@dbcdk/react-components 0.0.210 → 0.0.212

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.
Files changed (61) hide show
  1. package/README.md +6 -1
  2. package/dist/components/button/Button.cjs +2 -1
  3. package/dist/components/button/Button.d.ts +6 -1
  4. package/dist/components/button/Button.js +2 -1
  5. package/dist/components/button/Button.module.css +14 -0
  6. package/dist/components/color-scheme-button/ColorSchemeButton.cjs +2 -2
  7. package/dist/components/color-scheme-button/ColorSchemeButton.js +2 -2
  8. package/dist/components/forms/file-upload/FileUpload.cjs +4 -0
  9. package/dist/components/forms/file-upload/FileUpload.js +4 -0
  10. package/dist/components/forms/form-select/FormSelect.cjs +4 -0
  11. package/dist/components/forms/form-select/FormSelect.d.ts +1 -1
  12. package/dist/components/forms/form-select/FormSelect.js +4 -0
  13. package/dist/components/forms/input/Input.cjs +4 -0
  14. package/dist/components/forms/input/Input.js +4 -0
  15. package/dist/components/forms/radio-buttons/RadioButtonGroup.cjs +6 -5
  16. package/dist/components/forms/radio-buttons/RadioButtonGroup.js +2 -5
  17. package/dist/components/forms/radio-buttons/RadioButtons.module.css +15 -0
  18. package/dist/components/forms/select/Select.cjs +4 -0
  19. package/dist/components/forms/select/Select.d.ts +1 -1
  20. package/dist/components/forms/select/Select.js +4 -0
  21. package/dist/components/forms/text-area/Textarea.cjs +4 -0
  22. package/dist/components/forms/text-area/Textarea.js +4 -0
  23. package/dist/components/forms/typeahead/Typeahead.cjs +109 -42
  24. package/dist/components/forms/typeahead/Typeahead.d.ts +6 -0
  25. package/dist/components/forms/typeahead/Typeahead.js +109 -42
  26. package/dist/components/forms/typeahead/Typeahead.module.css +16 -0
  27. package/dist/components/headline/CollapsibleHeadline.cjs +15 -18
  28. package/dist/components/headline/CollapsibleHeadline.d.ts +2 -2
  29. package/dist/components/headline/CollapsibleHeadline.js +15 -18
  30. package/dist/components/headline/Headline.module.css +22 -0
  31. package/dist/components/nav-bar/NavBar.d.ts +2 -1
  32. package/dist/components/sidebar/Sidebar.cjs +2 -1
  33. package/dist/components/sidebar/Sidebar.js +2 -1
  34. package/dist/components/sidebar/components/SidebarItem.cjs +36 -13
  35. package/dist/components/sidebar/components/SidebarItem.d.ts +5 -2
  36. package/dist/components/sidebar/components/SidebarItem.js +32 -13
  37. package/dist/components/sidebar/components/SidebarItem.module.css +16 -0
  38. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +43 -116
  39. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +5 -5
  40. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +44 -117
  41. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +17 -25
  42. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +40 -1
  43. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +3 -2
  44. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -2
  45. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +3 -2
  46. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +13 -10
  47. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +16 -22
  48. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +16 -22
  49. package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -1
  50. package/dist/components/sidebar/providers/SidebarProvider.cjs +9 -7
  51. package/dist/components/sidebar/providers/SidebarProvider.d.ts +2 -1
  52. package/dist/components/sidebar/providers/SidebarProvider.js +9 -7
  53. package/dist/components/theme-script/ThemeScript.cjs +1 -1
  54. package/dist/components/theme-script/ThemeScript.d.ts +1 -1
  55. package/dist/components/theme-script/ThemeScript.js +1 -1
  56. package/dist/hooks/useColorScheme.cjs +1 -1
  57. package/dist/hooks/useColorScheme.js +1 -1
  58. package/dist/hooks/useGetActiveTheme.cjs +1 -1
  59. package/dist/hooks/useGetActiveTheme.js +1 -1
  60. package/dist/styles/themes/dbc/colors.css +4 -4
  61. package/package.json +1 -1
@@ -5,27 +5,23 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var lucideReact = require('lucide-react');
6
6
  var react = require('react');
7
7
  var styles = require('./ExpandableSidebarItem.module.css');
8
- var Button = require('../../../button/Button');
9
8
  var SidebarProvider = require('../../providers/SidebarProvider');
10
- var ExpandableSidebarItem$1 = require('../expandable-sidebar-item/ExpandableSidebarItem');
11
9
  var SidebarItemContent = require('../sidebar-item-content/SidebarItemContent');
12
- var SidebarItem = require('../SidebarItem');
13
10
 
14
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
12
 
16
13
  var styles__default = /*#__PURE__*/_interopDefault(styles);
17
14
 
18
- const isGroup = (item) => item.type === "group";
19
- const isExpandable = (item) => item.type === "expandable";
20
15
  function ExpandableSidebarItem({
21
- items,
16
+ children,
22
17
  label,
23
18
  icon,
24
19
  badge,
25
- component: Component,
26
20
  href,
27
21
  iconWidth,
28
- truncateLabel
22
+ depth = 0,
23
+ truncateLabel,
24
+ enabled = true
29
25
  }) {
30
26
  const {
31
27
  defaultExpanded,
@@ -36,121 +32,52 @@ function ExpandableSidebarItem({
36
32
  collapseItem,
37
33
  isExpanded
38
34
  } = SidebarProvider.useSidebar();
39
- const [closing, setClosing] = react.useState(false);
40
- const expanded = react.useMemo(() => isExpanded(href), [href, isExpanded]);
35
+ const childrenId = react.useId();
36
+ const expanded = isExpanded(href);
37
+ const visible = expanded && !isSidebarCollapsed;
41
38
  react.useEffect(() => {
42
39
  if (defaultExpanded === null) return;
43
40
  if (defaultExpanded) expandItem(href);
44
41
  else collapseItem(href);
45
42
  }, [defaultExpanded, expandItem, collapseItem, href]);
46
- const commitCollapse = react.useCallback(() => {
47
- collapseItem(href);
48
- setClosing(false);
49
- }, [collapseItem, href]);
50
- const handleAnimationEnd = react.useCallback(() => {
51
- if (closing) commitCollapse();
52
- }, [closing, commitCollapse]);
53
- react.useEffect(() => {
54
- if (!closing) return;
55
- const timer = setTimeout(commitCollapse, 250);
56
- return () => clearTimeout(timer);
57
- }, [closing, commitCollapse]);
58
- const toggleAccordion = react.useCallback(
59
- (e, onlyExpand = false) => {
60
- e == null ? void 0 : e.preventDefault();
61
- e == null ? void 0 : e.stopPropagation();
62
- resetExpandAll();
63
- handleSidebarCollapseChange(false);
64
- if (!expanded) {
65
- expandItem(href);
66
- return;
67
- }
68
- if (!isSidebarCollapsed && !onlyExpand) {
69
- setClosing(true);
70
- }
71
- },
72
- [expanded, expandItem, href, handleSidebarCollapseChange, isSidebarCollapsed, resetExpandAll]
73
- );
74
- const renderNavItem = (item, key) => {
75
- var _a, _b;
76
- if (isGroup(item)) {
77
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.group, children: [
78
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.groupLabel, children: item.label }),
79
- (_a = item.children) == null ? void 0 : _a.map((child, idx) => renderNavItem(child, `${key}-${idx}`))
80
- ] }, key);
81
- }
82
- if (isExpandable(item)) {
83
- return /* @__PURE__ */ jsxRuntime.jsx(
84
- ExpandableSidebarItem$1.ExpandableSidebarItem,
85
- {
86
- items: (_b = item.children) != null ? _b : [],
87
- label: item.label,
88
- icon: item.icon,
89
- badge: item.badge,
90
- href: item.href,
91
- iconWidth: item.iconWidth,
92
- component: item.component
93
- },
94
- key
95
- );
96
- }
97
- return /* @__PURE__ */ jsxRuntime.jsx(
98
- SidebarItem.SidebarItem,
99
- {
100
- component: item.component,
101
- label: item.label,
102
- icon: item.icon,
103
- badge: item.badge,
104
- href: item.href,
105
- iconWidth: item.iconWidth,
106
- truncateLabel: item.truncateLabel
107
- },
108
- key
109
- );
110
- };
111
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.container}`, children: [
112
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.itemRow} ${expanded ? styles__default.default.itemRowExpanded : ""}`, children: [
113
- /* @__PURE__ */ jsxRuntime.jsx(Component, { onClick: () => toggleAccordion(void 0, true), children: /* @__PURE__ */ jsxRuntime.jsx(
114
- SidebarItemContent.SidebarItemContent,
115
- {
116
- headerStyle: expanded,
117
- icon,
118
- badge,
119
- iconWidth,
120
- label,
121
- href,
122
- disableActiveStyles: expanded,
123
- suffixIcon: !isSidebarCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(
124
- lucideReact.ChevronDown,
125
- {
126
- className: `${styles__default.default.chevron} ${expanded ? styles__default.default.chevronExpanded : ""}`
127
- }
128
- ) : void 0,
129
- truncateLabel
130
- }
131
- ) }),
132
- !isSidebarCollapsed && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.toggleButton, children: /* @__PURE__ */ jsxRuntime.jsx(
133
- Button.Button,
134
- {
135
- variant: "inline",
136
- shape: "round",
137
- className: styles__default.default.toggleButtonControl,
138
- "aria-label": expanded ? `Collapse ${label}` : `Expand ${label}`,
139
- "aria-expanded": expanded,
140
- "aria-controls": `${href}-children`,
141
- onClick: toggleAccordion
142
- }
143
- ) })
144
- ] }),
145
- expanded && !isSidebarCollapsed && /* @__PURE__ */ jsxRuntime.jsx(
146
- "div",
43
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.container, children: [
44
+ /* @__PURE__ */ jsxRuntime.jsx(
45
+ "button",
147
46
  {
148
- id: `${href}-children`,
149
- onAnimationEnd: handleAnimationEnd,
150
- className: `${styles__default.default.childrenContainer} ${closing ? "animate--collapse" : ""}`,
151
- children: items.map((item, idx) => renderNavItem(item, `${href}-${idx}`))
47
+ type: "button",
48
+ className: styles__default.default.toggleButton,
49
+ "aria-label": isSidebarCollapsed ? label : void 0,
50
+ "aria-expanded": visible,
51
+ "aria-controls": childrenId,
52
+ disabled: !enabled,
53
+ onClick: () => {
54
+ resetExpandAll();
55
+ handleSidebarCollapseChange(false);
56
+ if (visible) collapseItem(href);
57
+ else expandItem(href);
58
+ },
59
+ children: /* @__PURE__ */ jsxRuntime.jsx(
60
+ SidebarItemContent.SidebarItemContent,
61
+ {
62
+ icon,
63
+ badge,
64
+ depth,
65
+ iconWidth,
66
+ label,
67
+ disableActiveStyles: true,
68
+ suffixIcon: /* @__PURE__ */ jsxRuntime.jsx(
69
+ lucideReact.ChevronDown,
70
+ {
71
+ "aria-hidden": "true",
72
+ className: `${styles__default.default.chevron} ${visible ? styles__default.default.chevronExpanded : ""}`
73
+ }
74
+ ),
75
+ truncateLabel
76
+ }
77
+ )
152
78
  }
153
- )
79
+ ),
80
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: childrenId, hidden: !visible, className: styles__default.default.childrenContainer, children: visible ? children : null })
154
81
  ] });
155
82
  }
156
83
 
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
- import type { NavBarItem } from '../../../../components/nav-bar/NavBar';
3
2
  type ExpandableSidebarItemProps = {
4
- items: NavBarItem[];
3
+ children: React.ReactNode;
5
4
  label: string;
6
- component: React.ElementType;
7
- icon: React.ReactNode;
5
+ icon?: React.ReactNode;
8
6
  badge?: number | string;
9
7
  href: string;
8
+ depth?: number;
10
9
  iconWidth?: string | number;
11
10
  truncateLabel?: boolean;
11
+ enabled?: boolean;
12
12
  };
13
- export declare function ExpandableSidebarItem({ items, label, icon, badge, component: Component, href, iconWidth, truncateLabel, }: ExpandableSidebarItemProps): React.ReactNode;
13
+ export declare function ExpandableSidebarItem({ children, label, icon, badge, href, iconWidth, depth, truncateLabel, enabled, }: ExpandableSidebarItemProps): React.ReactNode;
14
14
  export {};
@@ -1,25 +1,21 @@
1
1
  'use client';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { ChevronDown } from 'lucide-react';
4
- import { useState, useMemo, useEffect, useCallback } from 'react';
4
+ import { useId, useEffect } from 'react';
5
5
  import styles from './ExpandableSidebarItem.module.css';
6
- import { Button } from '../../../button/Button';
7
6
  import { useSidebar } from '../../providers/SidebarProvider';
8
- import { ExpandableSidebarItem as ExpandableSidebarItem$1 } from '../expandable-sidebar-item/ExpandableSidebarItem';
9
7
  import { SidebarItemContent } from '../sidebar-item-content/SidebarItemContent';
10
- import { SidebarItem } from '../SidebarItem';
11
8
 
12
- const isGroup = (item) => item.type === "group";
13
- const isExpandable = (item) => item.type === "expandable";
14
9
  function ExpandableSidebarItem({
15
- items,
10
+ children,
16
11
  label,
17
12
  icon,
18
13
  badge,
19
- component: Component,
20
14
  href,
21
15
  iconWidth,
22
- truncateLabel
16
+ depth = 0,
17
+ truncateLabel,
18
+ enabled = true
23
19
  }) {
24
20
  const {
25
21
  defaultExpanded,
@@ -30,121 +26,52 @@ function ExpandableSidebarItem({
30
26
  collapseItem,
31
27
  isExpanded
32
28
  } = useSidebar();
33
- const [closing, setClosing] = useState(false);
34
- const expanded = useMemo(() => isExpanded(href), [href, isExpanded]);
29
+ const childrenId = useId();
30
+ const expanded = isExpanded(href);
31
+ const visible = expanded && !isSidebarCollapsed;
35
32
  useEffect(() => {
36
33
  if (defaultExpanded === null) return;
37
34
  if (defaultExpanded) expandItem(href);
38
35
  else collapseItem(href);
39
36
  }, [defaultExpanded, expandItem, collapseItem, href]);
40
- const commitCollapse = useCallback(() => {
41
- collapseItem(href);
42
- setClosing(false);
43
- }, [collapseItem, href]);
44
- const handleAnimationEnd = useCallback(() => {
45
- if (closing) commitCollapse();
46
- }, [closing, commitCollapse]);
47
- useEffect(() => {
48
- if (!closing) return;
49
- const timer = setTimeout(commitCollapse, 250);
50
- return () => clearTimeout(timer);
51
- }, [closing, commitCollapse]);
52
- const toggleAccordion = useCallback(
53
- (e, onlyExpand = false) => {
54
- e == null ? void 0 : e.preventDefault();
55
- e == null ? void 0 : e.stopPropagation();
56
- resetExpandAll();
57
- handleSidebarCollapseChange(false);
58
- if (!expanded) {
59
- expandItem(href);
60
- return;
61
- }
62
- if (!isSidebarCollapsed && !onlyExpand) {
63
- setClosing(true);
64
- }
65
- },
66
- [expanded, expandItem, href, handleSidebarCollapseChange, isSidebarCollapsed, resetExpandAll]
67
- );
68
- const renderNavItem = (item, key) => {
69
- var _a, _b;
70
- if (isGroup(item)) {
71
- return /* @__PURE__ */ jsxs("div", { className: styles.group, children: [
72
- /* @__PURE__ */ jsx("div", { className: styles.groupLabel, children: item.label }),
73
- (_a = item.children) == null ? void 0 : _a.map((child, idx) => renderNavItem(child, `${key}-${idx}`))
74
- ] }, key);
75
- }
76
- if (isExpandable(item)) {
77
- return /* @__PURE__ */ jsx(
78
- ExpandableSidebarItem$1,
79
- {
80
- items: (_b = item.children) != null ? _b : [],
81
- label: item.label,
82
- icon: item.icon,
83
- badge: item.badge,
84
- href: item.href,
85
- iconWidth: item.iconWidth,
86
- component: item.component
87
- },
88
- key
89
- );
90
- }
91
- return /* @__PURE__ */ jsx(
92
- SidebarItem,
93
- {
94
- component: item.component,
95
- label: item.label,
96
- icon: item.icon,
97
- badge: item.badge,
98
- href: item.href,
99
- iconWidth: item.iconWidth,
100
- truncateLabel: item.truncateLabel
101
- },
102
- key
103
- );
104
- };
105
- return /* @__PURE__ */ jsxs("div", { className: `${styles.container}`, children: [
106
- /* @__PURE__ */ jsxs("div", { className: `${styles.itemRow} ${expanded ? styles.itemRowExpanded : ""}`, children: [
107
- /* @__PURE__ */ jsx(Component, { onClick: () => toggleAccordion(void 0, true), children: /* @__PURE__ */ jsx(
108
- SidebarItemContent,
109
- {
110
- headerStyle: expanded,
111
- icon,
112
- badge,
113
- iconWidth,
114
- label,
115
- href,
116
- disableActiveStyles: expanded,
117
- suffixIcon: !isSidebarCollapsed ? /* @__PURE__ */ jsx(
118
- ChevronDown,
119
- {
120
- className: `${styles.chevron} ${expanded ? styles.chevronExpanded : ""}`
121
- }
122
- ) : void 0,
123
- truncateLabel
124
- }
125
- ) }),
126
- !isSidebarCollapsed && /* @__PURE__ */ jsx("div", { className: styles.toggleButton, children: /* @__PURE__ */ jsx(
127
- Button,
128
- {
129
- variant: "inline",
130
- shape: "round",
131
- className: styles.toggleButtonControl,
132
- "aria-label": expanded ? `Collapse ${label}` : `Expand ${label}`,
133
- "aria-expanded": expanded,
134
- "aria-controls": `${href}-children`,
135
- onClick: toggleAccordion
136
- }
137
- ) })
138
- ] }),
139
- expanded && !isSidebarCollapsed && /* @__PURE__ */ jsx(
140
- "div",
37
+ return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
38
+ /* @__PURE__ */ jsx(
39
+ "button",
141
40
  {
142
- id: `${href}-children`,
143
- onAnimationEnd: handleAnimationEnd,
144
- className: `${styles.childrenContainer} ${closing ? "animate--collapse" : ""}`,
145
- children: items.map((item, idx) => renderNavItem(item, `${href}-${idx}`))
41
+ type: "button",
42
+ className: styles.toggleButton,
43
+ "aria-label": isSidebarCollapsed ? label : void 0,
44
+ "aria-expanded": visible,
45
+ "aria-controls": childrenId,
46
+ disabled: !enabled,
47
+ onClick: () => {
48
+ resetExpandAll();
49
+ handleSidebarCollapseChange(false);
50
+ if (visible) collapseItem(href);
51
+ else expandItem(href);
52
+ },
53
+ children: /* @__PURE__ */ jsx(
54
+ SidebarItemContent,
55
+ {
56
+ icon,
57
+ badge,
58
+ depth,
59
+ iconWidth,
60
+ label,
61
+ disableActiveStyles: true,
62
+ suffixIcon: /* @__PURE__ */ jsx(
63
+ ChevronDown,
64
+ {
65
+ "aria-hidden": "true",
66
+ className: `${styles.chevron} ${visible ? styles.chevronExpanded : ""}`
67
+ }
68
+ ),
69
+ truncateLabel
70
+ }
71
+ )
146
72
  }
147
- )
73
+ ),
74
+ /* @__PURE__ */ jsx("div", { id: childrenId, hidden: !visible, className: styles.childrenContainer, children: visible ? children : null })
148
75
  ] });
149
76
  }
150
77
 
@@ -1,45 +1,37 @@
1
1
  .container {
2
- position: relative;
3
2
  display: flex;
4
3
  flex-direction: column;
5
- border-radius: var(--border-radius-default);
6
4
  }
7
5
 
8
- .itemRow {
9
- position: relative;
6
+ .toggleButton {
10
7
  display: block;
8
+ inline-size: 100%;
9
+ padding: 0;
10
+ border: 0;
11
11
  border-radius: var(--border-radius-md);
12
+ background: transparent;
13
+ color: inherit;
14
+ font: inherit;
15
+ text-align: start;
16
+ cursor: pointer;
12
17
  }
13
18
 
14
- .toggleButton {
15
- position: absolute;
16
- inset-inline-end: var(--spacing-xs);
17
- inset-block-start: 50%;
18
- transform: translateY(-50%);
19
- display: inline-flex;
20
- align-items: center;
21
- justify-content: center;
22
- }
23
-
24
- .container button {
25
- min-block-size: 28px !important;
26
- min-inline-size: 28px !important;
27
- max-block-size: 28px !important;
28
- max-inline-size: 28px !important;
29
- border-color: transparent !important;
30
- background-color: transparent !important;
19
+ .toggleButton:focus-visible {
20
+ outline: none;
21
+ box-shadow: var(--focus-ring);
31
22
  }
32
23
 
33
- .toggleButtonControl {
34
- opacity: 0;
24
+ .toggleButton:disabled {
25
+ color: var(--color-fg-subtle);
26
+ cursor: default;
35
27
  }
36
28
 
37
29
  .childrenContainer {
38
- overflow: hidden;
30
+ --sidebar-empty-icon-display: none;
39
31
  }
40
32
 
41
33
  .chevron {
42
- transition: transform 0.3s ease;
34
+ transition: transform var(--transition-fast) var(--ease-standard);
43
35
  }
44
36
 
45
37
  .chevronExpanded {
@@ -15,6 +15,46 @@
15
15
  inline-size var(--transition-fast) var(--ease-standard);
16
16
  }
17
17
 
18
+ /* Keep native scrolling visible without competing with navigation content. */
19
+ :is(.container, .content, .links) {
20
+ scrollbar-width: thin;
21
+ scrollbar-color: var(--color-border-subtle) transparent;
22
+ }
23
+
24
+ :is(.container, .content, .links):is(:hover, :focus-within) {
25
+ scrollbar-color: var(--color-border-default) transparent;
26
+ }
27
+
28
+ /* Non-auto standard properties override WebKit thumb styling in Chromium. */
29
+ @supports selector(::-webkit-scrollbar) {
30
+ :is(.container, .content, .links),
31
+ :is(.container, .content, .links):is(:hover, :focus-within) {
32
+ scrollbar-width: auto;
33
+ scrollbar-color: auto;
34
+ }
35
+ }
36
+
37
+ :is(.container, .content, .links)::-webkit-scrollbar {
38
+ width: calc(var(--spacing-xxs) + 2 * var(--border-width-thin));
39
+ height: calc(var(--spacing-xxs) + 2 * var(--border-width-thin));
40
+ }
41
+
42
+ :is(.container, .content, .links)::-webkit-scrollbar-track {
43
+ background: transparent;
44
+ }
45
+
46
+ :is(.container, .content, .links)::-webkit-scrollbar-thumb {
47
+ background-color: var(--color-border-subtle);
48
+ background-clip: padding-box;
49
+ border: var(--border-width-thin) solid transparent;
50
+ border-radius: var(--border-radius-default);
51
+ }
52
+
53
+ :is(.container, .content, .links)::-webkit-scrollbar-thumb:hover,
54
+ :is(.container, .content, .links):focus-within::-webkit-scrollbar-thumb {
55
+ background-color: var(--color-border-default);
56
+ }
57
+
18
58
  .sidebarIcon {
19
59
  inline-size: var(--icon-size-sm);
20
60
  block-size: var(--icon-size-sm);
@@ -164,7 +204,6 @@
164
204
  display: flex;
165
205
  flex-grow: 1;
166
206
  flex-direction: column;
167
- gap: 2px;
168
207
  font-size: var(--font-size-sm);
169
208
  }
170
209
 
@@ -20,8 +20,8 @@ function SidebarItemContent({
20
20
  suffixIcon,
21
21
  href,
22
22
  iconWidth,
23
+ depth = 0,
23
24
  disableActiveStyles = false,
24
- headerStyle,
25
25
  truncateLabel = false
26
26
  }) {
27
27
  const { activeLink, activeQuery, isSidebarCollapsed, wrapItemText } = SidebarProvider.useSidebar();
@@ -34,7 +34,8 @@ function SidebarItemContent({
34
34
  return /* @__PURE__ */ jsxRuntime.jsxs(
35
35
  "span",
36
36
  {
37
- className: `${styles__default.default.container} ${!disableActiveStyles && activeLink === href ? styles__default.default.active : ""} ${isSidebarCollapsed ? styles__default.default.collapsed : ""} ${headerStyle ? styles__default.default.headerStyle : ""}`,
37
+ style: { "--sidebar-item-depth": isSidebarCollapsed ? 0 : depth },
38
+ className: `${styles__default.default.container} ${!disableActiveStyles && href && activeLink === href ? styles__default.default.active : ""} ${isSidebarCollapsed ? styles__default.default.collapsed : ""}`,
38
39
  children: [
39
40
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.iconLabel, children: [
40
41
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, style: iconStyle, children: icon }),
@@ -6,9 +6,9 @@ export interface SidebarItemContentProps {
6
6
  badge?: number | string;
7
7
  suffixIcon?: React.ReactNode;
8
8
  href?: string;
9
+ depth?: number;
9
10
  iconWidth?: string | number;
10
11
  disableActiveStyles?: boolean;
11
- headerStyle?: boolean;
12
12
  truncateLabel?: boolean;
13
13
  }
14
- export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, disableActiveStyles, headerStyle, truncateLabel, }: SidebarItemContentProps): JSX.Element;
14
+ export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, depth, disableActiveStyles, truncateLabel, }: SidebarItemContentProps): JSX.Element;
@@ -13,8 +13,8 @@ function SidebarItemContent({
13
13
  suffixIcon,
14
14
  href,
15
15
  iconWidth,
16
+ depth = 0,
16
17
  disableActiveStyles = false,
17
- headerStyle,
18
18
  truncateLabel = false
19
19
  }) {
20
20
  const { activeLink, activeQuery, isSidebarCollapsed, wrapItemText } = useSidebar();
@@ -27,7 +27,8 @@ function SidebarItemContent({
27
27
  return /* @__PURE__ */ jsxs(
28
28
  "span",
29
29
  {
30
- className: `${styles.container} ${!disableActiveStyles && activeLink === href ? styles.active : ""} ${isSidebarCollapsed ? styles.collapsed : ""} ${headerStyle ? styles.headerStyle : ""}`,
30
+ style: { "--sidebar-item-depth": isSidebarCollapsed ? 0 : depth },
31
+ className: `${styles.container} ${!disableActiveStyles && href && activeLink === href ? styles.active : ""} ${isSidebarCollapsed ? styles.collapsed : ""}`,
31
32
  children: [
32
33
  /* @__PURE__ */ jsxs("span", { className: styles.iconLabel, children: [
33
34
  /* @__PURE__ */ jsx("span", { className: styles.icon, style: iconStyle, children: icon }),
@@ -4,8 +4,15 @@
4
4
  align-items: center;
5
5
  justify-content: space-between;
6
6
  gap: var(--spacing-sm);
7
+ /* Transparent borders separate the backgrounds while remaining part of the hit area. */
8
+ border-block: calc(var(--spacing-xxs) / 4) solid transparent;
9
+ background-clip: padding-box;
7
10
  padding-block: var(--spacing-xs);
8
11
  padding-inline: var(--spacing-xs);
12
+ /* Indent content, keeping every row's background and hit area at full width. */
13
+ padding-inline-start: calc(
14
+ var(--spacing-xs) + var(--sidebar-item-depth, 0) * (var(--icon-size-sm) + var(--spacing-sm))
15
+ );
9
16
  text-decoration: none;
10
17
  color: var(--color-fg-muted);
11
18
  cursor: pointer;
@@ -19,12 +26,11 @@
19
26
 
20
27
  .container.collapsed {
21
28
  justify-content: center;
22
- padding: var(--spacing-xs);
23
29
  border-radius: 0;
24
30
  }
25
31
 
26
32
  .active {
27
- background: var(--color-bg-selected);
33
+ background-color: var(--color-bg-selected);
28
34
  }
29
35
 
30
36
  .active::before {
@@ -80,6 +86,11 @@
80
86
  min-inline-size: var(--sidebar-item-icon-width, var(--icon-size-sm));
81
87
  }
82
88
 
89
+ /* Nested rows do not reserve a second icon gutter when they have no icon. */
90
+ .icon:empty {
91
+ display: var(--sidebar-empty-icon-display, flex);
92
+ }
93
+
83
94
  .icon svg,
84
95
  .suffixIcon svg {
85
96
  inline-size: var(--icon-size-sm);
@@ -111,14 +122,6 @@
111
122
  box-shadow: var(--focus-ring);
112
123
  }
113
124
 
114
- .headerStyle .label {
115
- font-weight: 500;
116
- color: var(--color-fg-subtle);
117
- font-size: var(--font-size-xs);
118
- text-transform: uppercase;
119
- letter-spacing: 0.04em;
120
- }
121
-
122
125
  .label {
123
126
  min-inline-size: 0;
124
127
  flex: 1 1 auto;