@redis-ui/components 51.9.3 → 51.10.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.
@@ -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.10.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -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.