Skip to content

Commit 725d600

Browse files
committed
chore: update dependencies and improve sidebar component structure
- Updated various dependencies in package.json and bun.lock for better performance and security. - Refactored sidebar component to remove unnecessary state management and improve layout structure. - Enhanced sidebar styling for better responsiveness and visual consistency. - Cleaned up unused properties and optimized code in sidebar-related files.
1 parent 271366d commit 725d600

9 files changed

Lines changed: 94 additions & 161 deletions

File tree

bun.lock

Lines changed: 60 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
"@babel/preset-env": "^7.28.5",
1414
"@babel/preset-react": "^7.28.5",
1515
"@babel/preset-typescript": "^7.28.5",
16-
"@eslint/js": "^9.39.1",
16+
"@eslint/js": "^9.39.2",
1717
"@relative-ci/agent": "^4.3.1",
18-
"@sentry/react": "^10.29.0",
18+
"@sentry/react": "^10.30.0",
1919
"@sentry/tracing": "^7.120.4",
2020
"@types/bluebird": "^3.5.42",
21-
"@types/node": "^24.10.1",
21+
"@types/node": "^24.10.4",
2222
"@types/react": "^19.2.7",
2323
"@types/react-dom": "^19.2.3",
24-
"@typescript-eslint/eslint-plugin": "^8.48.1",
25-
"@typescript-eslint/parser": "^8.48.1",
26-
"autoprefixer": "^10.4.22",
24+
"@typescript-eslint/eslint-plugin": "^8.49.0",
25+
"@typescript-eslint/parser": "^8.49.0",
26+
"autoprefixer": "^10.4.23",
2727
"cssnano": "^7.1.2",
28-
"dompurify": "^3.3.0",
28+
"dompurify": "^3.3.1",
2929
"esbuild": "^0.27.1",
30-
"eslint": "^9.39.1",
30+
"eslint": "^9.39.2",
3131
"eslint-config-prettier": "^10.1.8",
3232
"eslint-plugin-import": "2.32.0",
33-
"eslint-plugin-jest": "^29.2.1",
33+
"eslint-plugin-jest": "^29.5.0",
3434
"eslint-plugin-jsx-a11y": "^6.10.2",
3535
"eslint-plugin-node": "11.1.0",
3636
"eslint-plugin-promise": "7.2.1",
@@ -47,10 +47,10 @@
4747
"postcss-reporter": "^7.1.0",
4848
"prettier": "^3.7.4",
4949
"pretty-quick": "^4.2.2",
50-
"react": "^19.2.1",
51-
"react-dom": "^19.2.1",
52-
"sass": "^1.94.2",
53-
"snyk": "^1.1301.0",
50+
"react": "^19.2.3",
51+
"react-dom": "^19.2.3",
52+
"sass": "^1.96.0",
53+
"snyk": "^1.1301.1",
5454
"stylelint": "16.26.1",
5555
"stylelint-config-sass-guidelines": "^12.1.0",
5656
"stylelint-order": "^7.0.0",
@@ -131,9 +131,9 @@
131131
"@vitejs/plugin-react-swc": "^4.2.2",
132132
"@vitest/coverage-v8": "^4.0.15",
133133
"browserslist": "^4.28.1",
134-
"knip": "^5.71.0",
134+
"knip": "^5.73.4",
135135
"lightningcss": "^1.30.2",
136-
"oxlint": "^1.31.0",
136+
"oxlint": "^1.32.0",
137137
"postcss-scss": "^4.0.9",
138138
"stylelint-config-prettier": "^9.0.5",
139139
"stylelint-config-recommended": "^17.0.0",

packages/documentation/common/hooks/useResponsiveColumns.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ export function useResponsiveColumns(
3737
width: 150,
3838
parseHtml: true,
3939
},
40-
{ name: 'optional', type: 'string' },
41-
{ name: 'type', type: 'string' },
4240
];
4341
}
4442

@@ -87,8 +85,6 @@ export function useResponsiveColumns(
8785
width: widths.default,
8886
parseHtml: true,
8987
},
90-
{ name: 'optional', type: 'string' },
91-
{ name: 'type', type: 'string' },
9288
];
9389
}
9490

packages/documentation/components/data-grid/code-strings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ const App = () => (
7676
/>
7777
);`;
7878

79+

packages/documentation/components/sidebar/code-strings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ export default function App() {
3636
return <Sidebar enableSearch focusable groups={groups} />;
3737
}`;
3838

39+

packages/lib/components/sidebar/sidebar-groups.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { CSSProperties, useMemo } from 'react';
1+
import React from 'react';
22
import { AccordionGroup } from '../accordion-group/accordion-group';
33
import { List } from '../list/list';
44
import { SidebarGroupsModel } from './sidebar-model';
@@ -11,19 +11,12 @@ const SidebarGroups: React.FunctionComponent<SidebarGroupsModel> = ({
1111
listMaxHeight,
1212
focusable,
1313
onSelection,
14-
sideBarHeight,
1514
sectionsCollapsible,
1615
icons,
1716
enableSearch,
1817
}) => {
19-
const groupsWrapperStyle = useMemo(() => {
20-
return {
21-
height: `${sideBarHeight}px`,
22-
} as CSSProperties;
23-
}, [sideBarHeight]);
24-
2518
return (
26-
<div className={styles.groups_wrapper} style={groupsWrapperStyle}>
19+
<div className={styles.groups_wrapper}>
2720
<AccordionGroup
2821
titles={groups.filter(grp => grp.visible).map(grp => grp.title)}
2922
expanded

packages/lib/components/sidebar/sidebar-model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,4 @@ export type SidebarGroupsModel = Pick<
4444
> & {
4545
groups: SidebarGroupModel[];
4646
onSelection: (option: ListOption[], id?: string) => void;
47-
sideBarHeight?: number;
4847
};

packages/lib/components/sidebar/sidebar.module.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ $searchbar-height: 40px;
66

77
.sidebar {
88
align-items: flex-start;
9-
109
display: flex;
10+
flex-direction: column;
1111
height: var(--sidebar-height, 100%);
12+
min-height: 100%;
1213
overflow: hidden;
1314
position: relative;
1415

@@ -70,6 +71,11 @@ $searchbar-height: 40px;
7071
}
7172

7273
.content_wrapper {
74+
display: flex;
75+
flex-direction: column;
76+
flex: 1;
77+
min-height: 0;
78+
7379
&.border {
7480
@extend %border;
7581
}
@@ -97,7 +103,8 @@ $searchbar-height: 40px;
97103
}
98104

99105
.groups_wrapper {
100-
height: calc(100% - $searchbar-height);
106+
flex: 1;
107+
min-height: 0;
101108
overflow-x: hidden;
102109
overflow-y: auto;
103110
padding-top: 0.2rem;

packages/lib/components/sidebar/sidebar.tsx

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,6 @@ const Sidebar: React.FunctionComponent<SidebarProps> = ({
4545
: []
4646
);
4747

48-
const [sidebarHeight, setSidebarHeight] = useState(0);
49-
50-
const ref = useRef<HTMLDivElement | null>(null);
51-
52-
// Stabilize onSelect callback to prevent infinite loops
53-
const onSelectRef = useRef(onSelect);
54-
useLayoutEffect(() => {
55-
onSelectRef.current = onSelect;
56-
});
57-
5848
const isDarkMode = useMemo(() => isDark(), []);
5949

6050
const handleSelection = useCallback(
@@ -71,7 +61,6 @@ const Sidebar: React.FunctionComponent<SidebarProps> = ({
7161
})),
7262
}));
7363

74-
// Find group from the updated state, not stale _groups
7564
updatedGroup = updated.find(grp => grp.id === groupId);
7665
return updated;
7766
});
@@ -120,25 +109,21 @@ const Sidebar: React.FunctionComponent<SidebarProps> = ({
120109
return {
121110
'--sidebar-height': Number.isInteger(height) ? `${height}px` : height,
122111
} as CSSProperties;
123-
}, []);
112+
}, [height]);
124113

125114
const contentWrapper = useMemo(() => {
126115
return classNames(styles.content_wrapper, {
127116
[styles.border]: border,
128117
});
129118
}, [border]);
130119

131-
const onRef = useCallback((node: HTMLDivElement) => {
132-
if (node) {
133-
ref.current = node;
134-
setSidebarHeight(
135-
node.clientHeight ? node.clientHeight : window.innerHeight
136-
);
137-
}
138-
}, []);
120+
const onSelectRef = useRef(onSelect);
121+
useLayoutEffect(() => {
122+
onSelectRef.current = onSelect;
123+
});
139124

140125
return (
141-
<div className={sideBarClass} style={style} ref={onRef}>
126+
<div className={sideBarClass} style={style}>
142127
<div className={contentWrapper}>
143128
{enableSearch && (
144129
<div className={styles.search_wrapper}>
@@ -160,7 +145,6 @@ const Sidebar: React.FunctionComponent<SidebarProps> = ({
160145
onSelection={handleSelection}
161146
groupIconColor={groupIconColor}
162147
groupTitleColor={groupTitleColor}
163-
sideBarHeight={sidebarHeight}
164148
listMaxHeight={listMaxHeight}
165149
sectionsCollapsible={sectionsCollapsible}
166150
icons={icons}

0 commit comments

Comments
 (0)