@redis-ui/components 51.29.0 → 51.31.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.
@@ -2,6 +2,6 @@ import { ChipProps } from './Chip.types';
2
2
  declare const Chip: (({ text, onClose, closeButtonTitle, ...restProps }: ChipProps) => import("react/jsx-runtime").JSX.Element) & {
3
3
  Compose: ({ size, variant, disabled, tooltip, ...restProps }: import("./components/Compose/Compose.types").RestChipComposeProps & import("./components/Compose/Compose.types").ChipComposeProps) => import("react/jsx-runtime").JSX.Element;
4
4
  Title: ({ size, ...restProps }: import("..").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element;
5
- CloseButton: ({ onClose, icon: Icon, title, ...restProps }: import("./components/CloseButton/CloseButton.types").RestChipCloseButtonProps & import("./components/CloseButton/CloseButton.types").ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
5
+ CloseButton: ({ onClose, icon, title, ...restProps }: import("./components/CloseButton/CloseButton.types").RestChipCloseButtonProps & import("./components/CloseButton/CloseButton.types").ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
6
6
  };
7
7
  export default Chip;
@@ -1,5 +1,6 @@
1
1
  const require_Chip_context = require("../../Chip.context.cjs");
2
2
  const require_CloseButton_style = require("./CloseButton.style.cjs");
3
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
3
4
  let react_jsx_runtime = require("react/jsx-runtime");
4
5
  let _redislabsdev_redis_ui_icons = require("@redis-ui/icons");
5
6
  //#region src/Chip/components/CloseButton/CloseButton.tsx
@@ -7,9 +8,15 @@ var sizeMapper = {
7
8
  S: "M",
8
9
  M: "L"
9
10
  };
10
- var CloseButton = ({ onClose, icon: Icon = _redislabsdev_redis_ui_icons.ToastCancelIcon, title = "Remove", ...restProps }) => {
11
+ var glyphIcons = {
12
+ circle: _redislabsdev_redis_ui_icons.ToastCancelIcon,
13
+ cross: _redislabsdev_redis_ui_icons.CancelSlimIcon
14
+ };
15
+ var CloseButton = ({ onClose, icon, title = "Remove", ...restProps }) => {
11
16
  const { size, variant, disabled } = require_Chip_context.useChipContext();
17
+ const { glyph = "circle", size: sizeStyle } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.chip.closeButton;
12
18
  if (!onClose || disabled) return null;
19
+ const Icon = icon ?? glyphIcons[glyph];
13
20
  const handleRemoveChip = (e) => {
14
21
  e.stopPropagation();
15
22
  onClose();
@@ -24,6 +31,7 @@ var CloseButton = ({ onClose, icon: Icon = _redislabsdev_redis_ui_icons.ToastCan
24
31
  ...restProps,
25
32
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
26
33
  size: sizeMapper[size],
34
+ customSize: sizeStyle[size].iconSize,
27
35
  "aria-hidden": true
28
36
  })
29
37
  });
@@ -1,2 +1,2 @@
1
1
  import { ChipCloseButtonProps, RestChipCloseButtonProps } from './CloseButton.types';
2
- export declare const CloseButton: ({ onClose, icon: Icon, title, ...restProps }: RestChipCloseButtonProps & ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const CloseButton: ({ onClose, icon, title, ...restProps }: RestChipCloseButtonProps & ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,15 +1,22 @@
1
1
  import { useChipContext } from "../../Chip.context.js";
2
2
  import { CloseButton as CloseButton$1 } from "./CloseButton.style.js";
3
+ import { useTheme } from "@redis-ui/styles";
3
4
  import { jsx } from "react/jsx-runtime";
4
- import { ToastCancelIcon } from "@redis-ui/icons";
5
+ import { CancelSlimIcon, ToastCancelIcon } from "@redis-ui/icons";
5
6
  //#region src/Chip/components/CloseButton/CloseButton.tsx
6
7
  var sizeMapper = {
7
8
  S: "M",
8
9
  M: "L"
9
10
  };
10
- var CloseButton = ({ onClose, icon: Icon = ToastCancelIcon, title = "Remove", ...restProps }) => {
11
+ var glyphIcons = {
12
+ circle: ToastCancelIcon,
13
+ cross: CancelSlimIcon
14
+ };
15
+ var CloseButton = ({ onClose, icon, title = "Remove", ...restProps }) => {
11
16
  const { size, variant, disabled } = useChipContext();
17
+ const { glyph = "circle", size: sizeStyle } = useTheme().components.chip.closeButton;
12
18
  if (!onClose || disabled) return null;
19
+ const Icon = icon ?? glyphIcons[glyph];
13
20
  const handleRemoveChip = (e) => {
14
21
  e.stopPropagation();
15
22
  onClose();
@@ -24,6 +31,7 @@ var CloseButton = ({ onClose, icon: Icon = ToastCancelIcon, title = "Remove", ..
24
31
  ...restProps,
25
32
  children: /* @__PURE__ */ jsx(Icon, {
26
33
  size: sizeMapper[size],
34
+ customSize: sizeStyle[size].iconSize,
27
35
  "aria-hidden": true
28
36
  })
29
37
  });
@@ -8,13 +8,23 @@ var CloseButton = styled_components.default.button.withConfig({
8
8
  componentId: "RedisUI__sc-1pnn9du-0"
9
9
  })([
10
10
  "",
11
- ";flex:none;border:none;cursor:pointer;background-color:transparent;display:flex;align-items:center;justify-content:center;padding:0;&:hover{background-color:transparent;}",
11
+ ";flex:none;border:none;cursor:pointer;background-color:transparent;display:flex;align-items:center;justify-content:center;padding:0;",
12
12
  ";"
13
13
  ], ({ $size, $variant }) => {
14
14
  const style = (0, _redislabsdev_redis_ui_styles.useTheme)().components.chip.closeButton;
15
+ const { color, hoverColor, hoverBgColor } = style.variant[$variant];
16
+ const { size, borderRadius, margin } = style.size[$size];
15
17
  return styled_components.css`
16
- color: ${style.variant[$variant].color};
17
- border-radius: ${style.size[$size].borderRadius};
18
+ color: ${color};
19
+ width: ${size};
20
+ height: ${size};
21
+ border-radius: ${borderRadius};
22
+ ${margin && `margin: ${margin};`}
23
+
24
+ &:hover {
25
+ background-color: ${hoverBgColor || "transparent"};
26
+ ${hoverColor && `color: ${hoverColor};`}
27
+ }
18
28
  `;
19
29
  }, (0, _redislabsdev_redis_ui_styles.getFocusStyle)("0px"));
20
30
  //#endregion
@@ -6,13 +6,23 @@ var CloseButton = _styled.button.withConfig({
6
6
  componentId: "RedisUI__sc-1pnn9du-0"
7
7
  })([
8
8
  "",
9
- ";flex:none;border:none;cursor:pointer;background-color:transparent;display:flex;align-items:center;justify-content:center;padding:0;&:hover{background-color:transparent;}",
9
+ ";flex:none;border:none;cursor:pointer;background-color:transparent;display:flex;align-items:center;justify-content:center;padding:0;",
10
10
  ";"
11
11
  ], ({ $size, $variant }) => {
12
12
  const style = useTheme().components.chip.closeButton;
13
+ const { color, hoverColor, hoverBgColor } = style.variant[$variant];
14
+ const { size, borderRadius, margin } = style.size[$size];
13
15
  return css`
14
- color: ${style.variant[$variant].color};
15
- border-radius: ${style.size[$size].borderRadius};
16
+ color: ${color};
17
+ width: ${size};
18
+ height: ${size};
19
+ border-radius: ${borderRadius};
20
+ ${margin && `margin: ${margin};`}
21
+
22
+ &:hover {
23
+ background-color: ${hoverBgColor || "transparent"};
24
+ ${hoverColor && `color: ${hoverColor};`}
25
+ }
16
26
  `;
17
27
  }, getFocusStyle("0px"));
18
28
  //#endregion
@@ -1,11 +1,15 @@
1
- const require_Typography = require("../../../Typography/Typography.cjs");
2
1
  const require_Chip_context = require("../../Chip.context.cjs");
2
+ const require_Title_style = require("./Title.style.cjs");
3
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
3
4
  let react_jsx_runtime = require("react/jsx-runtime");
4
5
  //#region src/Chip/components/Title/Title.tsx
5
6
  var Title = ({ size, ...restProps }) => {
6
7
  const context = require_Chip_context.useChipContext();
7
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default.Body, {
8
+ const { fontFamily, sizes } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.chip;
9
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Title_style.Title, {
8
10
  size: size ?? context.size,
11
+ $fontSize: size ? void 0 : sizes[context.size].fontSize,
12
+ $fontFamily: fontFamily,
9
13
  ellipsis: true,
10
14
  tooltipOnEllipsis: true,
11
15
  ...restProps
@@ -1,11 +1,15 @@
1
- import Typography from "../../../Typography/Typography.js";
2
1
  import { useChipContext } from "../../Chip.context.js";
2
+ import { Title as Title$1 } from "./Title.style.js";
3
+ import { useTheme } from "@redis-ui/styles";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  //#region src/Chip/components/Title/Title.tsx
5
6
  var Title = ({ size, ...restProps }) => {
6
7
  const context = useChipContext();
7
- return /* @__PURE__ */ jsx(Typography.Body, {
8
+ const { fontFamily, sizes } = useTheme().components.chip;
9
+ return /* @__PURE__ */ jsx(Title$1, {
8
10
  size: size ?? context.size,
11
+ $fontSize: size ? void 0 : sizes[context.size].fontSize,
12
+ $fontFamily: fontFamily,
9
13
  ellipsis: true,
10
14
  tooltipOnEllipsis: true,
11
15
  ...restProps
@@ -0,0 +1,15 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_Typography = require("../../../Typography/Typography.cjs");
3
+ let styled_components = require("styled-components");
4
+ styled_components = require_runtime.__toESM(styled_components, 1);
5
+ //#region src/Chip/components/Title/Title.style.ts
6
+ var Title = (0, styled_components.default)(require_Typography.default.Body).withConfig({
7
+ displayName: "Titlestyle__Title",
8
+ componentId: "RedisUI__sc-77iu4i-0"
9
+ })([
10
+ "",
11
+ " ",
12
+ ""
13
+ ], ({ $fontSize }) => $fontSize && `font-size: ${$fontSize};`, ({ $fontFamily }) => $fontFamily && `font-family: ${$fontFamily};`);
14
+ //#endregion
15
+ exports.Title = Title;
@@ -0,0 +1,4 @@
1
+ export declare const Title: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../..").TypographyBodyProps & import("react").RefAttributes<HTMLElement>>, any, {
2
+ $fontSize?: string;
3
+ $fontFamily?: string;
4
+ }, never>;
@@ -0,0 +1,13 @@
1
+ import Typography from "../../../Typography/Typography.js";
2
+ import _styled from "styled-components";
3
+ //#region src/Chip/components/Title/Title.style.ts
4
+ var Title = _styled(Typography.Body).withConfig({
5
+ displayName: "Titlestyle__Title",
6
+ componentId: "RedisUI__sc-77iu4i-0"
7
+ })([
8
+ "",
9
+ " ",
10
+ ""
11
+ ], ({ $fontSize }) => $fontSize && `font-size: ${$fontSize};`, ({ $fontFamily }) => $fontFamily && `font-family: ${$fontFamily};`);
12
+ //#endregion
13
+ export { Title };
@@ -18,13 +18,26 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
18
18
  let react_jsx_runtime = require("react/jsx-runtime");
19
19
  let react = require("react");
20
20
  //#region src/SideBar/SideBar.tsx
21
- var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator = true, ...rest }) => {
21
+ var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator = true, overlay = false, ...rest }) => {
22
22
  const [transitionEnd, setTransitionEnd] = (0, react.useState)(true);
23
23
  const prefersReducedMotion = (0, _redislabsdev_redis_ui_styles.usePrefersReducedMotion)();
24
24
  const sidebarId = require_index.useId();
25
25
  const handleTransitionChange = (end) => {
26
26
  setTransitionEnd(prefersReducedMotion ? true : end);
27
27
  };
28
+ const nav = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SideBar_style.SideBarContainer, {
29
+ component: "nav",
30
+ direction: "column",
31
+ gap: "0",
32
+ id: sidebarId,
33
+ onTransitionEnd: () => handleTransitionChange(true),
34
+ "data-state": isExpanded ? "expanded" : "collapsed",
35
+ "data-transition": transitionEnd ? "inactive" : "active",
36
+ "data-role": "nav-bar",
37
+ $expandedWidth: expandedWidth,
38
+ $overlay: overlay,
39
+ ...rest
40
+ });
28
41
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SideBar_context.SideBarContextProvider, {
29
42
  value: {
30
43
  transitionEnd,
@@ -33,17 +46,9 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator =
33
46
  showActiveIndicator,
34
47
  sidebarId
35
48
  },
36
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Provider.default, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SideBar_style.SideBarContainer, {
37
- component: "nav",
38
- direction: "column",
39
- gap: "0",
40
- id: sidebarId,
41
- onTransitionEnd: () => handleTransitionChange(true),
42
- "data-state": isExpanded ? "expanded" : "collapsed",
43
- "data-transition": transitionEnd ? "inactive" : "active",
44
- "data-role": "nav-bar",
45
- $expandedWidth: expandedWidth,
46
- ...rest
49
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Provider.default, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SideBar_style.OverlaySlot, {
50
+ $overlay: overlay,
51
+ children: nav
47
52
  }) })
48
53
  });
49
54
  }, {
@@ -1,5 +1,5 @@
1
1
  import { SideBarProps } from './SideBar.types';
2
- declare const SideBar: (({ isExpanded, expandedWidth, showActiveIndicator, ...rest }: SideBarProps) => import("react/jsx-runtime").JSX.Element) & {
2
+ declare const SideBar: (({ isExpanded, expandedWidth, showActiveIndicator, overlay, ...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;
@@ -4,7 +4,7 @@ import { FlexSplit } from "../Layouts/FlexSplit/FlexSplit.js";
4
4
  import { SideBarContextProvider } from "./SideBar.context.js";
5
5
  import SideBarLogo from "./components/SideBarLogo/SideBarLogo.js";
6
6
  import SideBarItemsContainer from "./components/ItemsContainer/ItemsContainer.js";
7
- import { SideBarContainer } from "./SideBar.style.js";
7
+ import { OverlaySlot, SideBarContainer } from "./SideBar.style.js";
8
8
  import Divider from "./components/Divider/Divider.js";
9
9
  import Item from "./components/Item/Item.js";
10
10
  import Button from "./components/Button/Button.js";
@@ -18,13 +18,26 @@ import { usePrefersReducedMotion } from "@redis-ui/styles";
18
18
  import { jsx } from "react/jsx-runtime";
19
19
  import { useState } from "react";
20
20
  //#region src/SideBar/SideBar.tsx
21
- var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator = true, ...rest }) => {
21
+ var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator = true, overlay = false, ...rest }) => {
22
22
  const [transitionEnd, setTransitionEnd] = useState(true);
23
23
  const prefersReducedMotion = usePrefersReducedMotion();
24
24
  const sidebarId = useId();
25
25
  const handleTransitionChange = (end) => {
26
26
  setTransitionEnd(prefersReducedMotion ? true : end);
27
27
  };
28
+ const nav = /* @__PURE__ */ jsx(SideBarContainer, {
29
+ component: "nav",
30
+ direction: "column",
31
+ gap: "0",
32
+ id: sidebarId,
33
+ onTransitionEnd: () => handleTransitionChange(true),
34
+ "data-state": isExpanded ? "expanded" : "collapsed",
35
+ "data-transition": transitionEnd ? "inactive" : "active",
36
+ "data-role": "nav-bar",
37
+ $expandedWidth: expandedWidth,
38
+ $overlay: overlay,
39
+ ...rest
40
+ });
28
41
  return /* @__PURE__ */ jsx(SideBarContextProvider, {
29
42
  value: {
30
43
  transitionEnd,
@@ -33,17 +46,9 @@ var SideBar = Object.assign(({ isExpanded, expandedWidth, showActiveIndicator =
33
46
  showActiveIndicator,
34
47
  sidebarId
35
48
  },
36
- children: /* @__PURE__ */ jsx(Provider, { children: /* @__PURE__ */ jsx(SideBarContainer, {
37
- component: "nav",
38
- direction: "column",
39
- gap: "0",
40
- id: sidebarId,
41
- onTransitionEnd: () => handleTransitionChange(true),
42
- "data-state": isExpanded ? "expanded" : "collapsed",
43
- "data-transition": transitionEnd ? "inactive" : "active",
44
- "data-role": "nav-bar",
45
- $expandedWidth: expandedWidth,
46
- ...rest
49
+ children: /* @__PURE__ */ jsx(Provider, { children: /* @__PURE__ */ jsx(OverlaySlot, {
50
+ $overlay: overlay,
51
+ children: nav
47
52
  }) })
48
53
  });
49
54
  }, {
@@ -22,11 +22,40 @@ var useRootStateStyle = (getStyle) => {
22
22
  var SideBarContainer = (0, styled_components.default)(require_FlexGroup.FlexGroup).withConfig({
23
23
  displayName: "SideBarstyle__SideBarContainer",
24
24
  componentId: "RedisUI__sc-suwica-0"
25
- })(["position:relative;height:100%;transition:width 0.6s;@media (prefers-reduced-motion:reduce){transition:none;}", ""], ({ $expandedWidth }) => useRootStateStyle((theme, state) => styled_components.css`
25
+ })([
26
+ "position:relative;height:100%;transition:width 0.6s;@media (prefers-reduced-motion:reduce){transition:none;}",
27
+ " ",
28
+ ""
29
+ ], ({ $expandedWidth }) => useRootStateStyle((theme, state) => styled_components.css`
26
30
  box-shadow: ${require_SideBar_constants.SIDEBAR_CONSTANTS.shadow};
27
31
  background-color: ${theme.bgColor};
28
32
  width: ${(state === "expanded" ? $expandedWidth : void 0) ?? require_SideBar_constants.SIDEBAR_CONSTANTS.width[state]};
29
33
  border-right: ${theme.borderRight};
30
- `));
34
+ `), ({ $overlay }) => {
35
+ const { zIndex, shadow } = (0, _redislabsdev_redis_ui_styles.useTheme)().core;
36
+ return $overlay && styled_components.css`
37
+ position: absolute;
38
+ top: 0;
39
+ left: 0;
40
+ z-index: ${zIndex.zIndex5};
41
+
42
+ &[data-state='expanded'] {
43
+ box-shadow: ${shadow.shadow1};
44
+ }
45
+ `;
46
+ });
47
+ var OverlaySlot = styled_components.default.div.withConfig({
48
+ displayName: "SideBarstyle__OverlaySlot",
49
+ componentId: "RedisUI__sc-suwica-1"
50
+ })(["", ""], ({ $overlay }) => $overlay ? styled_components.css`
51
+ position: relative;
52
+ flex-shrink: 0;
53
+ width: ${require_SideBar_constants.SIDEBAR_CONSTANTS.width.collapsed};
54
+ /* A height would stop a flex parent from stretching the slot, which has no in-flow content */
55
+ min-height: 100%;
56
+ ` : styled_components.css`
57
+ display: contents;
58
+ `);
31
59
  //#endregion
60
+ exports.OverlaySlot = OverlaySlot;
32
61
  exports.SideBarContainer = SideBarContainer;
@@ -1,3 +1,7 @@
1
1
  export declare const SideBarContainer: import("styled-components").StyledComponent<({ gap, direction, align, justify, wrap, ...restProps }: import("..").FlexGroupProps) => import("react/jsx-runtime").JSX.Element, any, {
2
2
  $expandedWidth?: string;
3
+ $overlay?: boolean;
4
+ }, never>;
5
+ export declare const OverlaySlot: import("styled-components").StyledComponent<"div", any, {
6
+ $overlay: boolean;
3
7
  }, never>;
@@ -20,11 +20,39 @@ var useRootStateStyle = (getStyle) => {
20
20
  var SideBarContainer = _styled(FlexGroup).withConfig({
21
21
  displayName: "SideBarstyle__SideBarContainer",
22
22
  componentId: "RedisUI__sc-suwica-0"
23
- })(["position:relative;height:100%;transition:width 0.6s;@media (prefers-reduced-motion:reduce){transition:none;}", ""], ({ $expandedWidth }) => useRootStateStyle((theme, state) => css`
23
+ })([
24
+ "position:relative;height:100%;transition:width 0.6s;@media (prefers-reduced-motion:reduce){transition:none;}",
25
+ " ",
26
+ ""
27
+ ], ({ $expandedWidth }) => useRootStateStyle((theme, state) => css`
24
28
  box-shadow: ${SIDEBAR_CONSTANTS.shadow};
25
29
  background-color: ${theme.bgColor};
26
30
  width: ${(state === "expanded" ? $expandedWidth : void 0) ?? SIDEBAR_CONSTANTS.width[state]};
27
31
  border-right: ${theme.borderRight};
28
- `));
32
+ `), ({ $overlay }) => {
33
+ const { zIndex, shadow } = useTheme().core;
34
+ return $overlay && css`
35
+ position: absolute;
36
+ top: 0;
37
+ left: 0;
38
+ z-index: ${zIndex.zIndex5};
39
+
40
+ &[data-state='expanded'] {
41
+ box-shadow: ${shadow.shadow1};
42
+ }
43
+ `;
44
+ });
45
+ var OverlaySlot = _styled.div.withConfig({
46
+ displayName: "SideBarstyle__OverlaySlot",
47
+ componentId: "RedisUI__sc-suwica-1"
48
+ })(["", ""], ({ $overlay }) => $overlay ? css`
49
+ position: relative;
50
+ flex-shrink: 0;
51
+ width: ${SIDEBAR_CONSTANTS.width.collapsed};
52
+ /* A height would stop a flex parent from stretching the slot, which has no in-flow content */
53
+ min-height: 100%;
54
+ ` : css`
55
+ display: contents;
56
+ `);
29
57
  //#endregion
30
- export { SideBarContainer };
58
+ export { OverlaySlot, SideBarContainer };
@@ -5,6 +5,8 @@ export interface SideBarProps extends Omit<FlexGroupProps, 'direction'> {
5
5
  expandedWidth?: string;
6
6
  /** Shows the line next to the active item. The active item keeps its background either way. */
7
7
  showActiveIndicator?: boolean;
8
+ /** Expands over the content next to it, like a drawer, instead of pushing it. The sidebar keeps its collapsed width in the layout. */
9
+ overlay?: boolean;
8
10
  }
9
11
  export interface SideBarContextProps {
10
12
  isExpanded: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "51.29.0",
4
+ "version": "51.31.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -147,7 +147,7 @@ const handleClose = () => {};
147
147
  ## Notes
148
148
 
149
149
  - `Chip.Compose` accepts either a simple tooltip string or full tooltip content props and wraps the chip in `Tooltip` only when `tooltip` is provided.
150
- - `Chip.CloseButton` defaults to the `ToastCancelIcon` icon and a `Remove` title.
150
+ - `Chip.CloseButton` defaults to a `Remove` title and to the icon the theme picks: `ToastCancelIcon` in `themes`, `CancelSlimIcon` in `themesNext`. Pass `icon` to override it.
151
151
  - `Chip.Title` uses `Typography.Body` internally and enables ellipsis tooltips automatically.
152
152
  - `flat` chips should not receive `onClose`; that variant is intentionally non-closable.
153
153
  - When a closable chip is disabled, the close button is hidden.
@@ -15,6 +15,7 @@ import { SideBar } from '@redis-ui/components';
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
17
  | showActiveIndicator | `boolean` | `true` | Shows the line next to the active item. The active item keeps its background either way |
18
+ | overlay | `boolean` | `false` | Expands over the content next to it, like a drawer, instead of pushing it. The sidebar keeps its collapsed width in the layout |
18
19
 
19
20
  The component also accepts all `FlexGroupProps` except `direction`, which is fixed to a vertical sidebar layout.
20
21
 
@@ -310,6 +311,38 @@ const [activeLink, setActiveLink] = useState(items.top[0].content);
310
311
  </SideBar>
311
312
  ```
312
313
 
314
+ ### Overlay
315
+
316
+ > With `overlay`, the expanded sidebar opens over the content next to it, like a drawer, instead of pushing it aside. The sidebar keeps its collapsed width in the layout and stretches to the height of the row. Use it on narrow screens.
317
+
318
+ ```tsx
319
+ import { SideBar, Typography } from '@redis-ui/components';
320
+ import { useState } from 'react';
321
+ import { RedisLogoDarkMinIcon } from '@redis-ui/icons/multicolor';
322
+ import { items } from './SideBar.data';
323
+
324
+ const [expanded, setExpanded] = useState(true);
325
+
326
+ <div style={{ display: 'flex' }}>
327
+ <SideBar isExpanded={expanded} overlay>
328
+ <SideBar.Header onToggle={() => setExpanded(!expanded)}>
329
+ <SideBar.SideBarLogo logoIcon={RedisLogoDarkMinIcon} />
330
+ </SideBar.Header>
331
+ <SideBar.ItemsContainer>
332
+ {items.top.map((item) => (
333
+ <SideBar.Item key={item.content} tooltipProps={{ text: item.content, placement: 'right' }}>
334
+ <SideBar.Item.Icon icon={item.icon} />
335
+ <SideBar.Item.Text>{item.content}</SideBar.Item.Text>
336
+ </SideBar.Item>
337
+ ))}
338
+ </SideBar.ItemsContainer>
339
+ </SideBar>
340
+ <div style={{ flex: 1, minHeight: '40rem', padding: '2rem', background: '#8881' }}>
341
+ <Typography.Body>The page content stays in place while the sidebar is open.</Typography.Body>
342
+ </div>
343
+ </div>
344
+ ```
345
+
313
346
  ### Groups
314
347
 
315
348
  > Sidebar items can be split into groups, each with an optional title label. Items inside a group may also render an optional `SideBar.Item.Badge` (e.g. `NEW`, `BETA`) to the right of the text.
@@ -780,6 +813,7 @@ const [activeLink, setActiveLink] = useState('Agent Memory');
780
813
 
781
814
  - `SideBar` is a collapsible navigation shell with a fixed header/footer layout and grouped content in the middle.
782
815
  - Hosts can override the expanded width by passing the `expandedWidth` prop.
816
+ - `overlay` makes the expanded sidebar float over the content next to it, like a drawer, with a shadow, instead of pushing the content aside. It keeps its collapsed width in the layout and fills the height of its parent, whether that comes from a set height or, in a flex row, from the content next to it. Hosts usually turn it on for narrow screens.
783
817
  - `SideBar.Header` needs an `onToggle` handler and should usually render `SideBar.SideBarLogo` inside it.
784
818
  - `SideBar.Footer` is typically used with `Footer.MetaData`; that metadata area is hidden when the sidebar is collapsed.
785
819
  - `SideBar.ScrollContainer` is intended for the middle content when vertical space is constrained, and the docs recommend using only one per sidebar.
@@ -795,4 +829,4 @@ const [activeLink, setActiveLink] = useState('Agent Memory');
795
829
  - `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.
796
830
  - **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.
797
831
  - **Optional sizing theme keys**: a theme can set `button.height`, `item.fontSize`, `item.gap`, `item.iconSize`, `item.height`, `item.margin`, `groupTitle.fontSize` and `groupTitle.letterSpacing` to resize the sidebar. `button.height` replaces `SIDEBAR_CONSTANTS.button.height` and also sets the collapsed `SideBar.Button` width, so it stays square. `item.gap`, `item.height` and `item.margin` replace the matching `SIDEBAR_CONSTANTS.item` values (for items and `CollapseButton`), `item.iconSize` replaces the `L` icon size, `item.fontSize` applies to `Item.Text` without a `size` (including `CollapseButton`), `groupTitle.fontSize` replaces the `S` group title size, and `groupTitle.letterSpacing` sets the group title letter spacing. `item.child.height` and `item.child.fontSize` size the items inside `SideBar.ExpandableItem.Items` (defaulting to `2.8rem` and `item.fontSize`). Themes that leave them unset keep the defaults; the Next themes set them for Ultra.
798
- - **Optional label color**: a theme can set `labelColor` on `item.states.normal`, `item.states.hover` and `item.states.active` to color `Item.Text` apart from the row. The row color (`textColor`) still applies to `Item.Icon`, the `ExpandableItem` chevron and anything else in the item, and `labelColor` only applies to an `Item.Text` without a `color` prop. Themes that leave it unset keep the text on the row color; the Next themes set it so the text matches the breadcrumbs while the icons keep the row color.
832
+ - **Optional label color**: a theme can set `labelColor` on `item.states.normal`, `item.states.hover` and `item.states.active` to color `Item.Text` apart from the row. The row color (`textColor`) still applies to `Item.Icon`, the `ExpandableItem` chevron and anything else in the item, and `labelColor` only applies to an `Item.Text` without a `color` prop. Themes that leave it unset keep the text on the row color; the Next themes set it so the text matches the breadcrumbs while the icons keep the row color. On hover, the Next themes turn both the text and the icon to the brand red.