@dbcdk/react-components 0.0.209 → 0.0.211
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/dist/client.cjs +10 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +2 -0
- package/dist/components/forms/markdown-editor/MarkdownEditor.cjs +475 -0
- package/dist/components/forms/markdown-editor/MarkdownEditor.d.ts +68 -0
- package/dist/components/forms/markdown-editor/MarkdownEditor.js +468 -0
- package/dist/components/forms/markdown-editor/MarkdownEditor.module.css +202 -0
- package/dist/components/forms/markdown-editor/MarkdownViewer.cjs +29 -0
- package/dist/components/forms/markdown-editor/MarkdownViewer.d.ts +27 -0
- package/dist/components/forms/markdown-editor/MarkdownViewer.js +23 -0
- package/dist/components/forms/markdown-editor/MarkdownViewer.module.css +97 -0
- package/dist/components/forms/markdown-editor/markdown.utils.cjs +325 -0
- package/dist/components/forms/markdown-editor/markdown.utils.d.ts +66 -0
- package/dist/components/forms/markdown-editor/markdown.utils.js +310 -0
- package/dist/components/listbox/Listbox.cjs +2 -2
- package/dist/components/listbox/Listbox.d.ts +2 -2
- package/dist/components/listbox/Listbox.js +2 -2
- package/dist/components/meta-bar/MetaBar.cjs +2 -2
- package/dist/components/meta-bar/MetaBar.d.ts +2 -1
- package/dist/components/meta-bar/MetaBar.js +2 -2
- package/dist/components/meta-bar/MetaBar.module.css +7 -0
- package/dist/components/nav-bar/NavBar.d.ts +2 -1
- package/dist/components/overlay/tooltip/TooltipProvider.cjs +10 -1
- package/dist/components/overlay/tooltip/TooltipProvider.js +11 -2
- package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +9 -2
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +9 -2
- package/dist/components/sidebar/Sidebar.cjs +2 -1
- package/dist/components/sidebar/Sidebar.js +2 -1
- package/dist/components/sidebar/components/SidebarItem.cjs +34 -13
- package/dist/components/sidebar/components/SidebarItem.d.ts +4 -2
- package/dist/components/sidebar/components/SidebarItem.js +30 -13
- package/dist/components/sidebar/components/SidebarItem.module.css +16 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +41 -116
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +4 -5
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +42 -117
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +17 -25
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +1 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +1 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +0 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +1 -2
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +1 -2
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +1 -2
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +4 -10
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +11 -19
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +11 -19
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -1
- package/dist/components/sidebar/providers/SidebarProvider.cjs +9 -7
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +2 -1
- package/dist/components/sidebar/providers/SidebarProvider.js +9 -7
- package/dist/components/tabs/Tabs.cjs +83 -69
- package/dist/components/tabs/Tabs.d.ts +5 -1
- package/dist/components/tabs/Tabs.js +83 -69
- package/dist/components/tabs/Tabs.module.css +39 -0
- package/dist/index.cjs +213 -208
- package/dist/index.css +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +4 -1
|
@@ -1,29 +1,46 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import styles from './SidebarItem.module.css';
|
|
4
|
+
import { useSidebar } from '../providers/SidebarProvider';
|
|
2
5
|
import { SidebarItemContent } from './sidebar-item-content/SidebarItemContent';
|
|
3
6
|
|
|
4
7
|
function SidebarItem({
|
|
5
|
-
component: Component,
|
|
8
|
+
component: Component = "a",
|
|
6
9
|
label,
|
|
7
10
|
icon,
|
|
8
11
|
badge,
|
|
9
12
|
href,
|
|
10
13
|
iconWidth,
|
|
11
|
-
truncateLabel
|
|
14
|
+
truncateLabel,
|
|
15
|
+
enabled = true,
|
|
16
|
+
external
|
|
12
17
|
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return /* @__PURE__ */ jsx(Component, { children: /* @__PURE__ */ jsx(
|
|
17
|
-
SidebarItemContent,
|
|
18
|
+
const { activeLink, isSidebarCollapsed } = useSidebar();
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Component,
|
|
18
21
|
{
|
|
19
|
-
icon,
|
|
20
|
-
badge,
|
|
21
|
-
iconWidth,
|
|
22
|
-
label,
|
|
23
22
|
href,
|
|
24
|
-
|
|
23
|
+
className: styles.link,
|
|
24
|
+
"aria-label": isSidebarCollapsed ? label : void 0,
|
|
25
|
+
"aria-current": enabled && activeLink === href ? "page" : void 0,
|
|
26
|
+
"aria-disabled": !enabled || void 0,
|
|
27
|
+
tabIndex: enabled ? void 0 : -1,
|
|
28
|
+
onClick: enabled ? void 0 : (event) => event.preventDefault(),
|
|
29
|
+
...external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
30
|
+
children: /* @__PURE__ */ jsx(
|
|
31
|
+
SidebarItemContent,
|
|
32
|
+
{
|
|
33
|
+
icon,
|
|
34
|
+
badge,
|
|
35
|
+
iconWidth,
|
|
36
|
+
label,
|
|
37
|
+
href,
|
|
38
|
+
disableActiveStyles: !enabled,
|
|
39
|
+
truncateLabel
|
|
40
|
+
}
|
|
41
|
+
)
|
|
25
42
|
}
|
|
26
|
-
)
|
|
43
|
+
);
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
export { SidebarItem };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.link {
|
|
2
|
+
display: block;
|
|
3
|
+
color: inherit;
|
|
4
|
+
text-decoration: none;
|
|
5
|
+
border-radius: var(--border-radius-md);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.link:focus-visible {
|
|
9
|
+
outline: none;
|
|
10
|
+
box-shadow: var(--focus-ring);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.link[aria-disabled='true'] {
|
|
14
|
+
color: var(--color-fg-subtle);
|
|
15
|
+
cursor: default;
|
|
16
|
+
}
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs
CHANGED
|
@@ -5,27 +5,22 @@ 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
|
-
|
|
16
|
+
children,
|
|
22
17
|
label,
|
|
23
18
|
icon,
|
|
24
19
|
badge,
|
|
25
|
-
component: Component,
|
|
26
20
|
href,
|
|
27
21
|
iconWidth,
|
|
28
|
-
truncateLabel
|
|
22
|
+
truncateLabel,
|
|
23
|
+
enabled = true
|
|
29
24
|
}) {
|
|
30
25
|
const {
|
|
31
26
|
defaultExpanded,
|
|
@@ -36,121 +31,51 @@ function ExpandableSidebarItem({
|
|
|
36
31
|
collapseItem,
|
|
37
32
|
isExpanded
|
|
38
33
|
} = SidebarProvider.useSidebar();
|
|
39
|
-
const
|
|
40
|
-
const expanded =
|
|
34
|
+
const childrenId = react.useId();
|
|
35
|
+
const expanded = isExpanded(href);
|
|
36
|
+
const visible = expanded && !isSidebarCollapsed;
|
|
41
37
|
react.useEffect(() => {
|
|
42
38
|
if (defaultExpanded === null) return;
|
|
43
39
|
if (defaultExpanded) expandItem(href);
|
|
44
40
|
else collapseItem(href);
|
|
45
41
|
}, [defaultExpanded, expandItem, collapseItem, href]);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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",
|
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.container, children: [
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
+
"button",
|
|
147
45
|
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
46
|
+
type: "button",
|
|
47
|
+
className: styles__default.default.toggleButton,
|
|
48
|
+
"aria-label": isSidebarCollapsed ? label : void 0,
|
|
49
|
+
"aria-expanded": visible,
|
|
50
|
+
"aria-controls": childrenId,
|
|
51
|
+
disabled: !enabled,
|
|
52
|
+
onClick: () => {
|
|
53
|
+
resetExpandAll();
|
|
54
|
+
handleSidebarCollapseChange(false);
|
|
55
|
+
if (visible) collapseItem(href);
|
|
56
|
+
else expandItem(href);
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
+
SidebarItemContent.SidebarItemContent,
|
|
60
|
+
{
|
|
61
|
+
icon,
|
|
62
|
+
badge,
|
|
63
|
+
iconWidth,
|
|
64
|
+
label,
|
|
65
|
+
disableActiveStyles: true,
|
|
66
|
+
suffixIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
lucideReact.ChevronDown,
|
|
68
|
+
{
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
className: `${styles__default.default.chevron} ${visible ? styles__default.default.chevronExpanded : ""}`
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
truncateLabel
|
|
74
|
+
}
|
|
75
|
+
)
|
|
152
76
|
}
|
|
153
|
-
)
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { id: childrenId, hidden: !visible, className: styles__default.default.childrenContainer, children: visible ? children : null })
|
|
154
79
|
] });
|
|
155
80
|
}
|
|
156
81
|
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { NavBarItem } from '../../../../components/nav-bar/NavBar';
|
|
3
2
|
type ExpandableSidebarItemProps = {
|
|
4
|
-
|
|
3
|
+
children: React.ReactNode;
|
|
5
4
|
label: string;
|
|
6
|
-
|
|
7
|
-
icon: React.ReactNode;
|
|
5
|
+
icon?: React.ReactNode;
|
|
8
6
|
badge?: number | string;
|
|
9
7
|
href: string;
|
|
10
8
|
iconWidth?: string | number;
|
|
11
9
|
truncateLabel?: boolean;
|
|
10
|
+
enabled?: boolean;
|
|
12
11
|
};
|
|
13
|
-
export declare function ExpandableSidebarItem({
|
|
12
|
+
export declare function ExpandableSidebarItem({ children, label, icon, badge, href, iconWidth, truncateLabel, enabled, }: ExpandableSidebarItemProps): React.ReactNode;
|
|
14
13
|
export {};
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { ChevronDown } from 'lucide-react';
|
|
4
|
-
import {
|
|
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
|
-
|
|
10
|
+
children,
|
|
16
11
|
label,
|
|
17
12
|
icon,
|
|
18
13
|
badge,
|
|
19
|
-
component: Component,
|
|
20
14
|
href,
|
|
21
15
|
iconWidth,
|
|
22
|
-
truncateLabel
|
|
16
|
+
truncateLabel,
|
|
17
|
+
enabled = true
|
|
23
18
|
}) {
|
|
24
19
|
const {
|
|
25
20
|
defaultExpanded,
|
|
@@ -30,121 +25,51 @@ function ExpandableSidebarItem({
|
|
|
30
25
|
collapseItem,
|
|
31
26
|
isExpanded
|
|
32
27
|
} = useSidebar();
|
|
33
|
-
const
|
|
34
|
-
const expanded =
|
|
28
|
+
const childrenId = useId();
|
|
29
|
+
const expanded = isExpanded(href);
|
|
30
|
+
const visible = expanded && !isSidebarCollapsed;
|
|
35
31
|
useEffect(() => {
|
|
36
32
|
if (defaultExpanded === null) return;
|
|
37
33
|
if (defaultExpanded) expandItem(href);
|
|
38
34
|
else collapseItem(href);
|
|
39
35
|
}, [defaultExpanded, expandItem, collapseItem, href]);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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",
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
"button",
|
|
141
39
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
40
|
+
type: "button",
|
|
41
|
+
className: styles.toggleButton,
|
|
42
|
+
"aria-label": isSidebarCollapsed ? label : void 0,
|
|
43
|
+
"aria-expanded": visible,
|
|
44
|
+
"aria-controls": childrenId,
|
|
45
|
+
disabled: !enabled,
|
|
46
|
+
onClick: () => {
|
|
47
|
+
resetExpandAll();
|
|
48
|
+
handleSidebarCollapseChange(false);
|
|
49
|
+
if (visible) collapseItem(href);
|
|
50
|
+
else expandItem(href);
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ jsx(
|
|
53
|
+
SidebarItemContent,
|
|
54
|
+
{
|
|
55
|
+
icon,
|
|
56
|
+
badge,
|
|
57
|
+
iconWidth,
|
|
58
|
+
label,
|
|
59
|
+
disableActiveStyles: true,
|
|
60
|
+
suffixIcon: /* @__PURE__ */ jsx(
|
|
61
|
+
ChevronDown,
|
|
62
|
+
{
|
|
63
|
+
"aria-hidden": "true",
|
|
64
|
+
className: `${styles.chevron} ${visible ? styles.chevronExpanded : ""}`
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
truncateLabel
|
|
68
|
+
}
|
|
69
|
+
)
|
|
146
70
|
}
|
|
147
|
-
)
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx("div", { id: childrenId, hidden: !visible, className: styles.childrenContainer, children: visible ? children : null })
|
|
148
73
|
] });
|
|
149
74
|
}
|
|
150
75
|
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css
CHANGED
|
@@ -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
|
-
.
|
|
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
|
-
|
|
16
|
-
|
|
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
|
-
.
|
|
34
|
-
|
|
24
|
+
.toggleButton:disabled {
|
|
25
|
+
color: var(--color-fg-subtle);
|
|
26
|
+
cursor: default;
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
.childrenContainer {
|
|
38
|
-
|
|
30
|
+
padding-inline-start: var(--spacing-md);
|
|
39
31
|
}
|
|
40
32
|
|
|
41
33
|
.chevron {
|
|
42
|
-
transition: transform
|
|
34
|
+
transition: transform var(--transition-fast) var(--ease-standard);
|
|
43
35
|
}
|
|
44
36
|
|
|
45
37
|
.chevronExpanded {
|
|
@@ -186,7 +186,7 @@ function SidebarContainer({
|
|
|
186
186
|
] }) }),
|
|
187
187
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.content, children: [
|
|
188
188
|
!hideSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.filter, children: /* @__PURE__ */ jsxRuntime.jsx(SidenavFiltering__default.default, { placeholder: searchPlaceholder, showSettings }) }),
|
|
189
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.links, children: /* @__PURE__ */ jsxRuntime.jsx(SidebarItems.SidebarItems, { activeLink }) })
|
|
190
190
|
] }),
|
|
191
191
|
footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.footerSlot, children: footer }),
|
|
192
192
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.footer, children: [
|
|
@@ -179,7 +179,7 @@ function SidebarContainer({
|
|
|
179
179
|
] }) }),
|
|
180
180
|
/* @__PURE__ */ jsxs("div", { className: styles.content, children: [
|
|
181
181
|
!hideSearch && /* @__PURE__ */ jsx("div", { className: styles.filter, children: /* @__PURE__ */ jsx(SidenavFiltering, { placeholder: searchPlaceholder, showSettings }) }),
|
|
182
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
182
|
+
/* @__PURE__ */ jsx("div", { className: styles.links, children: /* @__PURE__ */ jsx(SidebarItems, { activeLink }) })
|
|
183
183
|
] }),
|
|
184
184
|
footer && /* @__PURE__ */ jsx("div", { className: styles.footerSlot, children: footer }),
|
|
185
185
|
/* @__PURE__ */ jsxs("div", { className: styles.footer, children: [
|
|
@@ -21,7 +21,6 @@ function SidebarItemContent({
|
|
|
21
21
|
href,
|
|
22
22
|
iconWidth,
|
|
23
23
|
disableActiveStyles = false,
|
|
24
|
-
headerStyle,
|
|
25
24
|
truncateLabel = false
|
|
26
25
|
}) {
|
|
27
26
|
const { activeLink, activeQuery, isSidebarCollapsed, wrapItemText } = SidebarProvider.useSidebar();
|
|
@@ -34,7 +33,7 @@ function SidebarItemContent({
|
|
|
34
33
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35
34
|
"span",
|
|
36
35
|
{
|
|
37
|
-
className: `${styles__default.default.container} ${!disableActiveStyles && activeLink === href ? styles__default.default.active : ""} ${isSidebarCollapsed ? styles__default.default.collapsed : ""}
|
|
36
|
+
className: `${styles__default.default.container} ${!disableActiveStyles && href && activeLink === href ? styles__default.default.active : ""} ${isSidebarCollapsed ? styles__default.default.collapsed : ""}`,
|
|
38
37
|
children: [
|
|
39
38
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.iconLabel, children: [
|
|
40
39
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.icon, style: iconStyle, children: icon }),
|
|
@@ -8,7 +8,6 @@ export interface SidebarItemContentProps {
|
|
|
8
8
|
href?: string;
|
|
9
9
|
iconWidth?: string | number;
|
|
10
10
|
disableActiveStyles?: boolean;
|
|
11
|
-
headerStyle?: boolean;
|
|
12
11
|
truncateLabel?: boolean;
|
|
13
12
|
}
|
|
14
|
-
export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, disableActiveStyles,
|
|
13
|
+
export declare function SidebarItemContent({ icon, label, badge, suffixIcon, href, iconWidth, disableActiveStyles, truncateLabel, }: SidebarItemContentProps): JSX.Element;
|
|
@@ -14,7 +14,6 @@ function SidebarItemContent({
|
|
|
14
14
|
href,
|
|
15
15
|
iconWidth,
|
|
16
16
|
disableActiveStyles = false,
|
|
17
|
-
headerStyle,
|
|
18
17
|
truncateLabel = false
|
|
19
18
|
}) {
|
|
20
19
|
const { activeLink, activeQuery, isSidebarCollapsed, wrapItemText } = useSidebar();
|
|
@@ -27,7 +26,7 @@ function SidebarItemContent({
|
|
|
27
26
|
return /* @__PURE__ */ jsxs(
|
|
28
27
|
"span",
|
|
29
28
|
{
|
|
30
|
-
className: `${styles.container} ${!disableActiveStyles && activeLink === href ? styles.active : ""} ${isSidebarCollapsed ? styles.collapsed : ""}
|
|
29
|
+
className: `${styles.container} ${!disableActiveStyles && href && activeLink === href ? styles.active : ""} ${isSidebarCollapsed ? styles.collapsed : ""}`,
|
|
31
30
|
children: [
|
|
32
31
|
/* @__PURE__ */ jsxs("span", { className: styles.iconLabel, children: [
|
|
33
32
|
/* @__PURE__ */ jsx("span", { className: styles.icon, style: iconStyle, children: icon }),
|
package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
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);
|
|
9
12
|
text-decoration: none;
|
|
@@ -19,12 +22,11 @@
|
|
|
19
22
|
|
|
20
23
|
.container.collapsed {
|
|
21
24
|
justify-content: center;
|
|
22
|
-
padding: var(--spacing-xs);
|
|
23
25
|
border-radius: 0;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
.active {
|
|
27
|
-
background: var(--color-bg-selected);
|
|
29
|
+
background-color: var(--color-bg-selected);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
.active::before {
|
|
@@ -111,14 +113,6 @@
|
|
|
111
113
|
box-shadow: var(--focus-ring);
|
|
112
114
|
}
|
|
113
115
|
|
|
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
116
|
.label {
|
|
123
117
|
min-inline-size: 0;
|
|
124
118
|
flex: 1 1 auto;
|