@wallarm-org/design-system 0.48.0-rc-feature-AS-1033.2 → 0.48.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.
- package/dist/components/AppShell/AppShellRemote.js +1 -1
- package/dist/components/AppShell/story-content/_storyAccountDropdown.js +18 -19
- package/dist/components/AppShell/story-content/_storyConfigRenderer.js +4 -5
- package/dist/components/AppShell/story-content/_storyNavConfigs.js +70 -3
- package/dist/components/AppShell/story-content/_storyQuickHelpDropdown.js +23 -9
- package/dist/components/NavPanel/NavPanelGroupLabel.js +1 -1
- package/dist/components/NavPanel/NavPanelHeader.js +1 -1
- package/dist/components/NavRail/classes.js +2 -2
- package/dist/components/OverflowList/OverflowList.js +28 -33
- package/dist/components/ProductNav/HeaderActions.d.ts +6 -0
- package/dist/components/ProductNav/HeaderActions.js +27 -0
- package/dist/components/ProductNav/NavItemsList.d.ts +10 -0
- package/dist/components/ProductNav/NavItemsList.js +69 -0
- package/dist/components/ProductNav/ProductNav.js +10 -1
- package/dist/components/ProductNav/ProductNavPanel.js +95 -68
- package/dist/components/ProductNav/index.d.ts +1 -1
- package/dist/components/ProductNav/matchNav.js +13 -3
- package/dist/components/ProductNav/types.d.ts +7 -0
- package/dist/components/ProductNav/useDrillTransition.d.ts +10 -0
- package/dist/components/ProductNav/useDrillTransition.js +25 -0
- package/dist/components/Select/SelectSeparator.d.ts +2 -5
- package/dist/components/Select/SelectSeparator.js +4 -9
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Table/mocks.js +10 -40
- package/dist/components/Tooltip/TooltipContent.js +2 -2
- package/dist/hooks/useOverflowItems.js +64 -80
- package/dist/metadata/components.json +4 -316
- package/dist/theme/components/product-nav.css +40 -0
- package/dist/theme/index.css +1 -0
- package/dist/theme/semantic.css +1 -1
- package/package.json +1 -1
- package/dist/components/OverflowList/OverflowList.helpers.d.ts +0 -30
- package/dist/components/OverflowList/OverflowList.helpers.js +0 -16
- package/dist/hooks/useOverflowItems.helpers.d.ts +0 -15
- package/dist/hooks/useOverflowItems.helpers.js +0 -19
|
@@ -8,7 +8,7 @@ const AppShellRemote = ({ ref, className, children, ...props })=>{
|
|
|
8
8
|
ref: ref,
|
|
9
9
|
"data-slot": "app-shell-remote",
|
|
10
10
|
"data-testid": testId,
|
|
11
|
-
className: cn('[grid-area:remote] relative overflow-auto overscroll-none rounded-tl-12 border border-border-primary-light bg-bg-page-bg', className),
|
|
11
|
+
className: cn('[grid-area:remote] relative overflow-auto overscroll-none rounded-tl-12 border-t border-l border-border-primary-light bg-bg-page-bg', className),
|
|
12
12
|
children: children
|
|
13
13
|
});
|
|
14
14
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Check, LogOut, PanelLeftDashed, PencilRuler, Settings, User } from "../../../icons/index.js";
|
|
3
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem } from "../../DropdownMenu/index.js";
|
|
3
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem } from "../../DropdownMenu/index.js";
|
|
4
4
|
import { NavRailItem } from "../../NavRail/index.js";
|
|
5
5
|
import { HStack, VStack } from "../../Stack/index.js";
|
|
6
6
|
import { Text } from "../../Text/index.js";
|
|
@@ -17,7 +17,10 @@ const SIDEBAR_MODE_LABELS = {
|
|
|
17
17
|
const AccountDropdown = ({ sidebarMode, onSidebarModeChange, theme, onThemeChange })=>/*#__PURE__*/ jsxs(DropdownMenu, {
|
|
18
18
|
positioning: {
|
|
19
19
|
placement: 'right-end',
|
|
20
|
-
gutter:
|
|
20
|
+
gutter: 6,
|
|
21
|
+
offset: {
|
|
22
|
+
crossAxis: 12
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
children: [
|
|
23
26
|
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
@@ -74,16 +77,14 @@ const AccountDropdown = ({ sidebarMode, onSidebarModeChange, theme, onThemeChang
|
|
|
74
77
|
/*#__PURE__*/ jsx(DropdownMenuItemIcon, {
|
|
75
78
|
children: /*#__PURE__*/ jsx(PencilRuler, {})
|
|
76
79
|
}),
|
|
77
|
-
/*#__PURE__*/ jsxs(
|
|
80
|
+
/*#__PURE__*/ jsxs(DropdownMenuItemContent, {
|
|
78
81
|
children: [
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
/*#__PURE__*/ jsx(DropdownMenuItemText, {
|
|
83
|
+
children: "Theme"
|
|
84
|
+
}),
|
|
81
85
|
/*#__PURE__*/ jsx(Text, {
|
|
82
|
-
size: "
|
|
83
|
-
|
|
84
|
-
style: {
|
|
85
|
-
display: 'inline'
|
|
86
|
-
},
|
|
86
|
+
size: "xs",
|
|
87
|
+
color: "secondary",
|
|
87
88
|
children: THEME_LABELS[theme]
|
|
88
89
|
})
|
|
89
90
|
]
|
|
@@ -91,7 +92,7 @@ const AccountDropdown = ({ sidebarMode, onSidebarModeChange, theme, onThemeChang
|
|
|
91
92
|
]
|
|
92
93
|
}),
|
|
93
94
|
/*#__PURE__*/ jsxs(DropdownMenuContent, {
|
|
94
|
-
className: "w-
|
|
95
|
+
className: "w-132",
|
|
95
96
|
children: [
|
|
96
97
|
/*#__PURE__*/ jsxs(DropdownMenuItem, {
|
|
97
98
|
onSelect: ()=>onThemeChange('light'),
|
|
@@ -126,16 +127,14 @@ const AccountDropdown = ({ sidebarMode, onSidebarModeChange, theme, onThemeChang
|
|
|
126
127
|
/*#__PURE__*/ jsx(DropdownMenuItemIcon, {
|
|
127
128
|
children: /*#__PURE__*/ jsx(PanelLeftDashed, {})
|
|
128
129
|
}),
|
|
129
|
-
/*#__PURE__*/ jsxs(
|
|
130
|
+
/*#__PURE__*/ jsxs(DropdownMenuItemContent, {
|
|
130
131
|
children: [
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
/*#__PURE__*/ jsx(DropdownMenuItemText, {
|
|
133
|
+
children: "Sidebar mode"
|
|
134
|
+
}),
|
|
133
135
|
/*#__PURE__*/ jsx(Text, {
|
|
134
|
-
size: "
|
|
135
|
-
|
|
136
|
-
style: {
|
|
137
|
-
display: 'inline'
|
|
138
|
-
},
|
|
136
|
+
size: "xs",
|
|
137
|
+
color: "secondary",
|
|
139
138
|
children: SIDEBAR_MODE_LABELS[sidebarMode]
|
|
140
139
|
})
|
|
141
140
|
]
|
|
@@ -6,9 +6,10 @@ import { RemoteShell, RemoteShellBreadcrumb, RemoteShellContent, RemoteShellPane
|
|
|
6
6
|
import { HomeContent } from "./_storyHomeContent.js";
|
|
7
7
|
import { PRODUCT_CONFIGS } from "./_storyLib.js";
|
|
8
8
|
const PageContent = ()=>{
|
|
9
|
-
const {
|
|
9
|
+
const { breadcrumbSegments } = useProductNavContext();
|
|
10
10
|
const lastSegment = breadcrumbSegments[breadcrumbSegments.length - 1];
|
|
11
|
-
const pageTitle = lastSegment?.label ??
|
|
11
|
+
const pageTitle = lastSegment?.label ?? '';
|
|
12
|
+
const fullPath = breadcrumbSegments.map((s)=>s.label).join(' / ');
|
|
12
13
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
13
14
|
children: [
|
|
14
15
|
/*#__PURE__*/ jsx("h1", {
|
|
@@ -19,9 +20,7 @@ const PageContent = ()=>{
|
|
|
19
20
|
className: "mt-8 text-sm text-text-secondary",
|
|
20
21
|
children: [
|
|
21
22
|
"Placeholder page for ",
|
|
22
|
-
|
|
23
|
-
" / ",
|
|
24
|
-
pageTitle,
|
|
23
|
+
fullPath,
|
|
25
24
|
"."
|
|
26
25
|
]
|
|
27
26
|
})
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { CircleDashed } from "../../../icons/index.js";
|
|
1
|
+
import { CircleDashed, Filter, Plus } from "../../../icons/index.js";
|
|
2
2
|
const edgeNavConfig = {
|
|
3
3
|
productLabel: 'Edge',
|
|
4
|
+
headerActions: [
|
|
5
|
+
{
|
|
6
|
+
icon: Filter,
|
|
7
|
+
label: 'Filter',
|
|
8
|
+
onClick: ()=>alert('Filter clicked')
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
icon: Plus,
|
|
12
|
+
label: 'Add',
|
|
13
|
+
onClick: ()=>alert('Add clicked')
|
|
14
|
+
}
|
|
15
|
+
],
|
|
4
16
|
items: [
|
|
5
17
|
{
|
|
6
18
|
type: 'link',
|
|
@@ -47,11 +59,59 @@ const edgeNavConfig = {
|
|
|
47
59
|
icon: CircleDashed
|
|
48
60
|
},
|
|
49
61
|
{
|
|
50
|
-
type: '
|
|
62
|
+
type: 'drill',
|
|
51
63
|
id: 'dp-nodes',
|
|
52
64
|
label: 'Nodes',
|
|
53
65
|
path: 'nodes',
|
|
54
|
-
icon: CircleDashed
|
|
66
|
+
icon: CircleDashed,
|
|
67
|
+
param: 'nodeId',
|
|
68
|
+
entities: [
|
|
69
|
+
{
|
|
70
|
+
id: 'node-1',
|
|
71
|
+
label: 'Node 1',
|
|
72
|
+
description: 'Primary node'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'node-2',
|
|
76
|
+
label: 'Node 2',
|
|
77
|
+
description: 'Secondary node'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'node-3',
|
|
81
|
+
label: 'Node 3',
|
|
82
|
+
description: 'Tertiary node'
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
children: [
|
|
86
|
+
{
|
|
87
|
+
type: 'link',
|
|
88
|
+
id: 'node-overview',
|
|
89
|
+
label: 'Overview',
|
|
90
|
+
path: 'overview',
|
|
91
|
+
icon: CircleDashed
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'link',
|
|
95
|
+
id: 'node-metrics',
|
|
96
|
+
label: 'Metrics',
|
|
97
|
+
path: 'metrics',
|
|
98
|
+
icon: CircleDashed
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'link',
|
|
102
|
+
id: 'node-logs',
|
|
103
|
+
label: 'Logs',
|
|
104
|
+
path: 'logs',
|
|
105
|
+
icon: CircleDashed
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'link',
|
|
109
|
+
id: 'node-config',
|
|
110
|
+
label: 'Configuration',
|
|
111
|
+
path: 'config',
|
|
112
|
+
icon: CircleDashed
|
|
113
|
+
}
|
|
114
|
+
]
|
|
55
115
|
},
|
|
56
116
|
{
|
|
57
117
|
type: 'link',
|
|
@@ -394,6 +454,13 @@ const aiHypervisorNavConfig = {
|
|
|
394
454
|
};
|
|
395
455
|
const infraDiscoveryNavConfig = {
|
|
396
456
|
productLabel: 'Infra Discovery',
|
|
457
|
+
headerActions: [
|
|
458
|
+
{
|
|
459
|
+
icon: Filter,
|
|
460
|
+
label: 'Filter',
|
|
461
|
+
onClick: ()=>alert('Filter clicked')
|
|
462
|
+
}
|
|
463
|
+
],
|
|
397
464
|
items: [
|
|
398
465
|
{
|
|
399
466
|
type: 'link',
|
|
@@ -3,21 +3,35 @@ import { Activity, Book, CircleHelp, LifeBuoy, NotebookText, SquareArrowOutUpRig
|
|
|
3
3
|
import { Button } from "../../Button/index.js";
|
|
4
4
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from "../../DropdownMenu/index.js";
|
|
5
5
|
import { Text } from "../../Text/index.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../../Tooltip/index.js";
|
|
6
7
|
const QuickHelpDropdown = ()=>/*#__PURE__*/ jsxs(DropdownMenu, {
|
|
7
8
|
positioning: {
|
|
8
9
|
placement: 'bottom-end',
|
|
9
10
|
gutter: 4
|
|
10
11
|
},
|
|
11
12
|
children: [
|
|
12
|
-
/*#__PURE__*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
/*#__PURE__*/ jsxs(Tooltip, {
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
16
|
+
asChild: true,
|
|
17
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
18
|
+
className: "inline-flex",
|
|
19
|
+
children: /*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
20
|
+
asChild: true,
|
|
21
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
22
|
+
variant: "ghost",
|
|
23
|
+
size: "small",
|
|
24
|
+
color: "neutral",
|
|
25
|
+
"aria-label": "Quick Help",
|
|
26
|
+
children: /*#__PURE__*/ jsx(CircleHelp, {})
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
32
|
+
children: "Quick help"
|
|
33
|
+
})
|
|
34
|
+
]
|
|
21
35
|
}),
|
|
22
36
|
/*#__PURE__*/ jsxs(DropdownMenuContent, {
|
|
23
37
|
className: "w-320",
|
|
@@ -38,7 +38,7 @@ const NavPanelGroupLabel = ({ ref, icon: Icon, className, children, ...props })=
|
|
|
38
38
|
children: children
|
|
39
39
|
}),
|
|
40
40
|
/*#__PURE__*/ jsx(ChevronRight, {
|
|
41
|
-
size: "
|
|
41
|
+
size: "md",
|
|
42
42
|
className: cn('shrink-0 transition-transform duration-150', expanded && 'rotate-90')
|
|
43
43
|
})
|
|
44
44
|
]
|
|
@@ -9,7 +9,7 @@ const NavPanelHeader = ({ ref, className, children, ...props })=>{
|
|
|
9
9
|
ref: ref,
|
|
10
10
|
"data-slot": "nav-panel-header",
|
|
11
11
|
"data-testid": testId,
|
|
12
|
-
className: cn('sticky top-0 z-10 flex shrink-0 items-center
|
|
12
|
+
className: cn('sticky top-0 z-10 flex shrink-0 items-center p-4', className),
|
|
13
13
|
children: /*#__PURE__*/ jsx(Text, {
|
|
14
14
|
size: "sm",
|
|
15
15
|
weight: "medium",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
const navRailVariants = cva('flex h-full shrink-0 flex-col overflow-hidden px-8
|
|
2
|
+
const navRailVariants = cva('flex h-full shrink-0 flex-col overflow-hidden px-8 pt-6 pb-12 transition-[width] duration-200 ease-in-out', {
|
|
3
3
|
variants: {
|
|
4
4
|
collapsed: {
|
|
5
5
|
true: 'w-[48px]',
|
|
@@ -10,7 +10,7 @@ const navRailVariants = cva('flex h-full shrink-0 flex-col overflow-hidden px-8
|
|
|
10
10
|
collapsed: false
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
const navRailItemVariants = cva('overlay flex h-32 w-full cursor-pointer items-center rounded-6 p-8 text-sm transition-colors outline-none', {
|
|
13
|
+
const navRailItemVariants = cva('overlay flex h-32 w-full cursor-pointer items-center rounded-6 p-8 text-sm transition-colors outline-none data-[state=open]:overlay-states-primary-active data-[state=open]:text-text-primary', {
|
|
14
14
|
variants: {
|
|
15
15
|
active: {
|
|
16
16
|
true: 'overlay-states-primary-active text-text-primary',
|
|
@@ -1,52 +1,48 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback,
|
|
2
|
+
import { memo, useCallback, useMemo } from "react";
|
|
3
3
|
import { useOverflowItems } from "../../hooks/index.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
|
-
import { OVERFLOW_RESERVE_SPACE, areItemsShallowEqual, resolveVisibleItems } from "./OverflowList.helpers.js";
|
|
6
5
|
const OverflowListComponent = ({ items, itemRenderer, overflowRenderer, className, collapseFrom = 'end', minVisibleItems = 0, alwaysRenderOverflow = false, onOverflow, ...props })=>{
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
if (!map.has(item)) map.set(item, index);
|
|
11
|
-
});
|
|
12
|
-
return map;
|
|
6
|
+
const memoizedItemRenderer = useCallback((item)=>{
|
|
7
|
+
const index = items.indexOf(item);
|
|
8
|
+
return itemRenderer(item, index);
|
|
13
9
|
}, [
|
|
14
|
-
items
|
|
15
|
-
]);
|
|
16
|
-
const memoizedItemRenderer = useCallback((item)=>itemRenderer(item, indexMap.get(item) ?? 0), [
|
|
17
|
-
indexMap,
|
|
10
|
+
items,
|
|
18
11
|
itemRenderer
|
|
19
12
|
]);
|
|
20
|
-
const memoizedMeasurementRenderer = useCallback((item)=>
|
|
21
|
-
|
|
13
|
+
const memoizedMeasurementRenderer = useCallback((item)=>{
|
|
14
|
+
const index = items.indexOf(item);
|
|
15
|
+
return itemRenderer(item, index);
|
|
16
|
+
}, [
|
|
17
|
+
items,
|
|
22
18
|
itemRenderer
|
|
23
19
|
]);
|
|
24
20
|
const { containerRef, visibleItems, hiddenItems, MeasurementContainer } = useOverflowItems({
|
|
25
21
|
items,
|
|
26
22
|
renderItem: memoizedMeasurementRenderer,
|
|
27
23
|
overflowRenderer: (items)=>overflowRenderer(items),
|
|
28
|
-
reserveSpace:
|
|
24
|
+
reserveSpace: 80
|
|
29
25
|
});
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
minVisibleItems
|
|
35
|
-
}), [
|
|
36
|
-
items,
|
|
26
|
+
const finalVisibleItems = useMemo(()=>{
|
|
27
|
+
if (visibleItems.length < minVisibleItems && items.length >= minVisibleItems) return items.slice(0, minVisibleItems);
|
|
28
|
+
return visibleItems;
|
|
29
|
+
}, [
|
|
37
30
|
visibleItems,
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
minVisibleItems,
|
|
32
|
+
items
|
|
33
|
+
]);
|
|
34
|
+
const finalHiddenItems = useMemo(()=>{
|
|
35
|
+
if (finalVisibleItems.length !== visibleItems.length) return items.slice(finalVisibleItems.length);
|
|
36
|
+
return hiddenItems;
|
|
37
|
+
}, [
|
|
38
|
+
finalVisibleItems.length,
|
|
39
|
+
visibleItems.length,
|
|
40
|
+
items,
|
|
41
|
+
hiddenItems
|
|
40
42
|
]);
|
|
41
43
|
const finalHiddenCount = finalHiddenItems.length;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (!onOverflow || 0 === finalHiddenItems.length) {
|
|
45
|
-
prevHiddenRef.current = finalHiddenItems;
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (!areItemsShallowEqual(prevHiddenRef.current, finalHiddenItems)) onOverflow(finalHiddenItems);
|
|
49
|
-
prevHiddenRef.current = finalHiddenItems;
|
|
44
|
+
useMemo(()=>{
|
|
45
|
+
if (onOverflow && finalHiddenItems.length > 0) onOverflow(finalHiddenItems);
|
|
50
46
|
}, [
|
|
51
47
|
finalHiddenItems,
|
|
52
48
|
onOverflow
|
|
@@ -69,7 +65,6 @@ const OverflowListComponent = ({ items, itemRenderer, overflowRenderer, classNam
|
|
|
69
65
|
/*#__PURE__*/ jsx(MeasurementContainer, {}),
|
|
70
66
|
/*#__PURE__*/ jsxs("div", {
|
|
71
67
|
ref: containerRef,
|
|
72
|
-
"data-slot": "overflow-list",
|
|
73
68
|
className: cn('flex w-full min-w-0', className),
|
|
74
69
|
...props,
|
|
75
70
|
children: [
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../Button/index.js";
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip/index.js";
|
|
4
|
+
const HeaderActions = ({ actions })=>/*#__PURE__*/ jsx("div", {
|
|
5
|
+
className: "flex items-center gap-2",
|
|
6
|
+
children: actions.map(({ icon: Icon, label, onClick, disabled })=>/*#__PURE__*/ jsxs(Tooltip, {
|
|
7
|
+
children: [
|
|
8
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
9
|
+
asChild: true,
|
|
10
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
11
|
+
variant: "ghost",
|
|
12
|
+
size: "small",
|
|
13
|
+
color: "neutral",
|
|
14
|
+
"aria-label": label,
|
|
15
|
+
onClick: onClick,
|
|
16
|
+
disabled: disabled,
|
|
17
|
+
children: /*#__PURE__*/ jsx(Icon, {})
|
|
18
|
+
})
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsx(TooltipContent, {
|
|
21
|
+
children: label
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
}, label))
|
|
25
|
+
});
|
|
26
|
+
HeaderActions.displayName = 'HeaderActions';
|
|
27
|
+
export { HeaderActions };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { NavConfigDrill, NavConfigNode } from './types';
|
|
3
|
+
export type NavItemsListProps = {
|
|
4
|
+
items: NavConfigNode[];
|
|
5
|
+
activeItemId: string | null;
|
|
6
|
+
onNavigate: (path: string) => void;
|
|
7
|
+
onDrillClick?: (drill: NavConfigDrill) => void;
|
|
8
|
+
level?: 'root' | 'group';
|
|
9
|
+
};
|
|
10
|
+
export declare const NavItemsList: FC<NavItemsListProps>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NavPanelDivider, NavPanelGroup, NavPanelGroupContent, NavPanelGroupItem, NavPanelGroupLabel, NavPanelItem, NavPanelSectionHeader } from "../NavPanel/index.js";
|
|
3
|
+
const NavItemsList = ({ items, activeItemId, onNavigate, onDrillClick, level = 'root' })=>/*#__PURE__*/ jsx(Fragment, {
|
|
4
|
+
children: items.map((item)=>{
|
|
5
|
+
const divider = item.dividerAfter ? /*#__PURE__*/ jsx(NavPanelDivider, {}, `divider-${item.id}`) : null;
|
|
6
|
+
if ('link' === item.type) {
|
|
7
|
+
const Item = 'group' === level ? NavPanelGroupItem : NavPanelItem;
|
|
8
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsx(Item, {
|
|
11
|
+
icon: item.icon,
|
|
12
|
+
active: activeItemId === item.id,
|
|
13
|
+
onClick: ()=>onNavigate(item.path),
|
|
14
|
+
children: item.label
|
|
15
|
+
}),
|
|
16
|
+
divider
|
|
17
|
+
]
|
|
18
|
+
}, item.id);
|
|
19
|
+
}
|
|
20
|
+
if ('group' === item.type) return /*#__PURE__*/ jsxs("span", {
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ jsxs(NavPanelGroup, {
|
|
23
|
+
defaultExpanded: item.defaultExpanded,
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ jsx(NavPanelGroupLabel, {
|
|
26
|
+
icon: item.icon,
|
|
27
|
+
children: item.label
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsx(NavPanelGroupContent, {
|
|
30
|
+
children: /*#__PURE__*/ jsx(NavItemsList, {
|
|
31
|
+
items: item.children,
|
|
32
|
+
activeItemId: activeItemId,
|
|
33
|
+
onNavigate: onNavigate,
|
|
34
|
+
onDrillClick: onDrillClick,
|
|
35
|
+
level: "group"
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
}),
|
|
40
|
+
divider
|
|
41
|
+
]
|
|
42
|
+
}, item.id);
|
|
43
|
+
if ('section-header' === item.type) return /*#__PURE__*/ jsxs("span", {
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsx(NavPanelSectionHeader, {
|
|
46
|
+
children: item.label
|
|
47
|
+
}),
|
|
48
|
+
divider
|
|
49
|
+
]
|
|
50
|
+
}, item.id);
|
|
51
|
+
if ('drill' === item.type) {
|
|
52
|
+
const Item = 'group' === level ? NavPanelGroupItem : NavPanelItem;
|
|
53
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ jsx(Item, {
|
|
56
|
+
icon: item.icon,
|
|
57
|
+
active: activeItemId === item.id,
|
|
58
|
+
onClick: ()=>onDrillClick?.(item),
|
|
59
|
+
children: item.label
|
|
60
|
+
}),
|
|
61
|
+
divider
|
|
62
|
+
]
|
|
63
|
+
}, item.id);
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
NavItemsList.displayName = 'NavItemsList';
|
|
69
|
+
export { NavItemsList };
|
|
@@ -43,10 +43,19 @@ const ProductNav = ({ config, basePath, onNavigate, children })=>{
|
|
|
43
43
|
]);
|
|
44
44
|
const drillInto = useCallback((drill)=>{
|
|
45
45
|
setVisualDrillLevel(null);
|
|
46
|
+
const segments = pathname.replace(/^\/+|\/+$/g, '').split('/').filter(Boolean);
|
|
47
|
+
const prefixSegments = segments.slice(0, 2 * effectiveDrillLevel);
|
|
46
48
|
const defaultEntity = drill.entities?.[0]?.id ?? 'default';
|
|
47
49
|
const firstChildPath = findFirstLinkPath(drill.children) ?? '';
|
|
48
|
-
setPathname(`/${
|
|
50
|
+
setPathname(`/${[
|
|
51
|
+
...prefixSegments,
|
|
52
|
+
drill.path,
|
|
53
|
+
defaultEntity,
|
|
54
|
+
firstChildPath
|
|
55
|
+
].join('/')}`);
|
|
49
56
|
}, [
|
|
57
|
+
effectiveDrillLevel,
|
|
58
|
+
pathname,
|
|
50
59
|
setPathname
|
|
51
60
|
]);
|
|
52
61
|
const goBack = useCallback(()=>{
|