@slipstream-ui/core 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +672 -52
- package/dist/index.d.ts +672 -52
- package/dist/index.js +1860 -657
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1836 -655
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/app-shell.manifest.json +156 -0
- package/dist/manifests/auth-layout.manifest.json +99 -0
- package/dist/manifests/autocomplete.manifest.json +53 -5
- package/dist/manifests/badge.manifest.json +12 -0
- package/dist/manifests/button.manifest.json +6 -2
- package/dist/manifests/card.manifest.json +53 -6
- package/dist/manifests/date-picker.manifest.json +87 -0
- package/dist/manifests/dialog.manifest.json +49 -4
- package/dist/manifests/drawer.manifest.json +18 -4
- package/dist/manifests/empty-state.manifest.json +108 -0
- package/dist/manifests/file-upload.manifest.json +103 -0
- package/dist/manifests/filter-bar.manifest.json +100 -0
- package/dist/manifests/menu.manifest.json +13 -1
- package/dist/manifests/metric-card.manifest.json +105 -0
- package/dist/manifests/page-header.manifest.json +94 -0
- package/dist/manifests/pagination.manifest.json +62 -34
- package/dist/manifests/password-input.manifest.json +75 -0
- package/dist/manifests/select-menu.manifest.json +142 -0
- package/dist/manifests/select.manifest.json +49 -12
- package/dist/manifests/stepper.manifest.json +95 -0
- package/dist/manifests/table-card.manifest.json +123 -0
- package/dist/manifests/time-picker.manifest.json +86 -0
- package/dist/manifests/timeline.manifest.json +69 -0
- package/dist/manifests/toast.manifest.json +101 -25
- package/package.json +1 -1
- package/src/components/app-shell/AppShell.test.tsx +100 -0
- package/src/components/app-shell/AppShell.tsx +162 -0
- package/src/components/app-shell/index.ts +1 -0
- package/src/components/auth-layout/AuthLayout.test.tsx +34 -0
- package/src/components/auth-layout/AuthLayout.tsx +47 -0
- package/src/components/auth-layout/index.ts +1 -0
- package/src/components/autocomplete/Autocomplete.test.tsx +53 -0
- package/src/components/autocomplete/Autocomplete.tsx +160 -41
- package/src/components/badge/Badge.test.tsx +14 -0
- package/src/components/badge/Badge.tsx +10 -4
- package/src/components/button/Button.test.tsx +29 -0
- package/src/components/button/Button.tsx +10 -0
- package/src/components/button-group/ButtonGroup.test.tsx +6 -8
- package/src/components/button-group/ButtonGroup.tsx +17 -9
- package/src/components/card/Card.test.tsx +14 -0
- package/src/components/card/Card.tsx +15 -8
- package/src/components/date-picker/DatePicker.test.tsx +30 -0
- package/src/components/date-picker/DatePicker.tsx +57 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/dialog/Dialog.test.tsx +64 -1
- package/src/components/dialog/Dialog.tsx +113 -23
- package/src/components/dialog/index.ts +1 -2
- package/src/components/drawer/Drawer.test.tsx +50 -0
- package/src/components/drawer/Drawer.tsx +44 -6
- package/src/components/empty-state/EmptyState.test.tsx +30 -0
- package/src/components/empty-state/EmptyState.tsx +48 -0
- package/src/components/empty-state/index.ts +1 -0
- package/src/components/file-upload/FileUpload.test.tsx +43 -0
- package/src/components/file-upload/FileUpload.tsx +143 -0
- package/src/components/file-upload/index.ts +1 -0
- package/src/components/filter-bar/FilterBar.test.tsx +32 -0
- package/src/components/filter-bar/FilterBar.tsx +71 -0
- package/src/components/filter-bar/index.ts +1 -0
- package/src/components/input-group/InputGroup.test.tsx +6 -3
- package/src/components/input-group/InputGroup.tsx +9 -6
- package/src/components/menu/Menu.test.tsx +21 -0
- package/src/components/menu/Menu.tsx +8 -3
- package/src/components/metric-card/MetricCard.test.tsx +28 -0
- package/src/components/metric-card/MetricCard.tsx +54 -0
- package/src/components/metric-card/index.ts +1 -0
- package/src/components/page-header/PageHeader.test.tsx +31 -0
- package/src/components/page-header/PageHeader.tsx +37 -0
- package/src/components/page-header/index.ts +1 -0
- package/src/components/pagination/Pagination.test.tsx +25 -0
- package/src/components/pagination/Pagination.tsx +53 -12
- package/src/components/password-input/PasswordInput.test.tsx +29 -0
- package/src/components/password-input/PasswordInput.tsx +41 -0
- package/src/components/password-input/index.ts +1 -0
- package/src/components/select/Select.test.tsx +40 -1
- package/src/components/select/Select.tsx +52 -14
- package/src/components/select/index.ts +1 -1
- package/src/components/select-menu/SelectMenu.test.tsx +105 -0
- package/src/components/select-menu/SelectMenu.tsx +368 -0
- package/src/components/select-menu/index.ts +1 -0
- package/src/components/stepper/Stepper.test.tsx +35 -0
- package/src/components/stepper/Stepper.tsx +91 -0
- package/src/components/stepper/index.ts +1 -0
- package/src/components/table-card/TableCard.test.tsx +59 -0
- package/src/components/table-card/TableCard.tsx +48 -0
- package/src/components/table-card/index.ts +1 -0
- package/src/components/time-picker/TimePicker.test.tsx +30 -0
- package/src/components/time-picker/TimePicker.tsx +56 -0
- package/src/components/time-picker/index.ts +1 -0
- package/src/components/timeline/Timeline.test.tsx +26 -0
- package/src/components/timeline/Timeline.tsx +53 -0
- package/src/components/timeline/index.ts +1 -0
- package/src/components/toast/Toast.test.tsx +5 -0
- package/src/components/toast/Toast.tsx +2 -16
- package/src/components/toast/Toaster.test.tsx +84 -0
- package/src/components/toast/Toaster.tsx +116 -0
- package/src/components/toast/index.ts +4 -0
- package/src/components/toast/toast-store.ts +117 -0
- package/src/index.ts +14 -0
- package/src/manifests/app-shell.manifest.json +156 -0
- package/src/manifests/auth-layout.manifest.json +99 -0
- package/src/manifests/autocomplete.manifest.json +53 -5
- package/src/manifests/badge.manifest.json +12 -0
- package/src/manifests/button.manifest.json +6 -2
- package/src/manifests/card.manifest.json +53 -6
- package/src/manifests/date-picker.manifest.json +87 -0
- package/src/manifests/dialog.manifest.json +49 -4
- package/src/manifests/drawer.manifest.json +18 -4
- package/src/manifests/empty-state.manifest.json +108 -0
- package/src/manifests/file-upload.manifest.json +103 -0
- package/src/manifests/filter-bar.manifest.json +100 -0
- package/src/manifests/menu.manifest.json +13 -1
- package/src/manifests/metric-card.manifest.json +105 -0
- package/src/manifests/page-header.manifest.json +94 -0
- package/src/manifests/pagination.manifest.json +62 -34
- package/src/manifests/password-input.manifest.json +75 -0
- package/src/manifests/select-menu.manifest.json +142 -0
- package/src/manifests/select.manifest.json +49 -12
- package/src/manifests/stepper.manifest.json +95 -0
- package/src/manifests/table-card.manifest.json +123 -0
- package/src/manifests/time-picker.manifest.json +86 -0
- package/src/manifests/timeline.manifest.json +69 -0
- package/src/manifests/toast.manifest.json +101 -25
package/dist/index.js
CHANGED
|
@@ -37,6 +37,8 @@ __export(index_exports, {
|
|
|
37
37
|
Alert: () => Alert,
|
|
38
38
|
AlertDescription: () => AlertDescription,
|
|
39
39
|
AlertTitle: () => AlertTitle,
|
|
40
|
+
AppShell: () => AppShell,
|
|
41
|
+
AuthLayout: () => AuthLayout,
|
|
40
42
|
Autocomplete: () => Autocomplete,
|
|
41
43
|
Avatar: () => Avatar,
|
|
42
44
|
AvatarFallback: () => AvatarFallback,
|
|
@@ -56,10 +58,19 @@ __export(index_exports, {
|
|
|
56
58
|
CheckboxGroup: () => CheckboxGroup,
|
|
57
59
|
CheckboxGroupItem: () => CheckboxGroupItem,
|
|
58
60
|
DataTable: () => DataTable,
|
|
61
|
+
DatePicker: () => DatePicker,
|
|
59
62
|
Dialog: () => Dialog,
|
|
63
|
+
DialogBody: () => DialogBody,
|
|
64
|
+
DialogDescription: () => DialogDescription,
|
|
65
|
+
DialogFooter: () => DialogFooter,
|
|
66
|
+
DialogHeader: () => DialogHeader,
|
|
67
|
+
DialogTitle: () => DialogTitle,
|
|
60
68
|
Divider: () => Divider,
|
|
61
69
|
Drawer: () => Drawer,
|
|
70
|
+
EmptyState: () => EmptyState,
|
|
62
71
|
Fieldset: () => Fieldset,
|
|
72
|
+
FileUpload: () => FileUpload,
|
|
73
|
+
FilterBar: () => FilterBar,
|
|
63
74
|
Flex: () => Flex,
|
|
64
75
|
FlexItem: () => FlexItem,
|
|
65
76
|
Form: () => Form,
|
|
@@ -80,7 +91,10 @@ __export(index_exports, {
|
|
|
80
91
|
MenuLabel: () => MenuLabel,
|
|
81
92
|
MenuSeparator: () => MenuSeparator,
|
|
82
93
|
MenuTrigger: () => MenuTrigger,
|
|
94
|
+
MetricCard: () => MetricCard,
|
|
95
|
+
PageHeader: () => PageHeader,
|
|
83
96
|
Pagination: () => Pagination,
|
|
97
|
+
PasswordInput: () => PasswordInput,
|
|
84
98
|
Popover: () => Popover,
|
|
85
99
|
PopoverContent: () => PopoverContent,
|
|
86
100
|
PopoverTrigger: () => PopoverTrigger,
|
|
@@ -92,13 +106,17 @@ __export(index_exports, {
|
|
|
92
106
|
RadioGroupItem: () => RadioGroupItem,
|
|
93
107
|
Search: () => Search,
|
|
94
108
|
Select: () => Select,
|
|
109
|
+
SelectMenu: () => SelectMenu,
|
|
95
110
|
Separator: () => Separator,
|
|
111
|
+
Sidebar: () => Sidebar,
|
|
96
112
|
Skeleton: () => Skeleton,
|
|
97
113
|
Spinner: () => Spinner,
|
|
114
|
+
Stepper: () => Stepper,
|
|
98
115
|
Switch: () => Switch,
|
|
99
116
|
Table: () => Table,
|
|
100
117
|
TableBody: () => TableBody,
|
|
101
118
|
TableCaption: () => TableCaption,
|
|
119
|
+
TableCard: () => TableCard,
|
|
102
120
|
TableCell: () => TableCell,
|
|
103
121
|
TableFooter: () => TableFooter,
|
|
104
122
|
TableHead: () => TableHead,
|
|
@@ -110,7 +128,10 @@ __export(index_exports, {
|
|
|
110
128
|
TabsTrigger: () => TabsTrigger,
|
|
111
129
|
Text: () => Text,
|
|
112
130
|
Textarea: () => Textarea,
|
|
131
|
+
TimePicker: () => TimePicker,
|
|
132
|
+
Timeline: () => Timeline,
|
|
113
133
|
ToastProvider: () => ToastProvider,
|
|
134
|
+
Toaster: () => Toaster,
|
|
114
135
|
Tooltip: () => Tooltip,
|
|
115
136
|
alertVariants: () => alertVariants,
|
|
116
137
|
badgeVariants: () => badgeVariants,
|
|
@@ -120,6 +141,7 @@ __export(index_exports, {
|
|
|
120
141
|
resolveGap: () => resolveGap,
|
|
121
142
|
separatorVariants: () => separatorVariants,
|
|
122
143
|
spinnerVariants: () => spinnerVariants,
|
|
144
|
+
toast: () => toast,
|
|
123
145
|
useCombobox: () => useCombobox,
|
|
124
146
|
usePresence: () => usePresence,
|
|
125
147
|
useToast: () => useToast
|
|
@@ -174,11 +196,269 @@ function usePresence(open, animate, exitMs = 200) {
|
|
|
174
196
|
return { present, exiting: present && !open };
|
|
175
197
|
}
|
|
176
198
|
|
|
177
|
-
// src/components/
|
|
199
|
+
// src/components/app-shell/AppShell.tsx
|
|
200
|
+
var React3 = __toESM(require("react"));
|
|
201
|
+
|
|
202
|
+
// src/components/drawer/Drawer.tsx
|
|
178
203
|
var React2 = __toESM(require("react"));
|
|
204
|
+
var import_react_dom = require("react-dom");
|
|
205
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
206
|
+
var FOCUSABLE = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
207
|
+
var sideClasses = {
|
|
208
|
+
right: "inset-y-0 right-0 border-l",
|
|
209
|
+
left: "inset-y-0 left-0 border-r",
|
|
210
|
+
top: "inset-x-0 top-0 border-b",
|
|
211
|
+
bottom: "inset-x-0 bottom-0 border-t"
|
|
212
|
+
};
|
|
213
|
+
var sideWidths = {
|
|
214
|
+
sm: "w-72",
|
|
215
|
+
md: "w-96",
|
|
216
|
+
lg: "w-[32rem]",
|
|
217
|
+
xl: "w-[40rem]",
|
|
218
|
+
"2xl": "w-[48rem]"
|
|
219
|
+
};
|
|
220
|
+
var sideHeights = {
|
|
221
|
+
sm: "h-48",
|
|
222
|
+
md: "h-80",
|
|
223
|
+
lg: "h-[32rem]",
|
|
224
|
+
xl: "h-[40rem]",
|
|
225
|
+
"2xl": "h-[48rem]"
|
|
226
|
+
};
|
|
227
|
+
var sizeClasses = {
|
|
228
|
+
right: sideWidths,
|
|
229
|
+
left: sideWidths,
|
|
230
|
+
top: sideHeights,
|
|
231
|
+
bottom: sideHeights
|
|
232
|
+
};
|
|
233
|
+
function extentStyle(value) {
|
|
234
|
+
if (value === void 0) return void 0;
|
|
235
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
236
|
+
}
|
|
237
|
+
var slideIn = {
|
|
238
|
+
right: "slide-in-from-right",
|
|
239
|
+
left: "slide-in-from-left",
|
|
240
|
+
top: "slide-in-from-top",
|
|
241
|
+
bottom: "slide-in-from-bottom"
|
|
242
|
+
};
|
|
243
|
+
var slideOut = {
|
|
244
|
+
right: "slide-out-to-right",
|
|
245
|
+
left: "slide-out-to-left",
|
|
246
|
+
top: "slide-out-to-top",
|
|
247
|
+
bottom: "slide-out-to-bottom"
|
|
248
|
+
};
|
|
249
|
+
function Drawer({
|
|
250
|
+
open,
|
|
251
|
+
onOpenChange,
|
|
252
|
+
title,
|
|
253
|
+
description,
|
|
254
|
+
children,
|
|
255
|
+
side = "right",
|
|
256
|
+
size = "md",
|
|
257
|
+
width,
|
|
258
|
+
height,
|
|
259
|
+
closeOnBackdrop = true,
|
|
260
|
+
showClose = true,
|
|
261
|
+
initialFocusRef,
|
|
262
|
+
ariaLabel,
|
|
263
|
+
animate = false
|
|
264
|
+
}) {
|
|
265
|
+
const drawerRef = React2.useRef(null);
|
|
266
|
+
const previouslyFocused = React2.useRef(null);
|
|
267
|
+
const titleId = React2.useId();
|
|
268
|
+
const descriptionId = React2.useId();
|
|
269
|
+
const { present, exiting } = usePresence(open, animate);
|
|
270
|
+
React2.useEffect(() => {
|
|
271
|
+
if (open) {
|
|
272
|
+
previouslyFocused.current = document.activeElement;
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
previouslyFocused.current?.focus?.();
|
|
276
|
+
previouslyFocused.current = null;
|
|
277
|
+
}, [open]);
|
|
278
|
+
React2.useEffect(() => {
|
|
279
|
+
if (!open || !present) return;
|
|
280
|
+
const node = drawerRef.current;
|
|
281
|
+
const target = initialFocusRef?.current ?? node?.querySelector(FOCUSABLE) ?? node;
|
|
282
|
+
target?.focus();
|
|
283
|
+
}, [open, present, initialFocusRef]);
|
|
284
|
+
React2.useEffect(() => {
|
|
285
|
+
if (!open) return;
|
|
286
|
+
const onKeyDown = (event) => {
|
|
287
|
+
if (event.key === "Escape") {
|
|
288
|
+
event.stopPropagation();
|
|
289
|
+
onOpenChange(false);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (event.key !== "Tab") return;
|
|
293
|
+
const node = drawerRef.current;
|
|
294
|
+
if (!node) return;
|
|
295
|
+
const focusable = Array.from(node.querySelectorAll(FOCUSABLE));
|
|
296
|
+
if (focusable.length === 0) {
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const first = focusable[0];
|
|
301
|
+
const last = focusable[focusable.length - 1];
|
|
302
|
+
const active = document.activeElement;
|
|
303
|
+
if (event.shiftKey && (active === first || !node.contains(active))) {
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
last.focus();
|
|
306
|
+
} else if (!event.shiftKey && active === last) {
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
first.focus();
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
document.addEventListener("keydown", onKeyDown);
|
|
312
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
313
|
+
}, [open, onOpenChange]);
|
|
314
|
+
if (!present || typeof document === "undefined") return null;
|
|
315
|
+
const isVerticalSide = side === "top" || side === "bottom";
|
|
316
|
+
const customExtent = isVerticalSide ? extentStyle(height) : extentStyle(width);
|
|
317
|
+
const motion = animate ? cn(
|
|
318
|
+
"duration-200 motion-reduce:animate-none",
|
|
319
|
+
exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`
|
|
320
|
+
) : void 0;
|
|
321
|
+
return (0, import_react_dom.createPortal)(
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
className: "fixed inset-0 z-50",
|
|
326
|
+
onMouseDown: (event) => {
|
|
327
|
+
if (closeOnBackdrop && event.target === event.currentTarget) onOpenChange(false);
|
|
328
|
+
},
|
|
329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
330
|
+
"div",
|
|
331
|
+
{
|
|
332
|
+
ref: drawerRef,
|
|
333
|
+
role: "dialog",
|
|
334
|
+
"aria-modal": "true",
|
|
335
|
+
"aria-label": ariaLabel ?? title,
|
|
336
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
337
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
338
|
+
tabIndex: -1,
|
|
339
|
+
className: cn(
|
|
340
|
+
"fixed flex flex-col bg-background shadow-xl border-border",
|
|
341
|
+
sideClasses[side],
|
|
342
|
+
sizeClasses[side][size],
|
|
343
|
+
motion
|
|
344
|
+
),
|
|
345
|
+
style: customExtent ? { [isVerticalSide ? "height" : "width"]: customExtent } : void 0,
|
|
346
|
+
children: [
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start justify-between gap-4 border-b border-border px-5 py-4", children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { id: titleId, className: "text-base font-semibold leading-tight", children: title }),
|
|
350
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id: descriptionId, className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
351
|
+
] }),
|
|
352
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
353
|
+
"button",
|
|
354
|
+
{
|
|
355
|
+
type: "button",
|
|
356
|
+
onClick: () => onOpenChange(false),
|
|
357
|
+
"aria-label": "Close drawer",
|
|
358
|
+
className: "-mr-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
359
|
+
children: "\u2715"
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex-1 overflow-y-auto px-5 py-4", children })
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
document.body
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// src/components/app-shell/AppShell.tsx
|
|
374
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
375
|
+
function Sidebar({
|
|
376
|
+
sections,
|
|
377
|
+
heading,
|
|
378
|
+
footer,
|
|
379
|
+
activeHref,
|
|
380
|
+
linkComponent,
|
|
381
|
+
label = "Primary",
|
|
382
|
+
className,
|
|
383
|
+
...props
|
|
384
|
+
}) {
|
|
385
|
+
const Link = linkComponent ?? "a";
|
|
386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cn("flex h-full min-h-0 flex-col gap-6 p-4", className), ...props, children: [
|
|
387
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "px-2", children: heading }),
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("nav", { "aria-label": label, className: "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto", children: sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
389
|
+
section.title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "mb-1.5 px-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: section.title }),
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "space-y-0.5", children: section.items.map((item) => {
|
|
391
|
+
const active = item.active ?? (activeHref !== void 0 && item.href === activeHref);
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
393
|
+
Link,
|
|
394
|
+
{
|
|
395
|
+
href: item.href,
|
|
396
|
+
"aria-current": active ? "page" : void 0,
|
|
397
|
+
className: cn(
|
|
398
|
+
"flex items-center gap-2.5 rounded-md px-2.5 py-2 text-sm transition-colors",
|
|
399
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
400
|
+
active ? "bg-primary/10 font-medium text-primary" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground"
|
|
401
|
+
),
|
|
402
|
+
children: [
|
|
403
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "shrink-0 [&_svg]:size-4", children: item.icon }),
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
405
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "shrink-0 text-xs", children: item.badge })
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
) }, item.href);
|
|
409
|
+
}) })
|
|
410
|
+
] }, section.title ?? `section-${index}`)) }),
|
|
411
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "border-t border-border pt-4", children: footer })
|
|
412
|
+
] });
|
|
413
|
+
}
|
|
414
|
+
function AppShell({
|
|
415
|
+
sidebar,
|
|
416
|
+
header,
|
|
417
|
+
hideMobileMenu = false,
|
|
418
|
+
sidebarWidth = "w-64",
|
|
419
|
+
className,
|
|
420
|
+
children,
|
|
421
|
+
...props
|
|
422
|
+
}) {
|
|
423
|
+
const [mobileOpen, setMobileOpen] = React3.useState(false);
|
|
424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cn("flex min-h-screen bg-background text-foreground", className), ...props, children: [
|
|
425
|
+
sidebar && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("aside", { className: cn("hidden shrink-0 border-r border-border md:block", sidebarWidth), children: sidebar }),
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
427
|
+
(header || sidebar && !hideMobileMenu) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "sticky top-0 z-30 flex h-14 items-center gap-3 border-b border-border bg-background/80 px-4 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: [
|
|
428
|
+
sidebar && !hideMobileMenu && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
429
|
+
"button",
|
|
430
|
+
{
|
|
431
|
+
type: "button",
|
|
432
|
+
onClick: () => setMobileOpen(true),
|
|
433
|
+
"aria-label": "Open navigation",
|
|
434
|
+
className: "rounded-md border border-border p-2 text-muted-foreground hover:bg-muted md:hidden",
|
|
435
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": "true", children: "\u2630" })
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "min-w-0 flex-1", children: header })
|
|
439
|
+
] }),
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("main", { className: "min-w-0 flex-1", children })
|
|
441
|
+
] }),
|
|
442
|
+
sidebar && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
443
|
+
Drawer,
|
|
444
|
+
{
|
|
445
|
+
open: mobileOpen,
|
|
446
|
+
onOpenChange: setMobileOpen,
|
|
447
|
+
title: "Navigation",
|
|
448
|
+
side: "left",
|
|
449
|
+
size: "sm",
|
|
450
|
+
animate: true,
|
|
451
|
+
children: sidebar
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
] });
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/components/button/Button.tsx
|
|
458
|
+
var React4 = __toESM(require("react"));
|
|
179
459
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
180
460
|
var import_class_variance_authority = require("class-variance-authority");
|
|
181
|
-
var
|
|
461
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
182
462
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
183
463
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
184
464
|
{
|
|
@@ -192,6 +472,12 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
192
472
|
warning: "bg-warning text-warning-foreground hover:bg-warning/90",
|
|
193
473
|
info: "bg-info text-info-foreground hover:bg-info/90",
|
|
194
474
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
475
|
+
// Colored outlines: semantic border + label on the page surface, with
|
|
476
|
+
// a faint tint on hover — mirrors the Alert variant recipe.
|
|
477
|
+
"outline-destructive": "border border-destructive/50 bg-background text-destructive hover:border-destructive hover:bg-destructive/10",
|
|
478
|
+
"outline-success": "border border-success/50 bg-background text-success hover:border-success hover:bg-success/10",
|
|
479
|
+
"outline-warning": "border border-warning/50 bg-background text-warning hover:border-warning hover:bg-warning/10",
|
|
480
|
+
"outline-info": "border border-info/50 bg-background text-info hover:border-info hover:bg-info/10",
|
|
195
481
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
196
482
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
197
483
|
link: "text-primary underline-offset-4 hover:underline"
|
|
@@ -209,10 +495,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
209
495
|
}
|
|
210
496
|
}
|
|
211
497
|
);
|
|
212
|
-
var Button =
|
|
498
|
+
var Button = React4.forwardRef(
|
|
213
499
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
214
500
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
215
|
-
return /* @__PURE__ */ (0,
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
216
502
|
Comp,
|
|
217
503
|
{
|
|
218
504
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -225,19 +511,22 @@ var Button = React2.forwardRef(
|
|
|
225
511
|
Button.displayName = "Button";
|
|
226
512
|
|
|
227
513
|
// src/components/button-group/ButtonGroup.tsx
|
|
228
|
-
var
|
|
229
|
-
var
|
|
230
|
-
var ButtonGroup =
|
|
231
|
-
({ orientation = "horizontal", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
514
|
+
var React5 = __toESM(require("react"));
|
|
515
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
516
|
+
var ButtonGroup = React5.forwardRef(
|
|
517
|
+
({ orientation = "horizontal", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
232
518
|
"div",
|
|
233
519
|
{
|
|
234
520
|
ref,
|
|
235
521
|
"data-slot": "button-group",
|
|
236
522
|
role: "group",
|
|
237
523
|
className: cn(
|
|
238
|
-
"inline-flex",
|
|
239
|
-
|
|
240
|
-
"[
|
|
524
|
+
"inline-flex overflow-hidden rounded-md border border-border bg-background",
|
|
525
|
+
"[&>*]:rounded-none [&>*]:border-0",
|
|
526
|
+
"[&>*:focus-visible]:ring-inset [&>*:focus-visible]:ring-offset-0",
|
|
527
|
+
// divide-* compiles to `.group > * ~ * { border-left/top }` — higher
|
|
528
|
+
// specificity than the lead-strip above, so seams stay exact.
|
|
529
|
+
orientation === "horizontal" ? "divide-x divide-border" : "flex-col divide-y divide-border",
|
|
241
530
|
className
|
|
242
531
|
),
|
|
243
532
|
...props
|
|
@@ -247,11 +536,11 @@ var ButtonGroup = React3.forwardRef(
|
|
|
247
536
|
ButtonGroup.displayName = "ButtonGroup";
|
|
248
537
|
|
|
249
538
|
// src/components/input/Input.tsx
|
|
250
|
-
var
|
|
251
|
-
var
|
|
252
|
-
var Input =
|
|
539
|
+
var React6 = __toESM(require("react"));
|
|
540
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
541
|
+
var Input = React6.forwardRef(
|
|
253
542
|
({ className, type, ...props }, ref) => {
|
|
254
|
-
return /* @__PURE__ */ (0,
|
|
543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
255
544
|
"input",
|
|
256
545
|
{
|
|
257
546
|
type,
|
|
@@ -272,13 +561,13 @@ var Input = React4.forwardRef(
|
|
|
272
561
|
Input.displayName = "Input";
|
|
273
562
|
|
|
274
563
|
// src/components/input-group/InputGroup.tsx
|
|
275
|
-
var
|
|
564
|
+
var React9 = __toESM(require("react"));
|
|
276
565
|
|
|
277
566
|
// src/components/textarea/Textarea.tsx
|
|
278
|
-
var
|
|
279
|
-
var
|
|
280
|
-
var Textarea =
|
|
281
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
567
|
+
var React7 = __toESM(require("react"));
|
|
568
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
569
|
+
var Textarea = React7.forwardRef(
|
|
570
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
282
571
|
"textarea",
|
|
283
572
|
{
|
|
284
573
|
ref,
|
|
@@ -296,47 +585,61 @@ var Textarea = React5.forwardRef(
|
|
|
296
585
|
Textarea.displayName = "Textarea";
|
|
297
586
|
|
|
298
587
|
// src/components/select/Select.tsx
|
|
299
|
-
var
|
|
300
|
-
var
|
|
301
|
-
var Select =
|
|
302
|
-
const generatedId =
|
|
588
|
+
var React8 = __toESM(require("react"));
|
|
589
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
590
|
+
var Select = React8.forwardRef(function Select2({ options, groups, label, placeholder, multiple = false, value, defaultValue, onChange, id, className, ...props }, ref) {
|
|
591
|
+
const generatedId = React8.useId();
|
|
303
592
|
const selectId = id ?? generatedId;
|
|
304
593
|
const labelId = `${selectId}-label`;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
/* @__PURE__ */ (0,
|
|
594
|
+
const renderOption = (option) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value);
|
|
595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
596
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { id: labelId, htmlFor: selectId, className: "text-sm font-medium", children: label }),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
308
598
|
"select",
|
|
309
599
|
{
|
|
310
600
|
ref,
|
|
311
601
|
id: selectId,
|
|
602
|
+
multiple,
|
|
312
603
|
"aria-labelledby": label ? labelId : void 0,
|
|
313
604
|
className: cn(
|
|
314
605
|
"rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
606
|
+
multiple && "min-h-32",
|
|
315
607
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
608
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
316
609
|
className
|
|
317
610
|
),
|
|
318
611
|
value,
|
|
319
612
|
defaultValue,
|
|
320
|
-
onChange: (event) =>
|
|
613
|
+
onChange: (event) => {
|
|
614
|
+
if (!onChange) return;
|
|
615
|
+
if (multiple) {
|
|
616
|
+
onChange(Array.from(event.target.selectedOptions, (option) => option.value));
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
onChange(event.target.value);
|
|
620
|
+
},
|
|
321
621
|
...props,
|
|
322
|
-
children:
|
|
622
|
+
children: [
|
|
623
|
+
placeholder && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", disabled: true, children: placeholder }),
|
|
624
|
+
groups ? groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("optgroup", { label: group.label, children: group.options.map(renderOption) }, group.label)) : (options ?? []).map(renderOption)
|
|
625
|
+
]
|
|
323
626
|
}
|
|
324
627
|
)
|
|
325
628
|
] });
|
|
326
629
|
});
|
|
327
630
|
|
|
328
631
|
// src/components/input-group/InputGroup.tsx
|
|
329
|
-
var
|
|
330
|
-
var isNestedField = (child) =>
|
|
331
|
-
var InputGroup =
|
|
632
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
633
|
+
var isNestedField = (child) => React9.isValidElement(child) && (child.type === Input || child.type === Textarea || child.type === Select);
|
|
634
|
+
var InputGroup = React9.forwardRef(
|
|
332
635
|
({ id, "aria-describedby": describedBy, "aria-invalid": invalid, className, children, ...props }, ref) => {
|
|
333
636
|
let wiredChildren = children;
|
|
334
637
|
if (id !== void 0 || describedBy !== void 0 || invalid !== void 0) {
|
|
335
|
-
const items =
|
|
638
|
+
const items = React9.Children.toArray(children);
|
|
336
639
|
const fieldIndex = items.findIndex(isNestedField);
|
|
337
640
|
if (fieldIndex !== -1) {
|
|
338
641
|
const field = items[fieldIndex];
|
|
339
|
-
items[fieldIndex] = isNestedField(field) ?
|
|
642
|
+
items[fieldIndex] = isNestedField(field) ? React9.cloneElement(field, {
|
|
340
643
|
...id !== void 0 && { id },
|
|
341
644
|
...describedBy !== void 0 && { "aria-describedby": describedBy },
|
|
342
645
|
...invalid !== void 0 && { "aria-invalid": invalid }
|
|
@@ -351,7 +654,7 @@ var InputGroup = React7.forwardRef(
|
|
|
351
654
|
};
|
|
352
655
|
}
|
|
353
656
|
}
|
|
354
|
-
return /* @__PURE__ */ (0,
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
355
658
|
"div",
|
|
356
659
|
{
|
|
357
660
|
ref,
|
|
@@ -359,12 +662,15 @@ var InputGroup = React7.forwardRef(
|
|
|
359
662
|
className: cn(
|
|
360
663
|
"flex h-10 w-full items-center overflow-hidden rounded-md border border-input bg-background",
|
|
361
664
|
"ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
362
|
-
// The group is the
|
|
363
|
-
//
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
"[&
|
|
665
|
+
// The group's outline is the only outline: force-strip every
|
|
666
|
+
// nested field's border, radius, ring, shadow and UA focus outline.
|
|
667
|
+
// Important flags defeat both the component's own utilities
|
|
668
|
+
// (Input ships `border` + `focus-visible:ring-2`) and browser
|
|
669
|
+
// defaults — no seams appear where an addon sits flush.
|
|
670
|
+
"[&_input]:h-full [&_input]:min-w-0 [&_input]:flex-1 [&_input]:rounded-none [&_input]:px-3 [&_input]:py-2",
|
|
671
|
+
"[&_input]:!border-0 [&_input]:!bg-transparent [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&_input]:!ring-offset-0",
|
|
672
|
+
"[&_textarea]:!border-0 [&_textarea]:!rounded-none [&_textarea]:!bg-transparent [&_textarea]:!shadow-none [&_textarea]:!outline-none [&_textarea]:!ring-0 [&_textarea]:!ring-offset-0",
|
|
673
|
+
"[&_select]:!border-0 [&_select]:!rounded-none [&_select]:!bg-transparent [&_select]:!shadow-none [&_select]:!outline-none [&_select]:!ring-0 [&_select]:!ring-offset-0",
|
|
368
674
|
"[&_input:disabled]:cursor-not-allowed",
|
|
369
675
|
className
|
|
370
676
|
),
|
|
@@ -375,8 +681,8 @@ var InputGroup = React7.forwardRef(
|
|
|
375
681
|
}
|
|
376
682
|
);
|
|
377
683
|
InputGroup.displayName = "InputGroup";
|
|
378
|
-
var InputGroupAddon =
|
|
379
|
-
({ side = "left", variant = "ghost", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
684
|
+
var InputGroupAddon = React9.forwardRef(
|
|
685
|
+
({ side = "left", variant = "ghost", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
380
686
|
"div",
|
|
381
687
|
{
|
|
382
688
|
ref,
|
|
@@ -394,9 +700,10 @@ var InputGroupAddon = React7.forwardRef(
|
|
|
394
700
|
InputGroupAddon.displayName = "InputGroupAddon";
|
|
395
701
|
|
|
396
702
|
// src/components/badge/Badge.tsx
|
|
397
|
-
var
|
|
703
|
+
var React10 = __toESM(require("react"));
|
|
704
|
+
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
398
705
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
399
|
-
var
|
|
706
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
400
707
|
var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
401
708
|
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
402
709
|
{
|
|
@@ -413,16 +720,19 @@ var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
|
413
720
|
}
|
|
414
721
|
}
|
|
415
722
|
);
|
|
416
|
-
var Badge =
|
|
417
|
-
({ className, variant, ...props }, ref) =>
|
|
723
|
+
var Badge = React10.forwardRef(
|
|
724
|
+
({ className, variant, asChild = false, ...props }, ref) => {
|
|
725
|
+
const Comp = asChild ? import_react_slot2.Slot : "div";
|
|
726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Comp, { ref, className: cn(badgeVariants({ variant }), className), ...props });
|
|
727
|
+
}
|
|
418
728
|
);
|
|
419
729
|
Badge.displayName = "Badge";
|
|
420
730
|
|
|
421
731
|
// src/components/avatar/Avatar.tsx
|
|
422
|
-
var
|
|
732
|
+
var React11 = __toESM(require("react"));
|
|
423
733
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
424
|
-
var
|
|
425
|
-
var Avatar =
|
|
734
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
735
|
+
var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
426
736
|
AvatarPrimitive.Root,
|
|
427
737
|
{
|
|
428
738
|
ref,
|
|
@@ -434,7 +744,7 @@ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
434
744
|
}
|
|
435
745
|
));
|
|
436
746
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
437
|
-
var AvatarImage =
|
|
747
|
+
var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
438
748
|
AvatarPrimitive.Image,
|
|
439
749
|
{
|
|
440
750
|
ref,
|
|
@@ -443,7 +753,7 @@ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
443
753
|
}
|
|
444
754
|
));
|
|
445
755
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
446
|
-
var AvatarFallback =
|
|
756
|
+
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
447
757
|
AvatarPrimitive.Fallback,
|
|
448
758
|
{
|
|
449
759
|
ref,
|
|
@@ -458,7 +768,7 @@ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
|
458
768
|
|
|
459
769
|
// src/components/spinner/Spinner.tsx
|
|
460
770
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
461
|
-
var
|
|
771
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
462
772
|
var spinnerVariants = (0, import_class_variance_authority3.cva)(
|
|
463
773
|
"inline-block animate-spin rounded-full border-2 border-current border-t-transparent text-muted-foreground motion-reduce:animate-none",
|
|
464
774
|
{
|
|
@@ -475,83 +785,83 @@ var spinnerVariants = (0, import_class_variance_authority3.cva)(
|
|
|
475
785
|
}
|
|
476
786
|
);
|
|
477
787
|
function Spinner({ className, size, label = "Loading...", ...props }) {
|
|
478
|
-
return /* @__PURE__ */ (0,
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
479
789
|
"span",
|
|
480
790
|
{
|
|
481
791
|
role: "status",
|
|
482
792
|
className: cn(spinnerVariants({ size }), className),
|
|
483
793
|
...props,
|
|
484
|
-
children: /* @__PURE__ */ (0,
|
|
794
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: label })
|
|
485
795
|
}
|
|
486
796
|
);
|
|
487
797
|
}
|
|
488
798
|
|
|
489
799
|
// src/components/toast/Toast.tsx
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
var ToastContext =
|
|
800
|
+
var React12 = __toESM(require("react"));
|
|
801
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
802
|
+
var ToastContext = React12.createContext(null);
|
|
493
803
|
var DEFAULT_DURATION = 5e3;
|
|
494
804
|
function ToastProvider({ children, label = "Notifications" }) {
|
|
495
|
-
const [
|
|
496
|
-
const
|
|
497
|
-
const
|
|
498
|
-
const timer =
|
|
805
|
+
const [toasts2, setToasts] = React12.useState([]);
|
|
806
|
+
const timers2 = React12.useRef(/* @__PURE__ */ new Map());
|
|
807
|
+
const dismiss2 = React12.useCallback((id) => {
|
|
808
|
+
const timer = timers2.current.get(id);
|
|
499
809
|
if (timer) {
|
|
500
810
|
clearTimeout(timer);
|
|
501
|
-
|
|
811
|
+
timers2.current.delete(id);
|
|
502
812
|
}
|
|
503
813
|
setToasts((current) => current.filter((entry) => entry.id !== id));
|
|
504
814
|
}, []);
|
|
505
|
-
const
|
|
815
|
+
const toast2 = React12.useCallback(
|
|
506
816
|
(options) => {
|
|
507
817
|
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
508
818
|
setToasts((current) => [...current, { ...options, id }]);
|
|
509
819
|
const duration = options.duration ?? DEFAULT_DURATION;
|
|
510
820
|
if (duration > 0) {
|
|
511
|
-
|
|
821
|
+
timers2.current.set(
|
|
512
822
|
id,
|
|
513
|
-
setTimeout(() =>
|
|
823
|
+
setTimeout(() => dismiss2(id), duration)
|
|
514
824
|
);
|
|
515
825
|
}
|
|
516
826
|
return id;
|
|
517
827
|
},
|
|
518
|
-
[
|
|
828
|
+
[dismiss2]
|
|
519
829
|
);
|
|
520
|
-
|
|
521
|
-
const pending =
|
|
830
|
+
React12.useEffect(() => {
|
|
831
|
+
const pending = timers2.current;
|
|
522
832
|
return () => {
|
|
523
833
|
for (const timer of pending.values()) clearTimeout(timer);
|
|
524
834
|
pending.clear();
|
|
525
835
|
};
|
|
526
836
|
}, []);
|
|
527
|
-
const value =
|
|
528
|
-
return /* @__PURE__ */ (0,
|
|
837
|
+
const value = React12.useMemo(() => ({ toasts: toasts2, toast: toast2, dismiss: dismiss2 }), [toasts2, toast2, dismiss2]);
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(ToastContext.Provider, { value, children: [
|
|
529
839
|
children,
|
|
530
|
-
/* @__PURE__ */ (0,
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToastRegion, { toasts: toasts2, onDismiss: dismiss2, label })
|
|
531
841
|
] });
|
|
532
842
|
}
|
|
533
843
|
function useToast() {
|
|
534
|
-
const context =
|
|
844
|
+
const context = React12.useContext(ToastContext);
|
|
535
845
|
if (!context) throw new Error("useToast must be used within a <ToastProvider>.");
|
|
536
846
|
return context;
|
|
537
847
|
}
|
|
538
848
|
function ToastRegion({
|
|
539
|
-
toasts,
|
|
849
|
+
toasts: toasts2,
|
|
540
850
|
onDismiss,
|
|
541
851
|
label
|
|
542
852
|
}) {
|
|
543
|
-
return /* @__PURE__ */ (0,
|
|
853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
544
854
|
"ol",
|
|
545
855
|
{
|
|
546
856
|
"aria-label": label,
|
|
547
857
|
className: "fixed bottom-4 right-4 z-50 flex w-full max-w-sm flex-col gap-2",
|
|
548
|
-
children:
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
550
|
-
/* @__PURE__ */ (0,
|
|
551
|
-
/* @__PURE__ */ (0,
|
|
552
|
-
entry.description && /* @__PURE__ */ (0,
|
|
858
|
+
children: toasts2.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: "rounded-lg border border-border bg-card p-4 shadow-lg", children: [
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { role: "status", className: "flex items-start justify-between gap-3", children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm font-semibold", children: entry.title }),
|
|
862
|
+
entry.description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: entry.description })
|
|
553
863
|
] }),
|
|
554
|
-
/* @__PURE__ */ (0,
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
555
865
|
"button",
|
|
556
866
|
{
|
|
557
867
|
type: "button",
|
|
@@ -562,7 +872,7 @@ function ToastRegion({
|
|
|
562
872
|
}
|
|
563
873
|
)
|
|
564
874
|
] }),
|
|
565
|
-
entry.action && /* @__PURE__ */ (0,
|
|
875
|
+
entry.action && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
566
876
|
"button",
|
|
567
877
|
{
|
|
568
878
|
type: "button",
|
|
@@ -579,165 +889,200 @@ function ToastRegion({
|
|
|
579
889
|
);
|
|
580
890
|
}
|
|
581
891
|
|
|
582
|
-
// src/components/
|
|
583
|
-
var
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
var
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
892
|
+
// src/components/toast/Toaster.tsx
|
|
893
|
+
var React13 = __toESM(require("react"));
|
|
894
|
+
|
|
895
|
+
// src/components/toast/toast-store.ts
|
|
896
|
+
var DEFAULT_DURATION2 = 5e3;
|
|
897
|
+
var toasts = [];
|
|
898
|
+
var EMPTY = [];
|
|
899
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
900
|
+
var timers = /* @__PURE__ */ new Map();
|
|
901
|
+
function emit() {
|
|
902
|
+
for (const listener of listeners) listener(toasts);
|
|
903
|
+
}
|
|
904
|
+
function dismiss(id) {
|
|
905
|
+
const timer = timers.get(id);
|
|
906
|
+
if (timer) {
|
|
907
|
+
clearTimeout(timer);
|
|
908
|
+
timers.delete(id);
|
|
909
|
+
}
|
|
910
|
+
toasts = toasts.filter((entry) => entry.id !== id);
|
|
911
|
+
emit();
|
|
912
|
+
}
|
|
913
|
+
function show(options) {
|
|
914
|
+
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
915
|
+
toasts = [...toasts, { ...options, id }];
|
|
916
|
+
emit();
|
|
917
|
+
const duration = options.duration ?? DEFAULT_DURATION2;
|
|
918
|
+
if (duration > 0) {
|
|
919
|
+
timers.set(
|
|
920
|
+
id,
|
|
921
|
+
setTimeout(() => dismiss(id), duration)
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
return id;
|
|
925
|
+
}
|
|
926
|
+
var toast = Object.assign(
|
|
927
|
+
(options) => show({ ...options, variant: options.variant ?? "default" }),
|
|
928
|
+
{
|
|
929
|
+
success: (title, description) => show({ title, description, variant: "success" }),
|
|
930
|
+
error: (title, description) => show({ title, description, variant: "error" }),
|
|
931
|
+
warning: (title, description) => show({ title, description, variant: "warning" }),
|
|
932
|
+
info: (title, description) => show({ title, description, variant: "info" }),
|
|
933
|
+
dismiss: (id) => {
|
|
934
|
+
if (id) {
|
|
935
|
+
dismiss(id);
|
|
623
936
|
return;
|
|
624
937
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
938
|
+
for (const entry of [...toasts]) dismiss(entry.id);
|
|
939
|
+
},
|
|
940
|
+
clear: () => {
|
|
941
|
+
for (const entry of [...toasts]) dismiss(entry.id);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
);
|
|
945
|
+
function subscribeToToasts(listener) {
|
|
946
|
+
listeners.add(listener);
|
|
947
|
+
return () => listeners.delete(listener);
|
|
948
|
+
}
|
|
949
|
+
function getToastSnapshot() {
|
|
950
|
+
return toasts;
|
|
951
|
+
}
|
|
952
|
+
function getToastServerSnapshot() {
|
|
953
|
+
return EMPTY;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
// src/components/toast/Toaster.tsx
|
|
957
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
958
|
+
var positionClasses = {
|
|
959
|
+
"top-left": "left-4 top-4 items-start",
|
|
960
|
+
"top-center": "left-1/2 top-4 -translate-x-1/2 items-center",
|
|
961
|
+
"top-right": "right-4 top-4 items-end",
|
|
962
|
+
"bottom-left": "bottom-4 left-4 items-start",
|
|
963
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center",
|
|
964
|
+
"bottom-right": "bottom-4 right-4 items-end"
|
|
965
|
+
};
|
|
966
|
+
var richClasses = {
|
|
967
|
+
default: "border-border bg-card",
|
|
968
|
+
success: "border-success/50 bg-success/10",
|
|
969
|
+
error: "border-destructive/50 bg-destructive/10",
|
|
970
|
+
warning: "border-warning/50 bg-warning/10",
|
|
971
|
+
info: "border-info/50 bg-info/10"
|
|
972
|
+
};
|
|
973
|
+
var dotClasses = {
|
|
974
|
+
default: "bg-muted-foreground",
|
|
975
|
+
success: "bg-success",
|
|
976
|
+
error: "bg-destructive",
|
|
977
|
+
warning: "bg-warning",
|
|
978
|
+
info: "bg-info"
|
|
979
|
+
};
|
|
980
|
+
function Toaster({ position = "bottom-right", label = "Notifications", richColors = false }) {
|
|
981
|
+
const entries = React13.useSyncExternalStore(subscribeToToasts, getToastSnapshot, getToastServerSnapshot);
|
|
982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
983
|
+
"ol",
|
|
984
|
+
{
|
|
985
|
+
"aria-label": label,
|
|
986
|
+
className: cn("fixed z-[60] flex w-full max-w-sm flex-col gap-2", positionClasses[position]),
|
|
987
|
+
children: entries.map((entry) => {
|
|
988
|
+
const variant = entry.variant ?? "default";
|
|
989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
990
|
+
"li",
|
|
659
991
|
{
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
"
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
/* @__PURE__ */ (0,
|
|
670
|
-
showClose && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
992
|
+
className: cn(
|
|
993
|
+
"rounded-lg border p-4 shadow-lg",
|
|
994
|
+
richColors ? richClasses[variant] : "border-border bg-card"
|
|
995
|
+
),
|
|
996
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { role: "status", className: "flex items-start gap-3", children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", className: cn("mt-1 h-2 w-2 shrink-0 rounded-full", dotClasses[variant]) }),
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-sm font-semibold", children: entry.title }),
|
|
1000
|
+
entry.description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: entry.description }),
|
|
1001
|
+
entry.action && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
671
1002
|
"button",
|
|
672
1003
|
{
|
|
673
1004
|
type: "button",
|
|
674
|
-
onClick: () =>
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
1005
|
+
onClick: () => {
|
|
1006
|
+
entry.action?.onClick();
|
|
1007
|
+
toast.dismiss(entry.id);
|
|
1008
|
+
},
|
|
1009
|
+
className: "mt-2 text-sm font-medium text-primary hover:underline",
|
|
1010
|
+
children: entry.action.label
|
|
678
1011
|
}
|
|
679
1012
|
)
|
|
680
1013
|
] }),
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1015
|
+
"button",
|
|
1016
|
+
{
|
|
1017
|
+
type: "button",
|
|
1018
|
+
onClick: () => toast.dismiss(entry.id),
|
|
1019
|
+
"aria-label": `Dismiss ${entry.title}`,
|
|
1020
|
+
className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1021
|
+
children: "\u2715"
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
] })
|
|
1025
|
+
},
|
|
1026
|
+
entry.id
|
|
1027
|
+
);
|
|
1028
|
+
})
|
|
1029
|
+
}
|
|
689
1030
|
);
|
|
690
1031
|
}
|
|
691
1032
|
|
|
692
|
-
// src/components/
|
|
693
|
-
var
|
|
1033
|
+
// src/components/dialog/Dialog.tsx
|
|
1034
|
+
var React14 = __toESM(require("react"));
|
|
694
1035
|
var import_react_dom2 = require("react-dom");
|
|
695
|
-
var
|
|
1036
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
696
1037
|
var FOCUSABLE2 = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
697
|
-
var
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
var sizeClasses = {
|
|
704
|
-
right: { sm: "w-72", md: "w-96", lg: "w-[32rem]" },
|
|
705
|
-
left: { sm: "w-72", md: "w-96", lg: "w-[32rem]" },
|
|
706
|
-
top: { sm: "h-48", md: "h-80", lg: "h-[32rem]" },
|
|
707
|
-
bottom: { sm: "h-48", md: "h-80", lg: "h-[32rem]" }
|
|
708
|
-
};
|
|
709
|
-
var slideIn = {
|
|
710
|
-
right: "slide-in-from-right",
|
|
711
|
-
left: "slide-in-from-left",
|
|
712
|
-
top: "slide-in-from-top",
|
|
713
|
-
bottom: "slide-in-from-bottom"
|
|
714
|
-
};
|
|
715
|
-
var slideOut = {
|
|
716
|
-
right: "slide-out-to-right",
|
|
717
|
-
left: "slide-out-to-left",
|
|
718
|
-
top: "slide-out-to-top",
|
|
719
|
-
bottom: "slide-out-to-bottom"
|
|
1038
|
+
var sizeClasses2 = {
|
|
1039
|
+
sm: "max-w-sm",
|
|
1040
|
+
md: "max-w-md",
|
|
1041
|
+
lg: "max-w-lg",
|
|
1042
|
+
xl: "max-w-xl",
|
|
1043
|
+
"2xl": "max-w-2xl"
|
|
720
1044
|
};
|
|
721
|
-
|
|
1045
|
+
var DialogIdsContext = React14.createContext(null);
|
|
1046
|
+
function DialogHeader({ className, ...props }) {
|
|
1047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("flex items-start justify-between gap-4", className), ...props });
|
|
1048
|
+
}
|
|
1049
|
+
function DialogTitle({ className, ...props }) {
|
|
1050
|
+
const ids = React14.useContext(DialogIdsContext);
|
|
1051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { id: ids?.titleId, className: cn("text-lg font-semibold", className), ...props });
|
|
1052
|
+
}
|
|
1053
|
+
function DialogDescription({ className, ...props }) {
|
|
1054
|
+
const ids = React14.useContext(DialogIdsContext);
|
|
1055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { id: ids?.descriptionId, className: cn("mt-2 text-sm text-muted-foreground", className), ...props });
|
|
1056
|
+
}
|
|
1057
|
+
function DialogBody({ className, ...props }) {
|
|
1058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("mt-4", className), ...props });
|
|
1059
|
+
}
|
|
1060
|
+
function DialogFooter({ className, ...props }) {
|
|
1061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("mt-6 flex items-center justify-end gap-2", className), ...props });
|
|
1062
|
+
}
|
|
1063
|
+
function Dialog({
|
|
722
1064
|
open,
|
|
723
1065
|
onOpenChange,
|
|
724
1066
|
title,
|
|
725
1067
|
description,
|
|
726
1068
|
children,
|
|
727
|
-
side = "right",
|
|
728
1069
|
size = "md",
|
|
1070
|
+
header,
|
|
1071
|
+
footer,
|
|
1072
|
+
scrollable = false,
|
|
1073
|
+
bodyClassName,
|
|
729
1074
|
closeOnBackdrop = true,
|
|
730
1075
|
showClose = true,
|
|
731
1076
|
initialFocusRef,
|
|
732
1077
|
ariaLabel,
|
|
733
1078
|
animate = false
|
|
734
1079
|
}) {
|
|
735
|
-
const
|
|
736
|
-
const previouslyFocused =
|
|
737
|
-
const titleId =
|
|
738
|
-
const descriptionId =
|
|
1080
|
+
const dialogRef = React14.useRef(null);
|
|
1081
|
+
const previouslyFocused = React14.useRef(null);
|
|
1082
|
+
const titleId = React14.useId();
|
|
1083
|
+
const descriptionId = React14.useId();
|
|
739
1084
|
const { present, exiting } = usePresence(open, animate);
|
|
740
|
-
|
|
1085
|
+
React14.useEffect(() => {
|
|
741
1086
|
if (open) {
|
|
742
1087
|
previouslyFocused.current = document.activeElement;
|
|
743
1088
|
return;
|
|
@@ -745,13 +1090,13 @@ function Drawer({
|
|
|
745
1090
|
previouslyFocused.current?.focus?.();
|
|
746
1091
|
previouslyFocused.current = null;
|
|
747
1092
|
}, [open]);
|
|
748
|
-
|
|
1093
|
+
React14.useEffect(() => {
|
|
749
1094
|
if (!open || !present) return;
|
|
750
|
-
const node =
|
|
1095
|
+
const node = dialogRef.current;
|
|
751
1096
|
const target = initialFocusRef?.current ?? node?.querySelector(FOCUSABLE2) ?? node;
|
|
752
1097
|
target?.focus();
|
|
753
1098
|
}, [open, present, initialFocusRef]);
|
|
754
|
-
|
|
1099
|
+
React14.useEffect(() => {
|
|
755
1100
|
if (!open) return;
|
|
756
1101
|
const onKeyDown = (event) => {
|
|
757
1102
|
if (event.key === "Escape") {
|
|
@@ -760,17 +1105,14 @@ function Drawer({
|
|
|
760
1105
|
return;
|
|
761
1106
|
}
|
|
762
1107
|
if (event.key !== "Tab") return;
|
|
763
|
-
const node =
|
|
764
|
-
if (!node) return;
|
|
765
|
-
const focusable = Array.from(node.querySelectorAll(FOCUSABLE2));
|
|
766
|
-
if (focusable.length === 0)
|
|
767
|
-
event.preventDefault();
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
1108
|
+
const node = dialogRef.current;
|
|
1109
|
+
if (!node) return;
|
|
1110
|
+
const focusable = Array.from(node.querySelectorAll(FOCUSABLE2));
|
|
1111
|
+
if (focusable.length === 0) return;
|
|
770
1112
|
const first = focusable[0];
|
|
771
1113
|
const last = focusable[focusable.length - 1];
|
|
772
1114
|
const active = document.activeElement;
|
|
773
|
-
if (event.shiftKey && (active === first ||
|
|
1115
|
+
if (event.shiftKey && (active === first || active === node)) {
|
|
774
1116
|
event.preventDefault();
|
|
775
1117
|
last.focus();
|
|
776
1118
|
} else if (!event.shiftKey && active === last) {
|
|
@@ -778,57 +1120,67 @@ function Drawer({
|
|
|
778
1120
|
first.focus();
|
|
779
1121
|
}
|
|
780
1122
|
};
|
|
781
|
-
document.addEventListener("keydown", onKeyDown);
|
|
782
|
-
return () => document.removeEventListener("keydown", onKeyDown);
|
|
1123
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
1124
|
+
return () => document.removeEventListener("keydown", onKeyDown, true);
|
|
783
1125
|
}, [open, onOpenChange]);
|
|
784
1126
|
if (!present || typeof document === "undefined") return null;
|
|
785
1127
|
const motion = animate ? cn(
|
|
786
1128
|
"duration-200 motion-reduce:animate-none",
|
|
787
|
-
exiting ?
|
|
1129
|
+
exiting ? "animate-out fade-out-0 zoom-out-95" : "animate-in fade-in-0 zoom-in-95"
|
|
788
1130
|
) : void 0;
|
|
789
1131
|
return (0, import_react_dom2.createPortal)(
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
791
1133
|
"div",
|
|
792
1134
|
{
|
|
793
|
-
className: "fixed inset-0 z-50",
|
|
1135
|
+
className: cn("fixed inset-0 z-50 flex items-center justify-center bg-background/80 p-4", motion),
|
|
794
1136
|
onMouseDown: (event) => {
|
|
795
1137
|
if (closeOnBackdrop && event.target === event.currentTarget) onOpenChange(false);
|
|
796
1138
|
},
|
|
797
|
-
children: /* @__PURE__ */ (0,
|
|
1139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
798
1140
|
"div",
|
|
799
1141
|
{
|
|
800
|
-
ref:
|
|
1142
|
+
ref: dialogRef,
|
|
801
1143
|
role: "dialog",
|
|
802
1144
|
"aria-modal": "true",
|
|
803
|
-
"aria-
|
|
804
|
-
"aria-
|
|
1145
|
+
"aria-labelledby": ariaLabel ? void 0 : titleId,
|
|
1146
|
+
"aria-label": ariaLabel,
|
|
805
1147
|
"aria-describedby": description ? descriptionId : void 0,
|
|
806
1148
|
tabIndex: -1,
|
|
807
1149
|
className: cn(
|
|
808
|
-
"
|
|
809
|
-
|
|
810
|
-
sizeClasses[side][size],
|
|
1150
|
+
"flex w-full flex-col rounded-xl border border-border bg-card p-6 shadow-xl",
|
|
1151
|
+
sizeClasses2[size],
|
|
811
1152
|
motion
|
|
812
1153
|
),
|
|
813
|
-
children: [
|
|
814
|
-
/* @__PURE__ */ (0,
|
|
815
|
-
/* @__PURE__ */ (0,
|
|
816
|
-
/* @__PURE__ */ (0,
|
|
817
|
-
description && /* @__PURE__ */ (0,
|
|
1154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogIdsContext.Provider, { value: { titleId, descriptionId }, children: [
|
|
1155
|
+
header ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogHeader, { children: [
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "min-w-0", children: [
|
|
1157
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogTitle, { children: title }),
|
|
1158
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogDescription, { children: description })
|
|
818
1159
|
] }),
|
|
819
|
-
showClose && /* @__PURE__ */ (0,
|
|
1160
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
820
1161
|
"button",
|
|
821
1162
|
{
|
|
822
1163
|
type: "button",
|
|
823
1164
|
onClick: () => onOpenChange(false),
|
|
824
|
-
"aria-label": "Close
|
|
825
|
-
className: "
|
|
1165
|
+
"aria-label": "Close dialog",
|
|
1166
|
+
className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
826
1167
|
children: "\u2715"
|
|
827
1168
|
}
|
|
828
1169
|
)
|
|
829
1170
|
] }),
|
|
830
|
-
/* @__PURE__ */ (0,
|
|
831
|
-
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1172
|
+
"div",
|
|
1173
|
+
{
|
|
1174
|
+
className: cn(
|
|
1175
|
+
"mt-4 min-h-0",
|
|
1176
|
+
scrollable && "max-h-[60vh] overflow-y-auto pr-1",
|
|
1177
|
+
bodyClassName
|
|
1178
|
+
),
|
|
1179
|
+
children
|
|
1180
|
+
}
|
|
1181
|
+
),
|
|
1182
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogFooter, { children: footer })
|
|
1183
|
+
] })
|
|
832
1184
|
}
|
|
833
1185
|
)
|
|
834
1186
|
}
|
|
@@ -837,12 +1189,308 @@ function Drawer({
|
|
|
837
1189
|
);
|
|
838
1190
|
}
|
|
839
1191
|
|
|
840
|
-
// src/components/
|
|
841
|
-
var
|
|
1192
|
+
// src/components/table-card/TableCard.tsx
|
|
1193
|
+
var React15 = __toESM(require("react"));
|
|
1194
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1195
|
+
var TableCard = React15.forwardRef(function TableCard2({ title, description, actions, toolbar, children, footer, flush = true, className, ...props }, ref) {
|
|
1196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1197
|
+
"div",
|
|
1198
|
+
{
|
|
1199
|
+
ref,
|
|
1200
|
+
className: cn("overflow-hidden rounded-xl border border-border bg-card text-card-foreground", className),
|
|
1201
|
+
...props,
|
|
1202
|
+
children: [
|
|
1203
|
+
(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "min-w-0", children: [
|
|
1205
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { className: "text-sm font-semibold", children: title }),
|
|
1206
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-0.5 text-sm text-muted-foreground", children: description })
|
|
1207
|
+
] }),
|
|
1208
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
1209
|
+
] }),
|
|
1210
|
+
toolbar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-b border-border px-4 py-2", children: toolbar }),
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn(flush ? "overflow-x-auto" : "p-4"), children }),
|
|
1212
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-t border-border px-4 py-3", children: footer })
|
|
1213
|
+
]
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
// src/components/select-menu/SelectMenu.tsx
|
|
1219
|
+
var React16 = __toESM(require("react"));
|
|
842
1220
|
var import_react_dom3 = require("react-dom");
|
|
1221
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1222
|
+
function useOutsideClose(open, close, refs) {
|
|
1223
|
+
React16.useEffect(() => {
|
|
1224
|
+
if (!open) return;
|
|
1225
|
+
const onPointerDown = (event) => {
|
|
1226
|
+
const target = event.target;
|
|
1227
|
+
if (refs.some((ref) => ref.current?.contains(target))) return;
|
|
1228
|
+
close();
|
|
1229
|
+
};
|
|
1230
|
+
document.addEventListener("mousedown", onPointerDown);
|
|
1231
|
+
return () => document.removeEventListener("mousedown", onPointerDown);
|
|
1232
|
+
}, [open, close, refs]);
|
|
1233
|
+
}
|
|
1234
|
+
var SelectMenu = React16.forwardRef(function SelectMenu2({
|
|
1235
|
+
items,
|
|
1236
|
+
value,
|
|
1237
|
+
defaultValue,
|
|
1238
|
+
onValueChange,
|
|
1239
|
+
multiple = false,
|
|
1240
|
+
placeholder = "Select\u2026",
|
|
1241
|
+
name,
|
|
1242
|
+
renderValue,
|
|
1243
|
+
renderItem,
|
|
1244
|
+
emptyText = "No options",
|
|
1245
|
+
className,
|
|
1246
|
+
disabled,
|
|
1247
|
+
onKeyDown,
|
|
1248
|
+
...buttonProps
|
|
1249
|
+
}, ref) {
|
|
1250
|
+
const [internal, setInternal] = React16.useState(() => {
|
|
1251
|
+
if (defaultValue === void 0) return [];
|
|
1252
|
+
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
1253
|
+
});
|
|
1254
|
+
const selectedValues = React16.useMemo(() => {
|
|
1255
|
+
if (value === void 0) return internal;
|
|
1256
|
+
return Array.isArray(value) ? value : [value];
|
|
1257
|
+
}, [value, internal]);
|
|
1258
|
+
const [open, setOpen] = React16.useState(false);
|
|
1259
|
+
const [activeIndex, setActiveIndex] = React16.useState(-1);
|
|
1260
|
+
const [position, setPosition] = React16.useState(null);
|
|
1261
|
+
const triggerRef = React16.useRef(null);
|
|
1262
|
+
const listRef = React16.useRef(null);
|
|
1263
|
+
const listboxId = React16.useId();
|
|
1264
|
+
const labelId = React16.useId();
|
|
1265
|
+
const typeahead = React16.useRef({ query: "", at: 0 });
|
|
1266
|
+
const setTriggerRef = React16.useCallback(
|
|
1267
|
+
(node) => {
|
|
1268
|
+
triggerRef.current = node;
|
|
1269
|
+
if (typeof ref === "function") ref(node);
|
|
1270
|
+
else if (ref) ref.current = node;
|
|
1271
|
+
},
|
|
1272
|
+
[ref]
|
|
1273
|
+
);
|
|
1274
|
+
const close = React16.useCallback(() => setOpen(false), []);
|
|
1275
|
+
useOutsideClose(open, close, [triggerRef, listRef]);
|
|
1276
|
+
const measure = React16.useCallback(() => {
|
|
1277
|
+
const node = triggerRef.current;
|
|
1278
|
+
if (!node) return;
|
|
1279
|
+
const rect = node.getBoundingClientRect();
|
|
1280
|
+
setPosition({ top: rect.bottom + 4, left: rect.left, width: Math.max(rect.width, 200) });
|
|
1281
|
+
}, []);
|
|
1282
|
+
React16.useEffect(() => {
|
|
1283
|
+
if (!open) return;
|
|
1284
|
+
measure();
|
|
1285
|
+
const onScroll = () => measure();
|
|
1286
|
+
window.addEventListener("resize", onScroll);
|
|
1287
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1288
|
+
return () => {
|
|
1289
|
+
window.removeEventListener("resize", onScroll);
|
|
1290
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
1291
|
+
};
|
|
1292
|
+
}, [open, measure]);
|
|
1293
|
+
const firstEnabled = React16.useMemo(() => items.findIndex((item) => !item.disabled), [items]);
|
|
1294
|
+
const openMenu = () => {
|
|
1295
|
+
if (disabled) return;
|
|
1296
|
+
setOpen(true);
|
|
1297
|
+
const selectedIndex = items.findIndex((item) => selectedValues.includes(item.value) && !item.disabled);
|
|
1298
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled);
|
|
1299
|
+
};
|
|
1300
|
+
const commit = (next) => {
|
|
1301
|
+
if (value === void 0) setInternal(next);
|
|
1302
|
+
onValueChange?.(multiple ? next : next[0] ?? "");
|
|
1303
|
+
};
|
|
1304
|
+
const select = (item) => {
|
|
1305
|
+
if (item.disabled) return;
|
|
1306
|
+
if (multiple) {
|
|
1307
|
+
const next = selectedValues.includes(item.value) ? selectedValues.filter((entry) => entry !== item.value) : [...selectedValues, item.value];
|
|
1308
|
+
commit(next);
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
commit([item.value]);
|
|
1312
|
+
setOpen(false);
|
|
1313
|
+
};
|
|
1314
|
+
const move = (direction) => {
|
|
1315
|
+
if (items.length === 0) return;
|
|
1316
|
+
let index = activeIndex;
|
|
1317
|
+
for (let step = 0; step < items.length; step += 1) {
|
|
1318
|
+
index = (index + direction + items.length) % items.length;
|
|
1319
|
+
if (!items[index]?.disabled) {
|
|
1320
|
+
setActiveIndex(index);
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
const handleKeyDown = (event) => {
|
|
1326
|
+
onKeyDown?.(event);
|
|
1327
|
+
if (event.defaultPrevented) return;
|
|
1328
|
+
if (!open) {
|
|
1329
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
1330
|
+
event.preventDefault();
|
|
1331
|
+
openMenu();
|
|
1332
|
+
}
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
switch (event.key) {
|
|
1336
|
+
case "ArrowDown":
|
|
1337
|
+
event.preventDefault();
|
|
1338
|
+
move(1);
|
|
1339
|
+
break;
|
|
1340
|
+
case "ArrowUp":
|
|
1341
|
+
event.preventDefault();
|
|
1342
|
+
move(-1);
|
|
1343
|
+
break;
|
|
1344
|
+
case "Home":
|
|
1345
|
+
event.preventDefault();
|
|
1346
|
+
setActiveIndex(firstEnabled);
|
|
1347
|
+
break;
|
|
1348
|
+
case "End": {
|
|
1349
|
+
event.preventDefault();
|
|
1350
|
+
for (let i = items.length - 1; i >= 0; i -= 1) {
|
|
1351
|
+
if (!items[i]?.disabled) {
|
|
1352
|
+
setActiveIndex(i);
|
|
1353
|
+
break;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
break;
|
|
1357
|
+
}
|
|
1358
|
+
case "Enter":
|
|
1359
|
+
case " ":
|
|
1360
|
+
event.preventDefault();
|
|
1361
|
+
if (activeIndex >= 0 && items[activeIndex]) select(items[activeIndex]);
|
|
1362
|
+
break;
|
|
1363
|
+
case "Escape":
|
|
1364
|
+
event.preventDefault();
|
|
1365
|
+
setOpen(false);
|
|
1366
|
+
break;
|
|
1367
|
+
case "Tab":
|
|
1368
|
+
setOpen(false);
|
|
1369
|
+
break;
|
|
1370
|
+
default: {
|
|
1371
|
+
if (event.key.length !== 1 || event.metaKey || event.ctrlKey || event.altKey) return;
|
|
1372
|
+
const now = Date.now();
|
|
1373
|
+
const buffer = now - typeahead.current.at > 600 ? event.key : typeahead.current.query + event.key;
|
|
1374
|
+
typeahead.current = { query: buffer, at: now };
|
|
1375
|
+
const query = buffer.toLowerCase();
|
|
1376
|
+
const index = items.findIndex((item) => !item.disabled && item.label.toLowerCase().startsWith(query));
|
|
1377
|
+
if (index >= 0) setActiveIndex(index);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
const selectedItems = items.filter((item) => selectedValues.includes(item.value));
|
|
1382
|
+
const triggerContent = renderValue ? renderValue(selectedItems) : selectedItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: placeholder }) : multiple ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate", children: selectedItems.length === 1 ? selectedItems[0].label : `${selectedItems.length} selected` }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "truncate", children: selectedItems[0].label });
|
|
1383
|
+
const activeOptionId = activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0;
|
|
1384
|
+
const rows = React16.useMemo(() => {
|
|
1385
|
+
const out = [];
|
|
1386
|
+
let lastGroup;
|
|
1387
|
+
items.forEach((item, index) => {
|
|
1388
|
+
if (item.group && item.group !== lastGroup) {
|
|
1389
|
+
out.push({ heading: item.group, index: -1 });
|
|
1390
|
+
lastGroup = item.group;
|
|
1391
|
+
}
|
|
1392
|
+
out.push({ item, index });
|
|
1393
|
+
});
|
|
1394
|
+
return out;
|
|
1395
|
+
}, [items]);
|
|
1396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1397
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id: labelId, className: "sr-only", children: typeof buttonProps["aria-label"] === "string" ? buttonProps["aria-label"] : "Select" }),
|
|
1398
|
+
name && selectedValues.map((selected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "hidden", name, value: selected }, selected)),
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1400
|
+
"button",
|
|
1401
|
+
{
|
|
1402
|
+
ref: setTriggerRef,
|
|
1403
|
+
type: "button",
|
|
1404
|
+
"aria-haspopup": "listbox",
|
|
1405
|
+
"aria-expanded": open,
|
|
1406
|
+
"aria-controls": open ? listboxId : void 0,
|
|
1407
|
+
"aria-activedescendant": open ? activeOptionId : void 0,
|
|
1408
|
+
"aria-labelledby": labelId,
|
|
1409
|
+
disabled,
|
|
1410
|
+
onClick: () => open ? setOpen(false) : openMenu(),
|
|
1411
|
+
onKeyDown: handleKeyDown,
|
|
1412
|
+
className: cn(
|
|
1413
|
+
"flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-left text-sm",
|
|
1414
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1415
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1416
|
+
className
|
|
1417
|
+
),
|
|
1418
|
+
...buttonProps,
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "min-w-0 flex-1", children: triggerContent }),
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25BE" })
|
|
1422
|
+
]
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
open && position && (0, import_react_dom3.createPortal)(
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1427
|
+
"div",
|
|
1428
|
+
{
|
|
1429
|
+
ref: listRef,
|
|
1430
|
+
id: listboxId,
|
|
1431
|
+
role: "listbox",
|
|
1432
|
+
"aria-labelledby": labelId,
|
|
1433
|
+
"aria-multiselectable": multiple || void 0,
|
|
1434
|
+
style: {
|
|
1435
|
+
position: "fixed",
|
|
1436
|
+
top: position.top,
|
|
1437
|
+
left: position.left,
|
|
1438
|
+
width: position.width,
|
|
1439
|
+
zIndex: 50
|
|
1440
|
+
},
|
|
1441
|
+
className: "max-h-64 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1442
|
+
children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: emptyText }) : rows.map(
|
|
1443
|
+
(row, rowIndex) => row.heading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1444
|
+
"p",
|
|
1445
|
+
{
|
|
1446
|
+
role: "presentation",
|
|
1447
|
+
className: "px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
1448
|
+
children: row.heading
|
|
1449
|
+
},
|
|
1450
|
+
`heading-${row.heading}-${rowIndex}`
|
|
1451
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1452
|
+
"div",
|
|
1453
|
+
{
|
|
1454
|
+
id: `${listboxId}-option-${row.index}`,
|
|
1455
|
+
role: "option",
|
|
1456
|
+
"aria-selected": selectedValues.includes(row.item.value),
|
|
1457
|
+
"aria-disabled": row.item.disabled || void 0,
|
|
1458
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1459
|
+
onMouseEnter: () => !row.item.disabled && setActiveIndex(row.index),
|
|
1460
|
+
onClick: () => select(row.item),
|
|
1461
|
+
className: cn(
|
|
1462
|
+
"flex cursor-pointer items-start gap-2 rounded-sm px-3 py-2 text-sm outline-none",
|
|
1463
|
+
row.index === activeIndex ? "bg-accent text-accent-foreground" : "hover:bg-accent/60",
|
|
1464
|
+
row.item.disabled && "pointer-events-none opacity-50"
|
|
1465
|
+
),
|
|
1466
|
+
children: renderItem ? renderItem(row.item, {
|
|
1467
|
+
selected: selectedValues.includes(row.item.value),
|
|
1468
|
+
active: row.index === activeIndex
|
|
1469
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1470
|
+
row.item.icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mt-0.5 shrink-0 [&_svg]:size-4", children: row.item.icon }),
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block", children: row.item.label }),
|
|
1473
|
+
row.item.description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: row.item.description })
|
|
1474
|
+
] }),
|
|
1475
|
+
multiple && selectedValues.includes(row.item.value) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", className: "ml-auto text-primary", children: "\u2713" })
|
|
1476
|
+
] })
|
|
1477
|
+
},
|
|
1478
|
+
row.item.value
|
|
1479
|
+
)
|
|
1480
|
+
)
|
|
1481
|
+
}
|
|
1482
|
+
),
|
|
1483
|
+
document.body
|
|
1484
|
+
)
|
|
1485
|
+
] });
|
|
1486
|
+
});
|
|
1487
|
+
|
|
1488
|
+
// src/components/search/Search.tsx
|
|
1489
|
+
var React18 = __toESM(require("react"));
|
|
1490
|
+
var import_react_dom4 = require("react-dom");
|
|
843
1491
|
|
|
844
1492
|
// src/components/search/use-combobox.ts
|
|
845
|
-
var
|
|
1493
|
+
var React17 = __toESM(require("react"));
|
|
846
1494
|
var searchUid = 0;
|
|
847
1495
|
function useCombobox({
|
|
848
1496
|
items,
|
|
@@ -850,12 +1498,12 @@ function useCombobox({
|
|
|
850
1498
|
onOpenChange,
|
|
851
1499
|
closeOnSubmit = true
|
|
852
1500
|
}) {
|
|
853
|
-
const [open, setOpenState] =
|
|
854
|
-
const [activeIndex, setActiveIndex] =
|
|
855
|
-
const [pos, setPos] =
|
|
856
|
-
const anchorRef =
|
|
857
|
-
const listboxId =
|
|
858
|
-
const setOpen =
|
|
1501
|
+
const [open, setOpenState] = React17.useState(false);
|
|
1502
|
+
const [activeIndex, setActiveIndex] = React17.useState(-1);
|
|
1503
|
+
const [pos, setPos] = React17.useState(null);
|
|
1504
|
+
const anchorRef = React17.useRef(null);
|
|
1505
|
+
const listboxId = React17.useRef(`slipstream-combobox-${++searchUid}`).current;
|
|
1506
|
+
const setOpen = React17.useCallback(
|
|
859
1507
|
(next) => {
|
|
860
1508
|
setOpenState(next);
|
|
861
1509
|
if (!next) setActiveIndex(-1);
|
|
@@ -863,10 +1511,10 @@ function useCombobox({
|
|
|
863
1511
|
},
|
|
864
1512
|
[onOpenChange]
|
|
865
1513
|
);
|
|
866
|
-
|
|
1514
|
+
React17.useEffect(() => {
|
|
867
1515
|
setActiveIndex(-1);
|
|
868
1516
|
}, [items]);
|
|
869
|
-
|
|
1517
|
+
React17.useLayoutEffect(() => {
|
|
870
1518
|
if (!open) {
|
|
871
1519
|
setPos(null);
|
|
872
1520
|
return;
|
|
@@ -886,7 +1534,7 @@ function useCombobox({
|
|
|
886
1534
|
window.removeEventListener("resize", measure);
|
|
887
1535
|
};
|
|
888
1536
|
}, [open, setOpen]);
|
|
889
|
-
|
|
1537
|
+
React17.useEffect(() => {
|
|
890
1538
|
if (!open) return;
|
|
891
1539
|
const onPointerDown = (event) => {
|
|
892
1540
|
if (!anchorRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -894,7 +1542,7 @@ function useCombobox({
|
|
|
894
1542
|
document.addEventListener("pointerdown", onPointerDown);
|
|
895
1543
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
896
1544
|
}, [open, setOpen]);
|
|
897
|
-
const onInputKeyDown =
|
|
1545
|
+
const onInputKeyDown = React17.useCallback(
|
|
898
1546
|
(event) => {
|
|
899
1547
|
if (event.key === "Escape") {
|
|
900
1548
|
if (open) {
|
|
@@ -962,7 +1610,7 @@ function useCombobox({
|
|
|
962
1610
|
}
|
|
963
1611
|
|
|
964
1612
|
// src/components/search/Search.tsx
|
|
965
|
-
var
|
|
1613
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
966
1614
|
function Search({
|
|
967
1615
|
options,
|
|
968
1616
|
defaultValue,
|
|
@@ -975,12 +1623,12 @@ function Search({
|
|
|
975
1623
|
className,
|
|
976
1624
|
"aria-label": ariaLabel
|
|
977
1625
|
}) {
|
|
978
|
-
const selected =
|
|
1626
|
+
const selected = React18.useMemo(
|
|
979
1627
|
() => options.find((option) => option.value === defaultValue),
|
|
980
1628
|
[options, defaultValue]
|
|
981
1629
|
);
|
|
982
|
-
const [query, setQuery] =
|
|
983
|
-
const filtered =
|
|
1630
|
+
const [query, setQuery] = React18.useState(selected?.label ?? "");
|
|
1631
|
+
const filtered = React18.useMemo(() => {
|
|
984
1632
|
if (!query.trim()) return options;
|
|
985
1633
|
const q = query.trim().toLowerCase();
|
|
986
1634
|
return options.filter(
|
|
@@ -999,8 +1647,8 @@ function Search({
|
|
|
999
1647
|
onValueChange?.(item.value);
|
|
1000
1648
|
combobox.setOpen(false);
|
|
1001
1649
|
};
|
|
1002
|
-
return /* @__PURE__ */ (0,
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: combobox.anchorRef, className: cn("relative w-full", className), children: [
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1004
1652
|
Input,
|
|
1005
1653
|
{
|
|
1006
1654
|
id,
|
|
@@ -1023,8 +1671,8 @@ function Search({
|
|
|
1023
1671
|
...combobox.inputProps
|
|
1024
1672
|
}
|
|
1025
1673
|
),
|
|
1026
|
-
combobox.ready && (0,
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1674
|
+
combobox.ready && (0, import_react_dom4.createPortal)(
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1028
1676
|
"ul",
|
|
1029
1677
|
{
|
|
1030
1678
|
id: combobox.listboxId,
|
|
@@ -1038,7 +1686,7 @@ function Search({
|
|
|
1038
1686
|
zIndex: 50
|
|
1039
1687
|
},
|
|
1040
1688
|
className: "max-h-64 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1041
|
-
children: filtered.length === 0 ? /* @__PURE__ */ (0,
|
|
1689
|
+
children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: emptyText }) : filtered.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1042
1690
|
"li",
|
|
1043
1691
|
{
|
|
1044
1692
|
id: combobox.optionId(index),
|
|
@@ -1052,8 +1700,8 @@ function Search({
|
|
|
1052
1700
|
combobox.activeIndex === index ? "bg-accent text-accent-foreground" : "hover:bg-accent/60"
|
|
1053
1701
|
),
|
|
1054
1702
|
children: [
|
|
1055
|
-
/* @__PURE__ */ (0,
|
|
1056
|
-
option.description && /* @__PURE__ */ (0,
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "block", children: option.label }),
|
|
1704
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "block text-xs text-muted-foreground", children: option.description })
|
|
1057
1705
|
]
|
|
1058
1706
|
},
|
|
1059
1707
|
option.value
|
|
@@ -1066,15 +1714,25 @@ function Search({
|
|
|
1066
1714
|
}
|
|
1067
1715
|
|
|
1068
1716
|
// src/components/autocomplete/Autocomplete.tsx
|
|
1069
|
-
var
|
|
1070
|
-
var
|
|
1071
|
-
var
|
|
1717
|
+
var React19 = __toESM(require("react"));
|
|
1718
|
+
var import_react_dom5 = require("react-dom");
|
|
1719
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1720
|
+
function normalize(entry) {
|
|
1721
|
+
if (typeof entry === "string") return { value: entry, label: entry };
|
|
1722
|
+
return { value: entry.value, label: entry.label ?? entry.value, group: entry.group, description: entry.description };
|
|
1723
|
+
}
|
|
1072
1724
|
function Autocomplete({
|
|
1073
1725
|
value,
|
|
1074
1726
|
defaultValue = "",
|
|
1075
1727
|
onValueChange,
|
|
1728
|
+
options,
|
|
1076
1729
|
suggestions,
|
|
1730
|
+
loadOptions,
|
|
1731
|
+
renderOption,
|
|
1732
|
+
clearable = false,
|
|
1077
1733
|
emptyText,
|
|
1734
|
+
loadingText,
|
|
1735
|
+
debounceMs = 200,
|
|
1078
1736
|
placeholder,
|
|
1079
1737
|
id,
|
|
1080
1738
|
name,
|
|
@@ -1083,27 +1741,62 @@ function Autocomplete({
|
|
|
1083
1741
|
onFocus,
|
|
1084
1742
|
...inputProps
|
|
1085
1743
|
}) {
|
|
1086
|
-
const [internalValue, setInternalValue] =
|
|
1744
|
+
const [internalValue, setInternalValue] = React19.useState(defaultValue);
|
|
1087
1745
|
const current = value ?? internalValue;
|
|
1088
|
-
const
|
|
1746
|
+
const [asyncOptions, setAsyncOptions] = React19.useState([]);
|
|
1747
|
+
const [loading, setLoading] = React19.useState(false);
|
|
1748
|
+
const requestId = React19.useRef(0);
|
|
1749
|
+
const source = React19.useMemo(() => {
|
|
1750
|
+
const list = options ?? (suggestions ?? []).map(normalize);
|
|
1751
|
+
return list.map(normalize);
|
|
1752
|
+
}, [options, suggestions]);
|
|
1753
|
+
React19.useEffect(() => {
|
|
1754
|
+
if (!loadOptions) return;
|
|
1755
|
+
const id2 = ++requestId.current;
|
|
1756
|
+
setLoading(true);
|
|
1757
|
+
const timer = setTimeout(async () => {
|
|
1758
|
+
try {
|
|
1759
|
+
const result = await loadOptions(current);
|
|
1760
|
+
if (requestId.current === id2) setAsyncOptions(result.map(normalize));
|
|
1761
|
+
} catch {
|
|
1762
|
+
if (requestId.current === id2) setAsyncOptions([]);
|
|
1763
|
+
} finally {
|
|
1764
|
+
if (requestId.current === id2) setLoading(false);
|
|
1765
|
+
}
|
|
1766
|
+
}, debounceMs);
|
|
1767
|
+
return () => clearTimeout(timer);
|
|
1768
|
+
}, [loadOptions, current, debounceMs]);
|
|
1769
|
+
const pool = loadOptions ? asyncOptions : source;
|
|
1770
|
+
const items = React19.useMemo(() => {
|
|
1089
1771
|
const q = current.trim().toLowerCase();
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
}, [suggestions, current]);
|
|
1772
|
+
return pool.filter((option) => !q || option.label.toLowerCase().includes(q) || option.value.toLowerCase().includes(q)).filter((option) => option.value !== current);
|
|
1773
|
+
}, [pool, current]);
|
|
1093
1774
|
const combobox = useCombobox({
|
|
1094
|
-
items,
|
|
1775
|
+
items: items.map((item) => ({ value: item.value, label: item.label })),
|
|
1095
1776
|
onSelect: (item) => {
|
|
1096
1777
|
if (value === void 0) setInternalValue(item.label);
|
|
1097
1778
|
onValueChange?.(item.label);
|
|
1098
1779
|
}
|
|
1099
1780
|
});
|
|
1100
|
-
const select = (
|
|
1101
|
-
if (value === void 0) setInternalValue(label);
|
|
1102
|
-
onValueChange?.(label);
|
|
1781
|
+
const select = (option) => {
|
|
1782
|
+
if (value === void 0) setInternalValue(option.label);
|
|
1783
|
+
onValueChange?.(option.label);
|
|
1103
1784
|
combobox.setOpen(false);
|
|
1104
1785
|
};
|
|
1105
|
-
|
|
1106
|
-
|
|
1786
|
+
const grouped = React19.useMemo(() => {
|
|
1787
|
+
const out = [];
|
|
1788
|
+
let lastGroup;
|
|
1789
|
+
items.forEach((option, index) => {
|
|
1790
|
+
if (option.group && option.group !== lastGroup) {
|
|
1791
|
+
out.push({ heading: option.group, index: -1 });
|
|
1792
|
+
lastGroup = option.group;
|
|
1793
|
+
}
|
|
1794
|
+
out.push({ option, index });
|
|
1795
|
+
});
|
|
1796
|
+
return out;
|
|
1797
|
+
}, [items]);
|
|
1798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: combobox.anchorRef, className: cn("relative w-full", className), children: [
|
|
1799
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1107
1800
|
Input,
|
|
1108
1801
|
{
|
|
1109
1802
|
id,
|
|
@@ -1111,6 +1804,7 @@ function Autocomplete({
|
|
|
1111
1804
|
placeholder,
|
|
1112
1805
|
autoComplete: "off",
|
|
1113
1806
|
value: current,
|
|
1807
|
+
className: clearable && current ? "pr-9" : void 0,
|
|
1114
1808
|
onChange: (event) => {
|
|
1115
1809
|
if (value === void 0) setInternalValue(event.target.value);
|
|
1116
1810
|
onValueChange?.(event.target.value);
|
|
@@ -1128,13 +1822,28 @@ function Autocomplete({
|
|
|
1128
1822
|
...combobox.inputProps
|
|
1129
1823
|
}
|
|
1130
1824
|
),
|
|
1131
|
-
|
|
1132
|
-
|
|
1825
|
+
clearable && current && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1826
|
+
"button",
|
|
1827
|
+
{
|
|
1828
|
+
type: "button",
|
|
1829
|
+
onClick: () => {
|
|
1830
|
+
if (value === void 0) setInternalValue("");
|
|
1831
|
+
onValueChange?.("");
|
|
1832
|
+
combobox.setOpen(true);
|
|
1833
|
+
},
|
|
1834
|
+
"aria-label": "Clear input",
|
|
1835
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1836
|
+
children: "\u2715"
|
|
1837
|
+
}
|
|
1838
|
+
),
|
|
1839
|
+
combobox.ready && (0, import_react_dom5.createPortal)(
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1133
1841
|
"ul",
|
|
1134
1842
|
{
|
|
1135
1843
|
id: combobox.listboxId,
|
|
1136
1844
|
role: "listbox",
|
|
1137
1845
|
"aria-label": "Suggestions",
|
|
1846
|
+
"aria-busy": loading || void 0,
|
|
1138
1847
|
style: {
|
|
1139
1848
|
position: "fixed",
|
|
1140
1849
|
top: combobox.pos.top,
|
|
@@ -1143,23 +1852,36 @@ function Autocomplete({
|
|
|
1143
1852
|
zIndex: 50
|
|
1144
1853
|
},
|
|
1145
1854
|
className: "max-h-60 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1146
|
-
children: items.length === 0 ? /* @__PURE__ */ (0,
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1855
|
+
children: loading && items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: loadingText ?? "Loading\u2026" }) : items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: emptyText ?? "No suggestions" }) : grouped.map(
|
|
1856
|
+
(entry, rowIndex) => entry.heading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1857
|
+
"li",
|
|
1858
|
+
{
|
|
1859
|
+
role: "presentation",
|
|
1860
|
+
className: "px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
1861
|
+
children: entry.heading
|
|
1862
|
+
},
|
|
1863
|
+
`group-${entry.heading}-${rowIndex}`
|
|
1864
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1865
|
+
"li",
|
|
1866
|
+
{
|
|
1867
|
+
id: combobox.optionId(entry.index),
|
|
1868
|
+
role: "option",
|
|
1869
|
+
"aria-selected": combobox.activeIndex === entry.index,
|
|
1870
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1871
|
+
onMouseEnter: () => combobox.setActiveIndex(entry.index),
|
|
1872
|
+
onClick: () => select(entry.option),
|
|
1873
|
+
className: cn(
|
|
1874
|
+
"cursor-pointer rounded-sm px-3 py-1.5 text-sm outline-none",
|
|
1875
|
+
combobox.activeIndex === entry.index ? "bg-accent text-accent-foreground" : "hover:bg-accent/60"
|
|
1876
|
+
),
|
|
1877
|
+
children: renderOption ? renderOption(entry.option, { active: combobox.activeIndex === entry.index }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "block", children: entry.option.label }),
|
|
1879
|
+
entry.option.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: entry.option.description })
|
|
1880
|
+
] })
|
|
1881
|
+
},
|
|
1882
|
+
entry.option.value
|
|
1883
|
+
)
|
|
1884
|
+
)
|
|
1163
1885
|
}
|
|
1164
1886
|
),
|
|
1165
1887
|
document.body
|
|
@@ -1168,10 +1890,10 @@ function Autocomplete({
|
|
|
1168
1890
|
}
|
|
1169
1891
|
|
|
1170
1892
|
// src/components/checkbox/Checkbox.tsx
|
|
1171
|
-
var
|
|
1172
|
-
var
|
|
1173
|
-
var Checkbox =
|
|
1174
|
-
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1893
|
+
var React20 = __toESM(require("react"));
|
|
1894
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1895
|
+
var Checkbox = React20.forwardRef(
|
|
1896
|
+
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1175
1897
|
"input",
|
|
1176
1898
|
{
|
|
1177
1899
|
type: "checkbox",
|
|
@@ -1192,38 +1914,38 @@ var Checkbox = React16.forwardRef(
|
|
|
1192
1914
|
Checkbox.displayName = "Checkbox";
|
|
1193
1915
|
|
|
1194
1916
|
// src/components/checkbox/CheckboxGroup.tsx
|
|
1195
|
-
var
|
|
1196
|
-
var
|
|
1197
|
-
var CheckboxGroupContext =
|
|
1917
|
+
var React21 = __toESM(require("react"));
|
|
1918
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1919
|
+
var CheckboxGroupContext = React21.createContext({
|
|
1198
1920
|
name: "",
|
|
1199
1921
|
values: [],
|
|
1200
1922
|
toggle: () => {
|
|
1201
1923
|
}
|
|
1202
1924
|
});
|
|
1203
|
-
var CheckboxGroup =
|
|
1925
|
+
var CheckboxGroup = React21.forwardRef(
|
|
1204
1926
|
({ name, legend, value, defaultValue, onValueChange, orientation = "vertical", error, className, children }, ref) => {
|
|
1205
|
-
const [internalValue, setInternalValue] =
|
|
1927
|
+
const [internalValue, setInternalValue] = React21.useState(defaultValue ?? []);
|
|
1206
1928
|
const currentValue = value ?? internalValue;
|
|
1207
1929
|
const toggle = (next) => {
|
|
1208
1930
|
const updated = currentValue.includes(next) ? currentValue.filter((item) => item !== next) : [...currentValue, next];
|
|
1209
1931
|
if (value === void 0) setInternalValue(updated);
|
|
1210
1932
|
onValueChange?.(updated);
|
|
1211
1933
|
};
|
|
1212
|
-
return /* @__PURE__ */ (0,
|
|
1213
|
-
legend && /* @__PURE__ */ (0,
|
|
1214
|
-
/* @__PURE__ */ (0,
|
|
1215
|
-
error && /* @__PURE__ */ (0,
|
|
1934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("fieldset", { ref, className: cn(orientation === "vertical" ? "space-y-2" : "flex flex-row flex-wrap gap-x-4 gap-y-2", className), children: [
|
|
1935
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("legend", { className: "text-sm font-medium", children: legend }),
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckboxGroupContext.Provider, { value: { name, values: currentValue, toggle }, children }),
|
|
1937
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-xs text-destructive", children: error })
|
|
1216
1938
|
] });
|
|
1217
1939
|
}
|
|
1218
1940
|
);
|
|
1219
1941
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
1220
|
-
var CheckboxGroupItem =
|
|
1942
|
+
var CheckboxGroupItem = React21.forwardRef(
|
|
1221
1943
|
({ value, label, className, id, ...props }, ref) => {
|
|
1222
|
-
const group =
|
|
1223
|
-
const generatedId =
|
|
1944
|
+
const group = React21.useContext(CheckboxGroupContext);
|
|
1945
|
+
const generatedId = React21.useId();
|
|
1224
1946
|
const inputId = id ?? generatedId;
|
|
1225
|
-
return /* @__PURE__ */ (0,
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1227
1949
|
Checkbox,
|
|
1228
1950
|
{
|
|
1229
1951
|
ref,
|
|
@@ -1236,7 +1958,7 @@ var CheckboxGroupItem = React17.forwardRef(
|
|
|
1236
1958
|
...props
|
|
1237
1959
|
}
|
|
1238
1960
|
),
|
|
1239
|
-
label && /* @__PURE__ */ (0,
|
|
1961
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1240
1962
|
"label",
|
|
1241
1963
|
{
|
|
1242
1964
|
htmlFor: inputId,
|
|
@@ -1250,10 +1972,10 @@ var CheckboxGroupItem = React17.forwardRef(
|
|
|
1250
1972
|
CheckboxGroupItem.displayName = "CheckboxGroupItem";
|
|
1251
1973
|
|
|
1252
1974
|
// src/components/radio/Radio.tsx
|
|
1253
|
-
var
|
|
1254
|
-
var
|
|
1255
|
-
var Radio =
|
|
1256
|
-
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */ (0,
|
|
1975
|
+
var React22 = __toESM(require("react"));
|
|
1976
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1977
|
+
var Radio = React22.forwardRef(
|
|
1978
|
+
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1257
1979
|
"input",
|
|
1258
1980
|
{
|
|
1259
1981
|
type: "radio",
|
|
@@ -1272,15 +1994,15 @@ var Radio = React18.forwardRef(
|
|
|
1272
1994
|
)
|
|
1273
1995
|
);
|
|
1274
1996
|
Radio.displayName = "Radio";
|
|
1275
|
-
var RadioGroup =
|
|
1997
|
+
var RadioGroup = React22.forwardRef(
|
|
1276
1998
|
({ name, legend, value, defaultValue, onValueChange, orientation = "vertical", error, className, children }, ref) => {
|
|
1277
|
-
const [internalValue, setInternalValue] =
|
|
1999
|
+
const [internalValue, setInternalValue] = React22.useState(defaultValue ?? "");
|
|
1278
2000
|
const currentValue = value ?? internalValue;
|
|
1279
2001
|
const handleChange = (next) => {
|
|
1280
2002
|
if (value === void 0) setInternalValue(next);
|
|
1281
2003
|
onValueChange?.(next);
|
|
1282
2004
|
};
|
|
1283
|
-
return /* @__PURE__ */ (0,
|
|
2005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1284
2006
|
"fieldset",
|
|
1285
2007
|
{
|
|
1286
2008
|
ref,
|
|
@@ -1289,28 +2011,28 @@ var RadioGroup = React18.forwardRef(
|
|
|
1289
2011
|
className
|
|
1290
2012
|
),
|
|
1291
2013
|
children: [
|
|
1292
|
-
legend && /* @__PURE__ */ (0,
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1294
|
-
error && /* @__PURE__ */ (0,
|
|
2014
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("legend", { className: "text-sm font-medium", children: legend }),
|
|
2015
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RadioGroupContext.Provider, { value: { name, value: currentValue, onChange: handleChange }, children }),
|
|
2016
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { role: "alert", className: "text-xs text-destructive", children: error })
|
|
1295
2017
|
]
|
|
1296
2018
|
}
|
|
1297
2019
|
);
|
|
1298
2020
|
}
|
|
1299
2021
|
);
|
|
1300
2022
|
RadioGroup.displayName = "RadioGroup";
|
|
1301
|
-
var RadioGroupContext =
|
|
2023
|
+
var RadioGroupContext = React22.createContext({
|
|
1302
2024
|
name: "",
|
|
1303
2025
|
value: "",
|
|
1304
2026
|
onChange: () => {
|
|
1305
2027
|
}
|
|
1306
2028
|
});
|
|
1307
|
-
var RadioGroupItem =
|
|
2029
|
+
var RadioGroupItem = React22.forwardRef(
|
|
1308
2030
|
({ value, label, className, id, ...props }, ref) => {
|
|
1309
|
-
const group =
|
|
1310
|
-
const generatedId =
|
|
2031
|
+
const group = React22.useContext(RadioGroupContext);
|
|
2032
|
+
const generatedId = React22.useId();
|
|
1311
2033
|
const inputId = id ?? generatedId;
|
|
1312
|
-
return /* @__PURE__ */ (0,
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
2034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1314
2036
|
Radio,
|
|
1315
2037
|
{
|
|
1316
2038
|
ref,
|
|
@@ -1323,21 +2045,21 @@ var RadioGroupItem = React18.forwardRef(
|
|
|
1323
2045
|
...props
|
|
1324
2046
|
}
|
|
1325
2047
|
),
|
|
1326
|
-
label && /* @__PURE__ */ (0,
|
|
2048
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: inputId, className: "text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: label })
|
|
1327
2049
|
] });
|
|
1328
2050
|
}
|
|
1329
2051
|
);
|
|
1330
2052
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
1331
2053
|
|
|
1332
2054
|
// src/components/radio/RadioCard.tsx
|
|
1333
|
-
var
|
|
1334
|
-
var
|
|
1335
|
-
var RadioCard =
|
|
2055
|
+
var React23 = __toESM(require("react"));
|
|
2056
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2057
|
+
var RadioCard = React23.forwardRef(
|
|
1336
2058
|
({ value, title, description, children, rounded = true, disabled, className, id }, ref) => {
|
|
1337
|
-
const group =
|
|
1338
|
-
const generatedId =
|
|
2059
|
+
const group = React23.useContext(RadioGroupContext);
|
|
2060
|
+
const generatedId = React23.useId();
|
|
1339
2061
|
const inputId = id ?? generatedId;
|
|
1340
|
-
return /* @__PURE__ */ (0,
|
|
2062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1341
2063
|
"label",
|
|
1342
2064
|
{
|
|
1343
2065
|
ref,
|
|
@@ -1353,7 +2075,7 @@ var RadioCard = React19.forwardRef(
|
|
|
1353
2075
|
className
|
|
1354
2076
|
),
|
|
1355
2077
|
children: [
|
|
1356
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1357
2079
|
Radio,
|
|
1358
2080
|
{
|
|
1359
2081
|
id: inputId,
|
|
@@ -1364,8 +2086,8 @@ var RadioCard = React19.forwardRef(
|
|
|
1364
2086
|
className: "sr-only"
|
|
1365
2087
|
}
|
|
1366
2088
|
),
|
|
1367
|
-
title && /* @__PURE__ */ (0,
|
|
1368
|
-
description && /* @__PURE__ */ (0,
|
|
2089
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm font-medium leading-none", children: title }),
|
|
2090
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm text-muted-foreground", children: description }),
|
|
1369
2091
|
children
|
|
1370
2092
|
]
|
|
1371
2093
|
}
|
|
@@ -1375,10 +2097,10 @@ var RadioCard = React19.forwardRef(
|
|
|
1375
2097
|
RadioCard.displayName = "RadioCard";
|
|
1376
2098
|
|
|
1377
2099
|
// src/components/label/Label.tsx
|
|
1378
|
-
var
|
|
1379
|
-
var
|
|
1380
|
-
var Label =
|
|
1381
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2100
|
+
var React24 = __toESM(require("react"));
|
|
2101
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2102
|
+
var Label = React24.forwardRef(
|
|
2103
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1382
2104
|
"label",
|
|
1383
2105
|
{
|
|
1384
2106
|
ref,
|
|
@@ -1393,20 +2115,20 @@ var Label = React20.forwardRef(
|
|
|
1393
2115
|
Label.displayName = "Label";
|
|
1394
2116
|
|
|
1395
2117
|
// src/components/fieldset/Fieldset.tsx
|
|
1396
|
-
var
|
|
1397
|
-
var
|
|
1398
|
-
var Fieldset =
|
|
1399
|
-
({ legend, description, error, className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2118
|
+
var React25 = __toESM(require("react"));
|
|
2119
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2120
|
+
var Fieldset = React25.forwardRef(
|
|
2121
|
+
({ legend, description, error, className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1400
2122
|
"fieldset",
|
|
1401
2123
|
{
|
|
1402
2124
|
ref,
|
|
1403
2125
|
className: cn("m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0", className),
|
|
1404
2126
|
...props,
|
|
1405
2127
|
children: [
|
|
1406
|
-
legend && /* @__PURE__ */ (0,
|
|
1407
|
-
description && /* @__PURE__ */ (0,
|
|
2128
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("legend", { className: "p-0 text-sm font-medium leading-none", children: legend }),
|
|
2129
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: description }),
|
|
1408
2130
|
children,
|
|
1409
|
-
error && /* @__PURE__ */ (0,
|
|
2131
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-xs text-destructive", children: error })
|
|
1410
2132
|
]
|
|
1411
2133
|
}
|
|
1412
2134
|
)
|
|
@@ -1414,36 +2136,36 @@ var Fieldset = React21.forwardRef(
|
|
|
1414
2136
|
Fieldset.displayName = "Fieldset";
|
|
1415
2137
|
|
|
1416
2138
|
// src/components/form-field/FormField.tsx
|
|
1417
|
-
var
|
|
2139
|
+
var React27 = __toESM(require("react"));
|
|
1418
2140
|
|
|
1419
2141
|
// src/components/tooltip/Tooltip.tsx
|
|
1420
|
-
var
|
|
1421
|
-
var
|
|
1422
|
-
var
|
|
2142
|
+
var React26 = __toESM(require("react"));
|
|
2143
|
+
var import_react_dom6 = require("react-dom");
|
|
2144
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1423
2145
|
var GAP = 8;
|
|
1424
|
-
var Tooltip =
|
|
2146
|
+
var Tooltip = React26.forwardRef(
|
|
1425
2147
|
({ content, side = "top", delay = 300, className, children }, ref) => {
|
|
1426
|
-
const [open, setOpen] =
|
|
1427
|
-
const [pos, setPos] =
|
|
1428
|
-
const anchorRef =
|
|
1429
|
-
const timerRef =
|
|
1430
|
-
const id =
|
|
1431
|
-
const
|
|
2148
|
+
const [open, setOpen] = React26.useState(false);
|
|
2149
|
+
const [pos, setPos] = React26.useState(null);
|
|
2150
|
+
const anchorRef = React26.useRef(null);
|
|
2151
|
+
const timerRef = React26.useRef(null);
|
|
2152
|
+
const id = React26.useId();
|
|
2153
|
+
const show2 = React26.useCallback(() => {
|
|
1432
2154
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1433
2155
|
timerRef.current = setTimeout(() => setOpen(true), delay);
|
|
1434
2156
|
}, [delay]);
|
|
1435
|
-
const hide =
|
|
2157
|
+
const hide = React26.useCallback(() => {
|
|
1436
2158
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1437
2159
|
setOpen(false);
|
|
1438
2160
|
setPos(null);
|
|
1439
2161
|
}, []);
|
|
1440
|
-
|
|
2162
|
+
React26.useEffect(
|
|
1441
2163
|
() => () => {
|
|
1442
2164
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1443
2165
|
},
|
|
1444
2166
|
[]
|
|
1445
2167
|
);
|
|
1446
|
-
|
|
2168
|
+
React26.useLayoutEffect(() => {
|
|
1447
2169
|
if (!open) return;
|
|
1448
2170
|
const rect = anchorRef.current?.getBoundingClientRect();
|
|
1449
2171
|
if (!rect) return;
|
|
@@ -1457,10 +2179,10 @@ var Tooltip = React22.forwardRef(
|
|
|
1457
2179
|
window.removeEventListener("resize", onScrollOrResize);
|
|
1458
2180
|
};
|
|
1459
2181
|
}, [open, side, hide]);
|
|
1460
|
-
const trigger =
|
|
2182
|
+
const trigger = React26.cloneElement(children, {
|
|
1461
2183
|
"aria-describedby": open ? id : void 0
|
|
1462
2184
|
});
|
|
1463
|
-
return /* @__PURE__ */ (0,
|
|
2185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1464
2186
|
"div",
|
|
1465
2187
|
{
|
|
1466
2188
|
ref: (node) => {
|
|
@@ -1469,9 +2191,9 @@ var Tooltip = React22.forwardRef(
|
|
|
1469
2191
|
else if (ref) ref.current = node;
|
|
1470
2192
|
},
|
|
1471
2193
|
className: cn("relative inline-flex", className),
|
|
1472
|
-
onMouseEnter:
|
|
2194
|
+
onMouseEnter: show2,
|
|
1473
2195
|
onMouseLeave: hide,
|
|
1474
|
-
onFocusCapture:
|
|
2196
|
+
onFocusCapture: show2,
|
|
1475
2197
|
onBlurCapture: hide,
|
|
1476
2198
|
onKeyDown: (event) => {
|
|
1477
2199
|
if (event.key === "Escape" && open) {
|
|
@@ -1481,8 +2203,8 @@ var Tooltip = React22.forwardRef(
|
|
|
1481
2203
|
},
|
|
1482
2204
|
children: [
|
|
1483
2205
|
trigger,
|
|
1484
|
-
open && pos && typeof document !== "undefined" && (0,
|
|
1485
|
-
/* @__PURE__ */ (0,
|
|
2206
|
+
open && pos && typeof document !== "undefined" && (0, import_react_dom6.createPortal)(
|
|
2207
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1486
2208
|
"div",
|
|
1487
2209
|
{
|
|
1488
2210
|
id,
|
|
@@ -1502,7 +2224,7 @@ var Tooltip = React22.forwardRef(
|
|
|
1502
2224
|
Tooltip.displayName = "Tooltip";
|
|
1503
2225
|
|
|
1504
2226
|
// src/components/form-field/FormField.tsx
|
|
1505
|
-
var
|
|
2227
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1506
2228
|
var FormField = ({
|
|
1507
2229
|
id,
|
|
1508
2230
|
label,
|
|
@@ -1520,48 +2242,48 @@ var FormField = ({
|
|
|
1520
2242
|
const errorId = `${id}-error`;
|
|
1521
2243
|
const describedBy = error ? errorId : hint ? hintId : void 0;
|
|
1522
2244
|
let control = children;
|
|
1523
|
-
if (
|
|
1524
|
-
control =
|
|
2245
|
+
if (React27.isValidElement(children) && children.type !== React27.Fragment) {
|
|
2246
|
+
control = React27.cloneElement(children, {
|
|
1525
2247
|
id,
|
|
1526
2248
|
"aria-describedby": describedBy,
|
|
1527
2249
|
...error ? { "aria-invalid": true } : {}
|
|
1528
2250
|
});
|
|
1529
2251
|
}
|
|
1530
|
-
const labelNode = /* @__PURE__ */ (0,
|
|
2252
|
+
const labelNode = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Label, { htmlFor: id, className: labelHidden ? "sr-only" : void 0, children: [
|
|
1531
2253
|
label,
|
|
1532
|
-
required && /* @__PURE__ */ (0,
|
|
2254
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1533
2255
|
" ",
|
|
1534
|
-
/* @__PURE__ */ (0,
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { "aria-hidden": "true", className: "ml-0.5 text-destructive", children: "*" })
|
|
1535
2257
|
] })
|
|
1536
2258
|
] });
|
|
1537
|
-
const tooltipNode = tooltip ? /* @__PURE__ */ (0,
|
|
2259
|
+
const tooltipNode = tooltip ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Tooltip, { content: tooltip, side: "top", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1538
2260
|
"button",
|
|
1539
2261
|
{
|
|
1540
2262
|
type: "button",
|
|
1541
2263
|
"aria-label": `${label} information`,
|
|
1542
2264
|
className: "ml-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1543
|
-
children: /* @__PURE__ */ (0,
|
|
2265
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM8 7a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 7Zm0-2.25a.9.9 0 1 1 0 1.8.9.9 0 0 1 0-1.8Z" }) })
|
|
1544
2266
|
}
|
|
1545
2267
|
) }) : null;
|
|
1546
|
-
const hintOrError = error ? /* @__PURE__ */ (0,
|
|
2268
|
+
const hintOrError = error ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { id: errorId, role: "alert", className: "text-xs text-destructive", children: error }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { id: hintId, className: "text-xs text-muted-foreground", children: hint }) : null;
|
|
1547
2269
|
if (labelPlacement === "left") {
|
|
1548
|
-
return /* @__PURE__ */ (0,
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
2270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn("flex min-w-0 flex-col gap-1.5", className), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex w-40 shrink-0 items-center gap-1 pt-2", children: [
|
|
1550
2272
|
labelNode,
|
|
1551
2273
|
tooltipNode
|
|
1552
2274
|
] }),
|
|
1553
|
-
/* @__PURE__ */ (0,
|
|
1554
|
-
/* @__PURE__ */ (0,
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1556
|
-
trailing && /* @__PURE__ */ (0,
|
|
2275
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2277
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "min-w-0 flex-1", children: control }),
|
|
2278
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: trailing })
|
|
1557
2279
|
] }),
|
|
1558
2280
|
hintOrError
|
|
1559
2281
|
] })
|
|
1560
2282
|
] }) });
|
|
1561
2283
|
}
|
|
1562
|
-
return /* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1564
|
-
/* @__PURE__ */ (0,
|
|
2284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("flex min-w-0 flex-col gap-1.5", className), children: [
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2286
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex min-w-0 items-center", children: [
|
|
1565
2287
|
labelNode,
|
|
1566
2288
|
tooltipNode
|
|
1567
2289
|
] }),
|
|
@@ -1574,12 +2296,12 @@ var FormField = ({
|
|
|
1574
2296
|
FormField.displayName = "FormField";
|
|
1575
2297
|
|
|
1576
2298
|
// src/components/form/Form.tsx
|
|
1577
|
-
var
|
|
1578
|
-
var
|
|
1579
|
-
var Form =
|
|
2299
|
+
var React28 = __toESM(require("react"));
|
|
2300
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2301
|
+
var Form = React28.forwardRef(
|
|
1580
2302
|
({ variant = "default", gap, className, style, ...props }, ref) => {
|
|
1581
2303
|
const gapResolved = resolveGap(gap ?? "md");
|
|
1582
|
-
return /* @__PURE__ */ (0,
|
|
2304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1583
2305
|
"form",
|
|
1584
2306
|
{
|
|
1585
2307
|
ref,
|
|
@@ -1599,15 +2321,15 @@ var Form = React24.forwardRef(
|
|
|
1599
2321
|
Form.displayName = "Form";
|
|
1600
2322
|
|
|
1601
2323
|
// src/components/form-layout/FormLayout.tsx
|
|
1602
|
-
var
|
|
1603
|
-
var
|
|
2324
|
+
var React29 = __toESM(require("react"));
|
|
2325
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1604
2326
|
var GRID_COLUMNS = {
|
|
1605
2327
|
1: "grid-cols-1",
|
|
1606
2328
|
2: "grid-cols-2",
|
|
1607
2329
|
3: "grid-cols-3",
|
|
1608
2330
|
4: "grid-cols-4"
|
|
1609
2331
|
};
|
|
1610
|
-
var FormLayout =
|
|
2332
|
+
var FormLayout = React29.forwardRef(
|
|
1611
2333
|
({
|
|
1612
2334
|
layout = "stack",
|
|
1613
2335
|
columns = 2,
|
|
@@ -1622,7 +2344,7 @@ var FormLayout = React25.forwardRef(
|
|
|
1622
2344
|
}, ref) => {
|
|
1623
2345
|
const Tag = as;
|
|
1624
2346
|
const gapResolved = resolveGap(gap ?? "md");
|
|
1625
|
-
return /* @__PURE__ */ (0,
|
|
2347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1626
2348
|
Tag,
|
|
1627
2349
|
{
|
|
1628
2350
|
ref,
|
|
@@ -1637,8 +2359,8 @@ var FormLayout = React25.forwardRef(
|
|
|
1637
2359
|
style: { ...gapResolved.style, ...style },
|
|
1638
2360
|
...props,
|
|
1639
2361
|
children: [
|
|
1640
|
-
legend && as === "fieldset" && /* @__PURE__ */ (0,
|
|
1641
|
-
description && as === "fieldset" && /* @__PURE__ */ (0,
|
|
2362
|
+
legend && as === "fieldset" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("legend", { className: "col-span-full p-0 text-sm font-medium leading-none", children: legend }),
|
|
2363
|
+
description && as === "fieldset" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "col-span-full text-xs text-muted-foreground", children: description }),
|
|
1642
2364
|
children
|
|
1643
2365
|
]
|
|
1644
2366
|
}
|
|
@@ -1648,17 +2370,17 @@ var FormLayout = React25.forwardRef(
|
|
|
1648
2370
|
FormLayout.displayName = "FormLayout";
|
|
1649
2371
|
|
|
1650
2372
|
// src/components/switch/Switch.tsx
|
|
1651
|
-
var
|
|
1652
|
-
var
|
|
1653
|
-
var Switch =
|
|
2373
|
+
var React30 = __toESM(require("react"));
|
|
2374
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2375
|
+
var Switch = React30.forwardRef(
|
|
1654
2376
|
({ className, checked, defaultChecked, onCheckedChange, disabled, ...props }, ref) => {
|
|
1655
|
-
const [internalChecked, setInternalChecked] =
|
|
2377
|
+
const [internalChecked, setInternalChecked] = React30.useState(defaultChecked ?? false);
|
|
1656
2378
|
const isOn = checked ?? internalChecked;
|
|
1657
2379
|
const toggle = () => {
|
|
1658
2380
|
if (checked === void 0) setInternalChecked((prev) => !prev);
|
|
1659
2381
|
onCheckedChange?.(!isOn);
|
|
1660
2382
|
};
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
2383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1662
2384
|
"button",
|
|
1663
2385
|
{
|
|
1664
2386
|
type: "button",
|
|
@@ -1675,7 +2397,7 @@ var Switch = React26.forwardRef(
|
|
|
1675
2397
|
className
|
|
1676
2398
|
),
|
|
1677
2399
|
...props,
|
|
1678
|
-
children: /* @__PURE__ */ (0,
|
|
2400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1679
2401
|
"span",
|
|
1680
2402
|
{
|
|
1681
2403
|
"aria-hidden": "true",
|
|
@@ -1692,9 +2414,9 @@ var Switch = React26.forwardRef(
|
|
|
1692
2414
|
Switch.displayName = "Switch";
|
|
1693
2415
|
|
|
1694
2416
|
// src/components/separator/Separator.tsx
|
|
1695
|
-
var
|
|
2417
|
+
var React31 = __toESM(require("react"));
|
|
1696
2418
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
1697
|
-
var
|
|
2419
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1698
2420
|
var separatorVariants = (0, import_class_variance_authority4.cva)("shrink-0 bg-border", {
|
|
1699
2421
|
variants: {
|
|
1700
2422
|
orientation: {
|
|
@@ -1706,8 +2428,8 @@ var separatorVariants = (0, import_class_variance_authority4.cva)("shrink-0 bg-b
|
|
|
1706
2428
|
orientation: "horizontal"
|
|
1707
2429
|
}
|
|
1708
2430
|
});
|
|
1709
|
-
var Separator =
|
|
1710
|
-
({ className, orientation, label, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2431
|
+
var Separator = React31.forwardRef(
|
|
2432
|
+
({ className, orientation, label, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1711
2433
|
"div",
|
|
1712
2434
|
{
|
|
1713
2435
|
ref,
|
|
@@ -1723,8 +2445,8 @@ Separator.displayName = "Separator";
|
|
|
1723
2445
|
var Divider = Separator;
|
|
1724
2446
|
|
|
1725
2447
|
// src/components/skeleton/Skeleton.tsx
|
|
1726
|
-
var
|
|
1727
|
-
var
|
|
2448
|
+
var React32 = __toESM(require("react"));
|
|
2449
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1728
2450
|
var roundedClasses = {
|
|
1729
2451
|
none: "rounded-none",
|
|
1730
2452
|
sm: "rounded-sm",
|
|
@@ -1732,8 +2454,8 @@ var roundedClasses = {
|
|
|
1732
2454
|
lg: "rounded-lg",
|
|
1733
2455
|
full: "rounded-full"
|
|
1734
2456
|
};
|
|
1735
|
-
var Skeleton =
|
|
1736
|
-
({ className, height, width, rounded = "md", ...props }, ref) => /* @__PURE__ */ (0,
|
|
2457
|
+
var Skeleton = React32.forwardRef(
|
|
2458
|
+
({ className, height, width, rounded = "md", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1737
2459
|
"div",
|
|
1738
2460
|
{
|
|
1739
2461
|
ref,
|
|
@@ -1751,14 +2473,14 @@ var Skeleton = React28.forwardRef(
|
|
|
1751
2473
|
);
|
|
1752
2474
|
Skeleton.displayName = "Skeleton";
|
|
1753
2475
|
|
|
1754
|
-
// src/components/progress/Progress.tsx
|
|
1755
|
-
var
|
|
1756
|
-
var
|
|
1757
|
-
var Progress =
|
|
2476
|
+
// src/components/progress/Progress.tsx
|
|
2477
|
+
var React33 = __toESM(require("react"));
|
|
2478
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2479
|
+
var Progress = React33.forwardRef(
|
|
1758
2480
|
({ className, value = 0, max = 100, label, ...props }, ref) => {
|
|
1759
2481
|
const clamped = Math.min(Math.max(value, 0), max);
|
|
1760
2482
|
const percent = max > 0 ? clamped / max * 100 : 0;
|
|
1761
|
-
return /* @__PURE__ */ (0,
|
|
2483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1762
2484
|
"div",
|
|
1763
2485
|
{
|
|
1764
2486
|
ref,
|
|
@@ -1769,7 +2491,7 @@ var Progress = React29.forwardRef(
|
|
|
1769
2491
|
"aria-label": label,
|
|
1770
2492
|
className: cn("relative h-2 w-full overflow-hidden rounded-full bg-muted", className),
|
|
1771
2493
|
...props,
|
|
1772
|
-
children: /* @__PURE__ */ (0,
|
|
2494
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1773
2495
|
"div",
|
|
1774
2496
|
{
|
|
1775
2497
|
className: "h-full bg-primary transition-all duration-300 motion-reduce:transition-none",
|
|
@@ -1783,10 +2505,10 @@ var Progress = React29.forwardRef(
|
|
|
1783
2505
|
Progress.displayName = "Progress";
|
|
1784
2506
|
|
|
1785
2507
|
// src/components/tabs/Tabs.tsx
|
|
1786
|
-
var
|
|
2508
|
+
var React34 = __toESM(require("react"));
|
|
1787
2509
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
1788
|
-
var
|
|
1789
|
-
var TabsContext =
|
|
2510
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2511
|
+
var TabsContext = React34.createContext({
|
|
1790
2512
|
value: "",
|
|
1791
2513
|
setValue: () => {
|
|
1792
2514
|
},
|
|
@@ -1794,19 +2516,19 @@ var TabsContext = React30.createContext({
|
|
|
1794
2516
|
variant: "default",
|
|
1795
2517
|
size: "md"
|
|
1796
2518
|
});
|
|
1797
|
-
var Tabs =
|
|
2519
|
+
var Tabs = React34.forwardRef(
|
|
1798
2520
|
({ value, defaultValue, onValueChange, variant = "default", size = "md", className, children }, ref) => {
|
|
1799
|
-
const [internalValue, setInternalValue] =
|
|
2521
|
+
const [internalValue, setInternalValue] = React34.useState(defaultValue ?? "");
|
|
1800
2522
|
const current = value ?? internalValue;
|
|
1801
|
-
const baseId =
|
|
1802
|
-
const setValue =
|
|
2523
|
+
const baseId = React34.useId();
|
|
2524
|
+
const setValue = React34.useCallback(
|
|
1803
2525
|
(next) => {
|
|
1804
2526
|
if (value === void 0) setInternalValue(next);
|
|
1805
2527
|
onValueChange?.(next);
|
|
1806
2528
|
},
|
|
1807
2529
|
[value, onValueChange]
|
|
1808
2530
|
);
|
|
1809
|
-
return /* @__PURE__ */ (0,
|
|
2531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref, className, "data-value": current, "data-variant": variant, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TabsContext.Provider, { value: { value: current, setValue, baseId, variant, size }, children }) });
|
|
1810
2532
|
}
|
|
1811
2533
|
);
|
|
1812
2534
|
Tabs.displayName = "Tabs";
|
|
@@ -1828,10 +2550,10 @@ var tabsListVariants = (0, import_class_variance_authority5.cva)("inline-flex it
|
|
|
1828
2550
|
},
|
|
1829
2551
|
defaultVariants: { variant: "default", size: "md" }
|
|
1830
2552
|
});
|
|
1831
|
-
var TabsList =
|
|
2553
|
+
var TabsList = React34.forwardRef(
|
|
1832
2554
|
({ className, ...props }, ref) => {
|
|
1833
|
-
const ctx =
|
|
1834
|
-
return /* @__PURE__ */ (0,
|
|
2555
|
+
const ctx = React34.useContext(TabsContext);
|
|
2556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1835
2557
|
"div",
|
|
1836
2558
|
{
|
|
1837
2559
|
ref,
|
|
@@ -1871,9 +2593,9 @@ var triggerInactiveByVariant = {
|
|
|
1871
2593
|
underline: "border-transparent text-muted-foreground hover:border-border hover:text-foreground",
|
|
1872
2594
|
rounded: "hover:text-foreground"
|
|
1873
2595
|
};
|
|
1874
|
-
var TabsTrigger =
|
|
2596
|
+
var TabsTrigger = React34.forwardRef(
|
|
1875
2597
|
({ value, className, onKeyDown, ...props }, ref) => {
|
|
1876
|
-
const ctx =
|
|
2598
|
+
const ctx = React34.useContext(TabsContext);
|
|
1877
2599
|
const active = ctx.value === value;
|
|
1878
2600
|
const focusAt = (tabs, index) => {
|
|
1879
2601
|
if (tabs.length === 0) return;
|
|
@@ -1883,7 +2605,7 @@ var TabsTrigger = React30.forwardRef(
|
|
|
1883
2605
|
target.click();
|
|
1884
2606
|
};
|
|
1885
2607
|
const siblingTabs = (button) => Array.from(button.parentElement?.querySelectorAll('[role="tab"]') ?? []);
|
|
1886
|
-
return /* @__PURE__ */ (0,
|
|
2608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1887
2609
|
"button",
|
|
1888
2610
|
{
|
|
1889
2611
|
ref,
|
|
@@ -1929,11 +2651,11 @@ var TabsTrigger = React30.forwardRef(
|
|
|
1929
2651
|
}
|
|
1930
2652
|
);
|
|
1931
2653
|
TabsTrigger.displayName = "TabsTrigger";
|
|
1932
|
-
var TabsContent =
|
|
2654
|
+
var TabsContent = React34.forwardRef(
|
|
1933
2655
|
({ value, className, ...props }, ref) => {
|
|
1934
|
-
const ctx =
|
|
2656
|
+
const ctx = React34.useContext(TabsContext);
|
|
1935
2657
|
const active = ctx.value === value;
|
|
1936
|
-
return /* @__PURE__ */ (0,
|
|
2658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1937
2659
|
"div",
|
|
1938
2660
|
{
|
|
1939
2661
|
ref,
|
|
@@ -1955,25 +2677,29 @@ var TabsContent = React30.forwardRef(
|
|
|
1955
2677
|
TabsContent.displayName = "TabsContent";
|
|
1956
2678
|
|
|
1957
2679
|
// src/components/card/Card.tsx
|
|
1958
|
-
var
|
|
1959
|
-
var
|
|
1960
|
-
var
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
2680
|
+
var React35 = __toESM(require("react"));
|
|
2681
|
+
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
2682
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2683
|
+
var Card = React35.forwardRef(
|
|
2684
|
+
({ className, asChild = false, ...props }, ref) => {
|
|
2685
|
+
const Comp = asChild ? import_react_slot3.Slot : "div";
|
|
2686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2687
|
+
Comp,
|
|
2688
|
+
{
|
|
2689
|
+
ref,
|
|
2690
|
+
className: cn("rounded-xl border border-border bg-card text-card-foreground shadow-sm", className),
|
|
2691
|
+
...props
|
|
2692
|
+
}
|
|
2693
|
+
);
|
|
2694
|
+
}
|
|
1969
2695
|
);
|
|
1970
2696
|
Card.displayName = "Card";
|
|
1971
|
-
var CardHeader =
|
|
1972
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2697
|
+
var CardHeader = React35.forwardRef(
|
|
2698
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
1973
2699
|
);
|
|
1974
2700
|
CardHeader.displayName = "CardHeader";
|
|
1975
|
-
var CardTitle =
|
|
1976
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2701
|
+
var CardTitle = React35.forwardRef(
|
|
2702
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1977
2703
|
"h3",
|
|
1978
2704
|
{
|
|
1979
2705
|
ref,
|
|
@@ -1983,29 +2709,29 @@ var CardTitle = React31.forwardRef(
|
|
|
1983
2709
|
)
|
|
1984
2710
|
);
|
|
1985
2711
|
CardTitle.displayName = "CardTitle";
|
|
1986
|
-
var CardDescription =
|
|
1987
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2712
|
+
var CardDescription = React35.forwardRef(
|
|
2713
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
|
|
1988
2714
|
);
|
|
1989
2715
|
CardDescription.displayName = "CardDescription";
|
|
1990
|
-
var CardContent =
|
|
1991
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2716
|
+
var CardContent = React35.forwardRef(
|
|
2717
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
1992
2718
|
);
|
|
1993
2719
|
CardContent.displayName = "CardContent";
|
|
1994
|
-
var CardFooter =
|
|
1995
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2720
|
+
var CardFooter = React35.forwardRef(
|
|
2721
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
1996
2722
|
);
|
|
1997
2723
|
CardFooter.displayName = "CardFooter";
|
|
1998
2724
|
|
|
1999
2725
|
// src/components/accordion/Accordion.tsx
|
|
2000
|
-
var
|
|
2001
|
-
var
|
|
2002
|
-
var AccordionContext =
|
|
2726
|
+
var React36 = __toESM(require("react"));
|
|
2727
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2728
|
+
var AccordionContext = React36.createContext({
|
|
2003
2729
|
openItems: /* @__PURE__ */ new Set(),
|
|
2004
2730
|
toggle: () => {
|
|
2005
2731
|
},
|
|
2006
2732
|
collapsible: true
|
|
2007
2733
|
});
|
|
2008
|
-
var Accordion =
|
|
2734
|
+
var Accordion = React36.forwardRef(
|
|
2009
2735
|
({
|
|
2010
2736
|
value,
|
|
2011
2737
|
defaultValue = [],
|
|
@@ -2017,9 +2743,9 @@ var Accordion = React32.forwardRef(
|
|
|
2017
2743
|
style,
|
|
2018
2744
|
children
|
|
2019
2745
|
}, ref) => {
|
|
2020
|
-
const [internalOpen, setInternalOpen] =
|
|
2746
|
+
const [internalOpen, setInternalOpen] = React36.useState(defaultValue);
|
|
2021
2747
|
const current = value ?? internalOpen;
|
|
2022
|
-
const toggle =
|
|
2748
|
+
const toggle = React36.useCallback(
|
|
2023
2749
|
(id) => {
|
|
2024
2750
|
const next = current.includes(id) ? current.filter((item) => item !== id) : collapsible ? [id] : [...current, id];
|
|
2025
2751
|
if (value === void 0) setInternalOpen(next);
|
|
@@ -2028,7 +2754,7 @@ var Accordion = React32.forwardRef(
|
|
|
2028
2754
|
[current, collapsible, value, onValueChange]
|
|
2029
2755
|
);
|
|
2030
2756
|
const gapResolved = resolveGap(gap);
|
|
2031
|
-
return /* @__PURE__ */ (0,
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2032
2758
|
"div",
|
|
2033
2759
|
{
|
|
2034
2760
|
ref,
|
|
@@ -2041,25 +2767,25 @@ var Accordion = React32.forwardRef(
|
|
|
2041
2767
|
className
|
|
2042
2768
|
),
|
|
2043
2769
|
style: { ...gapResolved.style, ...style },
|
|
2044
|
-
children: /* @__PURE__ */ (0,
|
|
2770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionContext.Provider, { value: { openItems: new Set(current), toggle, collapsible }, children })
|
|
2045
2771
|
}
|
|
2046
2772
|
);
|
|
2047
2773
|
}
|
|
2048
2774
|
);
|
|
2049
2775
|
Accordion.displayName = "Accordion";
|
|
2050
|
-
var AccordionItem =
|
|
2051
|
-
({ id, className, children }, ref) => /* @__PURE__ */ (0,
|
|
2776
|
+
var AccordionItem = React36.forwardRef(
|
|
2777
|
+
({ id, className, children }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref, "data-accordion-item": id, className, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionItemContext.Provider, { value: { id }, children }) })
|
|
2052
2778
|
);
|
|
2053
2779
|
AccordionItem.displayName = "AccordionItem";
|
|
2054
|
-
var AccordionItemContext =
|
|
2055
|
-
var AccordionTrigger =
|
|
2780
|
+
var AccordionItemContext = React36.createContext({ id: "" });
|
|
2781
|
+
var AccordionTrigger = React36.forwardRef(
|
|
2056
2782
|
({ className, children, icon, ...props }, ref) => {
|
|
2057
|
-
const { id } =
|
|
2058
|
-
const { openItems, toggle } =
|
|
2783
|
+
const { id } = React36.useContext(AccordionItemContext);
|
|
2784
|
+
const { openItems, toggle } = React36.useContext(AccordionContext);
|
|
2059
2785
|
const open = openItems.has(id);
|
|
2060
2786
|
const panelId = `${id}-panel`;
|
|
2061
2787
|
const triggerId = `${id}-trigger`;
|
|
2062
|
-
return /* @__PURE__ */ (0,
|
|
2788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2063
2789
|
"button",
|
|
2064
2790
|
{
|
|
2065
2791
|
ref,
|
|
@@ -2078,7 +2804,7 @@ var AccordionTrigger = React32.forwardRef(
|
|
|
2078
2804
|
...props,
|
|
2079
2805
|
children: [
|
|
2080
2806
|
children,
|
|
2081
|
-
icon ?? /* @__PURE__ */ (0,
|
|
2807
|
+
icon ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2082
2808
|
"svg",
|
|
2083
2809
|
{
|
|
2084
2810
|
"aria-hidden": "true",
|
|
@@ -2088,7 +2814,7 @@ var AccordionTrigger = React32.forwardRef(
|
|
|
2088
2814
|
strokeWidth: "2",
|
|
2089
2815
|
strokeLinecap: "round",
|
|
2090
2816
|
className: cn("h-4 w-4 shrink-0 transition-transform duration-200", open && "rotate-180"),
|
|
2091
|
-
children: /* @__PURE__ */ (0,
|
|
2817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
2092
2818
|
}
|
|
2093
2819
|
)
|
|
2094
2820
|
]
|
|
@@ -2097,13 +2823,13 @@ var AccordionTrigger = React32.forwardRef(
|
|
|
2097
2823
|
}
|
|
2098
2824
|
);
|
|
2099
2825
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
2100
|
-
var AccordionContent =
|
|
2826
|
+
var AccordionContent = React36.forwardRef(
|
|
2101
2827
|
({ className, children, ...props }, ref) => {
|
|
2102
|
-
const { id } =
|
|
2103
|
-
const { openItems } =
|
|
2828
|
+
const { id } = React36.useContext(AccordionItemContext);
|
|
2829
|
+
const { openItems } = React36.useContext(AccordionContext);
|
|
2104
2830
|
const open = openItems.has(id);
|
|
2105
|
-
const [expanded, setExpanded] =
|
|
2106
|
-
|
|
2831
|
+
const [expanded, setExpanded] = React36.useState(open);
|
|
2832
|
+
React36.useEffect(() => {
|
|
2107
2833
|
if (!open) {
|
|
2108
2834
|
setExpanded(false);
|
|
2109
2835
|
return;
|
|
@@ -2122,7 +2848,7 @@ var AccordionContent = React32.forwardRef(
|
|
|
2122
2848
|
cancelAnimationFrame(second);
|
|
2123
2849
|
};
|
|
2124
2850
|
}, [open]);
|
|
2125
|
-
return /* @__PURE__ */ (0,
|
|
2851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2126
2852
|
"div",
|
|
2127
2853
|
{
|
|
2128
2854
|
ref,
|
|
@@ -2141,7 +2867,7 @@ var AccordionContent = React32.forwardRef(
|
|
|
2141
2867
|
className
|
|
2142
2868
|
),
|
|
2143
2869
|
...props,
|
|
2144
|
-
children: /* @__PURE__ */ (0,
|
|
2870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "px-4 pb-3 text-sm text-muted-foreground", children }) })
|
|
2145
2871
|
}
|
|
2146
2872
|
);
|
|
2147
2873
|
}
|
|
@@ -2149,10 +2875,10 @@ var AccordionContent = React32.forwardRef(
|
|
|
2149
2875
|
AccordionContent.displayName = "AccordionContent";
|
|
2150
2876
|
|
|
2151
2877
|
// src/components/table/Table.tsx
|
|
2152
|
-
var
|
|
2153
|
-
var
|
|
2154
|
-
var Table =
|
|
2155
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2878
|
+
var React37 = __toESM(require("react"));
|
|
2879
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2880
|
+
var Table = React37.forwardRef(
|
|
2881
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2156
2882
|
"table",
|
|
2157
2883
|
{
|
|
2158
2884
|
ref,
|
|
@@ -2162,16 +2888,16 @@ var Table = React33.forwardRef(
|
|
|
2162
2888
|
) })
|
|
2163
2889
|
);
|
|
2164
2890
|
Table.displayName = "Table";
|
|
2165
|
-
var TableHeader =
|
|
2166
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2891
|
+
var TableHeader = React37.forwardRef(
|
|
2892
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
|
|
2167
2893
|
);
|
|
2168
2894
|
TableHeader.displayName = "TableHeader";
|
|
2169
|
-
var TableBody =
|
|
2170
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2895
|
+
var TableBody = React37.forwardRef(
|
|
2896
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props })
|
|
2171
2897
|
);
|
|
2172
2898
|
TableBody.displayName = "TableBody";
|
|
2173
|
-
var TableFooter =
|
|
2174
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2899
|
+
var TableFooter = React37.forwardRef(
|
|
2900
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2175
2901
|
"tfoot",
|
|
2176
2902
|
{
|
|
2177
2903
|
ref,
|
|
@@ -2181,8 +2907,8 @@ var TableFooter = React33.forwardRef(
|
|
|
2181
2907
|
)
|
|
2182
2908
|
);
|
|
2183
2909
|
TableFooter.displayName = "TableFooter";
|
|
2184
|
-
var TableRow =
|
|
2185
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2910
|
+
var TableRow = React37.forwardRef(
|
|
2911
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2186
2912
|
"tr",
|
|
2187
2913
|
{
|
|
2188
2914
|
ref,
|
|
@@ -2195,8 +2921,8 @@ var TableRow = React33.forwardRef(
|
|
|
2195
2921
|
)
|
|
2196
2922
|
);
|
|
2197
2923
|
TableRow.displayName = "TableRow";
|
|
2198
|
-
var TableHead =
|
|
2199
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2924
|
+
var TableHead = React37.forwardRef(
|
|
2925
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2200
2926
|
"th",
|
|
2201
2927
|
{
|
|
2202
2928
|
ref,
|
|
@@ -2210,26 +2936,32 @@ var TableHead = React33.forwardRef(
|
|
|
2210
2936
|
)
|
|
2211
2937
|
);
|
|
2212
2938
|
TableHead.displayName = "TableHead";
|
|
2213
|
-
var TableCell =
|
|
2214
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2939
|
+
var TableCell = React37.forwardRef(
|
|
2940
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("td", { ref, className: cn("px-3 py-2 align-middle", className), ...props })
|
|
2215
2941
|
);
|
|
2216
2942
|
TableCell.displayName = "TableCell";
|
|
2217
|
-
var TableCaption =
|
|
2218
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2943
|
+
var TableCaption = React37.forwardRef(
|
|
2944
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("caption", { ref, className: cn("mt-3 text-xs text-muted-foreground", className), ...props })
|
|
2219
2945
|
);
|
|
2220
2946
|
TableCaption.displayName = "TableCaption";
|
|
2221
2947
|
|
|
2222
2948
|
// src/components/data-table/DataTable.tsx
|
|
2223
|
-
var
|
|
2949
|
+
var React39 = __toESM(require("react"));
|
|
2224
2950
|
|
|
2225
2951
|
// src/components/pagination/Pagination.tsx
|
|
2226
|
-
var
|
|
2227
|
-
var
|
|
2952
|
+
var React38 = __toESM(require("react"));
|
|
2953
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2228
2954
|
var controlClass = "inline-flex h-8 items-center rounded-md border border-border px-2.5 text-sm transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
|
|
2229
|
-
var Pagination =
|
|
2955
|
+
var Pagination = React38.forwardRef(
|
|
2230
2956
|
({
|
|
2231
|
-
page,
|
|
2232
|
-
pageCount,
|
|
2957
|
+
page: pageProp,
|
|
2958
|
+
pageCount: pageCountProp,
|
|
2959
|
+
currentPage,
|
|
2960
|
+
totalPages,
|
|
2961
|
+
pageSize,
|
|
2962
|
+
total,
|
|
2963
|
+
itemLabel = "items",
|
|
2964
|
+
showSummary,
|
|
2233
2965
|
onPageChange,
|
|
2234
2966
|
siblings = 1,
|
|
2235
2967
|
showBoundaries = false,
|
|
@@ -2239,6 +2971,9 @@ var Pagination = React34.forwardRef(
|
|
|
2239
2971
|
className,
|
|
2240
2972
|
...props
|
|
2241
2973
|
}, ref) => {
|
|
2974
|
+
const page = pageProp ?? currentPage ?? 1;
|
|
2975
|
+
const derivedPageCount = total !== void 0 && pageSize !== void 0 && pageSize > 0 ? Math.ceil(total / pageSize) : void 0;
|
|
2976
|
+
const pageCount = Math.max(1, pageCountProp ?? totalPages ?? derivedPageCount ?? 1);
|
|
2242
2977
|
const pages = [];
|
|
2243
2978
|
const start = Math.max(2, page - siblings);
|
|
2244
2979
|
const end = Math.min(pageCount - 1, page + siblings);
|
|
@@ -2249,15 +2984,18 @@ var Pagination = React34.forwardRef(
|
|
|
2249
2984
|
if (pageCount > 1) pages.push(pageCount);
|
|
2250
2985
|
const withFirst = showFirst ?? showBoundaries;
|
|
2251
2986
|
const withLast = showLast ?? showBoundaries;
|
|
2252
|
-
|
|
2987
|
+
const summaryEnabled = showSummary ?? (total !== void 0 && pageSize !== void 0);
|
|
2988
|
+
const rangeStart = pageSize !== void 0 ? (page - 1) * pageSize + 1 : void 0;
|
|
2989
|
+
const rangeEnd = pageSize !== void 0 && total !== void 0 ? Math.min(total, page * pageSize) : void 0;
|
|
2990
|
+
const nav = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2253
2991
|
"nav",
|
|
2254
2992
|
{
|
|
2255
2993
|
ref,
|
|
2256
2994
|
"aria-label": "Pagination",
|
|
2257
|
-
className: cn("flex items-center justify-center gap-1", className),
|
|
2995
|
+
className: cn("flex items-center justify-center gap-1", summaryEnabled ? void 0 : className),
|
|
2258
2996
|
...props,
|
|
2259
2997
|
children: [
|
|
2260
|
-
withFirst && /* @__PURE__ */ (0,
|
|
2998
|
+
withFirst && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2261
2999
|
"button",
|
|
2262
3000
|
{
|
|
2263
3001
|
type: "button",
|
|
@@ -2268,7 +3006,7 @@ var Pagination = React34.forwardRef(
|
|
|
2268
3006
|
children: icons?.first ?? "\xAB"
|
|
2269
3007
|
}
|
|
2270
3008
|
),
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
3009
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2272
3010
|
"button",
|
|
2273
3011
|
{
|
|
2274
3012
|
type: "button",
|
|
@@ -2280,7 +3018,7 @@ var Pagination = React34.forwardRef(
|
|
|
2280
3018
|
}
|
|
2281
3019
|
),
|
|
2282
3020
|
pages.map(
|
|
2283
|
-
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */ (0,
|
|
3021
|
+
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2284
3022
|
"span",
|
|
2285
3023
|
{
|
|
2286
3024
|
"aria-hidden": "true",
|
|
@@ -2288,7 +3026,7 @@ var Pagination = React34.forwardRef(
|
|
|
2288
3026
|
children: "\u2026"
|
|
2289
3027
|
},
|
|
2290
3028
|
`ellipsis-${index}`
|
|
2291
|
-
) : /* @__PURE__ */ (0,
|
|
3029
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2292
3030
|
"button",
|
|
2293
3031
|
{
|
|
2294
3032
|
type: "button",
|
|
@@ -2305,7 +3043,7 @@ var Pagination = React34.forwardRef(
|
|
|
2305
3043
|
entry
|
|
2306
3044
|
)
|
|
2307
3045
|
),
|
|
2308
|
-
/* @__PURE__ */ (0,
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2309
3047
|
"button",
|
|
2310
3048
|
{
|
|
2311
3049
|
type: "button",
|
|
@@ -2316,7 +3054,7 @@ var Pagination = React34.forwardRef(
|
|
|
2316
3054
|
children: icons?.next ?? "\u203A"
|
|
2317
3055
|
}
|
|
2318
3056
|
),
|
|
2319
|
-
withLast && /* @__PURE__ */ (0,
|
|
3057
|
+
withLast && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2320
3058
|
"button",
|
|
2321
3059
|
{
|
|
2322
3060
|
type: "button",
|
|
@@ -2330,12 +3068,17 @@ var Pagination = React34.forwardRef(
|
|
|
2330
3068
|
]
|
|
2331
3069
|
}
|
|
2332
3070
|
);
|
|
3071
|
+
if (!summaryEnabled) return nav;
|
|
3072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cn("flex flex-wrap items-center justify-between gap-3", className), children: [
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-sm text-muted-foreground", children: rangeStart !== void 0 && rangeEnd !== void 0 && total !== void 0 ? `Showing ${rangeStart}\u2013${rangeEnd} of ${total} ${itemLabel}` : `Page ${page} of ${pageCount}` }),
|
|
3074
|
+
nav
|
|
3075
|
+
] });
|
|
2333
3076
|
}
|
|
2334
3077
|
);
|
|
2335
3078
|
Pagination.displayName = "Pagination";
|
|
2336
3079
|
|
|
2337
3080
|
// src/components/data-table/DataTable.tsx
|
|
2338
|
-
var
|
|
3081
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2339
3082
|
function compareValues(a, b) {
|
|
2340
3083
|
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
2341
3084
|
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
@@ -2365,9 +3108,9 @@ function DataTable({
|
|
|
2365
3108
|
loadingRows,
|
|
2366
3109
|
className
|
|
2367
3110
|
}) {
|
|
2368
|
-
const [internalSort, setInternalSort] =
|
|
2369
|
-
const [internalPage, setInternalPage] =
|
|
2370
|
-
const sort =
|
|
3111
|
+
const [internalSort, setInternalSort] = React39.useState(defaultSort);
|
|
3112
|
+
const [internalPage, setInternalPage] = React39.useState(1);
|
|
3113
|
+
const sort = React39.useMemo(() => {
|
|
2371
3114
|
if (sortKey !== void 0) {
|
|
2372
3115
|
return sortKey === null ? null : { key: sortKey, dir: sortDir ?? "asc" };
|
|
2373
3116
|
}
|
|
@@ -2384,7 +3127,7 @@ function DataTable({
|
|
|
2384
3127
|
if (page === void 0) setInternalPage(next);
|
|
2385
3128
|
onPageChange?.(next);
|
|
2386
3129
|
};
|
|
2387
|
-
const sorted =
|
|
3130
|
+
const sorted = React39.useMemo(() => {
|
|
2388
3131
|
if (!sort) return data;
|
|
2389
3132
|
const column = columns.find((c) => c.key === sort.key);
|
|
2390
3133
|
if (!column) return data;
|
|
@@ -2410,17 +3153,17 @@ function DataTable({
|
|
|
2410
3153
|
return String(raw);
|
|
2411
3154
|
};
|
|
2412
3155
|
const alignClass = (align) => align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left";
|
|
2413
|
-
return /* @__PURE__ */ (0,
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
3156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cn("w-full space-y-3", className), children: [
|
|
3157
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-full overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2415
3158
|
"table",
|
|
2416
3159
|
{
|
|
2417
3160
|
className: cn("w-full caption-bottom", density === "compact" ? "text-xs" : "text-sm"),
|
|
2418
3161
|
children: [
|
|
2419
|
-
caption && /* @__PURE__ */ (0,
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
3162
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("caption", { className: "px-3 py-2 text-left text-xs text-muted-foreground", children: caption }),
|
|
3163
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("thead", { className: cn("bg-muted/50", stickyHeader && "sticky top-0 z-10 bg-background"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tr", { children: columns.map((column) => {
|
|
2421
3164
|
const isSorted = sort?.key === column.key;
|
|
2422
3165
|
const ariaSort = !column.sortable ? void 0 : isSorted ? sort.dir === "asc" ? "ascending" : "descending" : "none";
|
|
2423
|
-
return /* @__PURE__ */ (0,
|
|
3166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2424
3167
|
"th",
|
|
2425
3168
|
{
|
|
2426
3169
|
scope: "col",
|
|
@@ -2430,7 +3173,7 @@ function DataTable({
|
|
|
2430
3173
|
alignClass(column.align),
|
|
2431
3174
|
column.className
|
|
2432
3175
|
),
|
|
2433
|
-
children: column.sortable ? /* @__PURE__ */ (0,
|
|
3176
|
+
children: column.sortable ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2434
3177
|
"button",
|
|
2435
3178
|
{
|
|
2436
3179
|
type: "button",
|
|
@@ -2438,7 +3181,7 @@ function DataTable({
|
|
|
2438
3181
|
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2439
3182
|
children: [
|
|
2440
3183
|
column.header,
|
|
2441
|
-
/* @__PURE__ */ (0,
|
|
3184
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "aria-hidden": "true", className: "text-[10px] text-muted-foreground", children: renderSortIcon ? renderSortIcon(isSorted ? sort.dir === "asc" ? "asc" : "desc" : "none") : isSorted ? sort.dir === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
|
|
2442
3185
|
]
|
|
2443
3186
|
}
|
|
2444
3187
|
) : column.header
|
|
@@ -2446,17 +3189,17 @@ function DataTable({
|
|
|
2446
3189
|
column.key
|
|
2447
3190
|
);
|
|
2448
3191
|
}) }) }),
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tbody", { "aria-busy": loading || void 0, children: loading ? Array.from(
|
|
2450
3193
|
{ length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },
|
|
2451
|
-
(_, skeletonRow) => /* @__PURE__ */ (0,
|
|
2452
|
-
) : visible.length === 0 ? /* @__PURE__ */ (0,
|
|
3194
|
+
(_, skeletonRow) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tr", { children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("td", { className: cn("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Skeleton, { className: density === "compact" ? "h-3 w-full" : "h-4 w-full" }) }, column.key)) }, `skeleton-${skeletonRow}`)
|
|
3195
|
+
) : visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2453
3196
|
"td",
|
|
2454
3197
|
{
|
|
2455
3198
|
colSpan: columns.length,
|
|
2456
3199
|
className: "px-3 py-8 text-center text-sm text-muted-foreground",
|
|
2457
3200
|
children: emptyMessage
|
|
2458
3201
|
}
|
|
2459
|
-
) }) : visible.map((row, index) => /* @__PURE__ */ (0,
|
|
3202
|
+
) }) : visible.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2460
3203
|
"tr",
|
|
2461
3204
|
{
|
|
2462
3205
|
tabIndex: onRowClick ? 0 : void 0,
|
|
@@ -2472,7 +3215,7 @@ function DataTable({
|
|
|
2472
3215
|
zebra && "[&:nth-child(odd)]:bg-muted/30",
|
|
2473
3216
|
onRowClick && "cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
|
|
2474
3217
|
),
|
|
2475
|
-
children: columns.map((column) => /* @__PURE__ */ (0,
|
|
3218
|
+
children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2476
3219
|
"td",
|
|
2477
3220
|
{
|
|
2478
3221
|
className: cn(
|
|
@@ -2481,7 +3224,7 @@ function DataTable({
|
|
|
2481
3224
|
alignClass(column.align),
|
|
2482
3225
|
column.className
|
|
2483
3226
|
),
|
|
2484
|
-
children: column.onClick ? /* @__PURE__ */ (0,
|
|
3227
|
+
children: column.onClick ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2485
3228
|
"button",
|
|
2486
3229
|
{
|
|
2487
3230
|
type: "button",
|
|
@@ -2499,8 +3242,8 @@ function DataTable({
|
|
|
2499
3242
|
]
|
|
2500
3243
|
}
|
|
2501
3244
|
) }),
|
|
2502
|
-
pageSize && pageCount > 1 && /* @__PURE__ */ (0,
|
|
2503
|
-
/* @__PURE__ */ (0,
|
|
3245
|
+
pageSize && pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [
|
|
3246
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2504
3247
|
"p",
|
|
2505
3248
|
{
|
|
2506
3249
|
className: "min-h-8 leading-none text-xs text-muted-foreground",
|
|
@@ -2515,16 +3258,16 @@ function DataTable({
|
|
|
2515
3258
|
]
|
|
2516
3259
|
}
|
|
2517
3260
|
),
|
|
2518
|
-
/* @__PURE__ */ (0,
|
|
3261
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Pagination, { page: safePage, pageCount, onPageChange: setPage })
|
|
2519
3262
|
] })
|
|
2520
3263
|
] });
|
|
2521
3264
|
}
|
|
2522
3265
|
|
|
2523
3266
|
// src/components/list/List.tsx
|
|
2524
|
-
var
|
|
2525
|
-
var
|
|
2526
|
-
var List =
|
|
2527
|
-
({ divided, bordered, size = "default", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3267
|
+
var React40 = __toESM(require("react"));
|
|
3268
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3269
|
+
var List = React40.forwardRef(
|
|
3270
|
+
({ divided, bordered, size = "default", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2528
3271
|
"ul",
|
|
2529
3272
|
{
|
|
2530
3273
|
ref,
|
|
@@ -2540,7 +3283,7 @@ var List = React36.forwardRef(
|
|
|
2540
3283
|
)
|
|
2541
3284
|
);
|
|
2542
3285
|
List.displayName = "List";
|
|
2543
|
-
var ListItem =
|
|
3286
|
+
var ListItem = React40.forwardRef(
|
|
2544
3287
|
({ leading, trailing, selected, onClick, description, disabled, className, children, ...props }, ref) => {
|
|
2545
3288
|
const padding = "px-3 py-2.5";
|
|
2546
3289
|
const rowClass = cn(
|
|
@@ -2550,23 +3293,23 @@ var ListItem = React36.forwardRef(
|
|
|
2550
3293
|
disabled && "opacity-50",
|
|
2551
3294
|
className
|
|
2552
3295
|
);
|
|
2553
|
-
const body = /* @__PURE__ */ (0,
|
|
2554
|
-
leading && /* @__PURE__ */ (0,
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2557
|
-
description && /* @__PURE__ */ (0,
|
|
3296
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
3297
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "flex shrink-0 items-center", children: leading }),
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "block truncate", children }),
|
|
3300
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "mt-0.5 block truncate text-xs text-muted-foreground", children: description })
|
|
2558
3301
|
] }),
|
|
2559
|
-
trailing && /* @__PURE__ */ (0,
|
|
3302
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "flex shrink-0 items-center text-xs text-muted-foreground", children: trailing })
|
|
2560
3303
|
] });
|
|
2561
|
-
return /* @__PURE__ */ (0,
|
|
3304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { ref, ...props, children: onClick ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", onClick, disabled, className: cn(padding, rowClass), children: body }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: cn(padding, rowClass), children: body }) });
|
|
2562
3305
|
}
|
|
2563
3306
|
);
|
|
2564
3307
|
ListItem.displayName = "ListItem";
|
|
2565
3308
|
|
|
2566
3309
|
// src/components/text/Text.tsx
|
|
2567
|
-
var
|
|
2568
|
-
var
|
|
2569
|
-
var
|
|
3310
|
+
var React41 = __toESM(require("react"));
|
|
3311
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3312
|
+
var sizeClasses3 = {
|
|
2570
3313
|
xs: "text-xs",
|
|
2571
3314
|
sm: "text-sm",
|
|
2572
3315
|
base: "text-base",
|
|
@@ -2579,15 +3322,15 @@ var weightClasses = {
|
|
|
2579
3322
|
semibold: "font-semibold",
|
|
2580
3323
|
bold: "font-bold"
|
|
2581
3324
|
};
|
|
2582
|
-
var Text =
|
|
3325
|
+
var Text = React41.forwardRef(
|
|
2583
3326
|
({ inline, size = "base", weight, muted, className, ...props }, ref) => {
|
|
2584
3327
|
const Tag = inline ? "span" : "p";
|
|
2585
|
-
return /* @__PURE__ */ (0,
|
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2586
3329
|
Tag,
|
|
2587
3330
|
{
|
|
2588
3331
|
ref,
|
|
2589
3332
|
className: cn(
|
|
2590
|
-
|
|
3333
|
+
sizeClasses3[size],
|
|
2591
3334
|
weight && weightClasses[weight],
|
|
2592
3335
|
muted && "text-muted-foreground",
|
|
2593
3336
|
inline ? "inline" : "block",
|
|
@@ -2601,8 +3344,8 @@ var Text = React37.forwardRef(
|
|
|
2601
3344
|
Text.displayName = "Text";
|
|
2602
3345
|
|
|
2603
3346
|
// src/components/heading/Heading.tsx
|
|
2604
|
-
var
|
|
2605
|
-
var
|
|
3347
|
+
var React42 = __toESM(require("react"));
|
|
3348
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2606
3349
|
var levelClasses = {
|
|
2607
3350
|
1: "text-4xl",
|
|
2608
3351
|
2: "text-3xl",
|
|
@@ -2611,7 +3354,7 @@ var levelClasses = {
|
|
|
2611
3354
|
5: "text-lg",
|
|
2612
3355
|
6: "text-base"
|
|
2613
3356
|
};
|
|
2614
|
-
var
|
|
3357
|
+
var sizeClasses4 = {
|
|
2615
3358
|
sm: "text-lg",
|
|
2616
3359
|
md: "text-xl",
|
|
2617
3360
|
lg: "text-2xl",
|
|
@@ -2619,16 +3362,16 @@ var sizeClasses3 = {
|
|
|
2619
3362
|
"2xl": "text-4xl",
|
|
2620
3363
|
"3xl": "text-5xl"
|
|
2621
3364
|
};
|
|
2622
|
-
var Heading =
|
|
3365
|
+
var Heading = React42.forwardRef(
|
|
2623
3366
|
({ level, size, muted, className, ...props }, ref) => {
|
|
2624
3367
|
const Tag = `h${level}`;
|
|
2625
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2626
3369
|
Tag,
|
|
2627
3370
|
{
|
|
2628
3371
|
ref,
|
|
2629
3372
|
className: cn(
|
|
2630
3373
|
"font-semibold tracking-tight",
|
|
2631
|
-
size ?
|
|
3374
|
+
size ? sizeClasses4[size] : levelClasses[level],
|
|
2632
3375
|
muted && "text-muted-foreground",
|
|
2633
3376
|
className
|
|
2634
3377
|
),
|
|
@@ -2639,13 +3382,448 @@ var Heading = React38.forwardRef(
|
|
|
2639
3382
|
);
|
|
2640
3383
|
Heading.displayName = "Heading";
|
|
2641
3384
|
|
|
3385
|
+
// src/components/empty-state/EmptyState.tsx
|
|
3386
|
+
var React43 = __toESM(require("react"));
|
|
3387
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3388
|
+
var EmptyState = React43.forwardRef(function EmptyState2({ icon, title, description, action, secondaryAction, size = "md", className, children, ...props }, ref) {
|
|
3389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3390
|
+
"div",
|
|
3391
|
+
{
|
|
3392
|
+
ref,
|
|
3393
|
+
className: cn(
|
|
3394
|
+
"flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center",
|
|
3395
|
+
size === "md" ? "gap-3 px-6 py-12" : "gap-2 px-4 py-6",
|
|
3396
|
+
className
|
|
3397
|
+
),
|
|
3398
|
+
...props,
|
|
3399
|
+
children: [
|
|
3400
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "text-muted-foreground [&_svg]:size-8", children: icon }),
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: cn("font-semibold", size === "md" ? "text-base" : "text-sm"), children: title }),
|
|
3402
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "max-w-sm text-sm text-muted-foreground", children: description }),
|
|
3403
|
+
children,
|
|
3404
|
+
(action || secondaryAction) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "mt-1 flex flex-wrap items-center justify-center gap-2", children: [
|
|
3405
|
+
action,
|
|
3406
|
+
secondaryAction
|
|
3407
|
+
] })
|
|
3408
|
+
]
|
|
3409
|
+
}
|
|
3410
|
+
);
|
|
3411
|
+
});
|
|
3412
|
+
|
|
3413
|
+
// src/components/page-header/PageHeader.tsx
|
|
3414
|
+
var React44 = __toESM(require("react"));
|
|
3415
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3416
|
+
var PageHeader = React44.forwardRef(function PageHeader2({ title, description, breadcrumbs, actions, className, children, ...props }, ref) {
|
|
3417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { ref, className: cn("flex flex-col gap-2", className), ...props, children: [
|
|
3418
|
+
breadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "text-sm text-muted-foreground", children: breadcrumbs }),
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", children: [
|
|
3421
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h1", { className: "text-2xl font-semibold tracking-tight", children: title }),
|
|
3422
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "mt-1 max-w-2xl text-sm text-muted-foreground", children: description })
|
|
3423
|
+
] }),
|
|
3424
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
3425
|
+
] }),
|
|
3426
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "mt-2", children })
|
|
3427
|
+
] });
|
|
3428
|
+
});
|
|
3429
|
+
|
|
3430
|
+
// src/components/metric-card/MetricCard.tsx
|
|
3431
|
+
var React45 = __toESM(require("react"));
|
|
3432
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3433
|
+
var trendClasses = {
|
|
3434
|
+
up: "text-success",
|
|
3435
|
+
down: "text-destructive",
|
|
3436
|
+
flat: "text-muted-foreground"
|
|
3437
|
+
};
|
|
3438
|
+
var trendGlyph = { up: "\u2191", down: "\u2193", flat: "\u2192" };
|
|
3439
|
+
var MetricCard = React45.forwardRef(function MetricCard2({ label, value, hint, delta, trend = "flat", icon, className, ...props }, ref) {
|
|
3440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref, className: cn("rounded-xl border border-border bg-card p-5", className), ...props, children: [
|
|
3441
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-sm text-muted-foreground", children: label }),
|
|
3443
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground [&_svg]:size-4", children: icon })
|
|
3444
|
+
] }),
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "mt-2 text-2xl font-semibold tabular-nums", children: value }),
|
|
3446
|
+
(delta || hint) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("p", { className: "mt-1 flex items-center gap-2 text-sm", children: [
|
|
3447
|
+
delta && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: cn("font-medium tabular-nums", trendClasses[trend]), children: [
|
|
3448
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": "true", children: trendGlyph[trend] }),
|
|
3449
|
+
" ",
|
|
3450
|
+
delta
|
|
3451
|
+
] }),
|
|
3452
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: hint })
|
|
3453
|
+
] })
|
|
3454
|
+
] });
|
|
3455
|
+
});
|
|
3456
|
+
|
|
3457
|
+
// src/components/password-input/PasswordInput.tsx
|
|
3458
|
+
var React46 = __toESM(require("react"));
|
|
3459
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3460
|
+
var PasswordInput = React46.forwardRef(function PasswordInput2({ className, showLabel = "Show password", hideLabel = "Hide password", ...props }, ref) {
|
|
3461
|
+
const [visible, setVisible] = React46.useState(false);
|
|
3462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cn("relative flex items-center", className), children: [
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Input, { ref, type: visible ? "text" : "password", className: "pr-24", ...props }),
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3465
|
+
Button,
|
|
3466
|
+
{
|
|
3467
|
+
type: "button",
|
|
3468
|
+
variant: "ghost",
|
|
3469
|
+
size: "sm",
|
|
3470
|
+
"aria-pressed": visible,
|
|
3471
|
+
"aria-label": visible ? hideLabel : showLabel,
|
|
3472
|
+
onClick: () => setVisible((current) => !current),
|
|
3473
|
+
className: "absolute right-1 h-8 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
3474
|
+
children: visible ? "Hide" : "Show"
|
|
3475
|
+
}
|
|
3476
|
+
)
|
|
3477
|
+
] });
|
|
3478
|
+
});
|
|
3479
|
+
|
|
3480
|
+
// src/components/auth-layout/AuthLayout.tsx
|
|
3481
|
+
var React47 = __toESM(require("react"));
|
|
3482
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3483
|
+
var sizeClasses5 = {
|
|
3484
|
+
sm: "max-w-sm",
|
|
3485
|
+
md: "max-w-md",
|
|
3486
|
+
lg: "max-w-lg"
|
|
3487
|
+
};
|
|
3488
|
+
var AuthLayout = React47.forwardRef(function AuthLayout2({ title, description, brand, footer, children, size = "md", className, ...props }, ref) {
|
|
3489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3490
|
+
"div",
|
|
3491
|
+
{
|
|
3492
|
+
ref,
|
|
3493
|
+
className: cn("flex min-h-screen flex-col items-center justify-center bg-muted/30 px-4 py-12", className),
|
|
3494
|
+
...props,
|
|
3495
|
+
children: [
|
|
3496
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "mb-6", children: brand }),
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cn("w-full rounded-xl border border-border bg-card p-6 shadow-sm sm:p-8", sizeClasses5[size]), children: [
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h1", { className: "text-xl font-semibold tracking-tight", children: title }),
|
|
3499
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: description }),
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "mt-6", children })
|
|
3501
|
+
] }),
|
|
3502
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "mt-6 text-center text-sm text-muted-foreground", children: footer })
|
|
3503
|
+
]
|
|
3504
|
+
}
|
|
3505
|
+
);
|
|
3506
|
+
});
|
|
3507
|
+
|
|
3508
|
+
// src/components/filter-bar/FilterBar.tsx
|
|
3509
|
+
var React48 = __toESM(require("react"));
|
|
3510
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3511
|
+
var FilterBar = React48.forwardRef(function FilterBar2({
|
|
3512
|
+
searchValue,
|
|
3513
|
+
onSearchChange,
|
|
3514
|
+
searchPlaceholder = "Search\u2026",
|
|
3515
|
+
onReset,
|
|
3516
|
+
activeCount = 0,
|
|
3517
|
+
trailing,
|
|
3518
|
+
className,
|
|
3519
|
+
children,
|
|
3520
|
+
...props
|
|
3521
|
+
}, ref) {
|
|
3522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3523
|
+
"div",
|
|
3524
|
+
{
|
|
3525
|
+
ref,
|
|
3526
|
+
role: "search",
|
|
3527
|
+
className: cn(
|
|
3528
|
+
"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-card p-2",
|
|
3529
|
+
className
|
|
3530
|
+
),
|
|
3531
|
+
...props,
|
|
3532
|
+
children: [
|
|
3533
|
+
onSearchChange !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3534
|
+
Input,
|
|
3535
|
+
{
|
|
3536
|
+
type: "search",
|
|
3537
|
+
value: searchValue,
|
|
3538
|
+
onChange: (event) => onSearchChange(event.target.value),
|
|
3539
|
+
placeholder: searchPlaceholder,
|
|
3540
|
+
"aria-label": searchPlaceholder,
|
|
3541
|
+
className: "h-9 w-full min-w-40 flex-1 sm:w-auto"
|
|
3542
|
+
}
|
|
3543
|
+
),
|
|
3544
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex flex-wrap items-center gap-2", children }),
|
|
3545
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Button, { type: "button", variant: "ghost", size: "sm", onClick: onReset, children: [
|
|
3546
|
+
"Reset",
|
|
3547
|
+
activeCount > 0 ? ` (${activeCount})` : ""
|
|
3548
|
+
] }),
|
|
3549
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "ml-auto flex items-center gap-2", children: trailing })
|
|
3550
|
+
]
|
|
3551
|
+
}
|
|
3552
|
+
);
|
|
3553
|
+
});
|
|
3554
|
+
|
|
3555
|
+
// src/components/date-picker/DatePicker.tsx
|
|
3556
|
+
var React49 = __toESM(require("react"));
|
|
3557
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3558
|
+
var DatePicker = React49.forwardRef(function DatePicker2({ value, defaultValue, onValueChange, clearable = false, className, ...props }, ref) {
|
|
3559
|
+
const [internal, setInternal] = React49.useState(defaultValue ?? "");
|
|
3560
|
+
const current = value ?? internal;
|
|
3561
|
+
const commit = (next) => {
|
|
3562
|
+
if (value === void 0) setInternal(next);
|
|
3563
|
+
onValueChange?.(next);
|
|
3564
|
+
};
|
|
3565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn("relative flex items-center", className), children: [
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3567
|
+
Input,
|
|
3568
|
+
{
|
|
3569
|
+
ref,
|
|
3570
|
+
type: "date",
|
|
3571
|
+
value: current,
|
|
3572
|
+
onChange: (event) => commit(event.target.value),
|
|
3573
|
+
className: clearable && current ? "pr-9" : void 0,
|
|
3574
|
+
...props
|
|
3575
|
+
}
|
|
3576
|
+
),
|
|
3577
|
+
clearable && current && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3578
|
+
"button",
|
|
3579
|
+
{
|
|
3580
|
+
type: "button",
|
|
3581
|
+
onClick: () => commit(""),
|
|
3582
|
+
"aria-label": "Clear date",
|
|
3583
|
+
className: "absolute right-2 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3584
|
+
children: "\u2715"
|
|
3585
|
+
}
|
|
3586
|
+
)
|
|
3587
|
+
] });
|
|
3588
|
+
});
|
|
3589
|
+
|
|
3590
|
+
// src/components/time-picker/TimePicker.tsx
|
|
3591
|
+
var React50 = __toESM(require("react"));
|
|
3592
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3593
|
+
var TimePicker = React50.forwardRef(function TimePicker2({ value, defaultValue, onValueChange, clearable = false, className, ...props }, ref) {
|
|
3594
|
+
const [internal, setInternal] = React50.useState(defaultValue ?? "");
|
|
3595
|
+
const current = value ?? internal;
|
|
3596
|
+
const commit = (next) => {
|
|
3597
|
+
if (value === void 0) setInternal(next);
|
|
3598
|
+
onValueChange?.(next);
|
|
3599
|
+
};
|
|
3600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("relative flex items-center", className), children: [
|
|
3601
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3602
|
+
Input,
|
|
3603
|
+
{
|
|
3604
|
+
ref,
|
|
3605
|
+
type: "time",
|
|
3606
|
+
value: current,
|
|
3607
|
+
onChange: (event) => commit(event.target.value),
|
|
3608
|
+
className: clearable && current ? "pr-9" : void 0,
|
|
3609
|
+
...props
|
|
3610
|
+
}
|
|
3611
|
+
),
|
|
3612
|
+
clearable && current && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3613
|
+
"button",
|
|
3614
|
+
{
|
|
3615
|
+
type: "button",
|
|
3616
|
+
onClick: () => commit(""),
|
|
3617
|
+
"aria-label": "Clear time",
|
|
3618
|
+
className: "absolute right-2 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3619
|
+
children: "\u2715"
|
|
3620
|
+
}
|
|
3621
|
+
)
|
|
3622
|
+
] });
|
|
3623
|
+
});
|
|
3624
|
+
|
|
3625
|
+
// src/components/stepper/Stepper.tsx
|
|
3626
|
+
var React51 = __toESM(require("react"));
|
|
3627
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3628
|
+
var Stepper = React51.forwardRef(function Stepper2({ steps, current, orientation = "horizontal", onStepClick, className, ...props }, ref) {
|
|
3629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3630
|
+
"ol",
|
|
3631
|
+
{
|
|
3632
|
+
ref,
|
|
3633
|
+
className: cn(
|
|
3634
|
+
"flex gap-4",
|
|
3635
|
+
orientation === "vertical" ? "flex-col" : "flex-wrap items-start",
|
|
3636
|
+
className
|
|
3637
|
+
),
|
|
3638
|
+
...props,
|
|
3639
|
+
children: steps.map((step, index) => {
|
|
3640
|
+
const state = index < current ? "complete" : index === current ? "current" : "upcoming";
|
|
3641
|
+
const interactive = Boolean(onStepClick);
|
|
3642
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3644
|
+
"span",
|
|
3645
|
+
{
|
|
3646
|
+
"aria-hidden": "true",
|
|
3647
|
+
className: cn(
|
|
3648
|
+
"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium",
|
|
3649
|
+
state === "complete" && "border-primary bg-primary text-primary-foreground",
|
|
3650
|
+
state === "current" && "border-primary text-primary",
|
|
3651
|
+
state === "upcoming" && "border-border text-muted-foreground"
|
|
3652
|
+
),
|
|
3653
|
+
children: state === "complete" ? "\u2713" : index + 1
|
|
3654
|
+
}
|
|
3655
|
+
),
|
|
3656
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "min-w-0", children: [
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: cn("block text-sm", state === "upcoming" ? "text-muted-foreground" : "font-medium"), children: step.label }),
|
|
3658
|
+
step.description && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "block text-xs text-muted-foreground", children: step.description }),
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sr-only", children: state === "complete" ? " (completed)" : state === "current" ? " (current step)" : " (upcoming)" })
|
|
3660
|
+
] })
|
|
3661
|
+
] });
|
|
3662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("li", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3663
|
+
interactive ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3664
|
+
"button",
|
|
3665
|
+
{
|
|
3666
|
+
type: "button",
|
|
3667
|
+
onClick: () => onStepClick?.(index),
|
|
3668
|
+
"aria-current": state === "current" ? "step" : void 0,
|
|
3669
|
+
className: "flex items-start gap-2 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3670
|
+
children: content
|
|
3671
|
+
}
|
|
3672
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { "aria-current": state === "current" ? "step" : void 0, className: "flex items-start gap-2", children: content }),
|
|
3673
|
+
orientation === "horizontal" && index < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { "aria-hidden": "true", className: "mt-3.5 hidden h-px w-8 bg-border sm:block" })
|
|
3674
|
+
] }, step.label);
|
|
3675
|
+
})
|
|
3676
|
+
}
|
|
3677
|
+
);
|
|
3678
|
+
});
|
|
3679
|
+
|
|
3680
|
+
// src/components/file-upload/FileUpload.tsx
|
|
3681
|
+
var React52 = __toESM(require("react"));
|
|
3682
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3683
|
+
function formatSize(bytes) {
|
|
3684
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
3685
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
3686
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
3687
|
+
}
|
|
3688
|
+
var FileUpload = React52.forwardRef(function FileUpload2({
|
|
3689
|
+
files,
|
|
3690
|
+
defaultFiles,
|
|
3691
|
+
onFilesChange,
|
|
3692
|
+
label = "Drop files here or click to browse",
|
|
3693
|
+
hint,
|
|
3694
|
+
progress,
|
|
3695
|
+
multiple = true,
|
|
3696
|
+
accept,
|
|
3697
|
+
disabled,
|
|
3698
|
+
className,
|
|
3699
|
+
id,
|
|
3700
|
+
...props
|
|
3701
|
+
}, ref) {
|
|
3702
|
+
const [internal, setInternal] = React52.useState(defaultFiles ?? []);
|
|
3703
|
+
const [dragging, setDragging] = React52.useState(false);
|
|
3704
|
+
const current = files ?? internal;
|
|
3705
|
+
const generatedId = React52.useId();
|
|
3706
|
+
const inputId = id ?? generatedId;
|
|
3707
|
+
const commit = (next) => {
|
|
3708
|
+
if (files === void 0) setInternal(next);
|
|
3709
|
+
onFilesChange?.(next);
|
|
3710
|
+
};
|
|
3711
|
+
const add = (incoming) => {
|
|
3712
|
+
if (!incoming || incoming.length === 0) return;
|
|
3713
|
+
const list = Array.from(incoming);
|
|
3714
|
+
commit(multiple ? [...current, ...list] : list.slice(0, 1));
|
|
3715
|
+
};
|
|
3716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cn("flex flex-col gap-3", className), children: [
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
3718
|
+
"div",
|
|
3719
|
+
{
|
|
3720
|
+
onDragOver: (event) => {
|
|
3721
|
+
if (disabled) return;
|
|
3722
|
+
event.preventDefault();
|
|
3723
|
+
setDragging(true);
|
|
3724
|
+
},
|
|
3725
|
+
onDragLeave: () => setDragging(false),
|
|
3726
|
+
onDrop: (event) => {
|
|
3727
|
+
if (disabled) return;
|
|
3728
|
+
event.preventDefault();
|
|
3729
|
+
setDragging(false);
|
|
3730
|
+
add(event.dataTransfer.files);
|
|
3731
|
+
},
|
|
3732
|
+
className: cn(
|
|
3733
|
+
"rounded-lg border border-dashed border-border p-6 text-center transition-colors",
|
|
3734
|
+
dragging && "border-primary bg-primary/5",
|
|
3735
|
+
disabled && "opacity-50"
|
|
3736
|
+
),
|
|
3737
|
+
children: [
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { htmlFor: inputId, className: cn("block text-sm", disabled ? "cursor-not-allowed" : "cursor-pointer"), children: [
|
|
3739
|
+
label,
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3741
|
+
"input",
|
|
3742
|
+
{
|
|
3743
|
+
ref,
|
|
3744
|
+
id: inputId,
|
|
3745
|
+
type: "file",
|
|
3746
|
+
multiple,
|
|
3747
|
+
accept,
|
|
3748
|
+
disabled,
|
|
3749
|
+
className: "sr-only",
|
|
3750
|
+
onChange: (event) => {
|
|
3751
|
+
add(event.target.files);
|
|
3752
|
+
event.target.value = "";
|
|
3753
|
+
},
|
|
3754
|
+
...props
|
|
3755
|
+
}
|
|
3756
|
+
)
|
|
3757
|
+
] }),
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: hint ?? (accept ? `Accepted: ${accept}` : "Any file type") })
|
|
3759
|
+
]
|
|
3760
|
+
}
|
|
3761
|
+
),
|
|
3762
|
+
current.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { "aria-label": "Selected files", className: "space-y-2", children: current.map((file) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2", children: [
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "min-w-0", children: [
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "truncate text-sm", children: file.name }),
|
|
3765
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-xs text-muted-foreground", children: formatSize(file.size) }),
|
|
3766
|
+
progress?.[file.name] !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3767
|
+
"div",
|
|
3768
|
+
{
|
|
3769
|
+
role: "progressbar",
|
|
3770
|
+
"aria-valuenow": progress[file.name],
|
|
3771
|
+
"aria-valuemin": 0,
|
|
3772
|
+
"aria-valuemax": 100,
|
|
3773
|
+
"aria-label": `Uploading ${file.name}`,
|
|
3774
|
+
className: "mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-muted",
|
|
3775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "h-full bg-primary", style: { width: `${progress[file.name]}%` } })
|
|
3776
|
+
}
|
|
3777
|
+
)
|
|
3778
|
+
] }),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3780
|
+
"button",
|
|
3781
|
+
{
|
|
3782
|
+
type: "button",
|
|
3783
|
+
onClick: () => commit(current.filter((entry) => entry.name !== file.name)),
|
|
3784
|
+
"aria-label": `Remove ${file.name}`,
|
|
3785
|
+
className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3786
|
+
children: "\u2715"
|
|
3787
|
+
}
|
|
3788
|
+
)
|
|
3789
|
+
] }, file.name)) })
|
|
3790
|
+
] });
|
|
3791
|
+
});
|
|
3792
|
+
|
|
3793
|
+
// src/components/timeline/Timeline.tsx
|
|
3794
|
+
var React53 = __toESM(require("react"));
|
|
3795
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3796
|
+
var Timeline = React53.forwardRef(function Timeline2({ items, className, ...props }, ref) {
|
|
3797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ol", { ref, className: cn("relative flex flex-col gap-6", className), ...props, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("li", { className: "relative flex gap-4", children: [
|
|
3798
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
3799
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3800
|
+
"span",
|
|
3801
|
+
{
|
|
3802
|
+
"aria-hidden": "true",
|
|
3803
|
+
className: cn(
|
|
3804
|
+
"mt-1 flex h-3 w-3 shrink-0 items-center justify-center rounded-full border-2",
|
|
3805
|
+
item.muted ? "border-border bg-background" : "border-primary bg-primary"
|
|
3806
|
+
)
|
|
3807
|
+
}
|
|
3808
|
+
),
|
|
3809
|
+
index < items.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { "aria-hidden": "true", className: "mt-1 w-px flex-1 bg-border" })
|
|
3810
|
+
] }),
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cn("min-w-0 pb-1", item.muted && "opacity-60"), children: [
|
|
3812
|
+
item.period && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: item.period }),
|
|
3813
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-sm font-semibold", children: item.title }),
|
|
3814
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: item.description }),
|
|
3815
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "mt-1 text-muted-foreground [&_svg]:size-4", children: item.icon })
|
|
3816
|
+
] })
|
|
3817
|
+
] }, `${item.title}-${index}`)) });
|
|
3818
|
+
});
|
|
3819
|
+
|
|
2642
3820
|
// src/components/block/Block.tsx
|
|
2643
|
-
var
|
|
2644
|
-
var
|
|
2645
|
-
var Block =
|
|
3821
|
+
var React54 = __toESM(require("react"));
|
|
3822
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3823
|
+
var Block = React54.forwardRef(
|
|
2646
3824
|
({ as = "div", inline, muted, className, ...props }, ref) => {
|
|
2647
3825
|
const Tag = inline ? "span" : as;
|
|
2648
|
-
return /* @__PURE__ */ (0,
|
|
3826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2649
3827
|
Tag,
|
|
2650
3828
|
{
|
|
2651
3829
|
ref,
|
|
@@ -2658,8 +3836,8 @@ var Block = React39.forwardRef(
|
|
|
2658
3836
|
Block.displayName = "Block";
|
|
2659
3837
|
|
|
2660
3838
|
// src/components/flex/Flex.tsx
|
|
2661
|
-
var
|
|
2662
|
-
var
|
|
3839
|
+
var React55 = __toESM(require("react"));
|
|
3840
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2663
3841
|
var justifyClasses = {
|
|
2664
3842
|
start: "justify-start",
|
|
2665
3843
|
center: "justify-center",
|
|
@@ -2675,11 +3853,11 @@ var alignClasses = {
|
|
|
2675
3853
|
stretch: "items-stretch",
|
|
2676
3854
|
baseline: "items-baseline"
|
|
2677
3855
|
};
|
|
2678
|
-
var Flex =
|
|
3856
|
+
var Flex = React55.forwardRef(
|
|
2679
3857
|
({ direction = "row", align, justify, wrap, gap = "md", as = "div", className, style, ...props }, ref) => {
|
|
2680
3858
|
const Tag = as;
|
|
2681
3859
|
const gapResolved = resolveGap(gap);
|
|
2682
|
-
return /* @__PURE__ */ (0,
|
|
3860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2683
3861
|
Tag,
|
|
2684
3862
|
{
|
|
2685
3863
|
ref,
|
|
@@ -2706,7 +3884,7 @@ var selfAlignClasses = {
|
|
|
2706
3884
|
stretch: "self-stretch",
|
|
2707
3885
|
baseline: "self-baseline"
|
|
2708
3886
|
};
|
|
2709
|
-
var FlexItem =
|
|
3887
|
+
var FlexItem = React55.forwardRef(
|
|
2710
3888
|
({ grow, shrink, basis, align, as = "div", className, ...props }, ref) => {
|
|
2711
3889
|
const Tag = as;
|
|
2712
3890
|
const style = {
|
|
@@ -2714,7 +3892,7 @@ var FlexItem = React40.forwardRef(
|
|
|
2714
3892
|
...shrink === false ? { flexShrink: 0 } : typeof shrink === "string" && shrink ? { flexShrink: Number(shrink) || shrink } : {},
|
|
2715
3893
|
...basis ? { flexBasis: basis } : {}
|
|
2716
3894
|
};
|
|
2717
|
-
return /* @__PURE__ */ (0,
|
|
3895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2718
3896
|
Tag,
|
|
2719
3897
|
{
|
|
2720
3898
|
ref,
|
|
@@ -2728,8 +3906,8 @@ var FlexItem = React40.forwardRef(
|
|
|
2728
3906
|
FlexItem.displayName = "FlexItem";
|
|
2729
3907
|
|
|
2730
3908
|
// src/components/grid/Grid.tsx
|
|
2731
|
-
var
|
|
2732
|
-
var
|
|
3909
|
+
var React56 = __toESM(require("react"));
|
|
3910
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2733
3911
|
var BASE_COLS = {
|
|
2734
3912
|
1: "grid-cols-1",
|
|
2735
3913
|
2: "grid-cols-2",
|
|
@@ -2794,11 +3972,11 @@ var LG_COL_SPAN = {
|
|
|
2794
3972
|
5: "lg:col-span-5",
|
|
2795
3973
|
6: "lg:col-span-6"
|
|
2796
3974
|
};
|
|
2797
|
-
var Grid =
|
|
3975
|
+
var Grid = React56.forwardRef(
|
|
2798
3976
|
({ cols, smCols, mdCols, lgCols, minCol, gap = "md", as = "div", className, style, ...props }, ref) => {
|
|
2799
3977
|
const Tag = as;
|
|
2800
3978
|
const gapResolved = resolveGap(gap);
|
|
2801
|
-
return /* @__PURE__ */ (0,
|
|
3979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2802
3980
|
Tag,
|
|
2803
3981
|
{
|
|
2804
3982
|
ref,
|
|
@@ -2822,10 +4000,10 @@ var Grid = React41.forwardRef(
|
|
|
2822
4000
|
}
|
|
2823
4001
|
);
|
|
2824
4002
|
Grid.displayName = "Grid";
|
|
2825
|
-
var GridItem =
|
|
4003
|
+
var GridItem = React56.forwardRef(
|
|
2826
4004
|
({ span, smSpan, mdSpan, lgSpan, as = "div", className, ...props }, ref) => {
|
|
2827
4005
|
const Tag = as;
|
|
2828
|
-
return /* @__PURE__ */ (0,
|
|
4006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2829
4007
|
Tag,
|
|
2830
4008
|
{
|
|
2831
4009
|
ref,
|
|
@@ -2844,10 +4022,11 @@ var GridItem = React41.forwardRef(
|
|
|
2844
4022
|
GridItem.displayName = "GridItem";
|
|
2845
4023
|
|
|
2846
4024
|
// src/components/menu/Menu.tsx
|
|
2847
|
-
var
|
|
2848
|
-
var
|
|
2849
|
-
var
|
|
2850
|
-
var
|
|
4025
|
+
var React57 = __toESM(require("react"));
|
|
4026
|
+
var import_react_dom7 = require("react-dom");
|
|
4027
|
+
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
4028
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4029
|
+
var MenuContext = React57.createContext({
|
|
2851
4030
|
open: false,
|
|
2852
4031
|
setOpen: () => {
|
|
2853
4032
|
},
|
|
@@ -2856,13 +4035,13 @@ var MenuContext = React42.createContext({
|
|
|
2856
4035
|
},
|
|
2857
4036
|
wrapperRef: { current: null }
|
|
2858
4037
|
});
|
|
2859
|
-
var Menu =
|
|
4038
|
+
var Menu = React57.forwardRef(
|
|
2860
4039
|
({ open, onOpenChange, className, children }, ref) => {
|
|
2861
|
-
const [internalOpen, setInternalOpen] =
|
|
2862
|
-
const [activeIndex, setActiveIndex] =
|
|
4040
|
+
const [internalOpen, setInternalOpen] = React57.useState(false);
|
|
4041
|
+
const [activeIndex, setActiveIndex] = React57.useState(-1);
|
|
2863
4042
|
const current = open ?? internalOpen;
|
|
2864
|
-
const wrapperRef =
|
|
2865
|
-
const setRefs =
|
|
4043
|
+
const wrapperRef = React57.useRef(null);
|
|
4044
|
+
const setRefs = React57.useCallback(
|
|
2866
4045
|
(node) => {
|
|
2867
4046
|
wrapperRef.current = node;
|
|
2868
4047
|
if (typeof ref === "function") ref(node);
|
|
@@ -2870,7 +4049,7 @@ var Menu = React42.forwardRef(
|
|
|
2870
4049
|
},
|
|
2871
4050
|
[ref]
|
|
2872
4051
|
);
|
|
2873
|
-
const setOpen =
|
|
4052
|
+
const setOpen = React57.useCallback(
|
|
2874
4053
|
(next) => {
|
|
2875
4054
|
if (open === void 0) setInternalOpen(next);
|
|
2876
4055
|
onOpenChange?.(next);
|
|
@@ -2878,7 +4057,7 @@ var Menu = React42.forwardRef(
|
|
|
2878
4057
|
},
|
|
2879
4058
|
[open, onOpenChange]
|
|
2880
4059
|
);
|
|
2881
|
-
return /* @__PURE__ */ (0,
|
|
4060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { ref: setRefs, className: cn("relative inline-block", className), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2882
4061
|
MenuContext.Provider,
|
|
2883
4062
|
{
|
|
2884
4063
|
value: { open: current, setOpen, activeIndex, setActiveIndex, wrapperRef },
|
|
@@ -2888,10 +4067,10 @@ var Menu = React42.forwardRef(
|
|
|
2888
4067
|
}
|
|
2889
4068
|
);
|
|
2890
4069
|
Menu.displayName = "Menu";
|
|
2891
|
-
var MenuTrigger =
|
|
4070
|
+
var MenuTrigger = React57.forwardRef(
|
|
2892
4071
|
({ className, children, ...props }, ref) => {
|
|
2893
|
-
const { open, setOpen } =
|
|
2894
|
-
return /* @__PURE__ */ (0,
|
|
4072
|
+
const { open, setOpen } = React57.useContext(MenuContext);
|
|
4073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2895
4074
|
"button",
|
|
2896
4075
|
{
|
|
2897
4076
|
ref,
|
|
@@ -2911,13 +4090,13 @@ var MenuTrigger = React42.forwardRef(
|
|
|
2911
4090
|
}
|
|
2912
4091
|
);
|
|
2913
4092
|
MenuTrigger.displayName = "MenuTrigger";
|
|
2914
|
-
var MenuContent =
|
|
4093
|
+
var MenuContent = React57.forwardRef(
|
|
2915
4094
|
({ className, children, ...props }, ref) => {
|
|
2916
|
-
const { open, setOpen, activeIndex, setActiveIndex, wrapperRef } =
|
|
2917
|
-
const contentRef =
|
|
2918
|
-
const [pos, setPos] =
|
|
2919
|
-
const itemsRef =
|
|
2920
|
-
|
|
4095
|
+
const { open, setOpen, activeIndex, setActiveIndex, wrapperRef } = React57.useContext(MenuContext);
|
|
4096
|
+
const contentRef = React57.useRef(null);
|
|
4097
|
+
const [pos, setPos] = React57.useState(null);
|
|
4098
|
+
const itemsRef = React57.useRef([]);
|
|
4099
|
+
React57.useLayoutEffect(() => {
|
|
2921
4100
|
if (!open) {
|
|
2922
4101
|
setPos(null);
|
|
2923
4102
|
return;
|
|
@@ -2937,7 +4116,7 @@ var MenuContent = React42.forwardRef(
|
|
|
2937
4116
|
window.removeEventListener("resize", measure);
|
|
2938
4117
|
};
|
|
2939
4118
|
}, [open, setOpen, wrapperRef]);
|
|
2940
|
-
|
|
4119
|
+
React57.useEffect(() => {
|
|
2941
4120
|
if (!open) return;
|
|
2942
4121
|
function onPointerDown(event) {
|
|
2943
4122
|
if (!contentRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -2945,7 +4124,7 @@ var MenuContent = React42.forwardRef(
|
|
|
2945
4124
|
document.addEventListener("pointerdown", onPointerDown);
|
|
2946
4125
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
2947
4126
|
}, [open, setOpen]);
|
|
2948
|
-
|
|
4127
|
+
React57.useEffect(() => {
|
|
2949
4128
|
if (open && pos && contentRef.current) {
|
|
2950
4129
|
itemsRef.current = Array.from(
|
|
2951
4130
|
contentRef.current.querySelectorAll('[role="menuitem"]:not([disabled])')
|
|
@@ -2980,8 +4159,8 @@ var MenuContent = React42.forwardRef(
|
|
|
2980
4159
|
}
|
|
2981
4160
|
};
|
|
2982
4161
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
2983
|
-
return (0,
|
|
2984
|
-
/* @__PURE__ */ (0,
|
|
4162
|
+
return (0, import_react_dom7.createPortal)(
|
|
4163
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2985
4164
|
"div",
|
|
2986
4165
|
{
|
|
2987
4166
|
ref: (node) => {
|
|
@@ -3005,14 +4184,16 @@ var MenuContent = React42.forwardRef(
|
|
|
3005
4184
|
}
|
|
3006
4185
|
);
|
|
3007
4186
|
MenuContent.displayName = "MenuContent";
|
|
3008
|
-
var MenuItem =
|
|
3009
|
-
({ className, destructive, onClick, ...props }, ref) => {
|
|
3010
|
-
const { setOpen } =
|
|
3011
|
-
|
|
3012
|
-
|
|
4187
|
+
var MenuItem = React57.forwardRef(
|
|
4188
|
+
({ className, destructive, asChild = false, onClick, ...props }, ref) => {
|
|
4189
|
+
const { setOpen } = React57.useContext(MenuContext);
|
|
4190
|
+
const Comp = asChild ? import_react_slot4.Slot : "button";
|
|
4191
|
+
const typeProp = asChild ? {} : { type: "button" };
|
|
4192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4193
|
+
Comp,
|
|
3013
4194
|
{
|
|
3014
4195
|
ref,
|
|
3015
|
-
|
|
4196
|
+
...typeProp,
|
|
3016
4197
|
role: "menuitem",
|
|
3017
4198
|
onClick: (event) => {
|
|
3018
4199
|
onClick?.(event);
|
|
@@ -3030,12 +4211,12 @@ var MenuItem = React42.forwardRef(
|
|
|
3030
4211
|
}
|
|
3031
4212
|
);
|
|
3032
4213
|
MenuItem.displayName = "MenuItem";
|
|
3033
|
-
var MenuSeparator =
|
|
3034
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4214
|
+
var MenuSeparator = React57.forwardRef(
|
|
4215
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { ref, role: "separator", className: cn("-mx-1 my-1 h-px bg-border", className), ...props })
|
|
3035
4216
|
);
|
|
3036
4217
|
MenuSeparator.displayName = "MenuSeparator";
|
|
3037
|
-
var MenuLabel =
|
|
3038
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4218
|
+
var MenuLabel = React57.forwardRef(
|
|
4219
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3039
4220
|
"div",
|
|
3040
4221
|
{
|
|
3041
4222
|
ref,
|
|
@@ -3047,9 +4228,9 @@ var MenuLabel = React42.forwardRef(
|
|
|
3047
4228
|
MenuLabel.displayName = "MenuLabel";
|
|
3048
4229
|
|
|
3049
4230
|
// src/components/alert/Alert.tsx
|
|
3050
|
-
var
|
|
4231
|
+
var React58 = __toESM(require("react"));
|
|
3051
4232
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
3052
|
-
var
|
|
4233
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3053
4234
|
var alertVariants = (0, import_class_variance_authority6.cva)(
|
|
3054
4235
|
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
3055
4236
|
{
|
|
@@ -3067,8 +4248,8 @@ var alertVariants = (0, import_class_variance_authority6.cva)(
|
|
|
3067
4248
|
}
|
|
3068
4249
|
}
|
|
3069
4250
|
);
|
|
3070
|
-
var Alert =
|
|
3071
|
-
({ className, variant, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4251
|
+
var Alert = React58.forwardRef(
|
|
4252
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3072
4253
|
"div",
|
|
3073
4254
|
{
|
|
3074
4255
|
ref,
|
|
@@ -3079,8 +4260,8 @@ var Alert = React43.forwardRef(
|
|
|
3079
4260
|
)
|
|
3080
4261
|
);
|
|
3081
4262
|
Alert.displayName = "Alert";
|
|
3082
|
-
var AlertTitle =
|
|
3083
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4263
|
+
var AlertTitle = React58.forwardRef(
|
|
4264
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3084
4265
|
"h5",
|
|
3085
4266
|
{
|
|
3086
4267
|
ref,
|
|
@@ -3090,8 +4271,8 @@ var AlertTitle = React43.forwardRef(
|
|
|
3090
4271
|
)
|
|
3091
4272
|
);
|
|
3092
4273
|
AlertTitle.displayName = "AlertTitle";
|
|
3093
|
-
var AlertDescription =
|
|
3094
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4274
|
+
var AlertDescription = React58.forwardRef(
|
|
4275
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3095
4276
|
"div",
|
|
3096
4277
|
{
|
|
3097
4278
|
ref,
|
|
@@ -3103,10 +4284,10 @@ var AlertDescription = React43.forwardRef(
|
|
|
3103
4284
|
AlertDescription.displayName = "AlertDescription";
|
|
3104
4285
|
|
|
3105
4286
|
// src/components/popover/Popover.tsx
|
|
3106
|
-
var
|
|
3107
|
-
var
|
|
3108
|
-
var
|
|
3109
|
-
var PopoverContext =
|
|
4287
|
+
var React59 = __toESM(require("react"));
|
|
4288
|
+
var import_react_dom8 = require("react-dom");
|
|
4289
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4290
|
+
var PopoverContext = React59.createContext({
|
|
3110
4291
|
open: false,
|
|
3111
4292
|
setOpen: () => {
|
|
3112
4293
|
},
|
|
@@ -3114,14 +4295,14 @@ var PopoverContext = React44.createContext({
|
|
|
3114
4295
|
contentId: "",
|
|
3115
4296
|
wrapperRef: { current: null }
|
|
3116
4297
|
});
|
|
3117
|
-
var Popover =
|
|
4298
|
+
var Popover = React59.forwardRef(
|
|
3118
4299
|
({ open, onOpenChange, className, children }, ref) => {
|
|
3119
|
-
const [internalOpen, setInternalOpen] =
|
|
4300
|
+
const [internalOpen, setInternalOpen] = React59.useState(false);
|
|
3120
4301
|
const current = open ?? internalOpen;
|
|
3121
|
-
const triggerId =
|
|
3122
|
-
const contentId =
|
|
3123
|
-
const wrapperRef =
|
|
3124
|
-
const setRefs =
|
|
4302
|
+
const triggerId = React59.useId();
|
|
4303
|
+
const contentId = React59.useId();
|
|
4304
|
+
const wrapperRef = React59.useRef(null);
|
|
4305
|
+
const setRefs = React59.useCallback(
|
|
3125
4306
|
(node) => {
|
|
3126
4307
|
wrapperRef.current = node;
|
|
3127
4308
|
if (typeof ref === "function") ref(node);
|
|
@@ -3129,14 +4310,14 @@ var Popover = React44.forwardRef(
|
|
|
3129
4310
|
},
|
|
3130
4311
|
[ref]
|
|
3131
4312
|
);
|
|
3132
|
-
const setOpen =
|
|
4313
|
+
const setOpen = React59.useCallback(
|
|
3133
4314
|
(next) => {
|
|
3134
4315
|
if (open === void 0) setInternalOpen(next);
|
|
3135
4316
|
onOpenChange?.(next);
|
|
3136
4317
|
},
|
|
3137
4318
|
[open, onOpenChange]
|
|
3138
4319
|
);
|
|
3139
|
-
return /* @__PURE__ */ (0,
|
|
4320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { ref: setRefs, className: cn("relative inline-block", className), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3140
4321
|
PopoverContext.Provider,
|
|
3141
4322
|
{
|
|
3142
4323
|
value: { open: current, setOpen, triggerId, contentId, wrapperRef },
|
|
@@ -3146,10 +4327,10 @@ var Popover = React44.forwardRef(
|
|
|
3146
4327
|
}
|
|
3147
4328
|
);
|
|
3148
4329
|
Popover.displayName = "Popover";
|
|
3149
|
-
var PopoverTrigger =
|
|
4330
|
+
var PopoverTrigger = React59.forwardRef(
|
|
3150
4331
|
({ className, children, onClick, ...props }, ref) => {
|
|
3151
|
-
const { open, setOpen, triggerId, contentId } =
|
|
3152
|
-
return /* @__PURE__ */ (0,
|
|
4332
|
+
const { open, setOpen, triggerId, contentId } = React59.useContext(PopoverContext);
|
|
4333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3153
4334
|
"button",
|
|
3154
4335
|
{
|
|
3155
4336
|
ref,
|
|
@@ -3174,12 +4355,12 @@ var PopoverTrigger = React44.forwardRef(
|
|
|
3174
4355
|
}
|
|
3175
4356
|
);
|
|
3176
4357
|
PopoverTrigger.displayName = "PopoverTrigger";
|
|
3177
|
-
var PopoverContent =
|
|
4358
|
+
var PopoverContent = React59.forwardRef(
|
|
3178
4359
|
({ className, children, onKeyDown, ...props }, ref) => {
|
|
3179
|
-
const { open, setOpen, triggerId, contentId, wrapperRef } =
|
|
3180
|
-
const contentRef =
|
|
3181
|
-
const [pos, setPos] =
|
|
3182
|
-
|
|
4360
|
+
const { open, setOpen, triggerId, contentId, wrapperRef } = React59.useContext(PopoverContext);
|
|
4361
|
+
const contentRef = React59.useRef(null);
|
|
4362
|
+
const [pos, setPos] = React59.useState(null);
|
|
4363
|
+
React59.useLayoutEffect(() => {
|
|
3183
4364
|
if (!open) {
|
|
3184
4365
|
setPos(null);
|
|
3185
4366
|
return;
|
|
@@ -3199,7 +4380,7 @@ var PopoverContent = React44.forwardRef(
|
|
|
3199
4380
|
window.removeEventListener("resize", measure);
|
|
3200
4381
|
};
|
|
3201
4382
|
}, [open, setOpen, wrapperRef]);
|
|
3202
|
-
|
|
4383
|
+
React59.useEffect(() => {
|
|
3203
4384
|
if (!open) return;
|
|
3204
4385
|
function onPointerDown(event) {
|
|
3205
4386
|
if (!contentRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -3207,14 +4388,14 @@ var PopoverContent = React44.forwardRef(
|
|
|
3207
4388
|
document.addEventListener("pointerdown", onPointerDown);
|
|
3208
4389
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
3209
4390
|
}, [open, setOpen]);
|
|
3210
|
-
|
|
4391
|
+
React59.useEffect(() => {
|
|
3211
4392
|
if (open && pos && contentRef.current) {
|
|
3212
4393
|
contentRef.current.focus();
|
|
3213
4394
|
}
|
|
3214
4395
|
}, [open, pos]);
|
|
3215
4396
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
3216
|
-
return (0,
|
|
3217
|
-
/* @__PURE__ */ (0,
|
|
4397
|
+
return (0, import_react_dom8.createPortal)(
|
|
4398
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3218
4399
|
"div",
|
|
3219
4400
|
{
|
|
3220
4401
|
ref: (node) => {
|
|
@@ -3249,21 +4430,21 @@ var PopoverContent = React44.forwardRef(
|
|
|
3249
4430
|
PopoverContent.displayName = "PopoverContent";
|
|
3250
4431
|
|
|
3251
4432
|
// src/components/breadcrumb/Breadcrumb.tsx
|
|
3252
|
-
var
|
|
3253
|
-
var
|
|
3254
|
-
var Breadcrumb =
|
|
3255
|
-
({ items, separator = "/", onItemClick, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4433
|
+
var React60 = __toESM(require("react"));
|
|
4434
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4435
|
+
var Breadcrumb = React60.forwardRef(
|
|
4436
|
+
({ items, separator = "/", onItemClick, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3256
4437
|
"nav",
|
|
3257
4438
|
{
|
|
3258
4439
|
ref,
|
|
3259
4440
|
"aria-label": "Breadcrumb",
|
|
3260
4441
|
className: cn("flex items-center space-x-1.5 text-sm text-muted-foreground", className),
|
|
3261
4442
|
...props,
|
|
3262
|
-
children: /* @__PURE__ */ (0,
|
|
4443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ol", { className: "flex flex-wrap items-center space-x-1.5", children: items.map((item, index) => {
|
|
3263
4444
|
const isLast = index === items.length - 1;
|
|
3264
|
-
return /* @__PURE__ */ (0,
|
|
3265
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
3266
|
-
item.href && !isLast ? /* @__PURE__ */ (0,
|
|
4445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("li", { className: "flex items-center space-x-1.5", children: [
|
|
4446
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground/50", children: separator }),
|
|
4447
|
+
item.href && !isLast ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3267
4448
|
"a",
|
|
3268
4449
|
{
|
|
3269
4450
|
href: item.href,
|
|
@@ -3274,7 +4455,7 @@ var Breadcrumb = React45.forwardRef(
|
|
|
3274
4455
|
} : void 0,
|
|
3275
4456
|
children: item.label
|
|
3276
4457
|
}
|
|
3277
|
-
) : /* @__PURE__ */ (0,
|
|
4458
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3278
4459
|
"span",
|
|
3279
4460
|
{
|
|
3280
4461
|
"aria-current": isLast ? "page" : void 0,
|
|
@@ -3297,6 +4478,8 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
3297
4478
|
Alert,
|
|
3298
4479
|
AlertDescription,
|
|
3299
4480
|
AlertTitle,
|
|
4481
|
+
AppShell,
|
|
4482
|
+
AuthLayout,
|
|
3300
4483
|
Autocomplete,
|
|
3301
4484
|
Avatar,
|
|
3302
4485
|
AvatarFallback,
|
|
@@ -3316,10 +4499,19 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
3316
4499
|
CheckboxGroup,
|
|
3317
4500
|
CheckboxGroupItem,
|
|
3318
4501
|
DataTable,
|
|
4502
|
+
DatePicker,
|
|
3319
4503
|
Dialog,
|
|
4504
|
+
DialogBody,
|
|
4505
|
+
DialogDescription,
|
|
4506
|
+
DialogFooter,
|
|
4507
|
+
DialogHeader,
|
|
4508
|
+
DialogTitle,
|
|
3320
4509
|
Divider,
|
|
3321
4510
|
Drawer,
|
|
4511
|
+
EmptyState,
|
|
3322
4512
|
Fieldset,
|
|
4513
|
+
FileUpload,
|
|
4514
|
+
FilterBar,
|
|
3323
4515
|
Flex,
|
|
3324
4516
|
FlexItem,
|
|
3325
4517
|
Form,
|
|
@@ -3340,7 +4532,10 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
3340
4532
|
MenuLabel,
|
|
3341
4533
|
MenuSeparator,
|
|
3342
4534
|
MenuTrigger,
|
|
4535
|
+
MetricCard,
|
|
4536
|
+
PageHeader,
|
|
3343
4537
|
Pagination,
|
|
4538
|
+
PasswordInput,
|
|
3344
4539
|
Popover,
|
|
3345
4540
|
PopoverContent,
|
|
3346
4541
|
PopoverTrigger,
|
|
@@ -3352,13 +4547,17 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
3352
4547
|
RadioGroupItem,
|
|
3353
4548
|
Search,
|
|
3354
4549
|
Select,
|
|
4550
|
+
SelectMenu,
|
|
3355
4551
|
Separator,
|
|
4552
|
+
Sidebar,
|
|
3356
4553
|
Skeleton,
|
|
3357
4554
|
Spinner,
|
|
4555
|
+
Stepper,
|
|
3358
4556
|
Switch,
|
|
3359
4557
|
Table,
|
|
3360
4558
|
TableBody,
|
|
3361
4559
|
TableCaption,
|
|
4560
|
+
TableCard,
|
|
3362
4561
|
TableCell,
|
|
3363
4562
|
TableFooter,
|
|
3364
4563
|
TableHead,
|
|
@@ -3370,7 +4569,10 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
3370
4569
|
TabsTrigger,
|
|
3371
4570
|
Text,
|
|
3372
4571
|
Textarea,
|
|
4572
|
+
TimePicker,
|
|
4573
|
+
Timeline,
|
|
3373
4574
|
ToastProvider,
|
|
4575
|
+
Toaster,
|
|
3374
4576
|
Tooltip,
|
|
3375
4577
|
alertVariants,
|
|
3376
4578
|
badgeVariants,
|
|
@@ -3380,6 +4582,7 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
3380
4582
|
resolveGap,
|
|
3381
4583
|
separatorVariants,
|
|
3382
4584
|
spinnerVariants,
|
|
4585
|
+
toast,
|
|
3383
4586
|
useCombobox,
|
|
3384
4587
|
usePresence,
|
|
3385
4588
|
useToast
|