@redis-ui/components 51.3.1 → 51.5.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/Button/ActionIconButton/ActionIconButton.style.cjs +5 -1
- package/dist/Button/ActionIconButton/ActionIconButton.style.js +6 -2
- package/dist/Button/Button.style.cjs +11 -1
- package/dist/Button/Button.style.js +11 -1
- package/dist/Chip/components/Compose/Compose.style.cjs +5 -1
- package/dist/Chip/components/Compose/Compose.style.js +6 -2
- package/dist/Inputs/components/Compose/Compose.style.cjs +17 -2
- package/dist/Inputs/components/Compose/Compose.style.js +17 -2
- package/dist/Menu/components/Content/Content.style.cjs +1 -0
- package/dist/Menu/components/Content/Content.style.js +1 -0
- package/dist/Modal/components/Content/components/Compose/Compose.style.cjs +7 -2
- package/dist/Modal/components/Content/components/Compose/Compose.style.js +7 -2
- package/dist/Popover/components/Content/components/Compose/Compose.style.cjs +1 -0
- package/dist/Popover/components/Content/components/Compose/Compose.style.js +1 -0
- package/dist/Popover/components/Content/components/Text/Text.style.cjs +4 -1
- package/dist/Popover/components/Content/components/Text/Text.style.js +4 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.cjs +15 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.js +15 -1
- package/dist/SideBar/SideBar.cjs +5 -2
- package/dist/SideBar/SideBar.d.ts +2 -1
- package/dist/SideBar/SideBar.js +5 -2
- package/dist/SideBar/SideBar.types.d.ts +3 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.cjs +32 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.d.ts +3 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.js +32 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.style.cjs +16 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.style.d.ts +4 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.style.js +13 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.types.d.ts +8 -0
- package/dist/SideBar/components/CollapseButton/CollapseButton.types.js +1 -0
- package/dist/SideBar/components/Item/Item.cjs +3 -2
- package/dist/SideBar/components/Item/Item.js +3 -2
- package/dist/SideBar/components/Item/Item.style.cjs +13 -11
- package/dist/SideBar/components/Item/Item.style.d.ts +3 -1
- package/dist/SideBar/components/Item/Item.style.js +13 -11
- package/dist/Tooltip/components/Content/components/Compose/Compose.style.cjs +17 -0
- package/dist/Tooltip/components/Content/components/Compose/Compose.style.js +17 -0
- package/package.json +1 -1
- package/skills/redis-ui-components/references/SideBar.md +60 -0
- package/skills/redis-ui-components/references/Tooltip.md +2 -1
|
@@ -13,7 +13,11 @@ var getSizeStyle = (size) => (theme) => {
|
|
|
13
13
|
height: ${themeSize.size};
|
|
14
14
|
` : null;
|
|
15
15
|
};
|
|
16
|
-
var maps = [
|
|
16
|
+
var maps = [
|
|
17
|
+
require_Button_style_utils.bgColorMap,
|
|
18
|
+
require_Button_style_utils.textColorMap,
|
|
19
|
+
require_Button_style_utils.shadowBorderMap
|
|
20
|
+
];
|
|
17
21
|
var ActionIconButton = styled_components.default.button.withConfig({
|
|
18
22
|
displayName: "ActionIconButtonstyle__ActionIconButton",
|
|
19
23
|
componentId: "RedisUI__sc-147pxp7-0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { bgColorMap, getButtonStatesStyle, textColorMap } from "../Button.style.utils.js";
|
|
2
|
+
import { bgColorMap, getButtonStatesStyle, shadowBorderMap, textColorMap } from "../Button.style.utils.js";
|
|
3
3
|
import { baseButtonStyle } from "../Button.style.js";
|
|
4
4
|
import _styled, { css } from "styled-components";
|
|
5
5
|
import { useTheme } from "@redis-ui/styles";
|
|
@@ -12,7 +12,11 @@ var getSizeStyle = (size) => (theme) => {
|
|
|
12
12
|
height: ${themeSize.size};
|
|
13
13
|
` : null;
|
|
14
14
|
};
|
|
15
|
-
var maps = [
|
|
15
|
+
var maps = [
|
|
16
|
+
bgColorMap,
|
|
17
|
+
textColorMap,
|
|
18
|
+
shadowBorderMap
|
|
19
|
+
];
|
|
16
20
|
var ActionIconButton = _styled.button.withConfig({
|
|
17
21
|
displayName: "ActionIconButtonstyle__ActionIconButton",
|
|
18
22
|
componentId: "RedisUI__sc-147pxp7-0"
|
|
@@ -52,11 +52,21 @@ var Button = styled_components.default.button.withConfig({
|
|
|
52
52
|
";",
|
|
53
53
|
";",
|
|
54
54
|
";",
|
|
55
|
+
";",
|
|
55
56
|
";"
|
|
56
57
|
], baseButtonStyle, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.button.gap, ({ size }) => require_css_utils.styleFromTokens({
|
|
57
58
|
tokenMaps: sizeTokenMaps,
|
|
58
59
|
tokens: (0, _redislabsdev_redis_ui_styles.useTheme)().components.button.sizes[size]
|
|
59
|
-
}), ({ size }) => require_Body_style.useBodyStyles(size === "small" ? { $size: "S" } : void 0), ({
|
|
60
|
+
}), ({ size }) => require_Body_style.useBodyStyles(size === "small" ? { $size: "S" } : void 0), ({ size }) => {
|
|
61
|
+
const { sizes, pressTransform } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.button;
|
|
62
|
+
return styled_components.css`
|
|
63
|
+
${require_css_utils.styleFromTokens({
|
|
64
|
+
tokenMaps: [require_css_utils.tokenMaps.fontSize],
|
|
65
|
+
tokens: sizes[size]
|
|
66
|
+
})}
|
|
67
|
+
${pressTransform && `&:active:not(:disabled) { transform: ${pressTransform}; }`}
|
|
68
|
+
`;
|
|
69
|
+
}, ({ variant }) => require_Button_style_utils.getButtonStatesStyle((0, _redislabsdev_redis_ui_styles.useTheme)().components.button.variants[variant], variantTokenMaps));
|
|
60
70
|
//#endregion
|
|
61
71
|
exports.Button = Button;
|
|
62
72
|
Object.defineProperty(exports, "Button_style_exports", {
|
|
@@ -51,10 +51,20 @@ var Button = _styled.button.withConfig({
|
|
|
51
51
|
";",
|
|
52
52
|
";",
|
|
53
53
|
";",
|
|
54
|
+
";",
|
|
54
55
|
";"
|
|
55
56
|
], baseButtonStyle, () => useTheme().components.button.gap, ({ size }) => styleFromTokens({
|
|
56
57
|
tokenMaps: sizeTokenMaps,
|
|
57
58
|
tokens: useTheme().components.button.sizes[size]
|
|
58
|
-
}), ({ size }) => useBodyStyles(size === "small" ? { $size: "S" } : void 0), ({
|
|
59
|
+
}), ({ size }) => useBodyStyles(size === "small" ? { $size: "S" } : void 0), ({ size }) => {
|
|
60
|
+
const { sizes, pressTransform } = useTheme().components.button;
|
|
61
|
+
return css`
|
|
62
|
+
${styleFromTokens({
|
|
63
|
+
tokenMaps: [tokenMaps.fontSize],
|
|
64
|
+
tokens: sizes[size]
|
|
65
|
+
})}
|
|
66
|
+
${pressTransform && `&:active:not(:disabled) { transform: ${pressTransform}; }`}
|
|
67
|
+
`;
|
|
68
|
+
}, ({ variant }) => getButtonStatesStyle(useTheme().components.button.variants[variant], variantTokenMaps));
|
|
59
69
|
//#endregion
|
|
60
70
|
export { Button, Button_style_exports, baseButtonStyle };
|
|
@@ -15,7 +15,11 @@ var ChipContainer = styled_components.default.span.withConfig({
|
|
|
15
15
|
], ({ $variant, $disabled }) => {
|
|
16
16
|
const variantStyle = (0, _redislabsdev_redis_ui_styles.useTheme)().components.chip.variant[$variant][$disabled ? "disabled" : "normal"];
|
|
17
17
|
return require_css_utils.styleFromTokens({
|
|
18
|
-
tokenMaps: [
|
|
18
|
+
tokenMaps: [
|
|
19
|
+
require_Button_style_utils.bgColorMap,
|
|
20
|
+
require_Button_style_utils.textColorMap,
|
|
21
|
+
require_Button_style_utils.shadowBorderMap
|
|
22
|
+
],
|
|
19
23
|
tokens: variantStyle
|
|
20
24
|
});
|
|
21
25
|
}, ({ $size }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styleFromTokens } from "../../../Helpers/css.utils.js";
|
|
2
|
-
import { bgColorMap, textColorMap } from "../../../Button/Button.style.utils.js";
|
|
2
|
+
import { bgColorMap, shadowBorderMap, textColorMap } from "../../../Button/Button.style.utils.js";
|
|
3
3
|
import _styled, { css } from "styled-components";
|
|
4
4
|
import { useTheme } from "@redis-ui/styles";
|
|
5
5
|
//#region src/Chip/components/Compose/Compose.style.ts
|
|
@@ -13,7 +13,11 @@ var ChipContainer = _styled.span.withConfig({
|
|
|
13
13
|
], ({ $variant, $disabled }) => {
|
|
14
14
|
const variantStyle = useTheme().components.chip.variant[$variant][$disabled ? "disabled" : "normal"];
|
|
15
15
|
return styleFromTokens({
|
|
16
|
-
tokenMaps: [
|
|
16
|
+
tokenMaps: [
|
|
17
|
+
bgColorMap,
|
|
18
|
+
textColorMap,
|
|
19
|
+
shadowBorderMap
|
|
20
|
+
],
|
|
17
21
|
tokens: variantStyle
|
|
18
22
|
});
|
|
19
23
|
}, ({ $size }) => {
|
|
@@ -24,12 +24,23 @@ var getStateStyle = (theme) => {
|
|
|
24
24
|
})};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
${statesStyle.hover && styled_components.css`
|
|
28
|
+
&:hover {
|
|
29
|
+
${require_css_utils.styleFromTokens({
|
|
30
|
+
tokenMaps: maps,
|
|
31
|
+
tokens: statesStyle.hover,
|
|
32
|
+
fallbackTokens: statesStyle.normal
|
|
33
|
+
})};
|
|
34
|
+
}
|
|
35
|
+
`}
|
|
36
|
+
|
|
27
37
|
&:focus-within {
|
|
28
38
|
${require_css_utils.styleFromTokens({
|
|
29
39
|
tokenMaps: maps,
|
|
30
40
|
tokens: statesStyle.focused,
|
|
31
41
|
fallbackTokens: statesStyle.normal
|
|
32
42
|
})};
|
|
43
|
+
${theme.components.input.focusRing && `box-shadow: ${theme.components.input.focusRing};`}
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
&[data-status='error'] {
|
|
@@ -85,11 +96,15 @@ var CommonInputCompose = styled_components.default.div.attrs(() => ({ "data-stat
|
|
|
85
96
|
tokenMaps: [require_css_utils.tokenMaps.borderWidth, require_css_utils.tokenMaps.borderRadius],
|
|
86
97
|
tokens: (0, _redislabsdev_redis_ui_styles.useTheme)().components.input.variants[$variant],
|
|
87
98
|
fallbackTokens: (0, _redislabsdev_redis_ui_styles.useTheme)().components.input.variants.outline
|
|
88
|
-
}), ({ $variant }) =>
|
|
99
|
+
}), ({ $variant }) => {
|
|
100
|
+
const { focusRing } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.input;
|
|
101
|
+
return $variant !== "underline" ? void 0 : styled_components.css`
|
|
89
102
|
border-top-color: transparent;
|
|
90
103
|
border-right-color: transparent;
|
|
91
104
|
border-left-color: transparent;
|
|
92
|
-
|
|
105
|
+
${focusRing && "box-shadow: none;"}
|
|
106
|
+
`;
|
|
107
|
+
});
|
|
93
108
|
var ReadonlyValue = (0, styled_components.default)(require_Typography.default.Body).attrs(() => ({ readOnly: true })).withConfig({
|
|
94
109
|
displayName: "Composestyle__ReadonlyValue",
|
|
95
110
|
componentId: "RedisUI__sc-1vsempl-1"
|
|
@@ -22,12 +22,23 @@ var getStateStyle = (theme) => {
|
|
|
22
22
|
})};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
${statesStyle.hover && css`
|
|
26
|
+
&:hover {
|
|
27
|
+
${styleFromTokens({
|
|
28
|
+
tokenMaps: maps,
|
|
29
|
+
tokens: statesStyle.hover,
|
|
30
|
+
fallbackTokens: statesStyle.normal
|
|
31
|
+
})};
|
|
32
|
+
}
|
|
33
|
+
`}
|
|
34
|
+
|
|
25
35
|
&:focus-within {
|
|
26
36
|
${styleFromTokens({
|
|
27
37
|
tokenMaps: maps,
|
|
28
38
|
tokens: statesStyle.focused,
|
|
29
39
|
fallbackTokens: statesStyle.normal
|
|
30
40
|
})};
|
|
41
|
+
${theme.components.input.focusRing && `box-shadow: ${theme.components.input.focusRing};`}
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
&[data-status='error'] {
|
|
@@ -83,11 +94,15 @@ var CommonInputCompose = _styled.div.attrs(() => ({ "data-status": useFieldStatu
|
|
|
83
94
|
tokenMaps: [tokenMaps.borderWidth, tokenMaps.borderRadius],
|
|
84
95
|
tokens: useTheme().components.input.variants[$variant],
|
|
85
96
|
fallbackTokens: useTheme().components.input.variants.outline
|
|
86
|
-
}), ({ $variant }) =>
|
|
97
|
+
}), ({ $variant }) => {
|
|
98
|
+
const { focusRing } = useTheme().components.input;
|
|
99
|
+
return $variant !== "underline" ? void 0 : css`
|
|
87
100
|
border-top-color: transparent;
|
|
88
101
|
border-right-color: transparent;
|
|
89
102
|
border-left-color: transparent;
|
|
90
|
-
|
|
103
|
+
${focusRing && "box-shadow: none;"}
|
|
104
|
+
`;
|
|
105
|
+
});
|
|
91
106
|
var ReadonlyValue = _styled(Typography.Body).attrs(() => ({ readOnly: true })).withConfig({
|
|
92
107
|
displayName: "Composestyle__ReadonlyValue",
|
|
93
108
|
componentId: "RedisUI__sc-1vsempl-1"
|
|
@@ -21,6 +21,7 @@ var Container = (0, styled_components.default)(require_index.Content2).withConfi
|
|
|
21
21
|
background-color: ${style.bgColor};
|
|
22
22
|
box-shadow: ${style.shadow};
|
|
23
23
|
border-radius: ${style.borderRadius};
|
|
24
|
+
${style.borderColor && `border: 1px solid ${style.borderColor};`}
|
|
24
25
|
|
|
25
26
|
${require_DropdownArrow_style.Arrow} {
|
|
26
27
|
color: ${style.bgColor};
|
|
@@ -19,6 +19,7 @@ var Container = _styled(Content2).withConfig({
|
|
|
19
19
|
background-color: ${style.bgColor};
|
|
20
20
|
box-shadow: ${style.shadow};
|
|
21
21
|
border-radius: ${style.borderRadius};
|
|
22
|
+
${style.borderColor && `border: 1px solid ${style.borderColor};`}
|
|
22
23
|
|
|
23
24
|
${Arrow} {
|
|
24
25
|
color: ${style.bgColor};
|
|
@@ -25,6 +25,7 @@ var Container = (0, styled_components.default)(require_index.Content).withConfig
|
|
|
25
25
|
z-index: ${theme.core.zIndex.zIndex9998};
|
|
26
26
|
box-shadow: ${style.shadow};
|
|
27
27
|
border-radius: ${style.borderRadius};
|
|
28
|
+
${style.borderColor && `border: 1px solid ${style.borderColor};`}
|
|
28
29
|
position: fixed;
|
|
29
30
|
top: 50%;
|
|
30
31
|
left: 50%;
|
|
@@ -42,9 +43,13 @@ var ModalOverlay = styled_components.default.div.withConfig({
|
|
|
42
43
|
componentId: "RedisUI__sc-kuv5cc-1"
|
|
43
44
|
})([
|
|
44
45
|
"background:",
|
|
45
|
-
";
|
|
46
|
+
";",
|
|
47
|
+
" position:fixed;inset:0;z-index:",
|
|
46
48
|
";display:grid;place-items:center;overflow-y:auto;"
|
|
47
|
-
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.modal.overlay.bgColor, () =>
|
|
49
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.modal.overlay.bgColor, () => {
|
|
50
|
+
const { backdropFilter } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.modal.overlay;
|
|
51
|
+
return backdropFilter && `backdrop-filter: ${backdropFilter};`;
|
|
52
|
+
}, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.zIndex.zIndex9998);
|
|
48
53
|
//#endregion
|
|
49
54
|
exports.Container = Container;
|
|
50
55
|
exports.ModalOverlay = ModalOverlay;
|
|
@@ -23,6 +23,7 @@ var Container = _styled(Content).withConfig({
|
|
|
23
23
|
z-index: ${theme.core.zIndex.zIndex9998};
|
|
24
24
|
box-shadow: ${style.shadow};
|
|
25
25
|
border-radius: ${style.borderRadius};
|
|
26
|
+
${style.borderColor && `border: 1px solid ${style.borderColor};`}
|
|
26
27
|
position: fixed;
|
|
27
28
|
top: 50%;
|
|
28
29
|
left: 50%;
|
|
@@ -40,8 +41,12 @@ var ModalOverlay = _styled.div.withConfig({
|
|
|
40
41
|
componentId: "RedisUI__sc-kuv5cc-1"
|
|
41
42
|
})([
|
|
42
43
|
"background:",
|
|
43
|
-
";
|
|
44
|
+
";",
|
|
45
|
+
" position:fixed;inset:0;z-index:",
|
|
44
46
|
";display:grid;place-items:center;overflow-y:auto;"
|
|
45
|
-
], () => useTheme().components.modal.overlay.bgColor, () =>
|
|
47
|
+
], () => useTheme().components.modal.overlay.bgColor, () => {
|
|
48
|
+
const { backdropFilter } = useTheme().components.modal.overlay;
|
|
49
|
+
return backdropFilter && `backdrop-filter: ${backdropFilter};`;
|
|
50
|
+
}, () => useTheme().core.zIndex.zIndex9998);
|
|
46
51
|
//#endregion
|
|
47
52
|
export { Container, ModalOverlay };
|
|
@@ -34,6 +34,7 @@ var Content = (0, styled_components.default)(require_index.Content2).withConfig(
|
|
|
34
34
|
}
|
|
35
35
|
box-shadow: ${popoverTheme.shadow};
|
|
36
36
|
border-radius: ${popoverTheme.borderRadius};
|
|
37
|
+
${popoverTheme.borderColor && `border: 1px solid ${popoverTheme.borderColor};`}
|
|
37
38
|
overflow: hidden;
|
|
38
39
|
min-width: ${popoverTheme.minWidth};
|
|
39
40
|
max-width: ${$maxWidth || popoverTheme.maxWidth};
|
|
@@ -32,6 +32,7 @@ var Content = _styled(Content2).withConfig({
|
|
|
32
32
|
}
|
|
33
33
|
box-shadow: ${popoverTheme.shadow};
|
|
34
34
|
border-radius: ${popoverTheme.borderRadius};
|
|
35
|
+
${popoverTheme.borderColor && `border: 1px solid ${popoverTheme.borderColor};`}
|
|
35
36
|
overflow: hidden;
|
|
36
37
|
min-width: ${popoverTheme.minWidth};
|
|
37
38
|
max-width: ${$maxWidth || popoverTheme.maxWidth};
|
|
@@ -7,6 +7,9 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
7
7
|
var Text = (0, styled_components.default)(require_Typography.default.Body).withConfig({
|
|
8
8
|
displayName: "Textstyle__Text",
|
|
9
9
|
componentId: "RedisUI__sc-6foh1z-0"
|
|
10
|
-
})(["color:", ";"], () =>
|
|
10
|
+
})(["color:", ";"], () => {
|
|
11
|
+
const { popover, tooltip } = (0, _redislabsdev_redis_ui_styles.useTheme)().components;
|
|
12
|
+
return popover.textColor ?? tooltip.textColor;
|
|
13
|
+
});
|
|
11
14
|
//#endregion
|
|
12
15
|
exports.Text = Text;
|
|
@@ -5,6 +5,9 @@ import { useTheme } from "@redis-ui/styles";
|
|
|
5
5
|
var Text = _styled(Typography.Body).withConfig({
|
|
6
6
|
displayName: "Textstyle__Text",
|
|
7
7
|
componentId: "RedisUI__sc-6foh1z-0"
|
|
8
|
-
})(["color:", ";"], () =>
|
|
8
|
+
})(["color:", ";"], () => {
|
|
9
|
+
const { popover, tooltip } = useTheme().components;
|
|
10
|
+
return popover.textColor ?? tooltip.textColor;
|
|
11
|
+
});
|
|
9
12
|
//#endregion
|
|
10
13
|
export { Text };
|
|
@@ -22,7 +22,14 @@ var getStateStyle = (theme) => {
|
|
|
22
22
|
})};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
&:hover
|
|
25
|
+
&:hover {
|
|
26
|
+
${require_css_utils.styleFromTokens({
|
|
27
|
+
tokenMaps: maps,
|
|
28
|
+
tokens: statesStyle.hover ?? statesStyle.focused,
|
|
29
|
+
fallbackTokens: statesStyle.normal
|
|
30
|
+
})};
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
&:focus,
|
|
27
34
|
&:active {
|
|
28
35
|
${require_css_utils.styleFromTokens({
|
|
@@ -32,6 +39,13 @@ var getStateStyle = (theme) => {
|
|
|
32
39
|
})};
|
|
33
40
|
}
|
|
34
41
|
|
|
42
|
+
${theme.components.select.focusRing && styled_components.css`
|
|
43
|
+
&:focus-visible,
|
|
44
|
+
&[data-state='open'] {
|
|
45
|
+
box-shadow: ${theme.components.select.focusRing};
|
|
46
|
+
}
|
|
47
|
+
`}
|
|
48
|
+
|
|
35
49
|
&[data-state='open'] {
|
|
36
50
|
${require_css_utils.styleFromTokens({
|
|
37
51
|
tokenMaps: maps,
|
|
@@ -20,7 +20,14 @@ var getStateStyle = (theme) => {
|
|
|
20
20
|
})};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
&:hover
|
|
23
|
+
&:hover {
|
|
24
|
+
${styleFromTokens({
|
|
25
|
+
tokenMaps: maps,
|
|
26
|
+
tokens: statesStyle.hover ?? statesStyle.focused,
|
|
27
|
+
fallbackTokens: statesStyle.normal
|
|
28
|
+
})};
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
&:focus,
|
|
25
32
|
&:active {
|
|
26
33
|
${styleFromTokens({
|
|
@@ -30,6 +37,13 @@ var getStateStyle = (theme) => {
|
|
|
30
37
|
})};
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
${theme.components.select.focusRing && css`
|
|
41
|
+
&:focus-visible,
|
|
42
|
+
&[data-state='open'] {
|
|
43
|
+
box-shadow: ${theme.components.select.focusRing};
|
|
44
|
+
}
|
|
45
|
+
`}
|
|
46
|
+
|
|
33
47
|
&[data-state='open'] {
|
|
34
48
|
${styleFromTokens({
|
|
35
49
|
tokenMaps: maps,
|
package/dist/SideBar/SideBar.cjs
CHANGED
|
@@ -12,11 +12,12 @@ const require_Header = require("./components/Header/Header.cjs");
|
|
|
12
12
|
const require_ScrollContainer = require("./components/ScrollContainer/ScrollContainer.cjs");
|
|
13
13
|
const require_Footer = require("./components/Footer/Footer.cjs");
|
|
14
14
|
const require_Group = require("./components/Group/Group.cjs");
|
|
15
|
+
const require_CollapseButton = require("./components/CollapseButton/CollapseButton.cjs");
|
|
15
16
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
16
17
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
18
|
let react = require("react");
|
|
18
19
|
//#region src/SideBar/SideBar.tsx
|
|
19
|
-
var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
20
|
+
var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator = true, ...rest }) => {
|
|
20
21
|
const [transitionEnd, setTransitionEnd] = (0, react.useState)(true);
|
|
21
22
|
const prefersReducedMotion = (0, _redislabsdev_redis_ui_styles.usePrefersReducedMotion)();
|
|
22
23
|
const sidebarId = require_index.useId();
|
|
@@ -28,6 +29,7 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
28
29
|
transitionEnd,
|
|
29
30
|
handleTransitionChange,
|
|
30
31
|
isExpanded,
|
|
32
|
+
showActiveIndicator,
|
|
31
33
|
sidebarId
|
|
32
34
|
},
|
|
33
35
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Provider.default, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SideBar_style.SideBarContainer, {
|
|
@@ -53,7 +55,8 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
53
55
|
Button: require_Button.default,
|
|
54
56
|
Header: require_Header.default,
|
|
55
57
|
Footer: require_Footer.default,
|
|
56
|
-
Group: require_Group.default
|
|
58
|
+
Group: require_Group.default,
|
|
59
|
+
CollapseButton: require_CollapseButton.default
|
|
57
60
|
});
|
|
58
61
|
//#endregion
|
|
59
62
|
exports.default = SideBar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SideBarProps } from './SideBar.types';
|
|
2
|
-
declare const SideBar: (({ isExpanded, expandedWidth, ...rest }: SideBarProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
2
|
+
declare const SideBar: (({ isExpanded, expandedWidth, showActiveIndicator, ...rest }: SideBarProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
3
|
SideBarLogo: ({ logoIcon: LogoIcon, ...restProps }: import("./components/SideBarLogo/SideBarLogo.types").SideBarLogoProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
ItemsContainer: (props: import("./components/ItemsContainer/ItemsContainer.types").SideBarItemsContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
ScrollContainer: (props: import("./components/ScrollContainer/ScrollContainer.types").SideBarScrollContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,5 +21,6 @@ declare const SideBar: (({ isExpanded, expandedWidth, ...rest }: SideBarProps) =
|
|
|
21
21
|
Group: ((props: import("./components/Group/Group.types").SideBarGroupProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
22
22
|
Title: ({ children, ...rest }: import("./components/Group/components/Title/Title.types").SideBarGroupTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
};
|
|
24
|
+
CollapseButton: ({ onToggle, icon, collapseText, expandText, ...rest }: import("./components/CollapseButton/CollapseButton.types").SideBarCollapseButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
};
|
|
25
26
|
export default SideBar;
|
package/dist/SideBar/SideBar.js
CHANGED
|
@@ -12,11 +12,12 @@ import Header from "./components/Header/Header.js";
|
|
|
12
12
|
import ScrollContainer from "./components/ScrollContainer/ScrollContainer.js";
|
|
13
13
|
import Footer from "./components/Footer/Footer.js";
|
|
14
14
|
import Group from "./components/Group/Group.js";
|
|
15
|
+
import CollapseButton from "./components/CollapseButton/CollapseButton.js";
|
|
15
16
|
import { usePrefersReducedMotion } from "@redis-ui/styles";
|
|
16
17
|
import { jsx } from "react/jsx-runtime";
|
|
17
18
|
import { useState } from "react";
|
|
18
19
|
//#region src/SideBar/SideBar.tsx
|
|
19
|
-
var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
20
|
+
var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator = true, ...rest }) => {
|
|
20
21
|
const [transitionEnd, setTransitionEnd] = useState(true);
|
|
21
22
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
22
23
|
const sidebarId = useId();
|
|
@@ -28,6 +29,7 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
28
29
|
transitionEnd,
|
|
29
30
|
handleTransitionChange,
|
|
30
31
|
isExpanded,
|
|
32
|
+
showActiveIndicator,
|
|
31
33
|
sidebarId
|
|
32
34
|
},
|
|
33
35
|
children: /* @__PURE__ */ jsx(Provider, { children: /* @__PURE__ */ jsx(SideBarContainer, {
|
|
@@ -53,7 +55,8 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, ...rest }) => {
|
|
|
53
55
|
Button,
|
|
54
56
|
Header,
|
|
55
57
|
Footer,
|
|
56
|
-
Group
|
|
58
|
+
Group,
|
|
59
|
+
CollapseButton
|
|
57
60
|
});
|
|
58
61
|
//#endregion
|
|
59
62
|
export { SideBar as default };
|
|
@@ -3,9 +3,12 @@ import { FlexGroupProps } from '../Layouts';
|
|
|
3
3
|
export interface SideBarProps extends Omit<FlexGroupProps, 'direction'> {
|
|
4
4
|
isExpanded: boolean;
|
|
5
5
|
expandedWidth?: string;
|
|
6
|
+
/** Shows the line next to the active item. The active item keeps its background either way. */
|
|
7
|
+
showActiveIndicator?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export interface SideBarContextProps {
|
|
8
10
|
isExpanded: boolean;
|
|
11
|
+
showActiveIndicator: boolean;
|
|
9
12
|
transitionEnd: boolean;
|
|
10
13
|
handleTransitionChange: (end: boolean) => void;
|
|
11
14
|
sidebarId: string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const require_Tooltip = require("../../../Tooltip/Tooltip.cjs");
|
|
2
|
+
const require_ScreenReaderAnnounce = require("../../../ScreenReaderAnnounce/ScreenReaderAnnounce.cjs");
|
|
3
|
+
const require_SideBar_context = require("../../SideBar.context.cjs");
|
|
4
|
+
const require_Icon = require("../Item/components/Icon/Icon.cjs");
|
|
5
|
+
const require_Text = require("../Item/components/Text/Text.cjs");
|
|
6
|
+
const require_Item_style = require("../Item/Item.style.cjs");
|
|
7
|
+
const require_CollapseButton_style = require("./CollapseButton.style.cjs");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
//#region src/SideBar/components/CollapseButton/CollapseButton.tsx
|
|
10
|
+
var CollapseButton = ({ onToggle, icon, collapseText = "Collapse", expandText = "Expand sidebar", ...rest }) => {
|
|
11
|
+
const { isExpanded, handleTransitionChange, sidebarId } = require_SideBar_context.useSideBarContext();
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_CollapseButton_style.Container, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.default, {
|
|
13
|
+
placement: "right",
|
|
14
|
+
disabled: isExpanded,
|
|
15
|
+
content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Item_style.TooltipContent, { children: expandText }),
|
|
16
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_CollapseButton_style.CollapseButton, {
|
|
17
|
+
as: "button",
|
|
18
|
+
type: "button",
|
|
19
|
+
"aria-label": isExpanded ? void 0 : expandText,
|
|
20
|
+
"aria-controls": sidebarId,
|
|
21
|
+
"aria-expanded": isExpanded,
|
|
22
|
+
...rest,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
handleTransitionChange(false);
|
|
25
|
+
onToggle();
|
|
26
|
+
},
|
|
27
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.default, { icon }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.default, { children: collapseText })]
|
|
28
|
+
})
|
|
29
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScreenReaderAnnounce.ScreenReaderAnnounce, { text: isExpanded ? "Sidebar expanded" : "Sidebar collapsed" })] });
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.default = CollapseButton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Tooltip from "../../../Tooltip/Tooltip.js";
|
|
2
|
+
import { ScreenReaderAnnounce } from "../../../ScreenReaderAnnounce/ScreenReaderAnnounce.js";
|
|
3
|
+
import { useSideBarContext } from "../../SideBar.context.js";
|
|
4
|
+
import Icon from "../Item/components/Icon/Icon.js";
|
|
5
|
+
import Text from "../Item/components/Text/Text.js";
|
|
6
|
+
import { TooltipContent } from "../Item/Item.style.js";
|
|
7
|
+
import { CollapseButton as CollapseButton$1, Container } from "./CollapseButton.style.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/SideBar/components/CollapseButton/CollapseButton.tsx
|
|
10
|
+
var CollapseButton = ({ onToggle, icon, collapseText = "Collapse", expandText = "Expand sidebar", ...rest }) => {
|
|
11
|
+
const { isExpanded, handleTransitionChange, sidebarId } = useSideBarContext();
|
|
12
|
+
return /* @__PURE__ */ jsxs(Container, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
13
|
+
placement: "right",
|
|
14
|
+
disabled: isExpanded,
|
|
15
|
+
content: /* @__PURE__ */ jsx(TooltipContent, { children: expandText }),
|
|
16
|
+
children: /* @__PURE__ */ jsxs(CollapseButton$1, {
|
|
17
|
+
as: "button",
|
|
18
|
+
type: "button",
|
|
19
|
+
"aria-label": isExpanded ? void 0 : expandText,
|
|
20
|
+
"aria-controls": sidebarId,
|
|
21
|
+
"aria-expanded": isExpanded,
|
|
22
|
+
...rest,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
handleTransitionChange(false);
|
|
25
|
+
onToggle();
|
|
26
|
+
},
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Icon, { icon }), /* @__PURE__ */ jsx(Text, { children: collapseText })]
|
|
28
|
+
})
|
|
29
|
+
}), /* @__PURE__ */ jsx(ScreenReaderAnnounce, { text: isExpanded ? "Sidebar expanded" : "Sidebar collapsed" })] });
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { CollapseButton as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Item_style = require("../Item/Item.style.cjs");
|
|
3
|
+
let styled_components = require("styled-components");
|
|
4
|
+
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
5
|
+
//#region src/SideBar/components/CollapseButton/CollapseButton.style.ts
|
|
6
|
+
var Container = styled_components.default.div.withConfig({
|
|
7
|
+
displayName: "CollapseButtonstyle__Container",
|
|
8
|
+
componentId: "RedisUI__sc-1ukbtbz-0"
|
|
9
|
+
})(["display:flex;flex-direction:column;flex:none;"]);
|
|
10
|
+
var CollapseButton = (0, styled_components.default)(require_Item_style.SideBarItem).withConfig({
|
|
11
|
+
displayName: "CollapseButtonstyle__CollapseButton",
|
|
12
|
+
componentId: "RedisUI__sc-1ukbtbz-1"
|
|
13
|
+
})(["border:0;font:inherit;text-align:start;"]);
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.CollapseButton = CollapseButton;
|
|
16
|
+
exports.Container = Container;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SideBarItem } from "../Item/Item.style.js";
|
|
2
|
+
import _styled from "styled-components";
|
|
3
|
+
//#region src/SideBar/components/CollapseButton/CollapseButton.style.ts
|
|
4
|
+
var Container = _styled.div.withConfig({
|
|
5
|
+
displayName: "CollapseButtonstyle__Container",
|
|
6
|
+
componentId: "RedisUI__sc-1ukbtbz-0"
|
|
7
|
+
})(["display:flex;flex-direction:column;flex:none;"]);
|
|
8
|
+
var CollapseButton = _styled(SideBarItem).withConfig({
|
|
9
|
+
displayName: "CollapseButtonstyle__CollapseButton",
|
|
10
|
+
componentId: "RedisUI__sc-1ukbtbz-1"
|
|
11
|
+
})(["border:0;font:inherit;text-align:start;"]);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { CollapseButton, Container };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconType } from '@redis-ui/icons';
|
|
3
|
+
export interface SideBarCollapseButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> {
|
|
4
|
+
onToggle: () => void;
|
|
5
|
+
icon: IconType;
|
|
6
|
+
collapseText?: string;
|
|
7
|
+
expandText?: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,7 +10,7 @@ let react = require("react");
|
|
|
10
10
|
//#region src/SideBar/components/Item/Item.tsx
|
|
11
11
|
var Item = Object.assign(({ tooltipProps, isActive = false, onKeyDown, ...restProps }) => {
|
|
12
12
|
const itemRef = (0, react.useRef)(null);
|
|
13
|
-
const { isExpanded } = require_SideBar_context.useSideBarContext();
|
|
13
|
+
const { isExpanded, showActiveIndicator } = require_SideBar_context.useSideBarContext();
|
|
14
14
|
const activeLinkAttributes = isActive ? {
|
|
15
15
|
"data-state": "active",
|
|
16
16
|
"aria-current": "page"
|
|
@@ -29,7 +29,8 @@ var Item = Object.assign(({ tooltipProps, isActive = false, onKeyDown, ...restPr
|
|
|
29
29
|
...activeLinkAttributes,
|
|
30
30
|
tabIndex,
|
|
31
31
|
onKeyDown: handleKeyDown,
|
|
32
|
-
ref: itemRef
|
|
32
|
+
ref: itemRef,
|
|
33
|
+
$hasActiveIndicator: showActiveIndicator
|
|
33
34
|
});
|
|
34
35
|
return isExpanded ? item : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.default, {
|
|
35
36
|
...tooltipProps,
|
|
@@ -10,7 +10,7 @@ import { useRef } from "react";
|
|
|
10
10
|
//#region src/SideBar/components/Item/Item.tsx
|
|
11
11
|
var Item = Object.assign(({ tooltipProps, isActive = false, onKeyDown, ...restProps }) => {
|
|
12
12
|
const itemRef = useRef(null);
|
|
13
|
-
const { isExpanded } = useSideBarContext();
|
|
13
|
+
const { isExpanded, showActiveIndicator } = useSideBarContext();
|
|
14
14
|
const activeLinkAttributes = isActive ? {
|
|
15
15
|
"data-state": "active",
|
|
16
16
|
"aria-current": "page"
|
|
@@ -29,7 +29,8 @@ var Item = Object.assign(({ tooltipProps, isActive = false, onKeyDown, ...restPr
|
|
|
29
29
|
...activeLinkAttributes,
|
|
30
30
|
tabIndex,
|
|
31
31
|
onKeyDown: handleKeyDown,
|
|
32
|
-
ref: itemRef
|
|
32
|
+
ref: itemRef,
|
|
33
|
+
$hasActiveIndicator: showActiveIndicator
|
|
33
34
|
});
|
|
34
35
|
return isExpanded ? item : /* @__PURE__ */ jsx(Tooltip, {
|
|
35
36
|
...tooltipProps,
|
|
@@ -17,7 +17,7 @@ var SideBarItem = styled_components.default.li.withConfig({
|
|
|
17
17
|
";outline-offset:-",
|
|
18
18
|
";}",
|
|
19
19
|
";& > svg{transition:inherit;}"
|
|
20
|
-
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.focus.size, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.focus.color, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.focus.size, () => {
|
|
20
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.focus.size, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.focus.color, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.focus.size, ({ $hasActiveIndicator = true }) => {
|
|
21
21
|
return require_SideBar_utils.useStateStyle(({ item: theme }, state) => {
|
|
22
22
|
const { states } = theme;
|
|
23
23
|
return styled_components.css`
|
|
@@ -55,16 +55,18 @@ var SideBarItem = styled_components.default.li.withConfig({
|
|
|
55
55
|
})}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
${$hasActiveIndicator && styled_components.css`
|
|
59
|
+
&[data-state='active']::before {
|
|
60
|
+
content: '';
|
|
61
|
+
position: absolute;
|
|
62
|
+
left: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.activeIndicator.left};
|
|
63
|
+
top: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.activeIndicator.top};
|
|
64
|
+
bottom: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.activeIndicator.bottom};
|
|
65
|
+
width: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.activeIndicator.width};
|
|
66
|
+
background-color: ${theme.activeIndicator.bgColor};
|
|
67
|
+
border-radius: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.activeIndicator.borderRadius};
|
|
68
|
+
}
|
|
69
|
+
`}
|
|
68
70
|
`;
|
|
69
71
|
});
|
|
70
72
|
});
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare const SideBarItem: import("styled-components").StyledComponent<"li", any, {
|
|
1
|
+
export declare const SideBarItem: import("styled-components").StyledComponent<"li", any, {
|
|
2
|
+
$hasActiveIndicator?: boolean;
|
|
3
|
+
}, never>;
|
|
2
4
|
export declare const TooltipContent: import("styled-components").StyledComponent<(props: import("../../..").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element, any, {}, never>;
|
|
@@ -15,7 +15,7 @@ var SideBarItem = _styled.li.withConfig({
|
|
|
15
15
|
";outline-offset:-",
|
|
16
16
|
";}",
|
|
17
17
|
";& > svg{transition:inherit;}"
|
|
18
|
-
], () => useTheme().core.focus.size, () => useTheme().core.focus.color, () => useTheme().core.focus.size, () => {
|
|
18
|
+
], () => useTheme().core.focus.size, () => useTheme().core.focus.color, () => useTheme().core.focus.size, ({ $hasActiveIndicator = true }) => {
|
|
19
19
|
return useStateStyle(({ item: theme }, state) => {
|
|
20
20
|
const { states } = theme;
|
|
21
21
|
return css`
|
|
@@ -53,16 +53,18 @@ var SideBarItem = _styled.li.withConfig({
|
|
|
53
53
|
})}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
${$hasActiveIndicator && css`
|
|
57
|
+
&[data-state='active']::before {
|
|
58
|
+
content: '';
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: ${SIDEBAR_CONSTANTS.item.activeIndicator.left};
|
|
61
|
+
top: ${SIDEBAR_CONSTANTS.item.activeIndicator.top};
|
|
62
|
+
bottom: ${SIDEBAR_CONSTANTS.item.activeIndicator.bottom};
|
|
63
|
+
width: ${SIDEBAR_CONSTANTS.item.activeIndicator.width};
|
|
64
|
+
background-color: ${theme.activeIndicator.bgColor};
|
|
65
|
+
border-radius: ${SIDEBAR_CONSTANTS.item.activeIndicator.borderRadius};
|
|
66
|
+
}
|
|
67
|
+
`}
|
|
66
68
|
`;
|
|
67
69
|
});
|
|
68
70
|
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_BodyText_style = require("../../../../../Popover/components/Content/components/Body/components/BodyText/BodyText.style.cjs");
|
|
3
|
+
const require_Link_style = require("../../../../../Link/Link.style.cjs");
|
|
4
|
+
const require_HeaderTitle_style = require("../../../../../Popover/components/Content/components/Header/components/HeaderTitle/HeaderTitle.style.cjs");
|
|
2
5
|
const require_index = require("../../../../../node_modules/@radix-ui/react-tooltip/dist/index.cjs");
|
|
6
|
+
const require_Compose_style = require("../../../TooltipCard/components/Compose/Compose.style.cjs");
|
|
3
7
|
let styled_components = require("styled-components");
|
|
4
8
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
5
9
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -24,6 +28,19 @@ var Content = (0, styled_components.default)(require_index.Content2).withConfig(
|
|
|
24
28
|
const bgColor = $backgroundColor || tooltipTheme.bgColor;
|
|
25
29
|
return styled_components.css`
|
|
26
30
|
background-color: ${bgColor};
|
|
31
|
+
${!$backgroundColor && tooltipTheme.contentTextColor && styled_components.css`
|
|
32
|
+
color: ${tooltipTheme.contentTextColor};
|
|
33
|
+
|
|
34
|
+
${require_Compose_style.Content} {
|
|
35
|
+
${require_HeaderTitle_style.HeaderTitle},
|
|
36
|
+
${require_BodyText_style.HeaderTitle},
|
|
37
|
+
${require_Link_style.StyledLink},
|
|
38
|
+
${require_Link_style.StyledLink}:hover,
|
|
39
|
+
${require_Link_style.StyledLink}:active {
|
|
40
|
+
color: inherit;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`}
|
|
27
44
|
${Arrow} {
|
|
28
45
|
color: ${bgColor};
|
|
29
46
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { HeaderTitle } from "../../../../../Popover/components/Content/components/Body/components/BodyText/BodyText.style.js";
|
|
2
|
+
import { StyledLink } from "../../../../../Link/Link.style.js";
|
|
3
|
+
import { HeaderTitle as HeaderTitle$1 } from "../../../../../Popover/components/Content/components/Header/components/HeaderTitle/HeaderTitle.style.js";
|
|
1
4
|
import { Arrow2, Content2 } from "../../../../../node_modules/@radix-ui/react-tooltip/dist/index.js";
|
|
5
|
+
import { Content as Content$1 } from "../../../TooltipCard/components/Compose/Compose.style.js";
|
|
2
6
|
import _styled, { css } from "styled-components";
|
|
3
7
|
import { useTheme } from "@redis-ui/styles";
|
|
4
8
|
//#region src/Tooltip/components/Content/components/Compose/Compose.style.ts
|
|
@@ -22,6 +26,19 @@ var Content = _styled(Content2).withConfig({
|
|
|
22
26
|
const bgColor = $backgroundColor || tooltipTheme.bgColor;
|
|
23
27
|
return css`
|
|
24
28
|
background-color: ${bgColor};
|
|
29
|
+
${!$backgroundColor && tooltipTheme.contentTextColor && css`
|
|
30
|
+
color: ${tooltipTheme.contentTextColor};
|
|
31
|
+
|
|
32
|
+
${Content$1} {
|
|
33
|
+
${HeaderTitle$1},
|
|
34
|
+
${HeaderTitle},
|
|
35
|
+
${StyledLink},
|
|
36
|
+
${StyledLink}:hover,
|
|
37
|
+
${StyledLink}:active {
|
|
38
|
+
color: inherit;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`}
|
|
25
42
|
${Arrow} {
|
|
26
43
|
color: ${bgColor};
|
|
27
44
|
}
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import { SideBar } from '@redis-ui/components';
|
|
|
14
14
|
|------|------|---------|-------------|
|
|
15
15
|
| isExpanded | `boolean` | *required* | Controls whether the sidebar is expanded or collapsed |
|
|
16
16
|
| expandedWidth | `string` | design-system default | Overrides the sidebar width when expanded |
|
|
17
|
+
| showActiveIndicator | `boolean` | `true` | Shows the line next to the active item. The active item keeps its background either way |
|
|
17
18
|
|
|
18
19
|
The component also accepts all `FlexGroupProps` except `direction`, which is fixed to a vertical sidebar layout.
|
|
19
20
|
|
|
@@ -37,6 +38,7 @@ The component also accepts all `FlexGroupProps` except `direction`, which is fix
|
|
|
37
38
|
- `SideBar.Footer.MetaData` - Footer metadata container.
|
|
38
39
|
- `SideBar.Footer.Link` - Footer link rendered as body text.
|
|
39
40
|
- `SideBar.Footer.Text` - Small footer text.
|
|
41
|
+
- `SideBar.CollapseButton` - Full-width expand/collapse toggle styled like an item, for use in the footer instead of `SideBar.Header`.
|
|
40
42
|
|
|
41
43
|
### SideBar.Header Props
|
|
42
44
|
|
|
@@ -123,6 +125,17 @@ The group title also accepts standard `HTMLAttributes<HTMLDivElement>` except `c
|
|
|
123
125
|
The root button also inherits all `ButtonProps` from the base `Button` component.
|
|
124
126
|
The tooltip text is used as the collapsed label and tooltip placement defaults to `right`.
|
|
125
127
|
|
|
128
|
+
### SideBar.CollapseButton Props
|
|
129
|
+
|
|
130
|
+
| Prop | Type | Default | Description |
|
|
131
|
+
|------|------|---------|-------------|
|
|
132
|
+
| onToggle | `() => void` | *required* | Called when the button is pressed |
|
|
133
|
+
| icon | `IconType` | *required* | Icon shown in both states, typically `PanelLeftIcon` (requires `@redis-ui/icons` 10.3.0 or later) |
|
|
134
|
+
| collapseText | `string` | `'Collapse'` | Label shown while the sidebar is expanded |
|
|
135
|
+
| expandText | `string` | `'Expand sidebar'` | Accessible name and tooltip while the sidebar is collapsed |
|
|
136
|
+
|
|
137
|
+
The button also accepts standard `ButtonHTMLAttributes<HTMLButtonElement>` except `onClick`.
|
|
138
|
+
|
|
126
139
|
### SideBar.Footer Props
|
|
127
140
|
|
|
128
141
|
This footer wrapper inherits `ComposeElementProps`.
|
|
@@ -329,6 +342,53 @@ const [activeLink, setActiveLink] = useState(groups[0].items[0].content);
|
|
|
329
342
|
</SideBar>
|
|
330
343
|
```
|
|
331
344
|
|
|
345
|
+
### CollapseButtonAtBottom
|
|
346
|
+
|
|
347
|
+
> Without `SideBar.Header`, `SideBar.CollapseButton` in the footer takes over the expand/collapse toggle.
|
|
348
|
+
> `showActiveIndicator={false}` drops the line next to the active item and keeps its background.
|
|
349
|
+
|
|
350
|
+
```tsx
|
|
351
|
+
import { SideBar } from '@redis-ui/components';
|
|
352
|
+
import { PanelLeftIcon } from '@redis-ui/icons';
|
|
353
|
+
import { useState } from 'react';
|
|
354
|
+
import { groups } from './SideBar.data';
|
|
355
|
+
|
|
356
|
+
const [expanded, setExpanded] = useState(true);
|
|
357
|
+
const [activeLink, setActiveLink] = useState(groups[0].items[0].content);
|
|
358
|
+
|
|
359
|
+
<SideBar
|
|
360
|
+
isExpanded={expanded}
|
|
361
|
+
expandedWidth="24rem"
|
|
362
|
+
showActiveIndicator={false}
|
|
363
|
+
style={{ paddingTop: '1rem' }}
|
|
364
|
+
>
|
|
365
|
+
<SideBar.ScrollContainer>
|
|
366
|
+
{groups.map((group, groupIdx) => (
|
|
367
|
+
<SideBar.Group key={group.title ?? `group-${groupIdx}`}>
|
|
368
|
+
{group.title && <SideBar.Group.Title>{group.title}</SideBar.Group.Title>}
|
|
369
|
+
<SideBar.ItemsContainer>
|
|
370
|
+
{group.items.map((item) => (
|
|
371
|
+
<SideBar.Item
|
|
372
|
+
isActive={item.content === activeLink}
|
|
373
|
+
onClick={() => setActiveLink(item.content)}
|
|
374
|
+
key={item.content}
|
|
375
|
+
tooltipProps={{ text: item.content, placement: 'right' }}
|
|
376
|
+
>
|
|
377
|
+
<SideBar.Item.Icon icon={item.icon} />
|
|
378
|
+
<SideBar.Item.Text>{item.content}</SideBar.Item.Text>
|
|
379
|
+
</SideBar.Item>
|
|
380
|
+
))}
|
|
381
|
+
</SideBar.ItemsContainer>
|
|
382
|
+
</SideBar.Group>
|
|
383
|
+
))}
|
|
384
|
+
</SideBar.ScrollContainer>
|
|
385
|
+
<SideBar.Footer>
|
|
386
|
+
<SideBar.Divider fullWidth noMargin />
|
|
387
|
+
<SideBar.CollapseButton icon={PanelLeftIcon} onToggle={() => setExpanded(!expanded)} />
|
|
388
|
+
</SideBar.Footer>
|
|
389
|
+
</SideBar>
|
|
390
|
+
```
|
|
391
|
+
|
|
332
392
|
### HeaderAndFooter
|
|
333
393
|
|
|
334
394
|
> `Header` includes toggle button and. Set `onToggle` handler to switch expanded state.
|
|
@@ -97,7 +97,7 @@ import { Tooltip, TooltipProvider } from '@redis-ui/components';
|
|
|
97
97
|
| Prop | Type | Default | Description |
|
|
98
98
|
|------|------|---------|-------------|
|
|
99
99
|
| children | `React.ReactNode` | required | Tooltip content body |
|
|
100
|
-
| backgroundColor | `string` | - | Overrides the tooltip background color |
|
|
100
|
+
| backgroundColor | `string` | - | Overrides the tooltip background color; custom content and `Tooltip.Card` then keep their own text colors instead of the theme's tooltip content color |
|
|
101
101
|
| placement | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Tooltip side relative to the trigger |
|
|
102
102
|
| sideOffset | `number` | `5` | Gap between trigger and content |
|
|
103
103
|
| maxWidth | `string` | theme default | Maximum width of the tooltip panel |
|
|
@@ -631,6 +631,7 @@ function Render() {
|
|
|
631
631
|
- `Tooltip.Trigger` can wrap plain text, SVG, or multi-element triggers by setting `withButton`.
|
|
632
632
|
- `Tooltip.Compose` supports controlled and uncontrolled open state.
|
|
633
633
|
- `Tooltip.Content.Compose` defaults `placement` to `top`, `sideOffset` to `5`, `portal` to `document.body`, and `interactive` to `false`.
|
|
634
|
+
- When the theme sets `tooltip.contentTextColor` (the Redis Ultra themes do), custom content and the `Tooltip.Card` title, body and footer link use that color so they stay readable on the tooltip background. Passing `backgroundColor` opts out, and the content keeps its own colors.
|
|
634
635
|
- `Tooltip.Card.Header` hides the close button by default.
|
|
635
636
|
- `Tooltip.Card.Footer` renders nothing when both `link` and `actionButtonHandler` are missing.
|
|
636
637
|
- For async tooltip content, prefer `Popover` unless the tooltip interaction is required.
|