@redis-ui/components 51.9.3 → 51.11.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.
@@ -5,7 +5,7 @@ declare const Modal: (({ children, defaultOpen, onOpenChange, open, withButton,
5
5
  Compose: ({ persistent, onCancel, ...props }: import("./components/Content/components/Compose/Compose.types").ContentComposeProps) => import("react/jsx-runtime").JSX.Element;
6
6
  Header: (({ title, titleHidden, ...restProps }: import("./components/Content/components/Header/Header.types").ContentHeaderProps) => import("react/jsx-runtime").JSX.Element) & {
7
7
  Compose: (props: import("./components/Content/components/Header/components/Compose/Compose.types").ContentHeaderComposeProps) => import("react/jsx-runtime").JSX.Element;
8
- Title: ({ hidden, children, ...restProps }: import("./components/Content/components/Header/components/Title/Title.types").TitleProps) => import("react/jsx-runtime").JSX.Element;
8
+ Title: ({ hidden, size, children, ...restProps }: import("./components/Content/components/Header/components/Title/Title.types").TitleProps) => import("react/jsx-runtime").JSX.Element;
9
9
  };
10
10
  Description: (({ hidden, children, ...restProps }: import("./components/Content/components/Description/Description.types").ModalDescriptionProps & import("./components/Content/components/Description/Description.types").RestModalDescriptionProps) => import("react/jsx-runtime").JSX.Element | null) & {
11
11
  Text: (props: import("./components/Content/components/Description/components/Text/Text.types").ModalDescriptionTextProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,7 @@ declare const Content: (({ title, description, descriptionHidden, onCancel, prim
3
3
  Compose: ({ persistent, onCancel, ...props }: import("./components/Compose/Compose.types").ContentComposeProps) => import("react/jsx-runtime").JSX.Element;
4
4
  Header: (({ title, titleHidden, ...restProps }: import("./components/Header/Header.types").ContentHeaderProps) => import("react/jsx-runtime").JSX.Element) & {
5
5
  Compose: (props: import("./components/Header/components/Compose/Compose.types").ContentHeaderComposeProps) => import("react/jsx-runtime").JSX.Element;
6
- Title: ({ hidden, children, ...restProps }: import("./components/Header/components/Title/Title.types").TitleProps) => import("react/jsx-runtime").JSX.Element;
6
+ Title: ({ hidden, size, children, ...restProps }: import("./components/Header/components/Title/Title.types").TitleProps) => import("react/jsx-runtime").JSX.Element;
7
7
  };
8
8
  Description: (({ hidden, children, ...restProps }: import("./components/Description/Description.types").ModalDescriptionProps & import("./components/Description/Description.types").RestModalDescriptionProps) => import("react/jsx-runtime").JSX.Element | null) & {
9
9
  Text: (props: import("./components/Description/components/Text/Text.types").ModalDescriptionTextProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { ContentHeaderProps } from './Header.types';
2
2
  declare const Header: (({ title, titleHidden, ...restProps }: ContentHeaderProps) => import("react/jsx-runtime").JSX.Element) & {
3
3
  Compose: (props: import("./components/Compose/Compose.types").ContentHeaderComposeProps) => import("react/jsx-runtime").JSX.Element;
4
- Title: ({ hidden, children, ...restProps }: import("./components/Title/Title.types").TitleProps) => import("react/jsx-runtime").JSX.Element;
4
+ Title: ({ hidden, size, children, ...restProps }: import("./components/Title/Title.types").TitleProps) => import("react/jsx-runtime").JSX.Element;
5
5
  };
6
6
  export default Header;
@@ -2,14 +2,19 @@ const require_react_utils = require("../../../../../../../Helpers/react.utils.cj
2
2
  const require_index = require("../../../../../../../packages/components/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs");
3
3
  const require_index$1 = require("../../../../../../../node_modules/@radix-ui/react-dialog/dist/index.cjs");
4
4
  const require_Title_style = require("./Title.style.cjs");
5
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  //#region src/Modal/components/Content/components/Header/components/Title/Title.tsx
7
- var Title = ({ hidden = false, children, ...restProps }) => {
8
+ var Title = ({ hidden = false, size, children, ...restProps }) => {
9
+ const { titleSize, titleLineHeight } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.modal.header;
10
+ const resolvedSize = size ?? titleSize;
8
11
  const emptyContent = !require_react_utils.childrenToString(children)?.trim();
9
12
  const TitleComponent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.Title, {
10
13
  asChild: true,
11
14
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Title_style.Title, {
12
15
  "data-role": "dialog-heading",
16
+ size: resolvedSize,
17
+ $lineHeight: resolvedSize === titleSize ? titleLineHeight : void 0,
13
18
  ...restProps,
14
19
  children: emptyContent ? "dialog" : children
15
20
  })
@@ -1,3 +1,3 @@
1
1
  import { TitleProps } from './Title.types';
2
- declare const Title: ({ hidden, children, ...restProps }: TitleProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Title: ({ hidden, size, children, ...restProps }: TitleProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Title;
@@ -2,14 +2,19 @@ import { childrenToString } from "../../../../../../../Helpers/react.utils.js";
2
2
  import { VisuallyHidden } from "../../../../../../../packages/components/node_modules/@radix-ui/react-visually-hidden/dist/index.js";
3
3
  import { Title as Title$1 } from "../../../../../../../node_modules/@radix-ui/react-dialog/dist/index.js";
4
4
  import { Title as Title$2 } from "./Title.style.js";
5
+ import { useTheme } from "@redis-ui/styles";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  //#region src/Modal/components/Content/components/Header/components/Title/Title.tsx
7
- var Title = ({ hidden = false, children, ...restProps }) => {
8
+ var Title = ({ hidden = false, size, children, ...restProps }) => {
9
+ const { titleSize, titleLineHeight } = useTheme().components.modal.header;
10
+ const resolvedSize = size ?? titleSize;
8
11
  const emptyContent = !childrenToString(children)?.trim();
9
12
  const TitleComponent = /* @__PURE__ */ jsx(Title$1, {
10
13
  asChild: true,
11
14
  children: /* @__PURE__ */ jsx(Title$2, {
12
15
  "data-role": "dialog-heading",
16
+ size: resolvedSize,
17
+ $lineHeight: resolvedSize === titleSize ? titleLineHeight : void 0,
13
18
  ...restProps,
14
19
  children: emptyContent ? "dialog" : children
15
20
  })
@@ -7,6 +7,12 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
7
7
  var Title = (0, styled_components.default)(require_Typography.default.Heading).withConfig({
8
8
  displayName: "Titlestyle__Title",
9
9
  componentId: "RedisUI__sc-9hk6e2-0"
10
- })(["color:", ";"], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.modal.header.textColor);
10
+ })([
11
+ "color:",
12
+ ";",
13
+ ""
14
+ ], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.modal.header.textColor, ({ $lineHeight }) => $lineHeight && styled_components.css`
15
+ line-height: ${$lineHeight};
16
+ `);
11
17
  //#endregion
12
18
  exports.Title = Title;
@@ -1 +1,3 @@
1
- export declare const Title: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../../../../..").TypographyHeadingProps & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
1
+ export declare const Title: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../../../../../..").TypographyHeadingProps & import("react").RefAttributes<HTMLElement>>, any, {
2
+ $lineHeight?: string;
3
+ }, never>;
@@ -1,10 +1,16 @@
1
1
  import Typography from "../../../../../../../Typography/Typography.js";
2
- import _styled from "styled-components";
2
+ import _styled, { css } from "styled-components";
3
3
  import { useTheme } from "@redis-ui/styles";
4
4
  //#region src/Modal/components/Content/components/Header/components/Title/Title.style.ts
5
5
  var Title = _styled(Typography.Heading).withConfig({
6
6
  displayName: "Titlestyle__Title",
7
7
  componentId: "RedisUI__sc-9hk6e2-0"
8
- })(["color:", ";"], () => useTheme().components.modal.header.textColor);
8
+ })([
9
+ "color:",
10
+ ";",
11
+ ""
12
+ ], () => useTheme().components.modal.header.textColor, ({ $lineHeight }) => $lineHeight && css`
13
+ line-height: ${$lineHeight};
14
+ `);
9
15
  //#endregion
10
16
  export { Title };
@@ -18,10 +18,7 @@ var SIDEBAR_CONSTANTS = {
18
18
  },
19
19
  button: {
20
20
  height: "3.6rem",
21
- width: {
22
- collapsed: "3.6rem",
23
- expanded: "14.5rem"
24
- }
21
+ expandedWidth: "14.5rem"
25
22
  },
26
23
  collapseButton: {
27
24
  size: "2.2rem",
@@ -17,10 +17,7 @@ export declare const SIDEBAR_CONSTANTS: {
17
17
  };
18
18
  readonly button: {
19
19
  readonly height: "3.6rem";
20
- readonly width: {
21
- readonly collapsed: "3.6rem";
22
- readonly expanded: "14.5rem";
23
- };
20
+ readonly expandedWidth: "14.5rem";
24
21
  };
25
22
  readonly collapseButton: {
26
23
  readonly size: "2.2rem";
@@ -18,10 +18,7 @@ var SIDEBAR_CONSTANTS = {
18
18
  },
19
19
  button: {
20
20
  height: "3.6rem",
21
- width: {
22
- collapsed: "3.6rem",
23
- expanded: "14.5rem"
24
- }
21
+ expandedWidth: "14.5rem"
25
22
  },
26
23
  collapseButton: {
27
24
  size: "2.2rem",
@@ -9,10 +9,13 @@ styled_components = require_runtime.__toESM(styled_components, 1);
9
9
  var SideBarButton = (0, styled_components.default)(require_Button.default).withConfig({
10
10
  displayName: "Buttonstyle__SideBarButton",
11
11
  componentId: "RedisUI__sc-ngkny4-0"
12
- })(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => require_SideBar_utils.useStateStyle((theme, state) => styled_components.css`
13
- height: ${require_SideBar_constants.SIDEBAR_CONSTANTS.button.height};
14
- width: ${require_SideBar_constants.SIDEBAR_CONSTANTS.button.width[state]};
15
- `));
12
+ })(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => require_SideBar_utils.useStateStyle((theme, state) => {
13
+ const height = theme.button.height ?? require_SideBar_constants.SIDEBAR_CONSTANTS.button.height;
14
+ return styled_components.css`
15
+ height: ${height};
16
+ width: ${state === "collapsed" ? height : require_SideBar_constants.SIDEBAR_CONSTANTS.button.expandedWidth};
17
+ `;
18
+ }));
16
19
  var appear = styled_components.keyframes`
17
20
  0% {
18
21
  opacity:0;
@@ -7,10 +7,13 @@ import _styled, { css, keyframes } from "styled-components";
7
7
  var SideBarButton = _styled(Button).withConfig({
8
8
  displayName: "Buttonstyle__SideBarButton",
9
9
  componentId: "RedisUI__sc-ngkny4-0"
10
- })(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => useStateStyle((theme, state) => css`
11
- height: ${SIDEBAR_CONSTANTS.button.height};
12
- width: ${SIDEBAR_CONSTANTS.button.width[state]};
13
- `));
10
+ })(["flex-shrink:0;margin:0 auto;display:flex;position:relative;", " padding:0;transition:width 0.7s;min-width:unset;@media (prefers-reduced-motion:reduce){transition:none;}"], () => useStateStyle((theme, state) => {
11
+ const height = theme.button.height ?? SIDEBAR_CONSTANTS.button.height;
12
+ return css`
13
+ height: ${height};
14
+ width: ${state === "collapsed" ? height : SIDEBAR_CONSTANTS.button.expandedWidth};
15
+ `;
16
+ }));
14
17
  var appear = keyframes`
15
18
  0% {
16
19
  opacity:0;
@@ -21,13 +21,13 @@ var SideBarItem = styled_components.default.li.withConfig({
21
21
  return require_SideBar_utils.useStateStyle(({ item: theme }, state) => {
22
22
  const { states } = theme;
23
23
  return styled_components.css`
24
- margin: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.margin};
24
+ margin: ${theme.margin ?? require_SideBar_constants.SIDEBAR_CONSTANTS.item.margin};
25
25
  ${state === "expanded" && styled_components.css`
26
26
  :has(> button) {
27
27
  margin-inline-end: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.itemWithButtonOffset};
28
28
  }
29
29
  `}
30
- height: ${require_SideBar_constants.SIDEBAR_CONSTANTS.item.height};
30
+ height: ${theme.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
33
  gap: ${theme.gap ?? require_SideBar_constants.SIDEBAR_CONSTANTS.item.gap};
@@ -19,13 +19,13 @@ var SideBarItem = _styled.li.withConfig({
19
19
  return useStateStyle(({ item: theme }, state) => {
20
20
  const { states } = theme;
21
21
  return css`
22
- margin: ${SIDEBAR_CONSTANTS.item.margin};
22
+ margin: ${theme.margin ?? SIDEBAR_CONSTANTS.item.margin};
23
23
  ${state === "expanded" && css`
24
24
  :has(> button) {
25
25
  margin-inline-end: ${SIDEBAR_CONSTANTS.item.itemWithButtonOffset};
26
26
  }
27
27
  `}
28
- height: ${SIDEBAR_CONSTANTS.item.height};
28
+ height: ${theme.height ?? SIDEBAR_CONSTANTS.item.height};
29
29
  padding: ${SIDEBAR_CONSTANTS.item.padding};
30
30
  border-radius: ${SIDEBAR_CONSTANTS.item.borderRadius};
31
31
  gap: ${theme.gap ?? SIDEBAR_CONSTANTS.item.gap};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "51.9.3",
4
+ "version": "51.11.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@redis-ui/icons": "^8.0.0 || ^9.0.0 || ^10.0.0",
33
- "@redis-ui/styles": "^21.15.0",
33
+ "@redis-ui/styles": "^21.18.0",
34
34
  "react": "^18.0.0 || ^19.0.0",
35
35
  "react-dom": "^18.0.0 || ^19.0.0",
36
36
  "styled-components": "^5.0.0"
@@ -52,7 +52,7 @@ import { Modal } from '@redis-ui/components';
52
52
  | `Modal.Content.Header` | `titleHidden` | `boolean` | `false` | Hides the title visually while keeping it accessible |
53
53
  | `Modal.Content.Header.Compose` | `children` | `React.ReactNode` | required | Custom header container content |
54
54
  | `Modal.Content.Header.Title` | `hidden` | `boolean` | `false` | Hides the title visually while keeping the dialog title accessible |
55
- | `Modal.Content.Header.Title` | `Typography.Heading props` | - | - | Inherits the `Typography.Heading` prop surface |
55
+ | `Modal.Content.Header.Title` | `Typography.Heading props` | - | - | Inherits the `Typography.Heading` prop surface. `size` defaults to the theme `modal.header.titleSize` (`XL` classic, `L` next) |
56
56
  | `Modal.Content.Description` | `children` | `React.ReactNode` | required | Description content rendered below the title |
57
57
  | `Modal.Content.Description` | `hidden` | `boolean` | `false` | Hides the description visually while keeping it accessible |
58
58
  | `Modal.Content.Description.Text` | `Typography.Heading props` | - | - | Typography wrapper for description text, rendered at size `XS` |
@@ -82,7 +82,7 @@ The divider also accepts standard `HTMLAttributes<HTMLDivElement>` except `child
82
82
  | isActive | `boolean` | `false` | Marks the item as the active route/item and applies the design-system active visual treatment |
83
83
 
84
84
  The item also accepts standard `HTMLAttributes<HTMLLIElement>`.
85
- The tooltip text is used as the collapsed label and tooltip placement defaults to `right`.
85
+ The tooltip text is used as the collapsed label and tooltip placement defaults to `right`. Its height and margin come from the theme's `sideBar.item.height` and `sideBar.item.margin` when set (`3rem` and `0.1rem 0.5rem 0.1rem 1rem` in the Next themes), otherwise `3.2rem` and `0.2rem 0.5rem 0.2rem 1rem`.
86
86
 
87
87
  ### SideBar.Item.Icon Props
88
88
 
@@ -123,7 +123,7 @@ The group title also accepts standard `HTMLAttributes<HTMLDivElement>` except `c
123
123
  | buttonCollapsedIcon | `IconType` | `PlusIcon` | Icon shown while the sidebar is collapsed |
124
124
 
125
125
  The root button also inherits all `ButtonProps` from the base `Button` component.
126
- The tooltip text is used as the collapsed label and tooltip placement defaults to `right`.
126
+ The tooltip text is used as the collapsed label and tooltip placement defaults to `right`. Its height comes from the theme's `sideBar.button.height` when set (`3.4rem` in the Next themes), otherwise `3.6rem`. When the sidebar is collapsed, the button is square, so its width matches its height.
127
127
 
128
128
  ### SideBar.CollapseButton Props
129
129
 
@@ -396,7 +396,7 @@ const [activeLink, setActiveLink] = useState(groups[0].items[0].content);
396
396
  ```tsx
397
397
  import { SideBar, Typography } from '@redis-ui/components';
398
398
  import { Theme } from '@redis-ui/styles';
399
- import { PanelLeftIcon } from '@redis-ui/icons';
399
+ import { PanelLeftIcon, PlusIcon } from '@redis-ui/icons';
400
400
  import { ThemeProvider } from 'styled-components';
401
401
  import { groups } from './SideBar.data';
402
402
 
@@ -406,7 +406,15 @@ const withSideBarSizing = (theme: Theme): Theme => ({
406
406
  ...theme.components,
407
407
  sideBar: {
408
408
  ...theme.components.sideBar,
409
- item: { ...theme.components.sideBar.item, fontSize: '1.3rem', gap: '1.6rem', iconSize: '1.8rem' },
409
+ button: { ...theme.components.sideBar.button, height: '3.4rem' },
410
+ item: {
411
+ ...theme.components.sideBar.item,
412
+ fontSize: '1.3rem',
413
+ gap: '1.6rem',
414
+ iconSize: '1.8rem',
415
+ height: '3rem',
416
+ margin: '0.1rem 0.5rem 0.1rem 1rem'
417
+ },
410
418
  groupTitle: { ...theme.components.sideBar.groupTitle, fontSize: '1rem' }
411
419
  }
412
420
  }
@@ -414,6 +422,7 @@ const withSideBarSizing = (theme: Theme): Theme => ({
414
422
 
415
423
  const SizingSideBar = () => (
416
424
  <SideBar isExpanded expandedWidth="24rem" showActiveIndicator={false} style={{ paddingTop: '1rem' }}>
425
+ <SideBar.Button tooltipProps={{ text: 'New' }} buttonExpandedContent="New" buttonCollapsedIcon={PlusIcon} />
417
426
  <SideBar.ScrollContainer>
418
427
  <SideBar.Group>
419
428
  <SideBar.Group.Title>{groups[1].title}</SideBar.Group.Title>
@@ -671,4 +680,4 @@ const [expanded, setExpanded] = useState(true);
671
680
  - `SideBar.Group` wraps a section's `Group.Title` (optional) and items so the title and the items stay together as one logical unit.
672
681
  - `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.
673
682
  - **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.
683
+ - **Optional sizing theme keys**: a theme can set `button.height`, `item.fontSize`, `item.gap`, `item.iconSize`, `item.height`, `item.margin` and `groupTitle.fontSize` 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`), and `groupTitle.fontSize` replaces the `S` group title size. Themes that leave them unset keep the defaults; the Next themes set them for Ultra.