@dbcdk/react-components 0.0.211 → 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.
- package/README.md +6 -1
- package/dist/components/button/Button.cjs +2 -1
- package/dist/components/button/Button.d.ts +6 -1
- package/dist/components/button/Button.js +2 -1
- package/dist/components/button/Button.module.css +14 -0
- package/dist/components/color-scheme-button/ColorSchemeButton.cjs +2 -2
- package/dist/components/color-scheme-button/ColorSchemeButton.js +2 -2
- package/dist/components/forms/file-upload/FileUpload.cjs +4 -0
- package/dist/components/forms/file-upload/FileUpload.js +4 -0
- package/dist/components/forms/form-select/FormSelect.cjs +4 -0
- package/dist/components/forms/form-select/FormSelect.d.ts +1 -1
- package/dist/components/forms/form-select/FormSelect.js +4 -0
- package/dist/components/forms/input/Input.cjs +4 -0
- package/dist/components/forms/input/Input.js +4 -0
- package/dist/components/forms/radio-buttons/RadioButtonGroup.cjs +6 -5
- package/dist/components/forms/radio-buttons/RadioButtonGroup.js +2 -5
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +15 -0
- package/dist/components/forms/select/Select.cjs +4 -0
- package/dist/components/forms/select/Select.d.ts +1 -1
- package/dist/components/forms/select/Select.js +4 -0
- package/dist/components/forms/text-area/Textarea.cjs +4 -0
- package/dist/components/forms/text-area/Textarea.js +4 -0
- package/dist/components/forms/typeahead/Typeahead.cjs +109 -42
- package/dist/components/forms/typeahead/Typeahead.d.ts +6 -0
- package/dist/components/forms/typeahead/Typeahead.js +109 -42
- package/dist/components/forms/typeahead/Typeahead.module.css +16 -0
- package/dist/components/headline/CollapsibleHeadline.cjs +15 -18
- package/dist/components/headline/CollapsibleHeadline.d.ts +2 -2
- package/dist/components/headline/CollapsibleHeadline.js +15 -18
- package/dist/components/headline/Headline.module.css +22 -0
- package/dist/components/sidebar/components/SidebarItem.cjs +2 -0
- package/dist/components/sidebar/components/SidebarItem.d.ts +2 -1
- package/dist/components/sidebar/components/SidebarItem.js +2 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +2 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +2 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +2 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +1 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +40 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +2 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +2 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +9 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +6 -4
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +6 -4
- package/dist/components/theme-script/ThemeScript.cjs +1 -1
- package/dist/components/theme-script/ThemeScript.d.ts +1 -1
- package/dist/components/theme-script/ThemeScript.js +1 -1
- package/dist/hooks/useColorScheme.cjs +1 -1
- package/dist/hooks/useColorScheme.js +1 -1
- package/dist/hooks/useGetActiveTheme.cjs +1 -1
- package/dist/hooks/useGetActiveTheme.js +1 -1
- package/dist/styles/themes/dbc/colors.css +4 -4
- package/package.json +1 -1
|
@@ -8,6 +8,23 @@ import { Menu } from '../../../components/menu/Menu';
|
|
|
8
8
|
import { Popover } from '../../../components/popover/Popover';
|
|
9
9
|
import styles from './Typeahead.module.css';
|
|
10
10
|
|
|
11
|
+
function orderByGroup(options) {
|
|
12
|
+
if (!options.some((option) => option.group)) return options;
|
|
13
|
+
const groups = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const option of options) {
|
|
15
|
+
const group = option.group || void 0;
|
|
16
|
+
const entries = groups.get(group);
|
|
17
|
+
if (entries) entries.push(option);
|
|
18
|
+
else groups.set(group, [option]);
|
|
19
|
+
}
|
|
20
|
+
return Array.from(groups.values()).flat();
|
|
21
|
+
}
|
|
22
|
+
function findEnabledIndex(items, start, step) {
|
|
23
|
+
for (let index = start; index >= 0 && index < items.length; index += step) {
|
|
24
|
+
if (!items[index].disabled) return index;
|
|
25
|
+
}
|
|
26
|
+
return -1;
|
|
27
|
+
}
|
|
11
28
|
function parseLengthToPx(value, referenceFontSize = 16) {
|
|
12
29
|
if (!value) return 0;
|
|
13
30
|
const trimmed = value.trim();
|
|
@@ -173,16 +190,25 @@ function Typeahead({
|
|
|
173
190
|
filteredOptions = options;
|
|
174
191
|
} else {
|
|
175
192
|
filteredOptions = options.filter(
|
|
176
|
-
(option) =>
|
|
193
|
+
(option) => {
|
|
194
|
+
var _a2, _b, _c, _d;
|
|
195
|
+
return option.label.toLocaleLowerCase().includes(normalizedQuery) || ((_b = (_a2 = option.description) == null ? void 0 : _a2.toLocaleLowerCase().includes(normalizedQuery)) != null ? _b : false) || ((_d = (_c = option.group) == null ? void 0 : _c.toLocaleLowerCase().includes(normalizedQuery)) != null ? _d : false);
|
|
196
|
+
}
|
|
177
197
|
);
|
|
178
198
|
}
|
|
179
199
|
}
|
|
200
|
+
filteredOptions = orderByGroup(filteredOptions);
|
|
180
201
|
if (typeof maxVisibleOptions === "number" && Number.isFinite(maxVisibleOptions)) {
|
|
181
202
|
filteredOptions = filteredOptions.slice(0, Math.max(0, maxVisibleOptions));
|
|
182
203
|
}
|
|
204
|
+
const groupStarts = /* @__PURE__ */ new Map();
|
|
205
|
+
filteredOptions.forEach((option, index) => {
|
|
206
|
+
if (option.group && !groupStarts.has(option.group)) groupStarts.set(option.group, index);
|
|
207
|
+
});
|
|
183
208
|
const commitSelection = React.useCallback(
|
|
184
209
|
(option) => {
|
|
185
210
|
var _a2, _b;
|
|
211
|
+
if (option == null ? void 0 : option.disabled) return;
|
|
186
212
|
locallyClearedRef.current = false;
|
|
187
213
|
setHideSelectedHighlight(false);
|
|
188
214
|
if (mode === "multi") {
|
|
@@ -310,24 +336,21 @@ function Typeahead({
|
|
|
310
336
|
}, [selectedOption, selectedSingleText, mode]);
|
|
311
337
|
const getSelectedIndex = React.useCallback(
|
|
312
338
|
(items) => {
|
|
313
|
-
|
|
314
|
-
if (locallyClearedRef.current) return
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
const singleSelectedIndex = items.findIndex((option) => option.value === selectedValue);
|
|
321
|
-
return singleSelectedIndex >= 0 ? singleSelectedIndex : 0;
|
|
339
|
+
const firstEnabled = findEnabledIndex(items, 0, 1);
|
|
340
|
+
if (firstEnabled < 0 || locallyClearedRef.current) return firstEnabled;
|
|
341
|
+
const selectedIndex = items.findIndex(
|
|
342
|
+
(option) => !option.disabled && (mode === "multi" ? Array.isArray(selectedValue) && selectedValue.includes(option.value) : option.value === selectedValue)
|
|
343
|
+
);
|
|
344
|
+
return selectedIndex >= 0 ? selectedIndex : firstEnabled;
|
|
322
345
|
},
|
|
323
346
|
[mode, selectedValue]
|
|
324
347
|
);
|
|
325
348
|
useEffect(() => {
|
|
326
349
|
setActiveIndex((current) => {
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return
|
|
350
|
+
if (locallyClearedRef.current || current < 0 || !filteredOptions[current] || filteredOptions[current].disabled) {
|
|
351
|
+
return getSelectedIndex(filteredOptions);
|
|
352
|
+
}
|
|
353
|
+
return current;
|
|
331
354
|
});
|
|
332
355
|
}, [filteredOptions, getSelectedIndex]);
|
|
333
356
|
useEffect(() => {
|
|
@@ -428,7 +451,14 @@ function Typeahead({
|
|
|
428
451
|
}
|
|
429
452
|
const exactLabelMatch = options.find((option) => option.label === inputValue);
|
|
430
453
|
if (exactLabelMatch) {
|
|
431
|
-
|
|
454
|
+
if (exactLabelMatch.disabled) {
|
|
455
|
+
setInputValue(selectedSingleText);
|
|
456
|
+
setQuery("");
|
|
457
|
+
setOpen(false);
|
|
458
|
+
setActiveIndex(-1);
|
|
459
|
+
} else {
|
|
460
|
+
commitSelection(exactLabelMatch);
|
|
461
|
+
}
|
|
432
462
|
return;
|
|
433
463
|
}
|
|
434
464
|
if (allowCustomValue) {
|
|
@@ -460,7 +490,7 @@ function Typeahead({
|
|
|
460
490
|
if (justClearedRef.current) return;
|
|
461
491
|
setQuery("");
|
|
462
492
|
setOpen(true);
|
|
463
|
-
setActiveIndex(getSelectedIndex(options));
|
|
493
|
+
setActiveIndex(getSelectedIndex(orderByGroup(options)));
|
|
464
494
|
}, [getSelectedIndex, options]);
|
|
465
495
|
const openWithCurrentFilter = React.useCallback(() => {
|
|
466
496
|
if (justClearedRef.current) return;
|
|
@@ -502,7 +532,7 @@ function Typeahead({
|
|
|
502
532
|
if (isAlreadyFocused && mode === "single" && selectedOption && !locallyClearedRef.current) {
|
|
503
533
|
prepareSingleSearchInput();
|
|
504
534
|
setOpen(true);
|
|
505
|
-
setActiveIndex(getSelectedIndex(options));
|
|
535
|
+
setActiveIndex(getSelectedIndex(orderByGroup(options)));
|
|
506
536
|
} else if (isAlreadyFocused && !open) {
|
|
507
537
|
setOpen(true);
|
|
508
538
|
setActiveIndex(getSelectedIndex(filteredOptions));
|
|
@@ -549,7 +579,8 @@ function Typeahead({
|
|
|
549
579
|
setActiveIndex((index) => {
|
|
550
580
|
if (filteredOptions.length === 0) return -1;
|
|
551
581
|
if (index < 0) return getSelectedIndex(filteredOptions);
|
|
552
|
-
|
|
582
|
+
const next = findEnabledIndex(filteredOptions, index + 1, 1);
|
|
583
|
+
return next >= 0 ? next : index;
|
|
553
584
|
});
|
|
554
585
|
return;
|
|
555
586
|
case "ArrowUp":
|
|
@@ -559,20 +590,23 @@ function Typeahead({
|
|
|
559
590
|
return;
|
|
560
591
|
}
|
|
561
592
|
setActiveIndex((index) => {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
593
|
+
const next = findEnabledIndex(
|
|
594
|
+
filteredOptions,
|
|
595
|
+
index < 0 ? filteredOptions.length - 1 : index - 1,
|
|
596
|
+
-1
|
|
597
|
+
);
|
|
598
|
+
return next >= 0 ? next : index;
|
|
565
599
|
});
|
|
566
600
|
return;
|
|
567
601
|
case "Home":
|
|
568
602
|
if (!open || filteredOptions.length === 0) return;
|
|
569
603
|
e.preventDefault();
|
|
570
|
-
setActiveIndex(0);
|
|
604
|
+
setActiveIndex(findEnabledIndex(filteredOptions, 0, 1));
|
|
571
605
|
return;
|
|
572
606
|
case "End":
|
|
573
607
|
if (!open || filteredOptions.length === 0) return;
|
|
574
608
|
e.preventDefault();
|
|
575
|
-
setActiveIndex(filteredOptions.length - 1);
|
|
609
|
+
setActiveIndex(findEnabledIndex(filteredOptions, filteredOptions.length - 1, -1));
|
|
576
610
|
return;
|
|
577
611
|
case "Enter":
|
|
578
612
|
if (!open) return;
|
|
@@ -626,7 +660,7 @@ function Typeahead({
|
|
|
626
660
|
if (nextOpen) {
|
|
627
661
|
if (mode === "single" && selectedOption && !locallyClearedRef.current) {
|
|
628
662
|
setQuery("");
|
|
629
|
-
setActiveIndex(getSelectedIndex(options));
|
|
663
|
+
setActiveIndex(getSelectedIndex(orderByGroup(options)));
|
|
630
664
|
} else {
|
|
631
665
|
setActiveIndex(getSelectedIndex(filteredOptions));
|
|
632
666
|
}
|
|
@@ -744,41 +778,74 @@ function Typeahead({
|
|
|
744
778
|
const isActive = index === activeIndex;
|
|
745
779
|
const isSelected = mode === "multi" ? Array.isArray(selectedValue) && selectedValue.includes(option.value) : option.value === selectedValue && !hideSelectedHighlight;
|
|
746
780
|
const optionId = `${listboxId}-option-${index}`;
|
|
747
|
-
|
|
781
|
+
const groupId = option.group ? `${listboxId}-group-${groupStarts.get(option.group)}` : void 0;
|
|
782
|
+
const startsGroup = !!option.group && groupStarts.get(option.group) === index;
|
|
783
|
+
const descriptionId = option.description ? `${optionId}-description` : void 0;
|
|
784
|
+
const describedBy = [groupId, descriptionId].filter(Boolean).join(" ") || void 0;
|
|
785
|
+
const labelContent = /* @__PURE__ */ jsxs("span", { className: styles.optionText, children: [
|
|
786
|
+
/* @__PURE__ */ jsx("span", { children: option.label }),
|
|
787
|
+
option.description && /* @__PURE__ */ jsx("span", { id: descriptionId, className: styles.description, children: option.description })
|
|
788
|
+
] });
|
|
789
|
+
const item = mode === "multi" ? /* @__PURE__ */ jsx(
|
|
748
790
|
Menu.CheckItem,
|
|
749
791
|
{
|
|
750
792
|
checked: isSelected,
|
|
793
|
+
disabled: option.disabled,
|
|
751
794
|
active: isActive,
|
|
752
795
|
interactiveProps: {
|
|
753
796
|
id: optionId,
|
|
754
797
|
role: "option",
|
|
755
|
-
|
|
798
|
+
"aria-describedby": describedBy,
|
|
799
|
+
"aria-label": option.label,
|
|
800
|
+
"aria-disabled": option.disabled || void 0,
|
|
801
|
+
onMouseEnter: () => {
|
|
802
|
+
if (!option.disabled) setActiveIndex(index);
|
|
803
|
+
},
|
|
756
804
|
onMouseDown: (e) => {
|
|
757
805
|
interactingWithOptionsRef.current = true;
|
|
758
806
|
e.preventDefault();
|
|
759
807
|
},
|
|
760
808
|
onKeyDown: (e) => handleTabKeyDown(e)
|
|
761
809
|
},
|
|
762
|
-
label:
|
|
810
|
+
label: labelContent,
|
|
763
811
|
onCheckedChange: () => commitSelection(option)
|
|
764
812
|
},
|
|
765
813
|
option.value
|
|
766
|
-
) : /* @__PURE__ */ jsx(
|
|
767
|
-
|
|
814
|
+
) : /* @__PURE__ */ jsx(
|
|
815
|
+
Menu.Item,
|
|
768
816
|
{
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
817
|
+
active: isActive,
|
|
818
|
+
selected: isSelected,
|
|
819
|
+
disabled: option.disabled,
|
|
820
|
+
children: /* @__PURE__ */ jsx(
|
|
821
|
+
"button",
|
|
822
|
+
{
|
|
823
|
+
id: optionId,
|
|
824
|
+
type: "button",
|
|
825
|
+
role: "option",
|
|
826
|
+
"aria-selected": isSelected,
|
|
827
|
+
"aria-describedby": describedBy,
|
|
828
|
+
"aria-label": option.label,
|
|
829
|
+
"aria-disabled": option.disabled || void 0,
|
|
830
|
+
disabled: option.disabled,
|
|
831
|
+
onMouseEnter: () => {
|
|
832
|
+
if (!option.disabled) setActiveIndex(index);
|
|
833
|
+
},
|
|
834
|
+
onMouseDown: (e) => {
|
|
835
|
+
e.preventDefault();
|
|
836
|
+
},
|
|
837
|
+
onKeyDown: (e) => handleTabKeyDown(e),
|
|
838
|
+
onClick: () => commitSelection(option),
|
|
839
|
+
children: labelContent
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
},
|
|
843
|
+
option.value
|
|
844
|
+
);
|
|
845
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
846
|
+
startsGroup && /* @__PURE__ */ jsx(Menu.Header, { id: groupId, children: option.group }),
|
|
847
|
+
item
|
|
848
|
+
] }, option.value);
|
|
782
849
|
}) : /* @__PURE__ */ jsx(Menu.Item, { disabled: true, children: emptyMessage }) })
|
|
783
850
|
}
|
|
784
851
|
),
|
|
@@ -36,3 +36,19 @@
|
|
|
36
36
|
.typeaheadInput {
|
|
37
37
|
cursor: pointer;
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
/* Label and description share one row; the description wraps below only when space runs out. */
|
|
41
|
+
.optionText {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
align-items: baseline;
|
|
45
|
+
column-gap: var(--spacing-md);
|
|
46
|
+
min-width: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.description {
|
|
50
|
+
margin-inline-start: auto;
|
|
51
|
+
font-size: var(--font-size-xs);
|
|
52
|
+
color: var(--color-fg-muted);
|
|
53
|
+
text-align: end;
|
|
54
|
+
}
|
|
@@ -7,7 +7,6 @@ var react = require('react');
|
|
|
7
7
|
var usePersistentState = require('../../hooks/usePersistentState');
|
|
8
8
|
var Headline = require('./Headline');
|
|
9
9
|
var styles = require('./Headline.module.css');
|
|
10
|
-
var Button = require('../button/Button');
|
|
11
10
|
|
|
12
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
|
|
@@ -45,7 +44,7 @@ function CollapsibleHeadline({
|
|
|
45
44
|
onToggle == null ? void 0 : onToggle();
|
|
46
45
|
};
|
|
47
46
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.collapsibleRoot, children: [
|
|
48
|
-
/* @__PURE__ */ jsxRuntime.
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
49
48
|
Headline.Headline,
|
|
50
49
|
{
|
|
51
50
|
...headlineProps,
|
|
@@ -53,28 +52,26 @@ function CollapsibleHeadline({
|
|
|
53
52
|
weight,
|
|
54
53
|
size,
|
|
55
54
|
addition,
|
|
56
|
-
children:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
onClick: handleToggle,
|
|
68
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
type: "button",
|
|
59
|
+
className: styles__default.default.toggleButton,
|
|
60
|
+
"aria-expanded": isExpanded,
|
|
61
|
+
"aria-controls": panelId,
|
|
62
|
+
onClick: handleToggle,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: header }),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
69
66
|
lucideReact.ChevronDown,
|
|
70
67
|
{
|
|
71
68
|
"aria-hidden": true,
|
|
72
69
|
className: [styles__default.default.toggleChevron, isExpanded ? styles__default.default.toggleChevronExpanded : ""].filter(Boolean).join(" ")
|
|
73
70
|
}
|
|
74
71
|
)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
)
|
|
78
75
|
}
|
|
79
76
|
),
|
|
80
77
|
isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { id: panelId, className: styles__default.default.collapsiblePanel, children })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import type { HeadlineProps } from './Headline';
|
|
3
3
|
export interface CollapsibleHeadlineProps extends Omit<HeadlineProps, 'addition' | 'children'> {
|
|
4
|
-
/** The headline text — always visible. */
|
|
4
|
+
/** The headline text — always visible. Use addition for separate interactive content. */
|
|
5
5
|
header: React.ReactNode;
|
|
6
6
|
/** Controlled expanded state. When omitted, the component manages its own state. */
|
|
7
7
|
expanded?: boolean;
|
|
@@ -9,7 +9,7 @@ export interface CollapsibleHeadlineProps extends Omit<HeadlineProps, 'addition'
|
|
|
9
9
|
onToggle?: () => void;
|
|
10
10
|
/** id of the panel element, used for aria-controls. Generated automatically if omitted. */
|
|
11
11
|
controls?: string;
|
|
12
|
-
/** Extra content rendered
|
|
12
|
+
/** Extra content rendered beside the heading, outside the toggle button. */
|
|
13
13
|
addition?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
15
|
* When set in uncontrolled mode, the component persists its expanded
|
|
@@ -5,7 +5,6 @@ import { useId } from 'react';
|
|
|
5
5
|
import { usePersistentState } from '../../hooks/usePersistentState';
|
|
6
6
|
import { Headline } from './Headline';
|
|
7
7
|
import styles from './Headline.module.css';
|
|
8
|
-
import { Button } from '../button/Button';
|
|
9
8
|
|
|
10
9
|
function CollapsibleHeadline({
|
|
11
10
|
header,
|
|
@@ -39,7 +38,7 @@ function CollapsibleHeadline({
|
|
|
39
38
|
onToggle == null ? void 0 : onToggle();
|
|
40
39
|
};
|
|
41
40
|
return /* @__PURE__ */ jsxs("div", { className: styles.collapsibleRoot, children: [
|
|
42
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
43
42
|
Headline,
|
|
44
43
|
{
|
|
45
44
|
...headlineProps,
|
|
@@ -47,28 +46,26 @@ function CollapsibleHeadline({
|
|
|
47
46
|
weight,
|
|
48
47
|
size,
|
|
49
48
|
addition,
|
|
50
|
-
children:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
onClick: handleToggle,
|
|
62
|
-
children: /* @__PURE__ */ jsx(
|
|
49
|
+
children: /* @__PURE__ */ jsxs(
|
|
50
|
+
"button",
|
|
51
|
+
{
|
|
52
|
+
type: "button",
|
|
53
|
+
className: styles.toggleButton,
|
|
54
|
+
"aria-expanded": isExpanded,
|
|
55
|
+
"aria-controls": panelId,
|
|
56
|
+
onClick: handleToggle,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx("span", { children: header }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
63
60
|
ChevronDown,
|
|
64
61
|
{
|
|
65
62
|
"aria-hidden": true,
|
|
66
63
|
className: [styles.toggleChevron, isExpanded ? styles.toggleChevronExpanded : ""].filter(Boolean).join(" ")
|
|
67
64
|
}
|
|
68
65
|
)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
72
69
|
}
|
|
73
70
|
),
|
|
74
71
|
isExpanded && /* @__PURE__ */ jsx("div", { id: panelId, className: styles.collapsiblePanel, children })
|
|
@@ -47,6 +47,27 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/* CollapsibleHeadline wrapper */
|
|
50
|
+
.toggleButton {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: var(--spacing-xs);
|
|
54
|
+
min-width: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
border: 0;
|
|
57
|
+
background: none;
|
|
58
|
+
color: inherit;
|
|
59
|
+
font: inherit;
|
|
60
|
+
letter-spacing: inherit;
|
|
61
|
+
text-align: start;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
border-radius: var(--border-radius-sm);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.toggleButton:focus-visible {
|
|
67
|
+
outline: var(--border-width-medium) solid var(--color-border-selected);
|
|
68
|
+
outline-offset: var(--spacing-2xs);
|
|
69
|
+
}
|
|
70
|
+
|
|
50
71
|
.collapsibleRoot {
|
|
51
72
|
display: flex;
|
|
52
73
|
flex-direction: column;
|
|
@@ -58,6 +79,7 @@
|
|
|
58
79
|
|
|
59
80
|
.toggleChevron {
|
|
60
81
|
display: block;
|
|
82
|
+
flex-shrink: 0;
|
|
61
83
|
width: 0.85em;
|
|
62
84
|
height: 0.85em;
|
|
63
85
|
transition: transform var(--transition-normal) var(--ease-standard);
|
|
@@ -5,10 +5,11 @@ interface SidebarItemProps {
|
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
6
|
badge?: number | string;
|
|
7
7
|
href?: string;
|
|
8
|
+
depth?: number;
|
|
8
9
|
iconWidth?: string | number;
|
|
9
10
|
enabled?: boolean;
|
|
10
11
|
external?: boolean;
|
|
11
12
|
truncateLabel?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare function SidebarItem({ component: Component, label, icon, badge, href, iconWidth, truncateLabel, enabled, external, }: SidebarItemProps): React.ReactNode;
|
|
14
|
+
export declare function SidebarItem({ component: Component, label, icon, badge, href, iconWidth, depth, truncateLabel, enabled, external, }: SidebarItemProps): React.ReactNode;
|
|
14
15
|
export {};
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs
CHANGED
|
@@ -19,6 +19,7 @@ function ExpandableSidebarItem({
|
|
|
19
19
|
badge,
|
|
20
20
|
href,
|
|
21
21
|
iconWidth,
|
|
22
|
+
depth = 0,
|
|
22
23
|
truncateLabel,
|
|
23
24
|
enabled = true
|
|
24
25
|
}) {
|
|
@@ -60,6 +61,7 @@ function ExpandableSidebarItem({
|
|
|
60
61
|
{
|
|
61
62
|
icon,
|
|
62
63
|
badge,
|
|
64
|
+
depth,
|
|
63
65
|
iconWidth,
|
|
64
66
|
label,
|
|
65
67
|
disableActiveStyles: true,
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ type ExpandableSidebarItemProps = {
|
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
6
|
badge?: number | string;
|
|
7
7
|
href: string;
|
|
8
|
+
depth?: number;
|
|
8
9
|
iconWidth?: string | number;
|
|
9
10
|
truncateLabel?: boolean;
|
|
10
11
|
enabled?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare function ExpandableSidebarItem({ children, label, icon, badge, href, iconWidth, truncateLabel, enabled, }: ExpandableSidebarItemProps): React.ReactNode;
|
|
13
|
+
export declare function ExpandableSidebarItem({ children, label, icon, badge, href, iconWidth, depth, truncateLabel, enabled, }: ExpandableSidebarItemProps): React.ReactNode;
|
|
13
14
|
export {};
|
|
@@ -13,6 +13,7 @@ function ExpandableSidebarItem({
|
|
|
13
13
|
badge,
|
|
14
14
|
href,
|
|
15
15
|
iconWidth,
|
|
16
|
+
depth = 0,
|
|
16
17
|
truncateLabel,
|
|
17
18
|
enabled = true
|
|
18
19
|
}) {
|
|
@@ -54,6 +55,7 @@ function ExpandableSidebarItem({
|
|
|
54
55
|
{
|
|
55
56
|
icon,
|
|
56
57
|
badge,
|
|
58
|
+
depth,
|
|
57
59
|
iconWidth,
|
|
58
60
|
label,
|
|
59
61
|
disableActiveStyles: true,
|
|
@@ -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);
|
|
@@ -20,6 +20,7 @@ function SidebarItemContent({
|
|
|
20
20
|
suffixIcon,
|
|
21
21
|
href,
|
|
22
22
|
iconWidth,
|
|
23
|
+
depth = 0,
|
|
23
24
|
disableActiveStyles = false,
|
|
24
25
|
truncateLabel = false
|
|
25
26
|
}) {
|
|
@@ -33,6 +34,7 @@ function SidebarItemContent({
|
|
|
33
34
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
34
35
|
"span",
|
|
35
36
|
{
|
|
37
|
+
style: { "--sidebar-item-depth": isSidebarCollapsed ? 0 : depth },
|
|
36
38
|
className: `${styles__default.default.container} ${!disableActiveStyles && href && activeLink === href ? styles__default.default.active : ""} ${isSidebarCollapsed ? styles__default.default.collapsed : ""}`,
|
|
37
39
|
children: [
|
|
38
40
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.iconLabel, children: [
|
|
@@ -6,8 +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
12
|
truncateLabel?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, disableActiveStyles, truncateLabel, }: SidebarItemContentProps): JSX.Element;
|
|
14
|
+
export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, depth, disableActiveStyles, truncateLabel, }: SidebarItemContentProps): JSX.Element;
|
|
@@ -13,6 +13,7 @@ function SidebarItemContent({
|
|
|
13
13
|
suffixIcon,
|
|
14
14
|
href,
|
|
15
15
|
iconWidth,
|
|
16
|
+
depth = 0,
|
|
16
17
|
disableActiveStyles = false,
|
|
17
18
|
truncateLabel = false
|
|
18
19
|
}) {
|
|
@@ -26,6 +27,7 @@ function SidebarItemContent({
|
|
|
26
27
|
return /* @__PURE__ */ jsxs(
|
|
27
28
|
"span",
|
|
28
29
|
{
|
|
30
|
+
style: { "--sidebar-item-depth": isSidebarCollapsed ? 0 : depth },
|
|
29
31
|
className: `${styles.container} ${!disableActiveStyles && href && activeLink === href ? styles.active : ""} ${isSidebarCollapsed ? styles.collapsed : ""}`,
|
|
30
32
|
children: [
|
|
31
33
|
/* @__PURE__ */ jsxs("span", { className: styles.iconLabel, children: [
|