@sereno-ds/ui 0.24.0 → 0.25.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/README.md +47 -0
- package/dist/feedback/Dialog.d.ts +49 -14
- package/dist/feedback/Dialog.js +133 -109
- package/dist/feedback/Dialog.js.map +1 -1
- package/dist/feedback/ToastProvider.js +6 -1
- package/dist/feedback/ToastProvider.js.map +1 -1
- package/dist/forms/AvatarUpload.js +59 -71
- package/dist/forms/AvatarUpload.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js.map +1 -1
- package/dist/navigation/BottomNav.d.ts +23 -9
- package/dist/navigation/BottomNav.js +59 -47
- package/dist/navigation/BottomNav.js.map +1 -1
- package/dist/navigation/SidebarNav.d.ts +55 -30
- package/dist/navigation/SidebarNav.js +122 -154
- package/dist/navigation/SidebarNav.js.map +1 -1
- package/dist/navigation/Stepper.d.ts +28 -14
- package/dist/navigation/Stepper.js +101 -70
- package/dist/navigation/Stepper.js.map +1 -1
- package/dist/navigation/Tabs.d.ts +44 -13
- package/dist/navigation/Tabs.js +164 -67
- package/dist/navigation/Tabs.js.map +1 -1
- package/dist/navigation/TopBar.d.ts +37 -9
- package/dist/navigation/TopBar.js +45 -39
- package/dist/navigation/TopBar.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +1 -1
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Desktop primary navigation — a **compound component**, the counterpart to
|
|
5
|
+
* `BottomNav`. Grouped sections with dividers, an optional second level per
|
|
6
|
+
* item, and a collapse toggle that drops it to a 72px icon rail.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <SidebarNav value={view} onChange={setView} header={<Wordmark />}>
|
|
10
|
+
* <SidebarNav.Section label="Workspace">
|
|
11
|
+
* <SidebarNav.Item value="agenda" label="Calendar" icon={<Calendar size={18} />} />
|
|
12
|
+
* <SidebarNav.Item value="finance" label="Finance" icon={<Wallet size={18} />}>
|
|
13
|
+
* <SidebarNav.SubItem value="finance:incoming" label="Incoming" />
|
|
14
|
+
* <SidebarNav.SubItem value="finance:payouts" label="Payouts" count={3} />
|
|
15
|
+
* </SidebarNav.Item>
|
|
16
|
+
* </SidebarNav.Section>
|
|
17
|
+
* </SidebarNav>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `Item` is not a destination once it has `SubItem` children — it toggles
|
|
21
|
+
* them instead (an inline accordion when expanded, a hover flyout on the
|
|
22
|
+
* collapsed rail).
|
|
23
|
+
*/
|
|
24
24
|
interface SidebarNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
|
|
25
|
-
sections: SidebarNavSection[];
|
|
26
25
|
value?: string;
|
|
27
26
|
onChange?: (value: string) => void;
|
|
28
27
|
/** Controlled collapse (icon-only rail). */
|
|
@@ -41,13 +40,39 @@ interface SidebarNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCha
|
|
|
41
40
|
};
|
|
42
41
|
/** Component used to render items that carry `href` (e.g. Next's `Link`). Defaults to `'a'`. */
|
|
43
42
|
linkComponent?: React.ElementType;
|
|
43
|
+
children: React.ReactNode;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
interface SidebarNavSectionProps {
|
|
46
|
+
/** Small uppercase heading above the block. Omit for an unlabelled group — the divider still shows. */
|
|
47
|
+
label?: string;
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
interface SidebarNavItemProps {
|
|
51
|
+
value: string;
|
|
52
|
+
label: string;
|
|
53
|
+
/** A Lucide icon passed as a node — sized by the caller. */
|
|
54
|
+
icon?: React.ReactNode;
|
|
55
|
+
count?: number;
|
|
56
|
+
/** Render this leaf as a real link (routing, new-tab, SSR-active) via `linkComponent`. */
|
|
57
|
+
href?: string;
|
|
58
|
+
/** `SidebarNav.SubItem`s — a second level. Present ⇒ this item is not a destination itself, it toggles them. */
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
interface SidebarNavSubItemProps {
|
|
62
|
+
value: string;
|
|
63
|
+
label: string;
|
|
64
|
+
count?: number;
|
|
65
|
+
/** Set by the parent `Item` when rendering this into the collapsed rail's flyout popover — not for consumers to pass. */
|
|
66
|
+
compact?: boolean;
|
|
67
|
+
}
|
|
68
|
+
declare function SidebarNavRoot({ value, onChange, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, collapsible, header, footer, labels, linkComponent, children, style, ...rest }: SidebarNavProps): React.JSX.Element;
|
|
69
|
+
declare function Section({ label, children }: SidebarNavSectionProps): React.JSX.Element;
|
|
70
|
+
declare function Item({ value, label, icon, count, href, children }: SidebarNavItemProps): React.JSX.Element;
|
|
71
|
+
declare function SubItem({ value, label, count, compact }: SidebarNavSubItemProps): React.JSX.Element;
|
|
72
|
+
declare const SidebarNav: typeof SidebarNavRoot & {
|
|
73
|
+
Section: typeof Section;
|
|
74
|
+
Item: typeof Item;
|
|
75
|
+
SubItem: typeof SubItem;
|
|
76
|
+
};
|
|
52
77
|
|
|
53
|
-
export { SidebarNav, type
|
|
78
|
+
export { SidebarNav, type SidebarNavItemProps, type SidebarNavProps, type SidebarNavSectionProps, type SidebarNavSubItemProps };
|
|
@@ -30,8 +30,20 @@ const countPill = (active) => sx({
|
|
|
30
30
|
color: active ? "var(--text-brand)" : "var(--text-muted)",
|
|
31
31
|
boxShadow: "inset 0 0 0 1px " + (active ? "var(--border-brand)" : "var(--border-default)")
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const SidebarNavContext = React.createContext(null);
|
|
34
|
+
function useSidebarNavContext(component) {
|
|
35
|
+
const ctx = React.useContext(SidebarNavContext);
|
|
36
|
+
if (!ctx) throw new Error(`<SidebarNav.${component}> must be rendered inside <SidebarNav>.`);
|
|
37
|
+
return ctx;
|
|
38
|
+
}
|
|
39
|
+
function childValuesOf(children) {
|
|
40
|
+
const out = [];
|
|
41
|
+
React.Children.forEach(children, (child) => {
|
|
42
|
+
if (React.isValidElement(child) && typeof child.props.value === "string") out.push(child.props.value);
|
|
43
|
+
});
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
function SidebarNavRoot({
|
|
35
47
|
value,
|
|
36
48
|
onChange,
|
|
37
49
|
collapsed: collapsedProp,
|
|
@@ -42,6 +54,7 @@ function SidebarNav({
|
|
|
42
54
|
footer,
|
|
43
55
|
labels,
|
|
44
56
|
linkComponent,
|
|
57
|
+
children,
|
|
45
58
|
style,
|
|
46
59
|
...rest
|
|
47
60
|
}) {
|
|
@@ -59,39 +72,29 @@ function SidebarNav({
|
|
|
59
72
|
}, [collapsed]);
|
|
60
73
|
const showTip = (label, r) => setTip({ label, top: r.top + r.height / 2, left: r.right + 10 });
|
|
61
74
|
const hideTip = () => setTip(null);
|
|
62
|
-
const [
|
|
63
|
-
const parent = sections.flatMap((s) => s.items).find((it) => it.children?.some((c) => c.value === value))?.value;
|
|
64
|
-
return new Set(parent ? [parent] : []);
|
|
65
|
-
});
|
|
66
|
-
const toggleAccordion = (v) => setOpenSet((prev) => {
|
|
67
|
-
const next = new Set(prev);
|
|
68
|
-
if (next.has(v)) next.delete(v);
|
|
69
|
-
else next.add(v);
|
|
70
|
-
return next;
|
|
71
|
-
});
|
|
72
|
-
const [flyout, setFlyout] = React.useState(null);
|
|
75
|
+
const [flyoutValue, setFlyoutValue] = React.useState(null);
|
|
73
76
|
const flyoutTimer = React.useRef(void 0);
|
|
74
77
|
const openFlyout = (v) => {
|
|
75
78
|
clearTimeout(flyoutTimer.current);
|
|
76
|
-
|
|
79
|
+
setFlyoutValue(v);
|
|
77
80
|
};
|
|
78
81
|
const closeFlyoutSoon = () => {
|
|
79
82
|
clearTimeout(flyoutTimer.current);
|
|
80
|
-
flyoutTimer.current = setTimeout(() =>
|
|
83
|
+
flyoutTimer.current = setTimeout(() => setFlyoutValue(null), 140);
|
|
81
84
|
};
|
|
82
85
|
const closeFlyoutNow = () => {
|
|
83
86
|
clearTimeout(flyoutTimer.current);
|
|
84
|
-
|
|
87
|
+
setFlyoutValue(null);
|
|
85
88
|
};
|
|
86
89
|
React.useEffect(() => () => clearTimeout(flyoutTimer.current), []);
|
|
87
90
|
React.useEffect(() => {
|
|
88
|
-
if (!collapsed)
|
|
91
|
+
if (!collapsed) setFlyoutValue(null);
|
|
89
92
|
}, [collapsed]);
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
setFlyout(null);
|
|
93
|
+
const select = (v) => {
|
|
94
|
+
closeFlyoutNow();
|
|
93
95
|
onChange?.(v);
|
|
94
96
|
};
|
|
97
|
+
const ctx = { value, select, collapsed, linkComponent, flyoutValue, openFlyout, closeFlyoutSoon, closeFlyoutNow, showTip, hideTip };
|
|
95
98
|
const toggleLabel = collapsed ? labels?.expand ?? "Expand" : labels?.collapse ?? "Collapse";
|
|
96
99
|
const toggleBtn = collapsible ? /* @__PURE__ */ jsx(
|
|
97
100
|
"button",
|
|
@@ -131,7 +134,7 @@ function SidebarNav({
|
|
|
131
134
|
)
|
|
132
135
|
}
|
|
133
136
|
) : null;
|
|
134
|
-
return /* @__PURE__ */ jsxs(
|
|
137
|
+
return /* @__PURE__ */ jsx(SidebarNavContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
135
138
|
"nav",
|
|
136
139
|
{
|
|
137
140
|
...rest,
|
|
@@ -177,41 +180,7 @@ function SidebarNav({
|
|
|
177
180
|
display: "flex",
|
|
178
181
|
flexDirection: "column"
|
|
179
182
|
}),
|
|
180
|
-
children
|
|
181
|
-
"div",
|
|
182
|
-
{
|
|
183
|
-
style: sx({
|
|
184
|
-
display: "flex",
|
|
185
|
-
flexDirection: "column",
|
|
186
|
-
gap: 2,
|
|
187
|
-
marginTop: i ? "var(--space-3)" : 0,
|
|
188
|
-
paddingTop: i ? "var(--space-3)" : 0,
|
|
189
|
-
borderTop: i ? "var(--border-width-hairline) solid var(--border-default)" : "none"
|
|
190
|
-
}),
|
|
191
|
-
children: [
|
|
192
|
-
section.label && !collapsed && /* @__PURE__ */ jsx("span", { style: groupHead, children: section.label }),
|
|
193
|
-
section.items.map((item) => /* @__PURE__ */ jsx(
|
|
194
|
-
ItemRow,
|
|
195
|
-
{
|
|
196
|
-
item,
|
|
197
|
-
collapsed,
|
|
198
|
-
activeValue: value,
|
|
199
|
-
open: collapsed ? flyout === item.value : openSet.has(item.value),
|
|
200
|
-
onToggle: () => collapsed ? flyout === item.value ? setFlyout(null) : openFlyout(item.value) : toggleAccordion(item.value),
|
|
201
|
-
onFlyoutEnter: () => openFlyout(item.value),
|
|
202
|
-
onFlyoutLeave: closeFlyoutSoon,
|
|
203
|
-
onFlyoutClose: closeFlyoutNow,
|
|
204
|
-
onSelect: handleSelect,
|
|
205
|
-
onTip: showTip,
|
|
206
|
-
onTipHide: hideTip,
|
|
207
|
-
linkComponent
|
|
208
|
-
},
|
|
209
|
-
item.value
|
|
210
|
-
))
|
|
211
|
-
]
|
|
212
|
-
},
|
|
213
|
-
section.label ?? i
|
|
214
|
-
))
|
|
183
|
+
children
|
|
215
184
|
}
|
|
216
185
|
),
|
|
217
186
|
footer && !collapsed && /* @__PURE__ */ jsx(
|
|
@@ -276,31 +245,37 @@ function SidebarNav({
|
|
|
276
245
|
)
|
|
277
246
|
]
|
|
278
247
|
}
|
|
279
|
-
);
|
|
248
|
+
) });
|
|
280
249
|
}
|
|
281
|
-
function
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
onSelect,
|
|
291
|
-
onTip,
|
|
292
|
-
onTipHide,
|
|
293
|
-
linkComponent
|
|
294
|
-
}) {
|
|
250
|
+
function Section({ label, children }) {
|
|
251
|
+
const { collapsed } = useSidebarNavContext("Section");
|
|
252
|
+
return /* @__PURE__ */ jsxs("div", { className: "sereno-sidenav-section", style: sx({ display: "flex", flexDirection: "column", gap: 2 }), children: [
|
|
253
|
+
label && !collapsed && /* @__PURE__ */ jsx("span", { style: groupHead, children: label }),
|
|
254
|
+
children
|
|
255
|
+
] });
|
|
256
|
+
}
|
|
257
|
+
function Item({ value, label, icon, count, href, children }) {
|
|
258
|
+
const { value: activeValue, select, collapsed, linkComponent, flyoutValue, openFlyout, closeFlyoutSoon, closeFlyoutNow, showTip, hideTip } = useSidebarNavContext("Item");
|
|
295
259
|
const st = useInteract(false);
|
|
296
260
|
const btnRef = React.useRef(null);
|
|
297
|
-
const hasChildren =
|
|
298
|
-
const
|
|
299
|
-
const
|
|
261
|
+
const hasChildren = React.Children.count(children) > 0;
|
|
262
|
+
const childVals = hasChildren ? childValuesOf(children) : [];
|
|
263
|
+
const selfActive = activeValue === value && !hasChildren;
|
|
264
|
+
const childActive = hasChildren && childVals.includes(activeValue ?? "");
|
|
300
265
|
const highlight = selfActive || collapsed && childActive;
|
|
301
266
|
const railFlyout = collapsed && hasChildren;
|
|
302
|
-
const asLink = !hasChildren && !!
|
|
267
|
+
const asLink = !hasChildren && !!href && !!linkComponent;
|
|
303
268
|
const Link = linkComponent ?? "a";
|
|
269
|
+
const [localOpen, setLocalOpen] = React.useState(() => childActive);
|
|
270
|
+
const open = collapsed ? flyoutValue === value : localOpen;
|
|
271
|
+
const onToggle = () => {
|
|
272
|
+
if (collapsed) {
|
|
273
|
+
if (flyoutValue === value) closeFlyoutNow();
|
|
274
|
+
else openFlyout(value);
|
|
275
|
+
} else {
|
|
276
|
+
setLocalOpen((o) => !o);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
304
279
|
const rowStyle = sx({
|
|
305
280
|
position: "relative",
|
|
306
281
|
display: "flex",
|
|
@@ -323,8 +298,8 @@ function ItemRow({
|
|
|
323
298
|
transition: "var(--transition-control)"
|
|
324
299
|
});
|
|
325
300
|
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
326
|
-
|
|
327
|
-
collapsed && (
|
|
301
|
+
icon && /* @__PURE__ */ jsx("span", { style: sx({ flex: "0 0 auto", display: "inline-flex", width: 20, height: 20, alignItems: "center", justifyContent: "center" }), children: icon }),
|
|
302
|
+
collapsed && (count !== void 0 || childActive) && /* @__PURE__ */ jsx(
|
|
328
303
|
"span",
|
|
329
304
|
{
|
|
330
305
|
"aria-hidden": true,
|
|
@@ -340,8 +315,8 @@ function ItemRow({
|
|
|
340
315
|
}
|
|
341
316
|
),
|
|
342
317
|
!collapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
343
|
-
/* @__PURE__ */ jsx("span", { style: sx({ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }), children:
|
|
344
|
-
|
|
318
|
+
/* @__PURE__ */ jsx("span", { style: sx({ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }), children: label }),
|
|
319
|
+
count !== void 0 && /* @__PURE__ */ jsx("span", { style: countPill(highlight), children: count }),
|
|
345
320
|
hasChildren && /* @__PURE__ */ jsx(
|
|
346
321
|
ChevronDown,
|
|
347
322
|
{
|
|
@@ -357,26 +332,30 @@ function ItemRow({
|
|
|
357
332
|
onMouseEnter: (e) => {
|
|
358
333
|
st.handlers.onMouseEnter?.(e);
|
|
359
334
|
if (!collapsed) return;
|
|
360
|
-
if (railFlyout)
|
|
361
|
-
else
|
|
335
|
+
if (railFlyout) openFlyout(value);
|
|
336
|
+
else showTip(label, e.currentTarget.getBoundingClientRect());
|
|
362
337
|
},
|
|
363
338
|
onMouseLeave: (e) => {
|
|
364
339
|
st.handlers.onMouseLeave?.(e);
|
|
365
|
-
if (railFlyout)
|
|
366
|
-
else
|
|
340
|
+
if (railFlyout) closeFlyoutSoon();
|
|
341
|
+
else hideTip();
|
|
367
342
|
}
|
|
368
343
|
};
|
|
344
|
+
const compactChildren = React.Children.map(
|
|
345
|
+
children,
|
|
346
|
+
(child) => React.isValidElement(child) ? React.cloneElement(child, { compact: true }) : child
|
|
347
|
+
);
|
|
369
348
|
return /* @__PURE__ */ jsxs("div", { style: sx({ display: "flex", flexDirection: "column" }), children: [
|
|
370
349
|
asLink ? /* @__PURE__ */ jsx(
|
|
371
350
|
Link,
|
|
372
351
|
{
|
|
373
|
-
href
|
|
352
|
+
href,
|
|
374
353
|
className: "sereno-sidenav-btn",
|
|
375
|
-
"aria-label": collapsed ?
|
|
354
|
+
"aria-label": collapsed ? label : void 0,
|
|
376
355
|
"aria-current": selfActive ? "page" : void 0,
|
|
377
356
|
onClick: () => {
|
|
378
|
-
|
|
379
|
-
|
|
357
|
+
hideTip();
|
|
358
|
+
select(value);
|
|
380
359
|
},
|
|
381
360
|
...hoverHandlers,
|
|
382
361
|
style: rowStyle,
|
|
@@ -388,14 +367,14 @@ function ItemRow({
|
|
|
388
367
|
ref: btnRef,
|
|
389
368
|
type: "button",
|
|
390
369
|
className: "sereno-sidenav-btn",
|
|
391
|
-
"aria-label": collapsed ?
|
|
370
|
+
"aria-label": collapsed ? label : void 0,
|
|
392
371
|
"aria-current": selfActive ? "page" : void 0,
|
|
393
372
|
"aria-haspopup": hasChildren ? "menu" : void 0,
|
|
394
373
|
"aria-expanded": hasChildren ? open : void 0,
|
|
395
374
|
onClick: () => {
|
|
396
|
-
|
|
375
|
+
hideTip();
|
|
397
376
|
if (hasChildren) onToggle();
|
|
398
|
-
else
|
|
377
|
+
else select(value);
|
|
399
378
|
},
|
|
400
379
|
...hoverHandlers,
|
|
401
380
|
style: rowStyle,
|
|
@@ -413,32 +392,54 @@ function ItemRow({
|
|
|
413
392
|
paddingLeft: "var(--space-3)",
|
|
414
393
|
borderLeft: "var(--border-width-hairline) solid var(--border-default)"
|
|
415
394
|
}),
|
|
416
|
-
children
|
|
395
|
+
children
|
|
417
396
|
}
|
|
418
397
|
),
|
|
419
|
-
railFlyout && open && /* @__PURE__ */ jsx(
|
|
420
|
-
SubmenuPopover,
|
|
421
|
-
{
|
|
422
|
-
anchorRef: btnRef,
|
|
423
|
-
parentLabel: item.label,
|
|
424
|
-
parentIcon: item.icon,
|
|
425
|
-
items: item.children,
|
|
426
|
-
activeValue,
|
|
427
|
-
onSelect,
|
|
428
|
-
onMouseEnter: onFlyoutEnter,
|
|
429
|
-
onMouseLeave: onFlyoutLeave,
|
|
430
|
-
onClose: onFlyoutClose
|
|
431
|
-
}
|
|
432
|
-
)
|
|
398
|
+
railFlyout && open && /* @__PURE__ */ jsx(SubmenuPopover, { anchorRef: btnRef, label, icon, onClose: closeFlyoutNow, onMouseEnter: () => openFlyout(value), onMouseLeave: closeFlyoutSoon, children: compactChildren })
|
|
433
399
|
] });
|
|
434
400
|
}
|
|
401
|
+
function SubItem({ value, label, count, compact = false }) {
|
|
402
|
+
const { value: activeValue, select } = useSidebarNavContext("SubItem");
|
|
403
|
+
const active = activeValue === value;
|
|
404
|
+
const st = useInteract(false);
|
|
405
|
+
return /* @__PURE__ */ jsxs(
|
|
406
|
+
"button",
|
|
407
|
+
{
|
|
408
|
+
type: "button",
|
|
409
|
+
className: "sereno-sidenav-btn",
|
|
410
|
+
"aria-current": active ? "page" : void 0,
|
|
411
|
+
onClick: () => select(value),
|
|
412
|
+
...st.handlers,
|
|
413
|
+
style: sx({
|
|
414
|
+
display: "flex",
|
|
415
|
+
alignItems: "center",
|
|
416
|
+
gap: "var(--space-2)",
|
|
417
|
+
width: "100%",
|
|
418
|
+
height: compact ? 32 : 34,
|
|
419
|
+
padding: "0 var(--space-2)",
|
|
420
|
+
border: "none",
|
|
421
|
+
borderRadius: "var(--radius-sm)",
|
|
422
|
+
cursor: "pointer",
|
|
423
|
+
textAlign: "left",
|
|
424
|
+
fontFamily: "var(--font-body)",
|
|
425
|
+
fontSize: "var(--text-sm)",
|
|
426
|
+
fontWeight: active ? "var(--weight-semibold)" : "var(--weight-medium)",
|
|
427
|
+
background: active ? "var(--bg-brand-soft)" : st.hover ? "var(--interactive-ghost-hover)" : "transparent",
|
|
428
|
+
color: active ? "var(--text-brand)" : "var(--text-secondary)",
|
|
429
|
+
transition: "var(--transition-control)"
|
|
430
|
+
}),
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ jsx("span", { style: sx({ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }), children: label }),
|
|
433
|
+
count !== void 0 && /* @__PURE__ */ jsx("span", { style: countPill(active), children: count })
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}
|
|
435
438
|
function SubmenuPopover({
|
|
436
439
|
anchorRef,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
activeValue,
|
|
441
|
-
onSelect,
|
|
440
|
+
label,
|
|
441
|
+
icon,
|
|
442
|
+
children,
|
|
442
443
|
onClose,
|
|
443
444
|
onMouseEnter,
|
|
444
445
|
onMouseLeave
|
|
@@ -485,7 +486,7 @@ function SubmenuPopover({
|
|
|
485
486
|
{
|
|
486
487
|
ref,
|
|
487
488
|
role: "menu",
|
|
488
|
-
"aria-label":
|
|
489
|
+
"aria-label": label,
|
|
489
490
|
onMouseEnter,
|
|
490
491
|
onMouseLeave,
|
|
491
492
|
style: sx({
|
|
@@ -536,58 +537,25 @@ function SubmenuPopover({
|
|
|
536
537
|
color: "var(--text-primary)"
|
|
537
538
|
}),
|
|
538
539
|
children: [
|
|
539
|
-
|
|
540
|
-
|
|
540
|
+
icon && /* @__PURE__ */ jsx(
|
|
541
|
+
"span",
|
|
542
|
+
{
|
|
543
|
+
style: sx({ flex: "0 0 auto", display: "inline-flex", width: 16, height: 16, alignItems: "center", justifyContent: "center", color: "var(--text-muted)" }),
|
|
544
|
+
children: icon
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
/* @__PURE__ */ jsx("span", { style: sx({ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }), children: label })
|
|
541
548
|
]
|
|
542
549
|
}
|
|
543
550
|
),
|
|
544
|
-
/* @__PURE__ */ jsx("div", { style: sx({ display: "flex", flexDirection: "column", gap: 1 }), children
|
|
551
|
+
/* @__PURE__ */ jsx("div", { style: sx({ display: "flex", flexDirection: "column", gap: 1 }), children })
|
|
545
552
|
]
|
|
546
553
|
}
|
|
547
554
|
),
|
|
548
555
|
document.body
|
|
549
556
|
);
|
|
550
557
|
}
|
|
551
|
-
|
|
552
|
-
sub,
|
|
553
|
-
active,
|
|
554
|
-
onSelect,
|
|
555
|
-
inPopover = false
|
|
556
|
-
}) {
|
|
557
|
-
const st = useInteract(false);
|
|
558
|
-
return /* @__PURE__ */ jsxs(
|
|
559
|
-
"button",
|
|
560
|
-
{
|
|
561
|
-
type: "button",
|
|
562
|
-
className: "sereno-sidenav-btn",
|
|
563
|
-
"aria-current": active ? "page" : void 0,
|
|
564
|
-
onClick: () => onSelect?.(sub.value),
|
|
565
|
-
...st.handlers,
|
|
566
|
-
style: sx({
|
|
567
|
-
display: "flex",
|
|
568
|
-
alignItems: "center",
|
|
569
|
-
gap: "var(--space-2)",
|
|
570
|
-
width: "100%",
|
|
571
|
-
height: inPopover ? 32 : 34,
|
|
572
|
-
padding: "0 var(--space-2)",
|
|
573
|
-
border: "none",
|
|
574
|
-
borderRadius: "var(--radius-sm)",
|
|
575
|
-
cursor: "pointer",
|
|
576
|
-
textAlign: "left",
|
|
577
|
-
fontFamily: "var(--font-body)",
|
|
578
|
-
fontSize: "var(--text-sm)",
|
|
579
|
-
fontWeight: active ? "var(--weight-semibold)" : "var(--weight-medium)",
|
|
580
|
-
background: active ? "var(--bg-brand-soft)" : st.hover ? "var(--interactive-ghost-hover)" : "transparent",
|
|
581
|
-
color: active ? "var(--text-brand)" : "var(--text-secondary)",
|
|
582
|
-
transition: "var(--transition-control)"
|
|
583
|
-
}),
|
|
584
|
-
children: [
|
|
585
|
-
/* @__PURE__ */ jsx("span", { style: sx({ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }), children: sub.label }),
|
|
586
|
-
sub.count !== void 0 && /* @__PURE__ */ jsx("span", { style: countPill(active), children: sub.count })
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
);
|
|
590
|
-
}
|
|
558
|
+
const SidebarNav = Object.assign(SidebarNavRoot, { Section, Item, SubItem });
|
|
591
559
|
export {
|
|
592
560
|
SidebarNav
|
|
593
561
|
};
|