@eventideorg/design-system 0.1.0 → 0.1.1
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.css +1 -1
- package/dist/index.js +2946 -860
- package/dist/ui/hooks/index.d.ts +1 -1
- package/dist/ui/hooks/useAlert.d.ts +3 -0
- package/dist/ui/ui/Alert/AlertContext.d.ts +2 -0
- package/dist/ui/ui/Alert/AlertItem.d.ts +8 -0
- package/dist/ui/ui/Alert/AlertProvider.d.ts +4 -0
- package/dist/ui/ui/Alert/index.d.ts +4 -0
- package/dist/ui/ui/Alert/types.d.ts +16 -0
- package/dist/ui/ui/Breadcrumb.d.ts +11 -0
- package/dist/ui/ui/Breadcrumbs/BreadcrumbProvider.d.ts +11 -0
- package/dist/ui/ui/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/dist/ui/ui/Breadcrumbs/index.d.ts +3 -0
- package/dist/ui/ui/Breadcrumbs/types.d.ts +26 -0
- package/dist/ui/ui/ContextMenu.d.ts +25 -0
- package/dist/ui/ui/DropdownMenu.d.ts +25 -0
- package/dist/ui/ui/FormSystem/types.d.ts +15 -1
- package/dist/ui/ui/InputFields/AudioInput.d.ts +12 -0
- package/dist/ui/ui/InputFields/FieldWrapper.d.ts +1 -0
- package/dist/ui/ui/InputFields/SliderInput.d.ts +13 -0
- package/dist/ui/ui/InputFields/VideoInput.d.ts +12 -0
- package/dist/ui/ui/InputFields/index.d.ts +6 -0
- package/dist/ui/ui/InputOTP.d.ts +34 -0
- package/dist/ui/ui/ListView/CardView/CardItem.d.ts +2 -0
- package/dist/ui/ui/ListView/CardView/CardView.d.ts +2 -0
- package/dist/ui/ui/ListView/CardView/SortableCardItem.d.ts +2 -0
- package/dist/ui/ui/ListView/CardView/index.d.ts +3 -0
- package/dist/ui/ui/ListView/ListView.d.ts +2 -0
- package/dist/ui/ui/ListView/ListViewEmptyState.d.ts +2 -0
- package/dist/ui/ui/ListView/ListViewSplitPane.d.ts +2 -0
- package/dist/ui/ui/ListView/ListViewStatusBar.d.ts +2 -0
- package/dist/ui/ui/ListView/ListViewToolbar.d.ts +2 -0
- package/dist/ui/ui/ListView/TableView/TableHeader.d.ts +2 -0
- package/dist/ui/ui/ListView/TableView/TableRow.d.ts +2 -0
- package/dist/ui/ui/ListView/TableView/TableView.d.ts +2 -0
- package/dist/ui/ui/ListView/TableView/index.d.ts +3 -0
- package/dist/ui/ui/ListView/constants.d.ts +6 -0
- package/dist/ui/ui/ListView/hooks/index.d.ts +6 -0
- package/dist/ui/ui/ListView/hooks/useColumnVisibility.d.ts +14 -0
- package/dist/ui/ui/ListView/hooks/useFiltering.d.ts +6 -0
- package/dist/ui/ui/ListView/hooks/useListViewKeyboard.d.ts +10 -0
- package/dist/ui/ui/ListView/hooks/useSelection.d.ts +16 -0
- package/dist/ui/ui/ListView/hooks/useSorting.d.ts +12 -0
- package/dist/ui/ui/ListView/index.d.ts +10 -0
- package/dist/ui/ui/ListView/types.d.ts +148 -0
- package/dist/ui/ui/Slider.d.ts +4 -0
- package/dist/ui/ui/Sonner.d.ts +3 -0
- package/dist/ui/ui/Spinner.d.ts +2 -0
- package/dist/ui/ui/ThemeToggle/ThemeProvider.d.ts +4 -0
- package/dist/ui/ui/ThemeToggle/ThemeToggle.d.ts +4 -0
- package/dist/ui/ui/ThemeToggle/index.d.ts +3 -0
- package/dist/ui/ui/ThemeToggle/types.d.ts +10 -0
- package/dist/ui/ui/Tooltip.d.ts +7 -0
- package/dist/ui/ui/index.d.ts +16 -2
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Label as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as Ke } from "react/jsx-runtime";
|
|
2
|
+
import { X as ke, Info as Rt, AlertTriangle as At, AlertCircle as Tt, CheckCircle2 as Lt, Minus as Mt, EyeOff as Et, Eye as Pt, ChevronUp as Dt, ChevronDown as Ut, ChevronsUpDown as Le, Check as nt, Mail as $t, Link as Bt, Phone as Ot, CalendarIcon as Ft, Clock as _t, Upload as jt, Image as Kt, FileText as Ht, FileSpreadsheet as Vt, File as Gt, Search as at, Loader2 as Wt, Bold as Qt, Italic as Xt, Underline as Yt, Strikethrough as Zt, Heading1 as Jt, Heading2 as qt, Heading3 as er, List as it, ListOrdered as tr, Quote as rr, Code2 as nr, AlignLeft as ar, AlignCenter as ir, AlignRight as sr, Undo2 as or, Redo2 as lr, Link2 as cr, Unlink2 as dr, Mic as we, CircleDot as st, Pause as ge, Square as ot, Play as ur, RotateCcw as lt, Trash2 as ct, VideoOff as mr, SwitchCamera as fr, Video as hr, ArrowUpIcon as pr, ArrowDownIcon as gr, ImageIcon as br, LayoutGrid as He, SlidersHorizontal as vr, PanelRight as xr, SearchX as yr, PackageOpen as Nr, LoaderIcon as wr, Loader2Icon as kr, OctagonXIcon as Cr, TriangleAlertIcon as Sr, InfoIcon as zr, CircleCheckIcon as Ir, Sun as Rr, Moon as Ar } from "lucide-react";
|
|
3
|
+
import { cn as w } from "@/ui/lib/utils";
|
|
4
|
+
import * as be from "react";
|
|
5
|
+
import Ve, { createContext as Me, useState as R, useRef as F, useCallback as ae, useId as de, useMemo as ne, useEffect as X, useReducer as Tr, useContext as Ee } from "react";
|
|
6
|
+
import { Button as $ } from "@/ui/ui/Button";
|
|
7
|
+
import { Label as ue } from "@/ui/ui/Label";
|
|
8
|
+
import { cva as dt } from "class-variance-authority";
|
|
9
|
+
import { Slot as ut, Slider as xe, Tooltip as ce, Switch as Ge } from "radix-ui";
|
|
10
|
+
import { Breadcrumb as Lr, BreadcrumbList as Mr, BreadcrumbItem as Re, BreadcrumbEllipsis as Er, BreadcrumbSeparator as We, BreadcrumbPage as Qe, BreadcrumbLink as Pr } from "@/ui/ui/Breadcrumb";
|
|
11
|
+
import { ContextMenu as mt, ContextMenuTrigger as ft, ContextMenuContent as ht, ContextMenuItem as pt } from "@/ui/ui/ContextMenu";
|
|
12
|
+
import { useVirtualizer as gt } from "@tanstack/react-virtual";
|
|
13
|
+
import { useSensors as Dr, useSensor as Xe, PointerSensor as Ur, KeyboardSensor as $r, DndContext as Br, closestCenter as Or } from "@dnd-kit/core";
|
|
14
|
+
import { useSortable as Fr, arrayMove as _r, SortableContext as jr, rectSortingStrategy as Kr } from "@dnd-kit/sortable";
|
|
15
|
+
import { CSS as Hr } from "@dnd-kit/utilities";
|
|
16
|
+
import { Checkbox as Pe } from "@/ui/ui/Checkbox";
|
|
17
|
+
import { Input as ee } from "@/ui/ui/Input";
|
|
18
|
+
import { Popover as me, PopoverTrigger as fe, PopoverContent as he } from "@/ui/ui/Popover";
|
|
19
|
+
import { format as ye } from "date-fns";
|
|
20
|
+
import { Calendar as Ae } from "@/ui/ui/Calendar";
|
|
21
|
+
import { OTPInput as Vr, OTPInputContext as Gr } from "input-otp";
|
|
22
|
+
import { DropdownMenu as Ye, DropdownMenuTrigger as Ze, DropdownMenuContent as Je, DropdownMenuCheckboxItem as Wr, DropdownMenuItem as Qr } from "@/ui/ui/DropdownMenu";
|
|
23
|
+
import { Badge as bt } from "@/ui/ui/Badge";
|
|
24
|
+
import { useEditor as Xr, EditorContent as Yr } from "@tiptap/react";
|
|
25
|
+
import Zr from "@tiptap/starter-kit";
|
|
26
|
+
import Jr from "@tiptap/extension-text-align";
|
|
27
|
+
import qr from "@tiptap/extension-placeholder";
|
|
28
|
+
import en from "@tiptap/extension-character-count";
|
|
29
|
+
import { Select as tn, SelectTrigger as rn, SelectValue as nn, SelectContent as an, SelectItem as sn } from "@/ui/ui/Select";
|
|
30
|
+
import { Slider as on } from "@/ui/ui/Slider";
|
|
31
|
+
import { Switch as ln } from "@/ui/ui/Switch";
|
|
32
|
+
import { Textarea as cn } from "@/ui/ui/Textarea";
|
|
33
|
+
import { FieldWrapper as dn } from "@/ui/ui/InputFields/FieldWrapper";
|
|
34
|
+
import { useTheme as un } from "@/ui/ui/ThemeToggle/ThemeProvider";
|
|
35
|
+
import { Toaster as mn } from "sonner";
|
|
36
|
+
import { toast as Bi } from "sonner";
|
|
37
|
+
import { clsx as fn } from "clsx";
|
|
38
|
+
import { twMerge as hn } from "tailwind-merge";
|
|
39
|
+
const pn = dt(
|
|
27
40
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
28
41
|
{
|
|
29
42
|
variants: {
|
|
@@ -52,26 +65,101 @@ const mt = le(
|
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
);
|
|
55
|
-
function
|
|
68
|
+
function Ga({
|
|
56
69
|
className: t,
|
|
57
70
|
variant: r = "default",
|
|
58
71
|
size: n = "default",
|
|
59
72
|
asChild: a = !1,
|
|
60
73
|
...i
|
|
61
74
|
}) {
|
|
62
|
-
const
|
|
75
|
+
const m = a ? ut.Root : "button";
|
|
63
76
|
return /* @__PURE__ */ e(
|
|
64
|
-
|
|
77
|
+
m,
|
|
65
78
|
{
|
|
66
79
|
"data-slot": "button",
|
|
67
80
|
"data-variant": r,
|
|
68
81
|
"data-size": n,
|
|
69
|
-
className:
|
|
82
|
+
className: w(pn({ variant: r, size: n, className: t })),
|
|
70
83
|
...i
|
|
71
84
|
}
|
|
72
85
|
);
|
|
73
86
|
}
|
|
74
|
-
const
|
|
87
|
+
const gn = {
|
|
88
|
+
success: "border-success/30 bg-success/10 text-success dark:border-success/40 dark:bg-success/15",
|
|
89
|
+
error: "border-destructive/30 bg-destructive/10 text-destructive dark:border-destructive/40 dark:bg-destructive/15",
|
|
90
|
+
warning: "border-brand-gold/30 bg-brand-gold/10 text-brand-gold dark:border-brand-gold/40 dark:bg-brand-gold/15",
|
|
91
|
+
info: "border-primary/30 bg-primary/10 text-primary dark:border-primary/40 dark:bg-primary/15"
|
|
92
|
+
}, bn = {
|
|
93
|
+
success: /* @__PURE__ */ e(Lt, { className: "size-4 shrink-0" }),
|
|
94
|
+
error: /* @__PURE__ */ e(Tt, { className: "size-4 shrink-0" }),
|
|
95
|
+
warning: /* @__PURE__ */ e(At, { className: "size-4 shrink-0" }),
|
|
96
|
+
info: /* @__PURE__ */ e(Rt, { className: "size-4 shrink-0" })
|
|
97
|
+
};
|
|
98
|
+
function vn({ alert: t, onDismiss: r }) {
|
|
99
|
+
return /* @__PURE__ */ l(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
role: "alert",
|
|
103
|
+
"data-slot": "alert-item",
|
|
104
|
+
"data-variant": t.variant,
|
|
105
|
+
className: w(
|
|
106
|
+
"pointer-events-auto flex w-80 items-start gap-2 rounded-lg border px-4 py-3 shadow-lg",
|
|
107
|
+
gn[t.variant]
|
|
108
|
+
),
|
|
109
|
+
children: [
|
|
110
|
+
bn[t.variant],
|
|
111
|
+
/* @__PURE__ */ e("p", { className: "flex-1 text-sm font-medium", children: t.message }),
|
|
112
|
+
/* @__PURE__ */ e(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
"aria-label": "Dismiss alert",
|
|
117
|
+
onClick: () => r(t.id),
|
|
118
|
+
className: "shrink-0 rounded-sm opacity-70 hover:opacity-100 transition-opacity",
|
|
119
|
+
children: /* @__PURE__ */ e(ke, { className: "size-4" })
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
const xn = Me(null), yn = 5e3;
|
|
127
|
+
function Wa({ children: t }) {
|
|
128
|
+
const [r, n] = R([]), a = F(
|
|
129
|
+
/* @__PURE__ */ new Map()
|
|
130
|
+
), i = ae((o) => {
|
|
131
|
+
const f = a.current.get(o);
|
|
132
|
+
f && (clearTimeout(f), a.current.delete(o)), n((h) => h.filter((p) => p.id !== o));
|
|
133
|
+
}, []), m = ae(
|
|
134
|
+
(o) => {
|
|
135
|
+
const f = o.id ?? crypto.randomUUID(), h = o.duration ?? yn, p = { ...o, id: f, duration: h };
|
|
136
|
+
if (n((u) => [...u, p]), h > 0) {
|
|
137
|
+
const u = setTimeout(() => {
|
|
138
|
+
i(f);
|
|
139
|
+
}, h);
|
|
140
|
+
a.current.set(f, u);
|
|
141
|
+
}
|
|
142
|
+
return f;
|
|
143
|
+
},
|
|
144
|
+
[i]
|
|
145
|
+
), d = ae(() => {
|
|
146
|
+
for (const o of a.current.values())
|
|
147
|
+
clearTimeout(o);
|
|
148
|
+
a.current.clear(), n([]);
|
|
149
|
+
}, []);
|
|
150
|
+
return /* @__PURE__ */ l(xn.Provider, { value: { alerts: r, addAlert: m, removeAlert: i, clearAlerts: d }, children: [
|
|
151
|
+
t,
|
|
152
|
+
/* @__PURE__ */ e(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
"data-slot": "alert-container",
|
|
156
|
+
className: "fixed top-4 right-4 z-50 flex flex-col gap-2 pointer-events-none",
|
|
157
|
+
children: r.map((o) => /* @__PURE__ */ e(vn, { alert: o, onDismiss: i }, o.id))
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] });
|
|
161
|
+
}
|
|
162
|
+
const Nn = dt(
|
|
75
163
|
"inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
76
164
|
{
|
|
77
165
|
variants: {
|
|
@@ -89,29 +177,29 @@ const ft = le(
|
|
|
89
177
|
}
|
|
90
178
|
}
|
|
91
179
|
);
|
|
92
|
-
function
|
|
180
|
+
function Qa({
|
|
93
181
|
className: t,
|
|
94
182
|
variant: r = "default",
|
|
95
183
|
asChild: n = !1,
|
|
96
184
|
...a
|
|
97
185
|
}) {
|
|
98
|
-
const i = n ?
|
|
186
|
+
const i = n ? ut.Root : "span";
|
|
99
187
|
return /* @__PURE__ */ e(
|
|
100
188
|
i,
|
|
101
189
|
{
|
|
102
190
|
"data-slot": "badge",
|
|
103
191
|
"data-variant": r,
|
|
104
|
-
className:
|
|
192
|
+
className: w(Nn({ variant: r }), t),
|
|
105
193
|
...a
|
|
106
194
|
}
|
|
107
195
|
);
|
|
108
196
|
}
|
|
109
|
-
function
|
|
197
|
+
function Xa({ className: t, ...r }) {
|
|
110
198
|
return /* @__PURE__ */ e(
|
|
111
199
|
"div",
|
|
112
200
|
{
|
|
113
201
|
"data-slot": "card",
|
|
114
|
-
className:
|
|
202
|
+
className: w(
|
|
115
203
|
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
116
204
|
t
|
|
117
205
|
),
|
|
@@ -119,12 +207,12 @@ function qt({ className: t, ...r }) {
|
|
|
119
207
|
}
|
|
120
208
|
);
|
|
121
209
|
}
|
|
122
|
-
function
|
|
210
|
+
function Ya({ className: t, ...r }) {
|
|
123
211
|
return /* @__PURE__ */ e(
|
|
124
212
|
"div",
|
|
125
213
|
{
|
|
126
214
|
"data-slot": "card-header",
|
|
127
|
-
className:
|
|
215
|
+
className: w(
|
|
128
216
|
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
129
217
|
t
|
|
130
218
|
),
|
|
@@ -132,32 +220,32 @@ function er({ className: t, ...r }) {
|
|
|
132
220
|
}
|
|
133
221
|
);
|
|
134
222
|
}
|
|
135
|
-
function
|
|
223
|
+
function Za({ className: t, ...r }) {
|
|
136
224
|
return /* @__PURE__ */ e(
|
|
137
225
|
"div",
|
|
138
226
|
{
|
|
139
227
|
"data-slot": "card-title",
|
|
140
|
-
className:
|
|
228
|
+
className: w("leading-none font-semibold", t),
|
|
141
229
|
...r
|
|
142
230
|
}
|
|
143
231
|
);
|
|
144
232
|
}
|
|
145
|
-
function
|
|
233
|
+
function Ja({ className: t, ...r }) {
|
|
146
234
|
return /* @__PURE__ */ e(
|
|
147
235
|
"div",
|
|
148
236
|
{
|
|
149
237
|
"data-slot": "card-description",
|
|
150
|
-
className:
|
|
238
|
+
className: w("text-muted-foreground text-sm", t),
|
|
151
239
|
...r
|
|
152
240
|
}
|
|
153
241
|
);
|
|
154
242
|
}
|
|
155
|
-
function
|
|
243
|
+
function qa({ className: t, ...r }) {
|
|
156
244
|
return /* @__PURE__ */ e(
|
|
157
245
|
"div",
|
|
158
246
|
{
|
|
159
247
|
"data-slot": "card-action",
|
|
160
|
-
className:
|
|
248
|
+
className: w(
|
|
161
249
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
162
250
|
t
|
|
163
251
|
),
|
|
@@ -165,33 +253,33 @@ function nr({ className: t, ...r }) {
|
|
|
165
253
|
}
|
|
166
254
|
);
|
|
167
255
|
}
|
|
168
|
-
function
|
|
256
|
+
function ei({ className: t, ...r }) {
|
|
169
257
|
return /* @__PURE__ */ e(
|
|
170
258
|
"div",
|
|
171
259
|
{
|
|
172
260
|
"data-slot": "card-content",
|
|
173
|
-
className:
|
|
261
|
+
className: w("px-6", t),
|
|
174
262
|
...r
|
|
175
263
|
}
|
|
176
264
|
);
|
|
177
265
|
}
|
|
178
|
-
function
|
|
266
|
+
function ti({ className: t, ...r }) {
|
|
179
267
|
return /* @__PURE__ */ e(
|
|
180
268
|
"div",
|
|
181
269
|
{
|
|
182
270
|
"data-slot": "card-footer",
|
|
183
|
-
className:
|
|
271
|
+
className: w("flex items-center px-6 [.border-t]:pt-6", t),
|
|
184
272
|
...r
|
|
185
273
|
}
|
|
186
274
|
);
|
|
187
275
|
}
|
|
188
|
-
function
|
|
276
|
+
function ri({ className: t, type: r, ...n }) {
|
|
189
277
|
return /* @__PURE__ */ e(
|
|
190
278
|
"input",
|
|
191
279
|
{
|
|
192
280
|
type: r,
|
|
193
281
|
"data-slot": "input",
|
|
194
|
-
className:
|
|
282
|
+
className: w(
|
|
195
283
|
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
196
284
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
197
285
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
@@ -201,261 +289,347 @@ function sr({ className: t, type: r, ...n }) {
|
|
|
201
289
|
}
|
|
202
290
|
);
|
|
203
291
|
}
|
|
204
|
-
|
|
292
|
+
const wn = be.forwardRef(({ className: t, containerClassName: r, ...n }, a) => /* @__PURE__ */ e(
|
|
293
|
+
Vr,
|
|
294
|
+
{
|
|
295
|
+
ref: a,
|
|
296
|
+
containerClassName: w(
|
|
297
|
+
"flex items-center gap-2 has-[:disabled]:opacity-50",
|
|
298
|
+
r
|
|
299
|
+
),
|
|
300
|
+
className: w("disabled:cursor-not-allowed", t),
|
|
301
|
+
...n
|
|
302
|
+
}
|
|
303
|
+
));
|
|
304
|
+
wn.displayName = "InputOTP";
|
|
305
|
+
const kn = be.forwardRef(({ className: t, ...r }, n) => /* @__PURE__ */ e("div", { ref: n, className: w("flex items-center", t), ...r }));
|
|
306
|
+
kn.displayName = "InputOTPGroup";
|
|
307
|
+
const Cn = be.forwardRef(({ index: t, className: r, ...n }, a) => {
|
|
308
|
+
const i = be.useContext(Gr), { char: m, hasFakeCaret: d, isActive: o } = i.slots[t];
|
|
309
|
+
return /* @__PURE__ */ l(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
ref: a,
|
|
313
|
+
className: w(
|
|
314
|
+
"relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
|
|
315
|
+
o && "z-10 ring-1 ring-ring",
|
|
316
|
+
r
|
|
317
|
+
),
|
|
318
|
+
...n,
|
|
319
|
+
children: [
|
|
320
|
+
m,
|
|
321
|
+
d && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" }) })
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
);
|
|
325
|
+
});
|
|
326
|
+
Cn.displayName = "InputOTPSlot";
|
|
327
|
+
const Sn = be.forwardRef(({ ...t }, r) => /* @__PURE__ */ e("div", { ref: r, role: "separator", ...t, children: /* @__PURE__ */ e(Mt, {}) }));
|
|
328
|
+
Sn.displayName = "InputOTPSeparator";
|
|
329
|
+
function ni({
|
|
330
|
+
className: t,
|
|
331
|
+
defaultValue: r,
|
|
332
|
+
value: n,
|
|
333
|
+
min: a = 0,
|
|
334
|
+
max: i = 100,
|
|
335
|
+
...m
|
|
336
|
+
}) {
|
|
337
|
+
const d = n ?? r ?? [a];
|
|
338
|
+
return /* @__PURE__ */ l(
|
|
339
|
+
xe.Root,
|
|
340
|
+
{
|
|
341
|
+
"data-slot": "slider",
|
|
342
|
+
defaultValue: r,
|
|
343
|
+
value: n,
|
|
344
|
+
min: a,
|
|
345
|
+
max: i,
|
|
346
|
+
className: w(
|
|
347
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=horizontal]:h-5 data-[orientation=vertical]:w-5 data-[orientation=vertical]:flex-col",
|
|
348
|
+
t
|
|
349
|
+
),
|
|
350
|
+
...m,
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ e(
|
|
353
|
+
xe.Track,
|
|
354
|
+
{
|
|
355
|
+
"data-slot": "slider-track",
|
|
356
|
+
className: "bg-muted dark:bg-muted-foreground/25 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",
|
|
357
|
+
children: /* @__PURE__ */ e(
|
|
358
|
+
xe.Range,
|
|
359
|
+
{
|
|
360
|
+
"data-slot": "slider-range",
|
|
361
|
+
className: "bg-primary absolute rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
d.map((o, f) => /* @__PURE__ */ e(
|
|
367
|
+
xe.Thumb,
|
|
368
|
+
{
|
|
369
|
+
"data-slot": "slider-thumb",
|
|
370
|
+
className: "border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-none disabled:pointer-events-none"
|
|
371
|
+
},
|
|
372
|
+
f
|
|
373
|
+
))
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function q({
|
|
205
379
|
id: t,
|
|
206
380
|
label: r,
|
|
207
381
|
error: n,
|
|
208
382
|
helperText: a,
|
|
209
383
|
required: i,
|
|
210
|
-
disabled:
|
|
211
|
-
children:
|
|
212
|
-
className:
|
|
384
|
+
disabled: m,
|
|
385
|
+
children: d,
|
|
386
|
+
className: o
|
|
213
387
|
}) {
|
|
214
|
-
const
|
|
215
|
-
return /* @__PURE__ */
|
|
388
|
+
const f = de(), h = t ?? f, p = r ? `${h}-label` : void 0, u = n ? `${h}-error` : void 0, c = a && !n ? `${h}-helper` : void 0, s = [u, c].filter(Boolean).join(" ") || void 0;
|
|
389
|
+
return /* @__PURE__ */ l(
|
|
216
390
|
"div",
|
|
217
391
|
{
|
|
218
|
-
className:
|
|
219
|
-
"data-disabled":
|
|
392
|
+
className: w("space-y-2", o),
|
|
393
|
+
"data-disabled": m || void 0,
|
|
220
394
|
children: [
|
|
221
|
-
r && /* @__PURE__ */
|
|
395
|
+
r && /* @__PURE__ */ l(ue, { id: p, htmlFor: h, children: [
|
|
222
396
|
r,
|
|
223
397
|
i && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
|
|
224
398
|
] }),
|
|
225
|
-
|
|
226
|
-
n && /* @__PURE__ */ e("p", { id:
|
|
227
|
-
a && !n && /* @__PURE__ */ e("p", { id:
|
|
399
|
+
d({ id: h, labelId: p, describedBy: s }),
|
|
400
|
+
n && /* @__PURE__ */ e("p", { id: u, className: "text-sm text-destructive", role: "alert", children: n }),
|
|
401
|
+
a && !n && /* @__PURE__ */ e("p", { id: c, className: "text-sm text-muted-foreground", children: a })
|
|
228
402
|
]
|
|
229
403
|
}
|
|
230
404
|
);
|
|
231
405
|
}
|
|
232
|
-
function
|
|
406
|
+
function ai({
|
|
233
407
|
label: t,
|
|
234
408
|
error: r,
|
|
235
409
|
helperText: n,
|
|
236
410
|
required: a,
|
|
237
411
|
disabled: i,
|
|
238
|
-
id:
|
|
239
|
-
className:
|
|
240
|
-
...
|
|
412
|
+
id: m,
|
|
413
|
+
className: d,
|
|
414
|
+
...o
|
|
241
415
|
}) {
|
|
242
416
|
return /* @__PURE__ */ e(
|
|
243
|
-
|
|
417
|
+
q,
|
|
244
418
|
{
|
|
245
|
-
id:
|
|
419
|
+
id: m,
|
|
246
420
|
label: t,
|
|
247
421
|
error: r,
|
|
248
422
|
helperText: n,
|
|
249
423
|
required: a,
|
|
250
424
|
disabled: i,
|
|
251
|
-
className:
|
|
252
|
-
children: ({ id:
|
|
253
|
-
|
|
425
|
+
className: d,
|
|
426
|
+
children: ({ id: f, describedBy: h }) => /* @__PURE__ */ e(
|
|
427
|
+
ee,
|
|
254
428
|
{
|
|
255
|
-
id:
|
|
429
|
+
id: f,
|
|
256
430
|
"aria-invalid": !!r,
|
|
257
|
-
"aria-describedby":
|
|
431
|
+
"aria-describedby": h,
|
|
258
432
|
"aria-required": a,
|
|
259
433
|
disabled: i,
|
|
260
434
|
required: a,
|
|
261
|
-
...
|
|
435
|
+
...o
|
|
262
436
|
}
|
|
263
437
|
)
|
|
264
438
|
}
|
|
265
439
|
);
|
|
266
440
|
}
|
|
267
|
-
const
|
|
441
|
+
const zn = {
|
|
268
442
|
none: "resize-none",
|
|
269
443
|
vertical: "resize-y",
|
|
270
444
|
horizontal: "resize-x",
|
|
271
445
|
both: "resize"
|
|
272
446
|
};
|
|
273
|
-
function
|
|
447
|
+
function ii({
|
|
274
448
|
label: t,
|
|
275
449
|
error: r,
|
|
276
450
|
helperText: n,
|
|
277
451
|
required: a,
|
|
278
452
|
disabled: i,
|
|
279
|
-
id:
|
|
280
|
-
className:
|
|
281
|
-
resize:
|
|
282
|
-
...
|
|
453
|
+
id: m,
|
|
454
|
+
className: d,
|
|
455
|
+
resize: o = "vertical",
|
|
456
|
+
...f
|
|
283
457
|
}) {
|
|
284
458
|
return /* @__PURE__ */ e(
|
|
285
|
-
|
|
459
|
+
q,
|
|
286
460
|
{
|
|
287
|
-
id:
|
|
461
|
+
id: m,
|
|
288
462
|
label: t,
|
|
289
463
|
error: r,
|
|
290
464
|
helperText: n,
|
|
291
465
|
required: a,
|
|
292
466
|
disabled: i,
|
|
293
|
-
className:
|
|
294
|
-
children: ({ id:
|
|
295
|
-
|
|
467
|
+
className: d,
|
|
468
|
+
children: ({ id: h, describedBy: p }) => /* @__PURE__ */ e(
|
|
469
|
+
cn,
|
|
296
470
|
{
|
|
297
|
-
id:
|
|
471
|
+
id: h,
|
|
298
472
|
"aria-invalid": !!r,
|
|
299
473
|
"aria-describedby": p,
|
|
300
474
|
"aria-required": a,
|
|
301
475
|
disabled: i,
|
|
302
476
|
required: a,
|
|
303
|
-
className:
|
|
304
|
-
...
|
|
477
|
+
className: w(zn[o]),
|
|
478
|
+
...f
|
|
305
479
|
}
|
|
306
480
|
)
|
|
307
481
|
}
|
|
308
482
|
);
|
|
309
483
|
}
|
|
310
|
-
function
|
|
484
|
+
function si({
|
|
311
485
|
label: t,
|
|
312
486
|
error: r,
|
|
313
487
|
helperText: n,
|
|
314
488
|
required: a,
|
|
315
489
|
disabled: i,
|
|
316
|
-
id:
|
|
317
|
-
className:
|
|
318
|
-
showToggle:
|
|
319
|
-
...
|
|
490
|
+
id: m,
|
|
491
|
+
className: d,
|
|
492
|
+
showToggle: o = !0,
|
|
493
|
+
...f
|
|
320
494
|
}) {
|
|
321
|
-
const [
|
|
495
|
+
const [h, p] = R(!1);
|
|
322
496
|
return /* @__PURE__ */ e(
|
|
323
|
-
|
|
497
|
+
q,
|
|
324
498
|
{
|
|
325
|
-
id:
|
|
499
|
+
id: m,
|
|
326
500
|
label: t,
|
|
327
501
|
error: r,
|
|
328
502
|
helperText: n,
|
|
329
503
|
required: a,
|
|
330
504
|
disabled: i,
|
|
331
|
-
className:
|
|
332
|
-
children: ({ id:
|
|
505
|
+
className: d,
|
|
506
|
+
children: ({ id: u, describedBy: c }) => /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
333
507
|
/* @__PURE__ */ e(
|
|
334
|
-
|
|
508
|
+
ee,
|
|
335
509
|
{
|
|
336
|
-
id:
|
|
337
|
-
type:
|
|
510
|
+
id: u,
|
|
511
|
+
type: h ? "text" : "password",
|
|
338
512
|
"aria-invalid": !!r,
|
|
339
|
-
"aria-describedby":
|
|
513
|
+
"aria-describedby": c,
|
|
340
514
|
"aria-required": a,
|
|
341
515
|
disabled: i,
|
|
342
516
|
required: a,
|
|
343
|
-
className:
|
|
344
|
-
...
|
|
517
|
+
className: o ? "pr-10" : void 0,
|
|
518
|
+
...f
|
|
345
519
|
}
|
|
346
520
|
),
|
|
347
|
-
|
|
348
|
-
|
|
521
|
+
o && /* @__PURE__ */ e(
|
|
522
|
+
$,
|
|
349
523
|
{
|
|
350
524
|
type: "button",
|
|
351
525
|
variant: "ghost",
|
|
352
526
|
size: "icon-xs",
|
|
353
527
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
354
|
-
onClick: () => p((
|
|
528
|
+
onClick: () => p((s) => !s),
|
|
355
529
|
disabled: i,
|
|
356
|
-
"aria-label":
|
|
530
|
+
"aria-label": h ? "Hide password" : "Show password",
|
|
357
531
|
tabIndex: -1,
|
|
358
|
-
children:
|
|
532
|
+
children: h ? /* @__PURE__ */ e(Et, { className: "size-4" }) : /* @__PURE__ */ e(Pt, { className: "size-4" })
|
|
359
533
|
}
|
|
360
534
|
)
|
|
361
535
|
] })
|
|
362
536
|
}
|
|
363
537
|
);
|
|
364
538
|
}
|
|
365
|
-
function
|
|
539
|
+
function In(t, r, n) {
|
|
366
540
|
let a = t;
|
|
367
541
|
return r !== void 0 && a < r && (a = r), n !== void 0 && a > n && (a = n), a;
|
|
368
542
|
}
|
|
369
|
-
function
|
|
543
|
+
function oi({
|
|
370
544
|
label: t,
|
|
371
545
|
error: r,
|
|
372
546
|
helperText: n,
|
|
373
547
|
required: a,
|
|
374
548
|
disabled: i,
|
|
375
|
-
id:
|
|
376
|
-
className:
|
|
377
|
-
value:
|
|
378
|
-
defaultValue:
|
|
379
|
-
placeholder:
|
|
549
|
+
id: m,
|
|
550
|
+
className: d,
|
|
551
|
+
value: o,
|
|
552
|
+
defaultValue: f,
|
|
553
|
+
placeholder: h,
|
|
380
554
|
onChange: p,
|
|
381
|
-
onBlur:
|
|
382
|
-
min:
|
|
383
|
-
max:
|
|
384
|
-
step:
|
|
385
|
-
showStepper:
|
|
555
|
+
onBlur: u,
|
|
556
|
+
min: c,
|
|
557
|
+
max: s,
|
|
558
|
+
step: g = 1,
|
|
559
|
+
showStepper: x = !1
|
|
386
560
|
}) {
|
|
387
|
-
function
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
561
|
+
function N(S) {
|
|
562
|
+
const A = S.target.value;
|
|
563
|
+
if (A === "") {
|
|
390
564
|
p?.(void 0);
|
|
391
565
|
return;
|
|
392
566
|
}
|
|
393
|
-
const
|
|
394
|
-
isNaN(
|
|
567
|
+
const k = parseFloat(A);
|
|
568
|
+
isNaN(k) || p?.(k);
|
|
395
569
|
}
|
|
396
|
-
function
|
|
397
|
-
const
|
|
398
|
-
p?.(
|
|
570
|
+
function z(S) {
|
|
571
|
+
const k = In((typeof o == "number" ? o : f ?? 0) + g * S, c, s);
|
|
572
|
+
p?.(k);
|
|
399
573
|
}
|
|
400
574
|
return /* @__PURE__ */ e(
|
|
401
|
-
|
|
575
|
+
q,
|
|
402
576
|
{
|
|
403
|
-
id:
|
|
577
|
+
id: m,
|
|
404
578
|
label: t,
|
|
405
579
|
error: r,
|
|
406
580
|
helperText: n,
|
|
407
581
|
required: a,
|
|
408
582
|
disabled: i,
|
|
409
|
-
className:
|
|
410
|
-
children: ({ id:
|
|
583
|
+
className: d,
|
|
584
|
+
children: ({ id: S, describedBy: A }) => /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
411
585
|
/* @__PURE__ */ e(
|
|
412
|
-
|
|
586
|
+
ee,
|
|
413
587
|
{
|
|
414
|
-
id:
|
|
588
|
+
id: S,
|
|
415
589
|
type: "number",
|
|
416
590
|
"aria-invalid": !!r,
|
|
417
|
-
"aria-describedby":
|
|
591
|
+
"aria-describedby": A,
|
|
418
592
|
"aria-required": a,
|
|
419
593
|
disabled: i,
|
|
420
594
|
required: a,
|
|
421
|
-
value:
|
|
422
|
-
defaultValue:
|
|
423
|
-
placeholder:
|
|
424
|
-
onChange:
|
|
425
|
-
onBlur:
|
|
426
|
-
min:
|
|
427
|
-
max:
|
|
428
|
-
step:
|
|
429
|
-
className:
|
|
595
|
+
value: o ?? "",
|
|
596
|
+
defaultValue: f,
|
|
597
|
+
placeholder: h,
|
|
598
|
+
onChange: N,
|
|
599
|
+
onBlur: u,
|
|
600
|
+
min: c,
|
|
601
|
+
max: s,
|
|
602
|
+
step: g,
|
|
603
|
+
className: x ? "pr-9" : void 0
|
|
430
604
|
}
|
|
431
605
|
),
|
|
432
|
-
|
|
606
|
+
x && /* @__PURE__ */ l("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col", children: [
|
|
433
607
|
/* @__PURE__ */ e(
|
|
434
|
-
|
|
608
|
+
$,
|
|
435
609
|
{
|
|
436
610
|
type: "button",
|
|
437
611
|
variant: "ghost",
|
|
438
612
|
size: "icon-xs",
|
|
439
613
|
className: "h-5 w-7 text-muted-foreground hover:text-foreground",
|
|
440
|
-
onClick: () =>
|
|
441
|
-
disabled: i ||
|
|
614
|
+
onClick: () => z(1),
|
|
615
|
+
disabled: i || s !== void 0 && typeof o == "number" && o >= s,
|
|
442
616
|
"aria-label": "Increment",
|
|
443
617
|
tabIndex: -1,
|
|
444
|
-
children: /* @__PURE__ */ e(
|
|
618
|
+
children: /* @__PURE__ */ e(Dt, { className: "size-3" })
|
|
445
619
|
}
|
|
446
620
|
),
|
|
447
621
|
/* @__PURE__ */ e(
|
|
448
|
-
|
|
622
|
+
$,
|
|
449
623
|
{
|
|
450
624
|
type: "button",
|
|
451
625
|
variant: "ghost",
|
|
452
626
|
size: "icon-xs",
|
|
453
627
|
className: "h-5 w-7 text-muted-foreground hover:text-foreground",
|
|
454
|
-
onClick: () =>
|
|
455
|
-
disabled: i ||
|
|
628
|
+
onClick: () => z(-1),
|
|
629
|
+
disabled: i || c !== void 0 && typeof o == "number" && o <= c,
|
|
456
630
|
"aria-label": "Decrement",
|
|
457
631
|
tabIndex: -1,
|
|
458
|
-
children: /* @__PURE__ */ e(
|
|
632
|
+
children: /* @__PURE__ */ e(Ut, { className: "size-3" })
|
|
459
633
|
}
|
|
460
634
|
)
|
|
461
635
|
] })
|
|
@@ -463,132 +637,132 @@ function dr({
|
|
|
463
637
|
}
|
|
464
638
|
);
|
|
465
639
|
}
|
|
466
|
-
function
|
|
640
|
+
function li({
|
|
467
641
|
label: t,
|
|
468
642
|
error: r,
|
|
469
643
|
helperText: n,
|
|
470
644
|
required: a,
|
|
471
645
|
disabled: i,
|
|
472
|
-
id:
|
|
473
|
-
className:
|
|
474
|
-
checked:
|
|
475
|
-
defaultChecked:
|
|
476
|
-
onCheckedChange:
|
|
646
|
+
id: m,
|
|
647
|
+
className: d,
|
|
648
|
+
checked: o,
|
|
649
|
+
defaultChecked: f,
|
|
650
|
+
onCheckedChange: h
|
|
477
651
|
}) {
|
|
478
|
-
const p =
|
|
479
|
-
return /* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */
|
|
652
|
+
const p = de(), u = m ?? p, c = r ? `${u}-error` : void 0;
|
|
653
|
+
return /* @__PURE__ */ l("div", { className: w("space-y-1.5", d), children: [
|
|
654
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
481
655
|
/* @__PURE__ */ e(
|
|
482
|
-
|
|
656
|
+
Pe,
|
|
483
657
|
{
|
|
484
|
-
id:
|
|
485
|
-
checked:
|
|
486
|
-
defaultChecked:
|
|
487
|
-
onCheckedChange: (
|
|
658
|
+
id: u,
|
|
659
|
+
checked: o,
|
|
660
|
+
defaultChecked: f,
|
|
661
|
+
onCheckedChange: (s) => h?.(s === !0),
|
|
488
662
|
disabled: i,
|
|
489
663
|
required: a,
|
|
490
664
|
"aria-invalid": !!r,
|
|
491
|
-
"aria-describedby":
|
|
665
|
+
"aria-describedby": c
|
|
492
666
|
}
|
|
493
667
|
),
|
|
494
|
-
t && /* @__PURE__ */
|
|
668
|
+
t && /* @__PURE__ */ l(ue, { htmlFor: u, className: "cursor-pointer", children: [
|
|
495
669
|
t,
|
|
496
670
|
a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
|
|
497
671
|
] })
|
|
498
672
|
] }),
|
|
499
|
-
r && /* @__PURE__ */ e("p", { id:
|
|
673
|
+
r && /* @__PURE__ */ e("p", { id: c, className: "text-sm text-destructive", role: "alert", children: r }),
|
|
500
674
|
n && !r && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: n })
|
|
501
675
|
] });
|
|
502
676
|
}
|
|
503
|
-
function
|
|
677
|
+
function ci({
|
|
504
678
|
label: t,
|
|
505
679
|
error: r,
|
|
506
680
|
helperText: n,
|
|
507
681
|
required: a,
|
|
508
682
|
disabled: i,
|
|
509
|
-
id:
|
|
510
|
-
className:
|
|
511
|
-
checked:
|
|
512
|
-
defaultChecked:
|
|
513
|
-
onCheckedChange:
|
|
683
|
+
id: m,
|
|
684
|
+
className: d,
|
|
685
|
+
checked: o,
|
|
686
|
+
defaultChecked: f,
|
|
687
|
+
onCheckedChange: h
|
|
514
688
|
}) {
|
|
515
|
-
const p =
|
|
516
|
-
return /* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
689
|
+
const p = de(), u = m ?? p, c = r ? `${u}-error` : void 0;
|
|
690
|
+
return /* @__PURE__ */ l("div", { className: w("space-y-1.5", d), children: [
|
|
691
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
518
692
|
/* @__PURE__ */ e(
|
|
519
|
-
|
|
693
|
+
ln,
|
|
520
694
|
{
|
|
521
|
-
id:
|
|
522
|
-
checked:
|
|
523
|
-
defaultChecked:
|
|
524
|
-
onCheckedChange:
|
|
695
|
+
id: u,
|
|
696
|
+
checked: o,
|
|
697
|
+
defaultChecked: f,
|
|
698
|
+
onCheckedChange: h,
|
|
525
699
|
disabled: i,
|
|
526
700
|
required: a,
|
|
527
701
|
"aria-invalid": !!r,
|
|
528
|
-
"aria-describedby":
|
|
702
|
+
"aria-describedby": c
|
|
529
703
|
}
|
|
530
704
|
),
|
|
531
|
-
t && /* @__PURE__ */
|
|
705
|
+
t && /* @__PURE__ */ l(ue, { htmlFor: u, className: "cursor-pointer", children: [
|
|
532
706
|
t,
|
|
533
707
|
a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
|
|
534
708
|
] })
|
|
535
709
|
] }),
|
|
536
|
-
r && /* @__PURE__ */ e("p", { id:
|
|
710
|
+
r && /* @__PURE__ */ e("p", { id: c, className: "text-sm text-destructive", role: "alert", children: r }),
|
|
537
711
|
n && !r && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: n })
|
|
538
712
|
] });
|
|
539
713
|
}
|
|
540
|
-
function
|
|
714
|
+
function di({
|
|
541
715
|
label: t,
|
|
542
716
|
error: r,
|
|
543
717
|
helperText: n,
|
|
544
718
|
required: a,
|
|
545
719
|
disabled: i,
|
|
546
|
-
id:
|
|
547
|
-
className:
|
|
548
|
-
value:
|
|
549
|
-
defaultValue:
|
|
550
|
-
onChange:
|
|
720
|
+
id: m,
|
|
721
|
+
className: d,
|
|
722
|
+
value: o,
|
|
723
|
+
defaultValue: f = "#000000",
|
|
724
|
+
onChange: h,
|
|
551
725
|
showHexInput: p = !0
|
|
552
726
|
}) {
|
|
553
727
|
return /* @__PURE__ */ e(
|
|
554
|
-
|
|
728
|
+
q,
|
|
555
729
|
{
|
|
556
|
-
id:
|
|
730
|
+
id: m,
|
|
557
731
|
label: t,
|
|
558
732
|
error: r,
|
|
559
733
|
helperText: n,
|
|
560
734
|
required: a,
|
|
561
735
|
disabled: i,
|
|
562
|
-
className:
|
|
563
|
-
children: ({ id:
|
|
736
|
+
className: d,
|
|
737
|
+
children: ({ id: u, describedBy: c }) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
564
738
|
/* @__PURE__ */ e(
|
|
565
739
|
"label",
|
|
566
740
|
{
|
|
567
|
-
htmlFor:
|
|
568
|
-
className:
|
|
741
|
+
htmlFor: u,
|
|
742
|
+
className: w(
|
|
569
743
|
"relative size-9 shrink-0 cursor-pointer overflow-hidden rounded-md border border-input shadow-xs",
|
|
570
744
|
i && "cursor-not-allowed opacity-50"
|
|
571
745
|
),
|
|
572
746
|
children: /* @__PURE__ */ e(
|
|
573
747
|
"input",
|
|
574
748
|
{
|
|
575
|
-
id:
|
|
749
|
+
id: u,
|
|
576
750
|
type: "color",
|
|
577
|
-
value:
|
|
578
|
-
onChange: (
|
|
751
|
+
value: o ?? f,
|
|
752
|
+
onChange: (s) => h?.(s.target.value),
|
|
579
753
|
disabled: i,
|
|
580
754
|
"aria-invalid": !!r,
|
|
581
|
-
"aria-describedby":
|
|
755
|
+
"aria-describedby": c,
|
|
582
756
|
className: "absolute inset-0 size-full cursor-pointer border-0 p-0"
|
|
583
757
|
}
|
|
584
758
|
)
|
|
585
759
|
}
|
|
586
760
|
),
|
|
587
761
|
p && /* @__PURE__ */ e(
|
|
588
|
-
|
|
762
|
+
ee,
|
|
589
763
|
{
|
|
590
|
-
value:
|
|
591
|
-
onChange: (
|
|
764
|
+
value: o ?? f,
|
|
765
|
+
onChange: (s) => h?.(s.target.value),
|
|
592
766
|
disabled: i,
|
|
593
767
|
placeholder: "#000000",
|
|
594
768
|
maxLength: 7,
|
|
@@ -600,289 +774,289 @@ function fr({
|
|
|
600
774
|
}
|
|
601
775
|
);
|
|
602
776
|
}
|
|
603
|
-
function
|
|
777
|
+
function Rn({
|
|
604
778
|
options: t,
|
|
605
779
|
value: r,
|
|
606
780
|
onChange: n,
|
|
607
781
|
placeholder: a,
|
|
608
782
|
disabled: i,
|
|
609
|
-
required:
|
|
610
|
-
fieldId:
|
|
611
|
-
describedBy:
|
|
612
|
-
error:
|
|
783
|
+
required: m,
|
|
784
|
+
fieldId: d,
|
|
785
|
+
describedBy: o,
|
|
786
|
+
error: f
|
|
613
787
|
}) {
|
|
614
|
-
return /* @__PURE__ */
|
|
615
|
-
|
|
788
|
+
return /* @__PURE__ */ l(
|
|
789
|
+
tn,
|
|
616
790
|
{
|
|
617
791
|
value: r,
|
|
618
|
-
onValueChange: (
|
|
792
|
+
onValueChange: (h) => n?.(h),
|
|
619
793
|
disabled: i,
|
|
620
|
-
required:
|
|
794
|
+
required: m,
|
|
621
795
|
children: [
|
|
622
796
|
/* @__PURE__ */ e(
|
|
623
|
-
|
|
797
|
+
rn,
|
|
624
798
|
{
|
|
625
|
-
id:
|
|
799
|
+
id: d,
|
|
626
800
|
className: "w-full",
|
|
627
|
-
"aria-invalid": !!
|
|
628
|
-
"aria-describedby":
|
|
629
|
-
children: /* @__PURE__ */ e(
|
|
801
|
+
"aria-invalid": !!f,
|
|
802
|
+
"aria-describedby": o,
|
|
803
|
+
children: /* @__PURE__ */ e(nn, { placeholder: a ?? "Select an option..." })
|
|
630
804
|
}
|
|
631
805
|
),
|
|
632
|
-
/* @__PURE__ */ e(
|
|
633
|
-
|
|
806
|
+
/* @__PURE__ */ e(an, { children: t.map((h) => /* @__PURE__ */ e(
|
|
807
|
+
sn,
|
|
634
808
|
{
|
|
635
|
-
value:
|
|
636
|
-
disabled:
|
|
637
|
-
children:
|
|
809
|
+
value: h.value,
|
|
810
|
+
disabled: h.disabled,
|
|
811
|
+
children: h.label
|
|
638
812
|
},
|
|
639
|
-
|
|
813
|
+
h.value
|
|
640
814
|
)) })
|
|
641
815
|
]
|
|
642
816
|
}
|
|
643
817
|
);
|
|
644
818
|
}
|
|
645
|
-
function
|
|
819
|
+
function An({
|
|
646
820
|
options: t,
|
|
647
821
|
value: r = [],
|
|
648
822
|
onChange: n,
|
|
649
823
|
placeholder: a,
|
|
650
824
|
disabled: i,
|
|
651
|
-
fieldId:
|
|
652
|
-
describedBy:
|
|
653
|
-
error:
|
|
825
|
+
fieldId: m,
|
|
826
|
+
describedBy: d,
|
|
827
|
+
error: o
|
|
654
828
|
}) {
|
|
655
|
-
const [
|
|
656
|
-
function
|
|
657
|
-
const
|
|
658
|
-
n?.(
|
|
829
|
+
const [f, h] = R(!1), p = Array.isArray(r) ? r : [];
|
|
830
|
+
function u(s) {
|
|
831
|
+
const g = p.includes(s) ? p.filter((x) => x !== s) : [...p, s];
|
|
832
|
+
n?.(g);
|
|
659
833
|
}
|
|
660
|
-
function
|
|
661
|
-
n?.(p.filter((
|
|
834
|
+
function c(s) {
|
|
835
|
+
n?.(p.filter((g) => g !== s));
|
|
662
836
|
}
|
|
663
|
-
return /* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */ e(
|
|
665
|
-
|
|
837
|
+
return /* @__PURE__ */ l(me, { open: f, onOpenChange: h, children: [
|
|
838
|
+
/* @__PURE__ */ e(fe, { asChild: !0, children: /* @__PURE__ */ l(
|
|
839
|
+
$,
|
|
666
840
|
{
|
|
667
|
-
id:
|
|
841
|
+
id: m,
|
|
668
842
|
variant: "outline",
|
|
669
843
|
role: "combobox",
|
|
670
|
-
"aria-expanded":
|
|
671
|
-
"aria-invalid": !!
|
|
672
|
-
"aria-describedby":
|
|
844
|
+
"aria-expanded": f,
|
|
845
|
+
"aria-invalid": !!o,
|
|
846
|
+
"aria-describedby": d,
|
|
673
847
|
disabled: i,
|
|
674
848
|
className: "w-full justify-between font-normal h-auto min-h-9",
|
|
675
849
|
children: [
|
|
676
|
-
/* @__PURE__ */
|
|
850
|
+
/* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: [
|
|
677
851
|
p.length === 0 && /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: a ?? "Select options..." }),
|
|
678
|
-
p.map((
|
|
679
|
-
const
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
|
|
852
|
+
p.map((s) => {
|
|
853
|
+
const g = t.find((x) => x.value === s);
|
|
854
|
+
return /* @__PURE__ */ l(bt, { variant: "secondary", className: "gap-1", children: [
|
|
855
|
+
g?.label ?? s,
|
|
682
856
|
/* @__PURE__ */ e(
|
|
683
857
|
"span",
|
|
684
858
|
{
|
|
685
859
|
role: "button",
|
|
686
860
|
tabIndex: 0,
|
|
687
861
|
className: "ml-0.5 rounded-full outline-none hover:bg-muted-foreground/20 cursor-pointer",
|
|
688
|
-
onClick: (
|
|
689
|
-
|
|
862
|
+
onClick: (x) => {
|
|
863
|
+
x.stopPropagation(), c(s);
|
|
690
864
|
},
|
|
691
|
-
onKeyDown: (
|
|
692
|
-
(
|
|
865
|
+
onKeyDown: (x) => {
|
|
866
|
+
(x.key === "Enter" || x.key === " ") && (x.stopPropagation(), c(s));
|
|
693
867
|
},
|
|
694
|
-
"aria-label": `Remove ${
|
|
695
|
-
children: /* @__PURE__ */ e(
|
|
868
|
+
"aria-label": `Remove ${g?.label ?? s}`,
|
|
869
|
+
children: /* @__PURE__ */ e(ke, { className: "size-3" })
|
|
696
870
|
}
|
|
697
871
|
)
|
|
698
|
-
] },
|
|
872
|
+
] }, s);
|
|
699
873
|
})
|
|
700
874
|
] }),
|
|
701
|
-
/* @__PURE__ */ e(
|
|
875
|
+
/* @__PURE__ */ e(Le, { className: "ml-2 size-4 shrink-0 opacity-50" })
|
|
702
876
|
]
|
|
703
877
|
}
|
|
704
878
|
) }),
|
|
705
|
-
/* @__PURE__ */ e(
|
|
879
|
+
/* @__PURE__ */ e(he, { className: "w-(--radix-popover-trigger-width) p-1", children: t.map((s) => /* @__PURE__ */ l(
|
|
706
880
|
"button",
|
|
707
881
|
{
|
|
708
882
|
type: "button",
|
|
709
|
-
className:
|
|
883
|
+
className: w(
|
|
710
884
|
"relative flex w-full cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
|
|
711
|
-
|
|
885
|
+
s.disabled && "pointer-events-none opacity-50"
|
|
712
886
|
),
|
|
713
|
-
onClick: () =>
|
|
714
|
-
disabled:
|
|
887
|
+
onClick: () => u(s.value),
|
|
888
|
+
disabled: s.disabled,
|
|
715
889
|
children: [
|
|
716
890
|
/* @__PURE__ */ e(
|
|
717
891
|
"div",
|
|
718
892
|
{
|
|
719
|
-
className:
|
|
893
|
+
className: w(
|
|
720
894
|
"flex size-4 items-center justify-center rounded-sm border border-primary",
|
|
721
|
-
p.includes(
|
|
895
|
+
p.includes(s.value) ? "bg-primary text-primary-foreground" : "opacity-50"
|
|
722
896
|
),
|
|
723
|
-
children: p.includes(
|
|
897
|
+
children: p.includes(s.value) && /* @__PURE__ */ e(nt, { className: "size-3" })
|
|
724
898
|
}
|
|
725
899
|
),
|
|
726
|
-
|
|
900
|
+
s.label
|
|
727
901
|
]
|
|
728
902
|
},
|
|
729
|
-
|
|
903
|
+
s.value
|
|
730
904
|
)) })
|
|
731
905
|
] });
|
|
732
906
|
}
|
|
733
|
-
function
|
|
907
|
+
function ui({
|
|
734
908
|
label: t,
|
|
735
909
|
error: r,
|
|
736
910
|
helperText: n,
|
|
737
911
|
required: a,
|
|
738
912
|
disabled: i,
|
|
739
|
-
id:
|
|
740
|
-
className:
|
|
741
|
-
options:
|
|
742
|
-
value:
|
|
743
|
-
onChange:
|
|
913
|
+
id: m,
|
|
914
|
+
className: d,
|
|
915
|
+
options: o,
|
|
916
|
+
value: f,
|
|
917
|
+
onChange: h,
|
|
744
918
|
placeholder: p,
|
|
745
|
-
multiple:
|
|
919
|
+
multiple: u = !1
|
|
746
920
|
}) {
|
|
747
|
-
const
|
|
748
|
-
return /* @__PURE__ */
|
|
749
|
-
t && /* @__PURE__ */
|
|
921
|
+
const c = de(), s = m ?? c, g = r ? `${s}-error` : void 0, x = n && !r ? `${s}-helper` : void 0, N = [g, x].filter(Boolean).join(" ") || void 0;
|
|
922
|
+
return /* @__PURE__ */ l("div", { className: w("space-y-2", d), children: [
|
|
923
|
+
t && /* @__PURE__ */ l(ue, { htmlFor: s, children: [
|
|
750
924
|
t,
|
|
751
925
|
a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
|
|
752
926
|
] }),
|
|
753
|
-
|
|
754
|
-
|
|
927
|
+
u ? /* @__PURE__ */ e(
|
|
928
|
+
An,
|
|
755
929
|
{
|
|
756
|
-
options:
|
|
757
|
-
value: Array.isArray(
|
|
758
|
-
onChange:
|
|
930
|
+
options: o,
|
|
931
|
+
value: Array.isArray(f) ? f : [],
|
|
932
|
+
onChange: h,
|
|
759
933
|
placeholder: p,
|
|
760
934
|
disabled: i,
|
|
761
|
-
fieldId:
|
|
762
|
-
describedBy:
|
|
935
|
+
fieldId: s,
|
|
936
|
+
describedBy: N,
|
|
763
937
|
error: r
|
|
764
938
|
}
|
|
765
939
|
) : /* @__PURE__ */ e(
|
|
766
|
-
|
|
940
|
+
Rn,
|
|
767
941
|
{
|
|
768
|
-
options:
|
|
769
|
-
value: typeof
|
|
770
|
-
onChange:
|
|
942
|
+
options: o,
|
|
943
|
+
value: typeof f == "string" ? f : void 0,
|
|
944
|
+
onChange: h,
|
|
771
945
|
placeholder: p,
|
|
772
946
|
disabled: i,
|
|
773
947
|
required: a,
|
|
774
|
-
fieldId:
|
|
775
|
-
describedBy:
|
|
948
|
+
fieldId: s,
|
|
949
|
+
describedBy: N,
|
|
776
950
|
error: r
|
|
777
951
|
}
|
|
778
952
|
),
|
|
779
|
-
r && /* @__PURE__ */ e("p", { id:
|
|
780
|
-
n && !r && /* @__PURE__ */ e("p", { id:
|
|
953
|
+
r && /* @__PURE__ */ e("p", { id: g, className: "text-sm text-destructive", role: "alert", children: r }),
|
|
954
|
+
n && !r && /* @__PURE__ */ e("p", { id: x, className: "text-sm text-muted-foreground", children: n })
|
|
781
955
|
] });
|
|
782
956
|
}
|
|
783
|
-
const
|
|
784
|
-
function
|
|
957
|
+
const Tn = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
958
|
+
function mi({
|
|
785
959
|
label: t,
|
|
786
960
|
error: r,
|
|
787
961
|
helperText: n,
|
|
788
962
|
required: a,
|
|
789
963
|
disabled: i,
|
|
790
|
-
id:
|
|
791
|
-
className:
|
|
792
|
-
validateOnBlur:
|
|
793
|
-
onBlur:
|
|
794
|
-
...
|
|
964
|
+
id: m,
|
|
965
|
+
className: d,
|
|
966
|
+
validateOnBlur: o = !0,
|
|
967
|
+
onBlur: f,
|
|
968
|
+
...h
|
|
795
969
|
}) {
|
|
796
|
-
const [p,
|
|
797
|
-
function
|
|
798
|
-
|
|
970
|
+
const [p, u] = R(), c = r ?? p;
|
|
971
|
+
function s(g) {
|
|
972
|
+
o && g.target.value && !Tn.test(g.target.value) ? u("Please enter a valid email address") : u(void 0), f?.(g);
|
|
799
973
|
}
|
|
800
974
|
return /* @__PURE__ */ e(
|
|
801
|
-
|
|
975
|
+
q,
|
|
802
976
|
{
|
|
803
|
-
id:
|
|
977
|
+
id: m,
|
|
804
978
|
label: t,
|
|
805
|
-
error:
|
|
979
|
+
error: c,
|
|
806
980
|
helperText: n,
|
|
807
981
|
required: a,
|
|
808
982
|
disabled: i,
|
|
809
|
-
className:
|
|
810
|
-
children: ({ id:
|
|
811
|
-
/* @__PURE__ */ e(
|
|
983
|
+
className: d,
|
|
984
|
+
children: ({ id: g, describedBy: x }) => /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
985
|
+
/* @__PURE__ */ e($t, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
812
986
|
/* @__PURE__ */ e(
|
|
813
|
-
|
|
987
|
+
ee,
|
|
814
988
|
{
|
|
815
|
-
id:
|
|
989
|
+
id: g,
|
|
816
990
|
type: "email",
|
|
817
|
-
"aria-invalid": !!
|
|
818
|
-
"aria-describedby":
|
|
991
|
+
"aria-invalid": !!c,
|
|
992
|
+
"aria-describedby": x,
|
|
819
993
|
"aria-required": a,
|
|
820
994
|
disabled: i,
|
|
821
995
|
required: a,
|
|
822
|
-
onBlur:
|
|
996
|
+
onBlur: s,
|
|
823
997
|
className: "pl-9",
|
|
824
|
-
...
|
|
998
|
+
...h
|
|
825
999
|
}
|
|
826
1000
|
)
|
|
827
1001
|
] })
|
|
828
1002
|
}
|
|
829
1003
|
);
|
|
830
1004
|
}
|
|
831
|
-
function
|
|
1005
|
+
function Ln(t) {
|
|
832
1006
|
try {
|
|
833
1007
|
return new URL(t), !0;
|
|
834
1008
|
} catch {
|
|
835
1009
|
return !1;
|
|
836
1010
|
}
|
|
837
1011
|
}
|
|
838
|
-
function
|
|
1012
|
+
function fi({
|
|
839
1013
|
label: t,
|
|
840
1014
|
error: r,
|
|
841
1015
|
helperText: n,
|
|
842
1016
|
required: a,
|
|
843
1017
|
disabled: i,
|
|
844
|
-
id:
|
|
845
|
-
className:
|
|
846
|
-
validateOnBlur:
|
|
847
|
-
onBlur:
|
|
848
|
-
...
|
|
1018
|
+
id: m,
|
|
1019
|
+
className: d,
|
|
1020
|
+
validateOnBlur: o = !0,
|
|
1021
|
+
onBlur: f,
|
|
1022
|
+
...h
|
|
849
1023
|
}) {
|
|
850
|
-
const [p,
|
|
851
|
-
function
|
|
852
|
-
|
|
1024
|
+
const [p, u] = R(), c = r ?? p;
|
|
1025
|
+
function s(g) {
|
|
1026
|
+
o && g.target.value && !Ln(g.target.value) ? u("Please enter a valid URL") : u(void 0), f?.(g);
|
|
853
1027
|
}
|
|
854
1028
|
return /* @__PURE__ */ e(
|
|
855
|
-
|
|
1029
|
+
q,
|
|
856
1030
|
{
|
|
857
|
-
id:
|
|
1031
|
+
id: m,
|
|
858
1032
|
label: t,
|
|
859
|
-
error:
|
|
1033
|
+
error: c,
|
|
860
1034
|
helperText: n,
|
|
861
1035
|
required: a,
|
|
862
1036
|
disabled: i,
|
|
863
|
-
className:
|
|
864
|
-
children: ({ id:
|
|
865
|
-
/* @__PURE__ */ e(
|
|
1037
|
+
className: d,
|
|
1038
|
+
children: ({ id: g, describedBy: x }) => /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
1039
|
+
/* @__PURE__ */ e(Bt, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
866
1040
|
/* @__PURE__ */ e(
|
|
867
|
-
|
|
1041
|
+
ee,
|
|
868
1042
|
{
|
|
869
|
-
id:
|
|
1043
|
+
id: g,
|
|
870
1044
|
type: "url",
|
|
871
|
-
"aria-invalid": !!
|
|
872
|
-
"aria-describedby":
|
|
1045
|
+
"aria-invalid": !!c,
|
|
1046
|
+
"aria-describedby": x,
|
|
873
1047
|
"aria-required": a,
|
|
874
1048
|
disabled: i,
|
|
875
1049
|
required: a,
|
|
876
|
-
onBlur:
|
|
1050
|
+
onBlur: s,
|
|
877
1051
|
className: "pl-9",
|
|
878
|
-
...
|
|
1052
|
+
...h
|
|
879
1053
|
}
|
|
880
1054
|
)
|
|
881
1055
|
] })
|
|
882
1056
|
}
|
|
883
1057
|
);
|
|
884
1058
|
}
|
|
885
|
-
const
|
|
1059
|
+
const Mn = [
|
|
886
1060
|
{ code: "KE", dialCode: "+254", name: "Kenya", flag: "🇰🇪" },
|
|
887
1061
|
{ code: "UG", dialCode: "+256", name: "Uganda", flag: "🇺🇬" },
|
|
888
1062
|
{ code: "TZ", dialCode: "+255", name: "Tanzania", flag: "🇹🇿" },
|
|
@@ -899,214 +1073,214 @@ const yt = [
|
|
|
899
1073
|
{ code: "DE", dialCode: "+49", name: "Germany", flag: "🇩🇪" },
|
|
900
1074
|
{ code: "FR", dialCode: "+33", name: "France", flag: "🇫🇷" }
|
|
901
1075
|
];
|
|
902
|
-
function
|
|
1076
|
+
function hi({
|
|
903
1077
|
label: t,
|
|
904
1078
|
error: r,
|
|
905
1079
|
helperText: n,
|
|
906
1080
|
required: a,
|
|
907
1081
|
disabled: i,
|
|
908
|
-
id:
|
|
909
|
-
className:
|
|
910
|
-
value:
|
|
911
|
-
onChange:
|
|
912
|
-
defaultCountry:
|
|
913
|
-
countries: p =
|
|
914
|
-
placeholder:
|
|
1082
|
+
id: m,
|
|
1083
|
+
className: d,
|
|
1084
|
+
value: o,
|
|
1085
|
+
onChange: f,
|
|
1086
|
+
defaultCountry: h = "KE",
|
|
1087
|
+
countries: p = Mn,
|
|
1088
|
+
placeholder: u
|
|
915
1089
|
}) {
|
|
916
|
-
const
|
|
917
|
-
() => p.find((
|
|
918
|
-
), [
|
|
919
|
-
(
|
|
1090
|
+
const c = de(), s = m ?? c, g = r ? `${s}-error` : void 0, x = n && !r ? `${s}-helper` : void 0, N = [g, x].filter(Boolean).join(" ") || void 0, [z, S] = R(!1), [A, k] = R(
|
|
1091
|
+
() => p.find((C) => C.code === h) ?? p[0]
|
|
1092
|
+
), [P, D] = R(""), T = p.filter(
|
|
1093
|
+
(C) => C.name.toLowerCase().includes(P.toLowerCase()) || C.dialCode.includes(P) || C.code.toLowerCase().includes(P.toLowerCase())
|
|
920
1094
|
);
|
|
921
|
-
function
|
|
922
|
-
|
|
1095
|
+
function B(C) {
|
|
1096
|
+
f?.(C.target.value, A);
|
|
923
1097
|
}
|
|
924
|
-
function
|
|
925
|
-
|
|
1098
|
+
function L(C) {
|
|
1099
|
+
k(C), S(!1), D(""), f?.(o ?? "", C);
|
|
926
1100
|
}
|
|
927
|
-
return /* @__PURE__ */
|
|
928
|
-
t && /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ l("div", { className: w("space-y-2", d), children: [
|
|
1102
|
+
t && /* @__PURE__ */ l(ue, { htmlFor: s, children: [
|
|
929
1103
|
t,
|
|
930
1104
|
a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
|
|
931
1105
|
] }),
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */ e(
|
|
935
|
-
|
|
1106
|
+
/* @__PURE__ */ l("div", { className: "flex gap-1", children: [
|
|
1107
|
+
/* @__PURE__ */ l(me, { open: z, onOpenChange: S, children: [
|
|
1108
|
+
/* @__PURE__ */ e(fe, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1109
|
+
$,
|
|
936
1110
|
{
|
|
937
1111
|
variant: "outline",
|
|
938
1112
|
role: "combobox",
|
|
939
|
-
"aria-expanded":
|
|
1113
|
+
"aria-expanded": z,
|
|
940
1114
|
"aria-label": "Select country code",
|
|
941
1115
|
disabled: i,
|
|
942
1116
|
className: "w-auto shrink-0 gap-1 px-2",
|
|
943
1117
|
children: [
|
|
944
|
-
/* @__PURE__ */ e("span", { className: "text-base leading-none", children:
|
|
945
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children:
|
|
946
|
-
/* @__PURE__ */ e(
|
|
1118
|
+
/* @__PURE__ */ e("span", { className: "text-base leading-none", children: A.flag }),
|
|
1119
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: A.dialCode }),
|
|
1120
|
+
/* @__PURE__ */ e(Le, { className: "size-3 opacity-50" })
|
|
947
1121
|
]
|
|
948
1122
|
}
|
|
949
1123
|
) }),
|
|
950
|
-
/* @__PURE__ */
|
|
1124
|
+
/* @__PURE__ */ l(he, { className: "w-64 max-w-[calc(100vw-2rem)] p-0", align: "start", children: [
|
|
951
1125
|
/* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
|
|
952
|
-
|
|
1126
|
+
ee,
|
|
953
1127
|
{
|
|
954
1128
|
placeholder: "Search countries...",
|
|
955
|
-
value:
|
|
956
|
-
onChange: (
|
|
1129
|
+
value: P,
|
|
1130
|
+
onChange: (C) => D(C.target.value),
|
|
957
1131
|
className: "h-8"
|
|
958
1132
|
}
|
|
959
1133
|
) }),
|
|
960
|
-
/* @__PURE__ */
|
|
961
|
-
|
|
1134
|
+
/* @__PURE__ */ l("div", { className: "max-h-48 overflow-y-auto p-1", children: [
|
|
1135
|
+
T.map((C) => /* @__PURE__ */ l(
|
|
962
1136
|
"button",
|
|
963
1137
|
{
|
|
964
1138
|
type: "button",
|
|
965
|
-
className:
|
|
1139
|
+
className: w(
|
|
966
1140
|
"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
|
|
967
|
-
|
|
1141
|
+
A.code === C.code && "bg-accent"
|
|
968
1142
|
),
|
|
969
|
-
onClick: () =>
|
|
1143
|
+
onClick: () => L(C),
|
|
970
1144
|
children: [
|
|
971
|
-
/* @__PURE__ */ e("span", { className: "text-base leading-none", children:
|
|
972
|
-
/* @__PURE__ */ e("span", { className: "flex-1 text-left truncate", children:
|
|
973
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children:
|
|
1145
|
+
/* @__PURE__ */ e("span", { className: "text-base leading-none", children: C.flag }),
|
|
1146
|
+
/* @__PURE__ */ e("span", { className: "flex-1 text-left truncate", children: C.name }),
|
|
1147
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: C.dialCode })
|
|
974
1148
|
]
|
|
975
1149
|
},
|
|
976
|
-
|
|
1150
|
+
C.code
|
|
977
1151
|
)),
|
|
978
|
-
|
|
1152
|
+
T.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-4 text-center text-sm text-muted-foreground", children: "No countries found" })
|
|
979
1153
|
] })
|
|
980
1154
|
] })
|
|
981
1155
|
] }),
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */ e(
|
|
1156
|
+
/* @__PURE__ */ l("div", { className: "relative flex-1", children: [
|
|
1157
|
+
/* @__PURE__ */ e(Ot, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
|
|
984
1158
|
/* @__PURE__ */ e(
|
|
985
|
-
|
|
1159
|
+
ee,
|
|
986
1160
|
{
|
|
987
|
-
id:
|
|
1161
|
+
id: s,
|
|
988
1162
|
type: "tel",
|
|
989
|
-
value:
|
|
990
|
-
onChange:
|
|
991
|
-
placeholder:
|
|
1163
|
+
value: o,
|
|
1164
|
+
onChange: B,
|
|
1165
|
+
placeholder: u ?? "Phone number",
|
|
992
1166
|
disabled: i,
|
|
993
1167
|
required: a,
|
|
994
1168
|
"aria-invalid": !!r,
|
|
995
|
-
"aria-describedby":
|
|
1169
|
+
"aria-describedby": N,
|
|
996
1170
|
className: "pl-9"
|
|
997
1171
|
}
|
|
998
1172
|
)
|
|
999
1173
|
] })
|
|
1000
1174
|
] }),
|
|
1001
|
-
r && /* @__PURE__ */ e("p", { id:
|
|
1002
|
-
n && !r && /* @__PURE__ */ e("p", { id:
|
|
1175
|
+
r && /* @__PURE__ */ e("p", { id: g, className: "text-sm text-destructive", role: "alert", children: r }),
|
|
1176
|
+
n && !r && /* @__PURE__ */ e("p", { id: x, className: "text-sm text-muted-foreground", children: n })
|
|
1003
1177
|
] });
|
|
1004
1178
|
}
|
|
1005
|
-
function
|
|
1179
|
+
function pi({
|
|
1006
1180
|
mode: t = "single",
|
|
1007
1181
|
numberOfMonths: r = 1,
|
|
1008
1182
|
value: n,
|
|
1009
1183
|
onChange: a,
|
|
1010
1184
|
placeholder: i = "Pick a date",
|
|
1011
|
-
fromDate:
|
|
1012
|
-
toDate:
|
|
1013
|
-
label:
|
|
1014
|
-
error:
|
|
1015
|
-
helperText:
|
|
1185
|
+
fromDate: m,
|
|
1186
|
+
toDate: d,
|
|
1187
|
+
label: o,
|
|
1188
|
+
error: f,
|
|
1189
|
+
helperText: h,
|
|
1016
1190
|
required: p,
|
|
1017
|
-
disabled:
|
|
1018
|
-
id:
|
|
1019
|
-
className:
|
|
1191
|
+
disabled: u,
|
|
1192
|
+
id: c,
|
|
1193
|
+
className: s
|
|
1020
1194
|
}) {
|
|
1021
|
-
const [
|
|
1195
|
+
const [g, x] = R(!1), N = () => {
|
|
1022
1196
|
if (!n) return i;
|
|
1023
1197
|
if (t === "single" && n instanceof Date)
|
|
1024
|
-
return
|
|
1198
|
+
return ye(n, "MMM d, yyyy");
|
|
1025
1199
|
if (t === "multiple" && Array.isArray(n)) {
|
|
1026
|
-
const
|
|
1027
|
-
return
|
|
1200
|
+
const k = n.length;
|
|
1201
|
+
return k > 0 ? `${k} date${k === 1 ? "" : "s"} selected` : i;
|
|
1028
1202
|
}
|
|
1029
1203
|
if (t === "range" && n && typeof n == "object" && "from" in n) {
|
|
1030
|
-
const { from:
|
|
1031
|
-
if (
|
|
1032
|
-
return `${
|
|
1033
|
-
if (
|
|
1034
|
-
return
|
|
1204
|
+
const { from: k, to: P } = n;
|
|
1205
|
+
if (k && P)
|
|
1206
|
+
return `${ye(k, "MMM d")} - ${ye(P, "MMM d, yyyy")}`;
|
|
1207
|
+
if (k)
|
|
1208
|
+
return ye(k, "MMM d, yyyy");
|
|
1035
1209
|
}
|
|
1036
1210
|
return i;
|
|
1037
1211
|
};
|
|
1038
|
-
function
|
|
1039
|
-
a?.(
|
|
1212
|
+
function z(k) {
|
|
1213
|
+
a?.(k), x(!1);
|
|
1040
1214
|
}
|
|
1041
|
-
function
|
|
1042
|
-
a?.(
|
|
1215
|
+
function S(k) {
|
|
1216
|
+
a?.(k);
|
|
1043
1217
|
}
|
|
1044
|
-
function
|
|
1045
|
-
a?.(
|
|
1218
|
+
function A(k) {
|
|
1219
|
+
a?.(k);
|
|
1046
1220
|
}
|
|
1047
1221
|
return /* @__PURE__ */ e(
|
|
1048
|
-
|
|
1222
|
+
q,
|
|
1049
1223
|
{
|
|
1050
|
-
id:
|
|
1051
|
-
label:
|
|
1052
|
-
error:
|
|
1053
|
-
helperText:
|
|
1224
|
+
id: c,
|
|
1225
|
+
label: o,
|
|
1226
|
+
error: f,
|
|
1227
|
+
helperText: h,
|
|
1054
1228
|
required: p,
|
|
1055
|
-
disabled:
|
|
1056
|
-
className:
|
|
1057
|
-
children: ({ id:
|
|
1058
|
-
/* @__PURE__ */ e(
|
|
1059
|
-
|
|
1229
|
+
disabled: u,
|
|
1230
|
+
className: s,
|
|
1231
|
+
children: ({ id: k, describedBy: P }) => /* @__PURE__ */ l(me, { open: g, onOpenChange: x, children: [
|
|
1232
|
+
/* @__PURE__ */ e(fe, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1233
|
+
$,
|
|
1060
1234
|
{
|
|
1061
|
-
id:
|
|
1235
|
+
id: k,
|
|
1062
1236
|
variant: "outline",
|
|
1063
|
-
disabled:
|
|
1064
|
-
"aria-describedby":
|
|
1065
|
-
className:
|
|
1237
|
+
disabled: u,
|
|
1238
|
+
"aria-describedby": P,
|
|
1239
|
+
className: w(
|
|
1066
1240
|
"w-full justify-start text-left font-normal",
|
|
1067
1241
|
!n && "text-muted-foreground"
|
|
1068
1242
|
),
|
|
1069
1243
|
children: [
|
|
1070
|
-
/* @__PURE__ */ e(
|
|
1071
|
-
|
|
1244
|
+
/* @__PURE__ */ e(Ft, {}),
|
|
1245
|
+
N()
|
|
1072
1246
|
]
|
|
1073
1247
|
}
|
|
1074
1248
|
) }),
|
|
1075
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ l(he, { className: "w-auto p-0", align: "start", children: [
|
|
1076
1250
|
t === "single" && /* @__PURE__ */ e(
|
|
1077
|
-
|
|
1251
|
+
Ae,
|
|
1078
1252
|
{
|
|
1079
1253
|
mode: "single",
|
|
1080
1254
|
selected: n instanceof Date ? n : void 0,
|
|
1081
|
-
onSelect:
|
|
1255
|
+
onSelect: z,
|
|
1082
1256
|
numberOfMonths: r,
|
|
1083
|
-
fromDate:
|
|
1084
|
-
toDate:
|
|
1085
|
-
disabled:
|
|
1257
|
+
fromDate: m,
|
|
1258
|
+
toDate: d,
|
|
1259
|
+
disabled: u
|
|
1086
1260
|
}
|
|
1087
1261
|
),
|
|
1088
1262
|
t === "multiple" && /* @__PURE__ */ e(
|
|
1089
|
-
|
|
1263
|
+
Ae,
|
|
1090
1264
|
{
|
|
1091
1265
|
mode: "multiple",
|
|
1092
1266
|
selected: Array.isArray(n) ? n : void 0,
|
|
1093
|
-
onSelect:
|
|
1267
|
+
onSelect: S,
|
|
1094
1268
|
numberOfMonths: r,
|
|
1095
|
-
fromDate:
|
|
1096
|
-
toDate:
|
|
1097
|
-
disabled:
|
|
1269
|
+
fromDate: m,
|
|
1270
|
+
toDate: d,
|
|
1271
|
+
disabled: u
|
|
1098
1272
|
}
|
|
1099
1273
|
),
|
|
1100
1274
|
t === "range" && /* @__PURE__ */ e(
|
|
1101
|
-
|
|
1275
|
+
Ae,
|
|
1102
1276
|
{
|
|
1103
1277
|
mode: "range",
|
|
1104
1278
|
selected: n && typeof n == "object" && "from" in n ? n : void 0,
|
|
1105
|
-
onSelect:
|
|
1279
|
+
onSelect: A,
|
|
1106
1280
|
numberOfMonths: r,
|
|
1107
|
-
fromDate:
|
|
1108
|
-
toDate:
|
|
1109
|
-
disabled:
|
|
1281
|
+
fromDate: m,
|
|
1282
|
+
toDate: d,
|
|
1283
|
+
disabled: u
|
|
1110
1284
|
}
|
|
1111
1285
|
)
|
|
1112
1286
|
] })
|
|
@@ -1114,134 +1288,134 @@ function xr({
|
|
|
1114
1288
|
}
|
|
1115
1289
|
);
|
|
1116
1290
|
}
|
|
1117
|
-
function
|
|
1291
|
+
function gi({
|
|
1118
1292
|
label: t,
|
|
1119
1293
|
error: r,
|
|
1120
1294
|
helperText: n,
|
|
1121
1295
|
required: a,
|
|
1122
1296
|
disabled: i,
|
|
1123
|
-
id:
|
|
1124
|
-
className:
|
|
1125
|
-
value:
|
|
1126
|
-
onChange:
|
|
1127
|
-
format:
|
|
1297
|
+
id: m,
|
|
1298
|
+
className: d,
|
|
1299
|
+
value: o,
|
|
1300
|
+
onChange: f,
|
|
1301
|
+
format: h = "24h",
|
|
1128
1302
|
minuteStep: p = 1,
|
|
1129
|
-
placeholder:
|
|
1303
|
+
placeholder: u = "Select time"
|
|
1130
1304
|
}) {
|
|
1131
|
-
const [
|
|
1132
|
-
if (!
|
|
1133
|
-
const [v,
|
|
1134
|
-
return isNaN(v) || isNaN(
|
|
1135
|
-
},
|
|
1136
|
-
if (!
|
|
1137
|
-
const v = y
|
|
1138
|
-
if (!v) return
|
|
1139
|
-
if (
|
|
1305
|
+
const [c, s] = R(!1), g = (y) => {
|
|
1306
|
+
if (!y) return null;
|
|
1307
|
+
const [v, b] = y.split(":").map(Number);
|
|
1308
|
+
return isNaN(v) || isNaN(b) ? null : { hour: v, minute: b };
|
|
1309
|
+
}, x = g(o), N = (y) => {
|
|
1310
|
+
if (!y) return u;
|
|
1311
|
+
const v = g(y);
|
|
1312
|
+
if (!v) return u;
|
|
1313
|
+
if (h === "24h")
|
|
1140
1314
|
return `${String(v.hour).padStart(2, "0")}:${String(v.minute).padStart(2, "0")}`;
|
|
1141
1315
|
{
|
|
1142
|
-
const
|
|
1143
|
-
return `${v.hour % 12 || 12}:${String(v.minute).padStart(2, "0")} ${
|
|
1316
|
+
const b = v.hour >= 12 ? "PM" : "AM";
|
|
1317
|
+
return `${v.hour % 12 || 12}:${String(v.minute).padStart(2, "0")} ${b}`;
|
|
1144
1318
|
}
|
|
1145
|
-
},
|
|
1319
|
+
}, z = h === "24h" ? Array.from({ length: 24 }, (y, v) => v) : Array.from({ length: 12 }, (y, v) => v + 1), S = Array.from(
|
|
1146
1320
|
{ length: Math.ceil(60 / p) },
|
|
1147
|
-
(
|
|
1148
|
-
), [
|
|
1149
|
-
|
|
1150
|
-
),
|
|
1151
|
-
let v =
|
|
1152
|
-
|
|
1153
|
-
},
|
|
1154
|
-
|
|
1155
|
-
},
|
|
1156
|
-
if (
|
|
1157
|
-
let v =
|
|
1158
|
-
if (
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1321
|
+
(y, v) => v * p
|
|
1322
|
+
), [A, k] = R(x?.hour ?? null), [P, D] = R(x?.minute ?? null), [T, B] = R(
|
|
1323
|
+
x && x.hour >= 12 ? "PM" : "AM"
|
|
1324
|
+
), L = (y) => {
|
|
1325
|
+
let v = y;
|
|
1326
|
+
h === "12h" && (T === "PM" && y !== 12 ? v = y + 12 : T === "AM" && y === 12 && (v = 0)), k(v), _(v, P);
|
|
1327
|
+
}, C = (y) => {
|
|
1328
|
+
D(y), _(A, y);
|
|
1329
|
+
}, M = (y) => {
|
|
1330
|
+
if (B(y), A !== null) {
|
|
1331
|
+
let v = A;
|
|
1332
|
+
if (h === "12h") {
|
|
1333
|
+
const b = A % 12 || 12;
|
|
1334
|
+
y === "PM" && b !== 12 ? v = b + 12 : y === "AM" && b === 12 ? v = 0 : y === "AM" ? v = b : v = b === 12 ? 12 : b + 12;
|
|
1161
1335
|
}
|
|
1162
|
-
|
|
1336
|
+
k(v), _(v, P);
|
|
1163
1337
|
}
|
|
1164
|
-
},
|
|
1165
|
-
if (
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1338
|
+
}, _ = (y, v) => {
|
|
1339
|
+
if (y !== null && v !== null && f) {
|
|
1340
|
+
const b = `${String(y).padStart(2, "0")}:${String(v).padStart(2, "0")}`;
|
|
1341
|
+
f(b);
|
|
1168
1342
|
}
|
|
1169
1343
|
};
|
|
1170
1344
|
return /* @__PURE__ */ e(
|
|
1171
|
-
|
|
1345
|
+
dn,
|
|
1172
1346
|
{
|
|
1173
|
-
id:
|
|
1347
|
+
id: m,
|
|
1174
1348
|
label: t,
|
|
1175
1349
|
error: r,
|
|
1176
1350
|
helperText: n,
|
|
1177
1351
|
required: a,
|
|
1178
1352
|
disabled: i,
|
|
1179
|
-
className:
|
|
1180
|
-
children: ({ id:
|
|
1181
|
-
/* @__PURE__ */ e(
|
|
1182
|
-
|
|
1353
|
+
className: d,
|
|
1354
|
+
children: ({ id: y, describedBy: v }) => /* @__PURE__ */ l(me, { open: c, onOpenChange: s, children: [
|
|
1355
|
+
/* @__PURE__ */ e(fe, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1356
|
+
$,
|
|
1183
1357
|
{
|
|
1184
|
-
id:
|
|
1358
|
+
id: y,
|
|
1185
1359
|
"aria-describedby": v,
|
|
1186
1360
|
variant: "outline",
|
|
1187
|
-
className:
|
|
1361
|
+
className: w(
|
|
1188
1362
|
"w-full justify-start text-left font-normal",
|
|
1189
|
-
!
|
|
1363
|
+
!o && "text-muted-foreground"
|
|
1190
1364
|
),
|
|
1191
1365
|
disabled: i,
|
|
1192
1366
|
children: [
|
|
1193
|
-
/* @__PURE__ */ e(
|
|
1194
|
-
|
|
1367
|
+
/* @__PURE__ */ e(_t, { className: "mr-2 size-4" }),
|
|
1368
|
+
N(o)
|
|
1195
1369
|
]
|
|
1196
1370
|
}
|
|
1197
1371
|
) }),
|
|
1198
|
-
/* @__PURE__ */ e(
|
|
1199
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ e(he, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ l("div", { className: "flex w-fit", children: [
|
|
1373
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col border-r w-14", children: [
|
|
1200
1374
|
/* @__PURE__ */ e("div", { className: "py-1.5 text-xs font-medium border-b text-muted-foreground text-center", children: "Hr" }),
|
|
1201
|
-
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-y-auto", children:
|
|
1202
|
-
const
|
|
1375
|
+
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-y-auto", children: z.map((b) => {
|
|
1376
|
+
const O = h === "24h" ? b : T === "PM" && b !== 12 ? b + 12 : T === "AM" && b === 12 ? 0 : b;
|
|
1203
1377
|
return /* @__PURE__ */ e(
|
|
1204
1378
|
"button",
|
|
1205
1379
|
{
|
|
1206
1380
|
type: "button",
|
|
1207
|
-
onClick: () =>
|
|
1208
|
-
className:
|
|
1381
|
+
onClick: () => L(b),
|
|
1382
|
+
className: w(
|
|
1209
1383
|
"w-full py-1.5 text-sm hover:bg-accent text-center transition-colors",
|
|
1210
|
-
|
|
1384
|
+
A === O && "bg-primary/10 text-primary font-medium"
|
|
1211
1385
|
),
|
|
1212
|
-
children: String(
|
|
1386
|
+
children: String(b).padStart(2, "0")
|
|
1213
1387
|
},
|
|
1214
|
-
|
|
1388
|
+
b
|
|
1215
1389
|
);
|
|
1216
1390
|
}) })
|
|
1217
1391
|
] }),
|
|
1218
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ l("div", { className: w("flex flex-col w-14", h === "12h" && "border-r"), children: [
|
|
1219
1393
|
/* @__PURE__ */ e("div", { className: "py-1.5 text-xs font-medium border-b text-muted-foreground text-center", children: "Min" }),
|
|
1220
|
-
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-y-auto", children:
|
|
1394
|
+
/* @__PURE__ */ e("div", { className: "max-h-[200px] overflow-y-auto", children: S.map((b) => /* @__PURE__ */ e(
|
|
1221
1395
|
"button",
|
|
1222
1396
|
{
|
|
1223
1397
|
type: "button",
|
|
1224
|
-
onClick: () =>
|
|
1225
|
-
className:
|
|
1398
|
+
onClick: () => C(b),
|
|
1399
|
+
className: w(
|
|
1226
1400
|
"w-full py-1.5 text-sm hover:bg-accent text-center transition-colors",
|
|
1227
|
-
|
|
1401
|
+
P === b && "bg-primary/10 text-primary font-medium"
|
|
1228
1402
|
),
|
|
1229
|
-
children: String(
|
|
1403
|
+
children: String(b).padStart(2, "0")
|
|
1230
1404
|
},
|
|
1231
|
-
|
|
1405
|
+
b
|
|
1232
1406
|
)) })
|
|
1233
1407
|
] }),
|
|
1234
|
-
|
|
1408
|
+
h === "12h" && /* @__PURE__ */ l("div", { className: "flex flex-col w-14", children: [
|
|
1235
1409
|
/* @__PURE__ */ e("div", { className: "py-1.5 text-xs font-medium border-b text-muted-foreground text-center", children: " " }),
|
|
1236
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col", children: [
|
|
1237
1411
|
/* @__PURE__ */ e(
|
|
1238
1412
|
"button",
|
|
1239
1413
|
{
|
|
1240
1414
|
type: "button",
|
|
1241
|
-
onClick: () =>
|
|
1242
|
-
className:
|
|
1415
|
+
onClick: () => M("AM"),
|
|
1416
|
+
className: w(
|
|
1243
1417
|
"py-1.5 text-sm hover:bg-accent text-center transition-colors",
|
|
1244
|
-
|
|
1418
|
+
T === "AM" && "bg-primary/10 text-primary font-medium"
|
|
1245
1419
|
),
|
|
1246
1420
|
children: "AM"
|
|
1247
1421
|
}
|
|
@@ -1250,10 +1424,10 @@ function br({
|
|
|
1250
1424
|
"button",
|
|
1251
1425
|
{
|
|
1252
1426
|
type: "button",
|
|
1253
|
-
onClick: () =>
|
|
1254
|
-
className:
|
|
1427
|
+
onClick: () => M("PM"),
|
|
1428
|
+
className: w(
|
|
1255
1429
|
"py-1.5 text-sm hover:bg-accent text-center transition-colors",
|
|
1256
|
-
|
|
1430
|
+
T === "PM" && "bg-primary/10 text-primary font-medium"
|
|
1257
1431
|
),
|
|
1258
1432
|
children: "PM"
|
|
1259
1433
|
}
|
|
@@ -1265,119 +1439,119 @@ function br({
|
|
|
1265
1439
|
}
|
|
1266
1440
|
);
|
|
1267
1441
|
}
|
|
1268
|
-
function
|
|
1442
|
+
function qe(t) {
|
|
1269
1443
|
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
|
|
1270
1444
|
}
|
|
1271
|
-
function
|
|
1445
|
+
function En(t) {
|
|
1272
1446
|
const r = t.type;
|
|
1273
|
-
return r.startsWith("image/") ? /* @__PURE__ */ e(
|
|
1447
|
+
return r.startsWith("image/") ? /* @__PURE__ */ e(Kt, { className: "size-4 text-blue-700 dark:text-blue-400", "aria-hidden": "true" }) : r === "application/pdf" || t.name.endsWith(".pdf") ? /* @__PURE__ */ e(Ht, { className: "size-4 text-red-700 dark:text-red-400", "aria-hidden": "true" }) : r.includes("spreadsheet") || r.includes("csv") || r.includes("excel") || t.name.match(/\.(csv|xlsx?|xls)$/i) ? /* @__PURE__ */ e(Vt, { className: "size-4 text-green-700 dark:text-green-400", "aria-hidden": "true" }) : /* @__PURE__ */ e(Gt, { className: "size-4 text-muted-foreground", "aria-hidden": "true" });
|
|
1274
1448
|
}
|
|
1275
|
-
function
|
|
1449
|
+
function bi({
|
|
1276
1450
|
label: t,
|
|
1277
1451
|
error: r,
|
|
1278
1452
|
helperText: n,
|
|
1279
1453
|
required: a,
|
|
1280
1454
|
disabled: i,
|
|
1281
|
-
id:
|
|
1282
|
-
className:
|
|
1283
|
-
value:
|
|
1284
|
-
onChange:
|
|
1285
|
-
accept:
|
|
1455
|
+
id: m,
|
|
1456
|
+
className: d,
|
|
1457
|
+
value: o,
|
|
1458
|
+
onChange: f,
|
|
1459
|
+
accept: h,
|
|
1286
1460
|
multiple: p = !1,
|
|
1287
|
-
maxSize:
|
|
1288
|
-
maxFiles:
|
|
1461
|
+
maxSize: u,
|
|
1462
|
+
maxFiles: c
|
|
1289
1463
|
}) {
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
const
|
|
1293
|
-
return
|
|
1294
|
-
if (
|
|
1464
|
+
const s = F(null), [g, x] = R(!1), [N, z] = R(), [S, A] = R(/* @__PURE__ */ new Map()), k = ne(() => o ?? [], [o]), P = r ?? N;
|
|
1465
|
+
X(() => {
|
|
1466
|
+
const y = /* @__PURE__ */ new Map(), v = [];
|
|
1467
|
+
return S.forEach((b) => v.push(b)), k.forEach((b) => {
|
|
1468
|
+
if (b.type.startsWith("image/"))
|
|
1295
1469
|
try {
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1470
|
+
const O = URL.createObjectURL(b);
|
|
1471
|
+
y.set(b.name, O);
|
|
1298
1472
|
} catch {
|
|
1299
1473
|
}
|
|
1300
|
-
}),
|
|
1301
|
-
v.forEach((
|
|
1474
|
+
}), A(y), () => {
|
|
1475
|
+
v.forEach((b) => {
|
|
1302
1476
|
try {
|
|
1303
|
-
URL.revokeObjectURL(
|
|
1477
|
+
URL.revokeObjectURL(b);
|
|
1304
1478
|
} catch {
|
|
1305
1479
|
}
|
|
1306
|
-
}),
|
|
1480
|
+
}), y.forEach((b) => {
|
|
1307
1481
|
try {
|
|
1308
|
-
URL.revokeObjectURL(
|
|
1482
|
+
URL.revokeObjectURL(b);
|
|
1309
1483
|
} catch {
|
|
1310
1484
|
}
|
|
1311
1485
|
});
|
|
1312
1486
|
};
|
|
1313
|
-
}, [
|
|
1314
|
-
function
|
|
1315
|
-
if (
|
|
1316
|
-
const v =
|
|
1487
|
+
}, [k]);
|
|
1488
|
+
function D(y) {
|
|
1489
|
+
if (u) {
|
|
1490
|
+
const v = y.find((b) => b.size > u);
|
|
1317
1491
|
if (v)
|
|
1318
|
-
return `File "${v.name}" exceeds maximum size of ${
|
|
1492
|
+
return `File "${v.name}" exceeds maximum size of ${qe(u)}`;
|
|
1319
1493
|
}
|
|
1320
|
-
if (
|
|
1321
|
-
return `Maximum ${
|
|
1494
|
+
if (c && k.length + y.length > c)
|
|
1495
|
+
return `Maximum ${c} files allowed`;
|
|
1322
1496
|
}
|
|
1323
|
-
function
|
|
1324
|
-
if (!
|
|
1325
|
-
const v = Array.from(
|
|
1326
|
-
if (
|
|
1327
|
-
|
|
1497
|
+
function T(y) {
|
|
1498
|
+
if (!y || y.length === 0) return;
|
|
1499
|
+
const v = Array.from(y), b = D(v);
|
|
1500
|
+
if (b) {
|
|
1501
|
+
z(b);
|
|
1328
1502
|
return;
|
|
1329
1503
|
}
|
|
1330
|
-
|
|
1504
|
+
z(void 0), f?.(p ? [...k, ...v] : v.slice(0, 1)), s.current && (s.current.value = "");
|
|
1331
1505
|
}
|
|
1332
|
-
function
|
|
1333
|
-
const v =
|
|
1334
|
-
|
|
1506
|
+
function B(y) {
|
|
1507
|
+
const v = k.filter((b, O) => O !== y);
|
|
1508
|
+
f?.(v), z(void 0);
|
|
1335
1509
|
}
|
|
1336
|
-
function
|
|
1337
|
-
|
|
1510
|
+
function L(y) {
|
|
1511
|
+
y.preventDefault(), y.stopPropagation(), i || x(!0);
|
|
1338
1512
|
}
|
|
1339
|
-
function
|
|
1340
|
-
|
|
1513
|
+
function C(y) {
|
|
1514
|
+
y.preventDefault(), y.stopPropagation();
|
|
1341
1515
|
}
|
|
1342
|
-
function
|
|
1343
|
-
|
|
1516
|
+
function M(y) {
|
|
1517
|
+
y.preventDefault(), y.stopPropagation(), x(!1);
|
|
1344
1518
|
}
|
|
1345
|
-
function
|
|
1346
|
-
|
|
1519
|
+
function _(y) {
|
|
1520
|
+
y.preventDefault(), y.stopPropagation(), x(!1), i || T(y.dataTransfer.files);
|
|
1347
1521
|
}
|
|
1348
1522
|
return /* @__PURE__ */ e(
|
|
1349
|
-
|
|
1523
|
+
q,
|
|
1350
1524
|
{
|
|
1351
|
-
id:
|
|
1525
|
+
id: m,
|
|
1352
1526
|
label: t,
|
|
1353
|
-
error:
|
|
1527
|
+
error: P,
|
|
1354
1528
|
helperText: n,
|
|
1355
1529
|
required: a,
|
|
1356
1530
|
disabled: i,
|
|
1357
|
-
className:
|
|
1358
|
-
children: ({ id:
|
|
1359
|
-
/* @__PURE__ */
|
|
1531
|
+
className: d,
|
|
1532
|
+
children: ({ id: y, describedBy: v }) => /* @__PURE__ */ l("div", { className: "space-y-4", children: [
|
|
1533
|
+
/* @__PURE__ */ l(
|
|
1360
1534
|
"label",
|
|
1361
1535
|
{
|
|
1362
|
-
htmlFor:
|
|
1363
|
-
className:
|
|
1536
|
+
htmlFor: y,
|
|
1537
|
+
className: w(
|
|
1364
1538
|
"flex flex-col items-center justify-center rounded-md border-2 border-dashed p-4 sm:p-8 transition-colors cursor-pointer",
|
|
1365
|
-
|
|
1539
|
+
g && !i ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
|
|
1366
1540
|
i && "opacity-50 cursor-not-allowed"
|
|
1367
1541
|
),
|
|
1368
|
-
onDragEnter:
|
|
1369
|
-
onDragOver:
|
|
1370
|
-
onDragLeave:
|
|
1371
|
-
onDrop:
|
|
1542
|
+
onDragEnter: L,
|
|
1543
|
+
onDragOver: C,
|
|
1544
|
+
onDragLeave: M,
|
|
1545
|
+
onDrop: _,
|
|
1372
1546
|
children: [
|
|
1373
|
-
/* @__PURE__ */ e(
|
|
1374
|
-
/* @__PURE__ */
|
|
1547
|
+
/* @__PURE__ */ e(jt, { className: "size-8 text-muted-foreground mb-4", "aria-hidden": "true" }),
|
|
1548
|
+
/* @__PURE__ */ l("p", { className: "text-sm text-center text-foreground font-medium", children: [
|
|
1375
1549
|
/* @__PURE__ */ e("span", { className: "sm:hidden", children: "Tap to browse files" }),
|
|
1376
1550
|
/* @__PURE__ */ e("span", { className: "hidden sm:inline", children: "Drag & drop files here, or click to browse" })
|
|
1377
1551
|
] }),
|
|
1378
|
-
|
|
1552
|
+
h && /* @__PURE__ */ l("p", { className: "text-xs text-muted-foreground mt-2", children: [
|
|
1379
1553
|
"Accepted formats: ",
|
|
1380
|
-
|
|
1554
|
+
h
|
|
1381
1555
|
] })
|
|
1382
1556
|
]
|
|
1383
1557
|
}
|
|
@@ -1385,229 +1559,229 @@ function yr({
|
|
|
1385
1559
|
/* @__PURE__ */ e(
|
|
1386
1560
|
"input",
|
|
1387
1561
|
{
|
|
1388
|
-
ref:
|
|
1389
|
-
id:
|
|
1562
|
+
ref: s,
|
|
1563
|
+
id: y,
|
|
1390
1564
|
type: "file",
|
|
1391
|
-
accept:
|
|
1565
|
+
accept: h,
|
|
1392
1566
|
multiple: p,
|
|
1393
1567
|
disabled: i,
|
|
1394
1568
|
required: a,
|
|
1395
|
-
"aria-invalid": !!
|
|
1569
|
+
"aria-invalid": !!P,
|
|
1396
1570
|
"aria-describedby": v,
|
|
1397
1571
|
"aria-required": a,
|
|
1398
|
-
onChange: (
|
|
1572
|
+
onChange: (b) => T(b.target.files),
|
|
1399
1573
|
className: "sr-only"
|
|
1400
1574
|
}
|
|
1401
1575
|
),
|
|
1402
|
-
|
|
1403
|
-
const
|
|
1404
|
-
return /* @__PURE__ */
|
|
1576
|
+
k.length > 0 && /* @__PURE__ */ e("ul", { className: "space-y-2", role: "list", children: k.map((b, O) => {
|
|
1577
|
+
const J = S.get(b.name);
|
|
1578
|
+
return /* @__PURE__ */ l(
|
|
1405
1579
|
"li",
|
|
1406
1580
|
{
|
|
1407
1581
|
className: "flex items-center gap-3 rounded-md border p-3",
|
|
1408
1582
|
children: [
|
|
1409
|
-
|
|
1583
|
+
J ? /* @__PURE__ */ e(
|
|
1410
1584
|
"img",
|
|
1411
1585
|
{
|
|
1412
|
-
src:
|
|
1413
|
-
alt:
|
|
1586
|
+
src: J,
|
|
1587
|
+
alt: b.name,
|
|
1414
1588
|
className: "size-10 rounded object-cover",
|
|
1415
|
-
"data-testid": `file-icon-${
|
|
1589
|
+
"data-testid": `file-icon-${b.name}`
|
|
1416
1590
|
}
|
|
1417
|
-
) : /* @__PURE__ */ e("div", { "data-testid": `file-icon-${
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium truncate", children:
|
|
1420
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children:
|
|
1591
|
+
) : /* @__PURE__ */ e("div", { "data-testid": `file-icon-${b.name}`, children: En(b) }),
|
|
1592
|
+
/* @__PURE__ */ l("div", { className: "flex-1 min-w-0", children: [
|
|
1593
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium truncate", children: b.name }),
|
|
1594
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: qe(b.size) })
|
|
1421
1595
|
] }),
|
|
1422
1596
|
/* @__PURE__ */ e(
|
|
1423
|
-
|
|
1597
|
+
$,
|
|
1424
1598
|
{
|
|
1425
1599
|
type: "button",
|
|
1426
1600
|
variant: "ghost",
|
|
1427
1601
|
size: "icon-sm",
|
|
1428
|
-
onClick: (
|
|
1429
|
-
|
|
1602
|
+
onClick: (Q) => {
|
|
1603
|
+
Q.stopPropagation(), B(O);
|
|
1430
1604
|
},
|
|
1431
1605
|
disabled: i,
|
|
1432
|
-
"aria-label": `Remove ${
|
|
1433
|
-
children: /* @__PURE__ */ e(
|
|
1606
|
+
"aria-label": `Remove ${b.name}`,
|
|
1607
|
+
children: /* @__PURE__ */ e(ke, { className: "size-4" })
|
|
1434
1608
|
}
|
|
1435
1609
|
)
|
|
1436
1610
|
]
|
|
1437
1611
|
},
|
|
1438
|
-
`${
|
|
1612
|
+
`${b.name}-${O}`
|
|
1439
1613
|
);
|
|
1440
1614
|
}) })
|
|
1441
1615
|
] })
|
|
1442
1616
|
}
|
|
1443
1617
|
);
|
|
1444
1618
|
}
|
|
1445
|
-
function
|
|
1619
|
+
function vi({
|
|
1446
1620
|
label: t,
|
|
1447
1621
|
error: r,
|
|
1448
1622
|
helperText: n,
|
|
1449
1623
|
required: a,
|
|
1450
1624
|
disabled: i,
|
|
1451
|
-
id:
|
|
1452
|
-
className:
|
|
1453
|
-
value:
|
|
1454
|
-
onChange:
|
|
1455
|
-
onSearch:
|
|
1625
|
+
id: m,
|
|
1626
|
+
className: d,
|
|
1627
|
+
value: o,
|
|
1628
|
+
onChange: f,
|
|
1629
|
+
onSearch: h,
|
|
1456
1630
|
multiple: p = !1,
|
|
1457
|
-
debounceMs:
|
|
1458
|
-
minQueryLength:
|
|
1459
|
-
placeholder:
|
|
1631
|
+
debounceMs: u = 300,
|
|
1632
|
+
minQueryLength: c = 1,
|
|
1633
|
+
placeholder: s
|
|
1460
1634
|
}) {
|
|
1461
|
-
const
|
|
1462
|
-
const
|
|
1463
|
-
return
|
|
1464
|
-
|
|
1465
|
-
}),
|
|
1466
|
-
}, [
|
|
1467
|
-
|
|
1468
|
-
if (
|
|
1469
|
-
|
|
1635
|
+
const g = de(), x = m ?? g, N = r ? `${x}-error` : void 0, z = n && !r ? `${x}-helper` : void 0, S = [N, z].filter(Boolean).join(" ") || void 0, [A, k] = R(!1), [P, D] = R(""), [T, B] = R([]), [L, C] = R(!1), [M, _] = R(/* @__PURE__ */ new Map()), y = F(void 0), v = F(0), b = p ? Array.isArray(o) ? o : [] : typeof o == "string" ? o : void 0, O = ne(() => {
|
|
1636
|
+
const E = new Map(M);
|
|
1637
|
+
return T.forEach((U) => {
|
|
1638
|
+
E.set(U.value, U.label);
|
|
1639
|
+
}), E;
|
|
1640
|
+
}, [T, M]);
|
|
1641
|
+
X(() => {
|
|
1642
|
+
if (P.length < c) {
|
|
1643
|
+
B([]), C(!1);
|
|
1470
1644
|
return;
|
|
1471
1645
|
}
|
|
1472
|
-
|
|
1473
|
-
const
|
|
1474
|
-
return
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
const
|
|
1478
|
-
return
|
|
1479
|
-
|
|
1480
|
-
}),
|
|
1646
|
+
y.current !== void 0 && clearTimeout(y.current), C(!0), v.current += 1;
|
|
1647
|
+
const E = v.current;
|
|
1648
|
+
return y.current = window.setTimeout(() => {
|
|
1649
|
+
h(P).then((U) => {
|
|
1650
|
+
E === v.current && (B(U), C(!1), _((I) => {
|
|
1651
|
+
const j = new Map(I);
|
|
1652
|
+
return U.forEach((V) => {
|
|
1653
|
+
j.set(V.value, V.label);
|
|
1654
|
+
}), j;
|
|
1481
1655
|
}));
|
|
1482
1656
|
}).catch(() => {
|
|
1483
|
-
|
|
1657
|
+
E === v.current && (B([]), C(!1));
|
|
1484
1658
|
});
|
|
1485
|
-
},
|
|
1486
|
-
|
|
1659
|
+
}, u), () => {
|
|
1660
|
+
y.current !== void 0 && clearTimeout(y.current);
|
|
1487
1661
|
};
|
|
1488
|
-
}, [
|
|
1489
|
-
function
|
|
1490
|
-
if (
|
|
1491
|
-
const
|
|
1492
|
-
|
|
1662
|
+
}, [P, h, u, c]);
|
|
1663
|
+
function J(E, U) {
|
|
1664
|
+
if (_((I) => new Map(I).set(E, U)), p) {
|
|
1665
|
+
const I = Array.isArray(b) ? b : [], j = I.includes(E) ? I.filter((V) => V !== E) : [...I, E];
|
|
1666
|
+
f?.(j);
|
|
1493
1667
|
} else
|
|
1494
|
-
|
|
1668
|
+
f?.(E), k(!1);
|
|
1495
1669
|
}
|
|
1496
|
-
function
|
|
1670
|
+
function Q(E) {
|
|
1497
1671
|
if (p) {
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1672
|
+
const I = (Array.isArray(b) ? b : []).filter((j) => j !== E);
|
|
1673
|
+
f?.(I);
|
|
1500
1674
|
}
|
|
1501
1675
|
}
|
|
1502
|
-
function
|
|
1503
|
-
return p ? Array.isArray(
|
|
1676
|
+
function H(E) {
|
|
1677
|
+
return p ? Array.isArray(b) && b.includes(E) : b === E;
|
|
1504
1678
|
}
|
|
1505
|
-
function
|
|
1679
|
+
function te() {
|
|
1506
1680
|
if (p) {
|
|
1507
|
-
const
|
|
1508
|
-
return
|
|
1509
|
-
const
|
|
1510
|
-
return /* @__PURE__ */
|
|
1511
|
-
|
|
1681
|
+
const E = Array.isArray(b) ? b : [];
|
|
1682
|
+
return E.length === 0 ? /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: s ?? "Select options..." }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: E.map((U) => {
|
|
1683
|
+
const I = O.get(U) ?? U;
|
|
1684
|
+
return /* @__PURE__ */ l(bt, { variant: "secondary", className: "gap-1", children: [
|
|
1685
|
+
I,
|
|
1512
1686
|
/* @__PURE__ */ e(
|
|
1513
1687
|
"span",
|
|
1514
1688
|
{
|
|
1515
1689
|
role: "button",
|
|
1516
1690
|
tabIndex: 0,
|
|
1517
1691
|
className: "ml-0.5 rounded-full outline-none hover:bg-muted-foreground/20 cursor-pointer",
|
|
1518
|
-
onClick: (
|
|
1519
|
-
|
|
1692
|
+
onClick: (j) => {
|
|
1693
|
+
j.stopPropagation(), Q(U);
|
|
1520
1694
|
},
|
|
1521
|
-
onKeyDown: (
|
|
1522
|
-
(
|
|
1695
|
+
onKeyDown: (j) => {
|
|
1696
|
+
(j.key === "Enter" || j.key === " ") && (j.stopPropagation(), Q(U));
|
|
1523
1697
|
},
|
|
1524
|
-
"aria-label": `Remove ${
|
|
1525
|
-
children: /* @__PURE__ */ e(
|
|
1698
|
+
"aria-label": `Remove ${I}`,
|
|
1699
|
+
children: /* @__PURE__ */ e(ke, { className: "size-3" })
|
|
1526
1700
|
}
|
|
1527
1701
|
)
|
|
1528
|
-
] },
|
|
1702
|
+
] }, U);
|
|
1529
1703
|
}) });
|
|
1530
1704
|
} else
|
|
1531
|
-
return
|
|
1705
|
+
return b ? /* @__PURE__ */ e("span", { children: O.get(b) ?? b }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: s ?? "Select an option..." });
|
|
1532
1706
|
}
|
|
1533
|
-
function
|
|
1534
|
-
return
|
|
1535
|
-
/* @__PURE__ */ e(
|
|
1707
|
+
function ie() {
|
|
1708
|
+
return P.length < c ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-sm text-muted-foreground", children: "Type to search..." }) : L ? /* @__PURE__ */ l("div", { className: "py-6 text-center flex items-center justify-center gap-2", children: [
|
|
1709
|
+
/* @__PURE__ */ e(Wt, { className: "size-4 animate-spin", role: "status" }),
|
|
1536
1710
|
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Searching..." })
|
|
1537
|
-
] }) :
|
|
1711
|
+
] }) : T.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-sm text-muted-foreground", children: "No results found" }) : /* @__PURE__ */ e("div", { className: "max-h-64 overflow-y-auto", children: T.map((E) => /* @__PURE__ */ l(
|
|
1538
1712
|
"button",
|
|
1539
1713
|
{
|
|
1540
1714
|
type: "button",
|
|
1541
|
-
className:
|
|
1715
|
+
className: w(
|
|
1542
1716
|
"relative flex w-full cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
|
|
1543
|
-
|
|
1717
|
+
E.disabled && "pointer-events-none opacity-50"
|
|
1544
1718
|
),
|
|
1545
|
-
onClick: () =>
|
|
1546
|
-
disabled:
|
|
1719
|
+
onClick: () => J(E.value, E.label),
|
|
1720
|
+
disabled: E.disabled,
|
|
1547
1721
|
children: [
|
|
1548
1722
|
/* @__PURE__ */ e(
|
|
1549
1723
|
"div",
|
|
1550
1724
|
{
|
|
1551
|
-
className:
|
|
1725
|
+
className: w(
|
|
1552
1726
|
"flex size-4 items-center justify-center",
|
|
1553
|
-
|
|
1727
|
+
H(E.value) && "text-primary"
|
|
1554
1728
|
),
|
|
1555
|
-
children:
|
|
1729
|
+
children: H(E.value) && /* @__PURE__ */ e(nt, { className: "size-4" })
|
|
1556
1730
|
}
|
|
1557
1731
|
),
|
|
1558
|
-
|
|
1732
|
+
E.label
|
|
1559
1733
|
]
|
|
1560
1734
|
},
|
|
1561
|
-
|
|
1735
|
+
E.value
|
|
1562
1736
|
)) });
|
|
1563
1737
|
}
|
|
1564
|
-
return /* @__PURE__ */
|
|
1565
|
-
t && /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ l("div", { className: w("space-y-2", d), children: [
|
|
1739
|
+
t && /* @__PURE__ */ l(ue, { htmlFor: x, children: [
|
|
1566
1740
|
t,
|
|
1567
1741
|
a && /* @__PURE__ */ e("span", { className: "text-destructive ml-0.5", "aria-hidden": "true", children: "*" })
|
|
1568
1742
|
] }),
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
/* @__PURE__ */ e(
|
|
1571
|
-
|
|
1743
|
+
/* @__PURE__ */ l(me, { open: A, onOpenChange: k, children: [
|
|
1744
|
+
/* @__PURE__ */ e(fe, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1745
|
+
$,
|
|
1572
1746
|
{
|
|
1573
|
-
id:
|
|
1747
|
+
id: x,
|
|
1574
1748
|
variant: "outline",
|
|
1575
1749
|
role: "combobox",
|
|
1576
|
-
"aria-expanded":
|
|
1750
|
+
"aria-expanded": A,
|
|
1577
1751
|
"aria-invalid": !!r,
|
|
1578
|
-
"aria-describedby":
|
|
1752
|
+
"aria-describedby": S,
|
|
1579
1753
|
disabled: i,
|
|
1580
1754
|
className: "w-full justify-between font-normal h-auto min-h-9",
|
|
1581
1755
|
children: [
|
|
1582
|
-
|
|
1583
|
-
/* @__PURE__ */ e(
|
|
1756
|
+
te(),
|
|
1757
|
+
/* @__PURE__ */ e(Le, { className: "ml-2 size-4 shrink-0 opacity-50" })
|
|
1584
1758
|
]
|
|
1585
1759
|
}
|
|
1586
1760
|
) }),
|
|
1587
|
-
/* @__PURE__ */
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */ e(
|
|
1761
|
+
/* @__PURE__ */ l(he, { className: "w-(--radix-popover-trigger-width) p-0", children: [
|
|
1762
|
+
/* @__PURE__ */ l("div", { className: "flex items-center border-b px-3", children: [
|
|
1763
|
+
/* @__PURE__ */ e(at, { className: "mr-2 size-4 shrink-0 opacity-50" }),
|
|
1590
1764
|
/* @__PURE__ */ e(
|
|
1591
|
-
|
|
1765
|
+
ee,
|
|
1592
1766
|
{
|
|
1593
1767
|
placeholder: "Search...",
|
|
1594
|
-
value:
|
|
1595
|
-
onChange: (
|
|
1768
|
+
value: P,
|
|
1769
|
+
onChange: (E) => D(E.target.value),
|
|
1596
1770
|
className: "border-0 focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
1597
1771
|
}
|
|
1598
1772
|
)
|
|
1599
1773
|
] }),
|
|
1600
|
-
|
|
1774
|
+
ie()
|
|
1601
1775
|
] })
|
|
1602
1776
|
] }),
|
|
1603
|
-
r && /* @__PURE__ */ e("p", { id:
|
|
1604
|
-
n && !r && /* @__PURE__ */ e("p", { id:
|
|
1777
|
+
r && /* @__PURE__ */ e("p", { id: N, className: "text-sm text-destructive", role: "alert", children: r }),
|
|
1778
|
+
n && !r && /* @__PURE__ */ e("p", { id: z, className: "text-sm text-muted-foreground", children: n })
|
|
1605
1779
|
] });
|
|
1606
1780
|
}
|
|
1607
|
-
function
|
|
1608
|
-
return /* @__PURE__ */ e("div", { className: "mx-0.5 h-5 w-px bg-border" });
|
|
1781
|
+
function le() {
|
|
1782
|
+
return /* @__PURE__ */ e("div", { className: "mx-0.5 h-5 w-px bg-border", role: "separator", "aria-orientation": "vertical" });
|
|
1609
1783
|
}
|
|
1610
|
-
function
|
|
1784
|
+
function Z({
|
|
1611
1785
|
onClick: t,
|
|
1612
1786
|
isActive: r,
|
|
1613
1787
|
disabled: n,
|
|
@@ -1615,102 +1789,104 @@ function R({
|
|
|
1615
1789
|
children: i
|
|
1616
1790
|
}) {
|
|
1617
1791
|
return /* @__PURE__ */ e(
|
|
1618
|
-
|
|
1792
|
+
$,
|
|
1619
1793
|
{
|
|
1620
1794
|
type: "button",
|
|
1621
1795
|
variant: "ghost",
|
|
1622
1796
|
size: "icon-xs",
|
|
1623
1797
|
onClick: t,
|
|
1624
1798
|
disabled: n,
|
|
1625
|
-
className:
|
|
1799
|
+
className: w(r && "bg-accent text-accent-foreground"),
|
|
1626
1800
|
"aria-label": a,
|
|
1627
1801
|
"aria-pressed": r,
|
|
1628
1802
|
children: i
|
|
1629
1803
|
}
|
|
1630
1804
|
);
|
|
1631
1805
|
}
|
|
1632
|
-
const
|
|
1633
|
-
function
|
|
1634
|
-
return
|
|
1806
|
+
const Pn = /^(https?:\/\/|mailto:)/i;
|
|
1807
|
+
function Dn(t) {
|
|
1808
|
+
return Pn.test(t.trim());
|
|
1635
1809
|
}
|
|
1636
|
-
function
|
|
1810
|
+
function Un({
|
|
1637
1811
|
editor: t,
|
|
1638
1812
|
disabled: r
|
|
1639
1813
|
}) {
|
|
1640
|
-
const [n, a] =
|
|
1641
|
-
function
|
|
1642
|
-
if (
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1814
|
+
const [n, a] = R(!1), [i, m] = R("");
|
|
1815
|
+
function d(c) {
|
|
1816
|
+
if (c) {
|
|
1817
|
+
const s = t.getAttributes("link").href ?? "";
|
|
1818
|
+
m(s), f("");
|
|
1645
1819
|
}
|
|
1646
|
-
a(
|
|
1820
|
+
a(c);
|
|
1647
1821
|
}
|
|
1648
|
-
const [
|
|
1649
|
-
function
|
|
1650
|
-
const
|
|
1651
|
-
if (
|
|
1652
|
-
if (!
|
|
1653
|
-
|
|
1822
|
+
const [o, f] = R("");
|
|
1823
|
+
function h() {
|
|
1824
|
+
const c = i.trim();
|
|
1825
|
+
if (c) {
|
|
1826
|
+
if (!Dn(c)) {
|
|
1827
|
+
f("URL must start with http://, https://, or mailto:");
|
|
1654
1828
|
return;
|
|
1655
1829
|
}
|
|
1656
|
-
t.chain().focus().extendMarkRange("link").setLink({ href:
|
|
1830
|
+
t.chain().focus().extendMarkRange("link").setLink({ href: c }).run(), a(!1), m(""), f("");
|
|
1657
1831
|
}
|
|
1658
1832
|
}
|
|
1659
1833
|
function p() {
|
|
1660
|
-
t.chain().focus().extendMarkRange("link").unsetLink().run(), a(!1),
|
|
1834
|
+
t.chain().focus().extendMarkRange("link").unsetLink().run(), a(!1), m("");
|
|
1661
1835
|
}
|
|
1662
|
-
const
|
|
1663
|
-
return /* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */ e(
|
|
1665
|
-
|
|
1836
|
+
const u = t.isActive("link");
|
|
1837
|
+
return /* @__PURE__ */ l(me, { open: n, onOpenChange: d, children: [
|
|
1838
|
+
/* @__PURE__ */ e(fe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1839
|
+
$,
|
|
1666
1840
|
{
|
|
1667
1841
|
type: "button",
|
|
1668
1842
|
variant: "ghost",
|
|
1669
1843
|
size: "icon-xs",
|
|
1670
1844
|
disabled: r,
|
|
1671
|
-
className:
|
|
1672
|
-
"aria-label":
|
|
1673
|
-
"aria-pressed":
|
|
1674
|
-
children: /* @__PURE__ */ e(
|
|
1845
|
+
className: w(u && "bg-accent text-accent-foreground"),
|
|
1846
|
+
"aria-label": u ? "Edit link" : "Insert link",
|
|
1847
|
+
"aria-pressed": u,
|
|
1848
|
+
children: /* @__PURE__ */ e(cr, { className: "size-3", "aria-hidden": "true" })
|
|
1675
1849
|
}
|
|
1676
1850
|
) }),
|
|
1677
|
-
/* @__PURE__ */ e(
|
|
1851
|
+
/* @__PURE__ */ e(he, { className: "w-72 max-w-[calc(100vw-2rem)] p-3", align: "start", children: /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
1678
1852
|
/* @__PURE__ */ e(
|
|
1679
|
-
|
|
1853
|
+
ee,
|
|
1680
1854
|
{
|
|
1681
1855
|
placeholder: "https://example.com",
|
|
1682
1856
|
value: i,
|
|
1683
|
-
onChange: (
|
|
1684
|
-
|
|
1857
|
+
onChange: (c) => {
|
|
1858
|
+
m(c.target.value), f("");
|
|
1685
1859
|
},
|
|
1686
|
-
onKeyDown: (
|
|
1687
|
-
|
|
1860
|
+
onKeyDown: (c) => {
|
|
1861
|
+
c.key === "Enter" && (c.preventDefault(), h());
|
|
1688
1862
|
},
|
|
1689
|
-
"aria-
|
|
1863
|
+
"aria-label": "URL",
|
|
1864
|
+
"aria-invalid": !!o,
|
|
1865
|
+
"aria-describedby": o ? "link-url-error" : void 0,
|
|
1690
1866
|
className: "h-8"
|
|
1691
1867
|
}
|
|
1692
1868
|
),
|
|
1693
|
-
|
|
1694
|
-
/* @__PURE__ */
|
|
1869
|
+
o && /* @__PURE__ */ e("p", { id: "link-url-error", className: "text-xs text-destructive", role: "alert", children: o }),
|
|
1870
|
+
/* @__PURE__ */ l("div", { className: "flex gap-1", children: [
|
|
1695
1871
|
/* @__PURE__ */ e(
|
|
1696
|
-
|
|
1872
|
+
$,
|
|
1697
1873
|
{
|
|
1698
1874
|
type: "button",
|
|
1699
1875
|
size: "xs",
|
|
1700
|
-
onClick:
|
|
1876
|
+
onClick: h,
|
|
1701
1877
|
disabled: !i,
|
|
1702
1878
|
children: "Apply"
|
|
1703
1879
|
}
|
|
1704
1880
|
),
|
|
1705
|
-
|
|
1706
|
-
|
|
1881
|
+
u && /* @__PURE__ */ l(
|
|
1882
|
+
$,
|
|
1707
1883
|
{
|
|
1708
1884
|
type: "button",
|
|
1709
1885
|
variant: "ghost",
|
|
1710
1886
|
size: "xs",
|
|
1711
1887
|
onClick: p,
|
|
1712
1888
|
children: [
|
|
1713
|
-
/* @__PURE__ */ e(
|
|
1889
|
+
/* @__PURE__ */ e(dr, { className: "size-3", "aria-hidden": "true" }),
|
|
1714
1890
|
"Remove"
|
|
1715
1891
|
]
|
|
1716
1892
|
}
|
|
@@ -1719,11 +1895,11 @@ function kt({
|
|
|
1719
1895
|
] }) })
|
|
1720
1896
|
] });
|
|
1721
1897
|
}
|
|
1722
|
-
function
|
|
1898
|
+
function $n({
|
|
1723
1899
|
editor: t,
|
|
1724
1900
|
disabled: r
|
|
1725
1901
|
}) {
|
|
1726
|
-
return t ? /* @__PURE__ */
|
|
1902
|
+
return t ? /* @__PURE__ */ l(
|
|
1727
1903
|
"div",
|
|
1728
1904
|
{
|
|
1729
1905
|
className: "flex flex-wrap items-center gap-0.5 border-b border-input px-2 py-1",
|
|
@@ -1731,209 +1907,209 @@ function At({
|
|
|
1731
1907
|
"aria-label": "Formatting options",
|
|
1732
1908
|
children: [
|
|
1733
1909
|
/* @__PURE__ */ e(
|
|
1734
|
-
|
|
1910
|
+
Z,
|
|
1735
1911
|
{
|
|
1736
1912
|
onClick: () => t.chain().focus().toggleBold().run(),
|
|
1737
1913
|
isActive: t.isActive("bold"),
|
|
1738
1914
|
disabled: r,
|
|
1739
1915
|
ariaLabel: "Bold",
|
|
1740
|
-
children: /* @__PURE__ */ e(
|
|
1916
|
+
children: /* @__PURE__ */ e(Qt, { className: "size-3", "aria-hidden": "true" })
|
|
1741
1917
|
}
|
|
1742
1918
|
),
|
|
1743
1919
|
/* @__PURE__ */ e(
|
|
1744
|
-
|
|
1920
|
+
Z,
|
|
1745
1921
|
{
|
|
1746
1922
|
onClick: () => t.chain().focus().toggleItalic().run(),
|
|
1747
1923
|
isActive: t.isActive("italic"),
|
|
1748
1924
|
disabled: r,
|
|
1749
1925
|
ariaLabel: "Italic",
|
|
1750
|
-
children: /* @__PURE__ */ e(
|
|
1926
|
+
children: /* @__PURE__ */ e(Xt, { className: "size-3", "aria-hidden": "true" })
|
|
1751
1927
|
}
|
|
1752
1928
|
),
|
|
1753
1929
|
/* @__PURE__ */ e(
|
|
1754
|
-
|
|
1930
|
+
Z,
|
|
1755
1931
|
{
|
|
1756
1932
|
onClick: () => t.chain().focus().toggleUnderline().run(),
|
|
1757
1933
|
isActive: t.isActive("underline"),
|
|
1758
1934
|
disabled: r,
|
|
1759
1935
|
ariaLabel: "Underline",
|
|
1760
|
-
children: /* @__PURE__ */ e(
|
|
1936
|
+
children: /* @__PURE__ */ e(Yt, { className: "size-3", "aria-hidden": "true" })
|
|
1761
1937
|
}
|
|
1762
1938
|
),
|
|
1763
1939
|
/* @__PURE__ */ e(
|
|
1764
|
-
|
|
1940
|
+
Z,
|
|
1765
1941
|
{
|
|
1766
1942
|
onClick: () => t.chain().focus().toggleStrike().run(),
|
|
1767
1943
|
isActive: t.isActive("strike"),
|
|
1768
1944
|
disabled: r,
|
|
1769
1945
|
ariaLabel: "Strikethrough",
|
|
1770
|
-
children: /* @__PURE__ */ e(
|
|
1946
|
+
children: /* @__PURE__ */ e(Zt, { className: "size-3", "aria-hidden": "true" })
|
|
1771
1947
|
}
|
|
1772
1948
|
),
|
|
1773
|
-
/* @__PURE__ */ e(
|
|
1949
|
+
/* @__PURE__ */ e(le, {}),
|
|
1774
1950
|
/* @__PURE__ */ e(
|
|
1775
|
-
|
|
1951
|
+
Z,
|
|
1776
1952
|
{
|
|
1777
1953
|
onClick: () => t.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
1778
1954
|
isActive: t.isActive("heading", { level: 1 }),
|
|
1779
1955
|
disabled: r,
|
|
1780
1956
|
ariaLabel: "Heading 1",
|
|
1781
|
-
children: /* @__PURE__ */ e(
|
|
1957
|
+
children: /* @__PURE__ */ e(Jt, { className: "size-3", "aria-hidden": "true" })
|
|
1782
1958
|
}
|
|
1783
1959
|
),
|
|
1784
1960
|
/* @__PURE__ */ e(
|
|
1785
|
-
|
|
1961
|
+
Z,
|
|
1786
1962
|
{
|
|
1787
1963
|
onClick: () => t.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
1788
1964
|
isActive: t.isActive("heading", { level: 2 }),
|
|
1789
1965
|
disabled: r,
|
|
1790
1966
|
ariaLabel: "Heading 2",
|
|
1791
|
-
children: /* @__PURE__ */ e(
|
|
1967
|
+
children: /* @__PURE__ */ e(qt, { className: "size-3", "aria-hidden": "true" })
|
|
1792
1968
|
}
|
|
1793
1969
|
),
|
|
1794
1970
|
/* @__PURE__ */ e(
|
|
1795
|
-
|
|
1971
|
+
Z,
|
|
1796
1972
|
{
|
|
1797
1973
|
onClick: () => t.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
1798
1974
|
isActive: t.isActive("heading", { level: 3 }),
|
|
1799
1975
|
disabled: r,
|
|
1800
1976
|
ariaLabel: "Heading 3",
|
|
1801
|
-
children: /* @__PURE__ */ e(
|
|
1977
|
+
children: /* @__PURE__ */ e(er, { className: "size-3", "aria-hidden": "true" })
|
|
1802
1978
|
}
|
|
1803
1979
|
),
|
|
1804
|
-
/* @__PURE__ */ e(
|
|
1980
|
+
/* @__PURE__ */ e(le, {}),
|
|
1805
1981
|
/* @__PURE__ */ e(
|
|
1806
|
-
|
|
1982
|
+
Z,
|
|
1807
1983
|
{
|
|
1808
1984
|
onClick: () => t.chain().focus().toggleBulletList().run(),
|
|
1809
1985
|
isActive: t.isActive("bulletList"),
|
|
1810
1986
|
disabled: r,
|
|
1811
1987
|
ariaLabel: "Bullet list",
|
|
1812
|
-
children: /* @__PURE__ */ e(
|
|
1988
|
+
children: /* @__PURE__ */ e(it, { className: "size-3", "aria-hidden": "true" })
|
|
1813
1989
|
}
|
|
1814
1990
|
),
|
|
1815
1991
|
/* @__PURE__ */ e(
|
|
1816
|
-
|
|
1992
|
+
Z,
|
|
1817
1993
|
{
|
|
1818
1994
|
onClick: () => t.chain().focus().toggleOrderedList().run(),
|
|
1819
1995
|
isActive: t.isActive("orderedList"),
|
|
1820
1996
|
disabled: r,
|
|
1821
1997
|
ariaLabel: "Ordered list",
|
|
1822
|
-
children: /* @__PURE__ */ e(
|
|
1998
|
+
children: /* @__PURE__ */ e(tr, { className: "size-3", "aria-hidden": "true" })
|
|
1823
1999
|
}
|
|
1824
2000
|
),
|
|
1825
|
-
/* @__PURE__ */ e(
|
|
2001
|
+
/* @__PURE__ */ e(le, {}),
|
|
1826
2002
|
/* @__PURE__ */ e(
|
|
1827
|
-
|
|
2003
|
+
Z,
|
|
1828
2004
|
{
|
|
1829
2005
|
onClick: () => t.chain().focus().toggleBlockquote().run(),
|
|
1830
2006
|
isActive: t.isActive("blockquote"),
|
|
1831
2007
|
disabled: r,
|
|
1832
2008
|
ariaLabel: "Blockquote",
|
|
1833
|
-
children: /* @__PURE__ */ e(
|
|
2009
|
+
children: /* @__PURE__ */ e(rr, { className: "size-3", "aria-hidden": "true" })
|
|
1834
2010
|
}
|
|
1835
2011
|
),
|
|
1836
2012
|
/* @__PURE__ */ e(
|
|
1837
|
-
|
|
2013
|
+
Z,
|
|
1838
2014
|
{
|
|
1839
2015
|
onClick: () => t.chain().focus().toggleCodeBlock().run(),
|
|
1840
2016
|
isActive: t.isActive("codeBlock"),
|
|
1841
2017
|
disabled: r,
|
|
1842
2018
|
ariaLabel: "Code block",
|
|
1843
|
-
children: /* @__PURE__ */ e(
|
|
2019
|
+
children: /* @__PURE__ */ e(nr, { className: "size-3", "aria-hidden": "true" })
|
|
1844
2020
|
}
|
|
1845
2021
|
),
|
|
1846
|
-
/* @__PURE__ */ e(
|
|
2022
|
+
/* @__PURE__ */ e(le, {}),
|
|
1847
2023
|
/* @__PURE__ */ e(
|
|
1848
|
-
|
|
2024
|
+
Z,
|
|
1849
2025
|
{
|
|
1850
2026
|
onClick: () => t.chain().focus().setTextAlign("left").run(),
|
|
1851
2027
|
isActive: t.isActive({ textAlign: "left" }),
|
|
1852
2028
|
disabled: r,
|
|
1853
2029
|
ariaLabel: "Align left",
|
|
1854
|
-
children: /* @__PURE__ */ e(
|
|
2030
|
+
children: /* @__PURE__ */ e(ar, { className: "size-3", "aria-hidden": "true" })
|
|
1855
2031
|
}
|
|
1856
2032
|
),
|
|
1857
2033
|
/* @__PURE__ */ e(
|
|
1858
|
-
|
|
2034
|
+
Z,
|
|
1859
2035
|
{
|
|
1860
2036
|
onClick: () => t.chain().focus().setTextAlign("center").run(),
|
|
1861
2037
|
isActive: t.isActive({ textAlign: "center" }),
|
|
1862
2038
|
disabled: r,
|
|
1863
2039
|
ariaLabel: "Align center",
|
|
1864
|
-
children: /* @__PURE__ */ e(
|
|
2040
|
+
children: /* @__PURE__ */ e(ir, { className: "size-3", "aria-hidden": "true" })
|
|
1865
2041
|
}
|
|
1866
2042
|
),
|
|
1867
2043
|
/* @__PURE__ */ e(
|
|
1868
|
-
|
|
2044
|
+
Z,
|
|
1869
2045
|
{
|
|
1870
2046
|
onClick: () => t.chain().focus().setTextAlign("right").run(),
|
|
1871
2047
|
isActive: t.isActive({ textAlign: "right" }),
|
|
1872
2048
|
disabled: r,
|
|
1873
2049
|
ariaLabel: "Align right",
|
|
1874
|
-
children: /* @__PURE__ */ e(
|
|
2050
|
+
children: /* @__PURE__ */ e(sr, { className: "size-3", "aria-hidden": "true" })
|
|
1875
2051
|
}
|
|
1876
2052
|
),
|
|
1877
|
-
/* @__PURE__ */ e(
|
|
1878
|
-
/* @__PURE__ */ e(
|
|
1879
|
-
/* @__PURE__ */ e(
|
|
2053
|
+
/* @__PURE__ */ e(le, {}),
|
|
2054
|
+
/* @__PURE__ */ e(Un, { editor: t, disabled: r }),
|
|
2055
|
+
/* @__PURE__ */ e(le, {}),
|
|
1880
2056
|
/* @__PURE__ */ e(
|
|
1881
|
-
|
|
2057
|
+
Z,
|
|
1882
2058
|
{
|
|
1883
2059
|
onClick: () => t.chain().focus().undo().run(),
|
|
1884
2060
|
disabled: r || !t.can().undo(),
|
|
1885
2061
|
ariaLabel: "Undo",
|
|
1886
|
-
children: /* @__PURE__ */ e(
|
|
2062
|
+
children: /* @__PURE__ */ e(or, { className: "size-3", "aria-hidden": "true" })
|
|
1887
2063
|
}
|
|
1888
2064
|
),
|
|
1889
2065
|
/* @__PURE__ */ e(
|
|
1890
|
-
|
|
2066
|
+
Z,
|
|
1891
2067
|
{
|
|
1892
2068
|
onClick: () => t.chain().focus().redo().run(),
|
|
1893
2069
|
disabled: r || !t.can().redo(),
|
|
1894
2070
|
ariaLabel: "Redo",
|
|
1895
|
-
children: /* @__PURE__ */ e(
|
|
2071
|
+
children: /* @__PURE__ */ e(lr, { className: "size-3", "aria-hidden": "true" })
|
|
1896
2072
|
}
|
|
1897
2073
|
)
|
|
1898
2074
|
]
|
|
1899
2075
|
}
|
|
1900
2076
|
) : null;
|
|
1901
2077
|
}
|
|
1902
|
-
function
|
|
2078
|
+
function xi({
|
|
1903
2079
|
label: t,
|
|
1904
2080
|
error: r,
|
|
1905
2081
|
helperText: n,
|
|
1906
2082
|
required: a,
|
|
1907
2083
|
disabled: i,
|
|
1908
|
-
id:
|
|
1909
|
-
className:
|
|
1910
|
-
value:
|
|
1911
|
-
onChange:
|
|
1912
|
-
placeholder:
|
|
2084
|
+
id: m,
|
|
2085
|
+
className: d,
|
|
2086
|
+
value: o,
|
|
2087
|
+
onChange: f,
|
|
2088
|
+
placeholder: h,
|
|
1913
2089
|
minHeight: p = "150px",
|
|
1914
|
-
maxCharacters:
|
|
1915
|
-
showWordCount:
|
|
1916
|
-
showCharacterCount:
|
|
2090
|
+
maxCharacters: u,
|
|
2091
|
+
showWordCount: c,
|
|
2092
|
+
showCharacterCount: s
|
|
1917
2093
|
}) {
|
|
1918
|
-
const
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
}, [
|
|
1922
|
-
const
|
|
2094
|
+
const g = F(f);
|
|
2095
|
+
X(() => {
|
|
2096
|
+
g.current = f;
|
|
2097
|
+
}, [f]);
|
|
2098
|
+
const x = Xr({
|
|
1923
2099
|
extensions: [
|
|
1924
|
-
|
|
2100
|
+
Zr.configure({
|
|
1925
2101
|
link: { openOnClick: !1 }
|
|
1926
2102
|
}),
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
limit:
|
|
2103
|
+
Jr.configure({ types: ["heading", "paragraph"] }),
|
|
2104
|
+
qr.configure({ placeholder: h ?? "" }),
|
|
2105
|
+
en.configure({
|
|
2106
|
+
limit: u ?? void 0
|
|
1931
2107
|
})
|
|
1932
2108
|
],
|
|
1933
|
-
content:
|
|
2109
|
+
content: o ?? "",
|
|
1934
2110
|
editable: !i,
|
|
1935
|
-
onUpdate: ({ editor:
|
|
1936
|
-
|
|
2111
|
+
onUpdate: ({ editor: D }) => {
|
|
2112
|
+
g.current?.(D.getHTML());
|
|
1937
2113
|
},
|
|
1938
2114
|
editorProps: {
|
|
1939
2115
|
attributes: {
|
|
@@ -1942,46 +2118,46 @@ function Cr({
|
|
|
1942
2118
|
}
|
|
1943
2119
|
}
|
|
1944
2120
|
});
|
|
1945
|
-
|
|
1946
|
-
if (!
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1949
|
-
}, [
|
|
1950
|
-
|
|
1951
|
-
}, [
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1954
|
-
if (!
|
|
1955
|
-
const
|
|
1956
|
-
|
|
1957
|
-
}, [
|
|
1958
|
-
const
|
|
2121
|
+
X(() => {
|
|
2122
|
+
if (!x) return;
|
|
2123
|
+
const D = x.getHTML();
|
|
2124
|
+
o !== void 0 && o !== D && x.commands.setContent(o, { emitUpdate: !1 });
|
|
2125
|
+
}, [x, o]), X(() => {
|
|
2126
|
+
x && x.setEditable(!i);
|
|
2127
|
+
}, [x, i]);
|
|
2128
|
+
const N = F(""), z = F(void 0), S = F(void 0);
|
|
2129
|
+
X(() => {
|
|
2130
|
+
if (!x) return;
|
|
2131
|
+
const D = x.view.dom;
|
|
2132
|
+
N.current && D.setAttribute("id", N.current), z.current ? D.setAttribute("aria-labelledby", z.current) : D.removeAttribute("aria-labelledby"), D.setAttribute("aria-invalid", String(!!r)), D.setAttribute("aria-required", String(!!a)), S.current ? D.setAttribute("aria-describedby", S.current) : D.removeAttribute("aria-describedby");
|
|
2133
|
+
}, [x, r, a, t]);
|
|
2134
|
+
const A = x?.storage.characterCount?.characters() ?? 0, k = x?.storage.characterCount?.words() ?? 0, P = s || c;
|
|
1959
2135
|
return /* @__PURE__ */ e(
|
|
1960
|
-
|
|
2136
|
+
q,
|
|
1961
2137
|
{
|
|
1962
|
-
id:
|
|
2138
|
+
id: m,
|
|
1963
2139
|
label: t,
|
|
1964
2140
|
error: r,
|
|
1965
2141
|
helperText: n,
|
|
1966
2142
|
required: a,
|
|
1967
2143
|
disabled: i,
|
|
1968
|
-
className:
|
|
1969
|
-
children: ({ id:
|
|
2144
|
+
className: d,
|
|
2145
|
+
children: ({ id: D, labelId: T, describedBy: B }) => (N.current = D, z.current = T, S.current = B, /* @__PURE__ */ l(
|
|
1970
2146
|
"div",
|
|
1971
2147
|
{
|
|
1972
|
-
className:
|
|
2148
|
+
className: w(
|
|
1973
2149
|
"overflow-hidden rounded-md border border-input bg-transparent shadow-xs transition-colors",
|
|
1974
2150
|
"focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",
|
|
1975
2151
|
r && "border-destructive focus-within:border-destructive focus-within:ring-destructive/20",
|
|
1976
|
-
i && "
|
|
2152
|
+
i && "pointer-events-none bg-muted/30"
|
|
1977
2153
|
),
|
|
1978
2154
|
children: [
|
|
1979
|
-
/* @__PURE__ */ e(
|
|
2155
|
+
/* @__PURE__ */ e($n, { editor: x, disabled: i }),
|
|
1980
2156
|
/* @__PURE__ */ e(
|
|
1981
|
-
|
|
2157
|
+
Yr,
|
|
1982
2158
|
{
|
|
1983
|
-
editor:
|
|
1984
|
-
className:
|
|
2159
|
+
editor: x,
|
|
2160
|
+
className: w(
|
|
1985
2161
|
"prose prose-sm max-w-none px-3 py-2 overflow-x-auto",
|
|
1986
2162
|
"text-foreground",
|
|
1987
2163
|
"prose-headings:text-foreground",
|
|
@@ -2003,52 +2179,1962 @@ function Cr({
|
|
|
2003
2179
|
style: { minHeight: p }
|
|
2004
2180
|
}
|
|
2005
2181
|
),
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2182
|
+
P && /* @__PURE__ */ l(
|
|
2183
|
+
"div",
|
|
2184
|
+
{
|
|
2185
|
+
className: "flex justify-end gap-3 border-t border-input px-3 py-1.5 text-xs text-muted-foreground",
|
|
2186
|
+
role: "status",
|
|
2187
|
+
"aria-live": "polite",
|
|
2188
|
+
"aria-atomic": "true",
|
|
2189
|
+
children: [
|
|
2190
|
+
s && /* @__PURE__ */ e("span", { children: u ? `${A} / ${u} characters` : `${A} characters` }),
|
|
2191
|
+
c && /* @__PURE__ */ l("span", { children: [
|
|
2192
|
+
k,
|
|
2193
|
+
" words"
|
|
2194
|
+
] })
|
|
2195
|
+
]
|
|
2196
|
+
}
|
|
2197
|
+
)
|
|
2198
|
+
]
|
|
2199
|
+
}
|
|
2200
|
+
))
|
|
2201
|
+
}
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
2204
|
+
function yi({
|
|
2205
|
+
label: t,
|
|
2206
|
+
error: r,
|
|
2207
|
+
helperText: n,
|
|
2208
|
+
required: a,
|
|
2209
|
+
disabled: i,
|
|
2210
|
+
id: m,
|
|
2211
|
+
className: d,
|
|
2212
|
+
value: o,
|
|
2213
|
+
defaultValue: f,
|
|
2214
|
+
onChange: h,
|
|
2215
|
+
min: p = 0,
|
|
2216
|
+
max: u = 100,
|
|
2217
|
+
step: c = 1,
|
|
2218
|
+
showValue: s = !0
|
|
2219
|
+
}) {
|
|
2220
|
+
return /* @__PURE__ */ e(
|
|
2221
|
+
q,
|
|
2222
|
+
{
|
|
2223
|
+
id: m,
|
|
2224
|
+
label: t,
|
|
2225
|
+
error: r,
|
|
2226
|
+
helperText: n,
|
|
2227
|
+
required: a,
|
|
2228
|
+
disabled: i,
|
|
2229
|
+
className: d,
|
|
2230
|
+
children: ({ id: g, describedBy: x }) => /* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
|
|
2231
|
+
/* @__PURE__ */ e(
|
|
2232
|
+
on,
|
|
2233
|
+
{
|
|
2234
|
+
id: g,
|
|
2235
|
+
"aria-describedby": x,
|
|
2236
|
+
"aria-invalid": !!r,
|
|
2237
|
+
disabled: i,
|
|
2238
|
+
value: o !== void 0 ? [o] : void 0,
|
|
2239
|
+
defaultValue: [f ?? p],
|
|
2240
|
+
onValueChange: (N) => h?.(N[0]),
|
|
2241
|
+
min: p,
|
|
2242
|
+
max: u,
|
|
2243
|
+
step: c
|
|
2244
|
+
}
|
|
2245
|
+
),
|
|
2246
|
+
s && /* @__PURE__ */ e("span", { className: "text-sm tabular-nums text-muted-foreground min-w-8 text-right", children: o ?? f ?? p })
|
|
2247
|
+
] })
|
|
2248
|
+
}
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
function pe(t) {
|
|
2252
|
+
const r = Math.floor(t / 60), n = Math.floor(t % 60);
|
|
2253
|
+
return `${r}:${n.toString().padStart(2, "0")}`;
|
|
2254
|
+
}
|
|
2255
|
+
function Ni({
|
|
2256
|
+
label: t,
|
|
2257
|
+
error: r,
|
|
2258
|
+
helperText: n,
|
|
2259
|
+
required: a,
|
|
2260
|
+
disabled: i,
|
|
2261
|
+
id: m,
|
|
2262
|
+
className: d,
|
|
2263
|
+
value: o,
|
|
2264
|
+
onChange: f,
|
|
2265
|
+
maxDuration: h,
|
|
2266
|
+
maxSize: p,
|
|
2267
|
+
mimeType: u = "audio/webm",
|
|
2268
|
+
audioBitsPerSecond: c
|
|
2269
|
+
}) {
|
|
2270
|
+
const [s, g] = R(
|
|
2271
|
+
o ? "recorded" : "idle"
|
|
2272
|
+
), [x, N] = R(0), [z, S] = R(0), [A, k] = R(0), [P, D] = R(!1), [T, B] = R(), [L, C] = R(o ?? null), M = F(null), _ = F(null), y = F([]), v = F(null), b = F(null), O = F(null), J = F(null), Q = F(null), H = F(null), te = F(0), ie = r ?? T;
|
|
2273
|
+
X(() => {
|
|
2274
|
+
o === null && L !== null && (C(null), g("idle"), N(0), S(0), k(0));
|
|
2275
|
+
}, [o, L]), X(() => () => {
|
|
2276
|
+
if (v.current && clearInterval(v.current), H.current && clearInterval(H.current), O.current)
|
|
2277
|
+
try {
|
|
2278
|
+
URL.revokeObjectURL(O.current);
|
|
2279
|
+
} catch {
|
|
2280
|
+
}
|
|
2281
|
+
if (_.current && _.current.getTracks().forEach((K) => K.stop()), Q.current)
|
|
2282
|
+
try {
|
|
2283
|
+
Q.current.close();
|
|
2284
|
+
} catch {
|
|
2285
|
+
}
|
|
2286
|
+
}, []);
|
|
2287
|
+
const E = ae((K) => {
|
|
2288
|
+
const G = J.current;
|
|
2289
|
+
if (!G) return;
|
|
2290
|
+
const W = G.getContext("2d");
|
|
2291
|
+
if (!W) return;
|
|
2292
|
+
const Y = K.getChannelData(0), re = G.width, oe = G.height;
|
|
2293
|
+
W.clearRect(0, 0, re, oe);
|
|
2294
|
+
const Ct = getComputedStyle(G);
|
|
2295
|
+
W.fillStyle = Ct.getPropertyValue("--color-primary") || "#3b82f6";
|
|
2296
|
+
const Se = 2, $e = 1, Be = Math.floor(re / (Se + $e)), Oe = Math.ceil(Y.length / Be);
|
|
2297
|
+
for (let ve = 0; ve < Be; ve++) {
|
|
2298
|
+
let Fe = 0;
|
|
2299
|
+
const ze = ve * Oe, _e = Math.min(ze + Oe, Y.length);
|
|
2300
|
+
for (let Ie = ze; Ie < _e; Ie++)
|
|
2301
|
+
Fe += Math.abs(Y[Ie]);
|
|
2302
|
+
const St = Fe / (_e - ze), je = Math.max(2, St * oe * 0.8), zt = ve * (Se + $e), It = (oe - je) / 2;
|
|
2303
|
+
W.fillRect(zt, It, Se, je);
|
|
2304
|
+
}
|
|
2305
|
+
}, []);
|
|
2306
|
+
async function U() {
|
|
2307
|
+
B(void 0);
|
|
2308
|
+
try {
|
|
2309
|
+
const K = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
2310
|
+
_.current = K;
|
|
2311
|
+
const G = {};
|
|
2312
|
+
u && MediaRecorder.isTypeSupported(u) && (G.mimeType = u), c && (G.audioBitsPerSecond = c);
|
|
2313
|
+
const W = new MediaRecorder(K, G);
|
|
2314
|
+
M.current = W, y.current = [], W.ondataavailable = (Y) => {
|
|
2315
|
+
Y.data.size > 0 && y.current.push(Y.data);
|
|
2316
|
+
}, W.onstop = () => {
|
|
2317
|
+
const Y = new Blob(y.current, {
|
|
2318
|
+
type: W.mimeType || u
|
|
2319
|
+
});
|
|
2320
|
+
if (p && Y.size > p) {
|
|
2321
|
+
const re = (p / 1048576).toFixed(1);
|
|
2322
|
+
B(
|
|
2323
|
+
`Recording exceeds maximum size of ${re} MB`
|
|
2324
|
+
), g("idle"), N(0), K.getTracks().forEach((oe) => oe.stop()), _.current = null;
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
C(Y), g("recorded"), f?.(Y), se(Y), K.getTracks().forEach((re) => re.stop()), _.current = null;
|
|
2328
|
+
}, W.start(), g("recording"), N(0), te.current = performance.now(), v.current = setInterval(() => {
|
|
2329
|
+
const Y = (performance.now() - te.current) / 1e3;
|
|
2330
|
+
N(Y), h && Y >= h && I();
|
|
2331
|
+
}, 100);
|
|
2332
|
+
} catch {
|
|
2333
|
+
B("Could not access microphone. Please check permissions.");
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
function I() {
|
|
2337
|
+
v.current && (clearInterval(v.current), v.current = null), M.current && M.current.state !== "inactive" && M.current.stop();
|
|
2338
|
+
}
|
|
2339
|
+
function j() {
|
|
2340
|
+
M.current && M.current.state === "recording" && (M.current.pause(), g("paused"), v.current && (clearInterval(v.current), v.current = null));
|
|
2341
|
+
}
|
|
2342
|
+
function V() {
|
|
2343
|
+
if (M.current && M.current.state === "paused") {
|
|
2344
|
+
M.current.resume(), g("recording");
|
|
2345
|
+
const K = x, G = performance.now();
|
|
2346
|
+
v.current = setInterval(() => {
|
|
2347
|
+
const W = K + (performance.now() - G) / 1e3;
|
|
2348
|
+
N(W), h && W >= h && I();
|
|
2349
|
+
}, 100);
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
function se(K) {
|
|
2353
|
+
if (O.current)
|
|
2354
|
+
try {
|
|
2355
|
+
URL.revokeObjectURL(O.current);
|
|
2356
|
+
} catch {
|
|
2357
|
+
}
|
|
2358
|
+
const G = URL.createObjectURL(K);
|
|
2359
|
+
O.current = G;
|
|
2360
|
+
const W = new Audio(G);
|
|
2361
|
+
b.current = W, W.addEventListener("loadedmetadata", () => {
|
|
2362
|
+
k(W.duration);
|
|
2363
|
+
}), W.addEventListener("ended", () => {
|
|
2364
|
+
D(!1), S(0), H.current && (clearInterval(H.current), H.current = null);
|
|
2365
|
+
}), typeof K.arrayBuffer == "function" && K.arrayBuffer().then((Y) => {
|
|
2366
|
+
const re = new AudioContext();
|
|
2367
|
+
return Q.current = re, re.decodeAudioData(Y).then((oe) => {
|
|
2368
|
+
E(oe);
|
|
2369
|
+
});
|
|
2370
|
+
}).catch(() => {
|
|
2371
|
+
});
|
|
2372
|
+
}
|
|
2373
|
+
function Ce() {
|
|
2374
|
+
const K = b.current;
|
|
2375
|
+
K && (P ? (K.pause(), D(!1), H.current && (clearInterval(H.current), H.current = null)) : (K.play(), D(!0), H.current = setInterval(() => {
|
|
2376
|
+
S(K.currentTime);
|
|
2377
|
+
}, 100)));
|
|
2378
|
+
}
|
|
2379
|
+
function Nt(K) {
|
|
2380
|
+
const G = parseFloat(K.target.value);
|
|
2381
|
+
b.current && (b.current.currentTime = G, S(G));
|
|
2382
|
+
}
|
|
2383
|
+
function wt() {
|
|
2384
|
+
Ue(), g("idle"), C(null), N(0), S(0), k(0), D(!1), B(void 0), f?.(null);
|
|
2385
|
+
}
|
|
2386
|
+
function kt() {
|
|
2387
|
+
Ue(), g("idle"), C(null), N(0), S(0), k(0), D(!1), B(void 0), f?.(null);
|
|
2388
|
+
}
|
|
2389
|
+
function Ue() {
|
|
2390
|
+
if (b.current && (b.current.pause(), b.current = null), O.current) {
|
|
2391
|
+
try {
|
|
2392
|
+
URL.revokeObjectURL(O.current);
|
|
2393
|
+
} catch {
|
|
2394
|
+
}
|
|
2395
|
+
O.current = null;
|
|
2396
|
+
}
|
|
2397
|
+
if (H.current && (clearInterval(H.current), H.current = null), Q.current) {
|
|
2398
|
+
try {
|
|
2399
|
+
Q.current.close();
|
|
2400
|
+
} catch {
|
|
2401
|
+
}
|
|
2402
|
+
Q.current = null;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
return /* @__PURE__ */ e(
|
|
2406
|
+
q,
|
|
2407
|
+
{
|
|
2408
|
+
id: m,
|
|
2409
|
+
label: t,
|
|
2410
|
+
error: ie,
|
|
2411
|
+
helperText: n,
|
|
2412
|
+
required: a,
|
|
2413
|
+
disabled: i,
|
|
2414
|
+
className: d,
|
|
2415
|
+
children: ({ id: K, describedBy: G }) => /* @__PURE__ */ l(
|
|
2416
|
+
"div",
|
|
2417
|
+
{
|
|
2418
|
+
id: K,
|
|
2419
|
+
className: "space-y-3",
|
|
2420
|
+
"aria-invalid": !!ie,
|
|
2421
|
+
"aria-describedby": G,
|
|
2422
|
+
"aria-required": a,
|
|
2423
|
+
children: [
|
|
2424
|
+
s === "idle" && /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-center rounded-md border-2 border-dashed p-6 sm:p-8", children: [
|
|
2425
|
+
/* @__PURE__ */ e(we, { className: "size-8 text-muted-foreground mb-3", "aria-hidden": "true" }),
|
|
2426
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "Click to start recording audio" }),
|
|
2427
|
+
/* @__PURE__ */ l(
|
|
2428
|
+
$,
|
|
2429
|
+
{
|
|
2430
|
+
type: "button",
|
|
2431
|
+
variant: "default",
|
|
2432
|
+
onClick: U,
|
|
2433
|
+
disabled: i,
|
|
2434
|
+
"aria-label": "Start recording",
|
|
2435
|
+
children: [
|
|
2436
|
+
/* @__PURE__ */ e(we, { className: "size-4", "aria-hidden": "true" }),
|
|
2437
|
+
"Start Recording"
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
)
|
|
2441
|
+
] }),
|
|
2442
|
+
(s === "recording" || s === "paused") && /* @__PURE__ */ l("div", { className: "flex flex-col items-center rounded-md border p-4 sm:p-6 space-y-4", children: [
|
|
2443
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
|
|
2444
|
+
s === "recording" && /* @__PURE__ */ e(
|
|
2445
|
+
st,
|
|
2446
|
+
{
|
|
2447
|
+
className: "size-5 text-destructive animate-pulse",
|
|
2448
|
+
"aria-hidden": "true"
|
|
2449
|
+
}
|
|
2450
|
+
),
|
|
2451
|
+
s === "paused" && /* @__PURE__ */ e(
|
|
2452
|
+
ge,
|
|
2453
|
+
{
|
|
2454
|
+
className: "size-5 text-muted-foreground",
|
|
2455
|
+
"aria-hidden": "true"
|
|
2456
|
+
}
|
|
2457
|
+
),
|
|
2458
|
+
/* @__PURE__ */ l(
|
|
2459
|
+
"span",
|
|
2460
|
+
{
|
|
2461
|
+
className: "text-lg font-mono tabular-nums",
|
|
2462
|
+
role: "status",
|
|
2463
|
+
"aria-label": `Recording time: ${pe(x)}`,
|
|
2464
|
+
children: [
|
|
2465
|
+
pe(x),
|
|
2466
|
+
h && /* @__PURE__ */ l("span", { className: "text-muted-foreground", children: [
|
|
2467
|
+
" ",
|
|
2468
|
+
"/ ",
|
|
2469
|
+
pe(h)
|
|
2470
|
+
] })
|
|
2471
|
+
]
|
|
2472
|
+
}
|
|
2473
|
+
)
|
|
2474
|
+
] }),
|
|
2475
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2476
|
+
s === "recording" && /* @__PURE__ */ l(
|
|
2477
|
+
$,
|
|
2478
|
+
{
|
|
2479
|
+
type: "button",
|
|
2480
|
+
variant: "outline",
|
|
2481
|
+
size: "sm",
|
|
2482
|
+
onClick: j,
|
|
2483
|
+
"aria-label": "Pause recording",
|
|
2484
|
+
children: [
|
|
2485
|
+
/* @__PURE__ */ e(ge, { className: "size-4", "aria-hidden": "true" }),
|
|
2486
|
+
"Pause"
|
|
2487
|
+
]
|
|
2488
|
+
}
|
|
2489
|
+
),
|
|
2490
|
+
s === "paused" && /* @__PURE__ */ l(
|
|
2491
|
+
$,
|
|
2492
|
+
{
|
|
2493
|
+
type: "button",
|
|
2494
|
+
variant: "outline",
|
|
2495
|
+
size: "sm",
|
|
2496
|
+
onClick: V,
|
|
2497
|
+
"aria-label": "Resume recording",
|
|
2498
|
+
children: [
|
|
2499
|
+
/* @__PURE__ */ e(we, { className: "size-4", "aria-hidden": "true" }),
|
|
2500
|
+
"Resume"
|
|
2501
|
+
]
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
/* @__PURE__ */ l(
|
|
2505
|
+
$,
|
|
2506
|
+
{
|
|
2507
|
+
type: "button",
|
|
2508
|
+
variant: "destructive",
|
|
2509
|
+
size: "sm",
|
|
2510
|
+
onClick: I,
|
|
2511
|
+
"aria-label": "Stop recording",
|
|
2512
|
+
children: [
|
|
2513
|
+
/* @__PURE__ */ e(ot, { className: "size-4", "aria-hidden": "true" }),
|
|
2514
|
+
"Stop"
|
|
2515
|
+
]
|
|
2516
|
+
}
|
|
2517
|
+
)
|
|
2518
|
+
] })
|
|
2519
|
+
] }),
|
|
2520
|
+
s === "recorded" && L && /* @__PURE__ */ l("div", { className: "rounded-md border p-4 space-y-3", children: [
|
|
2521
|
+
/* @__PURE__ */ e(
|
|
2522
|
+
"canvas",
|
|
2523
|
+
{
|
|
2524
|
+
ref: J,
|
|
2525
|
+
width: 300,
|
|
2526
|
+
height: 60,
|
|
2527
|
+
className: "w-full h-[60px] rounded",
|
|
2528
|
+
"aria-hidden": "true"
|
|
2529
|
+
}
|
|
2530
|
+
),
|
|
2531
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
|
|
2532
|
+
/* @__PURE__ */ e(
|
|
2533
|
+
$,
|
|
2534
|
+
{
|
|
2535
|
+
type: "button",
|
|
2536
|
+
variant: "outline",
|
|
2537
|
+
size: "icon-sm",
|
|
2538
|
+
onClick: Ce,
|
|
2539
|
+
"aria-label": P ? "Pause playback" : "Play recording",
|
|
2540
|
+
children: P ? /* @__PURE__ */ e(ge, { className: "size-4", "aria-hidden": "true" }) : /* @__PURE__ */ e(ur, { className: "size-4", "aria-hidden": "true" })
|
|
2541
|
+
}
|
|
2542
|
+
),
|
|
2543
|
+
/* @__PURE__ */ e(
|
|
2544
|
+
"input",
|
|
2545
|
+
{
|
|
2546
|
+
type: "range",
|
|
2547
|
+
min: 0,
|
|
2548
|
+
max: A || 0,
|
|
2549
|
+
step: 0.1,
|
|
2550
|
+
value: z,
|
|
2551
|
+
onChange: Nt,
|
|
2552
|
+
className: "flex-1 h-2 accent-primary cursor-pointer",
|
|
2553
|
+
"aria-label": "Seek audio position"
|
|
2554
|
+
}
|
|
2555
|
+
),
|
|
2556
|
+
/* @__PURE__ */ l("span", { className: "text-xs font-mono tabular-nums text-muted-foreground whitespace-nowrap", children: [
|
|
2557
|
+
pe(z),
|
|
2558
|
+
" / ",
|
|
2559
|
+
pe(A)
|
|
2560
|
+
] })
|
|
2561
|
+
] }),
|
|
2562
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2563
|
+
/* @__PURE__ */ l(
|
|
2564
|
+
$,
|
|
2565
|
+
{
|
|
2566
|
+
type: "button",
|
|
2567
|
+
variant: "outline",
|
|
2568
|
+
size: "sm",
|
|
2569
|
+
onClick: wt,
|
|
2570
|
+
disabled: i,
|
|
2571
|
+
"aria-label": "Re-record",
|
|
2572
|
+
children: [
|
|
2573
|
+
/* @__PURE__ */ e(lt, { className: "size-4", "aria-hidden": "true" }),
|
|
2574
|
+
"Re-record"
|
|
2575
|
+
]
|
|
2576
|
+
}
|
|
2577
|
+
),
|
|
2578
|
+
/* @__PURE__ */ l(
|
|
2579
|
+
$,
|
|
2580
|
+
{
|
|
2581
|
+
type: "button",
|
|
2582
|
+
variant: "ghost",
|
|
2583
|
+
size: "sm",
|
|
2584
|
+
onClick: kt,
|
|
2585
|
+
disabled: i,
|
|
2586
|
+
className: "text-destructive hover:text-destructive",
|
|
2587
|
+
"aria-label": "Delete recording",
|
|
2588
|
+
children: [
|
|
2589
|
+
/* @__PURE__ */ e(ct, { className: "size-4", "aria-hidden": "true" }),
|
|
2590
|
+
"Delete"
|
|
2591
|
+
]
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2011
2594
|
] })
|
|
2012
2595
|
] })
|
|
2013
2596
|
]
|
|
2014
2597
|
}
|
|
2015
|
-
)
|
|
2598
|
+
)
|
|
2599
|
+
}
|
|
2600
|
+
);
|
|
2601
|
+
}
|
|
2602
|
+
function Ne(t) {
|
|
2603
|
+
const r = Math.floor(t / 60), n = Math.floor(t % 60);
|
|
2604
|
+
return `${r}:${n.toString().padStart(2, "0")}`;
|
|
2605
|
+
}
|
|
2606
|
+
function wi({
|
|
2607
|
+
label: t,
|
|
2608
|
+
error: r,
|
|
2609
|
+
helperText: n,
|
|
2610
|
+
required: a,
|
|
2611
|
+
disabled: i,
|
|
2612
|
+
id: m,
|
|
2613
|
+
className: d,
|
|
2614
|
+
value: o,
|
|
2615
|
+
onChange: f,
|
|
2616
|
+
maxDuration: h,
|
|
2617
|
+
maxSize: p,
|
|
2618
|
+
mimeType: u = "video/webm",
|
|
2619
|
+
videoBitsPerSecond: c
|
|
2620
|
+
}) {
|
|
2621
|
+
const [s, g] = R(
|
|
2622
|
+
o ? "recorded" : "idle"
|
|
2623
|
+
), [x, N] = R(0), [z, S] = R(), [A, k] = R(o ?? null), [P, D] = R("user"), T = F(null), B = F(null), L = F([]), C = F(null), M = F(null), _ = F(0), y = ae(
|
|
2624
|
+
(U) => {
|
|
2625
|
+
U && B.current && (U.srcObject = B.current);
|
|
2626
|
+
},
|
|
2627
|
+
// Re-run when recordingState changes so the ref fires on mount
|
|
2628
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2629
|
+
[s]
|
|
2630
|
+
), v = r ?? z;
|
|
2631
|
+
X(() => {
|
|
2632
|
+
o === null && A !== null && (k(null), g("idle"), N(0));
|
|
2633
|
+
}, [o, A]);
|
|
2634
|
+
const b = ae(() => {
|
|
2635
|
+
if (C.current && (clearInterval(C.current), C.current = null), M.current) {
|
|
2636
|
+
try {
|
|
2637
|
+
URL.revokeObjectURL(M.current);
|
|
2638
|
+
} catch {
|
|
2639
|
+
}
|
|
2640
|
+
M.current = null;
|
|
2641
|
+
}
|
|
2642
|
+
B.current && (B.current.getTracks().forEach((U) => U.stop()), B.current = null);
|
|
2643
|
+
}, []);
|
|
2644
|
+
X(() => b, [b]);
|
|
2645
|
+
async function O() {
|
|
2646
|
+
S(void 0);
|
|
2647
|
+
try {
|
|
2648
|
+
const U = await navigator.mediaDevices.getUserMedia({
|
|
2649
|
+
video: { facingMode: P },
|
|
2650
|
+
audio: !0
|
|
2651
|
+
});
|
|
2652
|
+
B.current = U;
|
|
2653
|
+
const I = {};
|
|
2654
|
+
u && MediaRecorder.isTypeSupported(u) && (I.mimeType = u), c && (I.videoBitsPerSecond = c);
|
|
2655
|
+
const j = new MediaRecorder(U, I);
|
|
2656
|
+
T.current = j, L.current = [], j.ondataavailable = (V) => {
|
|
2657
|
+
V.data.size > 0 && L.current.push(V.data);
|
|
2658
|
+
}, j.onstop = () => {
|
|
2659
|
+
const V = new Blob(L.current, {
|
|
2660
|
+
type: j.mimeType || u
|
|
2661
|
+
});
|
|
2662
|
+
if (p && V.size > p) {
|
|
2663
|
+
const se = (p / 1048576).toFixed(1);
|
|
2664
|
+
S(
|
|
2665
|
+
`Recording exceeds maximum size of ${se} MB`
|
|
2666
|
+
), g("idle"), N(0), U.getTracks().forEach((Ce) => Ce.stop()), B.current = null;
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
if (k(V), g("recorded"), f?.(V), M.current)
|
|
2670
|
+
try {
|
|
2671
|
+
URL.revokeObjectURL(M.current);
|
|
2672
|
+
} catch {
|
|
2673
|
+
}
|
|
2674
|
+
M.current = URL.createObjectURL(V), U.getTracks().forEach((se) => se.stop()), B.current = null;
|
|
2675
|
+
}, j.start(), g("recording"), N(0), _.current = performance.now(), C.current = setInterval(() => {
|
|
2676
|
+
const V = (performance.now() - _.current) / 1e3;
|
|
2677
|
+
N(V), h && V >= h && J();
|
|
2678
|
+
}, 100);
|
|
2679
|
+
} catch {
|
|
2680
|
+
S("Could not access camera/microphone. Please check permissions.");
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
function J() {
|
|
2684
|
+
C.current && (clearInterval(C.current), C.current = null), T.current && T.current.state !== "inactive" && T.current.stop();
|
|
2685
|
+
}
|
|
2686
|
+
function Q() {
|
|
2687
|
+
T.current && T.current.state === "recording" && (T.current.pause(), g("paused"), C.current && (clearInterval(C.current), C.current = null));
|
|
2688
|
+
}
|
|
2689
|
+
function H() {
|
|
2690
|
+
if (T.current && T.current.state === "paused") {
|
|
2691
|
+
T.current.resume(), g("recording");
|
|
2692
|
+
const U = x, I = performance.now();
|
|
2693
|
+
C.current = setInterval(() => {
|
|
2694
|
+
const j = U + (performance.now() - I) / 1e3;
|
|
2695
|
+
N(j), h && j >= h && J();
|
|
2696
|
+
}, 100);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
function te() {
|
|
2700
|
+
b(), g("idle"), k(null), N(0), S(void 0), f?.(null);
|
|
2701
|
+
}
|
|
2702
|
+
function ie() {
|
|
2703
|
+
b(), g("idle"), k(null), N(0), S(void 0), f?.(null);
|
|
2704
|
+
}
|
|
2705
|
+
function E() {
|
|
2706
|
+
D((U) => U === "user" ? "environment" : "user");
|
|
2707
|
+
}
|
|
2708
|
+
return /* @__PURE__ */ e(
|
|
2709
|
+
q,
|
|
2710
|
+
{
|
|
2711
|
+
id: m,
|
|
2712
|
+
label: t,
|
|
2713
|
+
error: v,
|
|
2714
|
+
helperText: n,
|
|
2715
|
+
required: a,
|
|
2716
|
+
disabled: i,
|
|
2717
|
+
className: d,
|
|
2718
|
+
children: ({ id: U, describedBy: I }) => /* @__PURE__ */ l(
|
|
2719
|
+
"div",
|
|
2720
|
+
{
|
|
2721
|
+
id: U,
|
|
2722
|
+
className: "space-y-3",
|
|
2723
|
+
"aria-invalid": !!v,
|
|
2724
|
+
"aria-describedby": I,
|
|
2725
|
+
"aria-required": a,
|
|
2726
|
+
children: [
|
|
2727
|
+
s === "idle" && /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-center rounded-md border-2 border-dashed p-6 sm:p-8", children: [
|
|
2728
|
+
/* @__PURE__ */ e(mr, { className: "size-8 text-muted-foreground mb-3", "aria-hidden": "true" }),
|
|
2729
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-4", children: "Click to start recording video" }),
|
|
2730
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2731
|
+
/* @__PURE__ */ l(
|
|
2732
|
+
$,
|
|
2733
|
+
{
|
|
2734
|
+
type: "button",
|
|
2735
|
+
variant: "outline",
|
|
2736
|
+
size: "sm",
|
|
2737
|
+
onClick: E,
|
|
2738
|
+
disabled: i,
|
|
2739
|
+
"aria-label": "Flip camera",
|
|
2740
|
+
children: [
|
|
2741
|
+
/* @__PURE__ */ e(fr, { className: "size-4", "aria-hidden": "true" }),
|
|
2742
|
+
P === "user" ? "Front" : "Back"
|
|
2743
|
+
]
|
|
2744
|
+
}
|
|
2745
|
+
),
|
|
2746
|
+
/* @__PURE__ */ l(
|
|
2747
|
+
$,
|
|
2748
|
+
{
|
|
2749
|
+
type: "button",
|
|
2750
|
+
variant: "default",
|
|
2751
|
+
onClick: O,
|
|
2752
|
+
disabled: i,
|
|
2753
|
+
"aria-label": "Start recording",
|
|
2754
|
+
children: [
|
|
2755
|
+
/* @__PURE__ */ e(hr, { className: "size-4", "aria-hidden": "true" }),
|
|
2756
|
+
"Start Recording"
|
|
2757
|
+
]
|
|
2758
|
+
}
|
|
2759
|
+
)
|
|
2760
|
+
] })
|
|
2761
|
+
] }),
|
|
2762
|
+
(s === "recording" || s === "paused") && /* @__PURE__ */ l("div", { className: "flex flex-col items-center rounded-md border p-4 sm:p-6 space-y-4", children: [
|
|
2763
|
+
/* @__PURE__ */ e(
|
|
2764
|
+
"video",
|
|
2765
|
+
{
|
|
2766
|
+
ref: y,
|
|
2767
|
+
autoPlay: !0,
|
|
2768
|
+
muted: !0,
|
|
2769
|
+
playsInline: !0,
|
|
2770
|
+
className: "w-full max-h-[300px] rounded bg-black object-cover",
|
|
2771
|
+
"aria-label": "Camera preview"
|
|
2772
|
+
}
|
|
2773
|
+
),
|
|
2774
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
|
|
2775
|
+
s === "recording" && /* @__PURE__ */ e(
|
|
2776
|
+
st,
|
|
2777
|
+
{
|
|
2778
|
+
className: "size-5 text-destructive animate-pulse",
|
|
2779
|
+
"aria-hidden": "true"
|
|
2780
|
+
}
|
|
2781
|
+
),
|
|
2782
|
+
s === "paused" && /* @__PURE__ */ e(
|
|
2783
|
+
ge,
|
|
2784
|
+
{
|
|
2785
|
+
className: "size-5 text-muted-foreground",
|
|
2786
|
+
"aria-hidden": "true"
|
|
2787
|
+
}
|
|
2788
|
+
),
|
|
2789
|
+
/* @__PURE__ */ l(
|
|
2790
|
+
"span",
|
|
2791
|
+
{
|
|
2792
|
+
className: "text-lg font-mono tabular-nums",
|
|
2793
|
+
role: "status",
|
|
2794
|
+
"aria-label": `Recording time: ${Ne(x)}`,
|
|
2795
|
+
children: [
|
|
2796
|
+
Ne(x),
|
|
2797
|
+
h && /* @__PURE__ */ l("span", { className: "text-muted-foreground", children: [
|
|
2798
|
+
" ",
|
|
2799
|
+
"/ ",
|
|
2800
|
+
Ne(h)
|
|
2801
|
+
] })
|
|
2802
|
+
]
|
|
2803
|
+
}
|
|
2804
|
+
)
|
|
2805
|
+
] }),
|
|
2806
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2807
|
+
s === "recording" && /* @__PURE__ */ l(
|
|
2808
|
+
$,
|
|
2809
|
+
{
|
|
2810
|
+
type: "button",
|
|
2811
|
+
variant: "outline",
|
|
2812
|
+
size: "sm",
|
|
2813
|
+
onClick: Q,
|
|
2814
|
+
"aria-label": "Pause recording",
|
|
2815
|
+
children: [
|
|
2816
|
+
/* @__PURE__ */ e(ge, { className: "size-4", "aria-hidden": "true" }),
|
|
2817
|
+
"Pause"
|
|
2818
|
+
]
|
|
2819
|
+
}
|
|
2820
|
+
),
|
|
2821
|
+
s === "paused" && /* @__PURE__ */ l(
|
|
2822
|
+
$,
|
|
2823
|
+
{
|
|
2824
|
+
type: "button",
|
|
2825
|
+
variant: "outline",
|
|
2826
|
+
size: "sm",
|
|
2827
|
+
onClick: H,
|
|
2828
|
+
"aria-label": "Resume recording",
|
|
2829
|
+
children: [
|
|
2830
|
+
/* @__PURE__ */ e(we, { className: "size-4", "aria-hidden": "true" }),
|
|
2831
|
+
"Resume"
|
|
2832
|
+
]
|
|
2833
|
+
}
|
|
2834
|
+
),
|
|
2835
|
+
/* @__PURE__ */ l(
|
|
2836
|
+
$,
|
|
2837
|
+
{
|
|
2838
|
+
type: "button",
|
|
2839
|
+
variant: "destructive",
|
|
2840
|
+
size: "sm",
|
|
2841
|
+
onClick: J,
|
|
2842
|
+
"aria-label": "Stop recording",
|
|
2843
|
+
children: [
|
|
2844
|
+
/* @__PURE__ */ e(ot, { className: "size-4", "aria-hidden": "true" }),
|
|
2845
|
+
"Stop"
|
|
2846
|
+
]
|
|
2847
|
+
}
|
|
2848
|
+
)
|
|
2849
|
+
] })
|
|
2850
|
+
] }),
|
|
2851
|
+
s === "recorded" && A && /* @__PURE__ */ l("div", { className: "rounded-md border p-4 space-y-3", children: [
|
|
2852
|
+
/* @__PURE__ */ e(
|
|
2853
|
+
"video",
|
|
2854
|
+
{
|
|
2855
|
+
src: M.current ?? void 0,
|
|
2856
|
+
controls: !0,
|
|
2857
|
+
playsInline: !0,
|
|
2858
|
+
className: "w-full max-h-[300px] rounded bg-black",
|
|
2859
|
+
"aria-label": "Recorded video"
|
|
2860
|
+
}
|
|
2861
|
+
),
|
|
2862
|
+
/* @__PURE__ */ l("p", { className: "text-xs font-mono tabular-nums text-muted-foreground", children: [
|
|
2863
|
+
"Duration: ",
|
|
2864
|
+
Ne(x)
|
|
2865
|
+
] }),
|
|
2866
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2867
|
+
/* @__PURE__ */ l(
|
|
2868
|
+
$,
|
|
2869
|
+
{
|
|
2870
|
+
type: "button",
|
|
2871
|
+
variant: "outline",
|
|
2872
|
+
size: "sm",
|
|
2873
|
+
onClick: te,
|
|
2874
|
+
disabled: i,
|
|
2875
|
+
"aria-label": "Re-record",
|
|
2876
|
+
children: [
|
|
2877
|
+
/* @__PURE__ */ e(lt, { className: "size-4", "aria-hidden": "true" }),
|
|
2878
|
+
"Re-record"
|
|
2879
|
+
]
|
|
2880
|
+
}
|
|
2881
|
+
),
|
|
2882
|
+
/* @__PURE__ */ l(
|
|
2883
|
+
$,
|
|
2884
|
+
{
|
|
2885
|
+
type: "button",
|
|
2886
|
+
variant: "ghost",
|
|
2887
|
+
size: "sm",
|
|
2888
|
+
onClick: ie,
|
|
2889
|
+
disabled: i,
|
|
2890
|
+
className: "text-destructive hover:text-destructive",
|
|
2891
|
+
"aria-label": "Delete recording",
|
|
2892
|
+
children: [
|
|
2893
|
+
/* @__PURE__ */ e(ct, { className: "size-4", "aria-hidden": "true" }),
|
|
2894
|
+
"Delete"
|
|
2895
|
+
]
|
|
2896
|
+
}
|
|
2897
|
+
)
|
|
2898
|
+
] })
|
|
2899
|
+
] })
|
|
2900
|
+
]
|
|
2901
|
+
}
|
|
2902
|
+
)
|
|
2903
|
+
}
|
|
2904
|
+
);
|
|
2905
|
+
}
|
|
2906
|
+
function et({
|
|
2907
|
+
columns: t,
|
|
2908
|
+
sort: r,
|
|
2909
|
+
onSortChange: n,
|
|
2910
|
+
allItemIds: a,
|
|
2911
|
+
selectedIds: i,
|
|
2912
|
+
onSelectionAction: m
|
|
2913
|
+
}) {
|
|
2914
|
+
const d = a.length > 0 && i.size === a.length, o = i.size > 0 && i.size < a.length, f = () => {
|
|
2915
|
+
m({ type: "select-all", ids: a });
|
|
2916
|
+
}, h = (c) => {
|
|
2917
|
+
r?.columnKey === c ? r.direction === "asc" ? n({ columnKey: c, direction: "desc" }) : n(null) : n({ columnKey: c, direction: "asc" });
|
|
2918
|
+
}, p = (c, s) => {
|
|
2919
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), h(s));
|
|
2920
|
+
}, u = t.filter((c) => c.visible !== !1);
|
|
2921
|
+
return /* @__PURE__ */ e("thead", { "data-slot": "table-header", children: /* @__PURE__ */ l("tr", { className: "bg-muted/50", children: [
|
|
2922
|
+
/* @__PURE__ */ e("th", { scope: "col", className: "w-10 px-2 py-2", children: /* @__PURE__ */ e(
|
|
2923
|
+
Pe,
|
|
2924
|
+
{
|
|
2925
|
+
checked: d ? !0 : o ? "indeterminate" : !1,
|
|
2926
|
+
onCheckedChange: f,
|
|
2927
|
+
"aria-label": "Select all"
|
|
2928
|
+
}
|
|
2929
|
+
) }),
|
|
2930
|
+
u.map((c) => {
|
|
2931
|
+
const s = c.sortable !== !1, g = r?.columnKey === c.key, x = g ? r.direction : null;
|
|
2932
|
+
return /* @__PURE__ */ e(
|
|
2933
|
+
"th",
|
|
2934
|
+
{
|
|
2935
|
+
scope: "col",
|
|
2936
|
+
className: `px-4 py-2 text-left text-muted-foreground text-xs font-medium ${s ? "cursor-pointer select-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" : ""}`,
|
|
2937
|
+
onClick: s ? () => h(c.key) : void 0,
|
|
2938
|
+
onKeyDown: s ? (z) => p(z, c.key) : void 0,
|
|
2939
|
+
tabIndex: s ? 0 : void 0,
|
|
2940
|
+
"aria-sort": g ? x === "asc" ? "ascending" : "descending" : s ? "none" : void 0,
|
|
2941
|
+
style: c.width ? { width: c.width } : void 0,
|
|
2942
|
+
children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
2943
|
+
c.label,
|
|
2944
|
+
s && g && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "text-foreground", children: x === "asc" ? /* @__PURE__ */ e(pr, { className: "size-3.5" }) : /* @__PURE__ */ e(gr, { className: "size-3.5" }) })
|
|
2945
|
+
] })
|
|
2946
|
+
},
|
|
2947
|
+
c.key
|
|
2948
|
+
);
|
|
2949
|
+
})
|
|
2950
|
+
] }) });
|
|
2951
|
+
}
|
|
2952
|
+
function tt({
|
|
2953
|
+
item: t,
|
|
2954
|
+
columns: r,
|
|
2955
|
+
isSelected: n,
|
|
2956
|
+
onSelect: a,
|
|
2957
|
+
onItemOpen: i,
|
|
2958
|
+
contextMenuActions: m,
|
|
2959
|
+
selectedItems: d
|
|
2960
|
+
}) {
|
|
2961
|
+
const o = (s) => {
|
|
2962
|
+
s.stopPropagation(), a(t.id, !1, !1);
|
|
2963
|
+
}, f = (s) => {
|
|
2964
|
+
a(t.id, s.shiftKey, s.metaKey || s.ctrlKey);
|
|
2965
|
+
}, h = () => {
|
|
2966
|
+
i?.(t);
|
|
2967
|
+
}, p = (s) => {
|
|
2968
|
+
s.key === "Enter" ? (s.preventDefault(), i?.(t)) : s.key === " " && (s.preventDefault(), a(t.id, s.shiftKey, s.metaKey || s.ctrlKey));
|
|
2969
|
+
}, u = r.filter((s) => s.visible !== !1), c = /* @__PURE__ */ l(
|
|
2970
|
+
"tr",
|
|
2971
|
+
{
|
|
2972
|
+
"data-slot": "table-row",
|
|
2973
|
+
"data-state": n ? "selected" : void 0,
|
|
2974
|
+
"aria-selected": n,
|
|
2975
|
+
tabIndex: 0,
|
|
2976
|
+
className: `${n ? "bg-accent" : "hover:bg-muted/50"} cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,
|
|
2977
|
+
onClick: f,
|
|
2978
|
+
onDoubleClick: h,
|
|
2979
|
+
onKeyDown: p,
|
|
2980
|
+
children: [
|
|
2981
|
+
/* @__PURE__ */ e("td", { className: "w-10 px-2 py-2", onClick: o, children: /* @__PURE__ */ e(
|
|
2982
|
+
Pe,
|
|
2983
|
+
{
|
|
2984
|
+
checked: n,
|
|
2985
|
+
"aria-label": `Select ${t.name}`,
|
|
2986
|
+
tabIndex: -1
|
|
2987
|
+
}
|
|
2988
|
+
) }),
|
|
2989
|
+
u.map((s) => {
|
|
2990
|
+
let g;
|
|
2991
|
+
s.key === "name" ? g = t.name : g = t.metadata[s.key];
|
|
2992
|
+
const x = s.render ? s.render(g, t) : String(g ?? "");
|
|
2993
|
+
return /* @__PURE__ */ e("td", { className: "px-4 py-2 text-sm", children: x }, s.key);
|
|
2994
|
+
})
|
|
2995
|
+
]
|
|
2996
|
+
}
|
|
2997
|
+
);
|
|
2998
|
+
return !m || m.length === 0 ? c : /* @__PURE__ */ l(mt, { children: [
|
|
2999
|
+
/* @__PURE__ */ e(ft, { asChild: !0, children: c }),
|
|
3000
|
+
/* @__PURE__ */ e(ht, { children: m.map((s) => /* @__PURE__ */ l(
|
|
3001
|
+
pt,
|
|
3002
|
+
{
|
|
3003
|
+
onClick: () => s.onAction(d),
|
|
3004
|
+
variant: s.destructive ? "destructive" : "default",
|
|
3005
|
+
disabled: s.disabled,
|
|
3006
|
+
children: [
|
|
3007
|
+
s.icon && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: s.icon }),
|
|
3008
|
+
s.label
|
|
3009
|
+
]
|
|
3010
|
+
},
|
|
3011
|
+
s.id
|
|
3012
|
+
)) })
|
|
3013
|
+
] });
|
|
3014
|
+
}
|
|
3015
|
+
const Bn = 100, On = 40;
|
|
3016
|
+
function Fn({
|
|
3017
|
+
items: t,
|
|
3018
|
+
columns: r,
|
|
3019
|
+
sort: n,
|
|
3020
|
+
onSortChange: a,
|
|
3021
|
+
selectedIds: i,
|
|
3022
|
+
onSelectionAction: m,
|
|
3023
|
+
onItemOpen: d,
|
|
3024
|
+
contextMenuActions: o,
|
|
3025
|
+
virtualizeThreshold: f = Bn,
|
|
3026
|
+
className: h
|
|
3027
|
+
}) {
|
|
3028
|
+
const p = t.map((z) => z.id), u = t.filter((z) => i.has(z.id)), c = F(null), s = t.length > f, g = gt({
|
|
3029
|
+
count: t.length,
|
|
3030
|
+
getScrollElement: () => c.current,
|
|
3031
|
+
estimateSize: () => On,
|
|
3032
|
+
overscan: 20,
|
|
3033
|
+
enabled: s
|
|
3034
|
+
}), x = (z, S, A) => {
|
|
3035
|
+
m({ type: "select", id: z, shiftKey: S, metaKey: A });
|
|
3036
|
+
};
|
|
3037
|
+
if (!s)
|
|
3038
|
+
return /* @__PURE__ */ e("div", { "data-testid": "table-view", "data-slot": "table-view", className: w("overflow-auto", h), children: /* @__PURE__ */ l("table", { className: "w-full border-collapse text-sm", "aria-label": "Items list", children: [
|
|
3039
|
+
/* @__PURE__ */ e(
|
|
3040
|
+
et,
|
|
3041
|
+
{
|
|
3042
|
+
columns: r,
|
|
3043
|
+
sort: n,
|
|
3044
|
+
onSortChange: a,
|
|
3045
|
+
allItemIds: p,
|
|
3046
|
+
selectedIds: i,
|
|
3047
|
+
onSelectionAction: m
|
|
3048
|
+
}
|
|
3049
|
+
),
|
|
3050
|
+
/* @__PURE__ */ e("tbody", { children: t.map((z) => /* @__PURE__ */ e(
|
|
3051
|
+
tt,
|
|
3052
|
+
{
|
|
3053
|
+
item: z,
|
|
3054
|
+
columns: r,
|
|
3055
|
+
isSelected: i.has(z.id),
|
|
3056
|
+
onSelect: x,
|
|
3057
|
+
onItemOpen: d,
|
|
3058
|
+
contextMenuActions: o,
|
|
3059
|
+
selectedItems: u
|
|
3060
|
+
},
|
|
3061
|
+
z.id
|
|
3062
|
+
)) })
|
|
3063
|
+
] }) });
|
|
3064
|
+
const N = g.getVirtualItems();
|
|
3065
|
+
return /* @__PURE__ */ e(
|
|
3066
|
+
"div",
|
|
3067
|
+
{
|
|
3068
|
+
ref: c,
|
|
3069
|
+
"data-testid": "table-view",
|
|
3070
|
+
"data-slot": "table-view",
|
|
3071
|
+
className: w("overflow-auto", h),
|
|
3072
|
+
style: { maxHeight: "80vh" },
|
|
3073
|
+
children: /* @__PURE__ */ l("table", { className: "w-full border-collapse text-sm", "aria-label": "Items list", children: [
|
|
3074
|
+
/* @__PURE__ */ e(
|
|
3075
|
+
et,
|
|
3076
|
+
{
|
|
3077
|
+
columns: r,
|
|
3078
|
+
sort: n,
|
|
3079
|
+
onSortChange: a,
|
|
3080
|
+
allItemIds: p,
|
|
3081
|
+
selectedIds: i,
|
|
3082
|
+
onSelectionAction: m
|
|
3083
|
+
}
|
|
3084
|
+
),
|
|
3085
|
+
/* @__PURE__ */ l("tbody", { children: [
|
|
3086
|
+
N.length > 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
3087
|
+
"td",
|
|
3088
|
+
{
|
|
3089
|
+
colSpan: r.length + 1,
|
|
3090
|
+
style: { height: N[0].start, padding: 0, border: 0 }
|
|
3091
|
+
}
|
|
3092
|
+
) }),
|
|
3093
|
+
N.map((z) => {
|
|
3094
|
+
const S = t[z.index];
|
|
3095
|
+
return /* @__PURE__ */ e(
|
|
3096
|
+
tt,
|
|
3097
|
+
{
|
|
3098
|
+
item: S,
|
|
3099
|
+
columns: r,
|
|
3100
|
+
isSelected: i.has(S.id),
|
|
3101
|
+
onSelect: x,
|
|
3102
|
+
onItemOpen: d,
|
|
3103
|
+
contextMenuActions: o,
|
|
3104
|
+
selectedItems: u
|
|
3105
|
+
},
|
|
3106
|
+
S.id
|
|
3107
|
+
);
|
|
3108
|
+
}),
|
|
3109
|
+
N.length > 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
3110
|
+
"td",
|
|
3111
|
+
{
|
|
3112
|
+
colSpan: r.length + 1,
|
|
3113
|
+
style: {
|
|
3114
|
+
height: g.getTotalSize() - N[N.length - 1].end,
|
|
3115
|
+
padding: 0,
|
|
3116
|
+
border: 0
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
) })
|
|
3120
|
+
] })
|
|
3121
|
+
] })
|
|
3122
|
+
}
|
|
3123
|
+
);
|
|
3124
|
+
}
|
|
3125
|
+
function Te({
|
|
3126
|
+
item: t,
|
|
3127
|
+
density: r,
|
|
3128
|
+
isSelected: n,
|
|
3129
|
+
onSelect: a,
|
|
3130
|
+
onItemOpen: i,
|
|
3131
|
+
contextMenuActions: m,
|
|
3132
|
+
selectedItems: d
|
|
3133
|
+
}) {
|
|
3134
|
+
const o = (u) => {
|
|
3135
|
+
a(t.id, u.shiftKey, u.metaKey || u.ctrlKey);
|
|
3136
|
+
}, f = () => {
|
|
3137
|
+
i?.(t);
|
|
3138
|
+
}, h = (u) => {
|
|
3139
|
+
u.key === "Enter" ? (u.preventDefault(), i?.(t)) : u.key === " " && (u.preventDefault(), a(t.id, u.shiftKey, u.metaKey || u.ctrlKey));
|
|
3140
|
+
}, p = /* @__PURE__ */ l(
|
|
3141
|
+
"div",
|
|
3142
|
+
{
|
|
3143
|
+
role: "option",
|
|
3144
|
+
"data-slot": "card-item",
|
|
3145
|
+
tabIndex: 0,
|
|
3146
|
+
"aria-selected": n,
|
|
3147
|
+
"aria-label": t.name,
|
|
3148
|
+
onClick: o,
|
|
3149
|
+
onDoubleClick: f,
|
|
3150
|
+
onKeyDown: h,
|
|
3151
|
+
className: w(
|
|
3152
|
+
"flex cursor-pointer flex-col gap-1 rounded-lg border transition-colors",
|
|
3153
|
+
"hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3154
|
+
r === "compact" && "p-1",
|
|
3155
|
+
r === "regular" && "p-2",
|
|
3156
|
+
r === "expanded" && "p-3",
|
|
3157
|
+
n && "ring-2 ring-primary bg-accent"
|
|
3158
|
+
),
|
|
3159
|
+
children: [
|
|
3160
|
+
/* @__PURE__ */ e("div", { className: "aspect-square overflow-hidden rounded-md bg-muted", children: t.thumbnail ? /* @__PURE__ */ e(
|
|
3161
|
+
"img",
|
|
3162
|
+
{
|
|
3163
|
+
src: t.thumbnail,
|
|
3164
|
+
alt: t.name,
|
|
3165
|
+
className: "h-full w-full object-cover"
|
|
3166
|
+
}
|
|
3167
|
+
) : /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center text-muted-foreground", "aria-hidden": "true", children: /* @__PURE__ */ e(br, { className: "size-8" }) }) }),
|
|
3168
|
+
/* @__PURE__ */ e(
|
|
3169
|
+
"p",
|
|
3170
|
+
{
|
|
3171
|
+
className: w(
|
|
3172
|
+
"truncate font-medium",
|
|
3173
|
+
r === "compact" ? "text-xs" : "text-sm"
|
|
3174
|
+
),
|
|
3175
|
+
children: t.name
|
|
3176
|
+
}
|
|
3177
|
+
),
|
|
3178
|
+
r !== "compact" && /* @__PURE__ */ l("div", { className: "flex flex-col gap-0.5", children: [
|
|
3179
|
+
r === "regular" && Object.entries(t.metadata).slice(0, 2).map(([u, c]) => /* @__PURE__ */ l(
|
|
3180
|
+
"span",
|
|
3181
|
+
{
|
|
3182
|
+
className: "truncate text-xs text-muted-foreground",
|
|
3183
|
+
children: [
|
|
3184
|
+
/* @__PURE__ */ l("span", { className: "sr-only", children: [
|
|
3185
|
+
u,
|
|
3186
|
+
": "
|
|
3187
|
+
] }),
|
|
3188
|
+
String(c)
|
|
3189
|
+
]
|
|
3190
|
+
},
|
|
3191
|
+
u
|
|
3192
|
+
)),
|
|
3193
|
+
r === "expanded" && Object.entries(t.metadata).map(([u, c]) => /* @__PURE__ */ l("span", { className: "text-xs text-muted-foreground", children: [
|
|
3194
|
+
u,
|
|
3195
|
+
": ",
|
|
3196
|
+
String(c)
|
|
3197
|
+
] }, u))
|
|
3198
|
+
] })
|
|
3199
|
+
]
|
|
3200
|
+
}
|
|
3201
|
+
);
|
|
3202
|
+
return !m || m.length === 0 ? p : /* @__PURE__ */ l(mt, { children: [
|
|
3203
|
+
/* @__PURE__ */ e(ft, { asChild: !0, children: p }),
|
|
3204
|
+
/* @__PURE__ */ e(ht, { children: m.map((u) => /* @__PURE__ */ l(
|
|
3205
|
+
pt,
|
|
3206
|
+
{
|
|
3207
|
+
disabled: u.disabled,
|
|
3208
|
+
variant: u.destructive ? "destructive" : "default",
|
|
3209
|
+
onClick: () => u.onAction(d),
|
|
3210
|
+
children: [
|
|
3211
|
+
u.icon && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: u.icon }),
|
|
3212
|
+
u.label
|
|
3213
|
+
]
|
|
3214
|
+
},
|
|
3215
|
+
u.id
|
|
3216
|
+
)) })
|
|
3217
|
+
] });
|
|
3218
|
+
}
|
|
3219
|
+
function _n(t) {
|
|
3220
|
+
const {
|
|
3221
|
+
attributes: r,
|
|
3222
|
+
listeners: n,
|
|
3223
|
+
setNodeRef: a,
|
|
3224
|
+
transform: i,
|
|
3225
|
+
transition: m,
|
|
3226
|
+
isDragging: d
|
|
3227
|
+
} = Fr({ id: t.item.id }), o = {
|
|
3228
|
+
transform: Hr.Transform.toString(i),
|
|
3229
|
+
transition: m,
|
|
3230
|
+
opacity: d ? 0.5 : 1
|
|
3231
|
+
};
|
|
3232
|
+
return /* @__PURE__ */ e(
|
|
3233
|
+
"div",
|
|
3234
|
+
{
|
|
3235
|
+
ref: a,
|
|
3236
|
+
role: "presentation",
|
|
3237
|
+
style: o,
|
|
3238
|
+
...r,
|
|
3239
|
+
...n,
|
|
3240
|
+
"aria-roledescription": "sortable item",
|
|
3241
|
+
"aria-label": `Draggable: ${t.item.name}`,
|
|
3242
|
+
children: /* @__PURE__ */ e(Te, { ...t })
|
|
3243
|
+
}
|
|
3244
|
+
);
|
|
3245
|
+
}
|
|
3246
|
+
const jn = {
|
|
3247
|
+
compact: {
|
|
3248
|
+
gridCols: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6",
|
|
3249
|
+
gap: "gap-2"
|
|
3250
|
+
},
|
|
3251
|
+
regular: {
|
|
3252
|
+
gridCols: "grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
3253
|
+
gap: "gap-4"
|
|
3254
|
+
},
|
|
3255
|
+
expanded: {
|
|
3256
|
+
gridCols: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
3257
|
+
gap: "gap-6"
|
|
3258
|
+
}
|
|
3259
|
+
}, Kn = 200, Hn = 100, Vn = 280, Gn = {
|
|
3260
|
+
compact: 6,
|
|
3261
|
+
regular: 4,
|
|
3262
|
+
expanded: 3
|
|
3263
|
+
};
|
|
3264
|
+
function Wn({
|
|
3265
|
+
items: t,
|
|
3266
|
+
density: r,
|
|
3267
|
+
selectedIds: n,
|
|
3268
|
+
onSelectionAction: a,
|
|
3269
|
+
onItemOpen: i,
|
|
3270
|
+
contextMenuActions: m,
|
|
3271
|
+
onReorder: d,
|
|
3272
|
+
virtualizeThreshold: o = Hn,
|
|
3273
|
+
className: f
|
|
3274
|
+
}) {
|
|
3275
|
+
const h = t.filter((L) => n.has(L.id)), { gridCols: p, gap: u } = jn[r], c = F(null), s = t.length > o, g = Gn[r] ?? 4, x = Math.ceil(t.length / g), N = !!d, z = Dr(
|
|
3276
|
+
Xe(Ur, { activationConstraint: { distance: 8 } }),
|
|
3277
|
+
Xe($r)
|
|
3278
|
+
), S = gt({
|
|
3279
|
+
count: x,
|
|
3280
|
+
getScrollElement: () => c.current,
|
|
3281
|
+
estimateSize: () => Vn,
|
|
3282
|
+
overscan: 5,
|
|
3283
|
+
enabled: s
|
|
3284
|
+
}), A = (L, C, M) => {
|
|
3285
|
+
a({ type: "select", id: L, shiftKey: C, metaKey: M });
|
|
3286
|
+
}, k = ae(
|
|
3287
|
+
(L) => {
|
|
3288
|
+
const { active: C, over: M } = L;
|
|
3289
|
+
if (!M || C.id === M.id || !d) return;
|
|
3290
|
+
const _ = t.findIndex((v) => v.id === C.id), y = t.findIndex((v) => v.id === M.id);
|
|
3291
|
+
if (_ !== -1 && y !== -1) {
|
|
3292
|
+
const v = _r(t, _, y);
|
|
3293
|
+
d(v.map((b) => b.id));
|
|
3294
|
+
}
|
|
3295
|
+
},
|
|
3296
|
+
[t, d]
|
|
3297
|
+
), P = t.map((L) => L.id), D = N ? _n : Te, T = () => t.map((L) => /* @__PURE__ */ e(
|
|
3298
|
+
D,
|
|
3299
|
+
{
|
|
3300
|
+
item: L,
|
|
3301
|
+
density: r,
|
|
3302
|
+
isSelected: n.has(L.id),
|
|
3303
|
+
onSelect: A,
|
|
3304
|
+
onItemOpen: i,
|
|
3305
|
+
contextMenuActions: m,
|
|
3306
|
+
selectedItems: h
|
|
3307
|
+
},
|
|
3308
|
+
L.id
|
|
3309
|
+
));
|
|
3310
|
+
if (!s) {
|
|
3311
|
+
const L = /* @__PURE__ */ l(
|
|
3312
|
+
"div",
|
|
3313
|
+
{
|
|
3314
|
+
"data-testid": "card-view",
|
|
3315
|
+
"data-slot": "card-view",
|
|
3316
|
+
role: "listbox",
|
|
3317
|
+
"aria-label": "Items grid",
|
|
3318
|
+
"aria-multiselectable": "true",
|
|
3319
|
+
className: w("grid", p, u, f),
|
|
3320
|
+
children: [
|
|
3321
|
+
t.length === 0 && /* @__PURE__ */ e("div", { className: "sr-only", children: "No items" }),
|
|
3322
|
+
T()
|
|
3323
|
+
]
|
|
3324
|
+
}
|
|
3325
|
+
);
|
|
3326
|
+
return N ? /* @__PURE__ */ e(
|
|
3327
|
+
Br,
|
|
3328
|
+
{
|
|
3329
|
+
sensors: z,
|
|
3330
|
+
collisionDetection: Or,
|
|
3331
|
+
onDragEnd: k,
|
|
3332
|
+
accessibility: {
|
|
3333
|
+
screenReaderInstructions: {
|
|
3334
|
+
draggable: "To pick up a draggable item, press space or enter. Use arrow keys to move. Press space or enter again to drop, or press escape to cancel."
|
|
3335
|
+
}
|
|
3336
|
+
},
|
|
3337
|
+
children: /* @__PURE__ */ e(jr, { items: P, strategy: Kr, children: L })
|
|
3338
|
+
}
|
|
3339
|
+
) : L;
|
|
3340
|
+
}
|
|
3341
|
+
const B = S.getVirtualItems();
|
|
3342
|
+
return /* @__PURE__ */ e(
|
|
3343
|
+
"div",
|
|
3344
|
+
{
|
|
3345
|
+
ref: c,
|
|
3346
|
+
"data-testid": "card-view",
|
|
3347
|
+
"data-slot": "card-view",
|
|
3348
|
+
role: "listbox",
|
|
3349
|
+
"aria-label": "Items grid",
|
|
3350
|
+
"aria-multiselectable": "true",
|
|
3351
|
+
className: w("overflow-auto", f),
|
|
3352
|
+
style: { maxHeight: "80vh" },
|
|
3353
|
+
children: /* @__PURE__ */ e("div", { role: "presentation", style: { height: S.getTotalSize(), position: "relative" }, children: B.map((L) => {
|
|
3354
|
+
const C = L.index * g, M = t.slice(C, C + g);
|
|
3355
|
+
return /* @__PURE__ */ e(
|
|
3356
|
+
"div",
|
|
3357
|
+
{
|
|
3358
|
+
role: "presentation",
|
|
3359
|
+
className: w("grid", p, u),
|
|
3360
|
+
style: {
|
|
3361
|
+
position: "absolute",
|
|
3362
|
+
top: 0,
|
|
3363
|
+
left: 0,
|
|
3364
|
+
width: "100%",
|
|
3365
|
+
transform: `translateY(${L.start}px)`
|
|
3366
|
+
},
|
|
3367
|
+
children: M.map((_) => /* @__PURE__ */ e(
|
|
3368
|
+
Te,
|
|
3369
|
+
{
|
|
3370
|
+
item: _,
|
|
3371
|
+
density: r,
|
|
3372
|
+
isSelected: n.has(_.id),
|
|
3373
|
+
onSelect: A,
|
|
3374
|
+
onItemOpen: i,
|
|
3375
|
+
contextMenuActions: m,
|
|
3376
|
+
selectedItems: h
|
|
3377
|
+
},
|
|
3378
|
+
_.id
|
|
3379
|
+
))
|
|
3380
|
+
},
|
|
3381
|
+
L.key
|
|
3382
|
+
);
|
|
3383
|
+
}) })
|
|
3384
|
+
}
|
|
3385
|
+
);
|
|
3386
|
+
}
|
|
3387
|
+
function Qn({
|
|
3388
|
+
view: t,
|
|
3389
|
+
onViewChange: r,
|
|
3390
|
+
searchValue: n,
|
|
3391
|
+
onSearchChange: a,
|
|
3392
|
+
columns: i,
|
|
3393
|
+
onColumnVisibilityChange: m,
|
|
3394
|
+
allowSplitView: d,
|
|
3395
|
+
isSplitViewOpen: o,
|
|
3396
|
+
onSplitViewToggle: f,
|
|
3397
|
+
cardDensity: h,
|
|
3398
|
+
onCardDensityChange: p,
|
|
3399
|
+
toolbarLeft: u,
|
|
3400
|
+
searchPlaceholder: c,
|
|
3401
|
+
className: s
|
|
3402
|
+
}) {
|
|
3403
|
+
return /* @__PURE__ */ l(
|
|
3404
|
+
"div",
|
|
3405
|
+
{
|
|
3406
|
+
"data-slot": "list-view-toolbar",
|
|
3407
|
+
role: "toolbar",
|
|
3408
|
+
"aria-label": "List view controls",
|
|
3409
|
+
className: w("flex items-center gap-2 px-2 py-1.5", s),
|
|
3410
|
+
children: [
|
|
3411
|
+
u,
|
|
3412
|
+
/* @__PURE__ */ l("div", { className: "relative flex-1 max-w-sm", children: [
|
|
3413
|
+
/* @__PURE__ */ e(at, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground", "aria-hidden": "true" }),
|
|
3414
|
+
/* @__PURE__ */ e(
|
|
3415
|
+
ee,
|
|
3416
|
+
{
|
|
3417
|
+
value: n,
|
|
3418
|
+
onChange: (g) => a(g.target.value),
|
|
3419
|
+
placeholder: c ?? "Search...",
|
|
3420
|
+
"aria-label": c ?? "Search items",
|
|
3421
|
+
className: "pl-8 h-8"
|
|
3422
|
+
}
|
|
3423
|
+
)
|
|
3424
|
+
] }),
|
|
3425
|
+
/* @__PURE__ */ l("div", { className: "flex items-center rounded-md border", role: "group", "aria-label": "View mode", children: [
|
|
3426
|
+
/* @__PURE__ */ e(
|
|
3427
|
+
$,
|
|
3428
|
+
{
|
|
3429
|
+
variant: t === "table" ? "secondary" : "ghost",
|
|
3430
|
+
size: "sm",
|
|
3431
|
+
onClick: () => r("table"),
|
|
3432
|
+
"aria-label": "Table view",
|
|
3433
|
+
"aria-pressed": t === "table",
|
|
3434
|
+
className: "rounded-r-none h-8",
|
|
3435
|
+
children: /* @__PURE__ */ e(it, { className: "size-4", "aria-hidden": "true" })
|
|
3436
|
+
}
|
|
3437
|
+
),
|
|
3438
|
+
/* @__PURE__ */ e(
|
|
3439
|
+
$,
|
|
3440
|
+
{
|
|
3441
|
+
variant: t === "card" ? "secondary" : "ghost",
|
|
3442
|
+
size: "sm",
|
|
3443
|
+
onClick: () => r("card"),
|
|
3444
|
+
"aria-label": "Card view",
|
|
3445
|
+
"aria-pressed": t === "card",
|
|
3446
|
+
className: "rounded-l-none h-8",
|
|
3447
|
+
children: /* @__PURE__ */ e(He, { className: "size-4", "aria-hidden": "true" })
|
|
3448
|
+
}
|
|
3449
|
+
)
|
|
3450
|
+
] }),
|
|
3451
|
+
t === "table" && i && m && /* @__PURE__ */ l(Ye, { children: [
|
|
3452
|
+
/* @__PURE__ */ e(Ze, { asChild: !0, children: /* @__PURE__ */ e(
|
|
3453
|
+
$,
|
|
3454
|
+
{
|
|
3455
|
+
variant: "outline",
|
|
3456
|
+
size: "sm",
|
|
3457
|
+
className: "h-8",
|
|
3458
|
+
"aria-label": "Toggle columns",
|
|
3459
|
+
children: /* @__PURE__ */ e(vr, { className: "size-4", "aria-hidden": "true" })
|
|
3460
|
+
}
|
|
3461
|
+
) }),
|
|
3462
|
+
/* @__PURE__ */ e(Je, { align: "end", children: i.map((g) => /* @__PURE__ */ e(
|
|
3463
|
+
Wr,
|
|
3464
|
+
{
|
|
3465
|
+
checked: g.visible !== !1,
|
|
3466
|
+
onCheckedChange: () => m(g.key),
|
|
3467
|
+
children: g.label
|
|
3468
|
+
},
|
|
3469
|
+
g.key
|
|
3470
|
+
)) })
|
|
3471
|
+
] }),
|
|
3472
|
+
t === "card" && h && p && /* @__PURE__ */ l(Ye, { children: [
|
|
3473
|
+
/* @__PURE__ */ e(Ze, { asChild: !0, children: /* @__PURE__ */ e(
|
|
3474
|
+
$,
|
|
3475
|
+
{
|
|
3476
|
+
variant: "outline",
|
|
3477
|
+
size: "sm",
|
|
3478
|
+
className: "h-8",
|
|
3479
|
+
"aria-label": "Card density",
|
|
3480
|
+
children: /* @__PURE__ */ e(He, { className: "size-4", "aria-hidden": "true" })
|
|
3481
|
+
}
|
|
3482
|
+
) }),
|
|
3483
|
+
/* @__PURE__ */ e(Je, { align: "end", children: ["compact", "regular", "expanded"].map((g) => /* @__PURE__ */ e(
|
|
3484
|
+
Qr,
|
|
3485
|
+
{
|
|
3486
|
+
onClick: () => p(g),
|
|
3487
|
+
className: h === g ? "bg-accent" : "",
|
|
3488
|
+
children: g.charAt(0).toUpperCase() + g.slice(1)
|
|
3489
|
+
},
|
|
3490
|
+
g
|
|
3491
|
+
)) })
|
|
3492
|
+
] }),
|
|
3493
|
+
d && /* @__PURE__ */ e(
|
|
3494
|
+
$,
|
|
3495
|
+
{
|
|
3496
|
+
variant: o ? "secondary" : "outline",
|
|
3497
|
+
size: "sm",
|
|
3498
|
+
className: "h-8",
|
|
3499
|
+
onClick: f,
|
|
3500
|
+
"aria-label": "Toggle split view",
|
|
3501
|
+
"aria-pressed": o,
|
|
3502
|
+
children: /* @__PURE__ */ e(xr, { className: "size-4", "aria-hidden": "true" })
|
|
3503
|
+
}
|
|
3504
|
+
)
|
|
3505
|
+
]
|
|
3506
|
+
}
|
|
3507
|
+
);
|
|
3508
|
+
}
|
|
3509
|
+
function Xn({
|
|
3510
|
+
totalCount: t,
|
|
3511
|
+
filteredCount: r,
|
|
3512
|
+
selectedCount: n,
|
|
3513
|
+
className: a
|
|
3514
|
+
}) {
|
|
3515
|
+
let m = r < t ? `${r} of ${t} items` : `${t} items`;
|
|
3516
|
+
return n > 0 && (m += ` · ${n} selected`), /* @__PURE__ */ e(
|
|
3517
|
+
"div",
|
|
3518
|
+
{
|
|
3519
|
+
"data-slot": "list-view-status-bar",
|
|
3520
|
+
role: "status",
|
|
3521
|
+
"aria-live": "polite",
|
|
3522
|
+
"aria-atomic": "true",
|
|
3523
|
+
className: w("text-muted-foreground text-xs px-2 py-1", a),
|
|
3524
|
+
children: m
|
|
3525
|
+
}
|
|
3526
|
+
);
|
|
3527
|
+
}
|
|
3528
|
+
function Yn({
|
|
3529
|
+
isOpen: t,
|
|
3530
|
+
renderDetail: r,
|
|
3531
|
+
selectedItem: n,
|
|
3532
|
+
children: a,
|
|
3533
|
+
className: i
|
|
3534
|
+
}) {
|
|
3535
|
+
return t ? /* @__PURE__ */ l(
|
|
3536
|
+
"div",
|
|
3537
|
+
{
|
|
3538
|
+
"data-slot": "list-view-split-pane",
|
|
3539
|
+
className: w("grid grid-cols-2 gap-0", i),
|
|
3540
|
+
children: [
|
|
3541
|
+
/* @__PURE__ */ e("div", { className: "overflow-auto border-r", children: a }),
|
|
3542
|
+
/* @__PURE__ */ e(
|
|
3543
|
+
"div",
|
|
3544
|
+
{
|
|
3545
|
+
role: "complementary",
|
|
3546
|
+
"aria-label": "Item detail",
|
|
3547
|
+
className: "overflow-auto p-4",
|
|
3548
|
+
children: n ? r(n) : /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center text-muted-foreground text-sm", children: "Select an item to view details" })
|
|
3549
|
+
}
|
|
3550
|
+
)
|
|
3551
|
+
]
|
|
3552
|
+
}
|
|
3553
|
+
) : /* @__PURE__ */ e("div", { "data-slot": "list-view-split-pane", className: i, children: a });
|
|
3554
|
+
}
|
|
3555
|
+
function Zn({
|
|
3556
|
+
isFiltered: t,
|
|
3557
|
+
className: r
|
|
3558
|
+
}) {
|
|
3559
|
+
return /* @__PURE__ */ e(
|
|
3560
|
+
"div",
|
|
3561
|
+
{
|
|
3562
|
+
role: "status",
|
|
3563
|
+
"data-testid": "list-view-empty-state",
|
|
3564
|
+
className: w(
|
|
3565
|
+
"flex flex-col items-center justify-center py-16 text-muted-foreground",
|
|
3566
|
+
r
|
|
3567
|
+
),
|
|
3568
|
+
children: t ? /* @__PURE__ */ l(Ke, { children: [
|
|
3569
|
+
/* @__PURE__ */ e(yr, { className: "size-12 mb-4", strokeWidth: 1 }),
|
|
3570
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No matching results found." }),
|
|
3571
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: "Try adjusting your search terms." })
|
|
3572
|
+
] }) : /* @__PURE__ */ l(Ke, { children: [
|
|
3573
|
+
/* @__PURE__ */ e(Nr, { className: "size-12 mb-4", strokeWidth: 1 }),
|
|
3574
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No entries were found." })
|
|
3575
|
+
] })
|
|
3576
|
+
}
|
|
3577
|
+
);
|
|
3578
|
+
}
|
|
3579
|
+
function Jn({
|
|
3580
|
+
orderedIds: t,
|
|
3581
|
+
onSelectionChange: r
|
|
3582
|
+
}) {
|
|
3583
|
+
const [n, a] = R(/* @__PURE__ */ new Set()), i = F(null);
|
|
3584
|
+
X(() => {
|
|
3585
|
+
r && r(Array.from(n));
|
|
3586
|
+
}, [n, r]);
|
|
3587
|
+
const m = (c, s, g) => {
|
|
3588
|
+
if (s) {
|
|
3589
|
+
const x = i.current ?? t[0], N = t.indexOf(x), z = t.indexOf(c);
|
|
3590
|
+
if (N !== -1 && z !== -1) {
|
|
3591
|
+
const S = Math.min(N, z), A = Math.max(N, z), k = t.slice(S, A + 1);
|
|
3592
|
+
a(new Set(k));
|
|
3593
|
+
}
|
|
3594
|
+
} else g ? (a((x) => {
|
|
3595
|
+
const N = new Set(x);
|
|
3596
|
+
return N.has(c) ? N.delete(c) : N.add(c), N;
|
|
3597
|
+
}), i.current = c) : (a(/* @__PURE__ */ new Set([c])), i.current = c);
|
|
3598
|
+
}, d = () => {
|
|
3599
|
+
const c = t.every((s) => n.has(s));
|
|
3600
|
+
a(c ? /* @__PURE__ */ new Set() : new Set(t));
|
|
3601
|
+
}, o = () => {
|
|
3602
|
+
a(/* @__PURE__ */ new Set());
|
|
3603
|
+
}, f = (c) => {
|
|
3604
|
+
a(new Set(c));
|
|
3605
|
+
}, h = (c) => n.has(c), p = t.length > 0 && t.every((c) => n.has(c)), u = n.size > 0 && n.size < t.length && t.some((c) => n.has(c));
|
|
3606
|
+
return {
|
|
3607
|
+
selectedIds: n,
|
|
3608
|
+
handleSelect: m,
|
|
3609
|
+
handleSelectAll: d,
|
|
3610
|
+
clearSelection: o,
|
|
3611
|
+
setSelection: f,
|
|
3612
|
+
isSelected: h,
|
|
3613
|
+
isAllSelected: p,
|
|
3614
|
+
isIndeterminate: u
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3617
|
+
function qn({
|
|
3618
|
+
onSortChange: t
|
|
3619
|
+
}) {
|
|
3620
|
+
const [r, n] = R(null);
|
|
3621
|
+
return X(() => {
|
|
3622
|
+
t && t(r);
|
|
3623
|
+
}, [r, t]), {
|
|
3624
|
+
sort: r,
|
|
3625
|
+
toggleSort: (d) => {
|
|
3626
|
+
n((o) => !o || o.columnKey !== d ? { columnKey: d, direction: "asc" } : o.direction === "asc" ? { columnKey: d, direction: "desc" } : null);
|
|
3627
|
+
},
|
|
3628
|
+
clearSort: () => {
|
|
3629
|
+
n(null);
|
|
3630
|
+
},
|
|
3631
|
+
sortItems: (d) => {
|
|
3632
|
+
if (!r)
|
|
3633
|
+
return d;
|
|
3634
|
+
const { columnKey: o, direction: f } = r, h = [...d];
|
|
3635
|
+
return h.sort((p, u) => {
|
|
3636
|
+
const c = o === "name" ? p.name : p.metadata[o], s = o === "name" ? u.name : u.metadata[o];
|
|
3637
|
+
if (c == null && s == null) return 0;
|
|
3638
|
+
if (c == null) return 1;
|
|
3639
|
+
if (s == null) return -1;
|
|
3640
|
+
let g = 0;
|
|
3641
|
+
return typeof c == "number" && typeof s == "number" ? g = c - s : typeof c == "string" && typeof s == "string" ? g = c.localeCompare(s) : g = String(c).localeCompare(String(s)), f === "asc" ? g : -g;
|
|
3642
|
+
}), h;
|
|
3643
|
+
}
|
|
3644
|
+
};
|
|
3645
|
+
}
|
|
3646
|
+
function ea() {
|
|
3647
|
+
const [t, r] = R(""), [n, a] = R("");
|
|
3648
|
+
return X(() => {
|
|
3649
|
+
const m = setTimeout(() => {
|
|
3650
|
+
a(t);
|
|
3651
|
+
}, Kn);
|
|
3652
|
+
return () => clearTimeout(m);
|
|
3653
|
+
}, [t]), {
|
|
3654
|
+
searchValue: t,
|
|
3655
|
+
setSearchValue: r,
|
|
3656
|
+
filterItems: (m, d) => {
|
|
3657
|
+
if (!n.trim())
|
|
3658
|
+
return m;
|
|
3659
|
+
const o = n.toLowerCase();
|
|
3660
|
+
return m.filter((f) => {
|
|
3661
|
+
if (f.name.toLowerCase().includes(o))
|
|
3662
|
+
return !0;
|
|
3663
|
+
if (d) {
|
|
3664
|
+
const h = d.filter((p) => p.visible !== !1);
|
|
3665
|
+
for (const p of h) {
|
|
3666
|
+
const u = f.metadata[p.key];
|
|
3667
|
+
if ((typeof u == "string" || typeof u == "number") && String(u).toLowerCase().includes(o))
|
|
3668
|
+
return !0;
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
return !1;
|
|
3672
|
+
});
|
|
3673
|
+
}
|
|
3674
|
+
};
|
|
3675
|
+
}
|
|
3676
|
+
function vt(t) {
|
|
3677
|
+
const r = t.map((a) => a.key).join(","), n = /* @__PURE__ */ new Map();
|
|
3678
|
+
return t.forEach((a) => {
|
|
3679
|
+
n.set(a.key, a.visible !== !1);
|
|
3680
|
+
}), { columnsKey: r, visibilityMap: n };
|
|
3681
|
+
}
|
|
3682
|
+
function ta(t, r) {
|
|
3683
|
+
switch (r.type) {
|
|
3684
|
+
case "TOGGLE": {
|
|
3685
|
+
const n = t.visibilityMap.get(r.key) ?? !1, a = Array.from(t.visibilityMap.values()).filter(
|
|
3686
|
+
Boolean
|
|
3687
|
+
).length;
|
|
3688
|
+
if (n && a === 1)
|
|
3689
|
+
return t;
|
|
3690
|
+
const i = new Map(t.visibilityMap);
|
|
3691
|
+
return i.set(r.key, !n), { ...t, visibilityMap: i };
|
|
3692
|
+
}
|
|
3693
|
+
case "RESET":
|
|
3694
|
+
return vt(r.columns);
|
|
3695
|
+
default:
|
|
3696
|
+
return t;
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
function ra(t) {
|
|
3700
|
+
const [r, n] = Tr(ta, t, vt), a = ne(
|
|
3701
|
+
() => t.map((f) => f.key).join(","),
|
|
3702
|
+
[t]
|
|
3703
|
+
);
|
|
3704
|
+
X(() => {
|
|
3705
|
+
r.columnsKey !== a && n({ type: "RESET", columns: t });
|
|
3706
|
+
}, [t, a, r.columnsKey]);
|
|
3707
|
+
const i = (f) => {
|
|
3708
|
+
n({ type: "TOGGLE", key: f });
|
|
3709
|
+
}, m = (f) => r.visibilityMap.get(f) ?? !1, d = ne(() => t.filter((f) => r.visibilityMap.get(f.key) !== !1), [t, r.visibilityMap]), o = ne(() => t.map((f) => ({
|
|
3710
|
+
...f,
|
|
3711
|
+
visible: r.visibilityMap.get(f.key) !== !1
|
|
3712
|
+
})), [t, r.visibilityMap]);
|
|
3713
|
+
return {
|
|
3714
|
+
visibleColumns: d,
|
|
3715
|
+
allColumns: o,
|
|
3716
|
+
toggleColumn: i,
|
|
3717
|
+
isColumnVisible: m
|
|
3718
|
+
};
|
|
3719
|
+
}
|
|
3720
|
+
function na({
|
|
3721
|
+
onSelectAll: t,
|
|
3722
|
+
onClearSelection: r,
|
|
3723
|
+
onOpenSelected: n
|
|
3724
|
+
}) {
|
|
3725
|
+
return {
|
|
3726
|
+
containerRef: F(null),
|
|
3727
|
+
handleKeyDown: (m) => {
|
|
3728
|
+
if (m.key === "a" && (m.metaKey || m.ctrlKey)) {
|
|
3729
|
+
m.preventDefault(), t();
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
if (m.key === "Escape") {
|
|
3733
|
+
r();
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
if (m.key === "Enter") {
|
|
3737
|
+
n();
|
|
3738
|
+
return;
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
};
|
|
3742
|
+
}
|
|
3743
|
+
const aa = [{ key: "name", label: "Name", sortable: !0 }];
|
|
3744
|
+
function ki({
|
|
3745
|
+
items: t,
|
|
3746
|
+
view: r,
|
|
3747
|
+
onViewChange: n,
|
|
3748
|
+
columns: a = aa,
|
|
3749
|
+
onSelectionChange: i,
|
|
3750
|
+
onItemOpen: m,
|
|
3751
|
+
onSortChange: d,
|
|
3752
|
+
allowSplitView: o = !1,
|
|
3753
|
+
contextMenuActions: f,
|
|
3754
|
+
renderDetail: h,
|
|
3755
|
+
cardDensity: p = "regular",
|
|
3756
|
+
onCardDensityChange: u,
|
|
3757
|
+
onReorder: c,
|
|
3758
|
+
virtualizeThreshold: s,
|
|
3759
|
+
toolbarLeft: g,
|
|
3760
|
+
searchPlaceholder: x,
|
|
3761
|
+
emptyState: N,
|
|
3762
|
+
className: z
|
|
3763
|
+
}) {
|
|
3764
|
+
const [S, A] = R(!1), { searchValue: k, setSearchValue: P, filterItems: D } = ea(), { visibleColumns: T, allColumns: B, toggleColumn: L } = ra(a), { sort: C, toggleSort: M, sortItems: _ } = qn({ onSortChange: d }), y = ne(
|
|
3765
|
+
() => D(t, T),
|
|
3766
|
+
[D, t, T]
|
|
3767
|
+
), v = ne(
|
|
3768
|
+
() => _(y),
|
|
3769
|
+
[_, y]
|
|
3770
|
+
), b = ne(
|
|
3771
|
+
() => v.map((I) => I.id),
|
|
3772
|
+
[v]
|
|
3773
|
+
), { selectedIds: O, handleSelect: J, handleSelectAll: Q, clearSelection: H } = Jn({
|
|
3774
|
+
orderedIds: b,
|
|
3775
|
+
onSelectionChange: i
|
|
3776
|
+
}), te = ne(() => {
|
|
3777
|
+
const I = Array.from(O);
|
|
3778
|
+
for (let j = I.length - 1; j >= 0; j--) {
|
|
3779
|
+
const V = v.find((se) => se.id === I[j]);
|
|
3780
|
+
if (V) return V;
|
|
3781
|
+
}
|
|
3782
|
+
return null;
|
|
3783
|
+
}, [O, v]), { containerRef: ie, handleKeyDown: E } = na({
|
|
3784
|
+
onSelectAll: Q,
|
|
3785
|
+
onClearSelection: H,
|
|
3786
|
+
onOpenSelected: () => {
|
|
3787
|
+
te && m && m(te);
|
|
3788
|
+
}
|
|
3789
|
+
}), U = (I) => {
|
|
3790
|
+
I && M(I.columnKey);
|
|
3791
|
+
};
|
|
3792
|
+
return /* @__PURE__ */ l(
|
|
3793
|
+
"div",
|
|
3794
|
+
{
|
|
3795
|
+
ref: ie,
|
|
3796
|
+
"data-testid": "list-view",
|
|
3797
|
+
"data-slot": "list-view",
|
|
3798
|
+
role: "region",
|
|
3799
|
+
"aria-label": "List view",
|
|
3800
|
+
tabIndex: -1,
|
|
3801
|
+
onKeyDown: E,
|
|
3802
|
+
className: w("flex flex-col", z),
|
|
3803
|
+
children: [
|
|
3804
|
+
/* @__PURE__ */ e(
|
|
3805
|
+
Qn,
|
|
3806
|
+
{
|
|
3807
|
+
view: r,
|
|
3808
|
+
onViewChange: n,
|
|
3809
|
+
searchValue: k,
|
|
3810
|
+
onSearchChange: P,
|
|
3811
|
+
columns: r === "table" ? B : void 0,
|
|
3812
|
+
onColumnVisibilityChange: r === "table" ? L : void 0,
|
|
3813
|
+
allowSplitView: o,
|
|
3814
|
+
isSplitViewOpen: S,
|
|
3815
|
+
onSplitViewToggle: () => A((I) => !I),
|
|
3816
|
+
cardDensity: r === "card" ? p : void 0,
|
|
3817
|
+
onCardDensityChange: r === "card" ? u : void 0,
|
|
3818
|
+
toolbarLeft: g,
|
|
3819
|
+
searchPlaceholder: x
|
|
3820
|
+
}
|
|
3821
|
+
),
|
|
3822
|
+
/* @__PURE__ */ e(
|
|
3823
|
+
Yn,
|
|
3824
|
+
{
|
|
3825
|
+
isOpen: S && o,
|
|
3826
|
+
renderDetail: h ?? (() => null),
|
|
3827
|
+
selectedItem: te,
|
|
3828
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto transition-opacity duration-150", children: v.length === 0 ? typeof N == "function" ? N({ isFiltered: t.length > 0 && v.length === 0 }) : N ?? /* @__PURE__ */ e(Zn, { isFiltered: t.length > 0 && v.length === 0 }) : r === "table" ? /* @__PURE__ */ e(
|
|
3829
|
+
Fn,
|
|
3830
|
+
{
|
|
3831
|
+
items: v,
|
|
3832
|
+
columns: T,
|
|
3833
|
+
sort: C,
|
|
3834
|
+
onSortChange: U,
|
|
3835
|
+
selectedIds: O,
|
|
3836
|
+
onSelectionAction: (I) => {
|
|
3837
|
+
switch (I.type) {
|
|
3838
|
+
case "select":
|
|
3839
|
+
J(I.id, I.shiftKey, I.metaKey);
|
|
3840
|
+
break;
|
|
3841
|
+
case "select-all":
|
|
3842
|
+
Q();
|
|
3843
|
+
break;
|
|
3844
|
+
case "clear":
|
|
3845
|
+
H();
|
|
3846
|
+
break;
|
|
3847
|
+
}
|
|
3848
|
+
},
|
|
3849
|
+
onItemOpen: m,
|
|
3850
|
+
contextMenuActions: f,
|
|
3851
|
+
virtualizeThreshold: s
|
|
3852
|
+
}
|
|
3853
|
+
) : /* @__PURE__ */ e(
|
|
3854
|
+
Wn,
|
|
3855
|
+
{
|
|
3856
|
+
items: v,
|
|
3857
|
+
density: p,
|
|
3858
|
+
selectedIds: O,
|
|
3859
|
+
onSelectionAction: (I) => {
|
|
3860
|
+
switch (I.type) {
|
|
3861
|
+
case "select":
|
|
3862
|
+
J(I.id, I.shiftKey, I.metaKey);
|
|
3863
|
+
break;
|
|
3864
|
+
case "select-all":
|
|
3865
|
+
Q();
|
|
3866
|
+
break;
|
|
3867
|
+
case "clear":
|
|
3868
|
+
H();
|
|
3869
|
+
break;
|
|
3870
|
+
}
|
|
3871
|
+
},
|
|
3872
|
+
onItemOpen: m,
|
|
3873
|
+
contextMenuActions: f,
|
|
3874
|
+
onReorder: c,
|
|
3875
|
+
virtualizeThreshold: s
|
|
3876
|
+
}
|
|
3877
|
+
) })
|
|
3878
|
+
}
|
|
3879
|
+
),
|
|
3880
|
+
/* @__PURE__ */ e(
|
|
3881
|
+
Xn,
|
|
3882
|
+
{
|
|
3883
|
+
totalCount: t.length,
|
|
3884
|
+
filteredCount: v.length,
|
|
3885
|
+
selectedCount: O.size
|
|
3886
|
+
}
|
|
3887
|
+
)
|
|
3888
|
+
]
|
|
3889
|
+
}
|
|
3890
|
+
);
|
|
3891
|
+
}
|
|
3892
|
+
const De = Me(null);
|
|
3893
|
+
function Ci({ children: t }) {
|
|
3894
|
+
const [r, n] = R([]), a = ae((d) => {
|
|
3895
|
+
n((o) => [...o.filter((h) => h.id !== d.id), d].sort((h, p) => h.order - p.order));
|
|
3896
|
+
}, []), i = ae((d) => {
|
|
3897
|
+
n((o) => o.filter((f) => f.id !== d));
|
|
3898
|
+
}, []), m = { items: r, addItem: a, removeItem: i };
|
|
3899
|
+
return /* @__PURE__ */ e(De.Provider, { value: m, children: t });
|
|
3900
|
+
}
|
|
3901
|
+
function ia() {
|
|
3902
|
+
const t = Ee(De);
|
|
3903
|
+
if (!t)
|
|
3904
|
+
throw new Error("useBreadcrumbs must be used within a BreadcrumbProvider");
|
|
3905
|
+
return t.items;
|
|
3906
|
+
}
|
|
3907
|
+
function Si(t) {
|
|
3908
|
+
const r = Ee(De);
|
|
3909
|
+
if (!r)
|
|
3910
|
+
throw new Error("useBreadcrumbItem must be used within a BreadcrumbProvider");
|
|
3911
|
+
const { addItem: n, removeItem: a } = r, { id: i, label: m, href: d, order: o } = t;
|
|
3912
|
+
X(() => (n({ id: i, label: m, href: d, order: o }), () => {
|
|
3913
|
+
a(i);
|
|
3914
|
+
}), [i, m, d, o, n, a]);
|
|
3915
|
+
}
|
|
3916
|
+
const sa = 4;
|
|
3917
|
+
function zi({
|
|
3918
|
+
maxVisibleItems: t = sa,
|
|
3919
|
+
className: r,
|
|
3920
|
+
listClassName: n
|
|
3921
|
+
}) {
|
|
3922
|
+
const a = ia();
|
|
3923
|
+
if (a.length === 0)
|
|
3924
|
+
return null;
|
|
3925
|
+
const i = a.length > t, m = oa(a, t, i);
|
|
3926
|
+
return /* @__PURE__ */ e(Lr, { className: r, children: /* @__PURE__ */ e(Mr, { className: n, children: m.map((d, o) => {
|
|
3927
|
+
const f = o === m.length - 1;
|
|
3928
|
+
return d.type === "ellipsis" ? /* @__PURE__ */ l(Ve.Fragment, { children: [
|
|
3929
|
+
/* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(Er, {}) }),
|
|
3930
|
+
/* @__PURE__ */ e(We, {})
|
|
3931
|
+
] }, "__ellipsis") : f ? /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(Qe, { children: d.item.label }) }, d.item.id) : /* @__PURE__ */ l(Ve.Fragment, { children: [
|
|
3932
|
+
/* @__PURE__ */ e(Re, { children: d.item.href ? /* @__PURE__ */ e(Pr, { href: d.item.href, children: d.item.label }) : /* @__PURE__ */ e(Qe, { children: d.item.label }) }),
|
|
3933
|
+
/* @__PURE__ */ e(We, {})
|
|
3934
|
+
] }, d.item.id);
|
|
3935
|
+
}) }) });
|
|
3936
|
+
}
|
|
3937
|
+
function oa(t, r, n) {
|
|
3938
|
+
if (!n)
|
|
3939
|
+
return t.map((d) => ({ type: "item", item: d }));
|
|
3940
|
+
const a = r - 1, i = t[0], m = t.slice(-a);
|
|
3941
|
+
return [
|
|
3942
|
+
{ type: "item", item: i },
|
|
3943
|
+
{ type: "ellipsis" },
|
|
3944
|
+
...m.map((d) => ({ type: "item", item: d }))
|
|
3945
|
+
];
|
|
3946
|
+
}
|
|
3947
|
+
function Ii({ className: t, ...r }) {
|
|
3948
|
+
return /* @__PURE__ */ e(
|
|
3949
|
+
wr,
|
|
3950
|
+
{
|
|
3951
|
+
role: "status",
|
|
3952
|
+
"aria-label": "Loading",
|
|
3953
|
+
"data-slot": "spinner",
|
|
3954
|
+
className: w("size-4 animate-spin", t),
|
|
3955
|
+
...r
|
|
3956
|
+
}
|
|
3957
|
+
);
|
|
3958
|
+
}
|
|
3959
|
+
const Ri = ce.Provider, Ai = ce.Root, Ti = ce.Trigger;
|
|
3960
|
+
function Li({
|
|
3961
|
+
className: t,
|
|
3962
|
+
sideOffset: r = 4,
|
|
3963
|
+
children: n,
|
|
3964
|
+
...a
|
|
3965
|
+
}) {
|
|
3966
|
+
return /* @__PURE__ */ e(ce.Portal, { children: /* @__PURE__ */ l(
|
|
3967
|
+
ce.Content,
|
|
3968
|
+
{
|
|
3969
|
+
"data-slot": "tooltip-content",
|
|
3970
|
+
sideOffset: r,
|
|
3971
|
+
className: w(
|
|
3972
|
+
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3973
|
+
"z-50 max-w-60 rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground shadow-md",
|
|
3974
|
+
t
|
|
3975
|
+
),
|
|
3976
|
+
...a,
|
|
3977
|
+
children: [
|
|
3978
|
+
n,
|
|
3979
|
+
/* @__PURE__ */ e(ce.Arrow, { className: "fill-primary" })
|
|
3980
|
+
]
|
|
3981
|
+
}
|
|
3982
|
+
) });
|
|
3983
|
+
}
|
|
3984
|
+
function Mi(t) {
|
|
3985
|
+
const { theme: r = "system" } = un();
|
|
3986
|
+
return /* @__PURE__ */ e(
|
|
3987
|
+
mn,
|
|
3988
|
+
{
|
|
3989
|
+
theme: r,
|
|
3990
|
+
className: "toaster group",
|
|
3991
|
+
icons: {
|
|
3992
|
+
success: /* @__PURE__ */ e(Ir, { className: "size-4" }),
|
|
3993
|
+
info: /* @__PURE__ */ e(zr, { className: "size-4" }),
|
|
3994
|
+
warning: /* @__PURE__ */ e(Sr, { className: "size-4" }),
|
|
3995
|
+
error: /* @__PURE__ */ e(Cr, { className: "size-4" }),
|
|
3996
|
+
loading: /* @__PURE__ */ e(kr, { className: "size-4 animate-spin" })
|
|
3997
|
+
},
|
|
3998
|
+
style: {
|
|
3999
|
+
"--normal-bg": "var(--color-popover)",
|
|
4000
|
+
"--normal-text": "var(--color-popover-foreground)",
|
|
4001
|
+
"--normal-border": "var(--color-border)",
|
|
4002
|
+
"--border-radius": "var(--radius-lg)"
|
|
4003
|
+
},
|
|
4004
|
+
...t
|
|
4005
|
+
}
|
|
4006
|
+
);
|
|
4007
|
+
}
|
|
4008
|
+
const xt = Me(void 0), yt = "(prefers-color-scheme: dark)";
|
|
4009
|
+
function la() {
|
|
4010
|
+
return window.matchMedia(yt).matches ? "dark" : "light";
|
|
4011
|
+
}
|
|
4012
|
+
function rt(t) {
|
|
4013
|
+
const r = t === "system" ? la() : t;
|
|
4014
|
+
document.documentElement.classList.toggle("dark", r === "dark");
|
|
4015
|
+
}
|
|
4016
|
+
function Ei({
|
|
4017
|
+
children: t,
|
|
4018
|
+
defaultTheme: r = "system",
|
|
4019
|
+
storageKey: n = "even-tide-theme"
|
|
4020
|
+
}) {
|
|
4021
|
+
const [a, i] = R(() => {
|
|
4022
|
+
const d = localStorage.getItem(n);
|
|
4023
|
+
return d === "light" || d === "dark" || d === "system" ? d : r;
|
|
4024
|
+
});
|
|
4025
|
+
X(() => {
|
|
4026
|
+
rt(a);
|
|
4027
|
+
}, [a]), X(() => {
|
|
4028
|
+
if (a !== "system") return;
|
|
4029
|
+
const d = window.matchMedia(yt), o = () => rt("system");
|
|
4030
|
+
return d.addEventListener("change", o), () => d.removeEventListener("change", o);
|
|
4031
|
+
}, [a]);
|
|
4032
|
+
function m(d) {
|
|
4033
|
+
localStorage.setItem(n, d), i(d);
|
|
4034
|
+
}
|
|
4035
|
+
return /* @__PURE__ */ e(xt.Provider, { value: { theme: a, setTheme: m }, children: t });
|
|
4036
|
+
}
|
|
4037
|
+
function ca() {
|
|
4038
|
+
const t = Ee(xt);
|
|
4039
|
+
if (t === void 0)
|
|
4040
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
4041
|
+
return t;
|
|
4042
|
+
}
|
|
4043
|
+
function Pi({ className: t }) {
|
|
4044
|
+
const { theme: r, setTheme: n } = ca(), a = r === "dark" || r === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
4045
|
+
return /* @__PURE__ */ e(
|
|
4046
|
+
Ge.Root,
|
|
4047
|
+
{
|
|
4048
|
+
checked: a,
|
|
4049
|
+
onCheckedChange: (i) => n(i ? "dark" : "light"),
|
|
4050
|
+
"aria-label": "Toggle dark mode",
|
|
4051
|
+
className: w(
|
|
4052
|
+
"relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
|
|
4053
|
+
t
|
|
4054
|
+
),
|
|
4055
|
+
children: /* @__PURE__ */ l(
|
|
4056
|
+
Ge.Thumb,
|
|
4057
|
+
{
|
|
4058
|
+
className: "pointer-events-none flex size-5 items-center justify-center rounded-full bg-background shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground",
|
|
4059
|
+
children: [
|
|
4060
|
+
/* @__PURE__ */ e(Rr, { className: "size-3 rotate-0 scale-100 transition-transform dark:rotate-90 dark:scale-0" }),
|
|
4061
|
+
/* @__PURE__ */ e(Ar, { className: "absolute size-3 rotate-90 scale-0 transition-transform dark:rotate-0 dark:scale-100 dark:text-primary" })
|
|
4062
|
+
]
|
|
4063
|
+
}
|
|
4064
|
+
)
|
|
2016
4065
|
}
|
|
2017
4066
|
);
|
|
2018
4067
|
}
|
|
2019
|
-
function
|
|
2020
|
-
return
|
|
4068
|
+
function Di(...t) {
|
|
4069
|
+
return hn(fn(t));
|
|
2021
4070
|
}
|
|
2022
4071
|
export {
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
4072
|
+
vn as AlertItem,
|
|
4073
|
+
Wa as AlertProvider,
|
|
4074
|
+
Ni as AudioInput,
|
|
4075
|
+
Qa as Badge,
|
|
4076
|
+
Ci as BreadcrumbProvider,
|
|
4077
|
+
zi as Breadcrumbs,
|
|
4078
|
+
Ga as Button,
|
|
4079
|
+
Xa as Card,
|
|
4080
|
+
qa as CardAction,
|
|
4081
|
+
ei as CardContent,
|
|
4082
|
+
Ja as CardDescription,
|
|
4083
|
+
ti as CardFooter,
|
|
4084
|
+
Ya as CardHeader,
|
|
4085
|
+
Te as CardItem,
|
|
4086
|
+
Za as CardTitle,
|
|
4087
|
+
Wn as CardView,
|
|
4088
|
+
li as Checkbox,
|
|
4089
|
+
di as ColorInput,
|
|
4090
|
+
Mn as DEFAULT_COUNTRIES,
|
|
4091
|
+
pi as DatePicker,
|
|
4092
|
+
mi as EmailInput,
|
|
4093
|
+
q as FieldWrapper,
|
|
4094
|
+
bi as FileInput,
|
|
4095
|
+
ri as Input,
|
|
4096
|
+
wn as InputOTP,
|
|
4097
|
+
kn as InputOTPGroup,
|
|
4098
|
+
Sn as InputOTPSeparator,
|
|
4099
|
+
Cn as InputOTPSlot,
|
|
4100
|
+
ki as ListView,
|
|
4101
|
+
Yn as ListViewSplitPane,
|
|
4102
|
+
Xn as ListViewStatusBar,
|
|
4103
|
+
Qn as ListViewToolbar,
|
|
4104
|
+
oi as NumberInput,
|
|
4105
|
+
si as PasswordInput,
|
|
4106
|
+
vi as QuerySelect,
|
|
4107
|
+
xi as RichTextInput,
|
|
4108
|
+
ui as SelectInput,
|
|
4109
|
+
ni as Slider,
|
|
4110
|
+
yi as SliderInput,
|
|
4111
|
+
_n as SortableCardItem,
|
|
4112
|
+
Ii as Spinner,
|
|
4113
|
+
ci as SwitchInput,
|
|
4114
|
+
Fn as TableView,
|
|
4115
|
+
hi as TelephoneInput,
|
|
4116
|
+
ai as TextInput,
|
|
4117
|
+
ii as TextareaInput,
|
|
4118
|
+
Ei as ThemeProvider,
|
|
4119
|
+
Pi as ThemeToggle,
|
|
4120
|
+
gi as TimePicker,
|
|
4121
|
+
Mi as Toaster,
|
|
4122
|
+
Ai as Tooltip,
|
|
4123
|
+
Li as TooltipContent,
|
|
4124
|
+
Ri as TooltipProvider,
|
|
4125
|
+
Ti as TooltipTrigger,
|
|
4126
|
+
fi as URLInput,
|
|
4127
|
+
wi as VideoInput,
|
|
4128
|
+
Nn as badgeVariants,
|
|
4129
|
+
pn as buttonVariants,
|
|
4130
|
+
Di as cn,
|
|
4131
|
+
Bi as toast,
|
|
4132
|
+
Si as useBreadcrumbItem,
|
|
4133
|
+
ia as useBreadcrumbs,
|
|
4134
|
+
ra as useColumnVisibility,
|
|
4135
|
+
ea as useFiltering,
|
|
4136
|
+
na as useListViewKeyboard,
|
|
4137
|
+
Jn as useSelection,
|
|
4138
|
+
qn as useSorting,
|
|
4139
|
+
ca as useTheme
|
|
2054
4140
|
};
|