@redis-ui/components 51.6.0 → 51.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SideBar/components/Group/components/Title/Title.style.cjs +3 -0
- package/dist/SideBar/components/Group/components/Title/Title.style.js +3 -0
- package/dist/SideBar/components/Item/Item.style.cjs +1 -1
- package/dist/SideBar/components/Item/Item.style.js +1 -1
- package/dist/SideBar/components/Item/components/Icon/Icon.cjs +12 -5
- package/dist/SideBar/components/Item/components/Icon/Icon.js +12 -5
- package/dist/SideBar/components/Item/components/Text/Text.cjs +1 -0
- package/dist/SideBar/components/Item/components/Text/Text.js +1 -0
- package/dist/SideBar/components/Item/components/Text/Text.style.cjs +11 -1
- package/dist/SideBar/components/Item/components/Text/Text.style.d.ts +1 -0
- package/dist/SideBar/components/Item/components/Text/Text.style.js +12 -2
- package/package.json +1 -1
- package/skills/redis-ui-components/references/SideBar.md +62 -1
|
@@ -18,6 +18,9 @@ var Label = (0, styled_components.default)(require_Typography.default.Body).with
|
|
|
18
18
|
""
|
|
19
19
|
], ({ $isExpanded, $transitionEnd }) => $isExpanded && $transitionEnd ? "1" : "0", () => require_SideBar_utils.useStateStyle((theme) => styled_components.css`
|
|
20
20
|
color: ${theme.groupTitle.textColor};
|
|
21
|
+
${theme.groupTitle.fontSize && styled_components.css`
|
|
22
|
+
font-size: ${theme.groupTitle.fontSize};
|
|
23
|
+
`}
|
|
21
24
|
`));
|
|
22
25
|
//#endregion
|
|
23
26
|
exports.Container = Container;
|
|
@@ -16,6 +16,9 @@ var Label = _styled(Typography.Body).withConfig({
|
|
|
16
16
|
""
|
|
17
17
|
], ({ $isExpanded, $transitionEnd }) => $isExpanded && $transitionEnd ? "1" : "0", () => useStateStyle((theme) => css`
|
|
18
18
|
color: ${theme.groupTitle.textColor};
|
|
19
|
+
${theme.groupTitle.fontSize && css`
|
|
20
|
+
font-size: ${theme.groupTitle.fontSize};
|
|
21
|
+
`}
|
|
19
22
|
`));
|
|
20
23
|
//#endregion
|
|
21
24
|
export { Container, Label };
|
|
@@ -30,7 +30,7 @@ var SideBarItem = styled_components.default.li.withConfig({
|
|
|
30
30
|
height: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.height};
|
|
31
31
|
padding: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.padding};
|
|
32
32
|
border-radius: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.borderRadius};
|
|
33
|
-
gap: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.gap};
|
|
33
|
+
gap: ${theme.gap ?? require_SideBar_constants.SIDEBAR_CONSTANTS.item.gap};
|
|
34
34
|
|
|
35
35
|
& {
|
|
36
36
|
${require_css_utils.styleFromTokens({
|
|
@@ -28,7 +28,7 @@ var SideBarItem = _styled.li.withConfig({
|
|
|
28
28
|
height: ${SIDEBAR_CONSTANTS.item.height};
|
|
29
29
|
padding: ${SIDEBAR_CONSTANTS.item.padding};
|
|
30
30
|
border-radius: ${SIDEBAR_CONSTANTS.item.borderRadius};
|
|
31
|
-
gap: ${SIDEBAR_CONSTANTS.item.gap};
|
|
31
|
+
gap: ${theme.gap ?? SIDEBAR_CONSTANTS.item.gap};
|
|
32
32
|
|
|
33
33
|
& {
|
|
34
34
|
${styleFromTokens({
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
const require_Icon_style = require("./Icon.style.cjs");
|
|
2
|
+
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
2
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
4
|
//#region src/SideBar/components/Item/components/Icon/Icon.tsx
|
|
4
|
-
var Icon = ({ icon: ItemIcon, ...restProps }) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var Icon = ({ icon: ItemIcon, ...restProps }) => {
|
|
6
|
+
const { iconSize } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.sideBar.item;
|
|
7
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon_style.SideBarItemIcon, {
|
|
8
|
+
"aria-hidden": true,
|
|
9
|
+
...restProps,
|
|
10
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemIcon, {
|
|
11
|
+
size: "L",
|
|
12
|
+
customSize: iconSize
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
};
|
|
9
16
|
//#endregion
|
|
10
17
|
exports.default = Icon;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { SideBarItemIcon } from "./Icon.style.js";
|
|
2
|
+
import { useTheme } from "@redis-ui/styles";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region src/SideBar/components/Item/components/Icon/Icon.tsx
|
|
4
|
-
var Icon = ({ icon: ItemIcon, ...restProps }) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var Icon = ({ icon: ItemIcon, ...restProps }) => {
|
|
6
|
+
const { iconSize } = useTheme().components.sideBar.item;
|
|
7
|
+
return /* @__PURE__ */ jsx(SideBarItemIcon, {
|
|
8
|
+
"aria-hidden": true,
|
|
9
|
+
...restProps,
|
|
10
|
+
children: /* @__PURE__ */ jsx(ItemIcon, {
|
|
11
|
+
size: "L",
|
|
12
|
+
customSize: iconSize
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
};
|
|
9
16
|
//#endregion
|
|
10
17
|
export { Icon as default };
|
|
@@ -2,10 +2,20 @@ const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs")
|
|
|
2
2
|
const require_Typography = require("../../../../../Typography/Typography.cjs");
|
|
3
3
|
let styled_components = require("styled-components");
|
|
4
4
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
5
|
+
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
5
6
|
//#region src/SideBar/components/Item/components/Text/Text.style.ts
|
|
6
7
|
var SideBarItemText = (0, styled_components.default)(require_Typography.default.Body).withConfig({
|
|
7
8
|
displayName: "Textstyle__SideBarItemText",
|
|
8
9
|
componentId: "RedisUI__sc-17tjfvd-0"
|
|
9
|
-
})([
|
|
10
|
+
})([
|
|
11
|
+
"transition:opacity 0.4s;@media (prefers-reduced-motion:reduce){transition:none;}opacity:",
|
|
12
|
+
";",
|
|
13
|
+
""
|
|
14
|
+
], ({ $isExpanded, $transitionEnd }) => $isExpanded && $transitionEnd ? "1" : "0", ({ $useThemeFontSize }) => {
|
|
15
|
+
const { fontSize } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.sideBar.item;
|
|
16
|
+
return $useThemeFontSize && fontSize && styled_components.css`
|
|
17
|
+
font-size: ${fontSize};
|
|
18
|
+
`;
|
|
19
|
+
});
|
|
10
20
|
//#endregion
|
|
11
21
|
exports.SideBarItemText = SideBarItemText;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const SideBarItemText: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../../..").TypographyBodyProps & import("react").RefAttributes<HTMLElement>>, any, {
|
|
2
2
|
$isExpanded: boolean;
|
|
3
3
|
$transitionEnd: boolean;
|
|
4
|
+
$useThemeFontSize: boolean;
|
|
4
5
|
}, never>;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import Typography from "../../../../../Typography/Typography.js";
|
|
2
|
-
import _styled from "styled-components";
|
|
2
|
+
import _styled, { css } from "styled-components";
|
|
3
|
+
import { useTheme } from "@redis-ui/styles";
|
|
3
4
|
//#region src/SideBar/components/Item/components/Text/Text.style.ts
|
|
4
5
|
var SideBarItemText = _styled(Typography.Body).withConfig({
|
|
5
6
|
displayName: "Textstyle__SideBarItemText",
|
|
6
7
|
componentId: "RedisUI__sc-17tjfvd-0"
|
|
7
|
-
})([
|
|
8
|
+
})([
|
|
9
|
+
"transition:opacity 0.4s;@media (prefers-reduced-motion:reduce){transition:none;}opacity:",
|
|
10
|
+
";",
|
|
11
|
+
""
|
|
12
|
+
], ({ $isExpanded, $transitionEnd }) => $isExpanded && $transitionEnd ? "1" : "0", ({ $useThemeFontSize }) => {
|
|
13
|
+
const { fontSize } = useTheme().components.sideBar.item;
|
|
14
|
+
return $useThemeFontSize && fontSize && css`
|
|
15
|
+
font-size: ${fontSize};
|
|
16
|
+
`;
|
|
17
|
+
});
|
|
8
18
|
//#endregion
|
|
9
19
|
export { SideBarItemText };
|
package/package.json
CHANGED
|
@@ -92,7 +92,7 @@ The tooltip text is used as the collapsed label and tooltip placement defaults t
|
|
|
92
92
|
|
|
93
93
|
### SideBar.Item.Text Props
|
|
94
94
|
|
|
95
|
-
This slot inherits `TypographyBodyProps`. Use it for the sidebar item text label.
|
|
95
|
+
This slot inherits `TypographyBodyProps`. Use it for the sidebar item text label. Without a `size`, it takes the theme's sidebar item font size when the theme sets one, so items and `CollapseButton` stay the same size.
|
|
96
96
|
|
|
97
97
|
### SideBar.Item.Button Props
|
|
98
98
|
|
|
@@ -389,6 +389,66 @@ const [activeLink, setActiveLink] = useState(groups[0].items[0].content);
|
|
|
389
389
|
</SideBar>
|
|
390
390
|
```
|
|
391
391
|
|
|
392
|
+
### ThemeSizing
|
|
393
|
+
|
|
394
|
+
> Theme defaults next to a theme that sets the SideBar sizing keys.
|
|
395
|
+
|
|
396
|
+
```tsx
|
|
397
|
+
import { SideBar, Typography } from '@redis-ui/components';
|
|
398
|
+
import { Theme } from '@redis-ui/styles';
|
|
399
|
+
import { PanelLeftIcon } from '@redis-ui/icons';
|
|
400
|
+
import { ThemeProvider } from 'styled-components';
|
|
401
|
+
import { groups } from './SideBar.data';
|
|
402
|
+
|
|
403
|
+
const withSideBarSizing = (theme: Theme): Theme => ({
|
|
404
|
+
...theme,
|
|
405
|
+
components: {
|
|
406
|
+
...theme.components,
|
|
407
|
+
sideBar: {
|
|
408
|
+
...theme.components.sideBar,
|
|
409
|
+
item: { ...theme.components.sideBar.item, fontSize: '1.3rem', gap: '1.6rem', iconSize: '1.8rem' },
|
|
410
|
+
groupTitle: { ...theme.components.sideBar.groupTitle, fontSize: '1rem' }
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
const SizingSideBar = () => (
|
|
416
|
+
<SideBar isExpanded expandedWidth="24rem" showActiveIndicator={false} style={{ paddingTop: '1rem' }}>
|
|
417
|
+
<SideBar.ScrollContainer>
|
|
418
|
+
<SideBar.Group>
|
|
419
|
+
<SideBar.Group.Title>{groups[1].title}</SideBar.Group.Title>
|
|
420
|
+
<SideBar.ItemsContainer>
|
|
421
|
+
{groups[1].items.map((item, index) => (
|
|
422
|
+
<SideBar.Item
|
|
423
|
+
key={item.content}
|
|
424
|
+
isActive={index === 0}
|
|
425
|
+
tooltipProps={{ text: item.content, placement: 'right' }}
|
|
426
|
+
>
|
|
427
|
+
<SideBar.Item.Icon icon={item.icon} />
|
|
428
|
+
<SideBar.Item.Text>{item.content}</SideBar.Item.Text>
|
|
429
|
+
</SideBar.Item>
|
|
430
|
+
))}
|
|
431
|
+
</SideBar.ItemsContainer>
|
|
432
|
+
</SideBar.Group>
|
|
433
|
+
</SideBar.ScrollContainer>
|
|
434
|
+
<SideBar.Footer>
|
|
435
|
+
<SideBar.Divider fullWidth noMargin />
|
|
436
|
+
<SideBar.CollapseButton icon={PanelLeftIcon} onToggle={() => undefined} />
|
|
437
|
+
</SideBar.Footer>
|
|
438
|
+
</SideBar>
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
<>
|
|
442
|
+
<Typography.Body size="S">Theme defaults</Typography.Body>
|
|
443
|
+
<SizingSideBar />
|
|
444
|
+
|
|
445
|
+
<Typography.Body size="S">Theme sizing keys</Typography.Body>
|
|
446
|
+
<ThemeProvider theme={withSideBarSizing}>
|
|
447
|
+
<SizingSideBar />
|
|
448
|
+
</ThemeProvider>
|
|
449
|
+
</>
|
|
450
|
+
```
|
|
451
|
+
|
|
392
452
|
### HeaderAndFooter
|
|
393
453
|
|
|
394
454
|
> `Header` includes toggle button and. Set `onToggle` handler to switch expanded state.
|
|
@@ -611,3 +671,4 @@ const [expanded, setExpanded] = useState(true);
|
|
|
611
671
|
- `SideBar.Group` wraps a section's `Group.Title` (optional) and items so the title and the items stay together as one logical unit.
|
|
612
672
|
- `SideBar.Group.Title` labels a group of items. Pair `SideBar.Item.Badge` with `Item.Text` if you need to mark individual items as `NEW`, `BETA`, etc.
|
|
613
673
|
- **Theme Architecture (v17.0.0+)**: The SideBar theme uses a flattened structure where state-dependent theme properties (`collapseButton.border`, `collapseButton.right`, `footer.meta.visibility`, `footer.meta.whiteSpace`) are defined as `{ collapsed: string; expanded: string }` objects directly on the theme. Structural layout values (widths, heights, margins, paddings, gaps, radii, shadows) that don't vary across light/dark themes are defined in `SIDEBAR_CONSTANTS` rather than duplicated in each theme file. This eliminates the need for runtime theme merging and provides full type safety.
|
|
674
|
+
- **Optional sizing theme keys**: a theme can set `item.fontSize`, `item.gap`, `item.iconSize` and `groupTitle.fontSize` to resize the sidebar. `item.gap` replaces `SIDEBAR_CONSTANTS.item.gap`, `item.iconSize` replaces the `L` icon size, `item.fontSize` applies to `Item.Text` without a `size` (including `CollapseButton`), and `groupTitle.fontSize` replaces the `S` group title size. Themes that leave them unset keep the defaults; the Next themes set them for Ultra.
|