@slipstream-ui/core 0.3.0 → 0.5.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 +957 -56
- package/dist/index.d.ts +957 -56
- package/dist/index.js +2554 -777
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2524 -777
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/app-shell.manifest.json +206 -0
- package/dist/manifests/auth-layout.manifest.json +99 -0
- package/dist/manifests/autocomplete.manifest.json +53 -5
- package/dist/manifests/badge.manifest.json +20 -3
- package/dist/manifests/breadcrumb.manifest.json +6 -0
- package/dist/manifests/button.manifest.json +20 -2
- package/dist/manifests/card.manifest.json +53 -6
- package/dist/manifests/confirm-dialog.manifest.json +132 -0
- package/dist/manifests/data-table.manifest.json +50 -0
- package/dist/manifests/date-picker.manifest.json +87 -0
- package/dist/manifests/dialog.manifest.json +56 -4
- package/dist/manifests/drawer.manifest.json +25 -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/link.manifest.json +106 -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 +124 -0
- package/dist/manifests/pagination.manifest.json +68 -34
- package/dist/manifests/password-input.manifest.json +75 -0
- package/dist/manifests/prose.manifest.json +75 -0
- package/dist/manifests/search.manifest.json +41 -9
- package/dist/manifests/section-heading.manifest.json +108 -0
- package/dist/manifests/select-menu.manifest.json +142 -0
- package/dist/manifests/select.manifest.json +55 -12
- package/dist/manifests/site-footer.manifest.json +94 -0
- package/dist/manifests/site-header.manifest.json +130 -0
- package/dist/manifests/stepper.manifest.json +95 -0
- package/dist/manifests/table-card.manifest.json +123 -0
- package/dist/manifests/table-of-contents.manifest.json +87 -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 +2 -2
- package/src/components/alert/Alert.tsx +2 -2
- package/src/components/app-shell/AppShell.test.tsx +148 -0
- package/src/components/app-shell/AppShell.tsx +266 -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 +35 -0
- package/src/components/badge/Badge.tsx +16 -4
- package/src/components/breadcrumb/Breadcrumb.test.tsx +16 -0
- package/src/components/breadcrumb/Breadcrumb.tsx +10 -5
- package/src/components/button/Button.test.tsx +67 -0
- package/src/components/button/Button.tsx +37 -3
- 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/confirm-dialog/ConfirmDialog.test.tsx +46 -0
- package/src/components/confirm-dialog/ConfirmDialog.tsx +86 -0
- package/src/components/confirm-dialog/index.ts +1 -0
- package/src/components/data-table/DataTable.test.tsx +92 -0
- package/src/components/data-table/DataTable.tsx +98 -7
- 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 +71 -1
- package/src/components/dialog/Dialog.tsx +116 -23
- package/src/components/dialog/index.ts +1 -2
- package/src/components/drawer/Drawer.test.tsx +59 -0
- package/src/components/drawer/Drawer.tsx +49 -8
- 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/Input.tsx +1 -0
- package/src/components/input-group/InputGroup.test.tsx +6 -3
- package/src/components/input-group/InputGroup.tsx +9 -6
- package/src/components/link/Link.test.tsx +60 -0
- package/src/components/link/Link.tsx +85 -0
- package/src/components/link/index.ts +1 -0
- 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 +48 -0
- package/src/components/page-header/PageHeader.tsx +53 -0
- package/src/components/page-header/index.ts +1 -0
- package/src/components/pagination/Pagination.test.tsx +33 -0
- package/src/components/pagination/Pagination.tsx +69 -18
- 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/prose/Prose.test.tsx +35 -0
- package/src/components/prose/Prose.tsx +61 -0
- package/src/components/prose/index.ts +1 -0
- package/src/components/search/Search.test.tsx +16 -0
- package/src/components/search/Search.tsx +11 -2
- package/src/components/section-heading/SectionHeading.test.tsx +32 -0
- package/src/components/section-heading/SectionHeading.tsx +54 -0
- package/src/components/section-heading/index.ts +1 -0
- package/src/components/select/Select.test.tsx +40 -1
- package/src/components/select/Select.tsx +54 -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/site-footer/SiteFooter.test.tsx +30 -0
- package/src/components/site-footer/SiteFooter.tsx +79 -0
- package/src/components/site-footer/index.ts +1 -0
- package/src/components/site-header/SiteHeader.test.tsx +53 -0
- package/src/components/site-header/SiteHeader.tsx +124 -0
- package/src/components/site-header/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/switch/Switch.test.tsx +10 -0
- package/src/components/switch/Switch.tsx +8 -3
- 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/table-of-contents/TableOfContents.test.tsx +31 -0
- package/src/components/table-of-contents/TableOfContents.tsx +100 -0
- package/src/components/table-of-contents/index.ts +1 -0
- package/src/components/textarea/Textarea.tsx +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 +21 -0
- package/src/manifests/app-shell.manifest.json +206 -0
- package/src/manifests/auth-layout.manifest.json +99 -0
- package/src/manifests/autocomplete.manifest.json +53 -5
- package/src/manifests/badge.manifest.json +20 -3
- package/src/manifests/breadcrumb.manifest.json +6 -0
- package/src/manifests/button.manifest.json +20 -2
- package/src/manifests/card.manifest.json +53 -6
- package/src/manifests/confirm-dialog.manifest.json +132 -0
- package/src/manifests/data-table.manifest.json +50 -0
- package/src/manifests/date-picker.manifest.json +87 -0
- package/src/manifests/dialog.manifest.json +56 -4
- package/src/manifests/drawer.manifest.json +25 -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/link.manifest.json +106 -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 +124 -0
- package/src/manifests/pagination.manifest.json +68 -34
- package/src/manifests/password-input.manifest.json +75 -0
- package/src/manifests/prose.manifest.json +75 -0
- package/src/manifests/search.manifest.json +41 -9
- package/src/manifests/section-heading.manifest.json +108 -0
- package/src/manifests/select-menu.manifest.json +142 -0
- package/src/manifests/select.manifest.json +55 -12
- package/src/manifests/site-footer.manifest.json +94 -0
- package/src/manifests/site-header.manifest.json +130 -0
- package/src/manifests/stepper.manifest.json +95 -0
- package/src/manifests/table-card.manifest.json +123 -0
- package/src/manifests/table-of-contents.manifest.json +87 -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/src/test/tailwind-v4.test.ts +103 -0
package/dist/index.mjs
CHANGED
|
@@ -48,24 +48,369 @@ function usePresence(open, animate, exitMs = 200) {
|
|
|
48
48
|
return { present, exiting: present && !open };
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// src/components/
|
|
51
|
+
// src/components/app-shell/AppShell.tsx
|
|
52
|
+
import * as React3 from "react";
|
|
53
|
+
|
|
54
|
+
// src/components/drawer/Drawer.tsx
|
|
52
55
|
import * as React2 from "react";
|
|
56
|
+
import { createPortal } from "react-dom";
|
|
57
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
58
|
+
var FOCUSABLE = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
59
|
+
var sideClasses = {
|
|
60
|
+
right: "inset-y-0 right-0 border-l",
|
|
61
|
+
left: "inset-y-0 left-0 border-r",
|
|
62
|
+
top: "inset-x-0 top-0 border-b",
|
|
63
|
+
bottom: "inset-x-0 bottom-0 border-t"
|
|
64
|
+
};
|
|
65
|
+
var sideWidths = {
|
|
66
|
+
sm: "w-72",
|
|
67
|
+
md: "w-96",
|
|
68
|
+
lg: "w-[32rem]",
|
|
69
|
+
xl: "w-[40rem]",
|
|
70
|
+
"2xl": "w-[48rem]"
|
|
71
|
+
};
|
|
72
|
+
var sideHeights = {
|
|
73
|
+
sm: "h-48",
|
|
74
|
+
md: "h-80",
|
|
75
|
+
lg: "h-[32rem]",
|
|
76
|
+
xl: "h-[40rem]",
|
|
77
|
+
"2xl": "h-[48rem]"
|
|
78
|
+
};
|
|
79
|
+
var sizeClasses = {
|
|
80
|
+
right: sideWidths,
|
|
81
|
+
left: sideWidths,
|
|
82
|
+
top: sideHeights,
|
|
83
|
+
bottom: sideHeights
|
|
84
|
+
};
|
|
85
|
+
function extentStyle(value) {
|
|
86
|
+
if (value === void 0) return void 0;
|
|
87
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
88
|
+
}
|
|
89
|
+
var slideIn = {
|
|
90
|
+
right: "slide-in-from-right",
|
|
91
|
+
left: "slide-in-from-left",
|
|
92
|
+
top: "slide-in-from-top",
|
|
93
|
+
bottom: "slide-in-from-bottom"
|
|
94
|
+
};
|
|
95
|
+
var slideOut = {
|
|
96
|
+
right: "slide-out-to-right",
|
|
97
|
+
left: "slide-out-to-left",
|
|
98
|
+
top: "slide-out-to-top",
|
|
99
|
+
bottom: "slide-out-to-bottom"
|
|
100
|
+
};
|
|
101
|
+
function Drawer({
|
|
102
|
+
open,
|
|
103
|
+
onOpenChange,
|
|
104
|
+
title,
|
|
105
|
+
description,
|
|
106
|
+
children,
|
|
107
|
+
side = "right",
|
|
108
|
+
size = "md",
|
|
109
|
+
width,
|
|
110
|
+
height,
|
|
111
|
+
closeOnBackdrop = true,
|
|
112
|
+
showClose = true,
|
|
113
|
+
closeLabel = "Close drawer",
|
|
114
|
+
initialFocusRef,
|
|
115
|
+
ariaLabel,
|
|
116
|
+
animate = false
|
|
117
|
+
}) {
|
|
118
|
+
const drawerRef = React2.useRef(null);
|
|
119
|
+
const previouslyFocused = React2.useRef(null);
|
|
120
|
+
const titleId = React2.useId();
|
|
121
|
+
const descriptionId = React2.useId();
|
|
122
|
+
const { present, exiting } = usePresence(open, animate);
|
|
123
|
+
React2.useEffect(() => {
|
|
124
|
+
if (open) {
|
|
125
|
+
previouslyFocused.current = document.activeElement;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
previouslyFocused.current?.focus?.();
|
|
129
|
+
previouslyFocused.current = null;
|
|
130
|
+
}, [open]);
|
|
131
|
+
React2.useEffect(() => {
|
|
132
|
+
if (!open || !present) return;
|
|
133
|
+
const node = drawerRef.current;
|
|
134
|
+
const target = initialFocusRef?.current ?? node?.querySelector(FOCUSABLE) ?? node;
|
|
135
|
+
target?.focus();
|
|
136
|
+
}, [open, present, initialFocusRef]);
|
|
137
|
+
React2.useEffect(() => {
|
|
138
|
+
if (!open) return;
|
|
139
|
+
const onKeyDown = (event) => {
|
|
140
|
+
if (event.key === "Escape") {
|
|
141
|
+
event.stopPropagation();
|
|
142
|
+
onOpenChange(false);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (event.key !== "Tab") return;
|
|
146
|
+
const node = drawerRef.current;
|
|
147
|
+
if (!node) return;
|
|
148
|
+
const focusable = Array.from(node.querySelectorAll(FOCUSABLE));
|
|
149
|
+
if (focusable.length === 0) {
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const first = focusable[0];
|
|
154
|
+
const last = focusable[focusable.length - 1];
|
|
155
|
+
const active = document.activeElement;
|
|
156
|
+
if (event.shiftKey && (active === first || !node.contains(active))) {
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
last.focus();
|
|
159
|
+
} else if (!event.shiftKey && active === last) {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
first.focus();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
document.addEventListener("keydown", onKeyDown);
|
|
165
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
166
|
+
}, [open, onOpenChange]);
|
|
167
|
+
if (!present || typeof document === "undefined") return null;
|
|
168
|
+
const isVerticalSide = side === "top" || side === "bottom";
|
|
169
|
+
const customExtent = isVerticalSide ? extentStyle(height) : extentStyle(width);
|
|
170
|
+
const motion = animate ? cn(
|
|
171
|
+
"duration-200 motion-reduce:animate-none",
|
|
172
|
+
exiting ? `animate-out ${slideOut[side]}` : `animate-in ${slideIn[side]}`
|
|
173
|
+
) : void 0;
|
|
174
|
+
return createPortal(
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: "fixed inset-0 z-50",
|
|
179
|
+
onMouseDown: (event) => {
|
|
180
|
+
if (closeOnBackdrop && event.target === event.currentTarget) onOpenChange(false);
|
|
181
|
+
},
|
|
182
|
+
children: /* @__PURE__ */ jsxs(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
ref: drawerRef,
|
|
186
|
+
role: "dialog",
|
|
187
|
+
"aria-modal": "true",
|
|
188
|
+
"aria-label": ariaLabel ?? title,
|
|
189
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
190
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
191
|
+
tabIndex: -1,
|
|
192
|
+
className: cn(
|
|
193
|
+
"fixed flex flex-col bg-background shadow-xl border-border",
|
|
194
|
+
sideClasses[side],
|
|
195
|
+
sizeClasses[side][size],
|
|
196
|
+
motion
|
|
197
|
+
),
|
|
198
|
+
style: customExtent ? { [isVerticalSide ? "height" : "width"]: customExtent } : void 0,
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-border px-5 py-4", children: [
|
|
201
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
202
|
+
/* @__PURE__ */ jsx("h2", { id: titleId, className: "text-base font-semibold leading-tight", children: title }),
|
|
203
|
+
description && /* @__PURE__ */ jsx("p", { id: descriptionId, className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
204
|
+
] }),
|
|
205
|
+
showClose && /* @__PURE__ */ jsx(
|
|
206
|
+
"button",
|
|
207
|
+
{
|
|
208
|
+
type: "button",
|
|
209
|
+
onClick: () => onOpenChange(false),
|
|
210
|
+
"aria-label": closeLabel,
|
|
211
|
+
className: "-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
212
|
+
children: "\u2715"
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto px-5 py-4", children })
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
document.body
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// src/components/app-shell/AppShell.tsx
|
|
227
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
228
|
+
function containsActive(item, activeHref) {
|
|
229
|
+
if (!activeHref) return false;
|
|
230
|
+
if (item.href === activeHref) return true;
|
|
231
|
+
return (item.children ?? []).some((child) => containsActive(child, activeHref));
|
|
232
|
+
}
|
|
233
|
+
var itemClass = "flex w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
234
|
+
var activeClass = "bg-primary/10 font-medium text-primary";
|
|
235
|
+
var idleClass = "text-muted-foreground hover:bg-accent hover:text-accent-foreground";
|
|
236
|
+
function Sidebar({
|
|
237
|
+
sections,
|
|
238
|
+
heading,
|
|
239
|
+
footer,
|
|
240
|
+
activeHref,
|
|
241
|
+
linkComponent,
|
|
242
|
+
label = "Primary",
|
|
243
|
+
collapsible = false,
|
|
244
|
+
defaultCollapsed = false,
|
|
245
|
+
collapsed: collapsedProp,
|
|
246
|
+
onCollapsedChange,
|
|
247
|
+
defaultExpanded = [],
|
|
248
|
+
className,
|
|
249
|
+
...props
|
|
250
|
+
}) {
|
|
251
|
+
const Link3 = linkComponent ?? "a";
|
|
252
|
+
const [internalCollapsed, setInternalCollapsed] = React3.useState(defaultCollapsed);
|
|
253
|
+
const collapsed = collapsedProp ?? internalCollapsed;
|
|
254
|
+
const [openGroups, setOpenGroups] = React3.useState(defaultExpanded);
|
|
255
|
+
const isOpen = (item) => collapsed ? false : openGroups.includes(item.href) || containsActive(item, activeHref);
|
|
256
|
+
const toggleGroup = (href) => {
|
|
257
|
+
setOpenGroups(
|
|
258
|
+
(current) => current.includes(href) ? current.filter((entry) => entry !== href) : [...current, href]
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
const toggleCollapsed = () => {
|
|
262
|
+
const next = !collapsed;
|
|
263
|
+
if (collapsedProp === void 0) setInternalCollapsed(next);
|
|
264
|
+
onCollapsedChange?.(next);
|
|
265
|
+
};
|
|
266
|
+
const renderItems = (items, depth = 0) => /* @__PURE__ */ jsx2("ul", { className: cn("space-y-0.5", depth > 0 && "ml-3.5 border-l border-border pl-2.5"), children: items.map((item) => {
|
|
267
|
+
const active = item.active ?? containsActive(item, activeHref);
|
|
268
|
+
const hasChildren = Boolean(item.children?.length);
|
|
269
|
+
const expanded = hasChildren && isOpen(item);
|
|
270
|
+
const panelId = `sidebar-group-${item.href.replace(/[^a-z0-9-]/gi, "-")}`;
|
|
271
|
+
if (hasChildren) {
|
|
272
|
+
return /* @__PURE__ */ jsxs2("li", { children: [
|
|
273
|
+
/* @__PURE__ */ jsxs2(
|
|
274
|
+
"button",
|
|
275
|
+
{
|
|
276
|
+
type: "button",
|
|
277
|
+
"aria-expanded": expanded,
|
|
278
|
+
"aria-controls": expanded ? panelId : void 0,
|
|
279
|
+
onClick: () => toggleGroup(item.href),
|
|
280
|
+
title: collapsed ? item.label : void 0,
|
|
281
|
+
className: cn(itemClass, active ? activeClass : idleClass, collapsed && "justify-center px-0"),
|
|
282
|
+
children: [
|
|
283
|
+
item.icon && /* @__PURE__ */ jsx2("span", { className: "shrink-0 [&_svg]:size-4", children: item.icon }),
|
|
284
|
+
/* @__PURE__ */ jsx2("span", { className: cn("min-w-0 flex-1 truncate text-left", collapsed && "sr-only"), children: item.label }),
|
|
285
|
+
!collapsed && /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: cn("shrink-0 text-xs transition-transform", expanded && "rotate-90"), children: "\u203A" })
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
expanded && /* @__PURE__ */ jsx2("div", { id: panelId, children: renderItems(item.children, depth + 1) })
|
|
290
|
+
] }, item.href);
|
|
291
|
+
}
|
|
292
|
+
return /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsxs2(
|
|
293
|
+
Link3,
|
|
294
|
+
{
|
|
295
|
+
href: item.href,
|
|
296
|
+
"aria-current": active ? "page" : void 0,
|
|
297
|
+
title: collapsed ? item.label : void 0,
|
|
298
|
+
className: cn(itemClass, active ? activeClass : idleClass, collapsed && "justify-center px-0"),
|
|
299
|
+
children: [
|
|
300
|
+
item.icon && /* @__PURE__ */ jsx2("span", { className: "shrink-0 [&_svg]:size-4", children: item.icon }),
|
|
301
|
+
/* @__PURE__ */ jsx2("span", { className: cn("min-w-0 flex-1 truncate", collapsed && "sr-only"), children: item.label }),
|
|
302
|
+
!collapsed && item.badge && /* @__PURE__ */ jsx2("span", { className: "shrink-0 text-xs", children: item.badge })
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
) }, item.href);
|
|
306
|
+
}) });
|
|
307
|
+
return /* @__PURE__ */ jsxs2(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
"data-collapsed": collapsed || void 0,
|
|
311
|
+
className: cn("flex h-full min-h-0 flex-col gap-5 p-3", className),
|
|
312
|
+
...props,
|
|
313
|
+
children: [
|
|
314
|
+
heading && /* @__PURE__ */ jsx2("div", { className: cn("px-1", collapsed && "sr-only"), children: heading }),
|
|
315
|
+
/* @__PURE__ */ jsx2("nav", { "aria-label": label, className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto", children: sections.map((section, index) => /* @__PURE__ */ jsxs2("div", { children: [
|
|
316
|
+
section.title && /* @__PURE__ */ jsx2("p", { className: cn("mb-1.5 px-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", collapsed && "sr-only"), children: section.title }),
|
|
317
|
+
renderItems(section.items)
|
|
318
|
+
] }, section.title ?? `section-${index}`)) }),
|
|
319
|
+
collapsible && /* @__PURE__ */ jsx2(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
type: "button",
|
|
323
|
+
onClick: toggleCollapsed,
|
|
324
|
+
"aria-expanded": !collapsed,
|
|
325
|
+
"aria-label": collapsed ? "Expand navigation" : "Collapse navigation",
|
|
326
|
+
className: cn(itemClass, idleClass, "justify-center"),
|
|
327
|
+
children: /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: cn("transition-transform", collapsed && "rotate-180"), children: "\xAB" })
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
footer && !collapsed && /* @__PURE__ */ jsx2("div", { className: "border-t border-border pt-3", children: footer })
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
var hideAt = {
|
|
336
|
+
sm: "hidden sm:block",
|
|
337
|
+
md: "hidden md:block",
|
|
338
|
+
lg: "hidden lg:block"
|
|
339
|
+
};
|
|
340
|
+
var showBelow = {
|
|
341
|
+
sm: "sm:hidden",
|
|
342
|
+
md: "md:hidden",
|
|
343
|
+
lg: "lg:hidden"
|
|
344
|
+
};
|
|
345
|
+
function AppShell({
|
|
346
|
+
sidebar,
|
|
347
|
+
header,
|
|
348
|
+
hideMobileMenu = false,
|
|
349
|
+
sidebarWidth = "w-64",
|
|
350
|
+
mobileBreakpoint = "md",
|
|
351
|
+
className,
|
|
352
|
+
children,
|
|
353
|
+
...props
|
|
354
|
+
}) {
|
|
355
|
+
const [mobileOpen, setMobileOpen] = React3.useState(false);
|
|
356
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("flex min-h-screen bg-background text-foreground", className), ...props, children: [
|
|
357
|
+
sidebar && /* @__PURE__ */ jsx2(
|
|
358
|
+
"aside",
|
|
359
|
+
{
|
|
360
|
+
className: cn(
|
|
361
|
+
"shrink-0 border-r border-border has-[[data-collapsed]]:w-16",
|
|
362
|
+
hideAt[mobileBreakpoint],
|
|
363
|
+
sidebarWidth
|
|
364
|
+
),
|
|
365
|
+
children: sidebar
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
369
|
+
(header || sidebar && !hideMobileMenu) && /* @__PURE__ */ jsxs2("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: [
|
|
370
|
+
sidebar && !hideMobileMenu && /* @__PURE__ */ jsx2(
|
|
371
|
+
"button",
|
|
372
|
+
{
|
|
373
|
+
type: "button",
|
|
374
|
+
onClick: () => setMobileOpen(true),
|
|
375
|
+
"aria-label": "Open navigation",
|
|
376
|
+
className: cn("rounded-md border border-border p-2 text-muted-foreground hover:bg-muted", showBelow[mobileBreakpoint]),
|
|
377
|
+
children: /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: "\u2630" })
|
|
378
|
+
}
|
|
379
|
+
),
|
|
380
|
+
/* @__PURE__ */ jsx2("div", { className: "min-w-0 flex-1", children: header })
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ jsx2("main", { className: "min-w-0 flex-1", children })
|
|
383
|
+
] }),
|
|
384
|
+
sidebar && /* @__PURE__ */ jsx2(Drawer, { open: mobileOpen, onOpenChange: setMobileOpen, title: "Navigation", side: "left", size: "sm", animate: true, children: sidebar })
|
|
385
|
+
] });
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/components/button/Button.tsx
|
|
389
|
+
import * as React4 from "react";
|
|
53
390
|
import { Slot } from "@radix-ui/react-slot";
|
|
54
391
|
import { cva } from "class-variance-authority";
|
|
55
|
-
import { jsx } from "react/jsx-runtime";
|
|
392
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
56
393
|
var buttonVariants = cva(
|
|
57
394
|
"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",
|
|
58
395
|
{
|
|
59
396
|
variants: {
|
|
60
397
|
variant: {
|
|
61
398
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
399
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
62
400
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
401
|
+
danger: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
63
402
|
// Semantic status variants — foregrounds are the paired AA tokens
|
|
64
403
|
// (white on dark green, ink on amber/cyan) in both themes.
|
|
65
404
|
success: "bg-success text-success-foreground hover:bg-success/90",
|
|
66
405
|
warning: "bg-warning text-warning-foreground hover:bg-warning/90",
|
|
67
406
|
info: "bg-info text-info-foreground hover:bg-info/90",
|
|
68
407
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
408
|
+
// Colored outlines: semantic border + AA ink label on the page
|
|
409
|
+
// surface, with a faint tint on hover - mirrors the Alert recipe.
|
|
410
|
+
"outline-destructive": "border border-destructive/50 bg-background text-destructive hover:border-destructive hover:bg-destructive/10",
|
|
411
|
+
"outline-success": "border border-success/50 bg-background text-success hover:border-success hover:bg-success/10",
|
|
412
|
+
"outline-warning": "border border-warning/50 bg-background text-warning-ink hover:border-warning hover:bg-warning/10",
|
|
413
|
+
"outline-info": "border border-info/50 bg-background text-info-ink hover:border-info hover:bg-info/10",
|
|
69
414
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
70
415
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
71
416
|
link: "text-primary underline-offset-4 hover:underline"
|
|
@@ -83,15 +428,31 @@ var buttonVariants = cva(
|
|
|
83
428
|
}
|
|
84
429
|
}
|
|
85
430
|
);
|
|
86
|
-
var Button =
|
|
87
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
431
|
+
var Button = React4.forwardRef(
|
|
432
|
+
({ className, variant, size, asChild = false, loading = false, loadingLabel = "Loading", disabled, children, ...props }, ref) => {
|
|
88
433
|
const Comp = asChild ? Slot : "button";
|
|
89
|
-
|
|
90
|
-
Comp,
|
|
434
|
+
if (asChild) {
|
|
435
|
+
return /* @__PURE__ */ jsx3(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props, children });
|
|
436
|
+
}
|
|
437
|
+
return /* @__PURE__ */ jsxs3(
|
|
438
|
+
"button",
|
|
91
439
|
{
|
|
92
440
|
className: cn(buttonVariants({ variant, size, className })),
|
|
93
441
|
ref,
|
|
94
|
-
|
|
442
|
+
disabled: disabled || loading,
|
|
443
|
+
"aria-busy": loading || void 0,
|
|
444
|
+
...props,
|
|
445
|
+
children: [
|
|
446
|
+
loading && /* @__PURE__ */ jsx3(
|
|
447
|
+
"span",
|
|
448
|
+
{
|
|
449
|
+
"aria-hidden": "true",
|
|
450
|
+
className: "h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
loading && /* @__PURE__ */ jsx3("span", { className: "sr-only", children: loadingLabel }),
|
|
454
|
+
children
|
|
455
|
+
]
|
|
95
456
|
}
|
|
96
457
|
);
|
|
97
458
|
}
|
|
@@ -99,19 +460,22 @@ var Button = React2.forwardRef(
|
|
|
99
460
|
Button.displayName = "Button";
|
|
100
461
|
|
|
101
462
|
// src/components/button-group/ButtonGroup.tsx
|
|
102
|
-
import * as
|
|
103
|
-
import { jsx as
|
|
104
|
-
var ButtonGroup =
|
|
105
|
-
({ orientation = "horizontal", className, ...props }, ref) => /* @__PURE__ */
|
|
463
|
+
import * as React5 from "react";
|
|
464
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
465
|
+
var ButtonGroup = React5.forwardRef(
|
|
466
|
+
({ orientation = "horizontal", className, ...props }, ref) => /* @__PURE__ */ jsx4(
|
|
106
467
|
"div",
|
|
107
468
|
{
|
|
108
469
|
ref,
|
|
109
470
|
"data-slot": "button-group",
|
|
110
471
|
role: "group",
|
|
111
472
|
className: cn(
|
|
112
|
-
"inline-flex",
|
|
113
|
-
|
|
114
|
-
"[
|
|
473
|
+
"inline-flex overflow-hidden rounded-md border border-border bg-background",
|
|
474
|
+
"[&>*]:rounded-none [&>*]:border-0",
|
|
475
|
+
"[&>*:focus-visible]:ring-inset [&>*:focus-visible]:ring-offset-0",
|
|
476
|
+
// divide-* compiles to `.group > * ~ * { border-left/top }` — higher
|
|
477
|
+
// specificity than the lead-strip above, so seams stay exact.
|
|
478
|
+
orientation === "horizontal" ? "divide-x divide-border" : "flex-col divide-y divide-border",
|
|
115
479
|
className
|
|
116
480
|
),
|
|
117
481
|
...props
|
|
@@ -121,11 +485,11 @@ var ButtonGroup = React3.forwardRef(
|
|
|
121
485
|
ButtonGroup.displayName = "ButtonGroup";
|
|
122
486
|
|
|
123
487
|
// src/components/input/Input.tsx
|
|
124
|
-
import * as
|
|
125
|
-
import { jsx as
|
|
126
|
-
var Input =
|
|
488
|
+
import * as React6 from "react";
|
|
489
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
490
|
+
var Input = React6.forwardRef(
|
|
127
491
|
({ className, type, ...props }, ref) => {
|
|
128
|
-
return /* @__PURE__ */
|
|
492
|
+
return /* @__PURE__ */ jsx5(
|
|
129
493
|
"input",
|
|
130
494
|
{
|
|
131
495
|
type,
|
|
@@ -135,6 +499,7 @@ var Input = React4.forwardRef(
|
|
|
135
499
|
"placeholder:text-muted-foreground",
|
|
136
500
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
137
501
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
502
|
+
"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
|
|
138
503
|
className
|
|
139
504
|
),
|
|
140
505
|
ref,
|
|
@@ -146,13 +511,13 @@ var Input = React4.forwardRef(
|
|
|
146
511
|
Input.displayName = "Input";
|
|
147
512
|
|
|
148
513
|
// src/components/input-group/InputGroup.tsx
|
|
149
|
-
import * as
|
|
514
|
+
import * as React9 from "react";
|
|
150
515
|
|
|
151
516
|
// src/components/textarea/Textarea.tsx
|
|
152
|
-
import * as
|
|
153
|
-
import { jsx as
|
|
154
|
-
var Textarea =
|
|
155
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
517
|
+
import * as React7 from "react";
|
|
518
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
519
|
+
var Textarea = React7.forwardRef(
|
|
520
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
156
521
|
"textarea",
|
|
157
522
|
{
|
|
158
523
|
ref,
|
|
@@ -161,6 +526,7 @@ var Textarea = React5.forwardRef(
|
|
|
161
526
|
"placeholder:text-muted-foreground",
|
|
162
527
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
163
528
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
529
|
+
"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
|
|
164
530
|
className
|
|
165
531
|
),
|
|
166
532
|
...props
|
|
@@ -170,47 +536,59 @@ var Textarea = React5.forwardRef(
|
|
|
170
536
|
Textarea.displayName = "Textarea";
|
|
171
537
|
|
|
172
538
|
// src/components/select/Select.tsx
|
|
173
|
-
import * as
|
|
174
|
-
import { jsx as
|
|
175
|
-
var Select =
|
|
176
|
-
const generatedId =
|
|
539
|
+
import * as React8 from "react";
|
|
540
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
541
|
+
var Select = React8.forwardRef(function Select2({ options, groups, label, placeholder, multiple = false, value, defaultValue, onChange, onValueChange, id, className, ...props }, ref) {
|
|
542
|
+
const generatedId = React8.useId();
|
|
177
543
|
const selectId = id ?? generatedId;
|
|
178
544
|
const labelId = `${selectId}-label`;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
/* @__PURE__ */
|
|
545
|
+
const renderOption = (option) => /* @__PURE__ */ jsx7("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value);
|
|
546
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1.5", children: [
|
|
547
|
+
label && /* @__PURE__ */ jsx7("label", { id: labelId, htmlFor: selectId, className: "text-sm font-medium", children: label }),
|
|
548
|
+
/* @__PURE__ */ jsxs4(
|
|
182
549
|
"select",
|
|
183
550
|
{
|
|
184
551
|
ref,
|
|
185
552
|
id: selectId,
|
|
553
|
+
multiple,
|
|
186
554
|
"aria-labelledby": label ? labelId : void 0,
|
|
187
555
|
className: cn(
|
|
188
556
|
"rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
557
|
+
multiple && "min-h-32",
|
|
189
558
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
559
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
560
|
+
"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20",
|
|
190
561
|
className
|
|
191
562
|
),
|
|
192
563
|
value,
|
|
193
564
|
defaultValue,
|
|
194
|
-
onChange: (event) =>
|
|
565
|
+
onChange: (event) => {
|
|
566
|
+
const next = multiple ? Array.from(event.target.selectedOptions, (option) => option.value) : event.target.value;
|
|
567
|
+
onChange?.(next);
|
|
568
|
+
onValueChange?.(next);
|
|
569
|
+
},
|
|
195
570
|
...props,
|
|
196
|
-
children:
|
|
571
|
+
children: [
|
|
572
|
+
placeholder && /* @__PURE__ */ jsx7("option", { value: "", disabled: true, children: placeholder }),
|
|
573
|
+
groups ? groups.map((group) => /* @__PURE__ */ jsx7("optgroup", { label: group.label, children: group.options.map(renderOption) }, group.label)) : (options ?? []).map(renderOption)
|
|
574
|
+
]
|
|
197
575
|
}
|
|
198
576
|
)
|
|
199
577
|
] });
|
|
200
578
|
});
|
|
201
579
|
|
|
202
580
|
// src/components/input-group/InputGroup.tsx
|
|
203
|
-
import { jsx as
|
|
204
|
-
var isNestedField = (child) =>
|
|
205
|
-
var InputGroup =
|
|
581
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
582
|
+
var isNestedField = (child) => React9.isValidElement(child) && (child.type === Input || child.type === Textarea || child.type === Select);
|
|
583
|
+
var InputGroup = React9.forwardRef(
|
|
206
584
|
({ id, "aria-describedby": describedBy, "aria-invalid": invalid, className, children, ...props }, ref) => {
|
|
207
585
|
let wiredChildren = children;
|
|
208
586
|
if (id !== void 0 || describedBy !== void 0 || invalid !== void 0) {
|
|
209
|
-
const items =
|
|
587
|
+
const items = React9.Children.toArray(children);
|
|
210
588
|
const fieldIndex = items.findIndex(isNestedField);
|
|
211
589
|
if (fieldIndex !== -1) {
|
|
212
590
|
const field = items[fieldIndex];
|
|
213
|
-
items[fieldIndex] = isNestedField(field) ?
|
|
591
|
+
items[fieldIndex] = isNestedField(field) ? React9.cloneElement(field, {
|
|
214
592
|
...id !== void 0 && { id },
|
|
215
593
|
...describedBy !== void 0 && { "aria-describedby": describedBy },
|
|
216
594
|
...invalid !== void 0 && { "aria-invalid": invalid }
|
|
@@ -225,7 +603,7 @@ var InputGroup = React7.forwardRef(
|
|
|
225
603
|
};
|
|
226
604
|
}
|
|
227
605
|
}
|
|
228
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ jsx8(
|
|
229
607
|
"div",
|
|
230
608
|
{
|
|
231
609
|
ref,
|
|
@@ -233,12 +611,15 @@ var InputGroup = React7.forwardRef(
|
|
|
233
611
|
className: cn(
|
|
234
612
|
"flex h-10 w-full items-center overflow-hidden rounded-md border border-input bg-background",
|
|
235
613
|
"ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
236
|
-
// The group is the
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
"[&
|
|
614
|
+
// The group's outline is the only outline: force-strip every
|
|
615
|
+
// nested field's border, radius, ring, shadow and UA focus outline.
|
|
616
|
+
// Important flags defeat both the component's own utilities
|
|
617
|
+
// (Input ships `border` + `focus-visible:ring-2`) and browser
|
|
618
|
+
// defaults — no seams appear where an addon sits flush.
|
|
619
|
+
"[&_input]:h-full [&_input]:min-w-0 [&_input]:flex-1 [&_input]:rounded-none [&_input]:px-3 [&_input]:py-2",
|
|
620
|
+
"[&_input]:!border-0 [&_input]:!bg-transparent [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&_input]:!ring-offset-0",
|
|
621
|
+
"[&_textarea]:!border-0 [&_textarea]:!rounded-none [&_textarea]:!bg-transparent [&_textarea]:!shadow-none [&_textarea]:!outline-none [&_textarea]:!ring-0 [&_textarea]:!ring-offset-0",
|
|
622
|
+
"[&_select]:!border-0 [&_select]:!rounded-none [&_select]:!bg-transparent [&_select]:!shadow-none [&_select]:!outline-none [&_select]:!ring-0 [&_select]:!ring-offset-0",
|
|
242
623
|
"[&_input:disabled]:cursor-not-allowed",
|
|
243
624
|
className
|
|
244
625
|
),
|
|
@@ -249,8 +630,8 @@ var InputGroup = React7.forwardRef(
|
|
|
249
630
|
}
|
|
250
631
|
);
|
|
251
632
|
InputGroup.displayName = "InputGroup";
|
|
252
|
-
var InputGroupAddon =
|
|
253
|
-
({ side = "left", variant = "ghost", className, ...props }, ref) => /* @__PURE__ */
|
|
633
|
+
var InputGroupAddon = React9.forwardRef(
|
|
634
|
+
({ side = "left", variant = "ghost", className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
254
635
|
"div",
|
|
255
636
|
{
|
|
256
637
|
ref,
|
|
@@ -268,15 +649,22 @@ var InputGroupAddon = React7.forwardRef(
|
|
|
268
649
|
InputGroupAddon.displayName = "InputGroupAddon";
|
|
269
650
|
|
|
270
651
|
// src/components/badge/Badge.tsx
|
|
271
|
-
import * as
|
|
652
|
+
import * as React10 from "react";
|
|
653
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
272
654
|
import { cva as cva2 } from "class-variance-authority";
|
|
273
|
-
import { jsx as
|
|
655
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
274
656
|
var badgeVariants = cva2(
|
|
275
657
|
"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",
|
|
276
658
|
{
|
|
277
659
|
variants: {
|
|
278
660
|
variant: {
|
|
279
661
|
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
662
|
+
// Aliases used by shadcn/Bootstrap-style codebases.
|
|
663
|
+
primary: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
664
|
+
danger: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
665
|
+
success: "border-transparent bg-success text-success-foreground hover:bg-success/80",
|
|
666
|
+
warning: "border-transparent bg-warning text-warning-foreground hover:bg-warning/80",
|
|
667
|
+
info: "border-transparent bg-info text-info-foreground hover:bg-info/80",
|
|
280
668
|
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
281
669
|
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
282
670
|
outline: "text-foreground"
|
|
@@ -287,16 +675,19 @@ var badgeVariants = cva2(
|
|
|
287
675
|
}
|
|
288
676
|
}
|
|
289
677
|
);
|
|
290
|
-
var Badge =
|
|
291
|
-
({ className, variant, ...props }, ref) =>
|
|
678
|
+
var Badge = React10.forwardRef(
|
|
679
|
+
({ className, variant, asChild = false, ...props }, ref) => {
|
|
680
|
+
const Comp = asChild ? Slot2 : "div";
|
|
681
|
+
return /* @__PURE__ */ jsx9(Comp, { ref, className: cn(badgeVariants({ variant }), className), ...props });
|
|
682
|
+
}
|
|
292
683
|
);
|
|
293
684
|
Badge.displayName = "Badge";
|
|
294
685
|
|
|
295
686
|
// src/components/avatar/Avatar.tsx
|
|
296
|
-
import * as
|
|
687
|
+
import * as React11 from "react";
|
|
297
688
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
298
|
-
import { jsx as
|
|
299
|
-
var Avatar =
|
|
689
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
690
|
+
var Avatar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
300
691
|
AvatarPrimitive.Root,
|
|
301
692
|
{
|
|
302
693
|
ref,
|
|
@@ -308,7 +699,7 @@ var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
308
699
|
}
|
|
309
700
|
));
|
|
310
701
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
311
|
-
var AvatarImage =
|
|
702
|
+
var AvatarImage = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
312
703
|
AvatarPrimitive.Image,
|
|
313
704
|
{
|
|
314
705
|
ref,
|
|
@@ -317,7 +708,7 @@ var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
317
708
|
}
|
|
318
709
|
));
|
|
319
710
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
320
|
-
var AvatarFallback =
|
|
711
|
+
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
321
712
|
AvatarPrimitive.Fallback,
|
|
322
713
|
{
|
|
323
714
|
ref,
|
|
@@ -332,7 +723,7 @@ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
|
332
723
|
|
|
333
724
|
// src/components/spinner/Spinner.tsx
|
|
334
725
|
import { cva as cva3 } from "class-variance-authority";
|
|
335
|
-
import { jsx as
|
|
726
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
336
727
|
var spinnerVariants = cva3(
|
|
337
728
|
"inline-block animate-spin rounded-full border-2 border-current border-t-transparent text-muted-foreground motion-reduce:animate-none",
|
|
338
729
|
{
|
|
@@ -349,83 +740,83 @@ var spinnerVariants = cva3(
|
|
|
349
740
|
}
|
|
350
741
|
);
|
|
351
742
|
function Spinner({ className, size, label = "Loading...", ...props }) {
|
|
352
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ jsx11(
|
|
353
744
|
"span",
|
|
354
745
|
{
|
|
355
746
|
role: "status",
|
|
356
747
|
className: cn(spinnerVariants({ size }), className),
|
|
357
748
|
...props,
|
|
358
|
-
children: /* @__PURE__ */
|
|
749
|
+
children: /* @__PURE__ */ jsx11("span", { className: "sr-only", children: label })
|
|
359
750
|
}
|
|
360
751
|
);
|
|
361
752
|
}
|
|
362
753
|
|
|
363
754
|
// src/components/toast/Toast.tsx
|
|
364
|
-
import * as
|
|
365
|
-
import { jsx as
|
|
366
|
-
var ToastContext =
|
|
755
|
+
import * as React12 from "react";
|
|
756
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
757
|
+
var ToastContext = React12.createContext(null);
|
|
367
758
|
var DEFAULT_DURATION = 5e3;
|
|
368
759
|
function ToastProvider({ children, label = "Notifications" }) {
|
|
369
|
-
const [
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
const timer =
|
|
760
|
+
const [toasts2, setToasts] = React12.useState([]);
|
|
761
|
+
const timers2 = React12.useRef(/* @__PURE__ */ new Map());
|
|
762
|
+
const dismiss2 = React12.useCallback((id) => {
|
|
763
|
+
const timer = timers2.current.get(id);
|
|
373
764
|
if (timer) {
|
|
374
765
|
clearTimeout(timer);
|
|
375
|
-
|
|
766
|
+
timers2.current.delete(id);
|
|
376
767
|
}
|
|
377
768
|
setToasts((current) => current.filter((entry) => entry.id !== id));
|
|
378
769
|
}, []);
|
|
379
|
-
const
|
|
770
|
+
const toast2 = React12.useCallback(
|
|
380
771
|
(options) => {
|
|
381
772
|
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
382
773
|
setToasts((current) => [...current, { ...options, id }]);
|
|
383
774
|
const duration = options.duration ?? DEFAULT_DURATION;
|
|
384
775
|
if (duration > 0) {
|
|
385
|
-
|
|
776
|
+
timers2.current.set(
|
|
386
777
|
id,
|
|
387
|
-
setTimeout(() =>
|
|
778
|
+
setTimeout(() => dismiss2(id), duration)
|
|
388
779
|
);
|
|
389
780
|
}
|
|
390
781
|
return id;
|
|
391
782
|
},
|
|
392
|
-
[
|
|
783
|
+
[dismiss2]
|
|
393
784
|
);
|
|
394
|
-
|
|
395
|
-
const pending =
|
|
785
|
+
React12.useEffect(() => {
|
|
786
|
+
const pending = timers2.current;
|
|
396
787
|
return () => {
|
|
397
788
|
for (const timer of pending.values()) clearTimeout(timer);
|
|
398
789
|
pending.clear();
|
|
399
790
|
};
|
|
400
791
|
}, []);
|
|
401
|
-
const value =
|
|
402
|
-
return /* @__PURE__ */
|
|
792
|
+
const value = React12.useMemo(() => ({ toasts: toasts2, toast: toast2, dismiss: dismiss2 }), [toasts2, toast2, dismiss2]);
|
|
793
|
+
return /* @__PURE__ */ jsxs5(ToastContext.Provider, { value, children: [
|
|
403
794
|
children,
|
|
404
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx12(ToastRegion, { toasts: toasts2, onDismiss: dismiss2, label })
|
|
405
796
|
] });
|
|
406
797
|
}
|
|
407
798
|
function useToast() {
|
|
408
|
-
const context =
|
|
799
|
+
const context = React12.useContext(ToastContext);
|
|
409
800
|
if (!context) throw new Error("useToast must be used within a <ToastProvider>.");
|
|
410
801
|
return context;
|
|
411
802
|
}
|
|
412
803
|
function ToastRegion({
|
|
413
|
-
toasts,
|
|
804
|
+
toasts: toasts2,
|
|
414
805
|
onDismiss,
|
|
415
806
|
label
|
|
416
807
|
}) {
|
|
417
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ jsx12(
|
|
418
809
|
"ol",
|
|
419
810
|
{
|
|
420
811
|
"aria-label": label,
|
|
421
812
|
className: "fixed bottom-4 right-4 z-50 flex w-full max-w-sm flex-col gap-2",
|
|
422
|
-
children:
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
entry.description && /* @__PURE__ */
|
|
813
|
+
children: toasts2.map((entry) => /* @__PURE__ */ jsxs5("li", { className: "rounded-lg border border-border bg-card p-4 shadow-lg", children: [
|
|
814
|
+
/* @__PURE__ */ jsxs5("div", { role: "status", className: "flex items-start justify-between gap-3", children: [
|
|
815
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
816
|
+
/* @__PURE__ */ jsx12("p", { className: "text-sm font-semibold", children: entry.title }),
|
|
817
|
+
entry.description && /* @__PURE__ */ jsx12("p", { className: "mt-1 text-sm text-muted-foreground", children: entry.description })
|
|
427
818
|
] }),
|
|
428
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ jsx12(
|
|
429
820
|
"button",
|
|
430
821
|
{
|
|
431
822
|
type: "button",
|
|
@@ -436,7 +827,7 @@ function ToastRegion({
|
|
|
436
827
|
}
|
|
437
828
|
)
|
|
438
829
|
] }),
|
|
439
|
-
entry.action && /* @__PURE__ */
|
|
830
|
+
entry.action && /* @__PURE__ */ jsx12(
|
|
440
831
|
"button",
|
|
441
832
|
{
|
|
442
833
|
type: "button",
|
|
@@ -453,165 +844,201 @@ function ToastRegion({
|
|
|
453
844
|
);
|
|
454
845
|
}
|
|
455
846
|
|
|
456
|
-
// src/components/
|
|
457
|
-
import * as
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
var
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
847
|
+
// src/components/toast/Toaster.tsx
|
|
848
|
+
import * as React13 from "react";
|
|
849
|
+
|
|
850
|
+
// src/components/toast/toast-store.ts
|
|
851
|
+
var DEFAULT_DURATION2 = 5e3;
|
|
852
|
+
var toasts = [];
|
|
853
|
+
var EMPTY = [];
|
|
854
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
855
|
+
var timers = /* @__PURE__ */ new Map();
|
|
856
|
+
function emit() {
|
|
857
|
+
for (const listener of listeners) listener(toasts);
|
|
858
|
+
}
|
|
859
|
+
function dismiss(id) {
|
|
860
|
+
const timer = timers.get(id);
|
|
861
|
+
if (timer) {
|
|
862
|
+
clearTimeout(timer);
|
|
863
|
+
timers.delete(id);
|
|
864
|
+
}
|
|
865
|
+
toasts = toasts.filter((entry) => entry.id !== id);
|
|
866
|
+
emit();
|
|
867
|
+
}
|
|
868
|
+
function show(options) {
|
|
869
|
+
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
870
|
+
toasts = [...toasts, { ...options, id }];
|
|
871
|
+
emit();
|
|
872
|
+
const duration = options.duration ?? DEFAULT_DURATION2;
|
|
873
|
+
if (duration > 0) {
|
|
874
|
+
timers.set(
|
|
875
|
+
id,
|
|
876
|
+
setTimeout(() => dismiss(id), duration)
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
return id;
|
|
880
|
+
}
|
|
881
|
+
var toast = Object.assign(
|
|
882
|
+
(options) => show({ ...options, variant: options.variant ?? "default" }),
|
|
883
|
+
{
|
|
884
|
+
success: (title, description) => show({ title, description, variant: "success" }),
|
|
885
|
+
error: (title, description) => show({ title, description, variant: "error" }),
|
|
886
|
+
warning: (title, description) => show({ title, description, variant: "warning" }),
|
|
887
|
+
info: (title, description) => show({ title, description, variant: "info" }),
|
|
888
|
+
dismiss: (id) => {
|
|
889
|
+
if (id) {
|
|
890
|
+
dismiss(id);
|
|
497
891
|
return;
|
|
498
892
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
893
|
+
for (const entry of [...toasts]) dismiss(entry.id);
|
|
894
|
+
},
|
|
895
|
+
clear: () => {
|
|
896
|
+
for (const entry of [...toasts]) dismiss(entry.id);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
);
|
|
900
|
+
function subscribeToToasts(listener) {
|
|
901
|
+
listeners.add(listener);
|
|
902
|
+
return () => listeners.delete(listener);
|
|
903
|
+
}
|
|
904
|
+
function getToastSnapshot() {
|
|
905
|
+
return toasts;
|
|
906
|
+
}
|
|
907
|
+
function getToastServerSnapshot() {
|
|
908
|
+
return EMPTY;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// src/components/toast/Toaster.tsx
|
|
912
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
913
|
+
var positionClasses = {
|
|
914
|
+
"top-left": "left-4 top-4 items-start",
|
|
915
|
+
"top-center": "left-1/2 top-4 -translate-x-1/2 items-center",
|
|
916
|
+
"top-right": "right-4 top-4 items-end",
|
|
917
|
+
"bottom-left": "bottom-4 left-4 items-start",
|
|
918
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center",
|
|
919
|
+
"bottom-right": "bottom-4 right-4 items-end"
|
|
920
|
+
};
|
|
921
|
+
var richClasses = {
|
|
922
|
+
default: "border-border bg-card",
|
|
923
|
+
success: "border-success/50 bg-success/10",
|
|
924
|
+
error: "border-destructive/50 bg-destructive/10",
|
|
925
|
+
warning: "border-warning/50 bg-warning/10",
|
|
926
|
+
info: "border-info/50 bg-info/10"
|
|
927
|
+
};
|
|
928
|
+
var dotClasses = {
|
|
929
|
+
default: "bg-muted-foreground",
|
|
930
|
+
success: "bg-success",
|
|
931
|
+
error: "bg-destructive",
|
|
932
|
+
warning: "bg-warning",
|
|
933
|
+
info: "bg-info"
|
|
934
|
+
};
|
|
935
|
+
function Toaster({ position = "bottom-right", label = "Notifications", richColors = false }) {
|
|
936
|
+
const entries = React13.useSyncExternalStore(subscribeToToasts, getToastSnapshot, getToastServerSnapshot);
|
|
937
|
+
return /* @__PURE__ */ jsx13(
|
|
938
|
+
"ol",
|
|
939
|
+
{
|
|
940
|
+
"aria-label": label,
|
|
941
|
+
className: cn("fixed z-[60] flex w-full max-w-sm flex-col gap-2", positionClasses[position]),
|
|
942
|
+
children: entries.map((entry) => {
|
|
943
|
+
const variant = entry.variant ?? "default";
|
|
944
|
+
return /* @__PURE__ */ jsx13(
|
|
945
|
+
"li",
|
|
533
946
|
{
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
"
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
showClose && /* @__PURE__ */ jsx11(
|
|
947
|
+
className: cn(
|
|
948
|
+
"rounded-lg border p-4 shadow-lg",
|
|
949
|
+
richColors ? richClasses[variant] : "border-border bg-card"
|
|
950
|
+
),
|
|
951
|
+
children: /* @__PURE__ */ jsxs6("div", { role: "status", className: "flex items-start gap-3", children: [
|
|
952
|
+
/* @__PURE__ */ jsx13("span", { "aria-hidden": "true", className: cn("mt-1 h-2 w-2 shrink-0 rounded-full", dotClasses[variant]) }),
|
|
953
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0 flex-1", children: [
|
|
954
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm font-semibold", children: entry.title }),
|
|
955
|
+
entry.description && /* @__PURE__ */ jsx13("p", { className: "mt-1 text-sm text-muted-foreground", children: entry.description }),
|
|
956
|
+
entry.action && /* @__PURE__ */ jsx13(
|
|
545
957
|
"button",
|
|
546
958
|
{
|
|
547
959
|
type: "button",
|
|
548
|
-
onClick: () =>
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
960
|
+
onClick: () => {
|
|
961
|
+
entry.action?.onClick();
|
|
962
|
+
toast.dismiss(entry.id);
|
|
963
|
+
},
|
|
964
|
+
className: "mt-2 text-sm font-medium text-primary hover:underline",
|
|
965
|
+
children: entry.action.label
|
|
552
966
|
}
|
|
553
967
|
)
|
|
554
968
|
] }),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
969
|
+
/* @__PURE__ */ jsx13(
|
|
970
|
+
"button",
|
|
971
|
+
{
|
|
972
|
+
type: "button",
|
|
973
|
+
onClick: () => toast.dismiss(entry.id),
|
|
974
|
+
"aria-label": `Dismiss ${entry.title}`,
|
|
975
|
+
className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
976
|
+
children: "\u2715"
|
|
977
|
+
}
|
|
978
|
+
)
|
|
979
|
+
] })
|
|
980
|
+
},
|
|
981
|
+
entry.id
|
|
982
|
+
);
|
|
983
|
+
})
|
|
984
|
+
}
|
|
563
985
|
);
|
|
564
986
|
}
|
|
565
987
|
|
|
566
|
-
// src/components/
|
|
567
|
-
import * as
|
|
988
|
+
// src/components/dialog/Dialog.tsx
|
|
989
|
+
import * as React14 from "react";
|
|
568
990
|
import { createPortal as createPortal2 } from "react-dom";
|
|
569
|
-
import { jsx as
|
|
991
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
570
992
|
var FOCUSABLE2 = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
571
|
-
var
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
var sizeClasses = {
|
|
578
|
-
right: { sm: "w-72", md: "w-96", lg: "w-[32rem]" },
|
|
579
|
-
left: { sm: "w-72", md: "w-96", lg: "w-[32rem]" },
|
|
580
|
-
top: { sm: "h-48", md: "h-80", lg: "h-[32rem]" },
|
|
581
|
-
bottom: { sm: "h-48", md: "h-80", lg: "h-[32rem]" }
|
|
582
|
-
};
|
|
583
|
-
var slideIn = {
|
|
584
|
-
right: "slide-in-from-right",
|
|
585
|
-
left: "slide-in-from-left",
|
|
586
|
-
top: "slide-in-from-top",
|
|
587
|
-
bottom: "slide-in-from-bottom"
|
|
588
|
-
};
|
|
589
|
-
var slideOut = {
|
|
590
|
-
right: "slide-out-to-right",
|
|
591
|
-
left: "slide-out-to-left",
|
|
592
|
-
top: "slide-out-to-top",
|
|
593
|
-
bottom: "slide-out-to-bottom"
|
|
993
|
+
var sizeClasses2 = {
|
|
994
|
+
sm: "max-w-sm",
|
|
995
|
+
md: "max-w-md",
|
|
996
|
+
lg: "max-w-lg",
|
|
997
|
+
xl: "max-w-xl",
|
|
998
|
+
"2xl": "max-w-2xl"
|
|
594
999
|
};
|
|
595
|
-
|
|
1000
|
+
var DialogIdsContext = React14.createContext(null);
|
|
1001
|
+
function DialogHeader({ className, ...props }) {
|
|
1002
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("flex items-start justify-between gap-4", className), ...props });
|
|
1003
|
+
}
|
|
1004
|
+
function DialogTitle({ className, ...props }) {
|
|
1005
|
+
const ids = React14.useContext(DialogIdsContext);
|
|
1006
|
+
return /* @__PURE__ */ jsx14("h2", { id: ids?.titleId, className: cn("text-lg font-semibold", className), ...props });
|
|
1007
|
+
}
|
|
1008
|
+
function DialogDescription({ className, ...props }) {
|
|
1009
|
+
const ids = React14.useContext(DialogIdsContext);
|
|
1010
|
+
return /* @__PURE__ */ jsx14("p", { id: ids?.descriptionId, className: cn("mt-2 text-sm text-muted-foreground", className), ...props });
|
|
1011
|
+
}
|
|
1012
|
+
function DialogBody({ className, ...props }) {
|
|
1013
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("mt-4", className), ...props });
|
|
1014
|
+
}
|
|
1015
|
+
function DialogFooter({ className, ...props }) {
|
|
1016
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("mt-6 flex items-center justify-end gap-2", className), ...props });
|
|
1017
|
+
}
|
|
1018
|
+
function Dialog({
|
|
596
1019
|
open,
|
|
597
1020
|
onOpenChange,
|
|
598
1021
|
title,
|
|
599
1022
|
description,
|
|
600
1023
|
children,
|
|
601
|
-
side = "right",
|
|
602
1024
|
size = "md",
|
|
1025
|
+
header,
|
|
1026
|
+
footer,
|
|
1027
|
+
scrollable = false,
|
|
1028
|
+
bodyClassName,
|
|
603
1029
|
closeOnBackdrop = true,
|
|
604
1030
|
showClose = true,
|
|
1031
|
+
closeLabel = "Close dialog",
|
|
605
1032
|
initialFocusRef,
|
|
606
1033
|
ariaLabel,
|
|
607
1034
|
animate = false
|
|
608
1035
|
}) {
|
|
609
|
-
const
|
|
610
|
-
const previouslyFocused =
|
|
611
|
-
const titleId =
|
|
612
|
-
const descriptionId =
|
|
1036
|
+
const dialogRef = React14.useRef(null);
|
|
1037
|
+
const previouslyFocused = React14.useRef(null);
|
|
1038
|
+
const titleId = React14.useId();
|
|
1039
|
+
const descriptionId = React14.useId();
|
|
613
1040
|
const { present, exiting } = usePresence(open, animate);
|
|
614
|
-
|
|
1041
|
+
React14.useEffect(() => {
|
|
615
1042
|
if (open) {
|
|
616
1043
|
previouslyFocused.current = document.activeElement;
|
|
617
1044
|
return;
|
|
@@ -619,13 +1046,13 @@ function Drawer({
|
|
|
619
1046
|
previouslyFocused.current?.focus?.();
|
|
620
1047
|
previouslyFocused.current = null;
|
|
621
1048
|
}, [open]);
|
|
622
|
-
|
|
1049
|
+
React14.useEffect(() => {
|
|
623
1050
|
if (!open || !present) return;
|
|
624
|
-
const node =
|
|
1051
|
+
const node = dialogRef.current;
|
|
625
1052
|
const target = initialFocusRef?.current ?? node?.querySelector(FOCUSABLE2) ?? node;
|
|
626
1053
|
target?.focus();
|
|
627
1054
|
}, [open, present, initialFocusRef]);
|
|
628
|
-
|
|
1055
|
+
React14.useEffect(() => {
|
|
629
1056
|
if (!open) return;
|
|
630
1057
|
const onKeyDown = (event) => {
|
|
631
1058
|
if (event.key === "Escape") {
|
|
@@ -634,17 +1061,14 @@ function Drawer({
|
|
|
634
1061
|
return;
|
|
635
1062
|
}
|
|
636
1063
|
if (event.key !== "Tab") return;
|
|
637
|
-
const node =
|
|
1064
|
+
const node = dialogRef.current;
|
|
638
1065
|
if (!node) return;
|
|
639
1066
|
const focusable = Array.from(node.querySelectorAll(FOCUSABLE2));
|
|
640
|
-
if (focusable.length === 0)
|
|
641
|
-
event.preventDefault();
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
1067
|
+
if (focusable.length === 0) return;
|
|
644
1068
|
const first = focusable[0];
|
|
645
1069
|
const last = focusable[focusable.length - 1];
|
|
646
1070
|
const active = document.activeElement;
|
|
647
|
-
if (event.shiftKey && (active === first ||
|
|
1071
|
+
if (event.shiftKey && (active === first || active === node)) {
|
|
648
1072
|
event.preventDefault();
|
|
649
1073
|
last.focus();
|
|
650
1074
|
} else if (!event.shiftKey && active === last) {
|
|
@@ -652,57 +1076,67 @@ function Drawer({
|
|
|
652
1076
|
first.focus();
|
|
653
1077
|
}
|
|
654
1078
|
};
|
|
655
|
-
document.addEventListener("keydown", onKeyDown);
|
|
656
|
-
return () => document.removeEventListener("keydown", onKeyDown);
|
|
1079
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
1080
|
+
return () => document.removeEventListener("keydown", onKeyDown, true);
|
|
657
1081
|
}, [open, onOpenChange]);
|
|
658
1082
|
if (!present || typeof document === "undefined") return null;
|
|
659
1083
|
const motion = animate ? cn(
|
|
660
1084
|
"duration-200 motion-reduce:animate-none",
|
|
661
|
-
exiting ?
|
|
1085
|
+
exiting ? "animate-out fade-out-0 zoom-out-95" : "animate-in fade-in-0 zoom-in-95"
|
|
662
1086
|
) : void 0;
|
|
663
1087
|
return createPortal2(
|
|
664
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ jsx14(
|
|
665
1089
|
"div",
|
|
666
1090
|
{
|
|
667
|
-
className: "fixed inset-0 z-50",
|
|
1091
|
+
className: cn("fixed inset-0 z-50 flex items-center justify-center bg-background/80 p-4", motion),
|
|
668
1092
|
onMouseDown: (event) => {
|
|
669
1093
|
if (closeOnBackdrop && event.target === event.currentTarget) onOpenChange(false);
|
|
670
1094
|
},
|
|
671
|
-
children: /* @__PURE__ */
|
|
1095
|
+
children: /* @__PURE__ */ jsx14(
|
|
672
1096
|
"div",
|
|
673
1097
|
{
|
|
674
|
-
ref:
|
|
1098
|
+
ref: dialogRef,
|
|
675
1099
|
role: "dialog",
|
|
676
1100
|
"aria-modal": "true",
|
|
677
|
-
"aria-
|
|
678
|
-
"aria-
|
|
1101
|
+
"aria-labelledby": ariaLabel ? void 0 : titleId,
|
|
1102
|
+
"aria-label": ariaLabel,
|
|
679
1103
|
"aria-describedby": description ? descriptionId : void 0,
|
|
680
1104
|
tabIndex: -1,
|
|
681
1105
|
className: cn(
|
|
682
|
-
"
|
|
683
|
-
|
|
684
|
-
sizeClasses[side][size],
|
|
1106
|
+
"flex w-full flex-col rounded-xl border border-border bg-card p-6 shadow-xl",
|
|
1107
|
+
sizeClasses2[size],
|
|
685
1108
|
motion
|
|
686
1109
|
),
|
|
687
|
-
children: [
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
/* @__PURE__ */
|
|
691
|
-
description && /* @__PURE__ */
|
|
1110
|
+
children: /* @__PURE__ */ jsxs7(DialogIdsContext.Provider, { value: { titleId, descriptionId }, children: [
|
|
1111
|
+
header ?? /* @__PURE__ */ jsxs7(DialogHeader, { children: [
|
|
1112
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
|
|
1113
|
+
title && /* @__PURE__ */ jsx14(DialogTitle, { children: title }),
|
|
1114
|
+
description && /* @__PURE__ */ jsx14(DialogDescription, { children: description })
|
|
692
1115
|
] }),
|
|
693
|
-
showClose && /* @__PURE__ */
|
|
1116
|
+
showClose && /* @__PURE__ */ jsx14(
|
|
694
1117
|
"button",
|
|
695
1118
|
{
|
|
696
1119
|
type: "button",
|
|
697
1120
|
onClick: () => onOpenChange(false),
|
|
698
|
-
"aria-label":
|
|
699
|
-
className: "
|
|
1121
|
+
"aria-label": closeLabel,
|
|
1122
|
+
className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
700
1123
|
children: "\u2715"
|
|
701
1124
|
}
|
|
702
1125
|
)
|
|
703
1126
|
] }),
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
|
|
1127
|
+
/* @__PURE__ */ jsx14(
|
|
1128
|
+
"div",
|
|
1129
|
+
{
|
|
1130
|
+
className: cn(
|
|
1131
|
+
"mt-4 min-h-0",
|
|
1132
|
+
scrollable && "max-h-[60vh] overflow-y-auto pr-1",
|
|
1133
|
+
bodyClassName
|
|
1134
|
+
),
|
|
1135
|
+
children
|
|
1136
|
+
}
|
|
1137
|
+
),
|
|
1138
|
+
footer && /* @__PURE__ */ jsx14(DialogFooter, { children: footer })
|
|
1139
|
+
] })
|
|
706
1140
|
}
|
|
707
1141
|
)
|
|
708
1142
|
}
|
|
@@ -711,12 +1145,308 @@ function Drawer({
|
|
|
711
1145
|
);
|
|
712
1146
|
}
|
|
713
1147
|
|
|
714
|
-
// src/components/
|
|
715
|
-
import * as
|
|
1148
|
+
// src/components/table-card/TableCard.tsx
|
|
1149
|
+
import * as React15 from "react";
|
|
1150
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1151
|
+
var TableCard = React15.forwardRef(function TableCard2({ title, description, actions, toolbar, children, footer, flush = true, className, ...props }, ref) {
|
|
1152
|
+
return /* @__PURE__ */ jsxs8(
|
|
1153
|
+
"div",
|
|
1154
|
+
{
|
|
1155
|
+
ref,
|
|
1156
|
+
className: cn("overflow-hidden rounded-xl border border-border bg-card text-card-foreground", className),
|
|
1157
|
+
...props,
|
|
1158
|
+
children: [
|
|
1159
|
+
(title || description || actions) && /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
1160
|
+
/* @__PURE__ */ jsxs8("div", { className: "min-w-0", children: [
|
|
1161
|
+
title && /* @__PURE__ */ jsx15("h2", { className: "text-sm font-semibold", children: title }),
|
|
1162
|
+
description && /* @__PURE__ */ jsx15("p", { className: "mt-0.5 text-sm text-muted-foreground", children: description })
|
|
1163
|
+
] }),
|
|
1164
|
+
actions && /* @__PURE__ */ jsx15("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
1165
|
+
] }),
|
|
1166
|
+
toolbar && /* @__PURE__ */ jsx15("div", { className: "border-b border-border px-4 py-2", children: toolbar }),
|
|
1167
|
+
/* @__PURE__ */ jsx15("div", { className: cn(flush ? "overflow-x-auto" : "p-4"), children }),
|
|
1168
|
+
footer && /* @__PURE__ */ jsx15("div", { className: "border-t border-border px-4 py-3", children: footer })
|
|
1169
|
+
]
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
// src/components/select-menu/SelectMenu.tsx
|
|
1175
|
+
import * as React16 from "react";
|
|
716
1176
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1177
|
+
import { Fragment, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1178
|
+
function useOutsideClose(open, close, refs) {
|
|
1179
|
+
React16.useEffect(() => {
|
|
1180
|
+
if (!open) return;
|
|
1181
|
+
const onPointerDown = (event) => {
|
|
1182
|
+
const target = event.target;
|
|
1183
|
+
if (refs.some((ref) => ref.current?.contains(target))) return;
|
|
1184
|
+
close();
|
|
1185
|
+
};
|
|
1186
|
+
document.addEventListener("mousedown", onPointerDown);
|
|
1187
|
+
return () => document.removeEventListener("mousedown", onPointerDown);
|
|
1188
|
+
}, [open, close, refs]);
|
|
1189
|
+
}
|
|
1190
|
+
var SelectMenu = React16.forwardRef(function SelectMenu2({
|
|
1191
|
+
items,
|
|
1192
|
+
value,
|
|
1193
|
+
defaultValue,
|
|
1194
|
+
onValueChange,
|
|
1195
|
+
multiple = false,
|
|
1196
|
+
placeholder = "Select\u2026",
|
|
1197
|
+
name,
|
|
1198
|
+
renderValue,
|
|
1199
|
+
renderItem,
|
|
1200
|
+
emptyText = "No options",
|
|
1201
|
+
className,
|
|
1202
|
+
disabled,
|
|
1203
|
+
onKeyDown,
|
|
1204
|
+
...buttonProps
|
|
1205
|
+
}, ref) {
|
|
1206
|
+
const [internal, setInternal] = React16.useState(() => {
|
|
1207
|
+
if (defaultValue === void 0) return [];
|
|
1208
|
+
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
1209
|
+
});
|
|
1210
|
+
const selectedValues = React16.useMemo(() => {
|
|
1211
|
+
if (value === void 0) return internal;
|
|
1212
|
+
return Array.isArray(value) ? value : [value];
|
|
1213
|
+
}, [value, internal]);
|
|
1214
|
+
const [open, setOpen] = React16.useState(false);
|
|
1215
|
+
const [activeIndex, setActiveIndex] = React16.useState(-1);
|
|
1216
|
+
const [position, setPosition] = React16.useState(null);
|
|
1217
|
+
const triggerRef = React16.useRef(null);
|
|
1218
|
+
const listRef = React16.useRef(null);
|
|
1219
|
+
const listboxId = React16.useId();
|
|
1220
|
+
const labelId = React16.useId();
|
|
1221
|
+
const typeahead = React16.useRef({ query: "", at: 0 });
|
|
1222
|
+
const setTriggerRef = React16.useCallback(
|
|
1223
|
+
(node) => {
|
|
1224
|
+
triggerRef.current = node;
|
|
1225
|
+
if (typeof ref === "function") ref(node);
|
|
1226
|
+
else if (ref) ref.current = node;
|
|
1227
|
+
},
|
|
1228
|
+
[ref]
|
|
1229
|
+
);
|
|
1230
|
+
const close = React16.useCallback(() => setOpen(false), []);
|
|
1231
|
+
useOutsideClose(open, close, [triggerRef, listRef]);
|
|
1232
|
+
const measure = React16.useCallback(() => {
|
|
1233
|
+
const node = triggerRef.current;
|
|
1234
|
+
if (!node) return;
|
|
1235
|
+
const rect = node.getBoundingClientRect();
|
|
1236
|
+
setPosition({ top: rect.bottom + 4, left: rect.left, width: Math.max(rect.width, 200) });
|
|
1237
|
+
}, []);
|
|
1238
|
+
React16.useEffect(() => {
|
|
1239
|
+
if (!open) return;
|
|
1240
|
+
measure();
|
|
1241
|
+
const onScroll = () => measure();
|
|
1242
|
+
window.addEventListener("resize", onScroll);
|
|
1243
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1244
|
+
return () => {
|
|
1245
|
+
window.removeEventListener("resize", onScroll);
|
|
1246
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
1247
|
+
};
|
|
1248
|
+
}, [open, measure]);
|
|
1249
|
+
const firstEnabled = React16.useMemo(() => items.findIndex((item) => !item.disabled), [items]);
|
|
1250
|
+
const openMenu = () => {
|
|
1251
|
+
if (disabled) return;
|
|
1252
|
+
setOpen(true);
|
|
1253
|
+
const selectedIndex = items.findIndex((item) => selectedValues.includes(item.value) && !item.disabled);
|
|
1254
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled);
|
|
1255
|
+
};
|
|
1256
|
+
const commit = (next) => {
|
|
1257
|
+
if (value === void 0) setInternal(next);
|
|
1258
|
+
onValueChange?.(multiple ? next : next[0] ?? "");
|
|
1259
|
+
};
|
|
1260
|
+
const select = (item) => {
|
|
1261
|
+
if (item.disabled) return;
|
|
1262
|
+
if (multiple) {
|
|
1263
|
+
const next = selectedValues.includes(item.value) ? selectedValues.filter((entry) => entry !== item.value) : [...selectedValues, item.value];
|
|
1264
|
+
commit(next);
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
commit([item.value]);
|
|
1268
|
+
setOpen(false);
|
|
1269
|
+
};
|
|
1270
|
+
const move = (direction) => {
|
|
1271
|
+
if (items.length === 0) return;
|
|
1272
|
+
let index = activeIndex;
|
|
1273
|
+
for (let step = 0; step < items.length; step += 1) {
|
|
1274
|
+
index = (index + direction + items.length) % items.length;
|
|
1275
|
+
if (!items[index]?.disabled) {
|
|
1276
|
+
setActiveIndex(index);
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
const handleKeyDown = (event) => {
|
|
1282
|
+
onKeyDown?.(event);
|
|
1283
|
+
if (event.defaultPrevented) return;
|
|
1284
|
+
if (!open) {
|
|
1285
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
1286
|
+
event.preventDefault();
|
|
1287
|
+
openMenu();
|
|
1288
|
+
}
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
switch (event.key) {
|
|
1292
|
+
case "ArrowDown":
|
|
1293
|
+
event.preventDefault();
|
|
1294
|
+
move(1);
|
|
1295
|
+
break;
|
|
1296
|
+
case "ArrowUp":
|
|
1297
|
+
event.preventDefault();
|
|
1298
|
+
move(-1);
|
|
1299
|
+
break;
|
|
1300
|
+
case "Home":
|
|
1301
|
+
event.preventDefault();
|
|
1302
|
+
setActiveIndex(firstEnabled);
|
|
1303
|
+
break;
|
|
1304
|
+
case "End": {
|
|
1305
|
+
event.preventDefault();
|
|
1306
|
+
for (let i = items.length - 1; i >= 0; i -= 1) {
|
|
1307
|
+
if (!items[i]?.disabled) {
|
|
1308
|
+
setActiveIndex(i);
|
|
1309
|
+
break;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
break;
|
|
1313
|
+
}
|
|
1314
|
+
case "Enter":
|
|
1315
|
+
case " ":
|
|
1316
|
+
event.preventDefault();
|
|
1317
|
+
if (activeIndex >= 0 && items[activeIndex]) select(items[activeIndex]);
|
|
1318
|
+
break;
|
|
1319
|
+
case "Escape":
|
|
1320
|
+
event.preventDefault();
|
|
1321
|
+
setOpen(false);
|
|
1322
|
+
break;
|
|
1323
|
+
case "Tab":
|
|
1324
|
+
setOpen(false);
|
|
1325
|
+
break;
|
|
1326
|
+
default: {
|
|
1327
|
+
if (event.key.length !== 1 || event.metaKey || event.ctrlKey || event.altKey) return;
|
|
1328
|
+
const now = Date.now();
|
|
1329
|
+
const buffer = now - typeahead.current.at > 600 ? event.key : typeahead.current.query + event.key;
|
|
1330
|
+
typeahead.current = { query: buffer, at: now };
|
|
1331
|
+
const query = buffer.toLowerCase();
|
|
1332
|
+
const index = items.findIndex((item) => !item.disabled && item.label.toLowerCase().startsWith(query));
|
|
1333
|
+
if (index >= 0) setActiveIndex(index);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
const selectedItems = items.filter((item) => selectedValues.includes(item.value));
|
|
1338
|
+
const triggerContent = renderValue ? renderValue(selectedItems) : selectedItems.length === 0 ? /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: placeholder }) : multiple ? /* @__PURE__ */ jsx16("span", { className: "truncate", children: selectedItems.length === 1 ? selectedItems[0].label : `${selectedItems.length} selected` }) : /* @__PURE__ */ jsx16("span", { className: "truncate", children: selectedItems[0].label });
|
|
1339
|
+
const activeOptionId = activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0;
|
|
1340
|
+
const rows = React16.useMemo(() => {
|
|
1341
|
+
const out = [];
|
|
1342
|
+
let lastGroup;
|
|
1343
|
+
items.forEach((item, index) => {
|
|
1344
|
+
if (item.group && item.group !== lastGroup) {
|
|
1345
|
+
out.push({ heading: item.group, index: -1 });
|
|
1346
|
+
lastGroup = item.group;
|
|
1347
|
+
}
|
|
1348
|
+
out.push({ item, index });
|
|
1349
|
+
});
|
|
1350
|
+
return out;
|
|
1351
|
+
}, [items]);
|
|
1352
|
+
return /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
1353
|
+
/* @__PURE__ */ jsx16("span", { id: labelId, className: "sr-only", children: typeof buttonProps["aria-label"] === "string" ? buttonProps["aria-label"] : "Select" }),
|
|
1354
|
+
name && selectedValues.map((selected) => /* @__PURE__ */ jsx16("input", { type: "hidden", name, value: selected }, selected)),
|
|
1355
|
+
/* @__PURE__ */ jsxs9(
|
|
1356
|
+
"button",
|
|
1357
|
+
{
|
|
1358
|
+
ref: setTriggerRef,
|
|
1359
|
+
type: "button",
|
|
1360
|
+
"aria-haspopup": "listbox",
|
|
1361
|
+
"aria-expanded": open,
|
|
1362
|
+
"aria-controls": open ? listboxId : void 0,
|
|
1363
|
+
"aria-activedescendant": open ? activeOptionId : void 0,
|
|
1364
|
+
"aria-labelledby": labelId,
|
|
1365
|
+
disabled,
|
|
1366
|
+
onClick: () => open ? setOpen(false) : openMenu(),
|
|
1367
|
+
onKeyDown: handleKeyDown,
|
|
1368
|
+
className: cn(
|
|
1369
|
+
"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",
|
|
1370
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1371
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1372
|
+
className
|
|
1373
|
+
),
|
|
1374
|
+
...buttonProps,
|
|
1375
|
+
children: [
|
|
1376
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1", children: triggerContent }),
|
|
1377
|
+
/* @__PURE__ */ jsx16("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25BE" })
|
|
1378
|
+
]
|
|
1379
|
+
}
|
|
1380
|
+
),
|
|
1381
|
+
open && position && createPortal3(
|
|
1382
|
+
/* @__PURE__ */ jsx16(
|
|
1383
|
+
"div",
|
|
1384
|
+
{
|
|
1385
|
+
ref: listRef,
|
|
1386
|
+
id: listboxId,
|
|
1387
|
+
role: "listbox",
|
|
1388
|
+
"aria-labelledby": labelId,
|
|
1389
|
+
"aria-multiselectable": multiple || void 0,
|
|
1390
|
+
style: {
|
|
1391
|
+
position: "fixed",
|
|
1392
|
+
top: position.top,
|
|
1393
|
+
left: position.left,
|
|
1394
|
+
width: position.width,
|
|
1395
|
+
zIndex: 50
|
|
1396
|
+
},
|
|
1397
|
+
className: "max-h-64 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1398
|
+
children: items.length === 0 ? /* @__PURE__ */ jsx16("p", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: emptyText }) : rows.map(
|
|
1399
|
+
(row, rowIndex) => row.heading ? /* @__PURE__ */ jsx16(
|
|
1400
|
+
"p",
|
|
1401
|
+
{
|
|
1402
|
+
role: "presentation",
|
|
1403
|
+
className: "px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
1404
|
+
children: row.heading
|
|
1405
|
+
},
|
|
1406
|
+
`heading-${row.heading}-${rowIndex}`
|
|
1407
|
+
) : /* @__PURE__ */ jsx16(
|
|
1408
|
+
"div",
|
|
1409
|
+
{
|
|
1410
|
+
id: `${listboxId}-option-${row.index}`,
|
|
1411
|
+
role: "option",
|
|
1412
|
+
"aria-selected": selectedValues.includes(row.item.value),
|
|
1413
|
+
"aria-disabled": row.item.disabled || void 0,
|
|
1414
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1415
|
+
onMouseEnter: () => !row.item.disabled && setActiveIndex(row.index),
|
|
1416
|
+
onClick: () => select(row.item),
|
|
1417
|
+
className: cn(
|
|
1418
|
+
"flex cursor-pointer items-start gap-2 rounded-sm px-3 py-2 text-sm outline-none",
|
|
1419
|
+
row.index === activeIndex ? "bg-accent text-accent-foreground" : "hover:bg-accent/60",
|
|
1420
|
+
row.item.disabled && "pointer-events-none opacity-50"
|
|
1421
|
+
),
|
|
1422
|
+
children: renderItem ? renderItem(row.item, {
|
|
1423
|
+
selected: selectedValues.includes(row.item.value),
|
|
1424
|
+
active: row.index === activeIndex
|
|
1425
|
+
}) : /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
1426
|
+
row.item.icon && /* @__PURE__ */ jsx16("span", { className: "mt-0.5 shrink-0 [&_svg]:size-4", children: row.item.icon }),
|
|
1427
|
+
/* @__PURE__ */ jsxs9("span", { className: "min-w-0 flex-1", children: [
|
|
1428
|
+
/* @__PURE__ */ jsx16("span", { className: "block", children: row.item.label }),
|
|
1429
|
+
row.item.description && /* @__PURE__ */ jsx16("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: row.item.description })
|
|
1430
|
+
] }),
|
|
1431
|
+
multiple && selectedValues.includes(row.item.value) && /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", className: "ml-auto text-primary", children: "\u2713" })
|
|
1432
|
+
] })
|
|
1433
|
+
},
|
|
1434
|
+
row.item.value
|
|
1435
|
+
)
|
|
1436
|
+
)
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
document.body
|
|
1440
|
+
)
|
|
1441
|
+
] });
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
// src/components/search/Search.tsx
|
|
1445
|
+
import * as React18 from "react";
|
|
1446
|
+
import { createPortal as createPortal4 } from "react-dom";
|
|
717
1447
|
|
|
718
1448
|
// src/components/search/use-combobox.ts
|
|
719
|
-
import * as
|
|
1449
|
+
import * as React17 from "react";
|
|
720
1450
|
var searchUid = 0;
|
|
721
1451
|
function useCombobox({
|
|
722
1452
|
items,
|
|
@@ -724,12 +1454,12 @@ function useCombobox({
|
|
|
724
1454
|
onOpenChange,
|
|
725
1455
|
closeOnSubmit = true
|
|
726
1456
|
}) {
|
|
727
|
-
const [open, setOpenState] =
|
|
728
|
-
const [activeIndex, setActiveIndex] =
|
|
729
|
-
const [pos, setPos] =
|
|
730
|
-
const anchorRef =
|
|
731
|
-
const listboxId =
|
|
732
|
-
const setOpen =
|
|
1457
|
+
const [open, setOpenState] = React17.useState(false);
|
|
1458
|
+
const [activeIndex, setActiveIndex] = React17.useState(-1);
|
|
1459
|
+
const [pos, setPos] = React17.useState(null);
|
|
1460
|
+
const anchorRef = React17.useRef(null);
|
|
1461
|
+
const listboxId = React17.useRef(`slipstream-combobox-${++searchUid}`).current;
|
|
1462
|
+
const setOpen = React17.useCallback(
|
|
733
1463
|
(next) => {
|
|
734
1464
|
setOpenState(next);
|
|
735
1465
|
if (!next) setActiveIndex(-1);
|
|
@@ -737,10 +1467,10 @@ function useCombobox({
|
|
|
737
1467
|
},
|
|
738
1468
|
[onOpenChange]
|
|
739
1469
|
);
|
|
740
|
-
|
|
1470
|
+
React17.useEffect(() => {
|
|
741
1471
|
setActiveIndex(-1);
|
|
742
1472
|
}, [items]);
|
|
743
|
-
|
|
1473
|
+
React17.useLayoutEffect(() => {
|
|
744
1474
|
if (!open) {
|
|
745
1475
|
setPos(null);
|
|
746
1476
|
return;
|
|
@@ -760,7 +1490,7 @@ function useCombobox({
|
|
|
760
1490
|
window.removeEventListener("resize", measure);
|
|
761
1491
|
};
|
|
762
1492
|
}, [open, setOpen]);
|
|
763
|
-
|
|
1493
|
+
React17.useEffect(() => {
|
|
764
1494
|
if (!open) return;
|
|
765
1495
|
const onPointerDown = (event) => {
|
|
766
1496
|
if (!anchorRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -768,7 +1498,7 @@ function useCombobox({
|
|
|
768
1498
|
document.addEventListener("pointerdown", onPointerDown);
|
|
769
1499
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
770
1500
|
}, [open, setOpen]);
|
|
771
|
-
const onInputKeyDown =
|
|
1501
|
+
const onInputKeyDown = React17.useCallback(
|
|
772
1502
|
(event) => {
|
|
773
1503
|
if (event.key === "Escape") {
|
|
774
1504
|
if (open) {
|
|
@@ -836,9 +1566,10 @@ function useCombobox({
|
|
|
836
1566
|
}
|
|
837
1567
|
|
|
838
1568
|
// src/components/search/Search.tsx
|
|
839
|
-
import { jsx as
|
|
1569
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
840
1570
|
function Search({
|
|
841
1571
|
options,
|
|
1572
|
+
value,
|
|
842
1573
|
defaultValue,
|
|
843
1574
|
onValueChange,
|
|
844
1575
|
placeholder = "Search\u2026",
|
|
@@ -849,12 +1580,16 @@ function Search({
|
|
|
849
1580
|
className,
|
|
850
1581
|
"aria-label": ariaLabel
|
|
851
1582
|
}) {
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
1583
|
+
const activeValue = value === void 0 ? defaultValue : value ?? void 0;
|
|
1584
|
+
const selected = React18.useMemo(
|
|
1585
|
+
() => options.find((option) => option.value === activeValue),
|
|
1586
|
+
[options, activeValue]
|
|
855
1587
|
);
|
|
856
|
-
const [query, setQuery] =
|
|
857
|
-
|
|
1588
|
+
const [query, setQuery] = React18.useState(selected?.label ?? "");
|
|
1589
|
+
React18.useEffect(() => {
|
|
1590
|
+
if (value !== void 0) setQuery(selected?.label ?? "");
|
|
1591
|
+
}, [value, selected]);
|
|
1592
|
+
const filtered = React18.useMemo(() => {
|
|
858
1593
|
if (!query.trim()) return options;
|
|
859
1594
|
const q = query.trim().toLowerCase();
|
|
860
1595
|
return options.filter(
|
|
@@ -873,8 +1608,8 @@ function Search({
|
|
|
873
1608
|
onValueChange?.(item.value);
|
|
874
1609
|
combobox.setOpen(false);
|
|
875
1610
|
};
|
|
876
|
-
return /* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */
|
|
1611
|
+
return /* @__PURE__ */ jsxs10("div", { ref: combobox.anchorRef, className: cn("relative w-full", className), children: [
|
|
1612
|
+
/* @__PURE__ */ jsx17(
|
|
878
1613
|
Input,
|
|
879
1614
|
{
|
|
880
1615
|
id,
|
|
@@ -897,8 +1632,8 @@ function Search({
|
|
|
897
1632
|
...combobox.inputProps
|
|
898
1633
|
}
|
|
899
1634
|
),
|
|
900
|
-
combobox.ready &&
|
|
901
|
-
/* @__PURE__ */
|
|
1635
|
+
combobox.ready && createPortal4(
|
|
1636
|
+
/* @__PURE__ */ jsx17(
|
|
902
1637
|
"ul",
|
|
903
1638
|
{
|
|
904
1639
|
id: combobox.listboxId,
|
|
@@ -912,7 +1647,7 @@ function Search({
|
|
|
912
1647
|
zIndex: 50
|
|
913
1648
|
},
|
|
914
1649
|
className: "max-h-64 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
915
|
-
children: filtered.length === 0 ? /* @__PURE__ */
|
|
1650
|
+
children: filtered.length === 0 ? /* @__PURE__ */ jsx17("li", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: emptyText }) : filtered.map((option, index) => /* @__PURE__ */ jsxs10(
|
|
916
1651
|
"li",
|
|
917
1652
|
{
|
|
918
1653
|
id: combobox.optionId(index),
|
|
@@ -926,8 +1661,8 @@ function Search({
|
|
|
926
1661
|
combobox.activeIndex === index ? "bg-accent text-accent-foreground" : "hover:bg-accent/60"
|
|
927
1662
|
),
|
|
928
1663
|
children: [
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
option.description && /* @__PURE__ */
|
|
1664
|
+
/* @__PURE__ */ jsx17("span", { className: "block", children: option.label }),
|
|
1665
|
+
option.description && /* @__PURE__ */ jsx17("span", { className: "block text-xs text-muted-foreground", children: option.description })
|
|
931
1666
|
]
|
|
932
1667
|
},
|
|
933
1668
|
option.value
|
|
@@ -940,15 +1675,25 @@ function Search({
|
|
|
940
1675
|
}
|
|
941
1676
|
|
|
942
1677
|
// src/components/autocomplete/Autocomplete.tsx
|
|
943
|
-
import * as
|
|
944
|
-
import { createPortal as
|
|
945
|
-
import { jsx as
|
|
1678
|
+
import * as React19 from "react";
|
|
1679
|
+
import { createPortal as createPortal5 } from "react-dom";
|
|
1680
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1681
|
+
function normalize(entry) {
|
|
1682
|
+
if (typeof entry === "string") return { value: entry, label: entry };
|
|
1683
|
+
return { value: entry.value, label: entry.label ?? entry.value, group: entry.group, description: entry.description };
|
|
1684
|
+
}
|
|
946
1685
|
function Autocomplete({
|
|
947
1686
|
value,
|
|
948
1687
|
defaultValue = "",
|
|
949
1688
|
onValueChange,
|
|
1689
|
+
options,
|
|
950
1690
|
suggestions,
|
|
1691
|
+
loadOptions,
|
|
1692
|
+
renderOption,
|
|
1693
|
+
clearable = false,
|
|
951
1694
|
emptyText,
|
|
1695
|
+
loadingText,
|
|
1696
|
+
debounceMs = 200,
|
|
952
1697
|
placeholder,
|
|
953
1698
|
id,
|
|
954
1699
|
name,
|
|
@@ -957,27 +1702,62 @@ function Autocomplete({
|
|
|
957
1702
|
onFocus,
|
|
958
1703
|
...inputProps
|
|
959
1704
|
}) {
|
|
960
|
-
const [internalValue, setInternalValue] =
|
|
1705
|
+
const [internalValue, setInternalValue] = React19.useState(defaultValue);
|
|
961
1706
|
const current = value ?? internalValue;
|
|
962
|
-
const
|
|
1707
|
+
const [asyncOptions, setAsyncOptions] = React19.useState([]);
|
|
1708
|
+
const [loading, setLoading] = React19.useState(false);
|
|
1709
|
+
const requestId = React19.useRef(0);
|
|
1710
|
+
const source = React19.useMemo(() => {
|
|
1711
|
+
const list = options ?? (suggestions ?? []).map(normalize);
|
|
1712
|
+
return list.map(normalize);
|
|
1713
|
+
}, [options, suggestions]);
|
|
1714
|
+
React19.useEffect(() => {
|
|
1715
|
+
if (!loadOptions) return;
|
|
1716
|
+
const id2 = ++requestId.current;
|
|
1717
|
+
setLoading(true);
|
|
1718
|
+
const timer = setTimeout(async () => {
|
|
1719
|
+
try {
|
|
1720
|
+
const result = await loadOptions(current);
|
|
1721
|
+
if (requestId.current === id2) setAsyncOptions(result.map(normalize));
|
|
1722
|
+
} catch {
|
|
1723
|
+
if (requestId.current === id2) setAsyncOptions([]);
|
|
1724
|
+
} finally {
|
|
1725
|
+
if (requestId.current === id2) setLoading(false);
|
|
1726
|
+
}
|
|
1727
|
+
}, debounceMs);
|
|
1728
|
+
return () => clearTimeout(timer);
|
|
1729
|
+
}, [loadOptions, current, debounceMs]);
|
|
1730
|
+
const pool = loadOptions ? asyncOptions : source;
|
|
1731
|
+
const items = React19.useMemo(() => {
|
|
963
1732
|
const q = current.trim().toLowerCase();
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
}, [suggestions, current]);
|
|
1733
|
+
return pool.filter((option) => !q || option.label.toLowerCase().includes(q) || option.value.toLowerCase().includes(q)).filter((option) => option.value !== current);
|
|
1734
|
+
}, [pool, current]);
|
|
967
1735
|
const combobox = useCombobox({
|
|
968
|
-
items,
|
|
1736
|
+
items: items.map((item) => ({ value: item.value, label: item.label })),
|
|
969
1737
|
onSelect: (item) => {
|
|
970
1738
|
if (value === void 0) setInternalValue(item.label);
|
|
971
1739
|
onValueChange?.(item.label);
|
|
972
1740
|
}
|
|
973
1741
|
});
|
|
974
|
-
const select = (
|
|
975
|
-
if (value === void 0) setInternalValue(label);
|
|
976
|
-
onValueChange?.(label);
|
|
1742
|
+
const select = (option) => {
|
|
1743
|
+
if (value === void 0) setInternalValue(option.label);
|
|
1744
|
+
onValueChange?.(option.label);
|
|
977
1745
|
combobox.setOpen(false);
|
|
978
1746
|
};
|
|
979
|
-
|
|
980
|
-
|
|
1747
|
+
const grouped = React19.useMemo(() => {
|
|
1748
|
+
const out = [];
|
|
1749
|
+
let lastGroup;
|
|
1750
|
+
items.forEach((option, index) => {
|
|
1751
|
+
if (option.group && option.group !== lastGroup) {
|
|
1752
|
+
out.push({ heading: option.group, index: -1 });
|
|
1753
|
+
lastGroup = option.group;
|
|
1754
|
+
}
|
|
1755
|
+
out.push({ option, index });
|
|
1756
|
+
});
|
|
1757
|
+
return out;
|
|
1758
|
+
}, [items]);
|
|
1759
|
+
return /* @__PURE__ */ jsxs11("div", { ref: combobox.anchorRef, className: cn("relative w-full", className), children: [
|
|
1760
|
+
/* @__PURE__ */ jsx18(
|
|
981
1761
|
Input,
|
|
982
1762
|
{
|
|
983
1763
|
id,
|
|
@@ -985,6 +1765,7 @@ function Autocomplete({
|
|
|
985
1765
|
placeholder,
|
|
986
1766
|
autoComplete: "off",
|
|
987
1767
|
value: current,
|
|
1768
|
+
className: clearable && current ? "pr-9" : void 0,
|
|
988
1769
|
onChange: (event) => {
|
|
989
1770
|
if (value === void 0) setInternalValue(event.target.value);
|
|
990
1771
|
onValueChange?.(event.target.value);
|
|
@@ -1002,13 +1783,28 @@ function Autocomplete({
|
|
|
1002
1783
|
...combobox.inputProps
|
|
1003
1784
|
}
|
|
1004
1785
|
),
|
|
1005
|
-
|
|
1006
|
-
|
|
1786
|
+
clearable && current && /* @__PURE__ */ jsx18(
|
|
1787
|
+
"button",
|
|
1788
|
+
{
|
|
1789
|
+
type: "button",
|
|
1790
|
+
onClick: () => {
|
|
1791
|
+
if (value === void 0) setInternalValue("");
|
|
1792
|
+
onValueChange?.("");
|
|
1793
|
+
combobox.setOpen(true);
|
|
1794
|
+
},
|
|
1795
|
+
"aria-label": "Clear input",
|
|
1796
|
+
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",
|
|
1797
|
+
children: "\u2715"
|
|
1798
|
+
}
|
|
1799
|
+
),
|
|
1800
|
+
combobox.ready && createPortal5(
|
|
1801
|
+
/* @__PURE__ */ jsx18(
|
|
1007
1802
|
"ul",
|
|
1008
1803
|
{
|
|
1009
1804
|
id: combobox.listboxId,
|
|
1010
1805
|
role: "listbox",
|
|
1011
1806
|
"aria-label": "Suggestions",
|
|
1807
|
+
"aria-busy": loading || void 0,
|
|
1012
1808
|
style: {
|
|
1013
1809
|
position: "fixed",
|
|
1014
1810
|
top: combobox.pos.top,
|
|
@@ -1017,23 +1813,36 @@ function Autocomplete({
|
|
|
1017
1813
|
zIndex: 50
|
|
1018
1814
|
},
|
|
1019
1815
|
className: "max-h-60 overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1020
|
-
children: items.length === 0 ? /* @__PURE__ */
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1816
|
+
children: loading && items.length === 0 ? /* @__PURE__ */ jsx18("li", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: loadingText ?? "Loading\u2026" }) : items.length === 0 ? /* @__PURE__ */ jsx18("li", { role: "presentation", className: "px-3 py-2 text-sm text-muted-foreground", children: emptyText ?? "No suggestions" }) : grouped.map(
|
|
1817
|
+
(entry, rowIndex) => entry.heading ? /* @__PURE__ */ jsx18(
|
|
1818
|
+
"li",
|
|
1819
|
+
{
|
|
1820
|
+
role: "presentation",
|
|
1821
|
+
className: "px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",
|
|
1822
|
+
children: entry.heading
|
|
1823
|
+
},
|
|
1824
|
+
`group-${entry.heading}-${rowIndex}`
|
|
1825
|
+
) : /* @__PURE__ */ jsx18(
|
|
1826
|
+
"li",
|
|
1827
|
+
{
|
|
1828
|
+
id: combobox.optionId(entry.index),
|
|
1829
|
+
role: "option",
|
|
1830
|
+
"aria-selected": combobox.activeIndex === entry.index,
|
|
1831
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1832
|
+
onMouseEnter: () => combobox.setActiveIndex(entry.index),
|
|
1833
|
+
onClick: () => select(entry.option),
|
|
1834
|
+
className: cn(
|
|
1835
|
+
"cursor-pointer rounded-sm px-3 py-1.5 text-sm outline-none",
|
|
1836
|
+
combobox.activeIndex === entry.index ? "bg-accent text-accent-foreground" : "hover:bg-accent/60"
|
|
1837
|
+
),
|
|
1838
|
+
children: renderOption ? renderOption(entry.option, { active: combobox.activeIndex === entry.index }) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1839
|
+
/* @__PURE__ */ jsx18("span", { className: "block", children: entry.option.label }),
|
|
1840
|
+
entry.option.description && /* @__PURE__ */ jsx18("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: entry.option.description })
|
|
1841
|
+
] })
|
|
1842
|
+
},
|
|
1843
|
+
entry.option.value
|
|
1844
|
+
)
|
|
1845
|
+
)
|
|
1037
1846
|
}
|
|
1038
1847
|
),
|
|
1039
1848
|
document.body
|
|
@@ -1042,10 +1851,10 @@ function Autocomplete({
|
|
|
1042
1851
|
}
|
|
1043
1852
|
|
|
1044
1853
|
// src/components/checkbox/Checkbox.tsx
|
|
1045
|
-
import * as
|
|
1046
|
-
import { jsx as
|
|
1047
|
-
var Checkbox =
|
|
1048
|
-
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */
|
|
1854
|
+
import * as React20 from "react";
|
|
1855
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1856
|
+
var Checkbox = React20.forwardRef(
|
|
1857
|
+
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */ jsx19(
|
|
1049
1858
|
"input",
|
|
1050
1859
|
{
|
|
1051
1860
|
type: "checkbox",
|
|
@@ -1066,38 +1875,38 @@ var Checkbox = React16.forwardRef(
|
|
|
1066
1875
|
Checkbox.displayName = "Checkbox";
|
|
1067
1876
|
|
|
1068
1877
|
// src/components/checkbox/CheckboxGroup.tsx
|
|
1069
|
-
import * as
|
|
1070
|
-
import { jsx as
|
|
1071
|
-
var CheckboxGroupContext =
|
|
1878
|
+
import * as React21 from "react";
|
|
1879
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1880
|
+
var CheckboxGroupContext = React21.createContext({
|
|
1072
1881
|
name: "",
|
|
1073
1882
|
values: [],
|
|
1074
1883
|
toggle: () => {
|
|
1075
1884
|
}
|
|
1076
1885
|
});
|
|
1077
|
-
var CheckboxGroup =
|
|
1886
|
+
var CheckboxGroup = React21.forwardRef(
|
|
1078
1887
|
({ name, legend, value, defaultValue, onValueChange, orientation = "vertical", error, className, children }, ref) => {
|
|
1079
|
-
const [internalValue, setInternalValue] =
|
|
1888
|
+
const [internalValue, setInternalValue] = React21.useState(defaultValue ?? []);
|
|
1080
1889
|
const currentValue = value ?? internalValue;
|
|
1081
1890
|
const toggle = (next) => {
|
|
1082
1891
|
const updated = currentValue.includes(next) ? currentValue.filter((item) => item !== next) : [...currentValue, next];
|
|
1083
1892
|
if (value === void 0) setInternalValue(updated);
|
|
1084
1893
|
onValueChange?.(updated);
|
|
1085
1894
|
};
|
|
1086
|
-
return /* @__PURE__ */
|
|
1087
|
-
legend && /* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
error && /* @__PURE__ */
|
|
1895
|
+
return /* @__PURE__ */ jsxs12("fieldset", { ref, className: cn(orientation === "vertical" ? "space-y-2" : "flex flex-row flex-wrap gap-x-4 gap-y-2", className), children: [
|
|
1896
|
+
legend && /* @__PURE__ */ jsx20("legend", { className: "text-sm font-medium", children: legend }),
|
|
1897
|
+
/* @__PURE__ */ jsx20(CheckboxGroupContext.Provider, { value: { name, values: currentValue, toggle }, children }),
|
|
1898
|
+
error && /* @__PURE__ */ jsx20("p", { role: "alert", className: "text-xs text-destructive", children: error })
|
|
1090
1899
|
] });
|
|
1091
1900
|
}
|
|
1092
1901
|
);
|
|
1093
1902
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
1094
|
-
var CheckboxGroupItem =
|
|
1903
|
+
var CheckboxGroupItem = React21.forwardRef(
|
|
1095
1904
|
({ value, label, className, id, ...props }, ref) => {
|
|
1096
|
-
const group =
|
|
1097
|
-
const generatedId =
|
|
1905
|
+
const group = React21.useContext(CheckboxGroupContext);
|
|
1906
|
+
const generatedId = React21.useId();
|
|
1098
1907
|
const inputId = id ?? generatedId;
|
|
1099
|
-
return /* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1908
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
1909
|
+
/* @__PURE__ */ jsx20(
|
|
1101
1910
|
Checkbox,
|
|
1102
1911
|
{
|
|
1103
1912
|
ref,
|
|
@@ -1110,7 +1919,7 @@ var CheckboxGroupItem = React17.forwardRef(
|
|
|
1110
1919
|
...props
|
|
1111
1920
|
}
|
|
1112
1921
|
),
|
|
1113
|
-
label && /* @__PURE__ */
|
|
1922
|
+
label && /* @__PURE__ */ jsx20(
|
|
1114
1923
|
"label",
|
|
1115
1924
|
{
|
|
1116
1925
|
htmlFor: inputId,
|
|
@@ -1124,10 +1933,10 @@ var CheckboxGroupItem = React17.forwardRef(
|
|
|
1124
1933
|
CheckboxGroupItem.displayName = "CheckboxGroupItem";
|
|
1125
1934
|
|
|
1126
1935
|
// src/components/radio/Radio.tsx
|
|
1127
|
-
import * as
|
|
1128
|
-
import { jsx as
|
|
1129
|
-
var Radio =
|
|
1130
|
-
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */
|
|
1936
|
+
import * as React22 from "react";
|
|
1937
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1938
|
+
var Radio = React22.forwardRef(
|
|
1939
|
+
({ className, checked, onCheckedChange, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
1131
1940
|
"input",
|
|
1132
1941
|
{
|
|
1133
1942
|
type: "radio",
|
|
@@ -1146,15 +1955,15 @@ var Radio = React18.forwardRef(
|
|
|
1146
1955
|
)
|
|
1147
1956
|
);
|
|
1148
1957
|
Radio.displayName = "Radio";
|
|
1149
|
-
var RadioGroup =
|
|
1958
|
+
var RadioGroup = React22.forwardRef(
|
|
1150
1959
|
({ name, legend, value, defaultValue, onValueChange, orientation = "vertical", error, className, children }, ref) => {
|
|
1151
|
-
const [internalValue, setInternalValue] =
|
|
1960
|
+
const [internalValue, setInternalValue] = React22.useState(defaultValue ?? "");
|
|
1152
1961
|
const currentValue = value ?? internalValue;
|
|
1153
1962
|
const handleChange = (next) => {
|
|
1154
1963
|
if (value === void 0) setInternalValue(next);
|
|
1155
1964
|
onValueChange?.(next);
|
|
1156
1965
|
};
|
|
1157
|
-
return /* @__PURE__ */
|
|
1966
|
+
return /* @__PURE__ */ jsxs13(
|
|
1158
1967
|
"fieldset",
|
|
1159
1968
|
{
|
|
1160
1969
|
ref,
|
|
@@ -1163,28 +1972,28 @@ var RadioGroup = React18.forwardRef(
|
|
|
1163
1972
|
className
|
|
1164
1973
|
),
|
|
1165
1974
|
children: [
|
|
1166
|
-
legend && /* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
error && /* @__PURE__ */
|
|
1975
|
+
legend && /* @__PURE__ */ jsx21("legend", { className: "text-sm font-medium", children: legend }),
|
|
1976
|
+
/* @__PURE__ */ jsx21(RadioGroupContext.Provider, { value: { name, value: currentValue, onChange: handleChange }, children }),
|
|
1977
|
+
error && /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-xs text-destructive", children: error })
|
|
1169
1978
|
]
|
|
1170
1979
|
}
|
|
1171
1980
|
);
|
|
1172
1981
|
}
|
|
1173
1982
|
);
|
|
1174
1983
|
RadioGroup.displayName = "RadioGroup";
|
|
1175
|
-
var RadioGroupContext =
|
|
1984
|
+
var RadioGroupContext = React22.createContext({
|
|
1176
1985
|
name: "",
|
|
1177
1986
|
value: "",
|
|
1178
1987
|
onChange: () => {
|
|
1179
1988
|
}
|
|
1180
1989
|
});
|
|
1181
|
-
var RadioGroupItem =
|
|
1990
|
+
var RadioGroupItem = React22.forwardRef(
|
|
1182
1991
|
({ value, label, className, id, ...props }, ref) => {
|
|
1183
|
-
const group =
|
|
1184
|
-
const generatedId =
|
|
1992
|
+
const group = React22.useContext(RadioGroupContext);
|
|
1993
|
+
const generatedId = React22.useId();
|
|
1185
1994
|
const inputId = id ?? generatedId;
|
|
1186
|
-
return /* @__PURE__ */
|
|
1187
|
-
/* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
1996
|
+
/* @__PURE__ */ jsx21(
|
|
1188
1997
|
Radio,
|
|
1189
1998
|
{
|
|
1190
1999
|
ref,
|
|
@@ -1197,21 +2006,21 @@ var RadioGroupItem = React18.forwardRef(
|
|
|
1197
2006
|
...props
|
|
1198
2007
|
}
|
|
1199
2008
|
),
|
|
1200
|
-
label && /* @__PURE__ */
|
|
2009
|
+
label && /* @__PURE__ */ jsx21("label", { htmlFor: inputId, className: "text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: label })
|
|
1201
2010
|
] });
|
|
1202
2011
|
}
|
|
1203
2012
|
);
|
|
1204
2013
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
1205
2014
|
|
|
1206
2015
|
// src/components/radio/RadioCard.tsx
|
|
1207
|
-
import * as
|
|
1208
|
-
import { jsx as
|
|
1209
|
-
var RadioCard =
|
|
2016
|
+
import * as React23 from "react";
|
|
2017
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2018
|
+
var RadioCard = React23.forwardRef(
|
|
1210
2019
|
({ value, title, description, children, rounded = true, disabled, className, id }, ref) => {
|
|
1211
|
-
const group =
|
|
1212
|
-
const generatedId =
|
|
2020
|
+
const group = React23.useContext(RadioGroupContext);
|
|
2021
|
+
const generatedId = React23.useId();
|
|
1213
2022
|
const inputId = id ?? generatedId;
|
|
1214
|
-
return /* @__PURE__ */
|
|
2023
|
+
return /* @__PURE__ */ jsxs14(
|
|
1215
2024
|
"label",
|
|
1216
2025
|
{
|
|
1217
2026
|
ref,
|
|
@@ -1227,7 +2036,7 @@ var RadioCard = React19.forwardRef(
|
|
|
1227
2036
|
className
|
|
1228
2037
|
),
|
|
1229
2038
|
children: [
|
|
1230
|
-
/* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ jsx22(
|
|
1231
2040
|
Radio,
|
|
1232
2041
|
{
|
|
1233
2042
|
id: inputId,
|
|
@@ -1238,8 +2047,8 @@ var RadioCard = React19.forwardRef(
|
|
|
1238
2047
|
className: "sr-only"
|
|
1239
2048
|
}
|
|
1240
2049
|
),
|
|
1241
|
-
title && /* @__PURE__ */
|
|
1242
|
-
description && /* @__PURE__ */
|
|
2050
|
+
title && /* @__PURE__ */ jsx22("span", { className: "text-sm font-medium leading-none", children: title }),
|
|
2051
|
+
description && /* @__PURE__ */ jsx22("span", { className: "text-sm text-muted-foreground", children: description }),
|
|
1243
2052
|
children
|
|
1244
2053
|
]
|
|
1245
2054
|
}
|
|
@@ -1249,10 +2058,10 @@ var RadioCard = React19.forwardRef(
|
|
|
1249
2058
|
RadioCard.displayName = "RadioCard";
|
|
1250
2059
|
|
|
1251
2060
|
// src/components/label/Label.tsx
|
|
1252
|
-
import * as
|
|
1253
|
-
import { jsx as
|
|
1254
|
-
var Label =
|
|
1255
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2061
|
+
import * as React24 from "react";
|
|
2062
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2063
|
+
var Label = React24.forwardRef(
|
|
2064
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
1256
2065
|
"label",
|
|
1257
2066
|
{
|
|
1258
2067
|
ref,
|
|
@@ -1267,20 +2076,20 @@ var Label = React20.forwardRef(
|
|
|
1267
2076
|
Label.displayName = "Label";
|
|
1268
2077
|
|
|
1269
2078
|
// src/components/fieldset/Fieldset.tsx
|
|
1270
|
-
import * as
|
|
1271
|
-
import { jsx as
|
|
1272
|
-
var Fieldset =
|
|
1273
|
-
({ legend, description, error, className, children, ...props }, ref) => /* @__PURE__ */
|
|
2079
|
+
import * as React25 from "react";
|
|
2080
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2081
|
+
var Fieldset = React25.forwardRef(
|
|
2082
|
+
({ legend, description, error, className, children, ...props }, ref) => /* @__PURE__ */ jsxs15(
|
|
1274
2083
|
"fieldset",
|
|
1275
2084
|
{
|
|
1276
2085
|
ref,
|
|
1277
2086
|
className: cn("m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0", className),
|
|
1278
2087
|
...props,
|
|
1279
2088
|
children: [
|
|
1280
|
-
legend && /* @__PURE__ */
|
|
1281
|
-
description && /* @__PURE__ */
|
|
2089
|
+
legend && /* @__PURE__ */ jsx24("legend", { className: "p-0 text-sm font-medium leading-none", children: legend }),
|
|
2090
|
+
description && /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: description }),
|
|
1282
2091
|
children,
|
|
1283
|
-
error && /* @__PURE__ */
|
|
2092
|
+
error && /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-xs text-destructive", children: error })
|
|
1284
2093
|
]
|
|
1285
2094
|
}
|
|
1286
2095
|
)
|
|
@@ -1288,36 +2097,36 @@ var Fieldset = React21.forwardRef(
|
|
|
1288
2097
|
Fieldset.displayName = "Fieldset";
|
|
1289
2098
|
|
|
1290
2099
|
// src/components/form-field/FormField.tsx
|
|
1291
|
-
import * as
|
|
2100
|
+
import * as React27 from "react";
|
|
1292
2101
|
|
|
1293
2102
|
// src/components/tooltip/Tooltip.tsx
|
|
1294
|
-
import * as
|
|
1295
|
-
import { createPortal as
|
|
1296
|
-
import { jsx as
|
|
2103
|
+
import * as React26 from "react";
|
|
2104
|
+
import { createPortal as createPortal6 } from "react-dom";
|
|
2105
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1297
2106
|
var GAP = 8;
|
|
1298
|
-
var Tooltip =
|
|
2107
|
+
var Tooltip = React26.forwardRef(
|
|
1299
2108
|
({ content, side = "top", delay = 300, className, children }, ref) => {
|
|
1300
|
-
const [open, setOpen] =
|
|
1301
|
-
const [pos, setPos] =
|
|
1302
|
-
const anchorRef =
|
|
1303
|
-
const timerRef =
|
|
1304
|
-
const id =
|
|
1305
|
-
const
|
|
2109
|
+
const [open, setOpen] = React26.useState(false);
|
|
2110
|
+
const [pos, setPos] = React26.useState(null);
|
|
2111
|
+
const anchorRef = React26.useRef(null);
|
|
2112
|
+
const timerRef = React26.useRef(null);
|
|
2113
|
+
const id = React26.useId();
|
|
2114
|
+
const show2 = React26.useCallback(() => {
|
|
1306
2115
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1307
2116
|
timerRef.current = setTimeout(() => setOpen(true), delay);
|
|
1308
2117
|
}, [delay]);
|
|
1309
|
-
const hide =
|
|
2118
|
+
const hide = React26.useCallback(() => {
|
|
1310
2119
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1311
2120
|
setOpen(false);
|
|
1312
2121
|
setPos(null);
|
|
1313
2122
|
}, []);
|
|
1314
|
-
|
|
2123
|
+
React26.useEffect(
|
|
1315
2124
|
() => () => {
|
|
1316
2125
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1317
2126
|
},
|
|
1318
2127
|
[]
|
|
1319
2128
|
);
|
|
1320
|
-
|
|
2129
|
+
React26.useLayoutEffect(() => {
|
|
1321
2130
|
if (!open) return;
|
|
1322
2131
|
const rect = anchorRef.current?.getBoundingClientRect();
|
|
1323
2132
|
if (!rect) return;
|
|
@@ -1331,10 +2140,10 @@ var Tooltip = React22.forwardRef(
|
|
|
1331
2140
|
window.removeEventListener("resize", onScrollOrResize);
|
|
1332
2141
|
};
|
|
1333
2142
|
}, [open, side, hide]);
|
|
1334
|
-
const trigger =
|
|
2143
|
+
const trigger = React26.cloneElement(children, {
|
|
1335
2144
|
"aria-describedby": open ? id : void 0
|
|
1336
2145
|
});
|
|
1337
|
-
return /* @__PURE__ */
|
|
2146
|
+
return /* @__PURE__ */ jsxs16(
|
|
1338
2147
|
"div",
|
|
1339
2148
|
{
|
|
1340
2149
|
ref: (node) => {
|
|
@@ -1343,9 +2152,9 @@ var Tooltip = React22.forwardRef(
|
|
|
1343
2152
|
else if (ref) ref.current = node;
|
|
1344
2153
|
},
|
|
1345
2154
|
className: cn("relative inline-flex", className),
|
|
1346
|
-
onMouseEnter:
|
|
2155
|
+
onMouseEnter: show2,
|
|
1347
2156
|
onMouseLeave: hide,
|
|
1348
|
-
onFocusCapture:
|
|
2157
|
+
onFocusCapture: show2,
|
|
1349
2158
|
onBlurCapture: hide,
|
|
1350
2159
|
onKeyDown: (event) => {
|
|
1351
2160
|
if (event.key === "Escape" && open) {
|
|
@@ -1355,8 +2164,8 @@ var Tooltip = React22.forwardRef(
|
|
|
1355
2164
|
},
|
|
1356
2165
|
children: [
|
|
1357
2166
|
trigger,
|
|
1358
|
-
open && pos && typeof document !== "undefined" &&
|
|
1359
|
-
/* @__PURE__ */
|
|
2167
|
+
open && pos && typeof document !== "undefined" && createPortal6(
|
|
2168
|
+
/* @__PURE__ */ jsx25(
|
|
1360
2169
|
"div",
|
|
1361
2170
|
{
|
|
1362
2171
|
id,
|
|
@@ -1376,7 +2185,7 @@ var Tooltip = React22.forwardRef(
|
|
|
1376
2185
|
Tooltip.displayName = "Tooltip";
|
|
1377
2186
|
|
|
1378
2187
|
// src/components/form-field/FormField.tsx
|
|
1379
|
-
import { Fragment as
|
|
2188
|
+
import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1380
2189
|
var FormField = ({
|
|
1381
2190
|
id,
|
|
1382
2191
|
label,
|
|
@@ -1394,48 +2203,48 @@ var FormField = ({
|
|
|
1394
2203
|
const errorId = `${id}-error`;
|
|
1395
2204
|
const describedBy = error ? errorId : hint ? hintId : void 0;
|
|
1396
2205
|
let control = children;
|
|
1397
|
-
if (
|
|
1398
|
-
control =
|
|
2206
|
+
if (React27.isValidElement(children) && children.type !== React27.Fragment) {
|
|
2207
|
+
control = React27.cloneElement(children, {
|
|
1399
2208
|
id,
|
|
1400
2209
|
"aria-describedby": describedBy,
|
|
1401
2210
|
...error ? { "aria-invalid": true } : {}
|
|
1402
2211
|
});
|
|
1403
2212
|
}
|
|
1404
|
-
const labelNode = /* @__PURE__ */
|
|
2213
|
+
const labelNode = /* @__PURE__ */ jsxs17(Label, { htmlFor: id, className: labelHidden ? "sr-only" : void 0, children: [
|
|
1405
2214
|
label,
|
|
1406
|
-
required && /* @__PURE__ */
|
|
2215
|
+
required && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1407
2216
|
" ",
|
|
1408
|
-
/* @__PURE__ */
|
|
2217
|
+
/* @__PURE__ */ jsx26("span", { "aria-hidden": "true", className: "ml-0.5 text-destructive", children: "*" })
|
|
1409
2218
|
] })
|
|
1410
2219
|
] });
|
|
1411
|
-
const tooltipNode = tooltip ? /* @__PURE__ */
|
|
2220
|
+
const tooltipNode = tooltip ? /* @__PURE__ */ jsx26(Tooltip, { content: tooltip, side: "top", children: /* @__PURE__ */ jsx26(
|
|
1412
2221
|
"button",
|
|
1413
2222
|
{
|
|
1414
2223
|
type: "button",
|
|
1415
2224
|
"aria-label": `${label} information`,
|
|
1416
2225
|
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",
|
|
1417
|
-
children: /* @__PURE__ */
|
|
2226
|
+
children: /* @__PURE__ */ jsx26("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx26("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" }) })
|
|
1418
2227
|
}
|
|
1419
2228
|
) }) : null;
|
|
1420
|
-
const hintOrError = error ? /* @__PURE__ */
|
|
2229
|
+
const hintOrError = error ? /* @__PURE__ */ jsx26("p", { id: errorId, role: "alert", className: "text-xs text-destructive", children: error }) : hint ? /* @__PURE__ */ jsx26("p", { id: hintId, className: "text-xs text-muted-foreground", children: hint }) : null;
|
|
1421
2230
|
if (labelPlacement === "left") {
|
|
1422
|
-
return /* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
2231
|
+
return /* @__PURE__ */ jsx26("div", { className: cn("flex min-w-0 flex-col gap-1.5", className), children: /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3", children: [
|
|
2232
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex w-40 shrink-0 items-center gap-1 pt-2", children: [
|
|
1424
2233
|
labelNode,
|
|
1425
2234
|
tooltipNode
|
|
1426
2235
|
] }),
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
/* @__PURE__ */
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
trailing && /* @__PURE__ */
|
|
2236
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
2237
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2238
|
+
/* @__PURE__ */ jsx26("div", { className: "min-w-0 flex-1", children: control }),
|
|
2239
|
+
trailing && /* @__PURE__ */ jsx26("span", { className: "shrink-0 text-xs text-muted-foreground", children: trailing })
|
|
1431
2240
|
] }),
|
|
1432
2241
|
hintOrError
|
|
1433
2242
|
] })
|
|
1434
2243
|
] }) });
|
|
1435
2244
|
}
|
|
1436
|
-
return /* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
2245
|
+
return /* @__PURE__ */ jsxs17("div", { className: cn("flex min-w-0 flex-col gap-1.5", className), children: [
|
|
2246
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2247
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex min-w-0 items-center", children: [
|
|
1439
2248
|
labelNode,
|
|
1440
2249
|
tooltipNode
|
|
1441
2250
|
] }),
|
|
@@ -1448,12 +2257,12 @@ var FormField = ({
|
|
|
1448
2257
|
FormField.displayName = "FormField";
|
|
1449
2258
|
|
|
1450
2259
|
// src/components/form/Form.tsx
|
|
1451
|
-
import * as
|
|
1452
|
-
import { jsx as
|
|
1453
|
-
var Form =
|
|
2260
|
+
import * as React28 from "react";
|
|
2261
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2262
|
+
var Form = React28.forwardRef(
|
|
1454
2263
|
({ variant = "default", gap, className, style, ...props }, ref) => {
|
|
1455
2264
|
const gapResolved = resolveGap(gap ?? "md");
|
|
1456
|
-
return /* @__PURE__ */
|
|
2265
|
+
return /* @__PURE__ */ jsx27(
|
|
1457
2266
|
"form",
|
|
1458
2267
|
{
|
|
1459
2268
|
ref,
|
|
@@ -1473,15 +2282,15 @@ var Form = React24.forwardRef(
|
|
|
1473
2282
|
Form.displayName = "Form";
|
|
1474
2283
|
|
|
1475
2284
|
// src/components/form-layout/FormLayout.tsx
|
|
1476
|
-
import * as
|
|
1477
|
-
import { jsx as
|
|
2285
|
+
import * as React29 from "react";
|
|
2286
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1478
2287
|
var GRID_COLUMNS = {
|
|
1479
2288
|
1: "grid-cols-1",
|
|
1480
2289
|
2: "grid-cols-2",
|
|
1481
2290
|
3: "grid-cols-3",
|
|
1482
2291
|
4: "grid-cols-4"
|
|
1483
2292
|
};
|
|
1484
|
-
var FormLayout =
|
|
2293
|
+
var FormLayout = React29.forwardRef(
|
|
1485
2294
|
({
|
|
1486
2295
|
layout = "stack",
|
|
1487
2296
|
columns = 2,
|
|
@@ -1496,7 +2305,7 @@ var FormLayout = React25.forwardRef(
|
|
|
1496
2305
|
}, ref) => {
|
|
1497
2306
|
const Tag = as;
|
|
1498
2307
|
const gapResolved = resolveGap(gap ?? "md");
|
|
1499
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ jsxs18(
|
|
1500
2309
|
Tag,
|
|
1501
2310
|
{
|
|
1502
2311
|
ref,
|
|
@@ -1511,8 +2320,8 @@ var FormLayout = React25.forwardRef(
|
|
|
1511
2320
|
style: { ...gapResolved.style, ...style },
|
|
1512
2321
|
...props,
|
|
1513
2322
|
children: [
|
|
1514
|
-
legend && as === "fieldset" && /* @__PURE__ */
|
|
1515
|
-
description && as === "fieldset" && /* @__PURE__ */
|
|
2323
|
+
legend && as === "fieldset" && /* @__PURE__ */ jsx28("legend", { className: "col-span-full p-0 text-sm font-medium leading-none", children: legend }),
|
|
2324
|
+
description && as === "fieldset" && /* @__PURE__ */ jsx28("p", { className: "col-span-full text-xs text-muted-foreground", children: description }),
|
|
1516
2325
|
children
|
|
1517
2326
|
]
|
|
1518
2327
|
}
|
|
@@ -1522,53 +2331,56 @@ var FormLayout = React25.forwardRef(
|
|
|
1522
2331
|
FormLayout.displayName = "FormLayout";
|
|
1523
2332
|
|
|
1524
2333
|
// src/components/switch/Switch.tsx
|
|
1525
|
-
import * as
|
|
1526
|
-
import { jsx as
|
|
1527
|
-
var Switch =
|
|
1528
|
-
({ className, checked, defaultChecked, onCheckedChange, disabled, ...props }, ref) => {
|
|
1529
|
-
const [internalChecked, setInternalChecked] =
|
|
2334
|
+
import * as React30 from "react";
|
|
2335
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2336
|
+
var Switch = React30.forwardRef(
|
|
2337
|
+
({ className, checked, defaultChecked, onCheckedChange, disabled, name, ...props }, ref) => {
|
|
2338
|
+
const [internalChecked, setInternalChecked] = React30.useState(defaultChecked ?? false);
|
|
1530
2339
|
const isOn = checked ?? internalChecked;
|
|
1531
2340
|
const toggle = () => {
|
|
1532
2341
|
if (checked === void 0) setInternalChecked((prev) => !prev);
|
|
1533
2342
|
onCheckedChange?.(!isOn);
|
|
1534
2343
|
};
|
|
1535
|
-
return /* @__PURE__ */
|
|
1536
|
-
"
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
"
|
|
1556
|
-
|
|
1557
|
-
"
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
2344
|
+
return /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
2345
|
+
name && isOn && /* @__PURE__ */ jsx29("input", { type: "hidden", name, value: "on" }),
|
|
2346
|
+
/* @__PURE__ */ jsx29(
|
|
2347
|
+
"button",
|
|
2348
|
+
{
|
|
2349
|
+
type: "button",
|
|
2350
|
+
role: "switch",
|
|
2351
|
+
"aria-checked": isOn,
|
|
2352
|
+
ref,
|
|
2353
|
+
disabled,
|
|
2354
|
+
onClick: toggle,
|
|
2355
|
+
className: cn(
|
|
2356
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
|
|
2357
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
2358
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
2359
|
+
isOn ? "bg-primary" : "bg-input",
|
|
2360
|
+
className
|
|
2361
|
+
),
|
|
2362
|
+
...props,
|
|
2363
|
+
children: /* @__PURE__ */ jsx29(
|
|
2364
|
+
"span",
|
|
2365
|
+
{
|
|
2366
|
+
"aria-hidden": "true",
|
|
2367
|
+
className: cn(
|
|
2368
|
+
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg transition-transform",
|
|
2369
|
+
isOn ? "translate-x-4" : "translate-x-0"
|
|
2370
|
+
)
|
|
2371
|
+
}
|
|
2372
|
+
)
|
|
2373
|
+
}
|
|
2374
|
+
)
|
|
2375
|
+
] });
|
|
1564
2376
|
}
|
|
1565
2377
|
);
|
|
1566
2378
|
Switch.displayName = "Switch";
|
|
1567
2379
|
|
|
1568
2380
|
// src/components/separator/Separator.tsx
|
|
1569
|
-
import * as
|
|
2381
|
+
import * as React31 from "react";
|
|
1570
2382
|
import { cva as cva4 } from "class-variance-authority";
|
|
1571
|
-
import { jsx as
|
|
2383
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1572
2384
|
var separatorVariants = cva4("shrink-0 bg-border", {
|
|
1573
2385
|
variants: {
|
|
1574
2386
|
orientation: {
|
|
@@ -1580,8 +2392,8 @@ var separatorVariants = cva4("shrink-0 bg-border", {
|
|
|
1580
2392
|
orientation: "horizontal"
|
|
1581
2393
|
}
|
|
1582
2394
|
});
|
|
1583
|
-
var Separator =
|
|
1584
|
-
({ className, orientation, label, ...props }, ref) => /* @__PURE__ */
|
|
2395
|
+
var Separator = React31.forwardRef(
|
|
2396
|
+
({ className, orientation, label, ...props }, ref) => /* @__PURE__ */ jsx30(
|
|
1585
2397
|
"div",
|
|
1586
2398
|
{
|
|
1587
2399
|
ref,
|
|
@@ -1597,8 +2409,8 @@ Separator.displayName = "Separator";
|
|
|
1597
2409
|
var Divider = Separator;
|
|
1598
2410
|
|
|
1599
2411
|
// src/components/skeleton/Skeleton.tsx
|
|
1600
|
-
import * as
|
|
1601
|
-
import { jsx as
|
|
2412
|
+
import * as React32 from "react";
|
|
2413
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1602
2414
|
var roundedClasses = {
|
|
1603
2415
|
none: "rounded-none",
|
|
1604
2416
|
sm: "rounded-sm",
|
|
@@ -1606,8 +2418,8 @@ var roundedClasses = {
|
|
|
1606
2418
|
lg: "rounded-lg",
|
|
1607
2419
|
full: "rounded-full"
|
|
1608
2420
|
};
|
|
1609
|
-
var Skeleton =
|
|
1610
|
-
({ className, height, width, rounded = "md", ...props }, ref) => /* @__PURE__ */
|
|
2421
|
+
var Skeleton = React32.forwardRef(
|
|
2422
|
+
({ className, height, width, rounded = "md", ...props }, ref) => /* @__PURE__ */ jsx31(
|
|
1611
2423
|
"div",
|
|
1612
2424
|
{
|
|
1613
2425
|
ref,
|
|
@@ -1626,13 +2438,13 @@ var Skeleton = React28.forwardRef(
|
|
|
1626
2438
|
Skeleton.displayName = "Skeleton";
|
|
1627
2439
|
|
|
1628
2440
|
// src/components/progress/Progress.tsx
|
|
1629
|
-
import * as
|
|
1630
|
-
import { jsx as
|
|
1631
|
-
var Progress =
|
|
2441
|
+
import * as React33 from "react";
|
|
2442
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2443
|
+
var Progress = React33.forwardRef(
|
|
1632
2444
|
({ className, value = 0, max = 100, label, ...props }, ref) => {
|
|
1633
2445
|
const clamped = Math.min(Math.max(value, 0), max);
|
|
1634
2446
|
const percent = max > 0 ? clamped / max * 100 : 0;
|
|
1635
|
-
return /* @__PURE__ */
|
|
2447
|
+
return /* @__PURE__ */ jsx32(
|
|
1636
2448
|
"div",
|
|
1637
2449
|
{
|
|
1638
2450
|
ref,
|
|
@@ -1643,7 +2455,7 @@ var Progress = React29.forwardRef(
|
|
|
1643
2455
|
"aria-label": label,
|
|
1644
2456
|
className: cn("relative h-2 w-full overflow-hidden rounded-full bg-muted", className),
|
|
1645
2457
|
...props,
|
|
1646
|
-
children: /* @__PURE__ */
|
|
2458
|
+
children: /* @__PURE__ */ jsx32(
|
|
1647
2459
|
"div",
|
|
1648
2460
|
{
|
|
1649
2461
|
className: "h-full bg-primary transition-all duration-300 motion-reduce:transition-none",
|
|
@@ -1657,10 +2469,10 @@ var Progress = React29.forwardRef(
|
|
|
1657
2469
|
Progress.displayName = "Progress";
|
|
1658
2470
|
|
|
1659
2471
|
// src/components/tabs/Tabs.tsx
|
|
1660
|
-
import * as
|
|
2472
|
+
import * as React34 from "react";
|
|
1661
2473
|
import { cva as cva5 } from "class-variance-authority";
|
|
1662
|
-
import { jsx as
|
|
1663
|
-
var TabsContext =
|
|
2474
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2475
|
+
var TabsContext = React34.createContext({
|
|
1664
2476
|
value: "",
|
|
1665
2477
|
setValue: () => {
|
|
1666
2478
|
},
|
|
@@ -1668,19 +2480,19 @@ var TabsContext = React30.createContext({
|
|
|
1668
2480
|
variant: "default",
|
|
1669
2481
|
size: "md"
|
|
1670
2482
|
});
|
|
1671
|
-
var Tabs =
|
|
2483
|
+
var Tabs = React34.forwardRef(
|
|
1672
2484
|
({ value, defaultValue, onValueChange, variant = "default", size = "md", className, children }, ref) => {
|
|
1673
|
-
const [internalValue, setInternalValue] =
|
|
2485
|
+
const [internalValue, setInternalValue] = React34.useState(defaultValue ?? "");
|
|
1674
2486
|
const current = value ?? internalValue;
|
|
1675
|
-
const baseId =
|
|
1676
|
-
const setValue =
|
|
2487
|
+
const baseId = React34.useId();
|
|
2488
|
+
const setValue = React34.useCallback(
|
|
1677
2489
|
(next) => {
|
|
1678
2490
|
if (value === void 0) setInternalValue(next);
|
|
1679
2491
|
onValueChange?.(next);
|
|
1680
2492
|
},
|
|
1681
2493
|
[value, onValueChange]
|
|
1682
2494
|
);
|
|
1683
|
-
return /* @__PURE__ */
|
|
2495
|
+
return /* @__PURE__ */ jsx33("div", { ref, className, "data-value": current, "data-variant": variant, children: /* @__PURE__ */ jsx33(TabsContext.Provider, { value: { value: current, setValue, baseId, variant, size }, children }) });
|
|
1684
2496
|
}
|
|
1685
2497
|
);
|
|
1686
2498
|
Tabs.displayName = "Tabs";
|
|
@@ -1702,10 +2514,10 @@ var tabsListVariants = cva5("inline-flex items-center justify-center text-muted-
|
|
|
1702
2514
|
},
|
|
1703
2515
|
defaultVariants: { variant: "default", size: "md" }
|
|
1704
2516
|
});
|
|
1705
|
-
var TabsList =
|
|
2517
|
+
var TabsList = React34.forwardRef(
|
|
1706
2518
|
({ className, ...props }, ref) => {
|
|
1707
|
-
const ctx =
|
|
1708
|
-
return /* @__PURE__ */
|
|
2519
|
+
const ctx = React34.useContext(TabsContext);
|
|
2520
|
+
return /* @__PURE__ */ jsx33(
|
|
1709
2521
|
"div",
|
|
1710
2522
|
{
|
|
1711
2523
|
ref,
|
|
@@ -1745,9 +2557,9 @@ var triggerInactiveByVariant = {
|
|
|
1745
2557
|
underline: "border-transparent text-muted-foreground hover:border-border hover:text-foreground",
|
|
1746
2558
|
rounded: "hover:text-foreground"
|
|
1747
2559
|
};
|
|
1748
|
-
var TabsTrigger =
|
|
2560
|
+
var TabsTrigger = React34.forwardRef(
|
|
1749
2561
|
({ value, className, onKeyDown, ...props }, ref) => {
|
|
1750
|
-
const ctx =
|
|
2562
|
+
const ctx = React34.useContext(TabsContext);
|
|
1751
2563
|
const active = ctx.value === value;
|
|
1752
2564
|
const focusAt = (tabs, index) => {
|
|
1753
2565
|
if (tabs.length === 0) return;
|
|
@@ -1757,7 +2569,7 @@ var TabsTrigger = React30.forwardRef(
|
|
|
1757
2569
|
target.click();
|
|
1758
2570
|
};
|
|
1759
2571
|
const siblingTabs = (button) => Array.from(button.parentElement?.querySelectorAll('[role="tab"]') ?? []);
|
|
1760
|
-
return /* @__PURE__ */
|
|
2572
|
+
return /* @__PURE__ */ jsx33(
|
|
1761
2573
|
"button",
|
|
1762
2574
|
{
|
|
1763
2575
|
ref,
|
|
@@ -1803,11 +2615,11 @@ var TabsTrigger = React30.forwardRef(
|
|
|
1803
2615
|
}
|
|
1804
2616
|
);
|
|
1805
2617
|
TabsTrigger.displayName = "TabsTrigger";
|
|
1806
|
-
var TabsContent =
|
|
2618
|
+
var TabsContent = React34.forwardRef(
|
|
1807
2619
|
({ value, className, ...props }, ref) => {
|
|
1808
|
-
const ctx =
|
|
2620
|
+
const ctx = React34.useContext(TabsContext);
|
|
1809
2621
|
const active = ctx.value === value;
|
|
1810
|
-
return /* @__PURE__ */
|
|
2622
|
+
return /* @__PURE__ */ jsx33(
|
|
1811
2623
|
"div",
|
|
1812
2624
|
{
|
|
1813
2625
|
ref,
|
|
@@ -1829,25 +2641,29 @@ var TabsContent = React30.forwardRef(
|
|
|
1829
2641
|
TabsContent.displayName = "TabsContent";
|
|
1830
2642
|
|
|
1831
2643
|
// src/components/card/Card.tsx
|
|
1832
|
-
import * as
|
|
1833
|
-
import {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
2644
|
+
import * as React35 from "react";
|
|
2645
|
+
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
2646
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2647
|
+
var Card = React35.forwardRef(
|
|
2648
|
+
({ className, asChild = false, ...props }, ref) => {
|
|
2649
|
+
const Comp = asChild ? Slot3 : "div";
|
|
2650
|
+
return /* @__PURE__ */ jsx34(
|
|
2651
|
+
Comp,
|
|
2652
|
+
{
|
|
2653
|
+
ref,
|
|
2654
|
+
className: cn("rounded-xl border border-border bg-card text-card-foreground shadow-sm", className),
|
|
2655
|
+
...props
|
|
2656
|
+
}
|
|
2657
|
+
);
|
|
2658
|
+
}
|
|
1843
2659
|
);
|
|
1844
2660
|
Card.displayName = "Card";
|
|
1845
|
-
var CardHeader =
|
|
1846
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2661
|
+
var CardHeader = React35.forwardRef(
|
|
2662
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx34("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
1847
2663
|
);
|
|
1848
2664
|
CardHeader.displayName = "CardHeader";
|
|
1849
|
-
var CardTitle =
|
|
1850
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2665
|
+
var CardTitle = React35.forwardRef(
|
|
2666
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
1851
2667
|
"h3",
|
|
1852
2668
|
{
|
|
1853
2669
|
ref,
|
|
@@ -1857,29 +2673,304 @@ var CardTitle = React31.forwardRef(
|
|
|
1857
2673
|
)
|
|
1858
2674
|
);
|
|
1859
2675
|
CardTitle.displayName = "CardTitle";
|
|
1860
|
-
var CardDescription =
|
|
1861
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2676
|
+
var CardDescription = React35.forwardRef(
|
|
2677
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx34("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
|
|
1862
2678
|
);
|
|
1863
2679
|
CardDescription.displayName = "CardDescription";
|
|
1864
|
-
var CardContent =
|
|
1865
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2680
|
+
var CardContent = React35.forwardRef(
|
|
2681
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx34("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
1866
2682
|
);
|
|
1867
2683
|
CardContent.displayName = "CardContent";
|
|
1868
|
-
var CardFooter =
|
|
1869
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2684
|
+
var CardFooter = React35.forwardRef(
|
|
2685
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx34("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
1870
2686
|
);
|
|
1871
2687
|
CardFooter.displayName = "CardFooter";
|
|
1872
2688
|
|
|
2689
|
+
// src/components/confirm-dialog/ConfirmDialog.tsx
|
|
2690
|
+
import * as React36 from "react";
|
|
2691
|
+
import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2692
|
+
function ConfirmDialog({
|
|
2693
|
+
open,
|
|
2694
|
+
onOpenChange,
|
|
2695
|
+
title,
|
|
2696
|
+
description,
|
|
2697
|
+
confirmLabel = "Confirm",
|
|
2698
|
+
cancelLabel = "Cancel",
|
|
2699
|
+
destructive = false,
|
|
2700
|
+
onConfirm,
|
|
2701
|
+
closeOnConfirm = true,
|
|
2702
|
+
children
|
|
2703
|
+
}) {
|
|
2704
|
+
const [pending, setPending] = React36.useState(false);
|
|
2705
|
+
const handleConfirm = async () => {
|
|
2706
|
+
try {
|
|
2707
|
+
setPending(true);
|
|
2708
|
+
await onConfirm();
|
|
2709
|
+
if (closeOnConfirm) onOpenChange(false);
|
|
2710
|
+
} finally {
|
|
2711
|
+
setPending(false);
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
return /* @__PURE__ */ jsx35(
|
|
2715
|
+
Dialog,
|
|
2716
|
+
{
|
|
2717
|
+
open,
|
|
2718
|
+
onOpenChange: (next) => {
|
|
2719
|
+
if (pending) return;
|
|
2720
|
+
onOpenChange(next);
|
|
2721
|
+
},
|
|
2722
|
+
title,
|
|
2723
|
+
description,
|
|
2724
|
+
size: "sm",
|
|
2725
|
+
footer: /* @__PURE__ */ jsxs20(DialogFooter, { children: [
|
|
2726
|
+
/* @__PURE__ */ jsx35(Button, { variant: "ghost", onClick: () => onOpenChange(false), disabled: pending, children: cancelLabel }),
|
|
2727
|
+
/* @__PURE__ */ jsx35(
|
|
2728
|
+
Button,
|
|
2729
|
+
{
|
|
2730
|
+
variant: destructive ? "destructive" : "default",
|
|
2731
|
+
onClick: handleConfirm,
|
|
2732
|
+
loading: pending,
|
|
2733
|
+
children: confirmLabel
|
|
2734
|
+
}
|
|
2735
|
+
)
|
|
2736
|
+
] }),
|
|
2737
|
+
children
|
|
2738
|
+
}
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
// src/components/table-of-contents/TableOfContents.tsx
|
|
2743
|
+
import * as React37 from "react";
|
|
2744
|
+
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2745
|
+
function TableOfContents({
|
|
2746
|
+
headings,
|
|
2747
|
+
activeId,
|
|
2748
|
+
label = "On this page",
|
|
2749
|
+
sticky = true,
|
|
2750
|
+
className,
|
|
2751
|
+
...props
|
|
2752
|
+
}) {
|
|
2753
|
+
return /* @__PURE__ */ jsxs21(
|
|
2754
|
+
"nav",
|
|
2755
|
+
{
|
|
2756
|
+
"aria-label": label,
|
|
2757
|
+
className: cn("text-sm", sticky && "sticky top-20 max-h-[calc(100vh-6rem)] overflow-y-auto", className),
|
|
2758
|
+
...props,
|
|
2759
|
+
children: [
|
|
2760
|
+
/* @__PURE__ */ jsx36("p", { className: "mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
2761
|
+
/* @__PURE__ */ jsx36("ul", { className: "space-y-1 border-l border-border", children: headings.map((heading) => {
|
|
2762
|
+
const active = heading.id === activeId;
|
|
2763
|
+
return /* @__PURE__ */ jsx36("li", { style: { paddingLeft: `${(heading.level - 2) * 0.75}rem` }, children: /* @__PURE__ */ jsx36(
|
|
2764
|
+
"a",
|
|
2765
|
+
{
|
|
2766
|
+
href: `#${heading.id}`,
|
|
2767
|
+
"aria-current": active ? "location" : void 0,
|
|
2768
|
+
className: cn(
|
|
2769
|
+
"-ml-px block border-l py-1 pl-3 transition-colors",
|
|
2770
|
+
active ? "border-primary font-medium text-primary" : "border-transparent text-muted-foreground hover:border-border hover:text-foreground"
|
|
2771
|
+
),
|
|
2772
|
+
children: heading.text
|
|
2773
|
+
}
|
|
2774
|
+
) }, heading.id);
|
|
2775
|
+
}) })
|
|
2776
|
+
]
|
|
2777
|
+
}
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2780
|
+
function useScrollSpy(ids, options) {
|
|
2781
|
+
const [activeId, setActiveId] = React37.useState();
|
|
2782
|
+
const idKey = ids.join("|");
|
|
2783
|
+
const rootMargin = options?.rootMargin ?? "0px 0px -70% 0px";
|
|
2784
|
+
React37.useEffect(() => {
|
|
2785
|
+
if (idKey.length === 0 || typeof IntersectionObserver === "undefined") return;
|
|
2786
|
+
const elements = idKey.split("|").map((id) => document.getElementById(id)).filter((element) => element !== null);
|
|
2787
|
+
if (elements.length === 0) return;
|
|
2788
|
+
const observer = new IntersectionObserver(
|
|
2789
|
+
(entries) => {
|
|
2790
|
+
const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
|
|
2791
|
+
if (visible[0]) setActiveId(visible[0].target.id);
|
|
2792
|
+
return;
|
|
2793
|
+
},
|
|
2794
|
+
{ rootMargin, threshold: 0 }
|
|
2795
|
+
);
|
|
2796
|
+
elements.forEach((element) => observer.observe(element));
|
|
2797
|
+
return () => observer.disconnect();
|
|
2798
|
+
}, [idKey, rootMargin]);
|
|
2799
|
+
return activeId;
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
// src/components/prose/Prose.tsx
|
|
2803
|
+
import * as React38 from "react";
|
|
2804
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2805
|
+
var sizeClasses3 = {
|
|
2806
|
+
sm: "text-sm [&_h2]:text-xl [&_h3]:text-lg",
|
|
2807
|
+
md: "text-base [&_h2]:text-2xl [&_h3]:text-xl",
|
|
2808
|
+
lg: "text-lg [&_h2]:text-3xl [&_h3]:text-2xl"
|
|
2809
|
+
};
|
|
2810
|
+
var Prose = React38.forwardRef(function Prose2({ size = "md", className, ...props }, ref) {
|
|
2811
|
+
return /* @__PURE__ */ jsx37(
|
|
2812
|
+
"div",
|
|
2813
|
+
{
|
|
2814
|
+
ref,
|
|
2815
|
+
className: cn(
|
|
2816
|
+
"max-w-none text-foreground",
|
|
2817
|
+
sizeClasses3[size],
|
|
2818
|
+
// Headings
|
|
2819
|
+
"[&_h1]:mb-4 [&_h1]:mt-10 [&_h1]:scroll-mt-24 [&_h1]:text-3xl [&_h1]:font-bold [&_h1]:tracking-tight",
|
|
2820
|
+
"[&_h2]:mb-3 [&_h2]:mt-9 [&_h2]:scroll-mt-24 [&_h2]:font-semibold [&_h2]:tracking-tight",
|
|
2821
|
+
"[&_h3]:mb-2 [&_h3]:mt-7 [&_h3]:scroll-mt-24 [&_h3]:font-semibold",
|
|
2822
|
+
"[&_h4]:mb-2 [&_h4]:mt-6 [&_h4]:scroll-mt-24 [&_h4]:font-semibold",
|
|
2823
|
+
// Body copy
|
|
2824
|
+
"[&_p]:my-4 [&_p]:leading-7",
|
|
2825
|
+
"[&_a]:text-primary [&_a]:underline [&_a]:decoration-primary/40 [&_a]:underline-offset-4 hover:[&_a]:decoration-primary",
|
|
2826
|
+
"[&_strong]:font-semibold [&_strong]:text-foreground [&_em]:italic",
|
|
2827
|
+
"[&_ul]:my-4 [&_ul]:list-disc [&_ul]:space-y-1.5 [&_ul]:pl-6",
|
|
2828
|
+
"[&_ol]:my-4 [&_ol]:list-decimal [&_ol]:space-y-1.5 [&_ol]:pl-6",
|
|
2829
|
+
"[&_li]:leading-7 [&_li>p]:my-0",
|
|
2830
|
+
"[&_blockquote]:my-6 [&_blockquote]:border-l-2 [&_blockquote]:border-primary/40 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:text-muted-foreground",
|
|
2831
|
+
// Code
|
|
2832
|
+
"[&_code]:rounded [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.875em]",
|
|
2833
|
+
"[&_pre]:my-5 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/50 [&_pre]:p-4",
|
|
2834
|
+
"[&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-sm",
|
|
2835
|
+
// Media, rules, tables
|
|
2836
|
+
"[&_hr]:my-8 [&_hr]:border-border",
|
|
2837
|
+
"[&_img]:my-6 [&_img]:rounded-lg [&_img]:border [&_img]:border-border",
|
|
2838
|
+
"[&_figure]:my-6 [&_figcaption]:mt-2 [&_figcaption]:text-center [&_figcaption]:text-xs [&_figcaption]:text-muted-foreground",
|
|
2839
|
+
"[&_table]:my-6 [&_table]:w-full [&_table]:border-collapse [&_table]:text-sm",
|
|
2840
|
+
"[&_th]:border-b [&_th]:border-border [&_th]:px-3 [&_th]:py-2 [&_th]:text-left [&_th]:font-semibold",
|
|
2841
|
+
"[&_td]:border-b [&_td]:border-border [&_td]:px-3 [&_td]:py-2",
|
|
2842
|
+
className
|
|
2843
|
+
),
|
|
2844
|
+
...props
|
|
2845
|
+
}
|
|
2846
|
+
);
|
|
2847
|
+
});
|
|
2848
|
+
|
|
2849
|
+
// src/components/site-footer/SiteFooter.tsx
|
|
2850
|
+
import { jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2851
|
+
function SiteFooter({
|
|
2852
|
+
brand,
|
|
2853
|
+
tagline,
|
|
2854
|
+
columns,
|
|
2855
|
+
legal,
|
|
2856
|
+
linkComponent,
|
|
2857
|
+
className,
|
|
2858
|
+
...props
|
|
2859
|
+
}) {
|
|
2860
|
+
const Link3 = linkComponent ?? "a";
|
|
2861
|
+
return /* @__PURE__ */ jsxs22("footer", { className: cn("border-t border-border bg-muted/30", className), ...props, children: [
|
|
2862
|
+
/* @__PURE__ */ jsxs22("div", { className: "mx-auto grid w-full max-w-7xl gap-8 px-4 py-12 sm:grid-cols-2 sm:px-6 lg:grid-cols-4", children: [
|
|
2863
|
+
/* @__PURE__ */ jsxs22("div", { className: "min-w-0", children: [
|
|
2864
|
+
brand,
|
|
2865
|
+
tagline && /* @__PURE__ */ jsx38("p", { className: "mt-3 max-w-56 text-sm text-muted-foreground", children: tagline })
|
|
2866
|
+
] }),
|
|
2867
|
+
columns.map((column) => /* @__PURE__ */ jsxs22("div", { children: [
|
|
2868
|
+
/* @__PURE__ */ jsx38("h3", { className: "mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: column.title }),
|
|
2869
|
+
/* @__PURE__ */ jsx38("ul", { className: "space-y-2 text-sm", children: column.links.map((link) => /* @__PURE__ */ jsx38("li", { children: /* @__PURE__ */ jsx38(
|
|
2870
|
+
Link3,
|
|
2871
|
+
{
|
|
2872
|
+
href: link.href,
|
|
2873
|
+
...link.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
2874
|
+
className: "text-muted-foreground transition-colors hover:text-foreground",
|
|
2875
|
+
children: link.label
|
|
2876
|
+
}
|
|
2877
|
+
) }, `${column.title}-${link.href}-${link.label}`)) })
|
|
2878
|
+
] }, column.title))
|
|
2879
|
+
] }),
|
|
2880
|
+
legal && /* @__PURE__ */ jsx38("div", { className: "border-t border-border", children: /* @__PURE__ */ jsx38("div", { className: "mx-auto flex w-full max-w-7xl flex-wrap items-center justify-between gap-2 px-4 py-4 text-xs text-muted-foreground sm:px-6", children: legal }) })
|
|
2881
|
+
] });
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
// src/components/site-header/SiteHeader.tsx
|
|
2885
|
+
import * as React39 from "react";
|
|
2886
|
+
import { Fragment as Fragment6, jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2887
|
+
function isActive(itemHref, activeHref, match) {
|
|
2888
|
+
if (!activeHref) return false;
|
|
2889
|
+
if (itemHref === activeHref) return true;
|
|
2890
|
+
if (match === "exact") return false;
|
|
2891
|
+
return activeHref === itemHref || activeHref.startsWith(itemHref.endsWith("/") ? itemHref : `${itemHref}/`);
|
|
2892
|
+
}
|
|
2893
|
+
function SiteHeader({
|
|
2894
|
+
brand,
|
|
2895
|
+
items,
|
|
2896
|
+
activeHref,
|
|
2897
|
+
match = "prefix",
|
|
2898
|
+
actions,
|
|
2899
|
+
linkComponent,
|
|
2900
|
+
sticky = true,
|
|
2901
|
+
mobileLabel = "Menu",
|
|
2902
|
+
className,
|
|
2903
|
+
...props
|
|
2904
|
+
}) {
|
|
2905
|
+
const [mobileOpen, setMobileOpen] = React39.useState(false);
|
|
2906
|
+
const Link3 = linkComponent ?? "a";
|
|
2907
|
+
const navLink = (item, extra) => {
|
|
2908
|
+
const active = isActive(item.href, activeHref, match);
|
|
2909
|
+
return /* @__PURE__ */ jsx39(
|
|
2910
|
+
Link3,
|
|
2911
|
+
{
|
|
2912
|
+
href: item.href,
|
|
2913
|
+
"aria-current": active ? "page" : void 0,
|
|
2914
|
+
...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
2915
|
+
onClick: extra === "mobile" ? () => setMobileOpen(false) : void 0,
|
|
2916
|
+
className: cn(
|
|
2917
|
+
"rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2918
|
+
extra === "mobile" ? "block rounded-md px-3 py-2 text-base hover:bg-accent" : "text-sm hover:text-foreground",
|
|
2919
|
+
active ? "font-medium text-foreground" : "text-muted-foreground"
|
|
2920
|
+
),
|
|
2921
|
+
children: item.label
|
|
2922
|
+
},
|
|
2923
|
+
item.href
|
|
2924
|
+
);
|
|
2925
|
+
};
|
|
2926
|
+
return /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
2927
|
+
/* @__PURE__ */ jsx39(
|
|
2928
|
+
"header",
|
|
2929
|
+
{
|
|
2930
|
+
className: cn(
|
|
2931
|
+
"w-full border-b border-border bg-background/80 backdrop-blur supports-[backdrop-filter]:bg-background/60",
|
|
2932
|
+
sticky && "sticky top-0 z-40",
|
|
2933
|
+
className
|
|
2934
|
+
),
|
|
2935
|
+
...props,
|
|
2936
|
+
children: /* @__PURE__ */ jsxs23("nav", { className: "mx-auto flex h-14 w-full max-w-7xl items-center justify-between gap-4 px-4 sm:px-6", children: [
|
|
2937
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex min-w-0 items-center gap-6", children: [
|
|
2938
|
+
/* @__PURE__ */ jsx39(Link3, { href: "/", "aria-label": "Home", className: "flex shrink-0 items-center", children: brand }),
|
|
2939
|
+
/* @__PURE__ */ jsx39("div", { className: "hidden items-center gap-5 md:flex", children: items.map((item) => navLink(item)) })
|
|
2940
|
+
] }),
|
|
2941
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", children: [
|
|
2942
|
+
actions,
|
|
2943
|
+
/* @__PURE__ */ jsx39(
|
|
2944
|
+
"button",
|
|
2945
|
+
{
|
|
2946
|
+
type: "button",
|
|
2947
|
+
onClick: () => setMobileOpen(true),
|
|
2948
|
+
"aria-label": "Open menu",
|
|
2949
|
+
className: "rounded-md border border-border p-2 text-muted-foreground hover:bg-muted md:hidden",
|
|
2950
|
+
children: /* @__PURE__ */ jsx39("span", { "aria-hidden": "true", children: "\u2630" })
|
|
2951
|
+
}
|
|
2952
|
+
)
|
|
2953
|
+
] })
|
|
2954
|
+
] })
|
|
2955
|
+
}
|
|
2956
|
+
),
|
|
2957
|
+
/* @__PURE__ */ jsxs23(Drawer, { open: mobileOpen, onOpenChange: setMobileOpen, title: mobileLabel, side: "right", size: "sm", animate: true, children: [
|
|
2958
|
+
/* @__PURE__ */ jsx39("nav", { "aria-label": "Mobile", className: "flex flex-col gap-1", children: items.map((item) => navLink(item, "mobile")) }),
|
|
2959
|
+
actions && /* @__PURE__ */ jsx39("div", { className: "mt-4 border-t border-border pt-4", children: actions })
|
|
2960
|
+
] })
|
|
2961
|
+
] });
|
|
2962
|
+
}
|
|
2963
|
+
|
|
1873
2964
|
// src/components/accordion/Accordion.tsx
|
|
1874
|
-
import * as
|
|
1875
|
-
import { jsx as
|
|
1876
|
-
var AccordionContext =
|
|
2965
|
+
import * as React40 from "react";
|
|
2966
|
+
import { jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2967
|
+
var AccordionContext = React40.createContext({
|
|
1877
2968
|
openItems: /* @__PURE__ */ new Set(),
|
|
1878
2969
|
toggle: () => {
|
|
1879
2970
|
},
|
|
1880
2971
|
collapsible: true
|
|
1881
2972
|
});
|
|
1882
|
-
var Accordion =
|
|
2973
|
+
var Accordion = React40.forwardRef(
|
|
1883
2974
|
({
|
|
1884
2975
|
value,
|
|
1885
2976
|
defaultValue = [],
|
|
@@ -1891,9 +2982,9 @@ var Accordion = React32.forwardRef(
|
|
|
1891
2982
|
style,
|
|
1892
2983
|
children
|
|
1893
2984
|
}, ref) => {
|
|
1894
|
-
const [internalOpen, setInternalOpen] =
|
|
2985
|
+
const [internalOpen, setInternalOpen] = React40.useState(defaultValue);
|
|
1895
2986
|
const current = value ?? internalOpen;
|
|
1896
|
-
const toggle =
|
|
2987
|
+
const toggle = React40.useCallback(
|
|
1897
2988
|
(id) => {
|
|
1898
2989
|
const next = current.includes(id) ? current.filter((item) => item !== id) : collapsible ? [id] : [...current, id];
|
|
1899
2990
|
if (value === void 0) setInternalOpen(next);
|
|
@@ -1902,7 +2993,7 @@ var Accordion = React32.forwardRef(
|
|
|
1902
2993
|
[current, collapsible, value, onValueChange]
|
|
1903
2994
|
);
|
|
1904
2995
|
const gapResolved = resolveGap(gap);
|
|
1905
|
-
return /* @__PURE__ */
|
|
2996
|
+
return /* @__PURE__ */ jsx40(
|
|
1906
2997
|
"div",
|
|
1907
2998
|
{
|
|
1908
2999
|
ref,
|
|
@@ -1915,25 +3006,25 @@ var Accordion = React32.forwardRef(
|
|
|
1915
3006
|
className
|
|
1916
3007
|
),
|
|
1917
3008
|
style: { ...gapResolved.style, ...style },
|
|
1918
|
-
children: /* @__PURE__ */
|
|
3009
|
+
children: /* @__PURE__ */ jsx40(AccordionContext.Provider, { value: { openItems: new Set(current), toggle, collapsible }, children })
|
|
1919
3010
|
}
|
|
1920
3011
|
);
|
|
1921
3012
|
}
|
|
1922
3013
|
);
|
|
1923
3014
|
Accordion.displayName = "Accordion";
|
|
1924
|
-
var AccordionItem =
|
|
1925
|
-
({ id, className, children }, ref) => /* @__PURE__ */
|
|
3015
|
+
var AccordionItem = React40.forwardRef(
|
|
3016
|
+
({ id, className, children }, ref) => /* @__PURE__ */ jsx40("div", { ref, "data-accordion-item": id, className, children: /* @__PURE__ */ jsx40(AccordionItemContext.Provider, { value: { id }, children }) })
|
|
1926
3017
|
);
|
|
1927
3018
|
AccordionItem.displayName = "AccordionItem";
|
|
1928
|
-
var AccordionItemContext =
|
|
1929
|
-
var AccordionTrigger =
|
|
3019
|
+
var AccordionItemContext = React40.createContext({ id: "" });
|
|
3020
|
+
var AccordionTrigger = React40.forwardRef(
|
|
1930
3021
|
({ className, children, icon, ...props }, ref) => {
|
|
1931
|
-
const { id } =
|
|
1932
|
-
const { openItems, toggle } =
|
|
3022
|
+
const { id } = React40.useContext(AccordionItemContext);
|
|
3023
|
+
const { openItems, toggle } = React40.useContext(AccordionContext);
|
|
1933
3024
|
const open = openItems.has(id);
|
|
1934
3025
|
const panelId = `${id}-panel`;
|
|
1935
3026
|
const triggerId = `${id}-trigger`;
|
|
1936
|
-
return /* @__PURE__ */
|
|
3027
|
+
return /* @__PURE__ */ jsxs24(
|
|
1937
3028
|
"button",
|
|
1938
3029
|
{
|
|
1939
3030
|
ref,
|
|
@@ -1952,7 +3043,7 @@ var AccordionTrigger = React32.forwardRef(
|
|
|
1952
3043
|
...props,
|
|
1953
3044
|
children: [
|
|
1954
3045
|
children,
|
|
1955
|
-
icon ?? /* @__PURE__ */
|
|
3046
|
+
icon ?? /* @__PURE__ */ jsx40(
|
|
1956
3047
|
"svg",
|
|
1957
3048
|
{
|
|
1958
3049
|
"aria-hidden": "true",
|
|
@@ -1962,7 +3053,7 @@ var AccordionTrigger = React32.forwardRef(
|
|
|
1962
3053
|
strokeWidth: "2",
|
|
1963
3054
|
strokeLinecap: "round",
|
|
1964
3055
|
className: cn("h-4 w-4 shrink-0 transition-transform duration-200", open && "rotate-180"),
|
|
1965
|
-
children: /* @__PURE__ */
|
|
3056
|
+
children: /* @__PURE__ */ jsx40("polyline", { points: "6 9 12 15 18 9" })
|
|
1966
3057
|
}
|
|
1967
3058
|
)
|
|
1968
3059
|
]
|
|
@@ -1971,13 +3062,13 @@ var AccordionTrigger = React32.forwardRef(
|
|
|
1971
3062
|
}
|
|
1972
3063
|
);
|
|
1973
3064
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
1974
|
-
var AccordionContent =
|
|
3065
|
+
var AccordionContent = React40.forwardRef(
|
|
1975
3066
|
({ className, children, ...props }, ref) => {
|
|
1976
|
-
const { id } =
|
|
1977
|
-
const { openItems } =
|
|
3067
|
+
const { id } = React40.useContext(AccordionItemContext);
|
|
3068
|
+
const { openItems } = React40.useContext(AccordionContext);
|
|
1978
3069
|
const open = openItems.has(id);
|
|
1979
|
-
const [expanded, setExpanded] =
|
|
1980
|
-
|
|
3070
|
+
const [expanded, setExpanded] = React40.useState(open);
|
|
3071
|
+
React40.useEffect(() => {
|
|
1981
3072
|
if (!open) {
|
|
1982
3073
|
setExpanded(false);
|
|
1983
3074
|
return;
|
|
@@ -1996,7 +3087,7 @@ var AccordionContent = React32.forwardRef(
|
|
|
1996
3087
|
cancelAnimationFrame(second);
|
|
1997
3088
|
};
|
|
1998
3089
|
}, [open]);
|
|
1999
|
-
return /* @__PURE__ */
|
|
3090
|
+
return /* @__PURE__ */ jsx40(
|
|
2000
3091
|
"div",
|
|
2001
3092
|
{
|
|
2002
3093
|
ref,
|
|
@@ -2015,7 +3106,7 @@ var AccordionContent = React32.forwardRef(
|
|
|
2015
3106
|
className
|
|
2016
3107
|
),
|
|
2017
3108
|
...props,
|
|
2018
|
-
children: /* @__PURE__ */
|
|
3109
|
+
children: /* @__PURE__ */ jsx40("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx40("div", { className: "px-4 pb-3 text-sm text-muted-foreground", children }) })
|
|
2019
3110
|
}
|
|
2020
3111
|
);
|
|
2021
3112
|
}
|
|
@@ -2023,10 +3114,10 @@ var AccordionContent = React32.forwardRef(
|
|
|
2023
3114
|
AccordionContent.displayName = "AccordionContent";
|
|
2024
3115
|
|
|
2025
3116
|
// src/components/table/Table.tsx
|
|
2026
|
-
import * as
|
|
2027
|
-
import { jsx as
|
|
2028
|
-
var Table =
|
|
2029
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3117
|
+
import * as React41 from "react";
|
|
3118
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3119
|
+
var Table = React41.forwardRef(
|
|
3120
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx41(
|
|
2030
3121
|
"table",
|
|
2031
3122
|
{
|
|
2032
3123
|
ref,
|
|
@@ -2036,16 +3127,16 @@ var Table = React33.forwardRef(
|
|
|
2036
3127
|
) })
|
|
2037
3128
|
);
|
|
2038
3129
|
Table.displayName = "Table";
|
|
2039
|
-
var TableHeader =
|
|
2040
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3130
|
+
var TableHeader = React41.forwardRef(
|
|
3131
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
|
|
2041
3132
|
);
|
|
2042
3133
|
TableHeader.displayName = "TableHeader";
|
|
2043
|
-
var TableBody =
|
|
2044
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3134
|
+
var TableBody = React41.forwardRef(
|
|
3135
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props })
|
|
2045
3136
|
);
|
|
2046
3137
|
TableBody.displayName = "TableBody";
|
|
2047
|
-
var TableFooter =
|
|
2048
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3138
|
+
var TableFooter = React41.forwardRef(
|
|
3139
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41(
|
|
2049
3140
|
"tfoot",
|
|
2050
3141
|
{
|
|
2051
3142
|
ref,
|
|
@@ -2055,8 +3146,8 @@ var TableFooter = React33.forwardRef(
|
|
|
2055
3146
|
)
|
|
2056
3147
|
);
|
|
2057
3148
|
TableFooter.displayName = "TableFooter";
|
|
2058
|
-
var TableRow =
|
|
2059
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3149
|
+
var TableRow = React41.forwardRef(
|
|
3150
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41(
|
|
2060
3151
|
"tr",
|
|
2061
3152
|
{
|
|
2062
3153
|
ref,
|
|
@@ -2069,8 +3160,8 @@ var TableRow = React33.forwardRef(
|
|
|
2069
3160
|
)
|
|
2070
3161
|
);
|
|
2071
3162
|
TableRow.displayName = "TableRow";
|
|
2072
|
-
var TableHead =
|
|
2073
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3163
|
+
var TableHead = React41.forwardRef(
|
|
3164
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41(
|
|
2074
3165
|
"th",
|
|
2075
3166
|
{
|
|
2076
3167
|
ref,
|
|
@@ -2084,35 +3175,45 @@ var TableHead = React33.forwardRef(
|
|
|
2084
3175
|
)
|
|
2085
3176
|
);
|
|
2086
3177
|
TableHead.displayName = "TableHead";
|
|
2087
|
-
var TableCell =
|
|
2088
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3178
|
+
var TableCell = React41.forwardRef(
|
|
3179
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41("td", { ref, className: cn("px-3 py-2 align-middle", className), ...props })
|
|
2089
3180
|
);
|
|
2090
3181
|
TableCell.displayName = "TableCell";
|
|
2091
|
-
var TableCaption =
|
|
2092
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3182
|
+
var TableCaption = React41.forwardRef(
|
|
3183
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41("caption", { ref, className: cn("mt-3 text-xs text-muted-foreground", className), ...props })
|
|
2093
3184
|
);
|
|
2094
3185
|
TableCaption.displayName = "TableCaption";
|
|
2095
3186
|
|
|
2096
3187
|
// src/components/data-table/DataTable.tsx
|
|
2097
|
-
import * as
|
|
3188
|
+
import * as React43 from "react";
|
|
2098
3189
|
|
|
2099
3190
|
// src/components/pagination/Pagination.tsx
|
|
2100
|
-
import * as
|
|
2101
|
-
import { jsx as
|
|
3191
|
+
import * as React42 from "react";
|
|
3192
|
+
import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2102
3193
|
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";
|
|
2103
|
-
var Pagination =
|
|
3194
|
+
var Pagination = React42.forwardRef(
|
|
2104
3195
|
({
|
|
2105
|
-
page,
|
|
2106
|
-
pageCount,
|
|
3196
|
+
page: pageProp,
|
|
3197
|
+
pageCount: pageCountProp,
|
|
3198
|
+
currentPage,
|
|
3199
|
+
totalPages,
|
|
3200
|
+
pageSize,
|
|
3201
|
+
total,
|
|
3202
|
+
itemLabel = "items",
|
|
3203
|
+
showSummary,
|
|
2107
3204
|
onPageChange,
|
|
2108
3205
|
siblings = 1,
|
|
2109
3206
|
showBoundaries = false,
|
|
2110
3207
|
showFirst,
|
|
2111
3208
|
showLast,
|
|
2112
3209
|
icons,
|
|
3210
|
+
labels,
|
|
2113
3211
|
className,
|
|
2114
3212
|
...props
|
|
2115
3213
|
}, ref) => {
|
|
3214
|
+
const page = pageProp ?? currentPage ?? 1;
|
|
3215
|
+
const derivedPageCount = total !== void 0 && pageSize !== void 0 && pageSize > 0 ? Math.ceil(total / pageSize) : void 0;
|
|
3216
|
+
const pageCount = Math.max(1, pageCountProp ?? totalPages ?? derivedPageCount ?? 1);
|
|
2116
3217
|
const pages = [];
|
|
2117
3218
|
const start = Math.max(2, page - siblings);
|
|
2118
3219
|
const end = Math.min(pageCount - 1, page + siblings);
|
|
@@ -2123,38 +3224,41 @@ var Pagination = React34.forwardRef(
|
|
|
2123
3224
|
if (pageCount > 1) pages.push(pageCount);
|
|
2124
3225
|
const withFirst = showFirst ?? showBoundaries;
|
|
2125
3226
|
const withLast = showLast ?? showBoundaries;
|
|
2126
|
-
|
|
3227
|
+
const summaryEnabled = showSummary ?? (total !== void 0 && pageSize !== void 0);
|
|
3228
|
+
const rangeStart = pageSize !== void 0 ? (page - 1) * pageSize + 1 : void 0;
|
|
3229
|
+
const rangeEnd = pageSize !== void 0 && total !== void 0 ? Math.min(total, page * pageSize) : void 0;
|
|
3230
|
+
const nav = /* @__PURE__ */ jsxs25(
|
|
2127
3231
|
"nav",
|
|
2128
3232
|
{
|
|
2129
3233
|
ref,
|
|
2130
|
-
"aria-label": "Pagination",
|
|
2131
|
-
className: cn("flex items-center justify-center gap-1", className),
|
|
3234
|
+
"aria-label": labels?.pagination ?? "Pagination",
|
|
3235
|
+
className: cn("flex items-center justify-center gap-1", summaryEnabled ? void 0 : className),
|
|
2132
3236
|
...props,
|
|
2133
3237
|
children: [
|
|
2134
|
-
withFirst && /* @__PURE__ */
|
|
3238
|
+
withFirst && /* @__PURE__ */ jsx42(
|
|
2135
3239
|
"button",
|
|
2136
3240
|
{
|
|
2137
3241
|
type: "button",
|
|
2138
3242
|
onClick: () => onPageChange?.(1),
|
|
2139
3243
|
disabled: page <= 1,
|
|
2140
|
-
"aria-label": "First page",
|
|
3244
|
+
"aria-label": labels?.first ?? "First page",
|
|
2141
3245
|
className: controlClass,
|
|
2142
3246
|
children: icons?.first ?? "\xAB"
|
|
2143
3247
|
}
|
|
2144
3248
|
),
|
|
2145
|
-
/* @__PURE__ */
|
|
3249
|
+
/* @__PURE__ */ jsx42(
|
|
2146
3250
|
"button",
|
|
2147
3251
|
{
|
|
2148
3252
|
type: "button",
|
|
2149
3253
|
onClick: () => onPageChange?.(page - 1),
|
|
2150
3254
|
disabled: page <= 1,
|
|
2151
|
-
"aria-label": "Previous page",
|
|
3255
|
+
"aria-label": labels?.previous ?? "Previous page",
|
|
2152
3256
|
className: controlClass,
|
|
2153
3257
|
children: icons?.previous ?? "\u2039"
|
|
2154
3258
|
}
|
|
2155
3259
|
),
|
|
2156
3260
|
pages.map(
|
|
2157
|
-
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */
|
|
3261
|
+
(entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx42(
|
|
2158
3262
|
"span",
|
|
2159
3263
|
{
|
|
2160
3264
|
"aria-hidden": "true",
|
|
@@ -2162,13 +3266,13 @@ var Pagination = React34.forwardRef(
|
|
|
2162
3266
|
children: "\u2026"
|
|
2163
3267
|
},
|
|
2164
3268
|
`ellipsis-${index}`
|
|
2165
|
-
) : /* @__PURE__ */
|
|
3269
|
+
) : /* @__PURE__ */ jsx42(
|
|
2166
3270
|
"button",
|
|
2167
3271
|
{
|
|
2168
3272
|
type: "button",
|
|
2169
3273
|
onClick: () => onPageChange?.(entry),
|
|
2170
3274
|
"aria-current": entry === page ? "page" : void 0,
|
|
2171
|
-
"aria-label": `Page ${entry}`,
|
|
3275
|
+
"aria-label": labels?.page?.(entry) ?? `Page ${entry}`,
|
|
2172
3276
|
className: cn(
|
|
2173
3277
|
"inline-flex h-8 w-8 items-center justify-center rounded-md border text-sm transition-colors",
|
|
2174
3278
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
@@ -2179,24 +3283,24 @@ var Pagination = React34.forwardRef(
|
|
|
2179
3283
|
entry
|
|
2180
3284
|
)
|
|
2181
3285
|
),
|
|
2182
|
-
/* @__PURE__ */
|
|
3286
|
+
/* @__PURE__ */ jsx42(
|
|
2183
3287
|
"button",
|
|
2184
3288
|
{
|
|
2185
3289
|
type: "button",
|
|
2186
3290
|
onClick: () => onPageChange?.(page + 1),
|
|
2187
3291
|
disabled: page >= pageCount,
|
|
2188
|
-
"aria-label": "Next page",
|
|
3292
|
+
"aria-label": labels?.next ?? "Next page",
|
|
2189
3293
|
className: controlClass,
|
|
2190
3294
|
children: icons?.next ?? "\u203A"
|
|
2191
3295
|
}
|
|
2192
3296
|
),
|
|
2193
|
-
withLast && /* @__PURE__ */
|
|
3297
|
+
withLast && /* @__PURE__ */ jsx42(
|
|
2194
3298
|
"button",
|
|
2195
3299
|
{
|
|
2196
3300
|
type: "button",
|
|
2197
3301
|
onClick: () => onPageChange?.(pageCount),
|
|
2198
3302
|
disabled: page >= pageCount,
|
|
2199
|
-
"aria-label": "Last page",
|
|
3303
|
+
"aria-label": labels?.last ?? "Last page",
|
|
2200
3304
|
className: controlClass,
|
|
2201
3305
|
children: icons?.last ?? "\xBB"
|
|
2202
3306
|
}
|
|
@@ -2204,12 +3308,17 @@ var Pagination = React34.forwardRef(
|
|
|
2204
3308
|
]
|
|
2205
3309
|
}
|
|
2206
3310
|
);
|
|
3311
|
+
if (!summaryEnabled) return nav;
|
|
3312
|
+
return /* @__PURE__ */ jsxs25("div", { className: cn("flex flex-wrap items-center justify-between gap-3", className), children: [
|
|
3313
|
+
/* @__PURE__ */ jsx42("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}` }),
|
|
3314
|
+
nav
|
|
3315
|
+
] });
|
|
2207
3316
|
}
|
|
2208
3317
|
);
|
|
2209
3318
|
Pagination.displayName = "Pagination";
|
|
2210
3319
|
|
|
2211
3320
|
// src/components/data-table/DataTable.tsx
|
|
2212
|
-
import { jsx as
|
|
3321
|
+
import { jsx as jsx43, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2213
3322
|
function compareValues(a, b) {
|
|
2214
3323
|
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
2215
3324
|
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
@@ -2230,8 +3339,16 @@ function DataTable({
|
|
|
2230
3339
|
pageSize,
|
|
2231
3340
|
page,
|
|
2232
3341
|
onPageChange,
|
|
3342
|
+
pageCount: pageCountProp,
|
|
3343
|
+
total,
|
|
3344
|
+
manualPagination = false,
|
|
3345
|
+
selectedRowIds,
|
|
3346
|
+
onSelectedRowIdsChange,
|
|
3347
|
+
isRowSelectable,
|
|
3348
|
+
bulkActions,
|
|
2233
3349
|
onRowClick,
|
|
2234
3350
|
emptyMessage = "No results.",
|
|
3351
|
+
selectAllLabel = "Select all rows",
|
|
2235
3352
|
stickyHeader,
|
|
2236
3353
|
density = "default",
|
|
2237
3354
|
zebra,
|
|
@@ -2239,9 +3356,9 @@ function DataTable({
|
|
|
2239
3356
|
loadingRows,
|
|
2240
3357
|
className
|
|
2241
3358
|
}) {
|
|
2242
|
-
const [internalSort, setInternalSort] =
|
|
2243
|
-
const [internalPage, setInternalPage] =
|
|
2244
|
-
const sort =
|
|
3359
|
+
const [internalSort, setInternalSort] = React43.useState(defaultSort);
|
|
3360
|
+
const [internalPage, setInternalPage] = React43.useState(1);
|
|
3361
|
+
const sort = React43.useMemo(() => {
|
|
2245
3362
|
if (sortKey !== void 0) {
|
|
2246
3363
|
return sortKey === null ? null : { key: sortKey, dir: sortDir ?? "asc" };
|
|
2247
3364
|
}
|
|
@@ -2258,7 +3375,7 @@ function DataTable({
|
|
|
2258
3375
|
if (page === void 0) setInternalPage(next);
|
|
2259
3376
|
onPageChange?.(next);
|
|
2260
3377
|
};
|
|
2261
|
-
const sorted =
|
|
3378
|
+
const sorted = React43.useMemo(() => {
|
|
2262
3379
|
if (!sort) return data;
|
|
2263
3380
|
const column = columns.find((c) => c.key === sort.key);
|
|
2264
3381
|
if (!column) return data;
|
|
@@ -2273,9 +3390,34 @@ function DataTable({
|
|
|
2273
3390
|
});
|
|
2274
3391
|
return copy;
|
|
2275
3392
|
}, [data, sort, columns]);
|
|
2276
|
-
const
|
|
3393
|
+
const effectiveTotal = total ?? sorted.length;
|
|
3394
|
+
const computedPageCount = pageSize ? Math.max(1, Math.ceil(effectiveTotal / pageSize)) : 0;
|
|
3395
|
+
const pageCount = pageCountProp ?? computedPageCount;
|
|
2277
3396
|
const safePage = Math.min(currentPage, pageCount || 1);
|
|
2278
|
-
const visible = pageSize ? sorted.slice((safePage - 1) * pageSize, safePage * pageSize) : sorted;
|
|
3397
|
+
const visible = manualPagination ? data : pageSize ? sorted.slice((safePage - 1) * pageSize, safePage * pageSize) : sorted;
|
|
3398
|
+
const [internalSelected, setInternalSelected] = React43.useState([]);
|
|
3399
|
+
const selectionEnabled = selectedRowIds !== void 0 || onSelectedRowIdsChange !== void 0;
|
|
3400
|
+
const selectedIds = selectedRowIds ?? internalSelected;
|
|
3401
|
+
const selectedSet = React43.useMemo(() => new Set(selectedIds), [selectedIds]);
|
|
3402
|
+
const selectableVisible = isRowSelectable ? visible.filter(isRowSelectable) : visible;
|
|
3403
|
+
const allSelected = selectableVisible.length > 0 && selectableVisible.every((row) => selectedSet.has(rowId(row)));
|
|
3404
|
+
const someSelected = selectableVisible.some((row) => selectedSet.has(rowId(row)));
|
|
3405
|
+
const commitSelection = (next) => {
|
|
3406
|
+
if (selectedRowIds === void 0) setInternalSelected(next);
|
|
3407
|
+
onSelectedRowIdsChange?.(next);
|
|
3408
|
+
};
|
|
3409
|
+
const toggleAll = () => {
|
|
3410
|
+
if (allSelected) {
|
|
3411
|
+
const visibleIds = new Set(selectableVisible.map((row) => rowId(row)));
|
|
3412
|
+
commitSelection(selectedIds.filter((id) => !visibleIds.has(id)));
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
const merged = /* @__PURE__ */ new Set([...selectedIds, ...selectableVisible.map((row) => rowId(row))]);
|
|
3416
|
+
commitSelection([...merged]);
|
|
3417
|
+
};
|
|
3418
|
+
const toggleRow = (id) => {
|
|
3419
|
+
commitSelection(selectedSet.has(id) ? selectedIds.filter((entry) => entry !== id) : [...selectedIds, id]);
|
|
3420
|
+
};
|
|
2279
3421
|
const cellValue = (row, column, index) => {
|
|
2280
3422
|
if (column.cell) return column.cell(row, index);
|
|
2281
3423
|
const raw = row[column.key];
|
|
@@ -2284,53 +3426,76 @@ function DataTable({
|
|
|
2284
3426
|
return String(raw);
|
|
2285
3427
|
};
|
|
2286
3428
|
const alignClass = (align) => align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left";
|
|
2287
|
-
return /* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
3429
|
+
return /* @__PURE__ */ jsxs26("div", { className: cn("w-full space-y-3", className), children: [
|
|
3430
|
+
selectionEnabled && selectedIds.length > 0 && bulkActions && /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm", children: [
|
|
3431
|
+
/* @__PURE__ */ jsxs26("span", { className: "font-medium", children: [
|
|
3432
|
+
selectedIds.length,
|
|
3433
|
+
" selected"
|
|
3434
|
+
] }),
|
|
3435
|
+
/* @__PURE__ */ jsx43("div", { className: "flex flex-wrap items-center gap-2", children: bulkActions })
|
|
3436
|
+
] }),
|
|
3437
|
+
/* @__PURE__ */ jsx43("div", { className: "w-full overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ jsxs26(
|
|
2289
3438
|
"table",
|
|
2290
3439
|
{
|
|
2291
3440
|
className: cn("w-full caption-bottom", density === "compact" ? "text-xs" : "text-sm"),
|
|
2292
3441
|
children: [
|
|
2293
|
-
caption && /* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
return /* @__PURE__ */ jsx34(
|
|
2298
|
-
"th",
|
|
3442
|
+
caption && /* @__PURE__ */ jsx43("caption", { className: "px-3 py-2 text-left text-xs text-muted-foreground", children: caption }),
|
|
3443
|
+
/* @__PURE__ */ jsx43("thead", { className: cn("bg-muted/50", stickyHeader && "sticky top-0 z-10 bg-background"), children: /* @__PURE__ */ jsxs26("tr", { children: [
|
|
3444
|
+
selectionEnabled && /* @__PURE__ */ jsx43("th", { scope: "col", className: "w-10 border-b border-border px-3 py-2", children: /* @__PURE__ */ jsx43(
|
|
3445
|
+
Checkbox,
|
|
2299
3446
|
{
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
3447
|
+
"aria-label": selectAllLabel,
|
|
3448
|
+
checked: allSelected,
|
|
3449
|
+
ref: (node) => {
|
|
3450
|
+
if (node) node.indeterminate = someSelected && !allSelected;
|
|
3451
|
+
},
|
|
3452
|
+
onCheckedChange: toggleAll
|
|
3453
|
+
}
|
|
3454
|
+
) }),
|
|
3455
|
+
columns.map((column) => {
|
|
3456
|
+
const isSorted = sort?.key === column.key;
|
|
3457
|
+
const ariaSort = !column.sortable ? void 0 : isSorted ? sort.dir === "asc" ? "ascending" : "descending" : "none";
|
|
3458
|
+
return /* @__PURE__ */ jsx43(
|
|
3459
|
+
"th",
|
|
3460
|
+
{
|
|
3461
|
+
scope: "col",
|
|
3462
|
+
"aria-sort": ariaSort,
|
|
3463
|
+
className: cn(
|
|
3464
|
+
"border-b border-border px-3 py-2 font-medium",
|
|
3465
|
+
alignClass(column.align),
|
|
3466
|
+
column.className
|
|
3467
|
+
),
|
|
3468
|
+
children: column.sortable ? /* @__PURE__ */ jsxs26(
|
|
3469
|
+
"button",
|
|
3470
|
+
{
|
|
3471
|
+
type: "button",
|
|
3472
|
+
onClick: () => applySort(column.key),
|
|
3473
|
+
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",
|
|
3474
|
+
children: [
|
|
3475
|
+
column.header,
|
|
3476
|
+
/* @__PURE__ */ jsx43("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" })
|
|
3477
|
+
]
|
|
3478
|
+
}
|
|
3479
|
+
) : column.header
|
|
3480
|
+
},
|
|
3481
|
+
column.key
|
|
3482
|
+
);
|
|
3483
|
+
})
|
|
3484
|
+
] }) }),
|
|
3485
|
+
/* @__PURE__ */ jsx43("tbody", { "aria-busy": loading || void 0, children: loading ? Array.from(
|
|
2324
3486
|
{ length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },
|
|
2325
|
-
(_, skeletonRow) => /* @__PURE__ */
|
|
2326
|
-
|
|
3487
|
+
(_, skeletonRow) => /* @__PURE__ */ jsxs26("tr", { children: [
|
|
3488
|
+
selectionEnabled && /* @__PURE__ */ jsx43("td", { className: cn("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ jsx43(Skeleton, { className: "h-4 w-4" }) }),
|
|
3489
|
+
columns.map((column) => /* @__PURE__ */ jsx43("td", { className: cn("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ jsx43(Skeleton, { className: density === "compact" ? "h-3 w-full" : "h-4 w-full" }) }, column.key))
|
|
3490
|
+
] }, `skeleton-${skeletonRow}`)
|
|
3491
|
+
) : visible.length === 0 ? /* @__PURE__ */ jsx43("tr", { children: /* @__PURE__ */ jsx43(
|
|
2327
3492
|
"td",
|
|
2328
3493
|
{
|
|
2329
|
-
colSpan: columns.length,
|
|
3494
|
+
colSpan: columns.length + (selectionEnabled ? 1 : 0),
|
|
2330
3495
|
className: "px-3 py-8 text-center text-sm text-muted-foreground",
|
|
2331
3496
|
children: emptyMessage
|
|
2332
3497
|
}
|
|
2333
|
-
) }) : visible.map((row, index) => /* @__PURE__ */
|
|
3498
|
+
) }) : visible.map((row, index) => /* @__PURE__ */ jsxs26(
|
|
2334
3499
|
"tr",
|
|
2335
3500
|
{
|
|
2336
3501
|
tabIndex: onRowClick ? 0 : void 0,
|
|
@@ -2346,35 +3511,53 @@ function DataTable({
|
|
|
2346
3511
|
zebra && "[&:nth-child(odd)]:bg-muted/30",
|
|
2347
3512
|
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"
|
|
2348
3513
|
),
|
|
2349
|
-
children:
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
"align-middle",
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
3514
|
+
children: [
|
|
3515
|
+
selectionEnabled && /* @__PURE__ */ jsx43(
|
|
3516
|
+
"td",
|
|
3517
|
+
{
|
|
3518
|
+
className: cn("align-middle", density === "compact" ? "px-2 py-1" : "px-3 py-2"),
|
|
3519
|
+
onClick: (event) => event.stopPropagation(),
|
|
3520
|
+
children: /* @__PURE__ */ jsx43(
|
|
3521
|
+
Checkbox,
|
|
3522
|
+
{
|
|
3523
|
+
"aria-label": `Select row ${rowId(row)}`,
|
|
3524
|
+
checked: selectedSet.has(rowId(row)),
|
|
3525
|
+
disabled: isRowSelectable ? !isRowSelectable(row) : void 0,
|
|
3526
|
+
onCheckedChange: () => toggleRow(rowId(row))
|
|
3527
|
+
}
|
|
3528
|
+
)
|
|
3529
|
+
}
|
|
3530
|
+
),
|
|
3531
|
+
columns.map((column) => /* @__PURE__ */ jsx43(
|
|
3532
|
+
"td",
|
|
3533
|
+
{
|
|
3534
|
+
className: cn(
|
|
3535
|
+
"align-middle",
|
|
3536
|
+
density === "compact" ? "px-2 py-1" : "px-3 py-2",
|
|
3537
|
+
alignClass(column.align),
|
|
3538
|
+
column.className
|
|
3539
|
+
),
|
|
3540
|
+
children: column.onClick ? /* @__PURE__ */ jsx43(
|
|
3541
|
+
"button",
|
|
3542
|
+
{
|
|
3543
|
+
type: "button",
|
|
3544
|
+
onClick: () => column.onClick(row),
|
|
3545
|
+
className: "block w-full rounded px-1.5 py-0.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3546
|
+
children: cellValue(row, column, index)
|
|
3547
|
+
}
|
|
3548
|
+
) : cellValue(row, column, index)
|
|
3549
|
+
},
|
|
3550
|
+
column.key
|
|
3551
|
+
))
|
|
3552
|
+
]
|
|
2370
3553
|
},
|
|
2371
3554
|
rowId(row)
|
|
2372
3555
|
)) })
|
|
2373
3556
|
]
|
|
2374
3557
|
}
|
|
2375
3558
|
) }),
|
|
2376
|
-
pageSize && pageCount > 1 && /* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
3559
|
+
pageSize && pageCount > 1 && /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [
|
|
3560
|
+
/* @__PURE__ */ jsxs26(
|
|
2378
3561
|
"p",
|
|
2379
3562
|
{
|
|
2380
3563
|
className: "min-h-8 leading-none text-xs text-muted-foreground",
|
|
@@ -2382,23 +3565,23 @@ function DataTable({
|
|
|
2382
3565
|
children: [
|
|
2383
3566
|
(safePage - 1) * pageSize + 1,
|
|
2384
3567
|
"\u2013",
|
|
2385
|
-
Math.min(safePage * pageSize,
|
|
3568
|
+
Math.min(safePage * pageSize, effectiveTotal),
|
|
2386
3569
|
" of",
|
|
2387
3570
|
" ",
|
|
2388
|
-
|
|
3571
|
+
effectiveTotal
|
|
2389
3572
|
]
|
|
2390
3573
|
}
|
|
2391
3574
|
),
|
|
2392
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ jsx43(Pagination, { page: safePage, pageCount, onPageChange: setPage })
|
|
2393
3576
|
] })
|
|
2394
3577
|
] });
|
|
2395
3578
|
}
|
|
2396
3579
|
|
|
2397
3580
|
// src/components/list/List.tsx
|
|
2398
|
-
import * as
|
|
2399
|
-
import { Fragment as
|
|
2400
|
-
var List =
|
|
2401
|
-
({ divided, bordered, size = "default", className, ...props }, ref) => /* @__PURE__ */
|
|
3581
|
+
import * as React44 from "react";
|
|
3582
|
+
import { Fragment as Fragment7, jsx as jsx44, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3583
|
+
var List = React44.forwardRef(
|
|
3584
|
+
({ divided, bordered, size = "default", className, ...props }, ref) => /* @__PURE__ */ jsx44(
|
|
2402
3585
|
"ul",
|
|
2403
3586
|
{
|
|
2404
3587
|
ref,
|
|
@@ -2414,7 +3597,7 @@ var List = React36.forwardRef(
|
|
|
2414
3597
|
)
|
|
2415
3598
|
);
|
|
2416
3599
|
List.displayName = "List";
|
|
2417
|
-
var ListItem =
|
|
3600
|
+
var ListItem = React44.forwardRef(
|
|
2418
3601
|
({ leading, trailing, selected, onClick, description, disabled, className, children, ...props }, ref) => {
|
|
2419
3602
|
const padding = "px-3 py-2.5";
|
|
2420
3603
|
const rowClass = cn(
|
|
@@ -2424,23 +3607,77 @@ var ListItem = React36.forwardRef(
|
|
|
2424
3607
|
disabled && "opacity-50",
|
|
2425
3608
|
className
|
|
2426
3609
|
);
|
|
2427
|
-
const body = /* @__PURE__ */
|
|
2428
|
-
leading && /* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2431
|
-
description && /* @__PURE__ */
|
|
2432
|
-
] }),
|
|
2433
|
-
trailing && /* @__PURE__ */
|
|
2434
|
-
] });
|
|
2435
|
-
return /* @__PURE__ */
|
|
3610
|
+
const body = /* @__PURE__ */ jsxs27(Fragment7, { children: [
|
|
3611
|
+
leading && /* @__PURE__ */ jsx44("span", { className: "flex shrink-0 items-center", children: leading }),
|
|
3612
|
+
/* @__PURE__ */ jsxs27("span", { className: "min-w-0 flex-1", children: [
|
|
3613
|
+
/* @__PURE__ */ jsx44("span", { className: "block truncate", children }),
|
|
3614
|
+
description && /* @__PURE__ */ jsx44("span", { className: "mt-0.5 block truncate text-xs text-muted-foreground", children: description })
|
|
3615
|
+
] }),
|
|
3616
|
+
trailing && /* @__PURE__ */ jsx44("span", { className: "flex shrink-0 items-center text-xs text-muted-foreground", children: trailing })
|
|
3617
|
+
] });
|
|
3618
|
+
return /* @__PURE__ */ jsx44("li", { ref, ...props, children: onClick ? /* @__PURE__ */ jsx44("button", { type: "button", onClick, disabled, className: cn(padding, rowClass), children: body }) : /* @__PURE__ */ jsx44("div", { className: cn(padding, rowClass), children: body }) });
|
|
3619
|
+
}
|
|
3620
|
+
);
|
|
3621
|
+
ListItem.displayName = "ListItem";
|
|
3622
|
+
|
|
3623
|
+
// src/components/link/Link.tsx
|
|
3624
|
+
import * as React45 from "react";
|
|
3625
|
+
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
3626
|
+
import { cva as cva6 } from "class-variance-authority";
|
|
3627
|
+
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3628
|
+
var linkVariants = cva6("inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm", {
|
|
3629
|
+
variants: {
|
|
3630
|
+
variant: {
|
|
3631
|
+
default: "text-primary hover:underline underline-offset-4",
|
|
3632
|
+
muted: "text-muted-foreground hover:text-foreground",
|
|
3633
|
+
underline: "underline underline-offset-4 hover:text-primary",
|
|
3634
|
+
arrow: "font-medium text-primary hover:underline underline-offset-4",
|
|
3635
|
+
external: "text-primary hover:underline underline-offset-4"
|
|
3636
|
+
}
|
|
3637
|
+
},
|
|
3638
|
+
defaultVariants: { variant: "default" }
|
|
3639
|
+
});
|
|
3640
|
+
var ABSOLUTE = /^https?:\/\//i;
|
|
3641
|
+
var Link = React45.forwardRef(function Link2({ className, variant, asChild = false, external, target, rel, children, ...props }, ref) {
|
|
3642
|
+
const isAbsolute = typeof props.href === "string" && ABSOLUTE.test(props.href);
|
|
3643
|
+
const isExternal = external ?? isAbsolute;
|
|
3644
|
+
const Comp = asChild ? Slot4 : "a";
|
|
3645
|
+
if (asChild) {
|
|
3646
|
+
return /* @__PURE__ */ jsx45(
|
|
3647
|
+
Comp,
|
|
3648
|
+
{
|
|
3649
|
+
ref,
|
|
3650
|
+
className: cn(linkVariants({ variant }), className),
|
|
3651
|
+
target: isExternal ? target ?? "_blank" : target,
|
|
3652
|
+
rel: isExternal ? rel ?? "noopener noreferrer" : rel,
|
|
3653
|
+
...props,
|
|
3654
|
+
children
|
|
3655
|
+
}
|
|
3656
|
+
);
|
|
2436
3657
|
}
|
|
2437
|
-
|
|
2438
|
-
|
|
3658
|
+
return /* @__PURE__ */ jsxs28(
|
|
3659
|
+
Comp,
|
|
3660
|
+
{
|
|
3661
|
+
ref,
|
|
3662
|
+
className: cn(linkVariants({ variant }), className),
|
|
3663
|
+
target: isExternal ? target ?? "_blank" : target,
|
|
3664
|
+
rel: isExternal ? rel ?? "noopener noreferrer" : rel,
|
|
3665
|
+
...props,
|
|
3666
|
+
children: [
|
|
3667
|
+
children,
|
|
3668
|
+
isExternal && variant !== "muted" && /* @__PURE__ */ jsxs28(Fragment8, { children: [
|
|
3669
|
+
/* @__PURE__ */ jsx45("span", { "aria-hidden": "true", className: "text-[0.75em]", children: "\u2197" }),
|
|
3670
|
+
/* @__PURE__ */ jsx45("span", { className: "sr-only", children: "(opens in a new tab)" })
|
|
3671
|
+
] })
|
|
3672
|
+
]
|
|
3673
|
+
}
|
|
3674
|
+
);
|
|
3675
|
+
});
|
|
2439
3676
|
|
|
2440
3677
|
// src/components/text/Text.tsx
|
|
2441
|
-
import * as
|
|
2442
|
-
import { jsx as
|
|
2443
|
-
var
|
|
3678
|
+
import * as React46 from "react";
|
|
3679
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3680
|
+
var sizeClasses4 = {
|
|
2444
3681
|
xs: "text-xs",
|
|
2445
3682
|
sm: "text-sm",
|
|
2446
3683
|
base: "text-base",
|
|
@@ -2453,15 +3690,15 @@ var weightClasses = {
|
|
|
2453
3690
|
semibold: "font-semibold",
|
|
2454
3691
|
bold: "font-bold"
|
|
2455
3692
|
};
|
|
2456
|
-
var Text =
|
|
3693
|
+
var Text = React46.forwardRef(
|
|
2457
3694
|
({ inline, size = "base", weight, muted, className, ...props }, ref) => {
|
|
2458
3695
|
const Tag = inline ? "span" : "p";
|
|
2459
|
-
return /* @__PURE__ */
|
|
3696
|
+
return /* @__PURE__ */ jsx46(
|
|
2460
3697
|
Tag,
|
|
2461
3698
|
{
|
|
2462
3699
|
ref,
|
|
2463
3700
|
className: cn(
|
|
2464
|
-
|
|
3701
|
+
sizeClasses4[size],
|
|
2465
3702
|
weight && weightClasses[weight],
|
|
2466
3703
|
muted && "text-muted-foreground",
|
|
2467
3704
|
inline ? "inline" : "block",
|
|
@@ -2475,8 +3712,8 @@ var Text = React37.forwardRef(
|
|
|
2475
3712
|
Text.displayName = "Text";
|
|
2476
3713
|
|
|
2477
3714
|
// src/components/heading/Heading.tsx
|
|
2478
|
-
import * as
|
|
2479
|
-
import { jsx as
|
|
3715
|
+
import * as React47 from "react";
|
|
3716
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
2480
3717
|
var levelClasses = {
|
|
2481
3718
|
1: "text-4xl",
|
|
2482
3719
|
2: "text-3xl",
|
|
@@ -2485,7 +3722,7 @@ var levelClasses = {
|
|
|
2485
3722
|
5: "text-lg",
|
|
2486
3723
|
6: "text-base"
|
|
2487
3724
|
};
|
|
2488
|
-
var
|
|
3725
|
+
var sizeClasses5 = {
|
|
2489
3726
|
sm: "text-lg",
|
|
2490
3727
|
md: "text-xl",
|
|
2491
3728
|
lg: "text-2xl",
|
|
@@ -2493,16 +3730,16 @@ var sizeClasses3 = {
|
|
|
2493
3730
|
"2xl": "text-4xl",
|
|
2494
3731
|
"3xl": "text-5xl"
|
|
2495
3732
|
};
|
|
2496
|
-
var Heading =
|
|
3733
|
+
var Heading = React47.forwardRef(
|
|
2497
3734
|
({ level, size, muted, className, ...props }, ref) => {
|
|
2498
3735
|
const Tag = `h${level}`;
|
|
2499
|
-
return /* @__PURE__ */
|
|
3736
|
+
return /* @__PURE__ */ jsx47(
|
|
2500
3737
|
Tag,
|
|
2501
3738
|
{
|
|
2502
3739
|
ref,
|
|
2503
3740
|
className: cn(
|
|
2504
3741
|
"font-semibold tracking-tight",
|
|
2505
|
-
size ?
|
|
3742
|
+
size ? sizeClasses5[size] : levelClasses[level],
|
|
2506
3743
|
muted && "text-muted-foreground",
|
|
2507
3744
|
className
|
|
2508
3745
|
),
|
|
@@ -2513,13 +3750,487 @@ var Heading = React38.forwardRef(
|
|
|
2513
3750
|
);
|
|
2514
3751
|
Heading.displayName = "Heading";
|
|
2515
3752
|
|
|
3753
|
+
// src/components/empty-state/EmptyState.tsx
|
|
3754
|
+
import * as React48 from "react";
|
|
3755
|
+
import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3756
|
+
var EmptyState = React48.forwardRef(function EmptyState2({ icon, title, description, action, secondaryAction, size = "md", className, children, ...props }, ref) {
|
|
3757
|
+
return /* @__PURE__ */ jsxs29(
|
|
3758
|
+
"div",
|
|
3759
|
+
{
|
|
3760
|
+
ref,
|
|
3761
|
+
className: cn(
|
|
3762
|
+
"flex flex-col items-center justify-center rounded-lg border border-dashed border-border text-center",
|
|
3763
|
+
size === "md" ? "gap-3 px-6 py-12" : "gap-2 px-4 py-6",
|
|
3764
|
+
className
|
|
3765
|
+
),
|
|
3766
|
+
...props,
|
|
3767
|
+
children: [
|
|
3768
|
+
icon && /* @__PURE__ */ jsx48("div", { className: "text-muted-foreground [&_svg]:size-8", children: icon }),
|
|
3769
|
+
/* @__PURE__ */ jsx48("p", { className: cn("font-semibold", size === "md" ? "text-base" : "text-sm"), children: title }),
|
|
3770
|
+
description && /* @__PURE__ */ jsx48("p", { className: "max-w-sm text-sm text-muted-foreground", children: description }),
|
|
3771
|
+
children,
|
|
3772
|
+
(action || secondaryAction) && /* @__PURE__ */ jsxs29("div", { className: "mt-1 flex flex-wrap items-center justify-center gap-2", children: [
|
|
3773
|
+
action,
|
|
3774
|
+
secondaryAction
|
|
3775
|
+
] })
|
|
3776
|
+
]
|
|
3777
|
+
}
|
|
3778
|
+
);
|
|
3779
|
+
});
|
|
3780
|
+
|
|
3781
|
+
// src/components/page-header/PageHeader.tsx
|
|
3782
|
+
import * as React49 from "react";
|
|
3783
|
+
import { jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3784
|
+
var sizeClasses6 = {
|
|
3785
|
+
sm: "text-xl",
|
|
3786
|
+
md: "text-2xl",
|
|
3787
|
+
lg: "text-3xl",
|
|
3788
|
+
hero: "text-4xl sm:text-5xl lg:text-[3.4rem] lg:leading-[1.1]"
|
|
3789
|
+
};
|
|
3790
|
+
var PageHeader = React49.forwardRef(function PageHeader2({ title, description, breadcrumbs, actions, eyebrow, size = "md", align = "left", className, children, ...props }, ref) {
|
|
3791
|
+
return /* @__PURE__ */ jsxs30("div", { ref, className: cn("flex flex-col gap-2", align === "center" && "items-center text-center", className), ...props, children: [
|
|
3792
|
+
breadcrumbs && /* @__PURE__ */ jsx49("div", { className: "text-sm text-muted-foreground", children: breadcrumbs }),
|
|
3793
|
+
eyebrow && /* @__PURE__ */ jsx49("p", { className: "text-xs font-medium uppercase tracking-wide text-primary", children: eyebrow }),
|
|
3794
|
+
/* @__PURE__ */ jsxs30("div", { className: cn("flex w-full flex-wrap items-start justify-between gap-3", align === "center" && "justify-center"), children: [
|
|
3795
|
+
/* @__PURE__ */ jsxs30("div", { className: cn("min-w-0", align === "center" && "flex flex-col items-center"), children: [
|
|
3796
|
+
/* @__PURE__ */ jsx49("h1", { className: cn("font-semibold tracking-tight", sizeClasses6[size]), children: title }),
|
|
3797
|
+
description && /* @__PURE__ */ jsx49("p", { className: "mt-2 max-w-2xl text-base text-muted-foreground", children: description })
|
|
3798
|
+
] }),
|
|
3799
|
+
actions && /* @__PURE__ */ jsx49("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
3800
|
+
] }),
|
|
3801
|
+
children && /* @__PURE__ */ jsx49("div", { className: "mt-2", children })
|
|
3802
|
+
] });
|
|
3803
|
+
});
|
|
3804
|
+
|
|
3805
|
+
// src/components/section-heading/SectionHeading.tsx
|
|
3806
|
+
import * as React50 from "react";
|
|
3807
|
+
import { jsx as jsx50, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3808
|
+
var sizeClasses7 = {
|
|
3809
|
+
sm: "text-lg",
|
|
3810
|
+
md: "text-2xl",
|
|
3811
|
+
lg: "text-3xl"
|
|
3812
|
+
};
|
|
3813
|
+
var SectionHeading = React50.forwardRef(function SectionHeading2({ title, description, eyebrow, actions, level = 2, align = "left", size = "md", className, ...props }, ref) {
|
|
3814
|
+
const Heading2 = `h${level}`;
|
|
3815
|
+
return /* @__PURE__ */ jsxs31(
|
|
3816
|
+
"div",
|
|
3817
|
+
{
|
|
3818
|
+
ref,
|
|
3819
|
+
className: cn(
|
|
3820
|
+
"flex flex-col gap-2",
|
|
3821
|
+
align === "center" ? "items-center text-center" : "sm:flex-row sm:items-end sm:justify-between",
|
|
3822
|
+
className
|
|
3823
|
+
),
|
|
3824
|
+
...props,
|
|
3825
|
+
children: [
|
|
3826
|
+
/* @__PURE__ */ jsxs31("div", { className: cn("min-w-0", align === "center" && "flex flex-col items-center"), children: [
|
|
3827
|
+
eyebrow && /* @__PURE__ */ jsx50("p", { className: "mb-1 text-xs font-medium uppercase tracking-wide text-primary", children: eyebrow }),
|
|
3828
|
+
/* @__PURE__ */ jsx50(Heading2, { className: cn("font-semibold tracking-tight", sizeClasses7[size]), children: title }),
|
|
3829
|
+
description && /* @__PURE__ */ jsx50("p", { className: cn("mt-2 max-w-2xl text-muted-foreground", align === "center" ? "mx-auto" : ""), children: description })
|
|
3830
|
+
] }),
|
|
3831
|
+
actions && /* @__PURE__ */ jsx50("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
3832
|
+
]
|
|
3833
|
+
}
|
|
3834
|
+
);
|
|
3835
|
+
});
|
|
3836
|
+
|
|
3837
|
+
// src/components/metric-card/MetricCard.tsx
|
|
3838
|
+
import * as React51 from "react";
|
|
3839
|
+
import { jsx as jsx51, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3840
|
+
var trendClasses = {
|
|
3841
|
+
up: "text-success",
|
|
3842
|
+
down: "text-destructive",
|
|
3843
|
+
flat: "text-muted-foreground"
|
|
3844
|
+
};
|
|
3845
|
+
var trendGlyph = { up: "\u2191", down: "\u2193", flat: "\u2192" };
|
|
3846
|
+
var MetricCard = React51.forwardRef(function MetricCard2({ label, value, hint, delta, trend = "flat", icon, className, ...props }, ref) {
|
|
3847
|
+
return /* @__PURE__ */ jsxs32("div", { ref, className: cn("rounded-xl border border-border bg-card p-5", className), ...props, children: [
|
|
3848
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-start justify-between gap-3", children: [
|
|
3849
|
+
/* @__PURE__ */ jsx51("p", { className: "text-sm text-muted-foreground", children: label }),
|
|
3850
|
+
icon && /* @__PURE__ */ jsx51("span", { className: "text-muted-foreground [&_svg]:size-4", children: icon })
|
|
3851
|
+
] }),
|
|
3852
|
+
/* @__PURE__ */ jsx51("p", { className: "mt-2 text-2xl font-semibold tabular-nums", children: value }),
|
|
3853
|
+
(delta || hint) && /* @__PURE__ */ jsxs32("p", { className: "mt-1 flex items-center gap-2 text-sm", children: [
|
|
3854
|
+
delta && /* @__PURE__ */ jsxs32("span", { className: cn("font-medium tabular-nums", trendClasses[trend]), children: [
|
|
3855
|
+
/* @__PURE__ */ jsx51("span", { "aria-hidden": "true", children: trendGlyph[trend] }),
|
|
3856
|
+
" ",
|
|
3857
|
+
delta
|
|
3858
|
+
] }),
|
|
3859
|
+
hint && /* @__PURE__ */ jsx51("span", { className: "text-muted-foreground", children: hint })
|
|
3860
|
+
] })
|
|
3861
|
+
] });
|
|
3862
|
+
});
|
|
3863
|
+
|
|
3864
|
+
// src/components/password-input/PasswordInput.tsx
|
|
3865
|
+
import * as React52 from "react";
|
|
3866
|
+
import { jsx as jsx52, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3867
|
+
var PasswordInput = React52.forwardRef(function PasswordInput2({ className, showLabel = "Show password", hideLabel = "Hide password", ...props }, ref) {
|
|
3868
|
+
const [visible, setVisible] = React52.useState(false);
|
|
3869
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("relative flex items-center", className), children: [
|
|
3870
|
+
/* @__PURE__ */ jsx52(Input, { ref, type: visible ? "text" : "password", className: "pr-24", ...props }),
|
|
3871
|
+
/* @__PURE__ */ jsx52(
|
|
3872
|
+
Button,
|
|
3873
|
+
{
|
|
3874
|
+
type: "button",
|
|
3875
|
+
variant: "ghost",
|
|
3876
|
+
size: "sm",
|
|
3877
|
+
"aria-pressed": visible,
|
|
3878
|
+
"aria-label": visible ? hideLabel : showLabel,
|
|
3879
|
+
onClick: () => setVisible((current) => !current),
|
|
3880
|
+
className: "absolute right-1 h-8 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
3881
|
+
children: visible ? "Hide" : "Show"
|
|
3882
|
+
}
|
|
3883
|
+
)
|
|
3884
|
+
] });
|
|
3885
|
+
});
|
|
3886
|
+
|
|
3887
|
+
// src/components/auth-layout/AuthLayout.tsx
|
|
3888
|
+
import * as React53 from "react";
|
|
3889
|
+
import { jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3890
|
+
var sizeClasses8 = {
|
|
3891
|
+
sm: "max-w-sm",
|
|
3892
|
+
md: "max-w-md",
|
|
3893
|
+
lg: "max-w-lg"
|
|
3894
|
+
};
|
|
3895
|
+
var AuthLayout = React53.forwardRef(function AuthLayout2({ title, description, brand, footer, children, size = "md", className, ...props }, ref) {
|
|
3896
|
+
return /* @__PURE__ */ jsxs34(
|
|
3897
|
+
"div",
|
|
3898
|
+
{
|
|
3899
|
+
ref,
|
|
3900
|
+
className: cn("flex min-h-screen flex-col items-center justify-center bg-muted/30 px-4 py-12", className),
|
|
3901
|
+
...props,
|
|
3902
|
+
children: [
|
|
3903
|
+
brand && /* @__PURE__ */ jsx53("div", { className: "mb-6", children: brand }),
|
|
3904
|
+
/* @__PURE__ */ jsxs34("div", { className: cn("w-full rounded-xl border border-border bg-card p-6 shadow-sm sm:p-8", sizeClasses8[size]), children: [
|
|
3905
|
+
/* @__PURE__ */ jsx53("h1", { className: "text-xl font-semibold tracking-tight", children: title }),
|
|
3906
|
+
description && /* @__PURE__ */ jsx53("p", { className: "mt-1 text-sm text-muted-foreground", children: description }),
|
|
3907
|
+
/* @__PURE__ */ jsx53("div", { className: "mt-6", children })
|
|
3908
|
+
] }),
|
|
3909
|
+
footer && /* @__PURE__ */ jsx53("div", { className: "mt-6 text-center text-sm text-muted-foreground", children: footer })
|
|
3910
|
+
]
|
|
3911
|
+
}
|
|
3912
|
+
);
|
|
3913
|
+
});
|
|
3914
|
+
|
|
3915
|
+
// src/components/filter-bar/FilterBar.tsx
|
|
3916
|
+
import * as React54 from "react";
|
|
3917
|
+
import { jsx as jsx54, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3918
|
+
var FilterBar = React54.forwardRef(function FilterBar2({
|
|
3919
|
+
searchValue,
|
|
3920
|
+
onSearchChange,
|
|
3921
|
+
searchPlaceholder = "Search\u2026",
|
|
3922
|
+
onReset,
|
|
3923
|
+
activeCount = 0,
|
|
3924
|
+
trailing,
|
|
3925
|
+
className,
|
|
3926
|
+
children,
|
|
3927
|
+
...props
|
|
3928
|
+
}, ref) {
|
|
3929
|
+
return /* @__PURE__ */ jsxs35(
|
|
3930
|
+
"div",
|
|
3931
|
+
{
|
|
3932
|
+
ref,
|
|
3933
|
+
role: "search",
|
|
3934
|
+
className: cn(
|
|
3935
|
+
"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-card p-2",
|
|
3936
|
+
className
|
|
3937
|
+
),
|
|
3938
|
+
...props,
|
|
3939
|
+
children: [
|
|
3940
|
+
onSearchChange !== void 0 && /* @__PURE__ */ jsx54(
|
|
3941
|
+
Input,
|
|
3942
|
+
{
|
|
3943
|
+
type: "search",
|
|
3944
|
+
value: searchValue,
|
|
3945
|
+
onChange: (event) => onSearchChange(event.target.value),
|
|
3946
|
+
placeholder: searchPlaceholder,
|
|
3947
|
+
"aria-label": searchPlaceholder,
|
|
3948
|
+
className: "h-9 w-full min-w-40 flex-1 sm:w-auto"
|
|
3949
|
+
}
|
|
3950
|
+
),
|
|
3951
|
+
/* @__PURE__ */ jsx54("div", { className: "flex flex-wrap items-center gap-2", children }),
|
|
3952
|
+
onReset && /* @__PURE__ */ jsxs35(Button, { type: "button", variant: "ghost", size: "sm", onClick: onReset, children: [
|
|
3953
|
+
"Reset",
|
|
3954
|
+
activeCount > 0 ? ` (${activeCount})` : ""
|
|
3955
|
+
] }),
|
|
3956
|
+
trailing && /* @__PURE__ */ jsx54("div", { className: "ml-auto flex items-center gap-2", children: trailing })
|
|
3957
|
+
]
|
|
3958
|
+
}
|
|
3959
|
+
);
|
|
3960
|
+
});
|
|
3961
|
+
|
|
3962
|
+
// src/components/date-picker/DatePicker.tsx
|
|
3963
|
+
import * as React55 from "react";
|
|
3964
|
+
import { jsx as jsx55, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3965
|
+
var DatePicker = React55.forwardRef(function DatePicker2({ value, defaultValue, onValueChange, clearable = false, className, ...props }, ref) {
|
|
3966
|
+
const [internal, setInternal] = React55.useState(defaultValue ?? "");
|
|
3967
|
+
const current = value ?? internal;
|
|
3968
|
+
const commit = (next) => {
|
|
3969
|
+
if (value === void 0) setInternal(next);
|
|
3970
|
+
onValueChange?.(next);
|
|
3971
|
+
};
|
|
3972
|
+
return /* @__PURE__ */ jsxs36("div", { className: cn("relative flex items-center", className), children: [
|
|
3973
|
+
/* @__PURE__ */ jsx55(
|
|
3974
|
+
Input,
|
|
3975
|
+
{
|
|
3976
|
+
ref,
|
|
3977
|
+
type: "date",
|
|
3978
|
+
value: current,
|
|
3979
|
+
onChange: (event) => commit(event.target.value),
|
|
3980
|
+
className: clearable && current ? "pr-9" : void 0,
|
|
3981
|
+
...props
|
|
3982
|
+
}
|
|
3983
|
+
),
|
|
3984
|
+
clearable && current && /* @__PURE__ */ jsx55(
|
|
3985
|
+
"button",
|
|
3986
|
+
{
|
|
3987
|
+
type: "button",
|
|
3988
|
+
onClick: () => commit(""),
|
|
3989
|
+
"aria-label": "Clear date",
|
|
3990
|
+
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",
|
|
3991
|
+
children: "\u2715"
|
|
3992
|
+
}
|
|
3993
|
+
)
|
|
3994
|
+
] });
|
|
3995
|
+
});
|
|
3996
|
+
|
|
3997
|
+
// src/components/time-picker/TimePicker.tsx
|
|
3998
|
+
import * as React56 from "react";
|
|
3999
|
+
import { jsx as jsx56, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4000
|
+
var TimePicker = React56.forwardRef(function TimePicker2({ value, defaultValue, onValueChange, clearable = false, className, ...props }, ref) {
|
|
4001
|
+
const [internal, setInternal] = React56.useState(defaultValue ?? "");
|
|
4002
|
+
const current = value ?? internal;
|
|
4003
|
+
const commit = (next) => {
|
|
4004
|
+
if (value === void 0) setInternal(next);
|
|
4005
|
+
onValueChange?.(next);
|
|
4006
|
+
};
|
|
4007
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn("relative flex items-center", className), children: [
|
|
4008
|
+
/* @__PURE__ */ jsx56(
|
|
4009
|
+
Input,
|
|
4010
|
+
{
|
|
4011
|
+
ref,
|
|
4012
|
+
type: "time",
|
|
4013
|
+
value: current,
|
|
4014
|
+
onChange: (event) => commit(event.target.value),
|
|
4015
|
+
className: clearable && current ? "pr-9" : void 0,
|
|
4016
|
+
...props
|
|
4017
|
+
}
|
|
4018
|
+
),
|
|
4019
|
+
clearable && current && /* @__PURE__ */ jsx56(
|
|
4020
|
+
"button",
|
|
4021
|
+
{
|
|
4022
|
+
type: "button",
|
|
4023
|
+
onClick: () => commit(""),
|
|
4024
|
+
"aria-label": "Clear time",
|
|
4025
|
+
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",
|
|
4026
|
+
children: "\u2715"
|
|
4027
|
+
}
|
|
4028
|
+
)
|
|
4029
|
+
] });
|
|
4030
|
+
});
|
|
4031
|
+
|
|
4032
|
+
// src/components/stepper/Stepper.tsx
|
|
4033
|
+
import * as React57 from "react";
|
|
4034
|
+
import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4035
|
+
var Stepper = React57.forwardRef(function Stepper2({ steps, current, orientation = "horizontal", onStepClick, className, ...props }, ref) {
|
|
4036
|
+
return /* @__PURE__ */ jsx57(
|
|
4037
|
+
"ol",
|
|
4038
|
+
{
|
|
4039
|
+
ref,
|
|
4040
|
+
className: cn(
|
|
4041
|
+
"flex gap-4",
|
|
4042
|
+
orientation === "vertical" ? "flex-col" : "flex-wrap items-start",
|
|
4043
|
+
className
|
|
4044
|
+
),
|
|
4045
|
+
...props,
|
|
4046
|
+
children: steps.map((step, index) => {
|
|
4047
|
+
const state = index < current ? "complete" : index === current ? "current" : "upcoming";
|
|
4048
|
+
const interactive = Boolean(onStepClick);
|
|
4049
|
+
const content = /* @__PURE__ */ jsxs38(Fragment9, { children: [
|
|
4050
|
+
/* @__PURE__ */ jsx57(
|
|
4051
|
+
"span",
|
|
4052
|
+
{
|
|
4053
|
+
"aria-hidden": "true",
|
|
4054
|
+
className: cn(
|
|
4055
|
+
"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium",
|
|
4056
|
+
state === "complete" && "border-primary bg-primary text-primary-foreground",
|
|
4057
|
+
state === "current" && "border-primary text-primary",
|
|
4058
|
+
state === "upcoming" && "border-border text-muted-foreground"
|
|
4059
|
+
),
|
|
4060
|
+
children: state === "complete" ? "\u2713" : index + 1
|
|
4061
|
+
}
|
|
4062
|
+
),
|
|
4063
|
+
/* @__PURE__ */ jsxs38("span", { className: "min-w-0", children: [
|
|
4064
|
+
/* @__PURE__ */ jsx57("span", { className: cn("block text-sm", state === "upcoming" ? "text-muted-foreground" : "font-medium"), children: step.label }),
|
|
4065
|
+
step.description && /* @__PURE__ */ jsx57("span", { className: "block text-xs text-muted-foreground", children: step.description }),
|
|
4066
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: state === "complete" ? " (completed)" : state === "current" ? " (current step)" : " (upcoming)" })
|
|
4067
|
+
] })
|
|
4068
|
+
] });
|
|
4069
|
+
return /* @__PURE__ */ jsxs38("li", { className: "flex min-w-0 items-start gap-2", children: [
|
|
4070
|
+
interactive ? /* @__PURE__ */ jsx57(
|
|
4071
|
+
"button",
|
|
4072
|
+
{
|
|
4073
|
+
type: "button",
|
|
4074
|
+
onClick: () => onStepClick?.(index),
|
|
4075
|
+
"aria-current": state === "current" ? "step" : void 0,
|
|
4076
|
+
className: "flex items-start gap-2 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
4077
|
+
children: content
|
|
4078
|
+
}
|
|
4079
|
+
) : /* @__PURE__ */ jsx57("div", { "aria-current": state === "current" ? "step" : void 0, className: "flex items-start gap-2", children: content }),
|
|
4080
|
+
orientation === "horizontal" && index < steps.length - 1 && /* @__PURE__ */ jsx57("span", { "aria-hidden": "true", className: "mt-3.5 hidden h-px w-8 bg-border sm:block" })
|
|
4081
|
+
] }, step.label);
|
|
4082
|
+
})
|
|
4083
|
+
}
|
|
4084
|
+
);
|
|
4085
|
+
});
|
|
4086
|
+
|
|
4087
|
+
// src/components/file-upload/FileUpload.tsx
|
|
4088
|
+
import * as React58 from "react";
|
|
4089
|
+
import { jsx as jsx58, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4090
|
+
function formatSize(bytes) {
|
|
4091
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
4092
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
4093
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
4094
|
+
}
|
|
4095
|
+
var FileUpload = React58.forwardRef(function FileUpload2({
|
|
4096
|
+
files,
|
|
4097
|
+
defaultFiles,
|
|
4098
|
+
onFilesChange,
|
|
4099
|
+
label = "Drop files here or click to browse",
|
|
4100
|
+
hint,
|
|
4101
|
+
progress,
|
|
4102
|
+
multiple = true,
|
|
4103
|
+
accept,
|
|
4104
|
+
disabled,
|
|
4105
|
+
className,
|
|
4106
|
+
id,
|
|
4107
|
+
...props
|
|
4108
|
+
}, ref) {
|
|
4109
|
+
const [internal, setInternal] = React58.useState(defaultFiles ?? []);
|
|
4110
|
+
const [dragging, setDragging] = React58.useState(false);
|
|
4111
|
+
const current = files ?? internal;
|
|
4112
|
+
const generatedId = React58.useId();
|
|
4113
|
+
const inputId = id ?? generatedId;
|
|
4114
|
+
const commit = (next) => {
|
|
4115
|
+
if (files === void 0) setInternal(next);
|
|
4116
|
+
onFilesChange?.(next);
|
|
4117
|
+
};
|
|
4118
|
+
const add = (incoming) => {
|
|
4119
|
+
if (!incoming || incoming.length === 0) return;
|
|
4120
|
+
const list = Array.from(incoming);
|
|
4121
|
+
commit(multiple ? [...current, ...list] : list.slice(0, 1));
|
|
4122
|
+
};
|
|
4123
|
+
return /* @__PURE__ */ jsxs39("div", { className: cn("flex flex-col gap-3", className), children: [
|
|
4124
|
+
/* @__PURE__ */ jsxs39(
|
|
4125
|
+
"div",
|
|
4126
|
+
{
|
|
4127
|
+
onDragOver: (event) => {
|
|
4128
|
+
if (disabled) return;
|
|
4129
|
+
event.preventDefault();
|
|
4130
|
+
setDragging(true);
|
|
4131
|
+
},
|
|
4132
|
+
onDragLeave: () => setDragging(false),
|
|
4133
|
+
onDrop: (event) => {
|
|
4134
|
+
if (disabled) return;
|
|
4135
|
+
event.preventDefault();
|
|
4136
|
+
setDragging(false);
|
|
4137
|
+
add(event.dataTransfer.files);
|
|
4138
|
+
},
|
|
4139
|
+
className: cn(
|
|
4140
|
+
"rounded-lg border border-dashed border-border p-6 text-center transition-colors",
|
|
4141
|
+
dragging && "border-primary bg-primary/5",
|
|
4142
|
+
disabled && "opacity-50"
|
|
4143
|
+
),
|
|
4144
|
+
children: [
|
|
4145
|
+
/* @__PURE__ */ jsxs39("label", { htmlFor: inputId, className: cn("block text-sm", disabled ? "cursor-not-allowed" : "cursor-pointer"), children: [
|
|
4146
|
+
label,
|
|
4147
|
+
/* @__PURE__ */ jsx58(
|
|
4148
|
+
"input",
|
|
4149
|
+
{
|
|
4150
|
+
ref,
|
|
4151
|
+
id: inputId,
|
|
4152
|
+
type: "file",
|
|
4153
|
+
multiple,
|
|
4154
|
+
accept,
|
|
4155
|
+
disabled,
|
|
4156
|
+
className: "sr-only",
|
|
4157
|
+
onChange: (event) => {
|
|
4158
|
+
add(event.target.files);
|
|
4159
|
+
event.target.value = "";
|
|
4160
|
+
},
|
|
4161
|
+
...props
|
|
4162
|
+
}
|
|
4163
|
+
)
|
|
4164
|
+
] }),
|
|
4165
|
+
/* @__PURE__ */ jsx58("p", { className: "mt-1 text-xs text-muted-foreground", children: hint ?? (accept ? `Accepted: ${accept}` : "Any file type") })
|
|
4166
|
+
]
|
|
4167
|
+
}
|
|
4168
|
+
),
|
|
4169
|
+
current.length > 0 && /* @__PURE__ */ jsx58("ul", { "aria-label": "Selected files", className: "space-y-2", children: current.map((file) => /* @__PURE__ */ jsxs39("li", { className: "flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2", children: [
|
|
4170
|
+
/* @__PURE__ */ jsxs39("div", { className: "min-w-0", children: [
|
|
4171
|
+
/* @__PURE__ */ jsx58("p", { className: "truncate text-sm", children: file.name }),
|
|
4172
|
+
/* @__PURE__ */ jsx58("p", { className: "text-xs text-muted-foreground", children: formatSize(file.size) }),
|
|
4173
|
+
progress?.[file.name] !== void 0 && /* @__PURE__ */ jsx58(
|
|
4174
|
+
"div",
|
|
4175
|
+
{
|
|
4176
|
+
role: "progressbar",
|
|
4177
|
+
"aria-valuenow": progress[file.name],
|
|
4178
|
+
"aria-valuemin": 0,
|
|
4179
|
+
"aria-valuemax": 100,
|
|
4180
|
+
"aria-label": `Uploading ${file.name}`,
|
|
4181
|
+
className: "mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-muted",
|
|
4182
|
+
children: /* @__PURE__ */ jsx58("div", { className: "h-full bg-primary", style: { width: `${progress[file.name]}%` } })
|
|
4183
|
+
}
|
|
4184
|
+
)
|
|
4185
|
+
] }),
|
|
4186
|
+
/* @__PURE__ */ jsx58(
|
|
4187
|
+
"button",
|
|
4188
|
+
{
|
|
4189
|
+
type: "button",
|
|
4190
|
+
onClick: () => commit(current.filter((entry) => entry.name !== file.name)),
|
|
4191
|
+
"aria-label": `Remove ${file.name}`,
|
|
4192
|
+
className: "rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
4193
|
+
children: "\u2715"
|
|
4194
|
+
}
|
|
4195
|
+
)
|
|
4196
|
+
] }, file.name)) })
|
|
4197
|
+
] });
|
|
4198
|
+
});
|
|
4199
|
+
|
|
4200
|
+
// src/components/timeline/Timeline.tsx
|
|
4201
|
+
import * as React59 from "react";
|
|
4202
|
+
import { jsx as jsx59, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4203
|
+
var Timeline = React59.forwardRef(function Timeline2({ items, className, ...props }, ref) {
|
|
4204
|
+
return /* @__PURE__ */ jsx59("ol", { ref, className: cn("relative flex flex-col gap-6", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs40("li", { className: "relative flex gap-4", children: [
|
|
4205
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex flex-col items-center", children: [
|
|
4206
|
+
/* @__PURE__ */ jsx59(
|
|
4207
|
+
"span",
|
|
4208
|
+
{
|
|
4209
|
+
"aria-hidden": "true",
|
|
4210
|
+
className: cn(
|
|
4211
|
+
"mt-1 flex h-3 w-3 shrink-0 items-center justify-center rounded-full border-2",
|
|
4212
|
+
item.muted ? "border-border bg-background" : "border-primary bg-primary"
|
|
4213
|
+
)
|
|
4214
|
+
}
|
|
4215
|
+
),
|
|
4216
|
+
index < items.length - 1 && /* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "mt-1 w-px flex-1 bg-border" })
|
|
4217
|
+
] }),
|
|
4218
|
+
/* @__PURE__ */ jsxs40("div", { className: cn("min-w-0 pb-1", item.muted && "opacity-60"), children: [
|
|
4219
|
+
item.period && /* @__PURE__ */ jsx59("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: item.period }),
|
|
4220
|
+
/* @__PURE__ */ jsx59("p", { className: "text-sm font-semibold", children: item.title }),
|
|
4221
|
+
item.description && /* @__PURE__ */ jsx59("p", { className: "mt-1 text-sm text-muted-foreground", children: item.description }),
|
|
4222
|
+
item.icon && /* @__PURE__ */ jsx59("div", { className: "mt-1 text-muted-foreground [&_svg]:size-4", children: item.icon })
|
|
4223
|
+
] })
|
|
4224
|
+
] }, `${item.title}-${index}`)) });
|
|
4225
|
+
});
|
|
4226
|
+
|
|
2516
4227
|
// src/components/block/Block.tsx
|
|
2517
|
-
import * as
|
|
2518
|
-
import { jsx as
|
|
2519
|
-
var Block =
|
|
4228
|
+
import * as React60 from "react";
|
|
4229
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
4230
|
+
var Block = React60.forwardRef(
|
|
2520
4231
|
({ as = "div", inline, muted, className, ...props }, ref) => {
|
|
2521
4232
|
const Tag = inline ? "span" : as;
|
|
2522
|
-
return /* @__PURE__ */
|
|
4233
|
+
return /* @__PURE__ */ jsx60(
|
|
2523
4234
|
Tag,
|
|
2524
4235
|
{
|
|
2525
4236
|
ref,
|
|
@@ -2532,8 +4243,8 @@ var Block = React39.forwardRef(
|
|
|
2532
4243
|
Block.displayName = "Block";
|
|
2533
4244
|
|
|
2534
4245
|
// src/components/flex/Flex.tsx
|
|
2535
|
-
import * as
|
|
2536
|
-
import { jsx as
|
|
4246
|
+
import * as React61 from "react";
|
|
4247
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
2537
4248
|
var justifyClasses = {
|
|
2538
4249
|
start: "justify-start",
|
|
2539
4250
|
center: "justify-center",
|
|
@@ -2549,11 +4260,11 @@ var alignClasses = {
|
|
|
2549
4260
|
stretch: "items-stretch",
|
|
2550
4261
|
baseline: "items-baseline"
|
|
2551
4262
|
};
|
|
2552
|
-
var Flex =
|
|
4263
|
+
var Flex = React61.forwardRef(
|
|
2553
4264
|
({ direction = "row", align, justify, wrap, gap = "md", as = "div", className, style, ...props }, ref) => {
|
|
2554
4265
|
const Tag = as;
|
|
2555
4266
|
const gapResolved = resolveGap(gap);
|
|
2556
|
-
return /* @__PURE__ */
|
|
4267
|
+
return /* @__PURE__ */ jsx61(
|
|
2557
4268
|
Tag,
|
|
2558
4269
|
{
|
|
2559
4270
|
ref,
|
|
@@ -2580,7 +4291,7 @@ var selfAlignClasses = {
|
|
|
2580
4291
|
stretch: "self-stretch",
|
|
2581
4292
|
baseline: "self-baseline"
|
|
2582
4293
|
};
|
|
2583
|
-
var FlexItem =
|
|
4294
|
+
var FlexItem = React61.forwardRef(
|
|
2584
4295
|
({ grow, shrink, basis, align, as = "div", className, ...props }, ref) => {
|
|
2585
4296
|
const Tag = as;
|
|
2586
4297
|
const style = {
|
|
@@ -2588,7 +4299,7 @@ var FlexItem = React40.forwardRef(
|
|
|
2588
4299
|
...shrink === false ? { flexShrink: 0 } : typeof shrink === "string" && shrink ? { flexShrink: Number(shrink) || shrink } : {},
|
|
2589
4300
|
...basis ? { flexBasis: basis } : {}
|
|
2590
4301
|
};
|
|
2591
|
-
return /* @__PURE__ */
|
|
4302
|
+
return /* @__PURE__ */ jsx61(
|
|
2592
4303
|
Tag,
|
|
2593
4304
|
{
|
|
2594
4305
|
ref,
|
|
@@ -2602,8 +4313,8 @@ var FlexItem = React40.forwardRef(
|
|
|
2602
4313
|
FlexItem.displayName = "FlexItem";
|
|
2603
4314
|
|
|
2604
4315
|
// src/components/grid/Grid.tsx
|
|
2605
|
-
import * as
|
|
2606
|
-
import { jsx as
|
|
4316
|
+
import * as React62 from "react";
|
|
4317
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
2607
4318
|
var BASE_COLS = {
|
|
2608
4319
|
1: "grid-cols-1",
|
|
2609
4320
|
2: "grid-cols-2",
|
|
@@ -2668,11 +4379,11 @@ var LG_COL_SPAN = {
|
|
|
2668
4379
|
5: "lg:col-span-5",
|
|
2669
4380
|
6: "lg:col-span-6"
|
|
2670
4381
|
};
|
|
2671
|
-
var Grid =
|
|
4382
|
+
var Grid = React62.forwardRef(
|
|
2672
4383
|
({ cols, smCols, mdCols, lgCols, minCol, gap = "md", as = "div", className, style, ...props }, ref) => {
|
|
2673
4384
|
const Tag = as;
|
|
2674
4385
|
const gapResolved = resolveGap(gap);
|
|
2675
|
-
return /* @__PURE__ */
|
|
4386
|
+
return /* @__PURE__ */ jsx62(
|
|
2676
4387
|
Tag,
|
|
2677
4388
|
{
|
|
2678
4389
|
ref,
|
|
@@ -2696,10 +4407,10 @@ var Grid = React41.forwardRef(
|
|
|
2696
4407
|
}
|
|
2697
4408
|
);
|
|
2698
4409
|
Grid.displayName = "Grid";
|
|
2699
|
-
var GridItem =
|
|
4410
|
+
var GridItem = React62.forwardRef(
|
|
2700
4411
|
({ span, smSpan, mdSpan, lgSpan, as = "div", className, ...props }, ref) => {
|
|
2701
4412
|
const Tag = as;
|
|
2702
|
-
return /* @__PURE__ */
|
|
4413
|
+
return /* @__PURE__ */ jsx62(
|
|
2703
4414
|
Tag,
|
|
2704
4415
|
{
|
|
2705
4416
|
ref,
|
|
@@ -2718,10 +4429,11 @@ var GridItem = React41.forwardRef(
|
|
|
2718
4429
|
GridItem.displayName = "GridItem";
|
|
2719
4430
|
|
|
2720
4431
|
// src/components/menu/Menu.tsx
|
|
2721
|
-
import * as
|
|
2722
|
-
import { createPortal as
|
|
2723
|
-
import {
|
|
2724
|
-
|
|
4432
|
+
import * as React63 from "react";
|
|
4433
|
+
import { createPortal as createPortal7 } from "react-dom";
|
|
4434
|
+
import { Slot as Slot5 } from "@radix-ui/react-slot";
|
|
4435
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
4436
|
+
var MenuContext = React63.createContext({
|
|
2725
4437
|
open: false,
|
|
2726
4438
|
setOpen: () => {
|
|
2727
4439
|
},
|
|
@@ -2730,13 +4442,13 @@ var MenuContext = React42.createContext({
|
|
|
2730
4442
|
},
|
|
2731
4443
|
wrapperRef: { current: null }
|
|
2732
4444
|
});
|
|
2733
|
-
var Menu =
|
|
4445
|
+
var Menu = React63.forwardRef(
|
|
2734
4446
|
({ open, onOpenChange, className, children }, ref) => {
|
|
2735
|
-
const [internalOpen, setInternalOpen] =
|
|
2736
|
-
const [activeIndex, setActiveIndex] =
|
|
4447
|
+
const [internalOpen, setInternalOpen] = React63.useState(false);
|
|
4448
|
+
const [activeIndex, setActiveIndex] = React63.useState(-1);
|
|
2737
4449
|
const current = open ?? internalOpen;
|
|
2738
|
-
const wrapperRef =
|
|
2739
|
-
const setRefs =
|
|
4450
|
+
const wrapperRef = React63.useRef(null);
|
|
4451
|
+
const setRefs = React63.useCallback(
|
|
2740
4452
|
(node) => {
|
|
2741
4453
|
wrapperRef.current = node;
|
|
2742
4454
|
if (typeof ref === "function") ref(node);
|
|
@@ -2744,7 +4456,7 @@ var Menu = React42.forwardRef(
|
|
|
2744
4456
|
},
|
|
2745
4457
|
[ref]
|
|
2746
4458
|
);
|
|
2747
|
-
const setOpen =
|
|
4459
|
+
const setOpen = React63.useCallback(
|
|
2748
4460
|
(next) => {
|
|
2749
4461
|
if (open === void 0) setInternalOpen(next);
|
|
2750
4462
|
onOpenChange?.(next);
|
|
@@ -2752,7 +4464,7 @@ var Menu = React42.forwardRef(
|
|
|
2752
4464
|
},
|
|
2753
4465
|
[open, onOpenChange]
|
|
2754
4466
|
);
|
|
2755
|
-
return /* @__PURE__ */
|
|
4467
|
+
return /* @__PURE__ */ jsx63("div", { ref: setRefs, className: cn("relative inline-block", className), children: /* @__PURE__ */ jsx63(
|
|
2756
4468
|
MenuContext.Provider,
|
|
2757
4469
|
{
|
|
2758
4470
|
value: { open: current, setOpen, activeIndex, setActiveIndex, wrapperRef },
|
|
@@ -2762,10 +4474,10 @@ var Menu = React42.forwardRef(
|
|
|
2762
4474
|
}
|
|
2763
4475
|
);
|
|
2764
4476
|
Menu.displayName = "Menu";
|
|
2765
|
-
var MenuTrigger =
|
|
4477
|
+
var MenuTrigger = React63.forwardRef(
|
|
2766
4478
|
({ className, children, ...props }, ref) => {
|
|
2767
|
-
const { open, setOpen } =
|
|
2768
|
-
return /* @__PURE__ */
|
|
4479
|
+
const { open, setOpen } = React63.useContext(MenuContext);
|
|
4480
|
+
return /* @__PURE__ */ jsx63(
|
|
2769
4481
|
"button",
|
|
2770
4482
|
{
|
|
2771
4483
|
ref,
|
|
@@ -2785,13 +4497,13 @@ var MenuTrigger = React42.forwardRef(
|
|
|
2785
4497
|
}
|
|
2786
4498
|
);
|
|
2787
4499
|
MenuTrigger.displayName = "MenuTrigger";
|
|
2788
|
-
var MenuContent =
|
|
4500
|
+
var MenuContent = React63.forwardRef(
|
|
2789
4501
|
({ className, children, ...props }, ref) => {
|
|
2790
|
-
const { open, setOpen, activeIndex, setActiveIndex, wrapperRef } =
|
|
2791
|
-
const contentRef =
|
|
2792
|
-
const [pos, setPos] =
|
|
2793
|
-
const itemsRef =
|
|
2794
|
-
|
|
4502
|
+
const { open, setOpen, activeIndex, setActiveIndex, wrapperRef } = React63.useContext(MenuContext);
|
|
4503
|
+
const contentRef = React63.useRef(null);
|
|
4504
|
+
const [pos, setPos] = React63.useState(null);
|
|
4505
|
+
const itemsRef = React63.useRef([]);
|
|
4506
|
+
React63.useLayoutEffect(() => {
|
|
2795
4507
|
if (!open) {
|
|
2796
4508
|
setPos(null);
|
|
2797
4509
|
return;
|
|
@@ -2811,7 +4523,7 @@ var MenuContent = React42.forwardRef(
|
|
|
2811
4523
|
window.removeEventListener("resize", measure);
|
|
2812
4524
|
};
|
|
2813
4525
|
}, [open, setOpen, wrapperRef]);
|
|
2814
|
-
|
|
4526
|
+
React63.useEffect(() => {
|
|
2815
4527
|
if (!open) return;
|
|
2816
4528
|
function onPointerDown(event) {
|
|
2817
4529
|
if (!contentRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -2819,7 +4531,7 @@ var MenuContent = React42.forwardRef(
|
|
|
2819
4531
|
document.addEventListener("pointerdown", onPointerDown);
|
|
2820
4532
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
2821
4533
|
}, [open, setOpen]);
|
|
2822
|
-
|
|
4534
|
+
React63.useEffect(() => {
|
|
2823
4535
|
if (open && pos && contentRef.current) {
|
|
2824
4536
|
itemsRef.current = Array.from(
|
|
2825
4537
|
contentRef.current.querySelectorAll('[role="menuitem"]:not([disabled])')
|
|
@@ -2854,8 +4566,8 @@ var MenuContent = React42.forwardRef(
|
|
|
2854
4566
|
}
|
|
2855
4567
|
};
|
|
2856
4568
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
2857
|
-
return
|
|
2858
|
-
/* @__PURE__ */
|
|
4569
|
+
return createPortal7(
|
|
4570
|
+
/* @__PURE__ */ jsx63(
|
|
2859
4571
|
"div",
|
|
2860
4572
|
{
|
|
2861
4573
|
ref: (node) => {
|
|
@@ -2879,14 +4591,16 @@ var MenuContent = React42.forwardRef(
|
|
|
2879
4591
|
}
|
|
2880
4592
|
);
|
|
2881
4593
|
MenuContent.displayName = "MenuContent";
|
|
2882
|
-
var MenuItem =
|
|
2883
|
-
({ className, destructive, onClick, ...props }, ref) => {
|
|
2884
|
-
const { setOpen } =
|
|
2885
|
-
|
|
2886
|
-
|
|
4594
|
+
var MenuItem = React63.forwardRef(
|
|
4595
|
+
({ className, destructive, asChild = false, onClick, ...props }, ref) => {
|
|
4596
|
+
const { setOpen } = React63.useContext(MenuContext);
|
|
4597
|
+
const Comp = asChild ? Slot5 : "button";
|
|
4598
|
+
const typeProp = asChild ? {} : { type: "button" };
|
|
4599
|
+
return /* @__PURE__ */ jsx63(
|
|
4600
|
+
Comp,
|
|
2887
4601
|
{
|
|
2888
4602
|
ref,
|
|
2889
|
-
|
|
4603
|
+
...typeProp,
|
|
2890
4604
|
role: "menuitem",
|
|
2891
4605
|
onClick: (event) => {
|
|
2892
4606
|
onClick?.(event);
|
|
@@ -2904,12 +4618,12 @@ var MenuItem = React42.forwardRef(
|
|
|
2904
4618
|
}
|
|
2905
4619
|
);
|
|
2906
4620
|
MenuItem.displayName = "MenuItem";
|
|
2907
|
-
var MenuSeparator =
|
|
2908
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4621
|
+
var MenuSeparator = React63.forwardRef(
|
|
4622
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx63("div", { ref, role: "separator", className: cn("-mx-1 my-1 h-px bg-border", className), ...props })
|
|
2909
4623
|
);
|
|
2910
4624
|
MenuSeparator.displayName = "MenuSeparator";
|
|
2911
|
-
var MenuLabel =
|
|
2912
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4625
|
+
var MenuLabel = React63.forwardRef(
|
|
4626
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx63(
|
|
2913
4627
|
"div",
|
|
2914
4628
|
{
|
|
2915
4629
|
ref,
|
|
@@ -2921,10 +4635,10 @@ var MenuLabel = React42.forwardRef(
|
|
|
2921
4635
|
MenuLabel.displayName = "MenuLabel";
|
|
2922
4636
|
|
|
2923
4637
|
// src/components/alert/Alert.tsx
|
|
2924
|
-
import * as
|
|
2925
|
-
import { cva as
|
|
2926
|
-
import { jsx as
|
|
2927
|
-
var alertVariants =
|
|
4638
|
+
import * as React64 from "react";
|
|
4639
|
+
import { cva as cva7 } from "class-variance-authority";
|
|
4640
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
4641
|
+
var alertVariants = cva7(
|
|
2928
4642
|
"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",
|
|
2929
4643
|
{
|
|
2930
4644
|
variants: {
|
|
@@ -2932,8 +4646,8 @@ var alertVariants = cva6(
|
|
|
2932
4646
|
default: "bg-background text-foreground border-border",
|
|
2933
4647
|
destructive: "border-destructive/50 text-destructive bg-destructive/10 [&>svg]:text-destructive",
|
|
2934
4648
|
success: "border-success/50 text-success bg-success/10 [&>svg]:text-success",
|
|
2935
|
-
warning: "border-warning/50 text-warning bg-warning/10 [&>svg]:text-warning",
|
|
2936
|
-
info: "border-info/50 text-info bg-info/10 [&>svg]:text-info"
|
|
4649
|
+
warning: "border-warning/50 text-warning-ink bg-warning/10 [&>svg]:text-warning-ink",
|
|
4650
|
+
info: "border-info/50 text-info-ink bg-info/10 [&>svg]:text-info-ink"
|
|
2937
4651
|
}
|
|
2938
4652
|
},
|
|
2939
4653
|
defaultVariants: {
|
|
@@ -2941,8 +4655,8 @@ var alertVariants = cva6(
|
|
|
2941
4655
|
}
|
|
2942
4656
|
}
|
|
2943
4657
|
);
|
|
2944
|
-
var Alert =
|
|
2945
|
-
({ className, variant, ...props }, ref) => /* @__PURE__ */
|
|
4658
|
+
var Alert = React64.forwardRef(
|
|
4659
|
+
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx64(
|
|
2946
4660
|
"div",
|
|
2947
4661
|
{
|
|
2948
4662
|
ref,
|
|
@@ -2953,8 +4667,8 @@ var Alert = React43.forwardRef(
|
|
|
2953
4667
|
)
|
|
2954
4668
|
);
|
|
2955
4669
|
Alert.displayName = "Alert";
|
|
2956
|
-
var AlertTitle =
|
|
2957
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4670
|
+
var AlertTitle = React64.forwardRef(
|
|
4671
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx64(
|
|
2958
4672
|
"h5",
|
|
2959
4673
|
{
|
|
2960
4674
|
ref,
|
|
@@ -2964,8 +4678,8 @@ var AlertTitle = React43.forwardRef(
|
|
|
2964
4678
|
)
|
|
2965
4679
|
);
|
|
2966
4680
|
AlertTitle.displayName = "AlertTitle";
|
|
2967
|
-
var AlertDescription =
|
|
2968
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4681
|
+
var AlertDescription = React64.forwardRef(
|
|
4682
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx64(
|
|
2969
4683
|
"div",
|
|
2970
4684
|
{
|
|
2971
4685
|
ref,
|
|
@@ -2977,10 +4691,10 @@ var AlertDescription = React43.forwardRef(
|
|
|
2977
4691
|
AlertDescription.displayName = "AlertDescription";
|
|
2978
4692
|
|
|
2979
4693
|
// src/components/popover/Popover.tsx
|
|
2980
|
-
import * as
|
|
2981
|
-
import { createPortal as
|
|
2982
|
-
import { jsx as
|
|
2983
|
-
var PopoverContext =
|
|
4694
|
+
import * as React65 from "react";
|
|
4695
|
+
import { createPortal as createPortal8 } from "react-dom";
|
|
4696
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
4697
|
+
var PopoverContext = React65.createContext({
|
|
2984
4698
|
open: false,
|
|
2985
4699
|
setOpen: () => {
|
|
2986
4700
|
},
|
|
@@ -2988,14 +4702,14 @@ var PopoverContext = React44.createContext({
|
|
|
2988
4702
|
contentId: "",
|
|
2989
4703
|
wrapperRef: { current: null }
|
|
2990
4704
|
});
|
|
2991
|
-
var Popover =
|
|
4705
|
+
var Popover = React65.forwardRef(
|
|
2992
4706
|
({ open, onOpenChange, className, children }, ref) => {
|
|
2993
|
-
const [internalOpen, setInternalOpen] =
|
|
4707
|
+
const [internalOpen, setInternalOpen] = React65.useState(false);
|
|
2994
4708
|
const current = open ?? internalOpen;
|
|
2995
|
-
const triggerId =
|
|
2996
|
-
const contentId =
|
|
2997
|
-
const wrapperRef =
|
|
2998
|
-
const setRefs =
|
|
4709
|
+
const triggerId = React65.useId();
|
|
4710
|
+
const contentId = React65.useId();
|
|
4711
|
+
const wrapperRef = React65.useRef(null);
|
|
4712
|
+
const setRefs = React65.useCallback(
|
|
2999
4713
|
(node) => {
|
|
3000
4714
|
wrapperRef.current = node;
|
|
3001
4715
|
if (typeof ref === "function") ref(node);
|
|
@@ -3003,14 +4717,14 @@ var Popover = React44.forwardRef(
|
|
|
3003
4717
|
},
|
|
3004
4718
|
[ref]
|
|
3005
4719
|
);
|
|
3006
|
-
const setOpen =
|
|
4720
|
+
const setOpen = React65.useCallback(
|
|
3007
4721
|
(next) => {
|
|
3008
4722
|
if (open === void 0) setInternalOpen(next);
|
|
3009
4723
|
onOpenChange?.(next);
|
|
3010
4724
|
},
|
|
3011
4725
|
[open, onOpenChange]
|
|
3012
4726
|
);
|
|
3013
|
-
return /* @__PURE__ */
|
|
4727
|
+
return /* @__PURE__ */ jsx65("div", { ref: setRefs, className: cn("relative inline-block", className), children: /* @__PURE__ */ jsx65(
|
|
3014
4728
|
PopoverContext.Provider,
|
|
3015
4729
|
{
|
|
3016
4730
|
value: { open: current, setOpen, triggerId, contentId, wrapperRef },
|
|
@@ -3020,10 +4734,10 @@ var Popover = React44.forwardRef(
|
|
|
3020
4734
|
}
|
|
3021
4735
|
);
|
|
3022
4736
|
Popover.displayName = "Popover";
|
|
3023
|
-
var PopoverTrigger =
|
|
4737
|
+
var PopoverTrigger = React65.forwardRef(
|
|
3024
4738
|
({ className, children, onClick, ...props }, ref) => {
|
|
3025
|
-
const { open, setOpen, triggerId, contentId } =
|
|
3026
|
-
return /* @__PURE__ */
|
|
4739
|
+
const { open, setOpen, triggerId, contentId } = React65.useContext(PopoverContext);
|
|
4740
|
+
return /* @__PURE__ */ jsx65(
|
|
3027
4741
|
"button",
|
|
3028
4742
|
{
|
|
3029
4743
|
ref,
|
|
@@ -3048,12 +4762,12 @@ var PopoverTrigger = React44.forwardRef(
|
|
|
3048
4762
|
}
|
|
3049
4763
|
);
|
|
3050
4764
|
PopoverTrigger.displayName = "PopoverTrigger";
|
|
3051
|
-
var PopoverContent =
|
|
4765
|
+
var PopoverContent = React65.forwardRef(
|
|
3052
4766
|
({ className, children, onKeyDown, ...props }, ref) => {
|
|
3053
|
-
const { open, setOpen, triggerId, contentId, wrapperRef } =
|
|
3054
|
-
const contentRef =
|
|
3055
|
-
const [pos, setPos] =
|
|
3056
|
-
|
|
4767
|
+
const { open, setOpen, triggerId, contentId, wrapperRef } = React65.useContext(PopoverContext);
|
|
4768
|
+
const contentRef = React65.useRef(null);
|
|
4769
|
+
const [pos, setPos] = React65.useState(null);
|
|
4770
|
+
React65.useLayoutEffect(() => {
|
|
3057
4771
|
if (!open) {
|
|
3058
4772
|
setPos(null);
|
|
3059
4773
|
return;
|
|
@@ -3073,7 +4787,7 @@ var PopoverContent = React44.forwardRef(
|
|
|
3073
4787
|
window.removeEventListener("resize", measure);
|
|
3074
4788
|
};
|
|
3075
4789
|
}, [open, setOpen, wrapperRef]);
|
|
3076
|
-
|
|
4790
|
+
React65.useEffect(() => {
|
|
3077
4791
|
if (!open) return;
|
|
3078
4792
|
function onPointerDown(event) {
|
|
3079
4793
|
if (!contentRef.current?.contains(event.target)) setOpen(false);
|
|
@@ -3081,14 +4795,14 @@ var PopoverContent = React44.forwardRef(
|
|
|
3081
4795
|
document.addEventListener("pointerdown", onPointerDown);
|
|
3082
4796
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
3083
4797
|
}, [open, setOpen]);
|
|
3084
|
-
|
|
4798
|
+
React65.useEffect(() => {
|
|
3085
4799
|
if (open && pos && contentRef.current) {
|
|
3086
4800
|
contentRef.current.focus();
|
|
3087
4801
|
}
|
|
3088
4802
|
}, [open, pos]);
|
|
3089
4803
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
3090
|
-
return
|
|
3091
|
-
/* @__PURE__ */
|
|
4804
|
+
return createPortal8(
|
|
4805
|
+
/* @__PURE__ */ jsx65(
|
|
3092
4806
|
"div",
|
|
3093
4807
|
{
|
|
3094
4808
|
ref: (node) => {
|
|
@@ -3123,43 +4837,46 @@ var PopoverContent = React44.forwardRef(
|
|
|
3123
4837
|
PopoverContent.displayName = "PopoverContent";
|
|
3124
4838
|
|
|
3125
4839
|
// src/components/breadcrumb/Breadcrumb.tsx
|
|
3126
|
-
import * as
|
|
3127
|
-
import { jsx as
|
|
3128
|
-
var Breadcrumb =
|
|
3129
|
-
({ items, separator = "/", onItemClick, className, ...props }, ref) =>
|
|
3130
|
-
"
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
"
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
onItemClick(
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
"
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
4840
|
+
import * as React66 from "react";
|
|
4841
|
+
import { jsx as jsx66, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4842
|
+
var Breadcrumb = React66.forwardRef(
|
|
4843
|
+
({ items, separator = "/", onItemClick, linkComponent, className, ...props }, ref) => {
|
|
4844
|
+
const LinkEl = linkComponent ?? "a";
|
|
4845
|
+
return /* @__PURE__ */ jsx66(
|
|
4846
|
+
"nav",
|
|
4847
|
+
{
|
|
4848
|
+
ref,
|
|
4849
|
+
"aria-label": "Breadcrumb",
|
|
4850
|
+
className: cn("flex items-center space-x-1.5 text-sm text-muted-foreground", className),
|
|
4851
|
+
...props,
|
|
4852
|
+
children: /* @__PURE__ */ jsx66("ol", { className: "flex flex-wrap items-center space-x-1.5", children: items.map((item, index) => {
|
|
4853
|
+
const isLast = index === items.length - 1;
|
|
4854
|
+
return /* @__PURE__ */ jsxs41("li", { className: "flex items-center space-x-1.5", children: [
|
|
4855
|
+
index > 0 && /* @__PURE__ */ jsx66("span", { "aria-hidden": "true", className: "text-muted-foreground/50", children: separator }),
|
|
4856
|
+
item.href && !isLast ? /* @__PURE__ */ jsx66(
|
|
4857
|
+
LinkEl,
|
|
4858
|
+
{
|
|
4859
|
+
href: item.href,
|
|
4860
|
+
className: "transition-colors hover:text-foreground",
|
|
4861
|
+
onClick: onItemClick ? (event) => {
|
|
4862
|
+
event.preventDefault();
|
|
4863
|
+
onItemClick(item, index);
|
|
4864
|
+
} : void 0,
|
|
4865
|
+
children: item.label
|
|
4866
|
+
}
|
|
4867
|
+
) : /* @__PURE__ */ jsx66(
|
|
4868
|
+
"span",
|
|
4869
|
+
{
|
|
4870
|
+
"aria-current": isLast ? "page" : void 0,
|
|
4871
|
+
className: isLast ? "font-medium text-foreground" : void 0,
|
|
4872
|
+
children: item.label
|
|
4873
|
+
}
|
|
4874
|
+
)
|
|
4875
|
+
] }, `${item.label}-${index}`);
|
|
4876
|
+
}) })
|
|
4877
|
+
}
|
|
4878
|
+
);
|
|
4879
|
+
}
|
|
3163
4880
|
);
|
|
3164
4881
|
Breadcrumb.displayName = "Breadcrumb";
|
|
3165
4882
|
export {
|
|
@@ -3170,6 +4887,8 @@ export {
|
|
|
3170
4887
|
Alert,
|
|
3171
4888
|
AlertDescription,
|
|
3172
4889
|
AlertTitle,
|
|
4890
|
+
AppShell,
|
|
4891
|
+
AuthLayout,
|
|
3173
4892
|
Autocomplete,
|
|
3174
4893
|
Avatar,
|
|
3175
4894
|
AvatarFallback,
|
|
@@ -3188,11 +4907,21 @@ export {
|
|
|
3188
4907
|
Checkbox,
|
|
3189
4908
|
CheckboxGroup,
|
|
3190
4909
|
CheckboxGroupItem,
|
|
4910
|
+
ConfirmDialog,
|
|
3191
4911
|
DataTable,
|
|
4912
|
+
DatePicker,
|
|
3192
4913
|
Dialog,
|
|
4914
|
+
DialogBody,
|
|
4915
|
+
DialogDescription,
|
|
4916
|
+
DialogFooter,
|
|
4917
|
+
DialogHeader,
|
|
4918
|
+
DialogTitle,
|
|
3193
4919
|
Divider,
|
|
3194
4920
|
Drawer,
|
|
4921
|
+
EmptyState,
|
|
3195
4922
|
Fieldset,
|
|
4923
|
+
FileUpload,
|
|
4924
|
+
FilterBar,
|
|
3196
4925
|
Flex,
|
|
3197
4926
|
FlexItem,
|
|
3198
4927
|
Form,
|
|
@@ -3205,6 +4934,7 @@ export {
|
|
|
3205
4934
|
InputGroup,
|
|
3206
4935
|
InputGroupAddon,
|
|
3207
4936
|
Label,
|
|
4937
|
+
Link,
|
|
3208
4938
|
List,
|
|
3209
4939
|
ListItem,
|
|
3210
4940
|
Menu,
|
|
@@ -3213,29 +4943,41 @@ export {
|
|
|
3213
4943
|
MenuLabel,
|
|
3214
4944
|
MenuSeparator,
|
|
3215
4945
|
MenuTrigger,
|
|
4946
|
+
MetricCard,
|
|
4947
|
+
PageHeader,
|
|
3216
4948
|
Pagination,
|
|
4949
|
+
PasswordInput,
|
|
3217
4950
|
Popover,
|
|
3218
4951
|
PopoverContent,
|
|
3219
4952
|
PopoverTrigger,
|
|
3220
4953
|
Progress,
|
|
4954
|
+
Prose,
|
|
3221
4955
|
Radio,
|
|
3222
4956
|
RadioCard,
|
|
3223
4957
|
RadioGroup,
|
|
3224
4958
|
RadioGroupContext,
|
|
3225
4959
|
RadioGroupItem,
|
|
3226
4960
|
Search,
|
|
4961
|
+
SectionHeading,
|
|
3227
4962
|
Select,
|
|
4963
|
+
SelectMenu,
|
|
3228
4964
|
Separator,
|
|
4965
|
+
Sidebar,
|
|
4966
|
+
SiteFooter,
|
|
4967
|
+
SiteHeader,
|
|
3229
4968
|
Skeleton,
|
|
3230
4969
|
Spinner,
|
|
4970
|
+
Stepper,
|
|
3231
4971
|
Switch,
|
|
3232
4972
|
Table,
|
|
3233
4973
|
TableBody,
|
|
3234
4974
|
TableCaption,
|
|
4975
|
+
TableCard,
|
|
3235
4976
|
TableCell,
|
|
3236
4977
|
TableFooter,
|
|
3237
4978
|
TableHead,
|
|
3238
4979
|
TableHeader,
|
|
4980
|
+
TableOfContents,
|
|
3239
4981
|
TableRow,
|
|
3240
4982
|
Tabs,
|
|
3241
4983
|
TabsContent,
|
|
@@ -3243,7 +4985,10 @@ export {
|
|
|
3243
4985
|
TabsTrigger,
|
|
3244
4986
|
Text,
|
|
3245
4987
|
Textarea,
|
|
4988
|
+
TimePicker,
|
|
4989
|
+
Timeline,
|
|
3246
4990
|
ToastProvider,
|
|
4991
|
+
Toaster,
|
|
3247
4992
|
Tooltip,
|
|
3248
4993
|
alertVariants,
|
|
3249
4994
|
badgeVariants,
|
|
@@ -3253,8 +4998,10 @@ export {
|
|
|
3253
4998
|
resolveGap,
|
|
3254
4999
|
separatorVariants,
|
|
3255
5000
|
spinnerVariants,
|
|
5001
|
+
toast,
|
|
3256
5002
|
useCombobox,
|
|
3257
5003
|
usePresence,
|
|
5004
|
+
useScrollSpy,
|
|
3258
5005
|
useToast
|
|
3259
5006
|
};
|
|
3260
5007
|
//# sourceMappingURL=index.mjs.map
|