@caratlogic/design-system 0.1.6 → 0.1.8
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/layouts/AppShell/DashboardShell.d.ts.map +1 -1
- package/dist/components/molecules/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/molecules/Modal/Modal.d.ts.map +1 -1
- package/dist/components/molecules/Sidebar/Sidebar.parts.d.ts.map +1 -1
- package/dist/index.cjs.js +97 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +97 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/overlayBodyLock.d.ts +11 -0
- package/dist/lib/overlayBodyLock.d.ts.map +1 -1
- package/dist/ui.cjs.js +7 -11
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +7 -11
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardShell.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/AppShell/DashboardShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DashboardShell.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/AppShell/DashboardShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAwC/C,OAAO,KAAK,EAMV,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AA8X1B,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAkDlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuE/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3D,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS3D;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAW,EACX,eAAuB,EACvB,SAAS,EACT,aAAa,GACd,EAAE,UAAU,2CA8CZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.parts.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Sidebar/Sidebar.parts.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAEL,cAAc,EAGf,MAAM,yBAAyB,CA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Aa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,CAAC;AAEF,eAAO,MAAM,WAAW,8GAA4B,CAAC;AACrD,eAAO,MAAM,kBAAkB,wHAA+B,CAAC;AAC/D,eAAO,MAAM,kBAAkB,qHAA+B,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -4375,13 +4375,19 @@ const notify = {
|
|
|
4375
4375
|
promise: sonner.toast.promise.bind(sonner.toast),
|
|
4376
4376
|
};
|
|
4377
4377
|
|
|
4378
|
+
/**
|
|
4379
|
+
* Only overlays that actually lock `<body>` count. `[data-radix-popper-content-wrapper]`
|
|
4380
|
+
* is deliberately absent: a tooltip renders into one, so including it made an
|
|
4381
|
+
* open tooltip — say, on the Edit button you just clicked — look like a live
|
|
4382
|
+
* modal and suppress the release, leaving the page unclickable. Modal poppers
|
|
4383
|
+
* (menus, selects) still match through their roles.
|
|
4384
|
+
*/
|
|
4378
4385
|
const OVERLAY_CONTENT_SELECTOR = [
|
|
4379
4386
|
'[data-slot="dialog-content"]',
|
|
4380
4387
|
'[role="dialog"]',
|
|
4381
4388
|
'[role="alertdialog"]',
|
|
4382
4389
|
'[role="menu"]',
|
|
4383
4390
|
'[role="listbox"]',
|
|
4384
|
-
'[data-radix-popper-content-wrapper]',
|
|
4385
4391
|
].join(',');
|
|
4386
4392
|
/**
|
|
4387
4393
|
* `@radix-ui/react-dismissable-layer` keeps the value it must restore to
|
|
@@ -4393,6 +4399,36 @@ const OVERLAY_CONTENT_SELECTOR = [
|
|
|
4393
4399
|
* Clearing is only safe once nothing is on screen, so this is a no-op while any
|
|
4394
4400
|
* overlay content is still mounted.
|
|
4395
4401
|
*/
|
|
4402
|
+
/**
|
|
4403
|
+
* Watches `<body>` and clears a lock that outlives every overlay.
|
|
4404
|
+
*
|
|
4405
|
+
* The per-overlay hooks handle the normal close path; this is the backstop for
|
|
4406
|
+
* the ones they cannot see — an overlay unmounted by a route change, a layer
|
|
4407
|
+
* combination nobody anticipated, a third-party popup. Returns a disposer.
|
|
4408
|
+
*
|
|
4409
|
+
* Cheap: an attribute-scoped MutationObserver that only reacts when something
|
|
4410
|
+
* actually writes `style` or `data-scroll-locked` on `<body>`.
|
|
4411
|
+
*/
|
|
4412
|
+
function watchOverlayBodyLock() {
|
|
4413
|
+
if (typeof document === 'undefined')
|
|
4414
|
+
return () => { };
|
|
4415
|
+
let timer;
|
|
4416
|
+
const check = () => {
|
|
4417
|
+
window.clearTimeout(timer);
|
|
4418
|
+
// Outlive the exit animation, so a legitimately-open overlay is still
|
|
4419
|
+
// mounted when `releaseStaleOverlayBodyLock` looks for it.
|
|
4420
|
+
timer = window.setTimeout(() => releaseStaleOverlayBodyLock(), 500);
|
|
4421
|
+
};
|
|
4422
|
+
const observer = new MutationObserver(check);
|
|
4423
|
+
observer.observe(document.body, {
|
|
4424
|
+
attributes: true,
|
|
4425
|
+
attributeFilter: ['style', 'data-scroll-locked'],
|
|
4426
|
+
});
|
|
4427
|
+
return () => {
|
|
4428
|
+
window.clearTimeout(timer);
|
|
4429
|
+
observer.disconnect();
|
|
4430
|
+
};
|
|
4431
|
+
}
|
|
4396
4432
|
function releaseStaleOverlayBodyLock() {
|
|
4397
4433
|
if (typeof document === 'undefined')
|
|
4398
4434
|
return;
|
|
@@ -12123,6 +12159,9 @@ function useRefundToWallet(open) {
|
|
|
12123
12159
|
|
|
12124
12160
|
const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', icon: Icon = Trash2, disabled = false, onConfirm, onCancel, }) => {
|
|
12125
12161
|
const { refundToWallet, setRefundToWallet } = useRefundToWallet(open);
|
|
12162
|
+
// Opened from a modal menu row, two dismissable layers overlap and Radix
|
|
12163
|
+
// restores `pointer-events: none` to <body> on close, freezing the page.
|
|
12164
|
+
useOverlayBodyLockRelease(open);
|
|
12126
12165
|
return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(DialogContent, { className: "gap-3 p-5", children: [jsxRuntime.jsxs(DialogHeader, { className: "gap-1.5", children: [jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsxRuntime.jsx("span", { className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: jsxRuntime.jsx(Icon, { className: "h-3.5 w-3.5 text-destructive" }) })), jsxRuntime.jsx("span", { children: title })] }), description && jsxRuntime.jsx(DialogDescription, { children: description }), info && (jsxRuntime.jsx(InfoCard, { info: info, title: title, refundToWallet: refundToWallet, onRefundChange: setRefundToWallet }))] }), jsxRuntime.jsxs(DialogFooter, { className: "mt-1", children: [jsxRuntime.jsx(Button$1, { variant: "outline", onClick: () => {
|
|
12127
12166
|
onCancel?.();
|
|
12128
12167
|
onOpenChange(false);
|
|
@@ -28606,6 +28645,8 @@ const SIZE_WIDTH = {
|
|
|
28606
28645
|
*/
|
|
28607
28646
|
function Modal({ open, onClose, title, icon, children, footer, size = 'md', hideCloseButton = false, className, bodyClassName, }) {
|
|
28608
28647
|
const maxWidth = SIZE_WIDTH[size];
|
|
28648
|
+
// See ConfirmDialog: overlapping dismissable layers leak the <body> lock.
|
|
28649
|
+
useOverlayBodyLockRelease(open);
|
|
28609
28650
|
return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (o) => !o && onClose(), children: jsxRuntime.jsxs(DialogContent, { hideCloseButton: true, style: {
|
|
28610
28651
|
width: `min(${maxWidth}px, calc(100vw - 2rem))`,
|
|
28611
28652
|
maxWidth: `${maxWidth}px`,
|
|
@@ -57438,7 +57479,11 @@ const SidebarInset = React__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
57438
57479
|
SidebarInset.displayName = 'SidebarInset';
|
|
57439
57480
|
const SidebarInput = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("input", { ref: ref, "data-sidebar": "input", className: cn('h-8 w-full bg-background text-sm shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring', className), ...props })));
|
|
57440
57481
|
SidebarInput.displayName = 'SidebarInput';
|
|
57441
|
-
const SidebarHeader = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("div", { ref: ref, "data-sidebar": "header",
|
|
57482
|
+
const SidebarHeader = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("div", { ref: ref, "data-sidebar": "header",
|
|
57483
|
+
/* Icon mode drops the asymmetric pl-4/pr-1 (which is there for the expanded
|
|
57484
|
+
brand + collapse button row) so a centred brand lands on the same axis as
|
|
57485
|
+
the nav icons below it. */
|
|
57486
|
+
className: cn('flex flex-col gap-2 pr-1 pt-3 pb-4 pl-4 group-data-[collapsible=icon]:px-0', className), ...props })));
|
|
57442
57487
|
SidebarHeader.displayName = 'SidebarHeader';
|
|
57443
57488
|
const SidebarFooter = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("div", { ref: ref, "data-sidebar": "footer", className: cn('flex flex-col gap-2 pr-1 py-4 pl-4', className), ...props })));
|
|
57444
57489
|
SidebarFooter.displayName = 'SidebarFooter';
|
|
@@ -57464,6 +57509,21 @@ const SidebarMenu = React__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
57464
57509
|
SidebarMenu.displayName = 'SidebarMenu';
|
|
57465
57510
|
const SidebarMenuItem = React__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx("li", { ref: ref, "data-sidebar": "menu-item", className: cn('group/menu-item relative', className), ...props })));
|
|
57466
57511
|
SidebarMenuItem.displayName = 'SidebarMenuItem';
|
|
57512
|
+
/**
|
|
57513
|
+
* Owns a nav tooltip's open state so every tooltip closes when the sidebar
|
|
57514
|
+
* expands or collapses. The width transition slides buttons out from under a
|
|
57515
|
+
* stationary pointer without firing `pointerleave`, so Radix otherwise keeps
|
|
57516
|
+
* each tooltip it opened on the way in — they surface together the moment the
|
|
57517
|
+
* rail renders them, and only a fresh hover dismisses them one by one.
|
|
57518
|
+
*/
|
|
57519
|
+
const useSidebarTooltipOpen = () => {
|
|
57520
|
+
const { state } = useSidebar();
|
|
57521
|
+
const [open, setOpen] = React__namespace.useState(false);
|
|
57522
|
+
React__namespace.useEffect(() => {
|
|
57523
|
+
setOpen(false);
|
|
57524
|
+
}, [state]);
|
|
57525
|
+
return { open, setOpen };
|
|
57526
|
+
};
|
|
57467
57527
|
const sidebarMenuButtonVariants = cva('peer/menu-button relative flex h-9 w-full cursor-pointer items-center gap-2 overflow-hidden rounded-sm px-2.5 py-1.5 text-left text-sm text-sidebar-foreground outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-active-bg data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-active-bg data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:!size-9 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:[&>span]:hidden [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0', {
|
|
57468
57528
|
variants: {
|
|
57469
57529
|
variant: {
|
|
@@ -57486,13 +57546,15 @@ const SidebarMenuButton = React__namespace.forwardRef(({ asChild = false, isActi
|
|
|
57486
57546
|
const { state } = useSidebar();
|
|
57487
57547
|
const [innerRef, setRef] = useForwardedRef(ref);
|
|
57488
57548
|
const truncatedText = useTruncatedText(innerRef);
|
|
57549
|
+
const { open: tooltipOpen, setOpen: setTooltipOpen } = useSidebarTooltipOpen();
|
|
57489
57550
|
const button = (jsxRuntime.jsx(Comp, { ref: setRef, "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), ...props }));
|
|
57490
57551
|
// Tooltip when collapsed (icon-only) OR when the expanded label is clipped.
|
|
57491
57552
|
// The Tooltip structure stays mounted and only the content is conditional,
|
|
57492
57553
|
// so toggling it never remounts the button.
|
|
57493
57554
|
const collapsed = !!tooltip && state === 'collapsed';
|
|
57494
57555
|
const collapsedProps = typeof tooltip === 'string' ? { children: tooltip } : tooltip;
|
|
57495
|
-
|
|
57556
|
+
const tooltipContent = collapsed ? (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, ...collapsedProps })) : truncatedText ? (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText })) : null;
|
|
57557
|
+
return (jsxRuntime.jsxs(Tooltip, { open: !!tooltipContent && tooltipOpen, onOpenChange: setTooltipOpen, children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), tooltipContent] }));
|
|
57496
57558
|
});
|
|
57497
57559
|
SidebarMenuButton.displayName = 'SidebarMenuButton';
|
|
57498
57560
|
const SidebarMenuAction = React__namespace.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
@@ -57516,9 +57578,10 @@ const SidebarMenuSubButton = React__namespace.forwardRef(({ asChild = false, siz
|
|
|
57516
57578
|
const Comp = asChild ? reactSlot.Slot : 'a';
|
|
57517
57579
|
const [innerRef, setRef] = useForwardedRef(ref);
|
|
57518
57580
|
const truncatedText = useTruncatedText(innerRef);
|
|
57581
|
+
const { open: tooltipOpen, setOpen: setTooltipOpen } = useSidebarTooltipOpen();
|
|
57519
57582
|
const button = (jsxRuntime.jsx(Comp, { ref: setRef, "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('relative flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-sm pl-3 pr-1 py-1.5 text-left text-sidebar-foreground/80 outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-sidebar-primary data-[active=true]:text-sidebar-primary-foreground', size === 'sm' && 'text-xs', size === 'md' && 'text-sm', 'group-data-[collapsible=icon]:hidden', className), ...props }));
|
|
57520
57583
|
// Keep the Tooltip mounted; render the content only when the label is clipped.
|
|
57521
|
-
return (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), truncatedText && (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText }))] }));
|
|
57584
|
+
return (jsxRuntime.jsxs(Tooltip, { open: !!truncatedText && tooltipOpen, onOpenChange: setTooltipOpen, children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }), truncatedText && (jsxRuntime.jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText }))] }));
|
|
57522
57585
|
});
|
|
57523
57586
|
SidebarMenuSubButton.displayName = 'SidebarMenuSubButton';
|
|
57524
57587
|
const Collapsible = CollapsiblePrimitive__namespace.Root;
|
|
@@ -65788,6 +65851,15 @@ const DEFAULT_SIDEBAR_WIDTH = '248px';
|
|
|
65788
65851
|
/** Green pill marking the active top-level item. Rendered in-flow as the row's
|
|
65789
65852
|
* first flex child (hidden when the sidebar collapses to icons). */
|
|
65790
65853
|
const ActiveRail = () => (jsxRuntime.jsx("span", { "aria-hidden": "true", className: "pointer-events-none h-9 w-[4px] shrink-0 rounded-full bg-sidebar-primary group-data-[collapsible=icon]:hidden" }));
|
|
65854
|
+
/** Collapsed, the rail is also the way back into the menu: clicking any nav
|
|
65855
|
+
* item opens the sidebar, not just the brand. */
|
|
65856
|
+
const useCollapsedSidebar = () => {
|
|
65857
|
+
const { state, isMobile, setOpen } = useSidebar();
|
|
65858
|
+
return {
|
|
65859
|
+
collapsed: !isMobile && state === 'collapsed',
|
|
65860
|
+
expandSidebar: () => setOpen(true),
|
|
65861
|
+
};
|
|
65862
|
+
};
|
|
65791
65863
|
const BrandHeader = ({ brand }) => {
|
|
65792
65864
|
const { state, isMobile, openMobile, toggleSidebar } = useSidebar();
|
|
65793
65865
|
const expanded = state === 'expanded' || (isMobile && openMobile);
|
|
@@ -65799,13 +65871,31 @@ const BrandHeader = ({ brand }) => {
|
|
|
65799
65871
|
const NavLeaf = ({ item, currentPath, onNavigate }) => {
|
|
65800
65872
|
const Icon = item.icon;
|
|
65801
65873
|
const active = isPathActive(currentPath, item.path);
|
|
65802
|
-
|
|
65874
|
+
const { collapsed, expandSidebar } = useCollapsedSidebar();
|
|
65875
|
+
return (jsxRuntime.jsxs(SidebarMenuItem, { className: cn(active && 'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [active && jsxRuntime.jsx(ActiveRail, {}), jsxRuntime.jsxs(SidebarMenuButton, { isActive: active, tooltip: item.label, onClick: () => {
|
|
65876
|
+
if (collapsed)
|
|
65877
|
+
expandSidebar();
|
|
65878
|
+
if (item.path)
|
|
65879
|
+
onNavigate(item.path);
|
|
65880
|
+
}, className: cn(active && 'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsxRuntime.jsx(Icon, {}), jsxRuntime.jsx("span", { children: item.label })] }), item.badge != null && (jsxRuntime.jsx(SidebarMenuBadge, { className: "h-5 w-5 min-w-5 rounded-full border border-primary bg-primary/10 p-0 text-primary", children: item.badge }))] }));
|
|
65803
65881
|
};
|
|
65804
65882
|
const NavParent = ({ item, currentPath, onNavigate }) => {
|
|
65805
65883
|
const Icon = item.icon;
|
|
65806
65884
|
const children = (item.children ?? []).filter((s) => s.visible !== false);
|
|
65807
65885
|
const parentActive = children.some((s) => isPathActive(currentPath, s.path));
|
|
65808
|
-
|
|
65886
|
+
const { collapsed, expandSidebar } = useCollapsedSidebar();
|
|
65887
|
+
const [open, setOpen] = React.useState(parentActive);
|
|
65888
|
+
// Collapsed, the sub-menu is hidden, so a click opens the sidebar and this
|
|
65889
|
+
// group instead of silently toggling something the user cannot see.
|
|
65890
|
+
const handleOpenChange = (next) => {
|
|
65891
|
+
if (!collapsed) {
|
|
65892
|
+
setOpen(next);
|
|
65893
|
+
return;
|
|
65894
|
+
}
|
|
65895
|
+
expandSidebar();
|
|
65896
|
+
setOpen(true);
|
|
65897
|
+
};
|
|
65898
|
+
return (jsxRuntime.jsx(Collapsible, { asChild: true, open: open, onOpenChange: handleOpenChange, children: jsxRuntime.jsxs(SidebarMenuItem, { className: "group/collapsible", children: [jsxRuntime.jsxs("div", { className: cn(parentActive &&
|
|
65809
65899
|
'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [parentActive && jsxRuntime.jsx(ActiveRail, {}), jsxRuntime.jsx(CollapsibleTrigger, { asChild: true, children: jsxRuntime.jsxs(SidebarMenuButton, { isActive: parentActive, tooltip: item.label, className: cn(parentActive &&
|
|
65810
65900
|
'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsxRuntime.jsx(Icon, {}), jsxRuntime.jsx("span", { children: item.label }), jsxRuntime.jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90 group-data-[collapsible=icon]:hidden" })] }) })] }), jsxRuntime.jsx(CollapsibleContent, { children: jsxRuntime.jsx(SidebarMenuSub, { children: children.map((sub) => {
|
|
65811
65901
|
const SubIcon = sub.icon;
|
|
@@ -68044,4 +68134,5 @@ exports.useDropdownMenu = useDropdownMenu;
|
|
|
68044
68134
|
exports.useNavbar = useNavbar;
|
|
68045
68135
|
exports.useSidebar = useSidebar;
|
|
68046
68136
|
exports.videoThumbnailSrc = videoThumbnailSrc;
|
|
68137
|
+
exports.watchOverlayBodyLock = watchOverlayBodyLock;
|
|
68047
68138
|
//# sourceMappingURL=index.cjs.js.map
|