@datum-cloud/datum-ui 0.2.0-alpha.3 → 0.2.0-alpha.5
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 +66 -32
- package/dist/alert/index.mjs +3 -0
- package/dist/alert-BC2Mccfo.mjs +95 -0
- package/dist/autocomplete/index.mjs +7 -0
- package/dist/autocomplete-DZtI97HP.mjs +295 -0
- package/dist/avatar-stack/index.mjs +5 -0
- package/dist/avatar-stack-JCfBlPB9.mjs +80 -0
- package/dist/badge/index.mjs +3 -0
- package/dist/badge-bFgeYceE.mjs +185 -0
- package/dist/breadcrumb/index.mjs +4 -0
- package/dist/breadcrumb-BGYJgom_.mjs +71 -0
- package/dist/button/index.mjs +4 -0
- package/dist/button-AzpnV-WB.mjs +49 -0
- package/dist/button-C1wRfGtT.mjs +230 -0
- package/dist/button-group/index.mjs +5 -0
- package/dist/button-group-C1IB2K5s.mjs +40 -0
- package/dist/calendar/index.mjs +5 -0
- package/dist/calendar-DlIHeWb0.mjs +113 -0
- package/dist/card/index.mjs +4 -0
- package/dist/card-3Kd0VdNf.mjs +63 -0
- package/dist/chart/index.mjs +4 -0
- package/dist/chart-BZqUKpkh.mjs +143 -0
- package/dist/checkbox/index.mjs +4 -0
- package/dist/checkbox-LG1OKTpG.mjs +34 -0
- package/dist/col-lrLMZaTJ.mjs +184 -0
- package/dist/collapsible/index.mjs +3 -0
- package/dist/collapsible-Bt9UYfv3.mjs +9 -0
- package/dist/command/index.mjs +5 -0
- package/dist/command-s0Yv3abE.mjs +86 -0
- package/dist/components/features/date-picker/index.d.ts +3 -0
- package/dist/components/features/date-picker/index.d.ts.map +1 -0
- package/dist/components/features/dropzone/index.d.ts +1 -0
- package/dist/components/features/dropzone/index.d.ts.map +1 -1
- package/dist/components/themes/index.d.ts +1 -1
- package/dist/components/themes/index.d.ts.map +1 -1
- package/dist/components/themes/types.d.ts +0 -2
- package/dist/components/themes/types.d.ts.map +1 -1
- package/dist/date-picker/index.mjs +9 -0
- package/dist/dialog/index.mjs +5 -0
- package/dist/dialog-DXBaT9gA.mjs +86 -0
- package/dist/dialog-bnMMf9GD.mjs +73 -0
- package/dist/dropdown/index.mjs +3 -0
- package/dist/dropdown-DtSa_lqc.mjs +112 -0
- package/dist/dropzone/index.mjs +5 -0
- package/dist/dropzone-BkOnwrS4.mjs +221 -0
- package/dist/empty-content/index.mjs +3 -0
- package/dist/empty-content-BM9rzI13.mjs +196 -0
- package/dist/exports/map.d.ts +3 -0
- package/dist/exports/map.d.ts.map +1 -0
- package/dist/fonts/AllianceNo1-Medium.ttf +0 -0
- package/dist/fonts/AllianceNo1-Regular.ttf +0 -0
- package/dist/fonts/AllianceNo1-SemiBold.ttf +0 -0
- package/dist/form/index.mjs +146 -0
- package/dist/grid/index.mjs +3 -0
- package/dist/hooks/index.mjs +2 -3
- package/dist/hover-card/index.mjs +4 -0
- package/dist/hover-card-CUPfFUqE.mjs +33 -0
- package/dist/icon-wrapper-9ticVbRL.mjs +14 -0
- package/dist/icons/index.mjs +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +65 -9
- package/dist/input/index.mjs +5 -0
- package/dist/input-DuyjEKEW.mjs +17 -0
- package/dist/input-fzXBheCN.mjs +17 -0
- package/dist/input-group/index.mjs +7 -0
- package/dist/input-group-CPaFSTEV.mjs +80 -0
- package/dist/input-number/index.mjs +6 -0
- package/dist/input-number-9o62JHRl.mjs +106 -0
- package/dist/input-with-addons/index.mjs +3 -0
- package/dist/input-with-addons-BQn7KCTU.mjs +30 -0
- package/dist/label/index.mjs +4 -0
- package/dist/label-_ste_Re3.mjs +44 -0
- package/dist/link-button-TIF2Zdrk.mjs +36 -0
- package/dist/loader-overlay/index.mjs +3 -0
- package/dist/loader-overlay-DUaQSZQP.mjs +17 -0
- package/dist/map/index.mjs +13 -0
- package/dist/map-WL6jhkSM.mjs +1094 -0
- package/dist/more-actions/index.mjs +5 -0
- package/dist/more-actions-Ch1f6Mh3.mjs +54 -0
- package/dist/nprogress/index.mjs +32 -0
- package/dist/page-title/index.mjs +3 -0
- package/dist/page-title-BJuo81rT.mjs +26 -0
- package/dist/popover/index.mjs +4 -0
- package/dist/popover-SQlKSz6L.mjs +36 -0
- package/dist/radio-group/index.mjs +4 -0
- package/dist/radio-group-Oshv0b-U.mjs +49 -0
- package/dist/select/index.mjs +4 -0
- package/dist/select-DVlEzD2W.mjs +166 -0
- package/dist/separator/index.mjs +4 -0
- package/dist/separator-T2ppyD-8.mjs +18 -0
- package/dist/sheet/index.mjs +5 -0
- package/dist/sheet-BKiCwtNO.mjs +45 -0
- package/dist/sheet-CtnP6gTD.mjs +77 -0
- package/dist/sidebar/index.mjs +11 -0
- package/dist/sidebar-DfqezV8t.mjs +945 -0
- package/dist/skeleton/index.mjs +4 -0
- package/dist/skeleton-vzbxA-DQ.mjs +13 -0
- package/dist/spinner/index.mjs +4 -0
- package/dist/spinner-BE7k2bAD.mjs +16 -0
- package/dist/{icon-wrapper-BgPkifId.mjs → spinner.icon-Bg8zgGh0.mjs} +1 -12
- package/dist/stepper/index.mjs +5 -0
- package/dist/stepper-SWB-u_nM.mjs +323 -0
- package/dist/{style.css → styles.css} +317 -575
- package/dist/styles.mjs +1 -0
- package/dist/switch/index.mjs +4 -0
- package/dist/switch-Calk7Gyw.mjs +32 -0
- package/dist/table/index.mjs +4 -0
- package/dist/table-CsXBcQLI.mjs +68 -0
- package/dist/tabs/index.mjs +3 -0
- package/dist/tabs-D8n-dqnw.mjs +52 -0
- package/dist/tag-input/index.mjs +5 -0
- package/dist/tag-input-Di7SDNbK.mjs +284 -0
- package/dist/task-queue/index.mjs +7 -0
- package/dist/task-queue-dropdown-DW72ikDH.mjs +1356 -0
- package/dist/textarea/index.mjs +5 -0
- package/dist/textarea-CxE3YbC7.mjs +17 -0
- package/dist/textarea-QYRcDEpK.mjs +15 -0
- package/dist/theme/index.mjs +3 -0
- package/dist/{theme.provider-DpFLwtHe.mjs → theme.provider-CzCxEFFh.mjs} +63 -1
- package/dist/to-api-format-C2xjQUcI.mjs +1506 -0
- package/dist/toast/index.mjs +3 -0
- package/dist/tooltip/index.mjs +4 -0
- package/dist/tooltip-Dd3ActSS.mjs +74 -0
- package/dist/typography/index.mjs +3 -0
- package/dist/typography-UA7ZZvgJ.mjs +200 -0
- package/dist/use-copy-to-clipboard-ki-WoTml.mjs +31 -0
- package/dist/use-stepper-BaToCYMs.mjs +2017 -0
- package/dist/{use-copy-to-clipboard-BfrpD6G8.mjs → use-toast-mdn_CqRY.mjs} +34 -27
- package/dist/utils/index.mjs +0 -1
- package/dist/utils-Bfgoe-Gm.mjs +20 -0
- package/dist/visually-hidden/index.mjs +3 -0
- package/dist/visuallyhidden-aaTUk4Yo.mjs +7 -0
- package/package.json +223 -24
- package/dist/components/index.mjs +0 -8
- package/dist/datum.provider-D6VMjSV0.mjs +0 -37
- package/dist/providers/datum.provider.d.ts +0 -20
- package/dist/providers/datum.provider.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -3
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.mjs +0 -4
- package/dist/theme-script-DHyLk25i.mjs +0 -11128
- /package/dist/{close.icon-chkXPAUC.mjs → close.icon-CMNMoXM_.mjs} +0 -0
- /package/dist/{map-leaflet-imports-OKaoesjZ.mjs → map-leaflet-imports-C4JYls8q.mjs} +0 -0
- /package/dist/{use-debounce-BYB-jPeX.mjs → use-debounce-B6wPrZV8.mjs} +0 -0
|
@@ -0,0 +1,945 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { t as Separator } from "./separator-T2ppyD-8.mjs";
|
|
3
|
+
import { t as Button } from "./button-AzpnV-WB.mjs";
|
|
4
|
+
import { t as Icon } from "./icon-wrapper-9ticVbRL.mjs";
|
|
5
|
+
import { n as CollapsibleContent, r as CollapsibleTrigger, t as Collapsible } from "./collapsible-Bt9UYfv3.mjs";
|
|
6
|
+
import { t as Input } from "./input-fzXBheCN.mjs";
|
|
7
|
+
import { a as SheetHeader, n as SheetContent, o as SheetTitle, r as SheetDescription, t as Sheet } from "./sheet-CtnP6gTD.mjs";
|
|
8
|
+
import { t as Skeleton } from "./skeleton-vzbxA-DQ.mjs";
|
|
9
|
+
import { i as TooltipProvider, t as Tooltip } from "./tooltip-Dd3ActSS.mjs";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
import { ChevronRight, ExternalLinkIcon, PanelLeftCloseIcon, PanelLeftOpenIcon } from "lucide-react";
|
|
12
|
+
import * as React$1 from "react";
|
|
13
|
+
import { Fragment, useCallback, useEffect, useRef, useState } from "react";
|
|
14
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
16
|
+
import { motion } from "motion/react";
|
|
17
|
+
|
|
18
|
+
//#region src/components/features/sidebar/nav-main.tsx
|
|
19
|
+
const NAV_STYLES = {
|
|
20
|
+
menuButton: "rounded-xl h-8 font-normal text-xs transition-all px-2 py-1 data-[active=true]:bg-sidebar data-[active=true]:text-foreground data-[active=true]:text-sidebar-primary data-[active=true]:[&>svg]:text-primary hover:bg-sidebar hover:text-sidebar-primary hover:[&>svg]:text-sidebar-primary hover:bg-sidebar-accent data-[active=true]:bg-sidebar-accent hover:font-semibold data-[active=true]:hover:[&>svg]:text-sidebar-primary transition-colors duration-300 gap-2.5 text-foreground [&>svg]:text-icon-primary",
|
|
21
|
+
disabled: "pointer-events-none opacity-50",
|
|
22
|
+
icon: "duration-300 transition-all",
|
|
23
|
+
iconSmall: "size-4 duration-300 transition-all"
|
|
24
|
+
};
|
|
25
|
+
function NavIcon({ icon: IconComponent, className, size = "default" }) {
|
|
26
|
+
if (!IconComponent) return null;
|
|
27
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
28
|
+
icon: IconComponent,
|
|
29
|
+
className: cn(size === "small" ? NAV_STYLES.iconSmall : NAV_STYLES.icon, className)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
NavIcon.displayName = "NavIcon";
|
|
33
|
+
function NavSidebarMenuButton({ ref, item, isActive, disableTooltip, className, children, asChild, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
35
|
+
ref,
|
|
36
|
+
tooltip: disableTooltip ? void 0 : item.title,
|
|
37
|
+
isActive,
|
|
38
|
+
disabled: item.disabled,
|
|
39
|
+
asChild,
|
|
40
|
+
className: cn(NAV_STYLES.menuButton, item.disabled && NAV_STYLES.disabled, className),
|
|
41
|
+
...props,
|
|
42
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(NavIcon, { icon: item.icon }), children] })
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
NavSidebarMenuButton.displayName = "NavSidebarMenuButton";
|
|
46
|
+
function NavMain({ ref, className, items, currentPath, linkComponent: LinkComp = "a", overrideState, itemClassName, disableTooltip, closeOnNavigation, ...props }) {
|
|
47
|
+
const pathname = currentPath;
|
|
48
|
+
const { state: sidebarState, isMobile, closeForNavigation, setOpen } = useSidebar();
|
|
49
|
+
const [openItems, setOpenItems] = useState({});
|
|
50
|
+
const isInitialMount = useRef(true);
|
|
51
|
+
const previousOpenItems = useRef({});
|
|
52
|
+
const previousPathname = useRef(pathname);
|
|
53
|
+
const state = overrideState ?? sidebarState;
|
|
54
|
+
const previousState = useRef(state);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
previousOpenItems.current = openItems;
|
|
57
|
+
if (isInitialMount.current) isInitialMount.current = false;
|
|
58
|
+
}, [openItems]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
previousPathname.current = pathname;
|
|
61
|
+
}, [pathname]);
|
|
62
|
+
const activeNavItem = useCallback((item) => {
|
|
63
|
+
const normalize = (p) => {
|
|
64
|
+
let result = p.startsWith("/") ? p : `/${p}`;
|
|
65
|
+
if (result !== "/" && result.endsWith("/")) result = result.slice(0, -1);
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
const cleanCurrentPath = normalize(pathname);
|
|
69
|
+
if (!item.href) return false;
|
|
70
|
+
const cleanNavPath = normalize(item.href);
|
|
71
|
+
if (cleanNavPath === "/") return cleanCurrentPath === "/";
|
|
72
|
+
const hasActiveDescendant = (navItem) => {
|
|
73
|
+
if (!navItem.children || navItem.children.length === 0) return false;
|
|
74
|
+
return navItem.children.some((child) => {
|
|
75
|
+
if (!child.href) return hasActiveDescendant(child);
|
|
76
|
+
const cleanChildPath = normalize(child.href);
|
|
77
|
+
if (cleanCurrentPath === cleanChildPath || cleanCurrentPath.startsWith(`${cleanChildPath}/`)) return true;
|
|
78
|
+
return hasActiveDescendant(child);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
if ((item.children || []).length > 0) {
|
|
82
|
+
if (hasActiveDescendant(item)) return false;
|
|
83
|
+
return cleanCurrentPath === cleanNavPath;
|
|
84
|
+
}
|
|
85
|
+
const isExcluded = item.excludePaths?.some((excludePath) => {
|
|
86
|
+
const cleanExcludePath = normalize(excludePath);
|
|
87
|
+
return cleanCurrentPath === cleanExcludePath || cleanCurrentPath.startsWith(`${cleanExcludePath}/`);
|
|
88
|
+
}) ?? false;
|
|
89
|
+
const isDirectMatch = cleanCurrentPath === cleanNavPath || !isExcluded && cleanCurrentPath.startsWith(`${cleanNavPath}/`);
|
|
90
|
+
const isTabChildMatch = item.tabChildLinks?.some((childPath) => {
|
|
91
|
+
const cleanChildPath = normalize(childPath);
|
|
92
|
+
return cleanCurrentPath === cleanChildPath || cleanCurrentPath.startsWith(`${cleanChildPath}/`);
|
|
93
|
+
}) ?? false;
|
|
94
|
+
return isDirectMatch || isTabChildMatch;
|
|
95
|
+
}, [pathname]);
|
|
96
|
+
const hasActiveDescendant = useCallback((item) => {
|
|
97
|
+
if (activeNavItem(item)) return true;
|
|
98
|
+
if (item.children) return item.children.some((child) => hasActiveDescendant(child));
|
|
99
|
+
return false;
|
|
100
|
+
}, [activeNavItem]);
|
|
101
|
+
const findItemByHref = useCallback((href, items) => {
|
|
102
|
+
for (const item of items) {
|
|
103
|
+
if (item.href === href) return item;
|
|
104
|
+
if (item.children) {
|
|
105
|
+
const found = findItemByHref(href, item.children);
|
|
106
|
+
if (found) return found;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}, []);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (previousState.current === "expanded" && state === "collapsed") setOpenItems((prev) => {
|
|
113
|
+
const newOpenItems = {};
|
|
114
|
+
Object.keys(prev).forEach((itemHref) => {
|
|
115
|
+
const item = findItemByHref(itemHref, items);
|
|
116
|
+
if (item && hasActiveDescendant(item)) newOpenItems[itemHref] = true;
|
|
117
|
+
});
|
|
118
|
+
return newOpenItems;
|
|
119
|
+
});
|
|
120
|
+
previousState.current = state;
|
|
121
|
+
}, [
|
|
122
|
+
state,
|
|
123
|
+
items,
|
|
124
|
+
hasActiveDescendant,
|
|
125
|
+
findItemByHref
|
|
126
|
+
]);
|
|
127
|
+
const toggleItem = (itemId) => {
|
|
128
|
+
setOpenItems((prev) => ({
|
|
129
|
+
...prev,
|
|
130
|
+
[itemId]: !prev[itemId]
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
133
|
+
const handleNavigation = useCallback(() => {
|
|
134
|
+
if (closeOnNavigation && !isMobile) closeForNavigation();
|
|
135
|
+
}, [
|
|
136
|
+
closeOnNavigation,
|
|
137
|
+
isMobile,
|
|
138
|
+
closeForNavigation
|
|
139
|
+
]);
|
|
140
|
+
const renderNavItem = (item, level = 0) => {
|
|
141
|
+
if ("hidden" in item && item.hidden) return null;
|
|
142
|
+
const itemKey = `${item.title}-${item.href || ""}-${level}`;
|
|
143
|
+
if ("type" in item && item.type === "group") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SidebarGroup, {
|
|
144
|
+
className: "mb-2 p-0! px-2",
|
|
145
|
+
children: [item.title && /* @__PURE__ */ jsx(SidebarGroupLabel, {
|
|
146
|
+
className: "lowercase group-data-[state=collapsed]:hidden first-letter:uppercase",
|
|
147
|
+
children: item.title
|
|
148
|
+
}), /* @__PURE__ */ jsx(SidebarGroupContent, {
|
|
149
|
+
className: "flex flex-col gap-1",
|
|
150
|
+
children: (item.children || []).map((child) => renderNavItem(child, level + 1))
|
|
151
|
+
})]
|
|
152
|
+
}), /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2 hidden group-data-[state=collapsed]:block" })] }, itemKey);
|
|
153
|
+
const isActive = activeNavItem(item);
|
|
154
|
+
const pathnameExistInDropdowns = item.children?.filter((dropdownItem) => pathname.includes(dropdownItem.href)) || [];
|
|
155
|
+
const hasChildren = (item.children || []).length > 0;
|
|
156
|
+
const isOpen = openItems[item.href] !== void 0 ? openItems[item.href] : Boolean(pathnameExistInDropdowns.length);
|
|
157
|
+
const hasActiveChild = pathnameExistInDropdowns.length > 0;
|
|
158
|
+
if (state === "collapsed" && !isMobile && level <= 2 && hasChildren) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
159
|
+
item.showSeparatorAbove && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-1" }),
|
|
160
|
+
/* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsxs("div", {
|
|
161
|
+
className: "flex flex-col px-2",
|
|
162
|
+
children: [/* @__PURE__ */ jsx(NavSidebarMenuButton, {
|
|
163
|
+
item,
|
|
164
|
+
isActive,
|
|
165
|
+
disableTooltip,
|
|
166
|
+
className: itemClassName,
|
|
167
|
+
onClick: () => {
|
|
168
|
+
setOpen(true);
|
|
169
|
+
if (item.href) setOpenItems((prev) => ({
|
|
170
|
+
...prev,
|
|
171
|
+
[item.href]: true
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
}), hasActiveChild && /* @__PURE__ */ jsx(motion.div, {
|
|
175
|
+
variants: {
|
|
176
|
+
hidden: { opacity: 0 },
|
|
177
|
+
visible: {
|
|
178
|
+
opacity: 1,
|
|
179
|
+
transition: {
|
|
180
|
+
staggerChildren: .05,
|
|
181
|
+
delayChildren: .1
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
initial: "hidden",
|
|
186
|
+
animate: "visible",
|
|
187
|
+
className: "flex flex-col gap-0.5",
|
|
188
|
+
children: item.children?.map((subItem) => {
|
|
189
|
+
const isSubItemActive = activeNavItem(subItem);
|
|
190
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
191
|
+
variants: {
|
|
192
|
+
hidden: { opacity: 0 },
|
|
193
|
+
visible: {
|
|
194
|
+
opacity: 1,
|
|
195
|
+
transition: {
|
|
196
|
+
duration: .2,
|
|
197
|
+
ease: "easeOut"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
children: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
202
|
+
tooltip: subItem.title,
|
|
203
|
+
isActive: isSubItemActive,
|
|
204
|
+
className: "h-6 p-0 group-data-[collapsible=icon]:h-6! group-data-[collapsible=icon]:p-0!",
|
|
205
|
+
asChild: true,
|
|
206
|
+
children: /* @__PURE__ */ jsx(LinkComp, {
|
|
207
|
+
className: "flex items-center justify-center",
|
|
208
|
+
...LinkComp === "a" ? { href: subItem.href || "" } : { to: subItem.href || "" },
|
|
209
|
+
onClick: () => {
|
|
210
|
+
handleNavigation();
|
|
211
|
+
},
|
|
212
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("size-1 rounded-full", isSubItemActive ? "bg-primary" : "bg-sidebar-primary-foreground") })
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
}, `collapsed-dot-${subItem.href}-${level}`);
|
|
216
|
+
})
|
|
217
|
+
})]
|
|
218
|
+
}) }),
|
|
219
|
+
item.showSeparatorBelow && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" })
|
|
220
|
+
] }, itemKey);
|
|
221
|
+
if (hasChildren && level <= 3) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
222
|
+
item.showSeparatorAbove && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" }),
|
|
223
|
+
/* @__PURE__ */ jsx(SidebarMenu, {
|
|
224
|
+
className: "px-2",
|
|
225
|
+
children: /* @__PURE__ */ jsx(Collapsible, {
|
|
226
|
+
asChild: true,
|
|
227
|
+
open: isOpen,
|
|
228
|
+
onOpenChange: (open) => {
|
|
229
|
+
if (item.href) setOpenItems((prev) => ({
|
|
230
|
+
...prev,
|
|
231
|
+
[item.href]: open
|
|
232
|
+
}));
|
|
233
|
+
},
|
|
234
|
+
className: "group/collapsible",
|
|
235
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
236
|
+
asChild: true,
|
|
237
|
+
className: "w-full",
|
|
238
|
+
children: /* @__PURE__ */ jsxs(NavSidebarMenuButton, {
|
|
239
|
+
item,
|
|
240
|
+
isActive,
|
|
241
|
+
disableTooltip,
|
|
242
|
+
className: itemClassName,
|
|
243
|
+
children: [/* @__PURE__ */ jsx("span", { children: item.title }), /* @__PURE__ */ jsx(Icon, {
|
|
244
|
+
icon: ChevronRight,
|
|
245
|
+
className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
|
|
246
|
+
})]
|
|
247
|
+
})
|
|
248
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
249
|
+
className: "data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden",
|
|
250
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
251
|
+
style: {
|
|
252
|
+
minHeight: 0,
|
|
253
|
+
overflow: "hidden"
|
|
254
|
+
},
|
|
255
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
256
|
+
variants: {
|
|
257
|
+
hidden: { opacity: 0 },
|
|
258
|
+
visible: {
|
|
259
|
+
opacity: 1,
|
|
260
|
+
transition: {
|
|
261
|
+
staggerChildren: .05,
|
|
262
|
+
delayChildren: .1
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
initial: isInitialMount.current || previousOpenItems.current[item.href] === openItems[item.href] && previousState.current === state && previousPathname.current === pathname && !hasActiveChild ? "visible" : "hidden",
|
|
267
|
+
animate: isOpen ? "visible" : "hidden",
|
|
268
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSub, {
|
|
269
|
+
className: cn(level >= 1 ? "mr-0 pr-[.1rem]" : "", level === 2 ? "pl-4" : "", level === 3 ? "pl-6" : "", "mr-0 gap-0.5 pr-0"),
|
|
270
|
+
children: item.children?.map((subItem, index) => /* @__PURE__ */ jsx(motion.div, {
|
|
271
|
+
variants: {
|
|
272
|
+
hidden: { opacity: 0 },
|
|
273
|
+
visible: {
|
|
274
|
+
opacity: 1,
|
|
275
|
+
transition: {
|
|
276
|
+
duration: .2,
|
|
277
|
+
ease: "easeOut"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
children: renderNavItem(subItem, level + 1)
|
|
282
|
+
}, `${subItem.href}-${level}-${index}`))
|
|
283
|
+
})
|
|
284
|
+
}, `collapsible-${item.href}-${isOpen}`)
|
|
285
|
+
})
|
|
286
|
+
})] })
|
|
287
|
+
}, `collapsed-item-drop-down-item-${item.title}-${level}`)
|
|
288
|
+
}),
|
|
289
|
+
item.showSeparatorBelow && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" })
|
|
290
|
+
] }, itemKey);
|
|
291
|
+
const renderCollapsible = (currentItem, currentLevel) => {
|
|
292
|
+
const currentItemIsActive = activeNavItem(currentItem);
|
|
293
|
+
const currentItemPathnameExistInDropdowns = currentItem.children?.filter((dropdownItem) => pathname.includes(dropdownItem.href)) || [];
|
|
294
|
+
return /* @__PURE__ */ jsx(Collapsible, {
|
|
295
|
+
asChild: true,
|
|
296
|
+
open: openItems[currentItem.href] || Boolean(currentItemPathnameExistInDropdowns.length),
|
|
297
|
+
onOpenChange: (open) => {
|
|
298
|
+
if (currentItem.href) setOpenItems((prev) => ({
|
|
299
|
+
...prev,
|
|
300
|
+
[currentItem.href]: open
|
|
301
|
+
}));
|
|
302
|
+
},
|
|
303
|
+
className: "group/collapsible",
|
|
304
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
305
|
+
asChild: true,
|
|
306
|
+
className: "w-full",
|
|
307
|
+
children: /* @__PURE__ */ jsxs(NavSidebarMenuButton, {
|
|
308
|
+
item: currentItem,
|
|
309
|
+
isActive: currentItemIsActive,
|
|
310
|
+
disableTooltip,
|
|
311
|
+
className: itemClassName,
|
|
312
|
+
children: [/* @__PURE__ */ jsx("span", { children: currentItem.title }), /* @__PURE__ */ jsx(Icon, {
|
|
313
|
+
icon: ChevronRight,
|
|
314
|
+
className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
|
|
315
|
+
})]
|
|
316
|
+
})
|
|
317
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
318
|
+
className: "data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden",
|
|
319
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
320
|
+
style: {
|
|
321
|
+
minHeight: 0,
|
|
322
|
+
overflow: "hidden"
|
|
323
|
+
},
|
|
324
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSub, {
|
|
325
|
+
className: cn(currentLevel >= 1 ? "mr-0 pr-[.1rem]" : "", "gap-0.5"),
|
|
326
|
+
children: currentItem.children?.map((subItem) => renderNavItem(subItem, currentLevel + 1))
|
|
327
|
+
})
|
|
328
|
+
})
|
|
329
|
+
})] }, `collapsible-sidebar-${currentItem.title}-${currentLevel}`)
|
|
330
|
+
}, `collapsed-item-drop-down-item-${currentItem.title}-${currentLevel}`);
|
|
331
|
+
};
|
|
332
|
+
if (level <= 2 && hasChildren) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
333
|
+
item.showSeparatorAbove && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" }),
|
|
334
|
+
/* @__PURE__ */ jsx(SidebarMenu, {
|
|
335
|
+
className: "px-2",
|
|
336
|
+
children: renderCollapsible(item, level)
|
|
337
|
+
}),
|
|
338
|
+
item.showSeparatorBelow && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" })
|
|
339
|
+
] }, itemKey);
|
|
340
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
341
|
+
item.showSeparatorAbove && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" }),
|
|
342
|
+
/* @__PURE__ */ jsx(SidebarMenu, {
|
|
343
|
+
className: cn(`level_${level} px-2`),
|
|
344
|
+
children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(NavSidebarMenuButton, {
|
|
345
|
+
asChild: true,
|
|
346
|
+
item,
|
|
347
|
+
isActive: isActive && !hasActiveChild,
|
|
348
|
+
disableTooltip,
|
|
349
|
+
onClick: () => hasChildren && toggleItem(item.href),
|
|
350
|
+
className: cn(level >= 1 && "h-6", itemClassName),
|
|
351
|
+
children: item.type === "externalLink" ? /* @__PURE__ */ jsxs("a", {
|
|
352
|
+
href: item.href || "",
|
|
353
|
+
target: "_blank",
|
|
354
|
+
rel: "noopener noreferrer",
|
|
355
|
+
className: "flex items-center justify-between",
|
|
356
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
357
|
+
className: "flex items-center gap-2",
|
|
358
|
+
children: [item?.icon && /* @__PURE__ */ jsx(Icon, {
|
|
359
|
+
icon: item.icon,
|
|
360
|
+
className: "size-4 transition-all duration-300"
|
|
361
|
+
}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
362
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
363
|
+
icon: ExternalLinkIcon,
|
|
364
|
+
className: "ml-auto size-4"
|
|
365
|
+
})]
|
|
366
|
+
}) : /* @__PURE__ */ jsxs(LinkComp, {
|
|
367
|
+
...LinkComp === "a" ? { href: item.href || "" } : { to: item.href || "" },
|
|
368
|
+
onClick: handleNavigation,
|
|
369
|
+
onMouseEnter: () => item.onPrefetch?.(),
|
|
370
|
+
children: [item?.icon && /* @__PURE__ */ jsx(Icon, {
|
|
371
|
+
icon: item.icon,
|
|
372
|
+
className: "text-sidebar-primary transition-all duration-300"
|
|
373
|
+
}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
374
|
+
})
|
|
375
|
+
}) })
|
|
376
|
+
}),
|
|
377
|
+
item.showSeparatorBelow && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" })
|
|
378
|
+
] }, itemKey);
|
|
379
|
+
};
|
|
380
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
381
|
+
ref,
|
|
382
|
+
"data-sidebar": "menu",
|
|
383
|
+
className: cn("flex h-full w-full min-w-0 flex-col gap-0.5 py-2", className),
|
|
384
|
+
...props,
|
|
385
|
+
children: (items || []).map((item) => renderNavItem(item))
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
NavMain.displayName = "NavMain";
|
|
389
|
+
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/components/features/sidebar/app-sidebar.tsx
|
|
392
|
+
function AppSidebar({ navItems, title, closeOnNavigation, defaultOpen, currentPath, linkComponent, ...props }) {
|
|
393
|
+
const { setOpen } = useSidebar();
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
if (defaultOpen === false) setOpen(false);
|
|
396
|
+
}, [defaultOpen, setOpen]);
|
|
397
|
+
return /* @__PURE__ */ jsx(Sidebar, {
|
|
398
|
+
collapsible: props.collapsible ?? "offcanvas",
|
|
399
|
+
...props,
|
|
400
|
+
children: /* @__PURE__ */ jsxs(SidebarContent, {
|
|
401
|
+
className: "gap-0",
|
|
402
|
+
children: [
|
|
403
|
+
title && /* @__PURE__ */ jsx(SidebarHeader, {
|
|
404
|
+
className: "px-4 pt-4 pb-0",
|
|
405
|
+
children: title
|
|
406
|
+
}),
|
|
407
|
+
navItems.length > 0 && /* @__PURE__ */ jsx(NavMain, {
|
|
408
|
+
className: "h-fit py-2",
|
|
409
|
+
items: navItems,
|
|
410
|
+
currentPath,
|
|
411
|
+
linkComponent,
|
|
412
|
+
closeOnNavigation
|
|
413
|
+
}),
|
|
414
|
+
props.collapsible !== "none" && /* @__PURE__ */ jsx(SidebarFooter, {
|
|
415
|
+
className: "mt-auto p-2",
|
|
416
|
+
children: /* @__PURE__ */ jsx(SidebarTrigger, {})
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
})
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region ../shadcn/hooks/use-mobile.ts
|
|
425
|
+
const MOBILE_BREAKPOINT = 768;
|
|
426
|
+
function useIsMobile() {
|
|
427
|
+
const [isMobile, setIsMobile] = React$1.useState(void 0);
|
|
428
|
+
React$1.useEffect(() => {
|
|
429
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
430
|
+
const onChange = () => {
|
|
431
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
432
|
+
};
|
|
433
|
+
mql.addEventListener("change", onChange);
|
|
434
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
435
|
+
return () => mql.removeEventListener("change", onChange);
|
|
436
|
+
}, []);
|
|
437
|
+
return !!isMobile;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/components/features/sidebar/sidebar.tsx
|
|
442
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
443
|
+
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
444
|
+
const SIDEBAR_WIDTH = "13rem";
|
|
445
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
446
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
447
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
448
|
+
const SidebarContext = React$1.createContext(null);
|
|
449
|
+
function useSidebar() {
|
|
450
|
+
const context = React$1.use(SidebarContext);
|
|
451
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
452
|
+
return context;
|
|
453
|
+
}
|
|
454
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, expandOnHover = false, expandBehavior = "push", showBackdrop = false, className, style, children, ...props }) {
|
|
455
|
+
const isMobile = useIsMobile();
|
|
456
|
+
const [openMobile, setOpenMobile] = React$1.useState(false);
|
|
457
|
+
const [isHovered, setIsHovered] = React$1.useState(false);
|
|
458
|
+
const [hasSubLayout, setHasSubLayout] = React$1.useState(false);
|
|
459
|
+
const hoverTimeoutRef = React$1.useRef(null);
|
|
460
|
+
const hoverLockRef = React$1.useRef(false);
|
|
461
|
+
const userClosedSidebarRef = React$1.useRef(false);
|
|
462
|
+
const [_open, _setOpen] = React$1.useState(defaultOpen);
|
|
463
|
+
const open = openProp ?? _open;
|
|
464
|
+
const LG_BREAKPOINT = 1024;
|
|
465
|
+
React$1.useLayoutEffect(() => {
|
|
466
|
+
if (isMobile) {
|
|
467
|
+
_setOpen(false);
|
|
468
|
+
setOpenMobile(false);
|
|
469
|
+
} else if (window.innerWidth < LG_BREAKPOINT) _setOpen(false);
|
|
470
|
+
}, [isMobile]);
|
|
471
|
+
React$1.useEffect(() => {
|
|
472
|
+
if (isMobile) userClosedSidebarRef.current = false;
|
|
473
|
+
}, [isMobile]);
|
|
474
|
+
React$1.useEffect(() => {
|
|
475
|
+
if (isMobile) return;
|
|
476
|
+
const mql = window.matchMedia(`(min-width: ${LG_BREAKPOINT}px)`);
|
|
477
|
+
const onChange = () => {
|
|
478
|
+
if (window.innerWidth >= LG_BREAKPOINT) {
|
|
479
|
+
if (!userClosedSidebarRef.current) _setOpen(true);
|
|
480
|
+
} else _setOpen(false);
|
|
481
|
+
};
|
|
482
|
+
mql.addEventListener("change", onChange);
|
|
483
|
+
return () => mql.removeEventListener("change", onChange);
|
|
484
|
+
}, [isMobile]);
|
|
485
|
+
const setOpen = React$1.useCallback((value) => {
|
|
486
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
487
|
+
if (setOpenProp) setOpenProp(openState);
|
|
488
|
+
else _setOpen(openState);
|
|
489
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
490
|
+
}, [setOpenProp, open]);
|
|
491
|
+
const handleMouseEnter = React$1.useCallback(() => {
|
|
492
|
+
if (!expandOnHover) return;
|
|
493
|
+
if (hoverLockRef.current) return;
|
|
494
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
495
|
+
setIsHovered(true);
|
|
496
|
+
}, [expandOnHover]);
|
|
497
|
+
const handleMouseLeave = React$1.useCallback(() => {
|
|
498
|
+
if (!expandOnHover) return;
|
|
499
|
+
const delay = expandBehavior === "overlay" ? 200 : 300;
|
|
500
|
+
hoverTimeoutRef.current = setTimeout(() => {
|
|
501
|
+
setIsHovered(false);
|
|
502
|
+
}, delay);
|
|
503
|
+
}, [expandOnHover, expandBehavior]);
|
|
504
|
+
const toggleSidebar = React$1.useCallback(() => {
|
|
505
|
+
if (isMobile) {
|
|
506
|
+
setOpenMobile((current) => !current);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const newState = !open;
|
|
510
|
+
if (!newState) userClosedSidebarRef.current = true;
|
|
511
|
+
else userClosedSidebarRef.current = false;
|
|
512
|
+
setOpen(newState);
|
|
513
|
+
if (!newState && expandOnHover) {
|
|
514
|
+
setIsHovered(false);
|
|
515
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
516
|
+
}
|
|
517
|
+
}, [
|
|
518
|
+
isMobile,
|
|
519
|
+
setOpen,
|
|
520
|
+
open,
|
|
521
|
+
setOpenMobile,
|
|
522
|
+
expandOnHover
|
|
523
|
+
]);
|
|
524
|
+
const forceClose = React$1.useCallback(() => {
|
|
525
|
+
if (isMobile) {
|
|
526
|
+
setOpenMobile(false);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
userClosedSidebarRef.current = true;
|
|
530
|
+
setOpen(false);
|
|
531
|
+
setIsHovered(false);
|
|
532
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
533
|
+
}, [
|
|
534
|
+
isMobile,
|
|
535
|
+
setOpen,
|
|
536
|
+
setOpenMobile
|
|
537
|
+
]);
|
|
538
|
+
const closeForNavigation = React$1.useCallback(() => {
|
|
539
|
+
if (isMobile) {
|
|
540
|
+
setOpenMobile(false);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
setOpen(false);
|
|
544
|
+
setIsHovered(false);
|
|
545
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
546
|
+
hoverLockRef.current = true;
|
|
547
|
+
setTimeout(() => {
|
|
548
|
+
hoverLockRef.current = false;
|
|
549
|
+
}, 300);
|
|
550
|
+
}, [
|
|
551
|
+
isMobile,
|
|
552
|
+
setOpen,
|
|
553
|
+
setOpenMobile
|
|
554
|
+
]);
|
|
555
|
+
React$1.useEffect(() => {
|
|
556
|
+
const handleKeyDown = (event) => {
|
|
557
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
558
|
+
event.preventDefault();
|
|
559
|
+
toggleSidebar();
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
563
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
564
|
+
}, [toggleSidebar]);
|
|
565
|
+
const effectiveOpen = open || expandOnHover && isHovered;
|
|
566
|
+
const state = effectiveOpen ? "expanded" : "collapsed";
|
|
567
|
+
return /* @__PURE__ */ jsx(SidebarContext, {
|
|
568
|
+
value: React$1.useMemo(() => ({
|
|
569
|
+
state,
|
|
570
|
+
open: effectiveOpen,
|
|
571
|
+
setOpen,
|
|
572
|
+
isMobile,
|
|
573
|
+
openMobile,
|
|
574
|
+
setOpenMobile,
|
|
575
|
+
toggleSidebar,
|
|
576
|
+
handleMouseEnter,
|
|
577
|
+
handleMouseLeave,
|
|
578
|
+
forceClose,
|
|
579
|
+
closeForNavigation,
|
|
580
|
+
hasSubLayout,
|
|
581
|
+
setHasSubLayout,
|
|
582
|
+
expandBehavior,
|
|
583
|
+
showBackdrop
|
|
584
|
+
}), [
|
|
585
|
+
state,
|
|
586
|
+
effectiveOpen,
|
|
587
|
+
setOpen,
|
|
588
|
+
isMobile,
|
|
589
|
+
openMobile,
|
|
590
|
+
setOpenMobile,
|
|
591
|
+
toggleSidebar,
|
|
592
|
+
handleMouseEnter,
|
|
593
|
+
handleMouseLeave,
|
|
594
|
+
forceClose,
|
|
595
|
+
closeForNavigation,
|
|
596
|
+
hasSubLayout,
|
|
597
|
+
setHasSubLayout,
|
|
598
|
+
expandBehavior,
|
|
599
|
+
showBackdrop
|
|
600
|
+
]),
|
|
601
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
602
|
+
delayDuration: 0,
|
|
603
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
604
|
+
"data-slot": "sidebar-wrapper",
|
|
605
|
+
style: {
|
|
606
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
607
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
608
|
+
...style
|
|
609
|
+
},
|
|
610
|
+
className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className),
|
|
611
|
+
...props,
|
|
612
|
+
children
|
|
613
|
+
})
|
|
614
|
+
})
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
|
|
618
|
+
const { isMobile, state, openMobile, setOpenMobile, handleMouseEnter, handleMouseLeave, expandBehavior, showBackdrop, forceClose } = useSidebar();
|
|
619
|
+
const sidebarRef = React$1.useRef(null);
|
|
620
|
+
const [showBackdropElement, setShowBackdropElement] = React$1.useState(false);
|
|
621
|
+
const [backdropVisible, setBackdropVisible] = React$1.useState(false);
|
|
622
|
+
React$1.useEffect(() => {
|
|
623
|
+
if (showBackdrop && expandBehavior === "overlay" && state === "expanded") {
|
|
624
|
+
setShowBackdropElement(true);
|
|
625
|
+
requestAnimationFrame(() => {
|
|
626
|
+
setBackdropVisible(true);
|
|
627
|
+
});
|
|
628
|
+
} else {
|
|
629
|
+
setBackdropVisible(false);
|
|
630
|
+
const timer = setTimeout(() => {
|
|
631
|
+
setShowBackdropElement(false);
|
|
632
|
+
}, 200);
|
|
633
|
+
return () => clearTimeout(timer);
|
|
634
|
+
}
|
|
635
|
+
}, [
|
|
636
|
+
showBackdrop,
|
|
637
|
+
expandBehavior,
|
|
638
|
+
state
|
|
639
|
+
]);
|
|
640
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
641
|
+
"data-slot": "sidebar",
|
|
642
|
+
className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", side === "left" ? "border-r" : "border-l", className),
|
|
643
|
+
...props,
|
|
644
|
+
children
|
|
645
|
+
});
|
|
646
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
647
|
+
open: openMobile,
|
|
648
|
+
onOpenChange: setOpenMobile,
|
|
649
|
+
...props,
|
|
650
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
651
|
+
"data-sidebar": "sidebar",
|
|
652
|
+
"data-slot": "sidebar",
|
|
653
|
+
"data-mobile": "true",
|
|
654
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
655
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
656
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
657
|
+
side,
|
|
658
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
659
|
+
className: "sr-only",
|
|
660
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
661
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
662
|
+
className: "flex h-full w-full flex-col",
|
|
663
|
+
children
|
|
664
|
+
})]
|
|
665
|
+
})
|
|
666
|
+
});
|
|
667
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
668
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
669
|
+
"data-state": state,
|
|
670
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
671
|
+
"data-variant": variant,
|
|
672
|
+
"data-side": side,
|
|
673
|
+
"data-slot": "sidebar",
|
|
674
|
+
onMouseEnter: handleMouseEnter,
|
|
675
|
+
onMouseLeave: handleMouseLeave,
|
|
676
|
+
children: [
|
|
677
|
+
/* @__PURE__ */ jsx("div", { className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-300 ease-[cubic-bezier(0.25,0.1,0.25,1)]", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", expandBehavior === "overlay" ? variant === "floating" || variant === "inset" ? "w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "w-(--sidebar-width-icon)" : variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)") }),
|
|
678
|
+
/* @__PURE__ */ jsx("div", {
|
|
679
|
+
ref: sidebarRef,
|
|
680
|
+
className: cn("border-sidebar-border fixed inset-y-0 hidden w-(--sidebar-width) transition-[left,right,width] duration-300 ease-[cubic-bezier(0.25,0.1,0.25,1)] md:flex", expandBehavior === "overlay" ? "z-50" : "z-10", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
|
|
681
|
+
...props,
|
|
682
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
683
|
+
"data-sidebar": "sidebar",
|
|
684
|
+
className: cn("bg-sidebar flex h-full w-full flex-col", "group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm", expandBehavior === "overlay" && state === "expanded" && "shadow-lg"),
|
|
685
|
+
children
|
|
686
|
+
})
|
|
687
|
+
}),
|
|
688
|
+
showBackdropElement && /* @__PURE__ */ jsx("div", {
|
|
689
|
+
className: cn("fixed inset-0 z-40 hidden bg-black/50 transition-opacity duration-200 ease-in-out md:block", backdropVisible ? "opacity-100" : "opacity-0"),
|
|
690
|
+
onMouseEnter: () => forceClose(),
|
|
691
|
+
onClick: () => forceClose(),
|
|
692
|
+
"aria-hidden": "true"
|
|
693
|
+
})
|
|
694
|
+
]
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
698
|
+
const { toggleSidebar, open } = useSidebar();
|
|
699
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
700
|
+
message: open ? "Close Sidebar" : "Open Sidebar",
|
|
701
|
+
side: "right",
|
|
702
|
+
align: "center",
|
|
703
|
+
delayDuration: 500,
|
|
704
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
705
|
+
"data-sidebar": "trigger",
|
|
706
|
+
"data-slot": "sidebar-trigger",
|
|
707
|
+
variant: "ghost",
|
|
708
|
+
size: "icon",
|
|
709
|
+
className: cn("text-icon-primary hover:bg-sidebar hover:text-sidebar-primary h-8 w-8 rounded-lg transition-all", className),
|
|
710
|
+
onClick: (event) => {
|
|
711
|
+
onClick?.(event);
|
|
712
|
+
toggleSidebar();
|
|
713
|
+
},
|
|
714
|
+
...props,
|
|
715
|
+
children: [open ? /* @__PURE__ */ jsx(Icon, {
|
|
716
|
+
icon: PanelLeftCloseIcon,
|
|
717
|
+
className: "size-4"
|
|
718
|
+
}) : /* @__PURE__ */ jsx(Icon, {
|
|
719
|
+
icon: PanelLeftOpenIcon,
|
|
720
|
+
className: "size-4"
|
|
721
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
722
|
+
className: "sr-only",
|
|
723
|
+
children: "Toggle Sidebar"
|
|
724
|
+
})]
|
|
725
|
+
})
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
function SidebarRail({ className, ...props }) {
|
|
729
|
+
const { toggleSidebar } = useSidebar();
|
|
730
|
+
return /* @__PURE__ */ jsx("button", {
|
|
731
|
+
"data-sidebar": "rail",
|
|
732
|
+
"data-slot": "sidebar-rail",
|
|
733
|
+
"aria-label": "Toggle Sidebar",
|
|
734
|
+
tabIndex: -1,
|
|
735
|
+
onClick: toggleSidebar,
|
|
736
|
+
title: "Toggle Sidebar",
|
|
737
|
+
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-[cubic-bezier(0.25,0.1,0.25,1)] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
738
|
+
...props
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
function SidebarInset({ className, ...props }) {
|
|
742
|
+
return /* @__PURE__ */ jsx("main", {
|
|
743
|
+
"data-slot": "sidebar-inset",
|
|
744
|
+
className: cn("bg-background relative flex w-full min-w-0 flex-1 flex-col", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
745
|
+
...props
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
function SidebarInput({ className, ...props }) {
|
|
749
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
750
|
+
"data-slot": "sidebar-input",
|
|
751
|
+
"data-sidebar": "input",
|
|
752
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
753
|
+
...props
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
function SidebarHeader({ className, ...props }) {
|
|
757
|
+
return /* @__PURE__ */ jsx("div", {
|
|
758
|
+
"data-slot": "sidebar-header",
|
|
759
|
+
"data-sidebar": "header",
|
|
760
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
761
|
+
...props
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
function SidebarFooter({ className, ...props }) {
|
|
765
|
+
return /* @__PURE__ */ jsx("div", {
|
|
766
|
+
"data-slot": "sidebar-footer",
|
|
767
|
+
"data-sidebar": "footer",
|
|
768
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
769
|
+
...props
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
function SidebarSeparator({ className, ...props }) {
|
|
773
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
774
|
+
"data-slot": "sidebar-separator",
|
|
775
|
+
"data-sidebar": "separator",
|
|
776
|
+
className: cn("bg-sidebar-border w-full", className),
|
|
777
|
+
...props
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
function SidebarContent({ className, ...props }) {
|
|
781
|
+
return /* @__PURE__ */ jsx("div", {
|
|
782
|
+
"data-slot": "sidebar-content",
|
|
783
|
+
"data-sidebar": "content",
|
|
784
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
785
|
+
...props
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
function SidebarGroup({ className, ...props }) {
|
|
789
|
+
return /* @__PURE__ */ jsx("div", {
|
|
790
|
+
"data-slot": "sidebar-group",
|
|
791
|
+
"data-sidebar": "group",
|
|
792
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
793
|
+
...props
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
function SidebarGroupLabel({ className, asChild = false, ...props }) {
|
|
797
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
798
|
+
"data-slot": "sidebar-group-label",
|
|
799
|
+
"data-sidebar": "group-label",
|
|
800
|
+
className: cn("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-[cubic-bezier(0.25,0.1,0.25,1)] focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className),
|
|
801
|
+
...props
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
function SidebarGroupAction({ className, asChild = false, ...props }) {
|
|
805
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
806
|
+
"data-slot": "sidebar-group-action",
|
|
807
|
+
"data-sidebar": "group-action",
|
|
808
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className),
|
|
809
|
+
...props
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
813
|
+
return /* @__PURE__ */ jsx("div", {
|
|
814
|
+
"data-slot": "sidebar-group-content",
|
|
815
|
+
"data-sidebar": "group-content",
|
|
816
|
+
className: cn("w-full text-sm", className),
|
|
817
|
+
...props
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
function SidebarMenu({ className, ...props }) {
|
|
821
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
822
|
+
"data-slot": "sidebar-menu",
|
|
823
|
+
"data-sidebar": "menu",
|
|
824
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
825
|
+
...props
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
829
|
+
return /* @__PURE__ */ jsx("li", {
|
|
830
|
+
"data-slot": "sidebar-menu-item",
|
|
831
|
+
"data-sidebar": "menu-item",
|
|
832
|
+
className: cn("group/menu-item relative", className),
|
|
833
|
+
...props
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar focus-visible:ring-2 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 data-[active=true]:text-sidebar-primary data-[state=open]:hover:bg-sidebar data-[state=open]:hover:text-sidebar-primary group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
837
|
+
variants: {
|
|
838
|
+
variant: {
|
|
839
|
+
default: "",
|
|
840
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
841
|
+
},
|
|
842
|
+
size: {
|
|
843
|
+
default: "h-8 text-sm",
|
|
844
|
+
sm: "h-7 text-xs",
|
|
845
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
defaultVariants: {
|
|
849
|
+
variant: "default",
|
|
850
|
+
size: "default"
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
|
|
854
|
+
const Comp = asChild ? Slot : "button";
|
|
855
|
+
const { isMobile, state } = useSidebar();
|
|
856
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
857
|
+
"data-slot": "sidebar-menu-button",
|
|
858
|
+
"data-sidebar": "menu-button",
|
|
859
|
+
"data-size": size,
|
|
860
|
+
"data-active": isActive,
|
|
861
|
+
className: cn(sidebarMenuButtonVariants({
|
|
862
|
+
variant,
|
|
863
|
+
size
|
|
864
|
+
}), className),
|
|
865
|
+
...props
|
|
866
|
+
});
|
|
867
|
+
if (!tooltip) return button;
|
|
868
|
+
const tooltipMessage = typeof tooltip === "string" || React$1.isValidElement(tooltip) || typeof tooltip === "object" && "message" in tooltip ? typeof tooltip === "string" || React$1.isValidElement(tooltip) ? tooltip : tooltip.message : null;
|
|
869
|
+
const tooltipProps = typeof tooltip === "object" && "message" in tooltip ? {
|
|
870
|
+
side: tooltip.side,
|
|
871
|
+
align: tooltip.align
|
|
872
|
+
} : {};
|
|
873
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
874
|
+
message: tooltipMessage,
|
|
875
|
+
side: "right",
|
|
876
|
+
align: "center",
|
|
877
|
+
hidden: state !== "collapsed" || isMobile,
|
|
878
|
+
...tooltipProps,
|
|
879
|
+
children: button
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
|
|
883
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
884
|
+
"data-slot": "sidebar-menu-action",
|
|
885
|
+
"data-sidebar": "menu-action",
|
|
886
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", className),
|
|
887
|
+
...props
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
891
|
+
return /* @__PURE__ */ jsx("div", {
|
|
892
|
+
"data-slot": "sidebar-menu-badge",
|
|
893
|
+
"data-sidebar": "menu-badge",
|
|
894
|
+
className: cn("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
895
|
+
...props
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
899
|
+
const width = React$1.useMemo(() => {
|
|
900
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
901
|
+
}, []);
|
|
902
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
903
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
904
|
+
"data-sidebar": "menu-skeleton",
|
|
905
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
906
|
+
...props,
|
|
907
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
908
|
+
className: "size-4 rounded-md",
|
|
909
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
910
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
911
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
912
|
+
"data-sidebar": "menu-skeleton-text",
|
|
913
|
+
style: { "--skeleton-width": width }
|
|
914
|
+
})]
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
918
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
919
|
+
"data-slot": "sidebar-menu-sub",
|
|
920
|
+
"data-sidebar": "menu-sub",
|
|
921
|
+
className: cn("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col px-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
922
|
+
...props
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
926
|
+
return /* @__PURE__ */ jsx("li", {
|
|
927
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
928
|
+
"data-sidebar": "menu-sub-item",
|
|
929
|
+
className: cn("group/menu-sub-item relative", className),
|
|
930
|
+
...props
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
|
|
934
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
935
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
936
|
+
"data-sidebar": "menu-sub-button",
|
|
937
|
+
"data-size": size,
|
|
938
|
+
"data-active": isActive,
|
|
939
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
940
|
+
...props
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
//#endregion
|
|
945
|
+
export { SidebarTrigger as C, NavMain as E, SidebarSeparator as S, AppSidebar as T, SidebarMenuSub as _, SidebarGroupAction as a, SidebarProvider as b, SidebarHeader as c, SidebarMenu as d, SidebarMenuAction as f, SidebarMenuSkeleton as g, SidebarMenuItem as h, SidebarGroup as i, SidebarInput as l, SidebarMenuButton as m, SidebarContent as n, SidebarGroupContent as o, SidebarMenuBadge as p, SidebarFooter as r, SidebarGroupLabel as s, Sidebar as t, SidebarInset as u, SidebarMenuSubButton as v, useSidebar as w, SidebarRail as x, SidebarMenuSubItem as y };
|