@classytic/fluid 0.2.1 → 0.3.2
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/LICENSE +21 -0
- package/README.md +149 -62
- package/dist/api-pagination-CJ0vR_w6.d.mts +34 -0
- package/dist/api-pagination-DBTE0yk4.mjs +190 -0
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/client/calendar.d.mts +105 -0
- package/dist/client/calendar.mjs +202 -0
- package/dist/client/core.d.mts +1614 -0
- package/dist/client/core.mjs +2779 -0
- package/dist/client/error.d.mts +125 -0
- package/dist/client/error.mjs +166 -0
- package/dist/client/hooks.d.mts +162 -0
- package/dist/client/hooks.mjs +447 -0
- package/dist/client/table.d.mts +84 -0
- package/dist/client/table.mjs +373 -0
- package/dist/client/theme.d.mts +6 -0
- package/dist/client/theme.mjs +65 -0
- package/dist/command.d.mts +134 -0
- package/dist/command.mjs +132 -0
- package/dist/compact.d.mts +359 -0
- package/dist/compact.mjs +892 -0
- package/dist/dashboard.d.mts +778 -0
- package/dist/dashboard.mjs +1617 -0
- package/dist/filter-utils-DqMmy_v-.mjs +72 -0
- package/dist/filter-utils-IZ0GtuPo.d.mts +40 -0
- package/dist/forms.d.mts +1549 -0
- package/dist/forms.mjs +3740 -0
- package/dist/index.d.mts +296 -0
- package/dist/index.mjs +432 -0
- package/dist/layouts.d.mts +215 -0
- package/dist/layouts.mjs +460 -0
- package/dist/search-context-DR7DBs7S.mjs +19 -0
- package/dist/search.d.mts +254 -0
- package/dist/search.mjs +523 -0
- package/dist/sheet-wrapper-CWNCvYMD.mjs +211 -0
- package/dist/use-base-search-BGgWnWaF.d.mts +35 -0
- package/dist/use-debounce-xmZucz5e.mjs +53 -0
- package/dist/use-keyboard-shortcut-Bl6YM5Q7.mjs +82 -0
- package/dist/use-keyboard-shortcut-_mRCh3QO.d.mts +24 -0
- package/dist/use-media-query-BnVNIKT4.mjs +17 -0
- package/dist/use-mobile-BX3SQVo2.mjs +20 -0
- package/dist/use-scroll-detection-CsgsQYvy.mjs +43 -0
- package/dist/utils-CDue7cEt.d.mts +6 -0
- package/dist/utils-DQ5SCVoW.mjs +10 -0
- package/package.json +85 -45
- package/styles.css +2 -2
- package/dist/chunk-GUHK2DTW.js +0 -15
- package/dist/chunk-GUHK2DTW.js.map +0 -1
- package/dist/chunk-H3NFL3GJ.js +0 -57
- package/dist/chunk-H3NFL3GJ.js.map +0 -1
- package/dist/chunk-J2YRTQE4.js +0 -293
- package/dist/chunk-J2YRTQE4.js.map +0 -1
- package/dist/compact.d.ts +0 -217
- package/dist/compact.js +0 -986
- package/dist/compact.js.map +0 -1
- package/dist/dashboard.d.ts +0 -386
- package/dist/dashboard.js +0 -1032
- package/dist/dashboard.js.map +0 -1
- package/dist/index.d.ts +0 -2141
- package/dist/index.js +0 -6460
- package/dist/index.js.map +0 -1
- package/dist/layout.d.ts +0 -25
- package/dist/layout.js +0 -4
- package/dist/layout.js.map +0 -1
- package/dist/search.d.ts +0 -172
- package/dist/search.js +0 -341
- package/dist/search.js.map +0 -1
- package/dist/use-base-search-AS5Z3SAy.d.ts +0 -64
- package/dist/utils-Cbsgs0XP.d.ts +0 -5
package/dist/dashboard.js
DELETED
|
@@ -1,1032 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { cn } from './chunk-GUHK2DTW.js';
|
|
3
|
-
export { cn } from './chunk-GUHK2DTW.js';
|
|
4
|
-
import { Button } from '@/components/ui/button';
|
|
5
|
-
import { Badge } from '@/components/ui/badge';
|
|
6
|
-
import { Skeleton } from '@/components/ui/skeleton';
|
|
7
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import * as React4 from 'react';
|
|
9
|
-
import React4__default, { useState } from 'react';
|
|
10
|
-
import Link3 from 'next/link';
|
|
11
|
-
import { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbPage, BreadcrumbLink, BreadcrumbSeparator } from '@/components/ui/breadcrumb';
|
|
12
|
-
import { Separator } from '@/components/ui/separator';
|
|
13
|
-
import { SidebarTrigger, useSidebar, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, SidebarGroup, SidebarGroupLabel, Sidebar, SidebarHeader, SidebarContent, SidebarFooter } from '@/components/ui/sidebar';
|
|
14
|
-
import { ChevronRight, ChevronsUpDown, CircleUserRound, LogOut, Building2, ChevronLeft, Check } from 'lucide-react';
|
|
15
|
-
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible';
|
|
16
|
-
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
|
|
17
|
-
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuItem } from '@/components/ui/dropdown-menu';
|
|
18
|
-
import { SheetTitle, SheetDescription } from '@/components/ui/sheet';
|
|
19
|
-
import { Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip';
|
|
20
|
-
|
|
21
|
-
var variants = {
|
|
22
|
-
default: {
|
|
23
|
-
wrapper: "px-6 py-5 rounded-xl shadow-sm border bg-background hover:shadow-md",
|
|
24
|
-
title: "text-2xl font-semibold tracking-tight",
|
|
25
|
-
description: "text-sm text-muted-foreground",
|
|
26
|
-
iconSize: "size-10",
|
|
27
|
-
iconInner: "size-5",
|
|
28
|
-
spacing: "space-y-1"
|
|
29
|
-
},
|
|
30
|
-
compact: {
|
|
31
|
-
wrapper: "px-4 py-3 rounded-lg border bg-background/50",
|
|
32
|
-
title: "text-lg font-semibold",
|
|
33
|
-
description: "text-xs text-muted-foreground",
|
|
34
|
-
iconSize: "size-8",
|
|
35
|
-
iconInner: "size-4",
|
|
36
|
-
spacing: "space-y-0.5"
|
|
37
|
-
},
|
|
38
|
-
hero: {
|
|
39
|
-
wrapper: "px-8 py-8 rounded-2xl shadow-lg border bg-gradient-to-br from-background to-muted/20",
|
|
40
|
-
title: "text-3xl font-bold tracking-tight bg-gradient-to-r from-foreground to-foreground/70 bg-clip-text text-transparent",
|
|
41
|
-
description: "text-base text-muted-foreground mt-2",
|
|
42
|
-
iconSize: "size-14",
|
|
43
|
-
iconInner: "size-7",
|
|
44
|
-
spacing: "space-y-2"
|
|
45
|
-
},
|
|
46
|
-
minimal: {
|
|
47
|
-
wrapper: "px-0 py-2",
|
|
48
|
-
title: "text-xl font-medium",
|
|
49
|
-
description: "text-sm text-muted-foreground",
|
|
50
|
-
iconSize: "size-8",
|
|
51
|
-
iconInner: "size-4",
|
|
52
|
-
spacing: "space-y-0.5"
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
function HeaderSection({
|
|
56
|
-
title,
|
|
57
|
-
description,
|
|
58
|
-
actions = null,
|
|
59
|
-
icon: Icon = null,
|
|
60
|
-
iconClassName,
|
|
61
|
-
loading = false,
|
|
62
|
-
variant = "default",
|
|
63
|
-
className,
|
|
64
|
-
badge,
|
|
65
|
-
breadcrumbs,
|
|
66
|
-
metadata,
|
|
67
|
-
children
|
|
68
|
-
}) {
|
|
69
|
-
const currentVariant = variants[variant] || variants.default;
|
|
70
|
-
const isBadgeObject = (badge2) => {
|
|
71
|
-
return typeof badge2 === "object" && badge2 !== null && "text" in badge2;
|
|
72
|
-
};
|
|
73
|
-
if (loading && !title) {
|
|
74
|
-
return /* @__PURE__ */ jsx("div", { className: cn(currentVariant.wrapper, "transition-all duration-300", className), children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between", children: [
|
|
75
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
76
|
-
Icon && /* @__PURE__ */ jsx(Skeleton, { className: cn(currentVariant.iconSize, "rounded-lg") }),
|
|
77
|
-
/* @__PURE__ */ jsxs("div", { className: currentVariant.spacing, children: [
|
|
78
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-48" }),
|
|
79
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-64 mt-1" })
|
|
80
|
-
] })
|
|
81
|
-
] }),
|
|
82
|
-
actions && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-4 sm:mt-0", children: [
|
|
83
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" }),
|
|
84
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" })
|
|
85
|
-
] })
|
|
86
|
-
] }) });
|
|
87
|
-
}
|
|
88
|
-
return /* @__PURE__ */ jsxs(
|
|
89
|
-
"div",
|
|
90
|
-
{
|
|
91
|
-
className: cn(
|
|
92
|
-
"transition-all duration-300",
|
|
93
|
-
currentVariant.wrapper,
|
|
94
|
-
className
|
|
95
|
-
),
|
|
96
|
-
children: [
|
|
97
|
-
breadcrumbs && /* @__PURE__ */ jsx("nav", { className: "mb-3 text-sm text-muted-foreground", children: breadcrumbs }),
|
|
98
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4", children: [
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start sm:items-center gap-4", children: [
|
|
100
|
-
Icon && /* @__PURE__ */ jsx(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
className: cn(
|
|
104
|
-
"flex aspect-square items-center justify-center rounded-lg flex-shrink-0",
|
|
105
|
-
"bg-primary/10 text-primary",
|
|
106
|
-
currentVariant.iconSize,
|
|
107
|
-
iconClassName
|
|
108
|
-
),
|
|
109
|
-
children: /* @__PURE__ */ jsx(Icon, { className: currentVariant.iconInner })
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ jsxs("div", { className: cn("flex-1", currentVariant.spacing), children: [
|
|
113
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
114
|
-
/* @__PURE__ */ jsx("h1", { className: cn("leading-none", currentVariant.title), children: title }),
|
|
115
|
-
badge && (isBadgeObject(badge) ? /* @__PURE__ */ jsx(
|
|
116
|
-
Badge,
|
|
117
|
-
{
|
|
118
|
-
variant: badge.variant || "secondary",
|
|
119
|
-
className: cn("ml-2", badge.className),
|
|
120
|
-
children: badge.text
|
|
121
|
-
}
|
|
122
|
-
) : badge)
|
|
123
|
-
] }),
|
|
124
|
-
description && /* @__PURE__ */ jsx("p", { className: currentVariant.description, children: description }),
|
|
125
|
-
metadata && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 mt-2 text-xs text-muted-foreground", children: metadata.map((item, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
126
|
-
item.icon && /* @__PURE__ */ jsx(item.icon, { className: "size-3" }),
|
|
127
|
-
/* @__PURE__ */ jsx("span", { children: item.text })
|
|
128
|
-
] }, index)) })
|
|
129
|
-
] })
|
|
130
|
-
] }),
|
|
131
|
-
actions && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mt-4 sm:mt-0", children: actions.map((action, index) => {
|
|
132
|
-
const isActionLoading = action.loading ?? false;
|
|
133
|
-
const isDisabled = loading || action.disabled || isActionLoading;
|
|
134
|
-
const displayText = isActionLoading ? action.loadingText || action.text : action.text;
|
|
135
|
-
return /* @__PURE__ */ jsxs(
|
|
136
|
-
Button,
|
|
137
|
-
{
|
|
138
|
-
onClick: action.onClick,
|
|
139
|
-
disabled: isDisabled,
|
|
140
|
-
variant: action.variant || "default",
|
|
141
|
-
size: action.size || (variant === "compact" ? "sm" : "default"),
|
|
142
|
-
className: cn(
|
|
143
|
-
variant === "hero" && "shadow-md hover:shadow-lg",
|
|
144
|
-
action.className
|
|
145
|
-
),
|
|
146
|
-
children: [
|
|
147
|
-
action.icon && action.iconPosition !== "right" && /* @__PURE__ */ jsx(action.icon, { className: "size-4 mr-2" }),
|
|
148
|
-
/* @__PURE__ */ jsx("span", { children: displayText }),
|
|
149
|
-
action.icon && action.iconPosition === "right" && /* @__PURE__ */ jsx(action.icon, { className: "size-4 ml-2" })
|
|
150
|
-
]
|
|
151
|
-
},
|
|
152
|
-
index
|
|
153
|
-
);
|
|
154
|
-
}) })
|
|
155
|
-
] }),
|
|
156
|
-
children && /* @__PURE__ */ jsx(
|
|
157
|
-
"div",
|
|
158
|
-
{
|
|
159
|
-
className: cn(
|
|
160
|
-
"mt-4 pt-4 border-t",
|
|
161
|
-
variant === "minimal" && "border-0 pt-2"
|
|
162
|
-
),
|
|
163
|
-
children
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
function PageHeader({ items, className, actions }) {
|
|
171
|
-
return /* @__PURE__ */ jsxs(
|
|
172
|
-
"header",
|
|
173
|
-
{
|
|
174
|
-
className: cn(
|
|
175
|
-
"flex h-12 shrink-0 items-center justify-between gap-2",
|
|
176
|
-
className
|
|
177
|
-
),
|
|
178
|
-
children: [
|
|
179
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
180
|
-
/* @__PURE__ */ jsx(SidebarTrigger, { className: "-ml-1" }),
|
|
181
|
-
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "!self-center h-4" }),
|
|
182
|
-
/* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, { children: items.map((item, index) => /* @__PURE__ */ jsxs(React4__default.Fragment, { children: [
|
|
183
|
-
/* @__PURE__ */ jsx(
|
|
184
|
-
BreadcrumbItem,
|
|
185
|
-
{
|
|
186
|
-
className: item.current ? "" : "hidden md:block",
|
|
187
|
-
children: item.current ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { render: /* @__PURE__ */ jsx(Link3, { href: item.href || "#" }), children: item.label })
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
|
-
index < items.length - 1 && /* @__PURE__ */ jsx(BreadcrumbSeparator, { className: "hidden md:block" })
|
|
191
|
-
] }, `breadcrumb-${index}`)) }) })
|
|
192
|
-
] }),
|
|
193
|
-
actions
|
|
194
|
-
]
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
var PADDING = {
|
|
199
|
-
none: "",
|
|
200
|
-
sm: "px-2",
|
|
201
|
-
md: "px-4",
|
|
202
|
-
lg: "px-6 lg:px-8"
|
|
203
|
-
};
|
|
204
|
-
function DashboardContent({
|
|
205
|
-
children,
|
|
206
|
-
className,
|
|
207
|
-
container = true,
|
|
208
|
-
padding = "md"
|
|
209
|
-
}) {
|
|
210
|
-
const containerClass = container === true ? "@container/main" : typeof container === "string" ? `@container/${container}` : "";
|
|
211
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-1 flex-col min-w-0", className), children: /* @__PURE__ */ jsx(
|
|
212
|
-
"div",
|
|
213
|
-
{
|
|
214
|
-
className: cn(
|
|
215
|
-
"flex flex-1 flex-col gap-2 min-w-0",
|
|
216
|
-
containerClass,
|
|
217
|
-
PADDING[padding]
|
|
218
|
-
),
|
|
219
|
-
children
|
|
220
|
-
}
|
|
221
|
-
) });
|
|
222
|
-
}
|
|
223
|
-
function SidebarBrand({
|
|
224
|
-
title,
|
|
225
|
-
icon,
|
|
226
|
-
href = "/",
|
|
227
|
-
className,
|
|
228
|
-
tooltip
|
|
229
|
-
}) {
|
|
230
|
-
const { isMobile, state } = useSidebar();
|
|
231
|
-
const isCollapsed = state === "collapsed";
|
|
232
|
-
return /* @__PURE__ */ jsx(SidebarMenu, { className, children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
233
|
-
SidebarMenuButton,
|
|
234
|
-
{
|
|
235
|
-
size: "lg",
|
|
236
|
-
className: "group-data-[collapsible=icon]:p-0!",
|
|
237
|
-
tooltip: isCollapsed ? tooltip || title : void 0,
|
|
238
|
-
render: /* @__PURE__ */ jsx(
|
|
239
|
-
Link3,
|
|
240
|
-
{
|
|
241
|
-
href,
|
|
242
|
-
className: cn(
|
|
243
|
-
"flex items-center text-sidebar-foreground",
|
|
244
|
-
isCollapsed && !isMobile && "justify-center"
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
),
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ jsx(
|
|
250
|
-
"div",
|
|
251
|
-
{
|
|
252
|
-
className: cn(
|
|
253
|
-
"rounded-lg flex items-center justify-center bg-sidebar-primary text-sidebar-primary-foreground shadow-sm flex-shrink-0 transition-[width,height]",
|
|
254
|
-
isCollapsed && !isMobile ? "h-6 w-6" : "h-8 w-8"
|
|
255
|
-
),
|
|
256
|
-
children: icon
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
/* @__PURE__ */ jsx(
|
|
260
|
-
"span",
|
|
261
|
-
{
|
|
262
|
-
className: cn(
|
|
263
|
-
"ml-2 font-semibold tracking-tight truncate",
|
|
264
|
-
!isMobile && isCollapsed && "hidden"
|
|
265
|
-
),
|
|
266
|
-
children: title
|
|
267
|
-
}
|
|
268
|
-
)
|
|
269
|
-
]
|
|
270
|
-
}
|
|
271
|
-
) }) });
|
|
272
|
-
}
|
|
273
|
-
function SidebarNavItem({ item, onClick }) {
|
|
274
|
-
const hasSubItems = item.items && item.items.length > 0;
|
|
275
|
-
const Icon = item.icon;
|
|
276
|
-
const [open, setOpen] = useState(item.isActive ?? false);
|
|
277
|
-
if (hasSubItems) {
|
|
278
|
-
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
279
|
-
Collapsible,
|
|
280
|
-
{
|
|
281
|
-
open,
|
|
282
|
-
onOpenChange: setOpen,
|
|
283
|
-
className: "group/collapsible",
|
|
284
|
-
children: [
|
|
285
|
-
/* @__PURE__ */ jsxs(
|
|
286
|
-
CollapsibleTrigger,
|
|
287
|
-
{
|
|
288
|
-
render: /* @__PURE__ */ jsx(SidebarMenuButton, {}),
|
|
289
|
-
children: [
|
|
290
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
291
|
-
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
292
|
-
item.badge && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs bg-sidebar-accent text-sidebar-accent-foreground px-1.5 py-0.5 rounded", children: item.badge }),
|
|
293
|
-
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-open/collapsible:rotate-90" })
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
),
|
|
297
|
-
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items.map((subItem, idx) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxs(SidebarMenuSubButton, { render: /* @__PURE__ */ jsx(Link3, { href: subItem.url }), children: [
|
|
298
|
-
/* @__PURE__ */ jsx("span", { children: subItem.title }),
|
|
299
|
-
subItem.badge && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs opacity-60", children: subItem.badge })
|
|
300
|
-
] }) }, `${item.title}-${subItem.title}-${idx}`)) }) })
|
|
301
|
-
]
|
|
302
|
-
}
|
|
303
|
-
) });
|
|
304
|
-
}
|
|
305
|
-
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(Link3, { href: item.url, className: "w-full", children: /* @__PURE__ */ jsxs(
|
|
306
|
-
SidebarMenuButton,
|
|
307
|
-
{
|
|
308
|
-
isActive: item.isActive,
|
|
309
|
-
onClick,
|
|
310
|
-
children: [
|
|
311
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
312
|
-
/* @__PURE__ */ jsx("span", { children: item.title }),
|
|
313
|
-
item.badge && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs bg-sidebar-accent text-sidebar-accent-foreground px-1.5 py-0.5 rounded", children: item.badge })
|
|
314
|
-
]
|
|
315
|
-
}
|
|
316
|
-
) }) });
|
|
317
|
-
}
|
|
318
|
-
function SidebarNavGroup({
|
|
319
|
-
title,
|
|
320
|
-
items,
|
|
321
|
-
className,
|
|
322
|
-
onItemClick
|
|
323
|
-
}) {
|
|
324
|
-
return /* @__PURE__ */ jsxs(SidebarGroup, { className, children: [
|
|
325
|
-
title && /* @__PURE__ */ jsx(SidebarGroupLabel, { children: title }),
|
|
326
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: items.map((item, idx) => /* @__PURE__ */ jsx(
|
|
327
|
-
SidebarNavItem,
|
|
328
|
-
{
|
|
329
|
-
item,
|
|
330
|
-
onClick: () => onItemClick?.(item)
|
|
331
|
-
},
|
|
332
|
-
`${item.title}-${idx}`
|
|
333
|
-
)) })
|
|
334
|
-
] });
|
|
335
|
-
}
|
|
336
|
-
function SidebarNav({ groups, className, onItemClick }) {
|
|
337
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-2", className), children: groups.map((group, index) => /* @__PURE__ */ jsx(
|
|
338
|
-
SidebarNavGroup,
|
|
339
|
-
{
|
|
340
|
-
title: group.title,
|
|
341
|
-
items: group.items,
|
|
342
|
-
onItemClick
|
|
343
|
-
},
|
|
344
|
-
group.title || `nav-group-${index}`
|
|
345
|
-
)) });
|
|
346
|
-
}
|
|
347
|
-
function getUserInitials(name) {
|
|
348
|
-
if (!name) return "?";
|
|
349
|
-
const names = name.trim().split(" ");
|
|
350
|
-
if (names.length === 1) return names[0].slice(0, 2).toUpperCase();
|
|
351
|
-
return (names[0][0] + names[names.length - 1][0]).toUpperCase();
|
|
352
|
-
}
|
|
353
|
-
function UserAvatar({ user, className }) {
|
|
354
|
-
return /* @__PURE__ */ jsxs(Avatar, { className: cn("h-8 w-8 rounded-lg", className), children: [
|
|
355
|
-
/* @__PURE__ */ jsx(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
356
|
-
/* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg bg-sidebar-primary text-sidebar-primary-foreground", children: getUserInitials(user.name) })
|
|
357
|
-
] });
|
|
358
|
-
}
|
|
359
|
-
function UserInfo({ user }) {
|
|
360
|
-
return /* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
361
|
-
/* @__PURE__ */ jsx("span", { className: "truncate font-semibold", children: user.name }),
|
|
362
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
363
|
-
] });
|
|
364
|
-
}
|
|
365
|
-
function SidebarUserMenu({
|
|
366
|
-
user,
|
|
367
|
-
menuItems = [],
|
|
368
|
-
onLogout,
|
|
369
|
-
className
|
|
370
|
-
}) {
|
|
371
|
-
const { isMobile, state } = useSidebar();
|
|
372
|
-
const isCollapsed = state === "collapsed";
|
|
373
|
-
const defaultItems = [
|
|
374
|
-
{
|
|
375
|
-
label: "Account",
|
|
376
|
-
icon: CircleUserRound,
|
|
377
|
-
href: "/dashboard/profile"
|
|
378
|
-
}
|
|
379
|
-
];
|
|
380
|
-
const items = menuItems.length > 0 ? menuItems : defaultItems;
|
|
381
|
-
return /* @__PURE__ */ jsx(SidebarMenu, { className, children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
382
|
-
/* @__PURE__ */ jsxs(
|
|
383
|
-
DropdownMenuTrigger,
|
|
384
|
-
{
|
|
385
|
-
render: /* @__PURE__ */ jsx(
|
|
386
|
-
SidebarMenuButton,
|
|
387
|
-
{
|
|
388
|
-
size: "lg",
|
|
389
|
-
tooltip: isCollapsed ? user.name : void 0,
|
|
390
|
-
className: cn(
|
|
391
|
-
"data-open:bg-sidebar-accent data-open:text-sidebar-accent-foreground",
|
|
392
|
-
isCollapsed && !isMobile && "justify-center"
|
|
393
|
-
)
|
|
394
|
-
}
|
|
395
|
-
),
|
|
396
|
-
children: [
|
|
397
|
-
/* @__PURE__ */ jsx(UserAvatar, { user }),
|
|
398
|
-
(!isCollapsed || isMobile) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
399
|
-
/* @__PURE__ */ jsx(UserInfo, { user }),
|
|
400
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-4" })
|
|
401
|
-
] })
|
|
402
|
-
]
|
|
403
|
-
}
|
|
404
|
-
),
|
|
405
|
-
/* @__PURE__ */ jsxs(
|
|
406
|
-
DropdownMenuContent,
|
|
407
|
-
{
|
|
408
|
-
className: "w-(--anchor-width) min-w-56 rounded-lg",
|
|
409
|
-
side: isMobile ? "bottom" : "right",
|
|
410
|
-
align: "end",
|
|
411
|
-
sideOffset: 4,
|
|
412
|
-
children: [
|
|
413
|
-
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
414
|
-
/* @__PURE__ */ jsx(UserAvatar, { user }),
|
|
415
|
-
/* @__PURE__ */ jsx(UserInfo, { user })
|
|
416
|
-
] }) }) }),
|
|
417
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
418
|
-
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: items.map((item, index) => /* @__PURE__ */ jsxs(React4.Fragment, { children: [
|
|
419
|
-
item.separator && index > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
420
|
-
item.href ? /* @__PURE__ */ jsxs(
|
|
421
|
-
DropdownMenuItem,
|
|
422
|
-
{
|
|
423
|
-
render: /* @__PURE__ */ jsx(Link3, { href: item.href }),
|
|
424
|
-
className: "w-full flex items-center",
|
|
425
|
-
children: [
|
|
426
|
-
item.icon && /* @__PURE__ */ jsx(item.icon, { className: "mr-2 h-4 w-4" }),
|
|
427
|
-
item.label
|
|
428
|
-
]
|
|
429
|
-
}
|
|
430
|
-
) : /* @__PURE__ */ jsxs(
|
|
431
|
-
DropdownMenuItem,
|
|
432
|
-
{
|
|
433
|
-
onClick: item.onClick,
|
|
434
|
-
className: "w-full flex items-center",
|
|
435
|
-
children: [
|
|
436
|
-
item.icon && /* @__PURE__ */ jsx(item.icon, { className: "mr-2 h-4 w-4" }),
|
|
437
|
-
item.label
|
|
438
|
-
]
|
|
439
|
-
}
|
|
440
|
-
)
|
|
441
|
-
] }, item.label)) }),
|
|
442
|
-
onLogout && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
443
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
444
|
-
/* @__PURE__ */ jsxs(
|
|
445
|
-
DropdownMenuItem,
|
|
446
|
-
{
|
|
447
|
-
onClick: onLogout,
|
|
448
|
-
className: "w-full flex items-center",
|
|
449
|
-
children: [
|
|
450
|
-
/* @__PURE__ */ jsx(LogOut, { className: "mr-2 h-4 w-4" }),
|
|
451
|
-
"Log out"
|
|
452
|
-
]
|
|
453
|
-
}
|
|
454
|
-
)
|
|
455
|
-
] })
|
|
456
|
-
]
|
|
457
|
-
}
|
|
458
|
-
)
|
|
459
|
-
] }) }) });
|
|
460
|
-
}
|
|
461
|
-
function DropdownContent({
|
|
462
|
-
items,
|
|
463
|
-
selected,
|
|
464
|
-
onSelect,
|
|
465
|
-
label,
|
|
466
|
-
renderItem,
|
|
467
|
-
isMobile = false
|
|
468
|
-
}) {
|
|
469
|
-
return /* @__PURE__ */ jsx(
|
|
470
|
-
DropdownMenuContent,
|
|
471
|
-
{
|
|
472
|
-
className: "w-64 rounded-lg",
|
|
473
|
-
side: isMobile ? "bottom" : "right",
|
|
474
|
-
align: "start",
|
|
475
|
-
sideOffset: 4,
|
|
476
|
-
children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
|
|
477
|
-
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-xs text-muted-foreground font-normal", children: label }),
|
|
478
|
-
items.map((item) => {
|
|
479
|
-
const isSelected = selected.id === item.id;
|
|
480
|
-
if (renderItem) {
|
|
481
|
-
return /* @__PURE__ */ jsx(
|
|
482
|
-
DropdownMenuItem,
|
|
483
|
-
{
|
|
484
|
-
onClick: () => onSelect(item),
|
|
485
|
-
className: "cursor-pointer",
|
|
486
|
-
children: renderItem(item, isSelected)
|
|
487
|
-
},
|
|
488
|
-
item.id
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
return /* @__PURE__ */ jsx(
|
|
492
|
-
DropdownMenuItem,
|
|
493
|
-
{
|
|
494
|
-
onClick: () => onSelect(item),
|
|
495
|
-
className: "gap-2 cursor-pointer",
|
|
496
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
497
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
498
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm truncate", children: item.name }),
|
|
499
|
-
isSelected && /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-primary shrink-0" })
|
|
500
|
-
] }),
|
|
501
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mt-0.5", children: [
|
|
502
|
-
item.code && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.code }),
|
|
503
|
-
item.type && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
504
|
-
item.code && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
505
|
-
/* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-[10px] h-4 px-1", children: item.type })
|
|
506
|
-
] }),
|
|
507
|
-
item.isDefault && /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-[10px] h-4 px-1", children: "Default" }),
|
|
508
|
-
item.isActive === false && /* @__PURE__ */ jsx(Badge, { variant: "destructive", className: "text-[10px] h-4 px-1", children: "Inactive" })
|
|
509
|
-
] }),
|
|
510
|
-
item.subtitle && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground mt-0.5 truncate", children: item.subtitle })
|
|
511
|
-
] })
|
|
512
|
-
},
|
|
513
|
-
item.id
|
|
514
|
-
);
|
|
515
|
-
})
|
|
516
|
-
] })
|
|
517
|
-
}
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
function SidebarLoadingSkeleton({ isCollapsed, isMobile }) {
|
|
521
|
-
return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(
|
|
522
|
-
SidebarMenuButton,
|
|
523
|
-
{
|
|
524
|
-
className: cn(
|
|
525
|
-
"h-10 py-1.5 bg-sidebar-accent/50",
|
|
526
|
-
isCollapsed && !isMobile && "justify-center"
|
|
527
|
-
),
|
|
528
|
-
disabled: true,
|
|
529
|
-
children: [
|
|
530
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4 rounded-sm shrink-0" }),
|
|
531
|
-
(!isCollapsed || isMobile) && /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 space-y-1", children: [
|
|
532
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24" }),
|
|
533
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-2.5 w-14" })
|
|
534
|
-
] })
|
|
535
|
-
]
|
|
536
|
-
}
|
|
537
|
-
) }) });
|
|
538
|
-
}
|
|
539
|
-
function SidebarProjectDisplay({
|
|
540
|
-
project,
|
|
541
|
-
Icon,
|
|
542
|
-
isCollapsed,
|
|
543
|
-
isMobile
|
|
544
|
-
}) {
|
|
545
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
546
|
-
/* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
547
|
-
(!isCollapsed || isMobile) && /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 leading-tight text-left", children: [
|
|
548
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium truncate", children: project.name }),
|
|
549
|
-
project.code && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground truncate", children: project.code })
|
|
550
|
-
] })
|
|
551
|
-
] });
|
|
552
|
-
}
|
|
553
|
-
function StandaloneLoadingSkeleton({ size }) {
|
|
554
|
-
return /* @__PURE__ */ jsxs(
|
|
555
|
-
Button,
|
|
556
|
-
{
|
|
557
|
-
variant: "outline",
|
|
558
|
-
size,
|
|
559
|
-
className: cn("gap-2", size === "sm" ? "h-8" : "h-9"),
|
|
560
|
-
disabled: true,
|
|
561
|
-
children: [
|
|
562
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4 rounded-sm" }),
|
|
563
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-20" })
|
|
564
|
-
]
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
function StandaloneProjectDisplay({
|
|
569
|
-
project,
|
|
570
|
-
Icon,
|
|
571
|
-
size
|
|
572
|
-
}) {
|
|
573
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
574
|
-
/* @__PURE__ */ jsx(Icon, { className: cn("text-muted-foreground shrink-0", size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4") }),
|
|
575
|
-
/* @__PURE__ */ jsx("span", { className: cn("font-medium truncate max-w-[120px]", size === "sm" ? "text-xs" : "text-sm"), children: project.name }),
|
|
576
|
-
project.code && /* @__PURE__ */ jsxs("span", { className: cn("text-muted-foreground truncate", size === "sm" ? "text-[10px]" : "text-xs"), children: [
|
|
577
|
-
"(",
|
|
578
|
-
project.code,
|
|
579
|
-
")"
|
|
580
|
-
] })
|
|
581
|
-
] });
|
|
582
|
-
}
|
|
583
|
-
function ProjectSwitcher({
|
|
584
|
-
items,
|
|
585
|
-
selected,
|
|
586
|
-
onSelect,
|
|
587
|
-
isLoading = false,
|
|
588
|
-
label = "Switch Project",
|
|
589
|
-
icon: Icon = Building2,
|
|
590
|
-
className,
|
|
591
|
-
disabled = false,
|
|
592
|
-
variant = "sidebar",
|
|
593
|
-
size = "default",
|
|
594
|
-
renderItem
|
|
595
|
-
}) {
|
|
596
|
-
const hasMultipleItems = items.length > 1;
|
|
597
|
-
if (variant === "standalone") {
|
|
598
|
-
if (isLoading) {
|
|
599
|
-
return /* @__PURE__ */ jsx(StandaloneLoadingSkeleton, { size });
|
|
600
|
-
}
|
|
601
|
-
if (!selected) {
|
|
602
|
-
return null;
|
|
603
|
-
}
|
|
604
|
-
if (!hasMultipleItems || disabled) {
|
|
605
|
-
return /* @__PURE__ */ jsx(
|
|
606
|
-
Button,
|
|
607
|
-
{
|
|
608
|
-
variant: "outline",
|
|
609
|
-
size,
|
|
610
|
-
className: cn("gap-2 cursor-default", size === "sm" ? "h-8" : "h-9", className),
|
|
611
|
-
disabled: true,
|
|
612
|
-
children: /* @__PURE__ */ jsx(StandaloneProjectDisplay, { project: selected, Icon, size })
|
|
613
|
-
}
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
617
|
-
/* @__PURE__ */ jsxs(
|
|
618
|
-
DropdownMenuTrigger,
|
|
619
|
-
{
|
|
620
|
-
render: /* @__PURE__ */ jsx(
|
|
621
|
-
Button,
|
|
622
|
-
{
|
|
623
|
-
variant: "outline",
|
|
624
|
-
size,
|
|
625
|
-
className: cn("gap-2", size === "sm" ? "h-8" : "h-9", className)
|
|
626
|
-
}
|
|
627
|
-
),
|
|
628
|
-
children: [
|
|
629
|
-
/* @__PURE__ */ jsx(StandaloneProjectDisplay, { project: selected, Icon, size }),
|
|
630
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: cn("text-muted-foreground shrink-0", size === "sm" ? "h-3 w-3" : "h-3.5 w-3.5") })
|
|
631
|
-
]
|
|
632
|
-
}
|
|
633
|
-
),
|
|
634
|
-
/* @__PURE__ */ jsx(
|
|
635
|
-
DropdownContent,
|
|
636
|
-
{
|
|
637
|
-
items,
|
|
638
|
-
selected,
|
|
639
|
-
onSelect,
|
|
640
|
-
label,
|
|
641
|
-
renderItem
|
|
642
|
-
}
|
|
643
|
-
)
|
|
644
|
-
] });
|
|
645
|
-
}
|
|
646
|
-
const { isMobile, state } = useSidebar();
|
|
647
|
-
const isCollapsed = state === "collapsed";
|
|
648
|
-
if (isLoading) {
|
|
649
|
-
return /* @__PURE__ */ jsx(SidebarLoadingSkeleton, { isCollapsed, isMobile });
|
|
650
|
-
}
|
|
651
|
-
if (!selected) {
|
|
652
|
-
return null;
|
|
653
|
-
}
|
|
654
|
-
if (!hasMultipleItems || disabled) {
|
|
655
|
-
return /* @__PURE__ */ jsx(SidebarMenu, { className, children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
656
|
-
SidebarMenuButton,
|
|
657
|
-
{
|
|
658
|
-
className: cn(
|
|
659
|
-
"h-10 py-1.5 bg-sidebar-accent/50",
|
|
660
|
-
isCollapsed && !isMobile && "justify-center"
|
|
661
|
-
),
|
|
662
|
-
tooltip: isCollapsed ? selected.name : void 0,
|
|
663
|
-
disabled: true,
|
|
664
|
-
children: /* @__PURE__ */ jsx(
|
|
665
|
-
SidebarProjectDisplay,
|
|
666
|
-
{
|
|
667
|
-
project: selected,
|
|
668
|
-
Icon,
|
|
669
|
-
isCollapsed,
|
|
670
|
-
isMobile
|
|
671
|
-
}
|
|
672
|
-
)
|
|
673
|
-
}
|
|
674
|
-
) }) });
|
|
675
|
-
}
|
|
676
|
-
return /* @__PURE__ */ jsx(SidebarMenu, { className, children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
677
|
-
/* @__PURE__ */ jsxs(
|
|
678
|
-
DropdownMenuTrigger,
|
|
679
|
-
{
|
|
680
|
-
render: /* @__PURE__ */ jsx(
|
|
681
|
-
SidebarMenuButton,
|
|
682
|
-
{
|
|
683
|
-
className: cn(
|
|
684
|
-
"h-10 py-1.5 bg-sidebar-accent/50 hover:bg-sidebar-accent transition-colors",
|
|
685
|
-
isCollapsed && !isMobile && "justify-center"
|
|
686
|
-
),
|
|
687
|
-
tooltip: isCollapsed ? selected.name : void 0
|
|
688
|
-
}
|
|
689
|
-
),
|
|
690
|
-
children: [
|
|
691
|
-
/* @__PURE__ */ jsx(
|
|
692
|
-
SidebarProjectDisplay,
|
|
693
|
-
{
|
|
694
|
-
project: selected,
|
|
695
|
-
Icon,
|
|
696
|
-
isCollapsed,
|
|
697
|
-
isMobile
|
|
698
|
-
}
|
|
699
|
-
),
|
|
700
|
-
(!isCollapsed || isMobile) && /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground shrink-0" })
|
|
701
|
-
]
|
|
702
|
-
}
|
|
703
|
-
),
|
|
704
|
-
/* @__PURE__ */ jsx(
|
|
705
|
-
DropdownContent,
|
|
706
|
-
{
|
|
707
|
-
items,
|
|
708
|
-
selected,
|
|
709
|
-
onSelect,
|
|
710
|
-
label,
|
|
711
|
-
renderItem,
|
|
712
|
-
isMobile
|
|
713
|
-
}
|
|
714
|
-
)
|
|
715
|
-
] }) }) });
|
|
716
|
-
}
|
|
717
|
-
function BreadcrumbNav({ items }) {
|
|
718
|
-
return /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, { children: items.map((item, index) => /* @__PURE__ */ jsxs(React4.Fragment, { children: [
|
|
719
|
-
/* @__PURE__ */ jsx(BreadcrumbItem, { className: item.current ? "" : "hidden md:block", children: item.current ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, { render: /* @__PURE__ */ jsx(Link3, { href: item.href || "#" }), children: item.label }) }),
|
|
720
|
-
index < items.length - 1 && /* @__PURE__ */ jsx(BreadcrumbSeparator, { className: "hidden md:block" })
|
|
721
|
-
] }, `breadcrumb-${index}`)) }) });
|
|
722
|
-
}
|
|
723
|
-
function DashboardHeader({
|
|
724
|
-
breadcrumbs,
|
|
725
|
-
leftContent,
|
|
726
|
-
rightContent,
|
|
727
|
-
showSidebarTrigger = true,
|
|
728
|
-
className,
|
|
729
|
-
children
|
|
730
|
-
}) {
|
|
731
|
-
return /* @__PURE__ */ jsxs(
|
|
732
|
-
"header",
|
|
733
|
-
{
|
|
734
|
-
className: cn(
|
|
735
|
-
"flex h-12 shrink-0 items-center justify-between gap-2",
|
|
736
|
-
className
|
|
737
|
-
),
|
|
738
|
-
children: [
|
|
739
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
740
|
-
showSidebarTrigger && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
741
|
-
/* @__PURE__ */ jsx(SidebarTrigger, { className: "-ml-1" }),
|
|
742
|
-
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mr-2 h-4" })
|
|
743
|
-
] }),
|
|
744
|
-
children ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
745
|
-
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(BreadcrumbNav, { items: breadcrumbs }),
|
|
746
|
-
leftContent
|
|
747
|
-
] })
|
|
748
|
-
] }),
|
|
749
|
-
rightContent && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: rightContent })
|
|
750
|
-
]
|
|
751
|
-
}
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
function InsetSidebar({
|
|
755
|
-
brand,
|
|
756
|
-
navigation,
|
|
757
|
-
secondaryNavigation,
|
|
758
|
-
project,
|
|
759
|
-
user,
|
|
760
|
-
headerContent,
|
|
761
|
-
ariaLabel = "Navigation Menu",
|
|
762
|
-
className,
|
|
763
|
-
children
|
|
764
|
-
}) {
|
|
765
|
-
const { isMobile } = useSidebar();
|
|
766
|
-
return /* @__PURE__ */ jsxs(Sidebar, { variant: "inset", collapsible: "icon", className, children: [
|
|
767
|
-
isMobile && /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
768
|
-
/* @__PURE__ */ jsx(SheetTitle, { children: ariaLabel }),
|
|
769
|
-
/* @__PURE__ */ jsx(SheetDescription, { children: "Application navigation menu containing links to different sections" })
|
|
770
|
-
] }),
|
|
771
|
-
/* @__PURE__ */ jsxs(SidebarHeader, { className: "gap-1", children: [
|
|
772
|
-
/* @__PURE__ */ jsx(
|
|
773
|
-
SidebarBrand,
|
|
774
|
-
{
|
|
775
|
-
title: brand.title,
|
|
776
|
-
icon: brand.icon,
|
|
777
|
-
href: brand.href
|
|
778
|
-
}
|
|
779
|
-
),
|
|
780
|
-
project && /* @__PURE__ */ jsx(
|
|
781
|
-
ProjectSwitcher,
|
|
782
|
-
{
|
|
783
|
-
items: project.items,
|
|
784
|
-
selected: project.selected,
|
|
785
|
-
onSelect: project.onSelect,
|
|
786
|
-
isLoading: project.isLoading,
|
|
787
|
-
label: project.label,
|
|
788
|
-
icon: project.icon
|
|
789
|
-
}
|
|
790
|
-
),
|
|
791
|
-
headerContent
|
|
792
|
-
] }),
|
|
793
|
-
/* @__PURE__ */ jsx(SidebarContent, { children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
794
|
-
/* @__PURE__ */ jsx(SidebarNav, { groups: navigation }),
|
|
795
|
-
secondaryNavigation && /* @__PURE__ */ jsx(SidebarNav, { groups: secondaryNavigation, className: "mt-auto" })
|
|
796
|
-
] }) }),
|
|
797
|
-
user && /* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(
|
|
798
|
-
SidebarUserMenu,
|
|
799
|
-
{
|
|
800
|
-
user: user.data,
|
|
801
|
-
menuItems: user.menuItems,
|
|
802
|
-
onLogout: user.onLogout
|
|
803
|
-
}
|
|
804
|
-
) })
|
|
805
|
-
] });
|
|
806
|
-
}
|
|
807
|
-
var SIDEBAR_RAIL_WIDTH = "3.5rem";
|
|
808
|
-
var SIDEBAR_PANEL_WIDTH = "13rem";
|
|
809
|
-
var SIDEBAR_WIDTH_EXPANDED = "16.5rem";
|
|
810
|
-
var SIDEBAR_WIDTH_COLLAPSED = "3.5rem";
|
|
811
|
-
var SIDEBAR_PADDING = "0.5rem";
|
|
812
|
-
var railVariants = {
|
|
813
|
-
default: "bg-sidebar",
|
|
814
|
-
dark: "bg-zinc-900 dark:bg-zinc-950",
|
|
815
|
-
primary: "bg-primary",
|
|
816
|
-
muted: "bg-muted"
|
|
817
|
-
};
|
|
818
|
-
var railTextVariants = {
|
|
819
|
-
default: "text-sidebar-foreground",
|
|
820
|
-
dark: "text-zinc-100",
|
|
821
|
-
primary: "text-primary-foreground",
|
|
822
|
-
muted: "text-muted-foreground"
|
|
823
|
-
};
|
|
824
|
-
function DualSidebar({
|
|
825
|
-
brand,
|
|
826
|
-
categories,
|
|
827
|
-
user,
|
|
828
|
-
defaultCategoryId,
|
|
829
|
-
onCategoryChange,
|
|
830
|
-
defaultCollapsed = false,
|
|
831
|
-
railVariant = "default",
|
|
832
|
-
ariaLabel = "Navigation Menu",
|
|
833
|
-
className
|
|
834
|
-
}) {
|
|
835
|
-
const [activeCategory, setActiveCategory] = React4.useState(
|
|
836
|
-
defaultCategoryId || (categories.length > 0 ? categories[0].id : null)
|
|
837
|
-
);
|
|
838
|
-
const [isExpanded, setIsExpanded] = React4.useState(!defaultCollapsed);
|
|
839
|
-
const { isMobile } = useSidebar();
|
|
840
|
-
const handleCategorySelect = (id) => {
|
|
841
|
-
setActiveCategory(id);
|
|
842
|
-
onCategoryChange?.(id);
|
|
843
|
-
if (!isExpanded) {
|
|
844
|
-
setIsExpanded(true);
|
|
845
|
-
}
|
|
846
|
-
};
|
|
847
|
-
const toggleExpanded = () => {
|
|
848
|
-
setIsExpanded(!isExpanded);
|
|
849
|
-
};
|
|
850
|
-
const activeCategoryData = categories.find((c) => c.id === activeCategory) || null;
|
|
851
|
-
const currentWidth = isExpanded ? SIDEBAR_WIDTH_EXPANDED : SIDEBAR_WIDTH_COLLAPSED;
|
|
852
|
-
const totalWidth = `calc(${currentWidth} + ${SIDEBAR_PADDING} * 2)`;
|
|
853
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
854
|
-
"div",
|
|
855
|
-
{
|
|
856
|
-
className: "group peer text-sidebar-foreground hidden md:block",
|
|
857
|
-
"data-state": "expanded",
|
|
858
|
-
"data-collapsible": "",
|
|
859
|
-
"data-variant": "inset",
|
|
860
|
-
"data-side": "left",
|
|
861
|
-
"data-slot": "sidebar",
|
|
862
|
-
children: [
|
|
863
|
-
/* @__PURE__ */ jsx(
|
|
864
|
-
"div",
|
|
865
|
-
{
|
|
866
|
-
"data-slot": "sidebar-gap",
|
|
867
|
-
className: "relative bg-transparent transition-[width] duration-200 ease-linear",
|
|
868
|
-
style: { width: totalWidth }
|
|
869
|
-
}
|
|
870
|
-
),
|
|
871
|
-
/* @__PURE__ */ jsx(
|
|
872
|
-
"div",
|
|
873
|
-
{
|
|
874
|
-
"data-slot": "sidebar-container",
|
|
875
|
-
className: cn(
|
|
876
|
-
"fixed inset-y-0 left-0 z-10 hidden h-svh transition-[width] duration-200 ease-linear md:flex",
|
|
877
|
-
className
|
|
878
|
-
),
|
|
879
|
-
style: {
|
|
880
|
-
width: totalWidth,
|
|
881
|
-
padding: SIDEBAR_PADDING
|
|
882
|
-
},
|
|
883
|
-
children: /* @__PURE__ */ jsxs(
|
|
884
|
-
"div",
|
|
885
|
-
{
|
|
886
|
-
"data-sidebar": "sidebar",
|
|
887
|
-
"data-slot": "sidebar-inner",
|
|
888
|
-
className: "bg-sidebar flex h-full w-full flex-row overflow-hidden rounded-lg border border-sidebar-border shadow-sm",
|
|
889
|
-
children: [
|
|
890
|
-
isMobile && /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
891
|
-
/* @__PURE__ */ jsx(SheetTitle, { children: ariaLabel }),
|
|
892
|
-
/* @__PURE__ */ jsx(SheetDescription, { children: "Navigation menu with category icons and expanded content" })
|
|
893
|
-
] }),
|
|
894
|
-
/* @__PURE__ */ jsxs(
|
|
895
|
-
"div",
|
|
896
|
-
{
|
|
897
|
-
className: cn(
|
|
898
|
-
"flex flex-col shrink-0 transition-colors",
|
|
899
|
-
railVariants[railVariant],
|
|
900
|
-
railTextVariants[railVariant],
|
|
901
|
-
isExpanded && "border-r border-sidebar-border"
|
|
902
|
-
),
|
|
903
|
-
style: { width: SIDEBAR_RAIL_WIDTH, minWidth: SIDEBAR_RAIL_WIDTH },
|
|
904
|
-
children: [
|
|
905
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-2 h-14", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
906
|
-
/* @__PURE__ */ jsx(
|
|
907
|
-
TooltipTrigger,
|
|
908
|
-
{
|
|
909
|
-
render: /* @__PURE__ */ jsx(
|
|
910
|
-
Link3,
|
|
911
|
-
{
|
|
912
|
-
href: brand.href || "/",
|
|
913
|
-
className: cn(
|
|
914
|
-
"flex items-center justify-center h-10 w-10 rounded-lg shadow-sm transition-colors",
|
|
915
|
-
railVariant === "dark" || railVariant === "primary" ? "bg-white/10 hover:bg-white/20 text-inherit" : "bg-sidebar-primary text-sidebar-primary-foreground"
|
|
916
|
-
)
|
|
917
|
-
}
|
|
918
|
-
),
|
|
919
|
-
children: brand.icon
|
|
920
|
-
}
|
|
921
|
-
),
|
|
922
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: brand.title })
|
|
923
|
-
] }) }),
|
|
924
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col gap-1 p-2", children: categories.map((category) => {
|
|
925
|
-
const Icon = category.icon;
|
|
926
|
-
const isActive = activeCategory === category.id;
|
|
927
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
928
|
-
/* @__PURE__ */ jsx(
|
|
929
|
-
TooltipTrigger,
|
|
930
|
-
{
|
|
931
|
-
render: /* @__PURE__ */ jsx(
|
|
932
|
-
"button",
|
|
933
|
-
{
|
|
934
|
-
onClick: () => handleCategorySelect(category.id),
|
|
935
|
-
className: cn(
|
|
936
|
-
"flex items-center justify-center h-10 w-10 rounded-lg transition-colors",
|
|
937
|
-
isActive ? railVariant === "dark" || railVariant === "primary" ? "bg-white/20" : "bg-sidebar-accent text-sidebar-accent-foreground" : railVariant === "dark" || railVariant === "primary" ? "hover:bg-white/10" : "hover:bg-sidebar-accent/50"
|
|
938
|
-
)
|
|
939
|
-
}
|
|
940
|
-
),
|
|
941
|
-
children: /* @__PURE__ */ jsx(Icon, { className: "h-5 w-5" })
|
|
942
|
-
}
|
|
943
|
-
),
|
|
944
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: category.name })
|
|
945
|
-
] }, category.id);
|
|
946
|
-
}) }),
|
|
947
|
-
/* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
948
|
-
/* @__PURE__ */ jsx(
|
|
949
|
-
TooltipTrigger,
|
|
950
|
-
{
|
|
951
|
-
render: /* @__PURE__ */ jsx(
|
|
952
|
-
"button",
|
|
953
|
-
{
|
|
954
|
-
onClick: toggleExpanded,
|
|
955
|
-
className: cn(
|
|
956
|
-
"flex items-center justify-center h-10 w-10 rounded-lg transition-colors",
|
|
957
|
-
railVariant === "dark" || railVariant === "primary" ? "hover:bg-white/10" : "hover:bg-sidebar-accent/50"
|
|
958
|
-
)
|
|
959
|
-
}
|
|
960
|
-
),
|
|
961
|
-
children: isExpanded ? /* @__PURE__ */ jsx(ChevronLeft, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-5 w-5" })
|
|
962
|
-
}
|
|
963
|
-
),
|
|
964
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: isExpanded ? "Collapse sidebar" : "Expand sidebar" })
|
|
965
|
-
] }) })
|
|
966
|
-
]
|
|
967
|
-
}
|
|
968
|
-
),
|
|
969
|
-
/* @__PURE__ */ jsx(
|
|
970
|
-
"div",
|
|
971
|
-
{
|
|
972
|
-
className: cn(
|
|
973
|
-
"flex flex-col bg-sidebar overflow-hidden transition-[width,opacity] duration-200 ease-linear",
|
|
974
|
-
isExpanded ? "opacity-100" : "opacity-0 w-0"
|
|
975
|
-
),
|
|
976
|
-
style: { width: isExpanded ? SIDEBAR_PANEL_WIDTH : 0 },
|
|
977
|
-
children: activeCategoryData ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
978
|
-
/* @__PURE__ */ jsx(SidebarHeader, { className: "h-14 border-b border-sidebar-border px-4 flex items-center shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
979
|
-
/* @__PURE__ */ jsx(activeCategoryData.icon, { className: "h-5 w-5 text-sidebar-foreground" }),
|
|
980
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold text-sidebar-foreground truncate", children: activeCategoryData.name })
|
|
981
|
-
] }) }),
|
|
982
|
-
/* @__PURE__ */ jsx(SidebarContent, { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs(SidebarGroup, { className: "p-2", children: [
|
|
983
|
-
/* @__PURE__ */ jsxs(SidebarGroupLabel, { className: "px-2 text-xs text-sidebar-foreground/60", children: [
|
|
984
|
-
activeCategoryData.name,
|
|
985
|
-
" Menu"
|
|
986
|
-
] }),
|
|
987
|
-
/* @__PURE__ */ jsx(SidebarMenu, { children: activeCategoryData.items.map((item, idx) => {
|
|
988
|
-
const Icon = item.icon;
|
|
989
|
-
return /* @__PURE__ */ jsx(
|
|
990
|
-
SidebarMenuItem,
|
|
991
|
-
{
|
|
992
|
-
children: /* @__PURE__ */ jsxs(
|
|
993
|
-
SidebarMenuButton,
|
|
994
|
-
{
|
|
995
|
-
isActive: item.isActive,
|
|
996
|
-
render: /* @__PURE__ */ jsx(Link3, { href: item.url }),
|
|
997
|
-
children: [
|
|
998
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
999
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: item.title }),
|
|
1000
|
-
item.badge && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs bg-sidebar-accent text-sidebar-accent-foreground px-1.5 py-0.5 rounded shrink-0", children: item.badge })
|
|
1001
|
-
]
|
|
1002
|
-
}
|
|
1003
|
-
)
|
|
1004
|
-
},
|
|
1005
|
-
`${activeCategoryData.id}-${item.title}-${idx}`
|
|
1006
|
-
);
|
|
1007
|
-
}) })
|
|
1008
|
-
] }) }),
|
|
1009
|
-
user && /* @__PURE__ */ jsx(SidebarFooter, { className: "border-t border-sidebar-border shrink-0", children: /* @__PURE__ */ jsx(
|
|
1010
|
-
SidebarUserMenu,
|
|
1011
|
-
{
|
|
1012
|
-
user: user.data,
|
|
1013
|
-
menuItems: user.menuItems,
|
|
1014
|
-
onLogout: user.onLogout
|
|
1015
|
-
}
|
|
1016
|
-
) })
|
|
1017
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center text-sidebar-foreground/60 text-sm", children: "Select a category" })
|
|
1018
|
-
}
|
|
1019
|
-
)
|
|
1020
|
-
]
|
|
1021
|
-
}
|
|
1022
|
-
)
|
|
1023
|
-
}
|
|
1024
|
-
)
|
|
1025
|
-
]
|
|
1026
|
-
}
|
|
1027
|
-
) });
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
export { DashboardContent, DashboardHeader, DualSidebar, HeaderSection, InsetSidebar, PageHeader, ProjectSwitcher, SidebarBrand, SidebarNav, SidebarNavGroup, SidebarNavItem, SidebarUserMenu };
|
|
1031
|
-
//# sourceMappingURL=dashboard.js.map
|
|
1032
|
-
//# sourceMappingURL=dashboard.js.map
|