@page-speed/forms 0.5.6 → 0.5.8
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/FormContext-089h0j0Q.d.ts +153 -0
- package/dist/FormContext-iHzBALZa.d.cts +153 -0
- package/dist/{chunk-A7R6GEMA.js → chunk-455PI4LV.js} +84 -3
- package/dist/chunk-455PI4LV.js.map +1 -0
- package/dist/{chunk-QZ4PK62A.js → chunk-4ROWNTY6.js} +335 -417
- package/dist/chunk-4ROWNTY6.js.map +1 -0
- package/dist/{chunk-WVSLOSNU.cjs → chunk-ED4UK63G.cjs} +440 -523
- package/dist/chunk-ED4UK63G.cjs.map +1 -0
- package/dist/chunk-IXHDJ7E5.js +263 -0
- package/dist/chunk-IXHDJ7E5.js.map +1 -0
- package/dist/{chunk-Q7VR374Y.js → chunk-MJYEXJ3U.js} +3 -3
- package/dist/{chunk-Q7VR374Y.js.map → chunk-MJYEXJ3U.js.map} +1 -1
- package/dist/{chunk-KPHMVGTU.cjs → chunk-MUBEMXI7.cjs} +6 -6
- package/dist/{chunk-KPHMVGTU.cjs.map → chunk-MUBEMXI7.cjs.map} +1 -1
- package/dist/chunk-Q7WXLZN5.cjs +287 -0
- package/dist/chunk-Q7WXLZN5.cjs.map +1 -0
- package/dist/{chunk-QQSBW6N3.cjs → chunk-QRI5TMES.cjs} +85 -2
- package/dist/chunk-QRI5TMES.cjs.map +1 -0
- package/dist/core.cjs +13 -9
- package/dist/core.d.cts +66 -141
- package/dist/core.d.ts +66 -141
- package/dist/core.js +3 -3
- package/dist/index.cjs +14 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/inputs.cjs +16 -16
- package/dist/inputs.d.cts +1 -1
- package/dist/inputs.d.ts +1 -1
- package/dist/inputs.js +2 -2
- package/dist/integration.cjs +17 -17
- package/dist/integration.d.cts +1 -1
- package/dist/integration.d.ts +1 -1
- package/dist/integration.js +3 -3
- package/dist/{types-CnOCn7b3.d.ts → types-BemGfSPA.d.cts} +27 -1
- package/dist/{types-CnOCn7b3.d.cts → types-BemGfSPA.d.ts} +27 -1
- package/dist/validation-rules.d.cts +1 -1
- package/dist/validation-rules.d.ts +1 -1
- package/dist/validation-utils.d.cts +1 -1
- package/dist/validation-utils.d.ts +1 -1
- package/dist/validation-valibot.d.cts +1 -1
- package/dist/validation-valibot.d.ts +1 -1
- package/dist/validation.d.cts +1 -1
- package/dist/validation.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-A7R6GEMA.js.map +0 -1
- package/dist/chunk-N2HOVRRN.js +0 -150
- package/dist/chunk-N2HOVRRN.js.map +0 -1
- package/dist/chunk-O4ZLR7AN.cjs +0 -173
- package/dist/chunk-O4ZLR7AN.cjs.map +0 -1
- package/dist/chunk-QQSBW6N3.cjs.map +0 -1
- package/dist/chunk-QZ4PK62A.js.map +0 -1
- package/dist/chunk-WVSLOSNU.cjs.map +0 -1
|
@@ -1,94 +1,13 @@
|
|
|
1
|
-
import { cn,
|
|
2
|
-
import * as
|
|
1
|
+
import { cn, FieldLabel, FieldDescription, LabelGroup, Field, INPUT_AUTOFILL_RESET_CLASSES, Button, Input, buttonVariants } from './chunk-455PI4LV.js';
|
|
2
|
+
import * as React19 from 'react';
|
|
3
3
|
import { Dialog as Dialog$1, Checkbox as Checkbox$1, RadioGroup as RadioGroup$1, Switch as Switch$1, Select as Select$1, Popover as Popover$1 } from 'radix-ui';
|
|
4
4
|
import { Command as Command$1 } from 'cmdk';
|
|
5
5
|
import { useDirection } from '@radix-ui/react-direction';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import { getDefaultClassNames, DayPicker } from 'react-day-picker';
|
|
8
8
|
|
|
9
|
-
var Input = React21.forwardRef(
|
|
10
|
-
({ className, type, ...props }, ref) => {
|
|
11
|
-
return /* @__PURE__ */ React21.createElement(
|
|
12
|
-
"input",
|
|
13
|
-
{
|
|
14
|
-
ref,
|
|
15
|
-
type,
|
|
16
|
-
"data-slot": "input",
|
|
17
|
-
className: cn(
|
|
18
|
-
// Core structure - no hardcoded colors, uses CSS variables
|
|
19
|
-
"flex h-9 w-full min-w-0 rounded-md border border-input",
|
|
20
|
-
"bg-transparent px-3 py-1 text-base shadow-sm",
|
|
21
|
-
"transition-colors outline-none md:text-sm",
|
|
22
|
-
// Focus state - uses ring-ring CSS variable (adapts to theme)
|
|
23
|
-
"focus-visible:ring-1 focus-visible:ring-ring",
|
|
24
|
-
// Error state - uses destructive CSS variables (adapts to theme)
|
|
25
|
-
"aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive",
|
|
26
|
-
// Disabled state - no color hardcoding
|
|
27
|
-
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
28
|
-
// File input specific - inherits text color from parent
|
|
29
|
-
"file:inline-flex file:h-7 file:border-0 file:bg-transparent",
|
|
30
|
-
"file:text-sm file:font-medium",
|
|
31
|
-
// Autofill reset - prevents browser from overriding our dynamic colors
|
|
32
|
-
INPUT_AUTOFILL_RESET_CLASSES,
|
|
33
|
-
className
|
|
34
|
-
),
|
|
35
|
-
...props
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
Input.displayName = "Input";
|
|
41
|
-
|
|
42
|
-
// src/inputs/TextInput.tsx
|
|
43
|
-
function TextInput({
|
|
44
|
-
name,
|
|
45
|
-
value,
|
|
46
|
-
onChange,
|
|
47
|
-
onBlur,
|
|
48
|
-
placeholder,
|
|
49
|
-
disabled = false,
|
|
50
|
-
required = false,
|
|
51
|
-
error = false,
|
|
52
|
-
className = "",
|
|
53
|
-
type = "text",
|
|
54
|
-
id = "text",
|
|
55
|
-
...props
|
|
56
|
-
}) {
|
|
57
|
-
const handleChange = (e) => {
|
|
58
|
-
onChange(e.target.value);
|
|
59
|
-
};
|
|
60
|
-
const handleBlur = () => {
|
|
61
|
-
onBlur?.();
|
|
62
|
-
};
|
|
63
|
-
const hasValue = String(value ?? "").trim().length > 0;
|
|
64
|
-
return /* @__PURE__ */ React21.createElement(
|
|
65
|
-
Input,
|
|
66
|
-
{
|
|
67
|
-
type,
|
|
68
|
-
id,
|
|
69
|
-
name,
|
|
70
|
-
value: value ?? "",
|
|
71
|
-
onChange: handleChange,
|
|
72
|
-
onBlur: handleBlur,
|
|
73
|
-
placeholder,
|
|
74
|
-
disabled,
|
|
75
|
-
required,
|
|
76
|
-
className: cn(
|
|
77
|
-
// Valid value indicator - ring-2 when has value and no error
|
|
78
|
-
!error && hasValue && "ring-2 ring-ring",
|
|
79
|
-
// Error state - handled by Input component via aria-invalid
|
|
80
|
-
className
|
|
81
|
-
),
|
|
82
|
-
"aria-invalid": error || props["aria-invalid"],
|
|
83
|
-
"aria-describedby": props["aria-describedby"],
|
|
84
|
-
"aria-required": required || props["aria-required"],
|
|
85
|
-
...props
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
TextInput.displayName = "TextInput";
|
|
90
9
|
function Textarea({ className, ...props }) {
|
|
91
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ React19.createElement(
|
|
92
11
|
"textarea",
|
|
93
12
|
{
|
|
94
13
|
"data-slot": "textarea",
|
|
@@ -135,7 +54,7 @@ function TextArea({
|
|
|
135
54
|
onBlur?.();
|
|
136
55
|
};
|
|
137
56
|
const hasValue = String(value ?? "").trim().length > 0;
|
|
138
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ React19.createElement(
|
|
139
58
|
Textarea,
|
|
140
59
|
{
|
|
141
60
|
name,
|
|
@@ -168,7 +87,7 @@ function Checkbox({
|
|
|
168
87
|
className,
|
|
169
88
|
...props
|
|
170
89
|
}) {
|
|
171
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ React19.createElement(
|
|
172
91
|
Checkbox$1.Root,
|
|
173
92
|
{
|
|
174
93
|
"data-slot": "checkbox",
|
|
@@ -189,13 +108,13 @@ function Checkbox({
|
|
|
189
108
|
),
|
|
190
109
|
...props
|
|
191
110
|
},
|
|
192
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ React19.createElement(
|
|
193
112
|
Checkbox$1.Indicator,
|
|
194
113
|
{
|
|
195
114
|
"data-slot": "checkbox-indicator",
|
|
196
115
|
className: "grid place-content-center text-current transition-none"
|
|
197
116
|
},
|
|
198
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ React19.createElement(
|
|
199
118
|
"svg",
|
|
200
119
|
{
|
|
201
120
|
className: "size-3.5",
|
|
@@ -206,7 +125,7 @@ function Checkbox({
|
|
|
206
125
|
strokeLinecap: "round",
|
|
207
126
|
strokeLinejoin: "round"
|
|
208
127
|
},
|
|
209
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
210
129
|
)
|
|
211
130
|
)
|
|
212
131
|
);
|
|
@@ -235,7 +154,7 @@ function Checkbox2({
|
|
|
235
154
|
onBlur?.();
|
|
236
155
|
};
|
|
237
156
|
const showChoiceCard = useChoiceCard || !!description;
|
|
238
|
-
const checkbox = /* @__PURE__ */
|
|
157
|
+
const checkbox = /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
239
158
|
"input",
|
|
240
159
|
{
|
|
241
160
|
type: "checkbox",
|
|
@@ -259,7 +178,7 @@ function Checkbox2({
|
|
|
259
178
|
border: 0
|
|
260
179
|
}
|
|
261
180
|
}
|
|
262
|
-
), /* @__PURE__ */
|
|
181
|
+
), /* @__PURE__ */ React19.createElement(
|
|
263
182
|
Checkbox,
|
|
264
183
|
{
|
|
265
184
|
id: checkboxId,
|
|
@@ -274,9 +193,9 @@ function Checkbox2({
|
|
|
274
193
|
}
|
|
275
194
|
));
|
|
276
195
|
if (!label) {
|
|
277
|
-
return /* @__PURE__ */
|
|
196
|
+
return /* @__PURE__ */ React19.createElement("div", { className }, checkbox);
|
|
278
197
|
}
|
|
279
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ React19.createElement("div", { className: "space-y-0", "data-invalid": error || void 0 }, /* @__PURE__ */ React19.createElement(
|
|
280
199
|
FieldLabel,
|
|
281
200
|
{
|
|
282
201
|
htmlFor: checkboxId,
|
|
@@ -289,7 +208,7 @@ function Checkbox2({
|
|
|
289
208
|
className
|
|
290
209
|
)
|
|
291
210
|
},
|
|
292
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ React19.createElement(
|
|
293
212
|
"div",
|
|
294
213
|
{
|
|
295
214
|
className: cn(
|
|
@@ -298,7 +217,7 @@ function Checkbox2({
|
|
|
298
217
|
)
|
|
299
218
|
},
|
|
300
219
|
checkbox,
|
|
301
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ React19.createElement("div", { className: "flex-1 space-y-1" }, /* @__PURE__ */ React19.createElement("span", { className: "text-sm font-medium leading-none" }, label), description && /* @__PURE__ */ React19.createElement(
|
|
302
221
|
FieldDescription,
|
|
303
222
|
{
|
|
304
223
|
id: `${checkboxId}-description`,
|
|
@@ -338,11 +257,11 @@ function CheckboxGroup({
|
|
|
338
257
|
).length;
|
|
339
258
|
const allSelected = selectedEnabledCount === enabledOptions.length;
|
|
340
259
|
const someSelected = selectedEnabledCount > 0 && !allSelected;
|
|
341
|
-
const useChoiceCard =
|
|
260
|
+
const useChoiceCard = React19.useMemo(() => {
|
|
342
261
|
if (!options) return false;
|
|
343
262
|
return options?.some((opt) => opt.description);
|
|
344
263
|
}, [options]);
|
|
345
|
-
const countableValue =
|
|
264
|
+
const countableValue = React19.useMemo(() => {
|
|
346
265
|
if (value?.length > 0) {
|
|
347
266
|
return value.length;
|
|
348
267
|
}
|
|
@@ -367,7 +286,7 @@ function CheckboxGroup({
|
|
|
367
286
|
onBlur?.();
|
|
368
287
|
};
|
|
369
288
|
const maxReached = Boolean(maxSelections && countableValue >= maxSelections);
|
|
370
|
-
const containerClass =
|
|
289
|
+
const containerClass = React19.useMemo(() => {
|
|
371
290
|
return cn(
|
|
372
291
|
"w-full gap-3 grid grid-cols-1 border-0 m-0 p-0 min-w-0",
|
|
373
292
|
(layout === "grid" || layout === "inline") && "md:grid-cols-2",
|
|
@@ -376,7 +295,7 @@ function CheckboxGroup({
|
|
|
376
295
|
}, [layout, className]);
|
|
377
296
|
const groupDescriptionId = description ? `${name}-description` : void 0;
|
|
378
297
|
const groupAriaDescribedBy = [props["aria-describedby"], groupDescriptionId].filter(Boolean).join(" ") || void 0;
|
|
379
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ React19.createElement(
|
|
380
299
|
"fieldset",
|
|
381
300
|
{
|
|
382
301
|
className: containerClass,
|
|
@@ -386,7 +305,7 @@ function CheckboxGroup({
|
|
|
386
305
|
"aria-required": required || props["aria-required"],
|
|
387
306
|
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
388
307
|
},
|
|
389
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ React19.createElement(
|
|
390
309
|
LabelGroup,
|
|
391
310
|
{
|
|
392
311
|
labelHtmlFor: name,
|
|
@@ -397,7 +316,7 @@ function CheckboxGroup({
|
|
|
397
316
|
primary: label
|
|
398
317
|
}
|
|
399
318
|
),
|
|
400
|
-
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */
|
|
319
|
+
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */ React19.createElement(
|
|
401
320
|
Checkbox2,
|
|
402
321
|
{
|
|
403
322
|
name: `${name}-select-all`,
|
|
@@ -415,7 +334,7 @@ function CheckboxGroup({
|
|
|
415
334
|
options.map((option) => {
|
|
416
335
|
const isChecked = value.includes(option.value);
|
|
417
336
|
const isDisabled = disabled || option.disabled || maxReached && !isChecked;
|
|
418
|
-
return /* @__PURE__ */
|
|
337
|
+
return /* @__PURE__ */ React19.createElement(
|
|
419
338
|
Checkbox2,
|
|
420
339
|
{
|
|
421
340
|
key: option.value,
|
|
@@ -433,7 +352,7 @@ function CheckboxGroup({
|
|
|
433
352
|
}
|
|
434
353
|
);
|
|
435
354
|
}),
|
|
436
|
-
(minSelections || maxSelections) && /* @__PURE__ */
|
|
355
|
+
(minSelections || maxSelections) && /* @__PURE__ */ React19.createElement(
|
|
437
356
|
FieldDescription,
|
|
438
357
|
{
|
|
439
358
|
className: cn(
|
|
@@ -442,8 +361,8 @@ function CheckboxGroup({
|
|
|
442
361
|
),
|
|
443
362
|
"aria-live": "polite"
|
|
444
363
|
},
|
|
445
|
-
minSelections && countableValue < minSelections && /* @__PURE__ */
|
|
446
|
-
maxSelections && /* @__PURE__ */
|
|
364
|
+
minSelections && countableValue < minSelections && /* @__PURE__ */ React19.createElement("span", null, "Select at least ", minSelections, " option", minSelections !== 1 ? "s" : ""),
|
|
365
|
+
maxSelections && /* @__PURE__ */ React19.createElement("span", null, countableValue, "/", maxSelections, " selected")
|
|
447
366
|
)
|
|
448
367
|
);
|
|
449
368
|
}
|
|
@@ -452,7 +371,7 @@ function RadioGroup({
|
|
|
452
371
|
className,
|
|
453
372
|
...props
|
|
454
373
|
}) {
|
|
455
|
-
return /* @__PURE__ */
|
|
374
|
+
return /* @__PURE__ */ React19.createElement(
|
|
456
375
|
RadioGroup$1.Root,
|
|
457
376
|
{
|
|
458
377
|
"data-slot": "radio-group",
|
|
@@ -465,7 +384,7 @@ function RadioGroupItem({
|
|
|
465
384
|
className,
|
|
466
385
|
...props
|
|
467
386
|
}) {
|
|
468
|
-
return /* @__PURE__ */
|
|
387
|
+
return /* @__PURE__ */ React19.createElement(
|
|
469
388
|
RadioGroup$1.Item,
|
|
470
389
|
{
|
|
471
390
|
"data-slot": "radio-group-item",
|
|
@@ -483,19 +402,19 @@ function RadioGroupItem({
|
|
|
483
402
|
),
|
|
484
403
|
...props
|
|
485
404
|
},
|
|
486
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ React19.createElement(
|
|
487
406
|
RadioGroup$1.Indicator,
|
|
488
407
|
{
|
|
489
408
|
"data-slot": "radio-group-indicator",
|
|
490
409
|
className: "relative flex items-center justify-center"
|
|
491
410
|
},
|
|
492
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ React19.createElement(
|
|
493
412
|
"svg",
|
|
494
413
|
{
|
|
495
414
|
className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2",
|
|
496
415
|
viewBox: "0 0 24 24"
|
|
497
416
|
},
|
|
498
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ React19.createElement("circle", { cx: "12", cy: "12", r: "12" })
|
|
499
418
|
)
|
|
500
419
|
)
|
|
501
420
|
);
|
|
@@ -523,18 +442,18 @@ function Radio({
|
|
|
523
442
|
const handleBlur = () => {
|
|
524
443
|
onBlur?.();
|
|
525
444
|
};
|
|
526
|
-
const useChoiceCard =
|
|
445
|
+
const useChoiceCard = React19.useMemo(() => {
|
|
527
446
|
return options.some((option) => option.description);
|
|
528
447
|
}, [options]);
|
|
529
448
|
const groupDescriptionId = description ? `${name}-description` : void 0;
|
|
530
|
-
return /* @__PURE__ */
|
|
449
|
+
return /* @__PURE__ */ React19.createElement("div", { className: cn("w-full", className), "data-invalid": error || void 0 }, (label || description) && /* @__PURE__ */ React19.createElement("div", { className: "mb-3 space-y-1" }, label && /* @__PURE__ */ React19.createElement("div", { className: "text-base font-medium leading-none" }, label), description && /* @__PURE__ */ React19.createElement(
|
|
531
450
|
FieldDescription,
|
|
532
451
|
{
|
|
533
452
|
id: groupDescriptionId,
|
|
534
453
|
className: "leading-snug"
|
|
535
454
|
},
|
|
536
455
|
description
|
|
537
|
-
)), /* @__PURE__ */
|
|
456
|
+
)), /* @__PURE__ */ React19.createElement(
|
|
538
457
|
RadioGroup,
|
|
539
458
|
{
|
|
540
459
|
name,
|
|
@@ -557,7 +476,7 @@ function Radio({
|
|
|
557
476
|
const isDisabled = disabled || option.disabled;
|
|
558
477
|
const radioId = `${name}-${option.value}`;
|
|
559
478
|
const hasDescription = !!option.description;
|
|
560
|
-
return /* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ React19.createElement(
|
|
561
480
|
FieldLabel,
|
|
562
481
|
{
|
|
563
482
|
key: option.value,
|
|
@@ -570,16 +489,15 @@ function Radio({
|
|
|
570
489
|
isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
571
490
|
)
|
|
572
491
|
},
|
|
573
|
-
/* @__PURE__ */
|
|
574
|
-
|
|
492
|
+
/* @__PURE__ */ React19.createElement(
|
|
493
|
+
"div",
|
|
575
494
|
{
|
|
576
|
-
orientation: "horizontal",
|
|
577
495
|
className: cn(
|
|
578
496
|
"flex w-full gap-3",
|
|
579
497
|
useChoiceCard ? "items-start" : "items-center"
|
|
580
498
|
)
|
|
581
499
|
},
|
|
582
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ React19.createElement(
|
|
583
501
|
RadioGroupItem,
|
|
584
502
|
{
|
|
585
503
|
value: option.value,
|
|
@@ -589,7 +507,7 @@ function Radio({
|
|
|
589
507
|
"aria-describedby": hasDescription ? `${radioId}-description` : void 0
|
|
590
508
|
}
|
|
591
509
|
),
|
|
592
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ React19.createElement("div", { className: "flex-1 space-y-1" }, /* @__PURE__ */ React19.createElement("span", { className: "text-sm font-medium leading-none" }, option.label), option.description && /* @__PURE__ */ React19.createElement(
|
|
593
511
|
FieldDescription,
|
|
594
512
|
{
|
|
595
513
|
id: `${radioId}-description`,
|
|
@@ -608,7 +526,7 @@ function Switch({
|
|
|
608
526
|
size = "default",
|
|
609
527
|
...props
|
|
610
528
|
}) {
|
|
611
|
-
return /* @__PURE__ */
|
|
529
|
+
return /* @__PURE__ */ React19.createElement(
|
|
612
530
|
Switch$1.Root,
|
|
613
531
|
{
|
|
614
532
|
"data-slot": "switch",
|
|
@@ -630,7 +548,7 @@ function Switch({
|
|
|
630
548
|
),
|
|
631
549
|
...props
|
|
632
550
|
},
|
|
633
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ React19.createElement(
|
|
634
552
|
Switch$1.Thumb,
|
|
635
553
|
{
|
|
636
554
|
"data-slot": "switch-thumb",
|
|
@@ -669,7 +587,7 @@ function Switch2({
|
|
|
669
587
|
const handleBlur = () => {
|
|
670
588
|
onBlur?.();
|
|
671
589
|
};
|
|
672
|
-
const switchElement = /* @__PURE__ */
|
|
590
|
+
const switchElement = /* @__PURE__ */ React19.createElement(
|
|
673
591
|
Switch,
|
|
674
592
|
{
|
|
675
593
|
id: switchId,
|
|
@@ -685,9 +603,9 @@ function Switch2({
|
|
|
685
603
|
}
|
|
686
604
|
);
|
|
687
605
|
if (!label) {
|
|
688
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ React19.createElement(Field, { className }, switchElement);
|
|
689
607
|
}
|
|
690
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ React19.createElement(Field, { className: "gap-0", invalid: Boolean(error) }, /* @__PURE__ */ React19.createElement(
|
|
691
609
|
FieldLabel,
|
|
692
610
|
{
|
|
693
611
|
htmlFor: switchId,
|
|
@@ -698,7 +616,7 @@ function Switch2({
|
|
|
698
616
|
)
|
|
699
617
|
},
|
|
700
618
|
switchElement,
|
|
701
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ React19.createElement(Field, { className: "gap-1" }, /* @__PURE__ */ React19.createElement("span", { className: "text-sm font-medium leading-none" }, label), description && /* @__PURE__ */ React19.createElement(
|
|
702
620
|
FieldDescription,
|
|
703
621
|
{
|
|
704
622
|
id: `${switchId}-description`,
|
|
@@ -712,17 +630,17 @@ Switch2.displayName = "Switch";
|
|
|
712
630
|
function Select({
|
|
713
631
|
...props
|
|
714
632
|
}) {
|
|
715
|
-
return /* @__PURE__ */
|
|
633
|
+
return /* @__PURE__ */ React19.createElement(Select$1.Root, { "data-slot": "select", ...props });
|
|
716
634
|
}
|
|
717
635
|
function SelectGroup({
|
|
718
636
|
...props
|
|
719
637
|
}) {
|
|
720
|
-
return /* @__PURE__ */
|
|
638
|
+
return /* @__PURE__ */ React19.createElement(Select$1.Group, { "data-slot": "select-group", ...props });
|
|
721
639
|
}
|
|
722
640
|
function SelectValue({
|
|
723
641
|
...props
|
|
724
642
|
}) {
|
|
725
|
-
return /* @__PURE__ */
|
|
643
|
+
return /* @__PURE__ */ React19.createElement(Select$1.Value, { "data-slot": "select-value", ...props });
|
|
726
644
|
}
|
|
727
645
|
function SelectTrigger({
|
|
728
646
|
className,
|
|
@@ -730,7 +648,7 @@ function SelectTrigger({
|
|
|
730
648
|
children,
|
|
731
649
|
...props
|
|
732
650
|
}) {
|
|
733
|
-
return /* @__PURE__ */
|
|
651
|
+
return /* @__PURE__ */ React19.createElement(
|
|
734
652
|
Select$1.Trigger,
|
|
735
653
|
{
|
|
736
654
|
"data-slot": "select-trigger",
|
|
@@ -760,7 +678,7 @@ function SelectTrigger({
|
|
|
760
678
|
...props
|
|
761
679
|
},
|
|
762
680
|
children,
|
|
763
|
-
/* @__PURE__ */
|
|
681
|
+
/* @__PURE__ */ React19.createElement(Select$1.Icon, { asChild: true }, /* @__PURE__ */ React19.createElement(
|
|
764
682
|
"svg",
|
|
765
683
|
{
|
|
766
684
|
className: "size-4 opacity-50",
|
|
@@ -771,7 +689,7 @@ function SelectTrigger({
|
|
|
771
689
|
strokeLinecap: "round",
|
|
772
690
|
strokeLinejoin: "round"
|
|
773
691
|
},
|
|
774
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "6 9 12 15 18 9" })
|
|
775
693
|
))
|
|
776
694
|
);
|
|
777
695
|
}
|
|
@@ -782,7 +700,7 @@ function SelectContent({
|
|
|
782
700
|
align = "center",
|
|
783
701
|
...props
|
|
784
702
|
}) {
|
|
785
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ React19.createElement(Select$1.Portal, null, /* @__PURE__ */ React19.createElement(
|
|
786
704
|
Select$1.Content,
|
|
787
705
|
{
|
|
788
706
|
"data-slot": "select-content",
|
|
@@ -795,8 +713,8 @@ function SelectContent({
|
|
|
795
713
|
align,
|
|
796
714
|
...props
|
|
797
715
|
},
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ React19.createElement(SelectScrollUpButton, null),
|
|
717
|
+
/* @__PURE__ */ React19.createElement(
|
|
800
718
|
Select$1.Viewport,
|
|
801
719
|
{
|
|
802
720
|
className: cn(
|
|
@@ -806,14 +724,14 @@ function SelectContent({
|
|
|
806
724
|
},
|
|
807
725
|
children
|
|
808
726
|
),
|
|
809
|
-
/* @__PURE__ */
|
|
727
|
+
/* @__PURE__ */ React19.createElement(SelectScrollDownButton, null)
|
|
810
728
|
));
|
|
811
729
|
}
|
|
812
730
|
function SelectLabel({
|
|
813
731
|
className,
|
|
814
732
|
...props
|
|
815
733
|
}) {
|
|
816
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ React19.createElement(
|
|
817
735
|
Select$1.Label,
|
|
818
736
|
{
|
|
819
737
|
"data-slot": "select-label",
|
|
@@ -827,7 +745,7 @@ function SelectItem({
|
|
|
827
745
|
children,
|
|
828
746
|
...props
|
|
829
747
|
}) {
|
|
830
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ React19.createElement(
|
|
831
749
|
Select$1.Item,
|
|
832
750
|
{
|
|
833
751
|
"data-slot": "select-item",
|
|
@@ -847,13 +765,13 @@ function SelectItem({
|
|
|
847
765
|
),
|
|
848
766
|
...props
|
|
849
767
|
},
|
|
850
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ React19.createElement(
|
|
851
769
|
"span",
|
|
852
770
|
{
|
|
853
771
|
"data-slot": "select-item-indicator",
|
|
854
772
|
className: "absolute right-2 flex size-3.5 items-center justify-center"
|
|
855
773
|
},
|
|
856
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ React19.createElement(Select$1.ItemIndicator, null, /* @__PURE__ */ React19.createElement(
|
|
857
775
|
"svg",
|
|
858
776
|
{
|
|
859
777
|
className: "size-4",
|
|
@@ -864,17 +782,17 @@ function SelectItem({
|
|
|
864
782
|
strokeLinecap: "round",
|
|
865
783
|
strokeLinejoin: "round"
|
|
866
784
|
},
|
|
867
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
868
786
|
))
|
|
869
787
|
),
|
|
870
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ React19.createElement(Select$1.ItemText, null, children)
|
|
871
789
|
);
|
|
872
790
|
}
|
|
873
791
|
function SelectScrollUpButton({
|
|
874
792
|
className,
|
|
875
793
|
...props
|
|
876
794
|
}) {
|
|
877
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ React19.createElement(
|
|
878
796
|
Select$1.ScrollUpButton,
|
|
879
797
|
{
|
|
880
798
|
"data-slot": "select-scroll-up-button",
|
|
@@ -884,7 +802,7 @@ function SelectScrollUpButton({
|
|
|
884
802
|
),
|
|
885
803
|
...props
|
|
886
804
|
},
|
|
887
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ React19.createElement(
|
|
888
806
|
"svg",
|
|
889
807
|
{
|
|
890
808
|
className: "size-4",
|
|
@@ -895,7 +813,7 @@ function SelectScrollUpButton({
|
|
|
895
813
|
strokeLinecap: "round",
|
|
896
814
|
strokeLinejoin: "round"
|
|
897
815
|
},
|
|
898
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "18 15 12 9 6 15" })
|
|
899
817
|
)
|
|
900
818
|
);
|
|
901
819
|
}
|
|
@@ -903,7 +821,7 @@ function SelectScrollDownButton({
|
|
|
903
821
|
className,
|
|
904
822
|
...props
|
|
905
823
|
}) {
|
|
906
|
-
return /* @__PURE__ */
|
|
824
|
+
return /* @__PURE__ */ React19.createElement(
|
|
907
825
|
Select$1.ScrollDownButton,
|
|
908
826
|
{
|
|
909
827
|
"data-slot": "select-scroll-down-button",
|
|
@@ -913,7 +831,7 @@ function SelectScrollDownButton({
|
|
|
913
831
|
),
|
|
914
832
|
...props
|
|
915
833
|
},
|
|
916
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ React19.createElement(
|
|
917
835
|
"svg",
|
|
918
836
|
{
|
|
919
837
|
className: "size-4",
|
|
@@ -924,7 +842,7 @@ function SelectScrollDownButton({
|
|
|
924
842
|
strokeLinecap: "round",
|
|
925
843
|
strokeLinejoin: "round"
|
|
926
844
|
},
|
|
927
|
-
/* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "6 9 12 15 18 9" })
|
|
928
846
|
)
|
|
929
847
|
);
|
|
930
848
|
}
|
|
@@ -946,8 +864,8 @@ function Select2({
|
|
|
946
864
|
renderOption,
|
|
947
865
|
...props
|
|
948
866
|
}) {
|
|
949
|
-
const [hasInteracted, setHasInteracted] =
|
|
950
|
-
const allOptions =
|
|
867
|
+
const [hasInteracted, setHasInteracted] = React19.useState(false);
|
|
868
|
+
const allOptions = React19.useMemo(() => {
|
|
951
869
|
if (optionGroups.length > 0) {
|
|
952
870
|
return optionGroups.flatMap((group) => group.options);
|
|
953
871
|
}
|
|
@@ -968,7 +886,7 @@ function Select2({
|
|
|
968
886
|
onBlur?.();
|
|
969
887
|
}
|
|
970
888
|
};
|
|
971
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
972
890
|
"input",
|
|
973
891
|
{
|
|
974
892
|
type: "hidden",
|
|
@@ -990,7 +908,7 @@ function Select2({
|
|
|
990
908
|
border: "0"
|
|
991
909
|
}
|
|
992
910
|
}
|
|
993
|
-
), /* @__PURE__ */
|
|
911
|
+
), /* @__PURE__ */ React19.createElement(
|
|
994
912
|
Select,
|
|
995
913
|
{
|
|
996
914
|
value: selectValue,
|
|
@@ -998,7 +916,7 @@ function Select2({
|
|
|
998
916
|
onOpenChange: handleOpenChange,
|
|
999
917
|
disabled
|
|
1000
918
|
},
|
|
1001
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ React19.createElement(
|
|
1002
920
|
SelectTrigger,
|
|
1003
921
|
{
|
|
1004
922
|
className: cn(
|
|
@@ -1011,11 +929,11 @@ function Select2({
|
|
|
1011
929
|
"aria-describedby": props["aria-describedby"],
|
|
1012
930
|
"aria-required": required || props["aria-required"]
|
|
1013
931
|
},
|
|
1014
|
-
/* @__PURE__ */
|
|
932
|
+
/* @__PURE__ */ React19.createElement(SelectValue, { placeholder })
|
|
1015
933
|
),
|
|
1016
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ React19.createElement(SelectContent, null, optionGroups.length > 0 ? (
|
|
1017
935
|
// Render grouped options
|
|
1018
|
-
optionGroups.map((group, groupIndex) => /* @__PURE__ */
|
|
936
|
+
optionGroups.map((group, groupIndex) => /* @__PURE__ */ React19.createElement(SelectGroup, { key: groupIndex }, /* @__PURE__ */ React19.createElement(SelectLabel, null, group.label), group.options.map((option) => /* @__PURE__ */ React19.createElement(
|
|
1019
937
|
SelectItem,
|
|
1020
938
|
{
|
|
1021
939
|
key: option.value,
|
|
@@ -1026,7 +944,7 @@ function Select2({
|
|
|
1026
944
|
))))
|
|
1027
945
|
) : (
|
|
1028
946
|
// Render flat options
|
|
1029
|
-
allOptions.map((option) => /* @__PURE__ */
|
|
947
|
+
allOptions.map((option) => /* @__PURE__ */ React19.createElement(
|
|
1030
948
|
SelectItem,
|
|
1031
949
|
{
|
|
1032
950
|
key: option.value,
|
|
@@ -1042,20 +960,20 @@ Select2.displayName = "Select";
|
|
|
1042
960
|
function Dialog({
|
|
1043
961
|
...props
|
|
1044
962
|
}) {
|
|
1045
|
-
return /* @__PURE__ */
|
|
963
|
+
return /* @__PURE__ */ React19.createElement(Dialog$1.Root, { "data-slot": "dialog", ...props });
|
|
1046
964
|
}
|
|
1047
965
|
function DialogPortal({
|
|
1048
966
|
...props
|
|
1049
967
|
}) {
|
|
1050
|
-
return /* @__PURE__ */
|
|
968
|
+
return /* @__PURE__ */ React19.createElement(Dialog$1.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1051
969
|
}
|
|
1052
970
|
function DialogClose({
|
|
1053
971
|
...props
|
|
1054
972
|
}) {
|
|
1055
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ React19.createElement(Dialog$1.Close, { "data-slot": "dialog-close", ...props });
|
|
1056
974
|
}
|
|
1057
|
-
var DialogOverlay =
|
|
1058
|
-
return /* @__PURE__ */
|
|
975
|
+
var DialogOverlay = React19.forwardRef(({ className, ...props }, ref) => {
|
|
976
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1059
977
|
Dialog$1.Overlay,
|
|
1060
978
|
{
|
|
1061
979
|
ref,
|
|
@@ -1069,8 +987,8 @@ var DialogOverlay = React21.forwardRef(({ className, ...props }, ref) => {
|
|
|
1069
987
|
);
|
|
1070
988
|
});
|
|
1071
989
|
DialogOverlay.displayName = Dialog$1.Overlay.displayName;
|
|
1072
|
-
var DialogContent =
|
|
1073
|
-
return /* @__PURE__ */
|
|
990
|
+
var DialogContent = React19.forwardRef(({ className, children, showCloseButton = true, ...props }, ref) => {
|
|
991
|
+
return /* @__PURE__ */ React19.createElement(DialogPortal, { "data-slot": "dialog-portal" }, /* @__PURE__ */ React19.createElement(DialogOverlay, null), /* @__PURE__ */ React19.createElement(
|
|
1074
992
|
Dialog$1.Content,
|
|
1075
993
|
{
|
|
1076
994
|
ref,
|
|
@@ -1082,13 +1000,13 @@ var DialogContent = React21.forwardRef(({ className, children, showCloseButton =
|
|
|
1082
1000
|
...props
|
|
1083
1001
|
},
|
|
1084
1002
|
children,
|
|
1085
|
-
showCloseButton && /* @__PURE__ */
|
|
1003
|
+
showCloseButton && /* @__PURE__ */ React19.createElement(
|
|
1086
1004
|
Dialog$1.Close,
|
|
1087
1005
|
{
|
|
1088
1006
|
"data-slot": "dialog-close",
|
|
1089
1007
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
1090
1008
|
},
|
|
1091
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ React19.createElement(
|
|
1092
1010
|
"svg",
|
|
1093
1011
|
{
|
|
1094
1012
|
className: "size-4",
|
|
@@ -1099,16 +1017,16 @@ var DialogContent = React21.forwardRef(({ className, children, showCloseButton =
|
|
|
1099
1017
|
strokeLinecap: "round",
|
|
1100
1018
|
strokeLinejoin: "round"
|
|
1101
1019
|
},
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1020
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1021
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1104
1022
|
),
|
|
1105
|
-
/* @__PURE__ */
|
|
1023
|
+
/* @__PURE__ */ React19.createElement("span", { className: "sr-only" }, "Close")
|
|
1106
1024
|
)
|
|
1107
1025
|
));
|
|
1108
1026
|
});
|
|
1109
1027
|
DialogContent.displayName = Dialog$1.Content.displayName;
|
|
1110
1028
|
function DialogHeader({ className, ...props }) {
|
|
1111
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1112
1030
|
"div",
|
|
1113
1031
|
{
|
|
1114
1032
|
"data-slot": "dialog-header",
|
|
@@ -1121,7 +1039,7 @@ function DialogTitle({
|
|
|
1121
1039
|
className,
|
|
1122
1040
|
...props
|
|
1123
1041
|
}) {
|
|
1124
|
-
return /* @__PURE__ */
|
|
1042
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1125
1043
|
Dialog$1.Title,
|
|
1126
1044
|
{
|
|
1127
1045
|
"data-slot": "dialog-title",
|
|
@@ -1136,7 +1054,7 @@ function Command({
|
|
|
1136
1054
|
className,
|
|
1137
1055
|
...props
|
|
1138
1056
|
}) {
|
|
1139
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1140
1058
|
Command$1,
|
|
1141
1059
|
{
|
|
1142
1060
|
"data-slot": "command",
|
|
@@ -1152,13 +1070,13 @@ function CommandInput({
|
|
|
1152
1070
|
className,
|
|
1153
1071
|
...props
|
|
1154
1072
|
}) {
|
|
1155
|
-
return /* @__PURE__ */
|
|
1073
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1156
1074
|
"div",
|
|
1157
1075
|
{
|
|
1158
1076
|
"data-slot": "command-input-wrapper",
|
|
1159
1077
|
className: "flex h-9 items-center gap-2 border-b px-3"
|
|
1160
1078
|
},
|
|
1161
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ React19.createElement(
|
|
1162
1080
|
"svg",
|
|
1163
1081
|
{
|
|
1164
1082
|
className: "size-4 shrink-0 opacity-50",
|
|
@@ -1169,10 +1087,10 @@ function CommandInput({
|
|
|
1169
1087
|
strokeLinecap: "round",
|
|
1170
1088
|
strokeLinejoin: "round"
|
|
1171
1089
|
},
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ React19.createElement("circle", { cx: "11", cy: "11", r: "8" }),
|
|
1091
|
+
/* @__PURE__ */ React19.createElement("path", { d: "m21 21-4.3-4.3" })
|
|
1174
1092
|
),
|
|
1175
|
-
/* @__PURE__ */
|
|
1093
|
+
/* @__PURE__ */ React19.createElement(
|
|
1176
1094
|
Command$1.Input,
|
|
1177
1095
|
{
|
|
1178
1096
|
"data-slot": "command-input",
|
|
@@ -1189,7 +1107,7 @@ function CommandList({
|
|
|
1189
1107
|
className,
|
|
1190
1108
|
...props
|
|
1191
1109
|
}) {
|
|
1192
|
-
return /* @__PURE__ */
|
|
1110
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1193
1111
|
Command$1.List,
|
|
1194
1112
|
{
|
|
1195
1113
|
"data-slot": "command-list",
|
|
@@ -1204,7 +1122,7 @@ function CommandList({
|
|
|
1204
1122
|
function CommandEmpty({
|
|
1205
1123
|
...props
|
|
1206
1124
|
}) {
|
|
1207
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1208
1126
|
Command$1.Empty,
|
|
1209
1127
|
{
|
|
1210
1128
|
"data-slot": "command-empty",
|
|
@@ -1217,7 +1135,7 @@ function CommandGroup({
|
|
|
1217
1135
|
className,
|
|
1218
1136
|
...props
|
|
1219
1137
|
}) {
|
|
1220
|
-
return /* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1221
1139
|
Command$1.Group,
|
|
1222
1140
|
{
|
|
1223
1141
|
"data-slot": "command-group",
|
|
@@ -1232,12 +1150,12 @@ function CommandGroup({
|
|
|
1232
1150
|
function Popover({
|
|
1233
1151
|
...props
|
|
1234
1152
|
}) {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1153
|
+
return /* @__PURE__ */ React19.createElement(Popover$1.Root, { "data-slot": "popover", ...props });
|
|
1236
1154
|
}
|
|
1237
1155
|
function PopoverTrigger({
|
|
1238
1156
|
...props
|
|
1239
1157
|
}) {
|
|
1240
|
-
return /* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ React19.createElement(Popover$1.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
1241
1159
|
}
|
|
1242
1160
|
function PopoverContent({
|
|
1243
1161
|
className,
|
|
@@ -1245,7 +1163,7 @@ function PopoverContent({
|
|
|
1245
1163
|
sideOffset = 4,
|
|
1246
1164
|
...props
|
|
1247
1165
|
}) {
|
|
1248
|
-
return /* @__PURE__ */
|
|
1166
|
+
return /* @__PURE__ */ React19.createElement(Popover$1.Portal, null, /* @__PURE__ */ React19.createElement(
|
|
1249
1167
|
Popover$1.Content,
|
|
1250
1168
|
{
|
|
1251
1169
|
"data-slot": "popover-content",
|
|
@@ -1306,21 +1224,21 @@ function MultiSelect({
|
|
|
1306
1224
|
renderValue,
|
|
1307
1225
|
...props
|
|
1308
1226
|
}) {
|
|
1309
|
-
const [isOpen, setIsOpen] =
|
|
1310
|
-
const [searchQuery, setSearchQuery] =
|
|
1311
|
-
const [focusedIndex, setFocusedIndex] =
|
|
1312
|
-
const [hasInteracted, setHasInteracted] =
|
|
1313
|
-
const triggerRef =
|
|
1227
|
+
const [isOpen, setIsOpen] = React19.useState(false);
|
|
1228
|
+
const [searchQuery, setSearchQuery] = React19.useState("");
|
|
1229
|
+
const [focusedIndex, setFocusedIndex] = React19.useState(-1);
|
|
1230
|
+
const [hasInteracted, setHasInteracted] = React19.useState(false);
|
|
1231
|
+
const triggerRef = React19.useRef(null);
|
|
1314
1232
|
const dropdownId = `${name}-dropdown`;
|
|
1315
1233
|
const searchInputId = `${name}-search`;
|
|
1316
1234
|
ensureResizeObserver();
|
|
1317
|
-
const allOptions =
|
|
1235
|
+
const allOptions = React19.useMemo(() => {
|
|
1318
1236
|
if (optionGroups.length > 0) {
|
|
1319
1237
|
return optionGroups.flatMap((group) => group.options);
|
|
1320
1238
|
}
|
|
1321
1239
|
return options;
|
|
1322
1240
|
}, [options, optionGroups]);
|
|
1323
|
-
const filteredOptions =
|
|
1241
|
+
const filteredOptions = React19.useMemo(() => {
|
|
1324
1242
|
if (!searchQuery.trim()) {
|
|
1325
1243
|
return allOptions;
|
|
1326
1244
|
}
|
|
@@ -1329,19 +1247,19 @@ function MultiSelect({
|
|
|
1329
1247
|
(option) => optionLabelText(option).toLowerCase().includes(query)
|
|
1330
1248
|
);
|
|
1331
1249
|
}, [allOptions, searchQuery]);
|
|
1332
|
-
const selectedOptions =
|
|
1250
|
+
const selectedOptions = React19.useMemo(() => {
|
|
1333
1251
|
return allOptions.filter((option) => value.includes(option.value));
|
|
1334
1252
|
}, [allOptions, value]);
|
|
1335
1253
|
const hasValue = value.length > 0;
|
|
1336
|
-
const isMaxReached =
|
|
1254
|
+
const isMaxReached = React19.useMemo(() => {
|
|
1337
1255
|
return maxSelections !== void 0 && value.length >= maxSelections;
|
|
1338
1256
|
}, [maxSelections, value.length]);
|
|
1339
|
-
const getEnabledOptions =
|
|
1257
|
+
const getEnabledOptions = React19.useCallback(() => {
|
|
1340
1258
|
return filteredOptions.filter(
|
|
1341
1259
|
(option) => !option.disabled && (!isMaxReached || value.includes(option.value))
|
|
1342
1260
|
);
|
|
1343
1261
|
}, [filteredOptions, isMaxReached, value]);
|
|
1344
|
-
|
|
1262
|
+
React19.useEffect(() => {
|
|
1345
1263
|
if (!isOpen) return;
|
|
1346
1264
|
if (!searchable) return;
|
|
1347
1265
|
const id = window.setTimeout(() => {
|
|
@@ -1354,7 +1272,7 @@ function MultiSelect({
|
|
|
1354
1272
|
window.clearTimeout(id);
|
|
1355
1273
|
};
|
|
1356
1274
|
}, [isOpen, searchable, searchInputId]);
|
|
1357
|
-
const handleToggleOption =
|
|
1275
|
+
const handleToggleOption = React19.useCallback(
|
|
1358
1276
|
(optionValue) => {
|
|
1359
1277
|
const isSelected = value.includes(optionValue);
|
|
1360
1278
|
if (isSelected) {
|
|
@@ -1366,12 +1284,12 @@ function MultiSelect({
|
|
|
1366
1284
|
},
|
|
1367
1285
|
[isMaxReached, onChange, value]
|
|
1368
1286
|
);
|
|
1369
|
-
const handleSelectAll =
|
|
1287
|
+
const handleSelectAll = React19.useCallback(() => {
|
|
1370
1288
|
const enabledOptions = filteredOptions.filter((option) => !option.disabled);
|
|
1371
1289
|
onChange(enabledOptions.map((option) => option.value));
|
|
1372
1290
|
setSearchQuery("");
|
|
1373
1291
|
}, [filteredOptions, onChange]);
|
|
1374
|
-
const handleClearAll =
|
|
1292
|
+
const handleClearAll = React19.useCallback(
|
|
1375
1293
|
(e) => {
|
|
1376
1294
|
e.stopPropagation();
|
|
1377
1295
|
onChange([]);
|
|
@@ -1380,14 +1298,14 @@ function MultiSelect({
|
|
|
1380
1298
|
},
|
|
1381
1299
|
[onChange]
|
|
1382
1300
|
);
|
|
1383
|
-
const handleRemoveValue =
|
|
1301
|
+
const handleRemoveValue = React19.useCallback(
|
|
1384
1302
|
(optionValue, e) => {
|
|
1385
1303
|
e.stopPropagation();
|
|
1386
1304
|
onChange(value.filter((entry) => entry !== optionValue));
|
|
1387
1305
|
},
|
|
1388
1306
|
[onChange, value]
|
|
1389
1307
|
);
|
|
1390
|
-
const handleOpenChange =
|
|
1308
|
+
const handleOpenChange = React19.useCallback(
|
|
1391
1309
|
(nextOpen) => {
|
|
1392
1310
|
if (disabled) {
|
|
1393
1311
|
setIsOpen(false);
|
|
@@ -1410,12 +1328,12 @@ function MultiSelect({
|
|
|
1410
1328
|
},
|
|
1411
1329
|
[disabled, hasInteracted, isOpen, onBlur, onFocus]
|
|
1412
1330
|
);
|
|
1413
|
-
const handleTriggerBlur =
|
|
1331
|
+
const handleTriggerBlur = React19.useCallback(() => {
|
|
1414
1332
|
if (!isOpen) {
|
|
1415
1333
|
onBlur?.();
|
|
1416
1334
|
}
|
|
1417
1335
|
}, [isOpen, onBlur]);
|
|
1418
|
-
const handleKeyDown =
|
|
1336
|
+
const handleKeyDown = React19.useCallback(
|
|
1419
1337
|
(event) => {
|
|
1420
1338
|
if (disabled) return;
|
|
1421
1339
|
const enabledOptions = getEnabledOptions();
|
|
@@ -1512,7 +1430,7 @@ function MultiSelect({
|
|
|
1512
1430
|
]
|
|
1513
1431
|
);
|
|
1514
1432
|
const combinedClassName = cn("relative w-full", className);
|
|
1515
|
-
return /* @__PURE__ */
|
|
1433
|
+
return /* @__PURE__ */ React19.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React19.createElement(
|
|
1516
1434
|
"select",
|
|
1517
1435
|
{
|
|
1518
1436
|
name,
|
|
@@ -1526,9 +1444,9 @@ function MultiSelect({
|
|
|
1526
1444
|
style: { display: "none" },
|
|
1527
1445
|
multiple: true
|
|
1528
1446
|
},
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
allOptions.map((option) => /* @__PURE__ */
|
|
1531
|
-
), /* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ React19.createElement("option", { value: "" }, "Select..."),
|
|
1448
|
+
allOptions.map((option) => /* @__PURE__ */ React19.createElement("option", { key: option.value, value: option.value }, optionLabelText(option)))
|
|
1449
|
+
), /* @__PURE__ */ React19.createElement(Popover, { open: isOpen, onOpenChange: handleOpenChange }, /* @__PURE__ */ React19.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React19.createElement(
|
|
1532
1450
|
"div",
|
|
1533
1451
|
{
|
|
1534
1452
|
ref: triggerRef,
|
|
@@ -1550,13 +1468,13 @@ function MultiSelect({
|
|
|
1550
1468
|
"aria-disabled": disabled,
|
|
1551
1469
|
tabIndex: disabled ? -1 : 0
|
|
1552
1470
|
},
|
|
1553
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ React19.createElement("div", { className: "flex flex-1 items-center overflow-hidden" }, selectedOptions.length > 0 ? /* @__PURE__ */ React19.createElement("div", { className: "flex flex-wrap gap-1" }, selectedOptions.map((option) => /* @__PURE__ */ React19.createElement(
|
|
1554
1472
|
"span",
|
|
1555
1473
|
{
|
|
1556
1474
|
key: option.value,
|
|
1557
1475
|
className: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium"
|
|
1558
1476
|
},
|
|
1559
|
-
renderValue ? renderValue(option) : /* @__PURE__ */
|
|
1477
|
+
renderValue ? renderValue(option) : /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement("span", { className: "max-w-40 overflow-hidden text-ellipsis whitespace-nowrap" }, option.label), !disabled && /* @__PURE__ */ React19.createElement(
|
|
1560
1478
|
"button",
|
|
1561
1479
|
{
|
|
1562
1480
|
type: "button",
|
|
@@ -1567,8 +1485,8 @@ function MultiSelect({
|
|
|
1567
1485
|
},
|
|
1568
1486
|
"\u2715"
|
|
1569
1487
|
))
|
|
1570
|
-
))) : /* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1488
|
+
))) : /* @__PURE__ */ React19.createElement("span", { className: "relative" }, placeholder)),
|
|
1489
|
+
/* @__PURE__ */ React19.createElement("div", { className: "ml-2 flex items-center gap-1" }, loading && /* @__PURE__ */ React19.createElement("span", { className: "text-xs" }, "\u23F3"), clearable && value.length > 0 && !disabled && !loading && /* @__PURE__ */ React19.createElement(
|
|
1572
1490
|
"button",
|
|
1573
1491
|
{
|
|
1574
1492
|
type: "button",
|
|
@@ -1578,8 +1496,8 @@ function MultiSelect({
|
|
|
1578
1496
|
tabIndex: -1
|
|
1579
1497
|
},
|
|
1580
1498
|
"\u2715"
|
|
1581
|
-
), /* @__PURE__ */
|
|
1582
|
-
)), isOpen && /* @__PURE__ */
|
|
1499
|
+
), /* @__PURE__ */ React19.createElement("span", { className: "text-xs leading-none", "aria-hidden": "true" }, isOpen ? "\u25B2" : "\u25BC"))
|
|
1500
|
+
)), isOpen && /* @__PURE__ */ React19.createElement(
|
|
1583
1501
|
PopoverContent,
|
|
1584
1502
|
{
|
|
1585
1503
|
id: dropdownId,
|
|
@@ -1590,14 +1508,14 @@ function MultiSelect({
|
|
|
1590
1508
|
event.preventDefault();
|
|
1591
1509
|
}
|
|
1592
1510
|
},
|
|
1593
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ React19.createElement(
|
|
1594
1512
|
Command,
|
|
1595
1513
|
{
|
|
1596
1514
|
shouldFilter: false,
|
|
1597
1515
|
className: "max-h-80",
|
|
1598
1516
|
onKeyDown: handleKeyDown
|
|
1599
1517
|
},
|
|
1600
|
-
searchable && /* @__PURE__ */
|
|
1518
|
+
searchable && /* @__PURE__ */ React19.createElement(
|
|
1601
1519
|
CommandInput,
|
|
1602
1520
|
{
|
|
1603
1521
|
id: searchInputId,
|
|
@@ -1611,7 +1529,7 @@ function MultiSelect({
|
|
|
1611
1529
|
"aria-label": "Search options"
|
|
1612
1530
|
}
|
|
1613
1531
|
),
|
|
1614
|
-
showSelectAll && filteredOptions.length > 0 && /* @__PURE__ */
|
|
1532
|
+
showSelectAll && filteredOptions.length > 0 && /* @__PURE__ */ React19.createElement("div", { className: "flex gap-2 border-b border-input p-2" }, /* @__PURE__ */ React19.createElement(
|
|
1615
1533
|
"button",
|
|
1616
1534
|
{
|
|
1617
1535
|
type: "button",
|
|
@@ -1620,7 +1538,7 @@ function MultiSelect({
|
|
|
1620
1538
|
disabled
|
|
1621
1539
|
},
|
|
1622
1540
|
"Select All"
|
|
1623
|
-
), value.length > 0 && /* @__PURE__ */
|
|
1541
|
+
), value.length > 0 && /* @__PURE__ */ React19.createElement(
|
|
1624
1542
|
"button",
|
|
1625
1543
|
{
|
|
1626
1544
|
type: "button",
|
|
@@ -1630,13 +1548,13 @@ function MultiSelect({
|
|
|
1630
1548
|
},
|
|
1631
1549
|
"Clear All"
|
|
1632
1550
|
)),
|
|
1633
|
-
isMaxReached && /* @__PURE__ */
|
|
1634
|
-
/* @__PURE__ */
|
|
1551
|
+
isMaxReached && /* @__PURE__ */ React19.createElement("div", { className: "border-b border-destructive bg-destructive/80 px-2 py-1 text-xs font-medium text-destructive-foreground" }, "Maximum ", maxSelections, " selection", maxSelections !== 1 ? "s" : "", " ", "reached"),
|
|
1552
|
+
/* @__PURE__ */ React19.createElement(CommandList, { role: "listbox", "aria-multiselectable": "true" }, /* @__PURE__ */ React19.createElement(CommandEmpty, null, "No options found"), optionGroups.length > 0 ? optionGroups.map((group, groupIndex) => {
|
|
1635
1553
|
const groupOptions = group.options.filter(
|
|
1636
1554
|
(option) => filteredOptions.includes(option)
|
|
1637
1555
|
);
|
|
1638
1556
|
if (groupOptions.length === 0) return null;
|
|
1639
|
-
return /* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1640
1558
|
CommandGroup,
|
|
1641
1559
|
{
|
|
1642
1560
|
key: `${group.label}-${groupIndex}`,
|
|
@@ -1647,7 +1565,7 @@ function MultiSelect({
|
|
|
1647
1565
|
const isSelected = value.includes(option.value);
|
|
1648
1566
|
const isFocused = globalIndex === focusedIndex;
|
|
1649
1567
|
const optionDisabled = option.disabled || isMaxReached && !isSelected;
|
|
1650
|
-
return /* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1651
1569
|
"div",
|
|
1652
1570
|
{
|
|
1653
1571
|
key: option.value,
|
|
@@ -1669,8 +1587,8 @@ function MultiSelect({
|
|
|
1669
1587
|
optionDisabled && "pointer-events-none opacity-50"
|
|
1670
1588
|
)
|
|
1671
1589
|
},
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1590
|
+
/* @__PURE__ */ React19.createElement("span", { className: "text-base leading-none" }, isSelected ? "\u2611" : "\u2610"),
|
|
1591
|
+
/* @__PURE__ */ React19.createElement("span", { className: "flex-1" }, renderOption ? renderOption(option) : option.label)
|
|
1674
1592
|
);
|
|
1675
1593
|
})
|
|
1676
1594
|
);
|
|
@@ -1678,7 +1596,7 @@ function MultiSelect({
|
|
|
1678
1596
|
const isSelected = value.includes(option.value);
|
|
1679
1597
|
const isFocused = index === focusedIndex;
|
|
1680
1598
|
const optionDisabled = option.disabled || isMaxReached && !isSelected;
|
|
1681
|
-
return /* @__PURE__ */
|
|
1599
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1682
1600
|
"div",
|
|
1683
1601
|
{
|
|
1684
1602
|
key: option.value,
|
|
@@ -1700,26 +1618,26 @@ function MultiSelect({
|
|
|
1700
1618
|
optionDisabled && "pointer-events-none opacity-50"
|
|
1701
1619
|
)
|
|
1702
1620
|
},
|
|
1703
|
-
/* @__PURE__ */
|
|
1704
|
-
/* @__PURE__ */
|
|
1621
|
+
/* @__PURE__ */ React19.createElement("span", { className: "text-base leading-none" }, isSelected ? "\u2611" : "\u2610"),
|
|
1622
|
+
/* @__PURE__ */ React19.createElement("span", { className: "flex-1" }, renderOption ? renderOption(option) : option.label)
|
|
1705
1623
|
);
|
|
1706
1624
|
}))
|
|
1707
1625
|
)
|
|
1708
1626
|
)));
|
|
1709
1627
|
}
|
|
1710
1628
|
MultiSelect.displayName = "MultiSelect";
|
|
1711
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1629
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React19.useLayoutEffect : React19.useEffect;
|
|
1712
1630
|
|
|
1713
1631
|
// src/hooks/use-as-ref.ts
|
|
1714
1632
|
function useAsRef(props) {
|
|
1715
|
-
const ref =
|
|
1633
|
+
const ref = React19.useRef(props);
|
|
1716
1634
|
useIsomorphicLayoutEffect(() => {
|
|
1717
1635
|
ref.current = props;
|
|
1718
1636
|
});
|
|
1719
1637
|
return ref;
|
|
1720
1638
|
}
|
|
1721
1639
|
function useLazyRef(fn) {
|
|
1722
|
-
const ref =
|
|
1640
|
+
const ref = React19.useRef(null);
|
|
1723
1641
|
if (ref.current === null) {
|
|
1724
1642
|
ref.current = fn();
|
|
1725
1643
|
}
|
|
@@ -1738,7 +1656,7 @@ function BaseFileIcon({
|
|
|
1738
1656
|
children,
|
|
1739
1657
|
className
|
|
1740
1658
|
}) {
|
|
1741
|
-
return /* @__PURE__ */
|
|
1659
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1742
1660
|
"svg",
|
|
1743
1661
|
{
|
|
1744
1662
|
viewBox: "0 0 24 24",
|
|
@@ -1754,25 +1672,25 @@ function BaseFileIcon({
|
|
|
1754
1672
|
);
|
|
1755
1673
|
}
|
|
1756
1674
|
function FileVideoIcon() {
|
|
1757
|
-
return /* @__PURE__ */
|
|
1675
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }), /* @__PURE__ */ React19.createElement("rect", { x: "8", y: "12", width: "6", height: "4", rx: "1" }), /* @__PURE__ */ React19.createElement("path", { d: "m14 13 3-1.5v5L14 15" }));
|
|
1758
1676
|
}
|
|
1759
1677
|
function FileAudioIcon() {
|
|
1760
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }), /* @__PURE__ */ React19.createElement("path", { d: "M10 16a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z" }), /* @__PURE__ */ React19.createElement("path", { d: "M13 17V11l3-1" }));
|
|
1761
1679
|
}
|
|
1762
1680
|
function FileTextIcon() {
|
|
1763
|
-
return /* @__PURE__ */
|
|
1681
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }), /* @__PURE__ */ React19.createElement("line", { x1: "8", y1: "13", x2: "16", y2: "13" }), /* @__PURE__ */ React19.createElement("line", { x1: "8", y1: "17", x2: "14", y2: "17" }));
|
|
1764
1682
|
}
|
|
1765
1683
|
function FileCodeIcon() {
|
|
1766
|
-
return /* @__PURE__ */
|
|
1684
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }), /* @__PURE__ */ React19.createElement("polyline", { points: "11 14 9 16 11 18" }), /* @__PURE__ */ React19.createElement("polyline", { points: "13 14 15 16 13 18" }));
|
|
1767
1685
|
}
|
|
1768
1686
|
function FileArchiveIcon() {
|
|
1769
|
-
return /* @__PURE__ */
|
|
1687
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }), /* @__PURE__ */ React19.createElement("rect", { x: "9", y: "11", width: "6", height: "2" }), /* @__PURE__ */ React19.createElement("path", { d: "M12 13v5" }));
|
|
1770
1688
|
}
|
|
1771
1689
|
function FileCogIcon() {
|
|
1772
|
-
return /* @__PURE__ */
|
|
1690
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }), /* @__PURE__ */ React19.createElement("circle", { cx: "12", cy: "16", r: "2" }), /* @__PURE__ */ React19.createElement("path", { d: "m12 12 .4.9m2.7 1.1 .9.4m-.9 2.7-.9.4m-2.7 1.1-.4.9m-2.3-.9-.4-.9m-2.7-1.1-.9-.4m.9-2.7.9-.4m2.7-1.1.4-.9" }));
|
|
1773
1691
|
}
|
|
1774
1692
|
function FileIcon() {
|
|
1775
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ React19.createElement(BaseFileIcon, null, /* @__PURE__ */ React19.createElement("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), /* @__PURE__ */ React19.createElement("polyline", { points: "14 2 14 8 20 8" }));
|
|
1776
1694
|
}
|
|
1777
1695
|
function formatBytes(bytes) {
|
|
1778
1696
|
if (bytes === 0) return "0 B";
|
|
@@ -1784,13 +1702,13 @@ function getFileIcon(file) {
|
|
|
1784
1702
|
const type = file.type;
|
|
1785
1703
|
const extension = file.name.split(".").pop()?.toLowerCase() ?? "";
|
|
1786
1704
|
if (type.startsWith("video/")) {
|
|
1787
|
-
return /* @__PURE__ */
|
|
1705
|
+
return /* @__PURE__ */ React19.createElement(FileVideoIcon, null);
|
|
1788
1706
|
}
|
|
1789
1707
|
if (type.startsWith("audio/")) {
|
|
1790
|
-
return /* @__PURE__ */
|
|
1708
|
+
return /* @__PURE__ */ React19.createElement(FileAudioIcon, null);
|
|
1791
1709
|
}
|
|
1792
1710
|
if (type.startsWith("text/") || ["txt", "md", "rtf", "pdf"].includes(extension)) {
|
|
1793
|
-
return /* @__PURE__ */
|
|
1711
|
+
return /* @__PURE__ */ React19.createElement(FileTextIcon, null);
|
|
1794
1712
|
}
|
|
1795
1713
|
if ([
|
|
1796
1714
|
"html",
|
|
@@ -1809,19 +1727,19 @@ function getFileIcon(file) {
|
|
|
1809
1727
|
"cpp",
|
|
1810
1728
|
"cs"
|
|
1811
1729
|
].includes(extension)) {
|
|
1812
|
-
return /* @__PURE__ */
|
|
1730
|
+
return /* @__PURE__ */ React19.createElement(FileCodeIcon, null);
|
|
1813
1731
|
}
|
|
1814
1732
|
if (["zip", "rar", "7z", "tar", "gz", "bz2"].includes(extension)) {
|
|
1815
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ React19.createElement(FileArchiveIcon, null);
|
|
1816
1734
|
}
|
|
1817
1735
|
if (["exe", "msi", "app", "apk", "deb", "rpm"].includes(extension) || type.startsWith("application/")) {
|
|
1818
|
-
return /* @__PURE__ */
|
|
1736
|
+
return /* @__PURE__ */ React19.createElement(FileCogIcon, null);
|
|
1819
1737
|
}
|
|
1820
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ React19.createElement(FileIcon, null);
|
|
1821
1739
|
}
|
|
1822
|
-
var StoreContext =
|
|
1740
|
+
var StoreContext = React19.createContext(null);
|
|
1823
1741
|
function useStoreContext(consumerName) {
|
|
1824
|
-
const context =
|
|
1742
|
+
const context = React19.useContext(StoreContext);
|
|
1825
1743
|
if (!context) {
|
|
1826
1744
|
throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
|
|
1827
1745
|
}
|
|
@@ -1832,7 +1750,7 @@ function useStore(selector) {
|
|
|
1832
1750
|
const lastValueRef = useLazyRef(
|
|
1833
1751
|
() => null
|
|
1834
1752
|
);
|
|
1835
|
-
const getSnapshot =
|
|
1753
|
+
const getSnapshot = React19.useCallback(() => {
|
|
1836
1754
|
const state = store.getState();
|
|
1837
1755
|
const prevValue = lastValueRef.current;
|
|
1838
1756
|
if (prevValue && prevValue.state === state) {
|
|
@@ -1842,13 +1760,13 @@ function useStore(selector) {
|
|
|
1842
1760
|
lastValueRef.current = { value: nextValue, state };
|
|
1843
1761
|
return nextValue;
|
|
1844
1762
|
}, [store, selector, lastValueRef]);
|
|
1845
|
-
return
|
|
1763
|
+
return React19.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
1846
1764
|
}
|
|
1847
|
-
var FileUploadContext =
|
|
1765
|
+
var FileUploadContext = React19.createContext(
|
|
1848
1766
|
null
|
|
1849
1767
|
);
|
|
1850
1768
|
function useFileUploadContext(consumerName) {
|
|
1851
|
-
const context =
|
|
1769
|
+
const context = React19.useContext(FileUploadContext);
|
|
1852
1770
|
if (!context) {
|
|
1853
1771
|
throw new Error(`\`${consumerName}\` must be used within \`${ROOT_NAME}\``);
|
|
1854
1772
|
}
|
|
@@ -1880,15 +1798,15 @@ function FileUpload(props) {
|
|
|
1880
1798
|
className,
|
|
1881
1799
|
...rootProps
|
|
1882
1800
|
} = props;
|
|
1883
|
-
const inputId =
|
|
1884
|
-
const dropzoneId =
|
|
1885
|
-
const listId =
|
|
1886
|
-
const labelId =
|
|
1801
|
+
const inputId = React19.useId();
|
|
1802
|
+
const dropzoneId = React19.useId();
|
|
1803
|
+
const listId = React19.useId();
|
|
1804
|
+
const labelId = React19.useId();
|
|
1887
1805
|
const dir = useDirection(dirProp);
|
|
1888
1806
|
const listeners = useLazyRef(() => /* @__PURE__ */ new Set()).current;
|
|
1889
1807
|
const files = useLazyRef(() => /* @__PURE__ */ new Map()).current;
|
|
1890
1808
|
const urlCache = useLazyRef(() => /* @__PURE__ */ new WeakMap()).current;
|
|
1891
|
-
const inputRef =
|
|
1809
|
+
const inputRef = React19.useRef(null);
|
|
1892
1810
|
const isControlled = value !== void 0;
|
|
1893
1811
|
const propsRef = useAsRef({
|
|
1894
1812
|
onValueChange,
|
|
@@ -1898,7 +1816,7 @@ function FileUpload(props) {
|
|
|
1898
1816
|
onFileValidate,
|
|
1899
1817
|
onUpload
|
|
1900
1818
|
});
|
|
1901
|
-
const store =
|
|
1819
|
+
const store = React19.useMemo(() => {
|
|
1902
1820
|
let state = {
|
|
1903
1821
|
files,
|
|
1904
1822
|
dragOver: false,
|
|
@@ -2027,7 +1945,7 @@ function FileUpload(props) {
|
|
|
2027
1945
|
}
|
|
2028
1946
|
};
|
|
2029
1947
|
}, [listeners, files, invalid, propsRef, urlCache]);
|
|
2030
|
-
const acceptTypes =
|
|
1948
|
+
const acceptTypes = React19.useMemo(
|
|
2031
1949
|
() => accept?.split(",").map((t) => t.trim()) ?? null,
|
|
2032
1950
|
[accept]
|
|
2033
1951
|
);
|
|
@@ -2045,14 +1963,14 @@ function FileUpload(props) {
|
|
|
2045
1963
|
});
|
|
2046
1964
|
};
|
|
2047
1965
|
}).current;
|
|
2048
|
-
|
|
1966
|
+
React19.useEffect(() => {
|
|
2049
1967
|
if (isControlled) {
|
|
2050
1968
|
store.dispatch({ type: "SET_FILES", files: value });
|
|
2051
1969
|
} else if (defaultValue && defaultValue.length > 0 && !store.getState().files.size) {
|
|
2052
1970
|
store.dispatch({ type: "SET_FILES", files: defaultValue });
|
|
2053
1971
|
}
|
|
2054
1972
|
}, [value, defaultValue, isControlled, store]);
|
|
2055
|
-
|
|
1973
|
+
React19.useEffect(() => {
|
|
2056
1974
|
return () => {
|
|
2057
1975
|
for (const file of files.keys()) {
|
|
2058
1976
|
const cachedUrl = urlCache.get(file);
|
|
@@ -2062,7 +1980,7 @@ function FileUpload(props) {
|
|
|
2062
1980
|
}
|
|
2063
1981
|
};
|
|
2064
1982
|
}, [files, urlCache]);
|
|
2065
|
-
const onFilesUpload =
|
|
1983
|
+
const onFilesUpload = React19.useCallback(
|
|
2066
1984
|
async (files2) => {
|
|
2067
1985
|
try {
|
|
2068
1986
|
for (const file of files2) {
|
|
@@ -2100,7 +2018,7 @@ function FileUpload(props) {
|
|
|
2100
2018
|
},
|
|
2101
2019
|
[store, propsRef, onProgress]
|
|
2102
2020
|
);
|
|
2103
|
-
const onFilesChange =
|
|
2021
|
+
const onFilesChange = React19.useCallback(
|
|
2104
2022
|
(originalFiles) => {
|
|
2105
2023
|
if (disabled) return;
|
|
2106
2024
|
let filesToProcess = [...originalFiles];
|
|
@@ -2198,7 +2116,7 @@ function FileUpload(props) {
|
|
|
2198
2116
|
disabled
|
|
2199
2117
|
]
|
|
2200
2118
|
);
|
|
2201
|
-
const onInputChange =
|
|
2119
|
+
const onInputChange = React19.useCallback(
|
|
2202
2120
|
(event) => {
|
|
2203
2121
|
const files2 = Array.from(event.target.files ?? []);
|
|
2204
2122
|
onFilesChange(files2);
|
|
@@ -2206,7 +2124,7 @@ function FileUpload(props) {
|
|
|
2206
2124
|
},
|
|
2207
2125
|
[onFilesChange]
|
|
2208
2126
|
);
|
|
2209
|
-
const contextValue =
|
|
2127
|
+
const contextValue = React19.useMemo(
|
|
2210
2128
|
() => ({
|
|
2211
2129
|
dropzoneId,
|
|
2212
2130
|
inputId,
|
|
@@ -2224,7 +2142,7 @@ function FileUpload(props) {
|
|
|
2224
2142
|
contextValue.dropzoneId,
|
|
2225
2143
|
inputProps?.["aria-describedby"]
|
|
2226
2144
|
].filter(Boolean).join(" ").trim();
|
|
2227
|
-
return /* @__PURE__ */
|
|
2145
|
+
return /* @__PURE__ */ React19.createElement(StoreContext.Provider, { value: store }, /* @__PURE__ */ React19.createElement(FileUploadContext.Provider, { value: contextValue }, /* @__PURE__ */ React19.createElement(
|
|
2228
2146
|
RootPrimitive,
|
|
2229
2147
|
{
|
|
2230
2148
|
"data-disabled": disabled ? "" : void 0,
|
|
@@ -2234,7 +2152,7 @@ function FileUpload(props) {
|
|
|
2234
2152
|
className: cn("relative flex flex-col gap-2", className)
|
|
2235
2153
|
},
|
|
2236
2154
|
children,
|
|
2237
|
-
/* @__PURE__ */
|
|
2155
|
+
/* @__PURE__ */ React19.createElement(
|
|
2238
2156
|
"input",
|
|
2239
2157
|
{
|
|
2240
2158
|
type: "file",
|
|
@@ -2253,7 +2171,7 @@ function FileUpload(props) {
|
|
|
2253
2171
|
...inputProps
|
|
2254
2172
|
}
|
|
2255
2173
|
),
|
|
2256
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ React19.createElement("div", { id: labelId, className: "sr-only" }, label ?? "File upload")
|
|
2257
2175
|
)));
|
|
2258
2176
|
}
|
|
2259
2177
|
function FileUploadDropzone(props) {
|
|
@@ -2282,7 +2200,7 @@ function FileUploadDropzone(props) {
|
|
|
2282
2200
|
onPaste: onPasteProp,
|
|
2283
2201
|
onKeyDown: onKeyDownProp
|
|
2284
2202
|
});
|
|
2285
|
-
const onClick =
|
|
2203
|
+
const onClick = React19.useCallback(
|
|
2286
2204
|
(event) => {
|
|
2287
2205
|
propsRef.current.onClick?.(event);
|
|
2288
2206
|
if (event.defaultPrevented) return;
|
|
@@ -2294,7 +2212,7 @@ function FileUploadDropzone(props) {
|
|
|
2294
2212
|
},
|
|
2295
2213
|
[context.inputRef, propsRef]
|
|
2296
2214
|
);
|
|
2297
|
-
const onDragOver =
|
|
2215
|
+
const onDragOver = React19.useCallback(
|
|
2298
2216
|
(event) => {
|
|
2299
2217
|
propsRef.current.onDragOver?.(event);
|
|
2300
2218
|
if (event.defaultPrevented) return;
|
|
@@ -2303,7 +2221,7 @@ function FileUploadDropzone(props) {
|
|
|
2303
2221
|
},
|
|
2304
2222
|
[store, propsRef]
|
|
2305
2223
|
);
|
|
2306
|
-
const onDragEnter =
|
|
2224
|
+
const onDragEnter = React19.useCallback(
|
|
2307
2225
|
(event) => {
|
|
2308
2226
|
propsRef.current.onDragEnter?.(event);
|
|
2309
2227
|
if (event.defaultPrevented) return;
|
|
@@ -2312,7 +2230,7 @@ function FileUploadDropzone(props) {
|
|
|
2312
2230
|
},
|
|
2313
2231
|
[store, propsRef]
|
|
2314
2232
|
);
|
|
2315
|
-
const onDragLeave =
|
|
2233
|
+
const onDragLeave = React19.useCallback(
|
|
2316
2234
|
(event) => {
|
|
2317
2235
|
propsRef.current.onDragLeave?.(event);
|
|
2318
2236
|
if (event.defaultPrevented) return;
|
|
@@ -2325,7 +2243,7 @@ function FileUploadDropzone(props) {
|
|
|
2325
2243
|
},
|
|
2326
2244
|
[store, propsRef]
|
|
2327
2245
|
);
|
|
2328
|
-
const onDrop =
|
|
2246
|
+
const onDrop = React19.useCallback(
|
|
2329
2247
|
(event) => {
|
|
2330
2248
|
propsRef.current.onDrop?.(event);
|
|
2331
2249
|
if (event.defaultPrevented) return;
|
|
@@ -2345,7 +2263,7 @@ function FileUploadDropzone(props) {
|
|
|
2345
2263
|
},
|
|
2346
2264
|
[store, context.inputRef, propsRef]
|
|
2347
2265
|
);
|
|
2348
|
-
const onPaste =
|
|
2266
|
+
const onPaste = React19.useCallback(
|
|
2349
2267
|
(event) => {
|
|
2350
2268
|
propsRef.current.onPaste?.(event);
|
|
2351
2269
|
if (event.defaultPrevented) return;
|
|
@@ -2377,7 +2295,7 @@ function FileUploadDropzone(props) {
|
|
|
2377
2295
|
},
|
|
2378
2296
|
[store, context.inputRef, propsRef]
|
|
2379
2297
|
);
|
|
2380
|
-
const onKeyDown =
|
|
2298
|
+
const onKeyDown = React19.useCallback(
|
|
2381
2299
|
(event) => {
|
|
2382
2300
|
propsRef.current.onKeyDown?.(event);
|
|
2383
2301
|
if (!event.defaultPrevented && (event.key === "Enter" || event.key === " ")) {
|
|
@@ -2388,7 +2306,7 @@ function FileUploadDropzone(props) {
|
|
|
2388
2306
|
[context.inputRef, propsRef]
|
|
2389
2307
|
);
|
|
2390
2308
|
const DropzonePrimitive = asChild ? Slot : "div";
|
|
2391
|
-
return /* @__PURE__ */
|
|
2309
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2392
2310
|
DropzonePrimitive,
|
|
2393
2311
|
{
|
|
2394
2312
|
role: "region",
|
|
@@ -2430,7 +2348,7 @@ function FileUploadList(props) {
|
|
|
2430
2348
|
const shouldRender = forceMount || fileCount > 0;
|
|
2431
2349
|
if (!shouldRender) return null;
|
|
2432
2350
|
const ListPrimitive = asChild ? Slot : "div";
|
|
2433
|
-
return /* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2434
2352
|
ListPrimitive,
|
|
2435
2353
|
{
|
|
2436
2354
|
role: "list",
|
|
@@ -2449,9 +2367,9 @@ function FileUploadList(props) {
|
|
|
2449
2367
|
}
|
|
2450
2368
|
);
|
|
2451
2369
|
}
|
|
2452
|
-
var FileUploadItemContext =
|
|
2370
|
+
var FileUploadItemContext = React19.createContext(null);
|
|
2453
2371
|
function useFileUploadItemContext(consumerName) {
|
|
2454
|
-
const context =
|
|
2372
|
+
const context = React19.useContext(FileUploadItemContext);
|
|
2455
2373
|
if (!context) {
|
|
2456
2374
|
throw new Error(`\`${consumerName}\` must be used within \`${ITEM_NAME}\``);
|
|
2457
2375
|
}
|
|
@@ -2459,7 +2377,7 @@ function useFileUploadItemContext(consumerName) {
|
|
|
2459
2377
|
}
|
|
2460
2378
|
function FileUploadItem(props) {
|
|
2461
2379
|
const { value, asChild, className, ...itemProps } = props;
|
|
2462
|
-
const id =
|
|
2380
|
+
const id = React19.useId();
|
|
2463
2381
|
const statusId = `${id}-status`;
|
|
2464
2382
|
const nameId = `${id}-name`;
|
|
2465
2383
|
const sizeId = `${id}-size`;
|
|
@@ -2471,7 +2389,7 @@ function FileUploadItem(props) {
|
|
|
2471
2389
|
const files = Array.from(state.files.keys());
|
|
2472
2390
|
return files.indexOf(value) + 1;
|
|
2473
2391
|
});
|
|
2474
|
-
const itemContext =
|
|
2392
|
+
const itemContext = React19.useMemo(
|
|
2475
2393
|
() => ({
|
|
2476
2394
|
id,
|
|
2477
2395
|
fileState,
|
|
@@ -2485,7 +2403,7 @@ function FileUploadItem(props) {
|
|
|
2485
2403
|
if (!fileState) return null;
|
|
2486
2404
|
const statusText = fileState.error ? `Error: ${fileState.error}` : fileState.status === "uploading" ? `Uploading: ${fileState.progress}% complete` : fileState.status === "success" ? "Upload complete" : "Ready to upload";
|
|
2487
2405
|
const ItemPrimitive = asChild ? Slot : "div";
|
|
2488
|
-
return /* @__PURE__ */
|
|
2406
|
+
return /* @__PURE__ */ React19.createElement(FileUploadItemContext.Provider, { value: itemContext }, /* @__PURE__ */ React19.createElement(
|
|
2489
2407
|
ItemPrimitive,
|
|
2490
2408
|
{
|
|
2491
2409
|
role: "listitem",
|
|
@@ -2503,14 +2421,14 @@ function FileUploadItem(props) {
|
|
|
2503
2421
|
)
|
|
2504
2422
|
},
|
|
2505
2423
|
props.children,
|
|
2506
|
-
/* @__PURE__ */
|
|
2424
|
+
/* @__PURE__ */ React19.createElement("span", { id: statusId, className: "sr-only" }, statusText)
|
|
2507
2425
|
));
|
|
2508
2426
|
}
|
|
2509
2427
|
function FileUploadItemPreview(props) {
|
|
2510
2428
|
const { render, asChild, children, className, ...previewProps } = props;
|
|
2511
2429
|
const itemContext = useFileUploadItemContext(ITEM_PREVIEW_NAME);
|
|
2512
2430
|
const context = useFileUploadContext(ITEM_PREVIEW_NAME);
|
|
2513
|
-
const getDefaultRender =
|
|
2431
|
+
const getDefaultRender = React19.useCallback(
|
|
2514
2432
|
(file) => {
|
|
2515
2433
|
if (itemContext.fileState?.file.type.startsWith("image/")) {
|
|
2516
2434
|
let url = context.urlCache.get(file);
|
|
@@ -2520,14 +2438,14 @@ function FileUploadItemPreview(props) {
|
|
|
2520
2438
|
}
|
|
2521
2439
|
return (
|
|
2522
2440
|
// biome-ignore lint/performance/noImgElement: dynamic file URLs from user uploads don't work well with Next.js Image optimization
|
|
2523
|
-
/* @__PURE__ */
|
|
2441
|
+
/* @__PURE__ */ React19.createElement("img", { src: url, alt: file.name, className: "size-full object-cover" })
|
|
2524
2442
|
);
|
|
2525
2443
|
}
|
|
2526
2444
|
return getFileIcon(file);
|
|
2527
2445
|
},
|
|
2528
2446
|
[itemContext.fileState?.file.type, context.urlCache]
|
|
2529
2447
|
);
|
|
2530
|
-
const onPreviewRender =
|
|
2448
|
+
const onPreviewRender = React19.useCallback(
|
|
2531
2449
|
(file) => {
|
|
2532
2450
|
if (render) {
|
|
2533
2451
|
return render(file, () => getDefaultRender(file));
|
|
@@ -2538,7 +2456,7 @@ function FileUploadItemPreview(props) {
|
|
|
2538
2456
|
);
|
|
2539
2457
|
if (!itemContext.fileState) return null;
|
|
2540
2458
|
const ItemPreviewPrimitive = asChild ? Slot : "div";
|
|
2541
|
-
return /* @__PURE__ */
|
|
2459
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2542
2460
|
ItemPreviewPrimitive,
|
|
2543
2461
|
{
|
|
2544
2462
|
"aria-labelledby": itemContext.nameId,
|
|
@@ -2565,7 +2483,7 @@ function FileUploadItemMetadata(props) {
|
|
|
2565
2483
|
const itemContext = useFileUploadItemContext(ITEM_METADATA_NAME);
|
|
2566
2484
|
if (!itemContext.fileState) return null;
|
|
2567
2485
|
const ItemMetadataPrimitive = asChild ? Slot : "div";
|
|
2568
|
-
return /* @__PURE__ */
|
|
2486
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2569
2487
|
ItemMetadataPrimitive,
|
|
2570
2488
|
{
|
|
2571
2489
|
"data-slot": "file-upload-metadata",
|
|
@@ -2573,7 +2491,7 @@ function FileUploadItemMetadata(props) {
|
|
|
2573
2491
|
...metadataProps,
|
|
2574
2492
|
className: cn("flex min-w-0 flex-1 flex-col", className)
|
|
2575
2493
|
},
|
|
2576
|
-
children ?? /* @__PURE__ */
|
|
2494
|
+
children ?? /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
2577
2495
|
"span",
|
|
2578
2496
|
{
|
|
2579
2497
|
id: itemContext.nameId,
|
|
@@ -2583,7 +2501,7 @@ function FileUploadItemMetadata(props) {
|
|
|
2583
2501
|
)
|
|
2584
2502
|
},
|
|
2585
2503
|
itemContext.fileState.file.name
|
|
2586
|
-
), /* @__PURE__ */
|
|
2504
|
+
), /* @__PURE__ */ React19.createElement(
|
|
2587
2505
|
"span",
|
|
2588
2506
|
{
|
|
2589
2507
|
id: itemContext.sizeId,
|
|
@@ -2593,7 +2511,7 @@ function FileUploadItemMetadata(props) {
|
|
|
2593
2511
|
)
|
|
2594
2512
|
},
|
|
2595
2513
|
formatBytes(itemContext.fileState.file.size)
|
|
2596
|
-
), itemContext.fileState.error && /* @__PURE__ */
|
|
2514
|
+
), itemContext.fileState.error && /* @__PURE__ */ React19.createElement(
|
|
2597
2515
|
"span",
|
|
2598
2516
|
{
|
|
2599
2517
|
id: itemContext.messageId,
|
|
@@ -2607,7 +2525,7 @@ function FileUploadItemDelete(props) {
|
|
|
2607
2525
|
const { asChild, onClick: onClickProp, ...deleteProps } = props;
|
|
2608
2526
|
const store = useStoreContext(ITEM_DELETE_NAME);
|
|
2609
2527
|
const itemContext = useFileUploadItemContext(ITEM_DELETE_NAME);
|
|
2610
|
-
const onClick =
|
|
2528
|
+
const onClick = React19.useCallback(
|
|
2611
2529
|
(event) => {
|
|
2612
2530
|
onClickProp?.(event);
|
|
2613
2531
|
if (!itemContext.fileState || event.defaultPrevented) return;
|
|
@@ -2620,7 +2538,7 @@ function FileUploadItemDelete(props) {
|
|
|
2620
2538
|
);
|
|
2621
2539
|
if (!itemContext.fileState) return null;
|
|
2622
2540
|
const ItemDeletePrimitive = asChild ? Slot : "button";
|
|
2623
|
-
return /* @__PURE__ */
|
|
2541
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2624
2542
|
ItemDeletePrimitive,
|
|
2625
2543
|
{
|
|
2626
2544
|
type: "button",
|
|
@@ -2659,16 +2577,16 @@ function FileInput({
|
|
|
2659
2577
|
onFileRemove,
|
|
2660
2578
|
...props
|
|
2661
2579
|
}) {
|
|
2662
|
-
const normalizedValue =
|
|
2580
|
+
const normalizedValue = React19.useMemo(() => {
|
|
2663
2581
|
const safeValue = Array.isArray(value) ? value : [];
|
|
2664
2582
|
return multiple ? safeValue : safeValue.slice(0, 1);
|
|
2665
2583
|
}, [multiple, value]);
|
|
2666
|
-
const [cropperOpen, setCropperOpen] =
|
|
2667
|
-
const [imageToCrop, setImageToCrop] =
|
|
2668
|
-
const [crop, setCrop] =
|
|
2669
|
-
const [zoom, setZoom] =
|
|
2670
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
2671
|
-
const validateFile =
|
|
2584
|
+
const [cropperOpen, setCropperOpen] = React19.useState(false);
|
|
2585
|
+
const [imageToCrop, setImageToCrop] = React19.useState(null);
|
|
2586
|
+
const [crop, setCrop] = React19.useState({ x: 0, y: 0 });
|
|
2587
|
+
const [zoom, setZoom] = React19.useState(1);
|
|
2588
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = React19.useState(null);
|
|
2589
|
+
const validateFile = React19.useCallback(
|
|
2672
2590
|
(file) => {
|
|
2673
2591
|
if (accept) {
|
|
2674
2592
|
const acceptedTypes = accept.split(",").map((type) => type.trim());
|
|
@@ -2703,7 +2621,7 @@ function FileInput({
|
|
|
2703
2621
|
},
|
|
2704
2622
|
[accept, maxSize]
|
|
2705
2623
|
);
|
|
2706
|
-
const mapRejectedFileError =
|
|
2624
|
+
const mapRejectedFileError = React19.useCallback(
|
|
2707
2625
|
(file, message) => {
|
|
2708
2626
|
const normalizedMessage = message.toLowerCase();
|
|
2709
2627
|
if (normalizedMessage.includes("maximum") && normalizedMessage.includes("files")) {
|
|
@@ -2722,27 +2640,27 @@ function FileInput({
|
|
|
2722
2640
|
},
|
|
2723
2641
|
[maxSize]
|
|
2724
2642
|
);
|
|
2725
|
-
const handleFileValidate =
|
|
2643
|
+
const handleFileValidate = React19.useCallback(
|
|
2726
2644
|
(file) => {
|
|
2727
2645
|
const validationError = validateFile(file);
|
|
2728
2646
|
return validationError?.message ?? null;
|
|
2729
2647
|
},
|
|
2730
2648
|
[validateFile]
|
|
2731
2649
|
);
|
|
2732
|
-
const handleFileReject =
|
|
2650
|
+
const handleFileReject = React19.useCallback(
|
|
2733
2651
|
(file, message) => {
|
|
2734
2652
|
const validationError = mapRejectedFileError(file, message);
|
|
2735
2653
|
onValidationError?.([validationError]);
|
|
2736
2654
|
},
|
|
2737
2655
|
[mapRejectedFileError, onValidationError]
|
|
2738
2656
|
);
|
|
2739
|
-
const handleBlur =
|
|
2657
|
+
const handleBlur = React19.useCallback(() => {
|
|
2740
2658
|
onBlur?.();
|
|
2741
2659
|
}, [onBlur]);
|
|
2742
|
-
const fileIdentity =
|
|
2660
|
+
const fileIdentity = React19.useCallback((file) => {
|
|
2743
2661
|
return `${file.name}-${file.size}-${file.lastModified}`;
|
|
2744
2662
|
}, []);
|
|
2745
|
-
const handleValueChange =
|
|
2663
|
+
const handleValueChange = React19.useCallback(
|
|
2746
2664
|
(incomingFiles) => {
|
|
2747
2665
|
const nextFiles = multiple ? incomingFiles : incomingFiles.slice(-1);
|
|
2748
2666
|
if (onFileRemove && nextFiles.length < normalizedValue.length) {
|
|
@@ -2778,7 +2696,7 @@ function FileInput({
|
|
|
2778
2696
|
fileIdentity
|
|
2779
2697
|
]
|
|
2780
2698
|
);
|
|
2781
|
-
const createCroppedImage =
|
|
2699
|
+
const createCroppedImage = React19.useCallback(
|
|
2782
2700
|
async (imageUrl, cropArea) => {
|
|
2783
2701
|
return new Promise((resolve, reject) => {
|
|
2784
2702
|
const image = new Image();
|
|
@@ -2822,7 +2740,7 @@ function FileInput({
|
|
|
2822
2740
|
},
|
|
2823
2741
|
[]
|
|
2824
2742
|
);
|
|
2825
|
-
const handleCropSave =
|
|
2743
|
+
const handleCropSave = React19.useCallback(async () => {
|
|
2826
2744
|
if (!imageToCrop || !croppedAreaPixels) return;
|
|
2827
2745
|
try {
|
|
2828
2746
|
const croppedBlob = await createCroppedImage(
|
|
@@ -2870,7 +2788,7 @@ function FileInput({
|
|
|
2870
2788
|
onChange,
|
|
2871
2789
|
onCropComplete
|
|
2872
2790
|
]);
|
|
2873
|
-
const handleCropCancel =
|
|
2791
|
+
const handleCropCancel = React19.useCallback(() => {
|
|
2874
2792
|
if (imageToCrop) {
|
|
2875
2793
|
URL.revokeObjectURL(imageToCrop.url);
|
|
2876
2794
|
}
|
|
@@ -2880,32 +2798,32 @@ function FileInput({
|
|
|
2880
2798
|
setZoom(1);
|
|
2881
2799
|
setCroppedAreaPixels(null);
|
|
2882
2800
|
}, [imageToCrop]);
|
|
2883
|
-
const handleCrop =
|
|
2801
|
+
const handleCrop = React19.useCallback((file) => {
|
|
2884
2802
|
if (!file.type.startsWith("image/")) return;
|
|
2885
2803
|
const previewUrl = URL.createObjectURL(file);
|
|
2886
2804
|
setImageToCrop({ file, url: previewUrl });
|
|
2887
2805
|
setCropperOpen(true);
|
|
2888
2806
|
}, []);
|
|
2889
|
-
const onCropChange =
|
|
2807
|
+
const onCropChange = React19.useCallback((nextCrop) => {
|
|
2890
2808
|
setCrop(nextCrop);
|
|
2891
2809
|
}, []);
|
|
2892
|
-
const onZoomChange =
|
|
2810
|
+
const onZoomChange = React19.useCallback((nextZoom) => {
|
|
2893
2811
|
setZoom(nextZoom);
|
|
2894
2812
|
}, []);
|
|
2895
|
-
const onCropCompleteInternal =
|
|
2813
|
+
const onCropCompleteInternal = React19.useCallback(
|
|
2896
2814
|
(_, nextCroppedAreaPixels) => {
|
|
2897
2815
|
setCroppedAreaPixels(nextCroppedAreaPixels);
|
|
2898
2816
|
},
|
|
2899
2817
|
[]
|
|
2900
2818
|
);
|
|
2901
|
-
const formatFileSize =
|
|
2819
|
+
const formatFileSize = React19.useCallback((bytes) => {
|
|
2902
2820
|
if (bytes === 0) return "0 Bytes";
|
|
2903
2821
|
const unit = 1024;
|
|
2904
2822
|
const units = ["Bytes", "KB", "MB", "GB"];
|
|
2905
2823
|
const index = Math.floor(Math.log(bytes) / Math.log(unit));
|
|
2906
2824
|
return Math.round(bytes / Math.pow(unit, index) * 100) / 100 + " " + units[index];
|
|
2907
2825
|
}, []);
|
|
2908
|
-
|
|
2826
|
+
React19.useEffect(() => {
|
|
2909
2827
|
return () => {
|
|
2910
2828
|
if (imageToCrop) {
|
|
2911
2829
|
URL.revokeObjectURL(imageToCrop.url);
|
|
@@ -2913,7 +2831,7 @@ function FileInput({
|
|
|
2913
2831
|
};
|
|
2914
2832
|
}, [imageToCrop]);
|
|
2915
2833
|
const fileCountLabel = normalizedValue.length > 0 ? `${normalizedValue.length} file(s) selected` : placeholder;
|
|
2916
|
-
return /* @__PURE__ */
|
|
2834
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
2917
2835
|
FileUpload,
|
|
2918
2836
|
{
|
|
2919
2837
|
name,
|
|
@@ -2939,7 +2857,7 @@ function FileInput({
|
|
|
2939
2857
|
"aria-describedby": props["aria-describedby"]
|
|
2940
2858
|
}
|
|
2941
2859
|
},
|
|
2942
|
-
/* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ React19.createElement(
|
|
2943
2861
|
FileUploadDropzone,
|
|
2944
2862
|
{
|
|
2945
2863
|
role: "button",
|
|
@@ -2952,7 +2870,7 @@ function FileInput({
|
|
|
2952
2870
|
error && "border-destructive"
|
|
2953
2871
|
)
|
|
2954
2872
|
},
|
|
2955
|
-
/* @__PURE__ */
|
|
2873
|
+
/* @__PURE__ */ React19.createElement("div", { className: "flex flex-col items-center gap-2 text-center" }, /* @__PURE__ */ React19.createElement(
|
|
2956
2874
|
"svg",
|
|
2957
2875
|
{
|
|
2958
2876
|
width: "48",
|
|
@@ -2965,23 +2883,23 @@ function FileInput({
|
|
|
2965
2883
|
strokeLinejoin: "round",
|
|
2966
2884
|
"aria-hidden": "true"
|
|
2967
2885
|
},
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
), /* @__PURE__ */
|
|
2886
|
+
/* @__PURE__ */ React19.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2887
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "17 8 12 3 7 8" }),
|
|
2888
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
2889
|
+
), /* @__PURE__ */ React19.createElement("p", { className: "text-sm font-medium" }, fileCountLabel), accept && /* @__PURE__ */ React19.createElement("p", { className: "text-xs" }, "Accepted: ", accept), /* @__PURE__ */ React19.createElement("p", { className: "text-xs" }, "Max size: ", formatFileSize(maxSize)))
|
|
2972
2890
|
),
|
|
2973
|
-
/* @__PURE__ */
|
|
2891
|
+
/* @__PURE__ */ React19.createElement(FileUploadList, { className: "mt-4" }, normalizedValue.map((file, index) => {
|
|
2974
2892
|
const progressValue = uploadProgress[file.name];
|
|
2975
2893
|
const hasProgress = showProgress && typeof progressValue === "number";
|
|
2976
|
-
return /* @__PURE__ */
|
|
2894
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2977
2895
|
FileUploadItem,
|
|
2978
2896
|
{
|
|
2979
2897
|
key: `${file.name}-${index}`,
|
|
2980
2898
|
value: file,
|
|
2981
2899
|
className: "flex items-center gap-3 border-border bg-card text-card-foreground hover:bg-primary/50 transition-colors"
|
|
2982
2900
|
},
|
|
2983
|
-
showPreview ? /* @__PURE__ */
|
|
2984
|
-
/* @__PURE__ */
|
|
2901
|
+
showPreview ? /* @__PURE__ */ React19.createElement(FileUploadItemPreview, { className: "h-12 w-12 rounded [&>img]:h-full [&>img]:w-full [&>img]:object-cover [&>svg]:size-6" }) : null,
|
|
2902
|
+
/* @__PURE__ */ React19.createElement("div", { className: "flex min-w-0 flex-1 flex-col" }, /* @__PURE__ */ React19.createElement(FileUploadItemMetadata, { className: "min-w-0" }), /* @__PURE__ */ React19.createElement("span", { className: "text-xs" }, formatFileSize(file.size)), hasProgress ? /* @__PURE__ */ React19.createElement("div", { className: "mt-1 flex items-center gap-2" }, /* @__PURE__ */ React19.createElement(
|
|
2985
2903
|
"div",
|
|
2986
2904
|
{
|
|
2987
2905
|
className: "h-1.5 flex-1 overflow-hidden rounded-full bg-accent/40",
|
|
@@ -2991,15 +2909,15 @@ function FileInput({
|
|
|
2991
2909
|
"aria-valuemax": 100,
|
|
2992
2910
|
"aria-label": `Upload progress: ${progressValue}%`
|
|
2993
2911
|
},
|
|
2994
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ React19.createElement(
|
|
2995
2913
|
"div",
|
|
2996
2914
|
{
|
|
2997
2915
|
className: "h-full bg-primary transition-all",
|
|
2998
2916
|
style: { width: `${progressValue}%` }
|
|
2999
2917
|
}
|
|
3000
2918
|
)
|
|
3001
|
-
), /* @__PURE__ */
|
|
3002
|
-
enableCropping && file.type.startsWith("image/") ? /* @__PURE__ */
|
|
2919
|
+
), /* @__PURE__ */ React19.createElement("span", { className: "text-xs" }, progressValue, "%")) : null),
|
|
2920
|
+
enableCropping && file.type.startsWith("image/") ? /* @__PURE__ */ React19.createElement(
|
|
3003
2921
|
Button,
|
|
3004
2922
|
{
|
|
3005
2923
|
type: "button",
|
|
@@ -3013,7 +2931,7 @@ function FileInput({
|
|
|
3013
2931
|
className: "h-8 w-8 p-0",
|
|
3014
2932
|
"aria-label": `Crop ${file.name}`
|
|
3015
2933
|
},
|
|
3016
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ React19.createElement(
|
|
3017
2935
|
"svg",
|
|
3018
2936
|
{
|
|
3019
2937
|
width: "20",
|
|
@@ -3026,11 +2944,11 @@ function FileInput({
|
|
|
3026
2944
|
strokeLinejoin: "round",
|
|
3027
2945
|
"aria-hidden": "true"
|
|
3028
2946
|
},
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ React19.createElement("path", { d: "M6.13 1L6 16a2 2 0 0 0 2 2h15" }),
|
|
2948
|
+
/* @__PURE__ */ React19.createElement("path", { d: "M1 6.13L16 6a2 2 0 0 1 2 2v15" })
|
|
3031
2949
|
)
|
|
3032
2950
|
) : null,
|
|
3033
|
-
/* @__PURE__ */
|
|
2951
|
+
/* @__PURE__ */ React19.createElement(FileUploadItemDelete, { asChild: true }, /* @__PURE__ */ React19.createElement(
|
|
3034
2952
|
Button,
|
|
3035
2953
|
{
|
|
3036
2954
|
type: "button",
|
|
@@ -3040,7 +2958,7 @@ function FileInput({
|
|
|
3040
2958
|
className: "h-8 w-8 p-0",
|
|
3041
2959
|
"aria-label": `Remove ${file.name}`
|
|
3042
2960
|
},
|
|
3043
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ React19.createElement(
|
|
3044
2962
|
"svg",
|
|
3045
2963
|
{
|
|
3046
2964
|
width: "20",
|
|
@@ -3053,13 +2971,13 @@ function FileInput({
|
|
|
3053
2971
|
strokeLinejoin: "round",
|
|
3054
2972
|
"aria-hidden": "true"
|
|
3055
2973
|
},
|
|
3056
|
-
/* @__PURE__ */
|
|
3057
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
2975
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
3058
2976
|
)
|
|
3059
2977
|
))
|
|
3060
2978
|
);
|
|
3061
2979
|
}))
|
|
3062
|
-
), /* @__PURE__ */
|
|
2980
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3063
2981
|
Dialog,
|
|
3064
2982
|
{
|
|
3065
2983
|
open: cropperOpen && Boolean(imageToCrop),
|
|
@@ -3069,14 +2987,14 @@ function FileInput({
|
|
|
3069
2987
|
}
|
|
3070
2988
|
}
|
|
3071
2989
|
},
|
|
3072
|
-
imageToCrop ? /* @__PURE__ */
|
|
2990
|
+
imageToCrop ? /* @__PURE__ */ React19.createElement(
|
|
3073
2991
|
DialogContent,
|
|
3074
2992
|
{
|
|
3075
2993
|
showCloseButton: false,
|
|
3076
2994
|
className: "max-w-3xl gap-0 p-0",
|
|
3077
2995
|
"aria-describedby": void 0
|
|
3078
2996
|
},
|
|
3079
|
-
/* @__PURE__ */
|
|
2997
|
+
/* @__PURE__ */ React19.createElement(DialogHeader, { className: "flex-row items-center justify-between border-b border-border px-4 py-3" }, /* @__PURE__ */ React19.createElement(DialogTitle, null, "Crop Image"), /* @__PURE__ */ React19.createElement(DialogClose, { asChild: true }, /* @__PURE__ */ React19.createElement(
|
|
3080
2998
|
Button,
|
|
3081
2999
|
{
|
|
3082
3000
|
type: "button",
|
|
@@ -3085,7 +3003,7 @@ function FileInput({
|
|
|
3085
3003
|
className: "h-8 w-8 p-0",
|
|
3086
3004
|
"aria-label": "Close"
|
|
3087
3005
|
},
|
|
3088
|
-
/* @__PURE__ */
|
|
3006
|
+
/* @__PURE__ */ React19.createElement(
|
|
3089
3007
|
"svg",
|
|
3090
3008
|
{
|
|
3091
3009
|
width: "16",
|
|
@@ -3098,11 +3016,11 @@ function FileInput({
|
|
|
3098
3016
|
strokeLinejoin: "round",
|
|
3099
3017
|
"aria-hidden": "true"
|
|
3100
3018
|
},
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
3020
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
3103
3021
|
)
|
|
3104
3022
|
))),
|
|
3105
|
-
/* @__PURE__ */
|
|
3023
|
+
/* @__PURE__ */ React19.createElement("div", { className: "p-4" }, /* @__PURE__ */ React19.createElement(
|
|
3106
3024
|
"div",
|
|
3107
3025
|
{
|
|
3108
3026
|
className: "relative h-96 w-full overflow-hidden rounded-md bg-accent/40",
|
|
@@ -3124,7 +3042,7 @@ function FileInput({
|
|
|
3124
3042
|
document.addEventListener("mouseup", handleMouseUp);
|
|
3125
3043
|
}
|
|
3126
3044
|
},
|
|
3127
|
-
/* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ React19.createElement(
|
|
3128
3046
|
"img",
|
|
3129
3047
|
{
|
|
3130
3048
|
src: imageToCrop.url,
|
|
@@ -3159,7 +3077,7 @@ function FileInput({
|
|
|
3159
3077
|
}
|
|
3160
3078
|
}
|
|
3161
3079
|
),
|
|
3162
|
-
/* @__PURE__ */
|
|
3080
|
+
/* @__PURE__ */ React19.createElement(
|
|
3163
3081
|
"div",
|
|
3164
3082
|
{
|
|
3165
3083
|
className: "pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded border-2 border-primary",
|
|
@@ -3168,9 +3086,9 @@ function FileInput({
|
|
|
3168
3086
|
aspectRatio: cropAspectRatio ? String(cropAspectRatio) : void 0
|
|
3169
3087
|
}
|
|
3170
3088
|
},
|
|
3171
|
-
/* @__PURE__ */
|
|
3089
|
+
/* @__PURE__ */ React19.createElement("div", { className: "absolute inset-0 grid grid-cols-3 grid-rows-3" }, /* @__PURE__ */ React19.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React19.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React19.createElement("div", null))
|
|
3172
3090
|
)
|
|
3173
|
-
), /* @__PURE__ */
|
|
3091
|
+
), /* @__PURE__ */ React19.createElement("div", { className: "mt-4 flex items-center gap-3" }, /* @__PURE__ */ React19.createElement(
|
|
3174
3092
|
"label",
|
|
3175
3093
|
{
|
|
3176
3094
|
htmlFor: "zoom-slider",
|
|
@@ -3179,7 +3097,7 @@ function FileInput({
|
|
|
3179
3097
|
"Zoom: ",
|
|
3180
3098
|
zoom.toFixed(1),
|
|
3181
3099
|
"x"
|
|
3182
|
-
), /* @__PURE__ */
|
|
3100
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3183
3101
|
"input",
|
|
3184
3102
|
{
|
|
3185
3103
|
id: "zoom-slider",
|
|
@@ -3193,7 +3111,7 @@ function FileInput({
|
|
|
3193
3111
|
"aria-label": "Zoom level"
|
|
3194
3112
|
}
|
|
3195
3113
|
))),
|
|
3196
|
-
/* @__PURE__ */
|
|
3114
|
+
/* @__PURE__ */ React19.createElement("div", { className: "flex items-center justify-end gap-2 border-t border-border p-4" }, /* @__PURE__ */ React19.createElement(Button, { type: "button", variant: "outline", onClick: handleCropCancel }, "Cancel"), /* @__PURE__ */ React19.createElement(Button, { type: "button", onClick: handleCropSave }, "Save"))
|
|
3197
3115
|
) : null
|
|
3198
3116
|
));
|
|
3199
3117
|
}
|
|
@@ -3209,7 +3127,7 @@ function Calendar({
|
|
|
3209
3127
|
...props
|
|
3210
3128
|
}) {
|
|
3211
3129
|
const defaultClassNames = getDefaultClassNames();
|
|
3212
|
-
return /* @__PURE__ */
|
|
3130
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3213
3131
|
DayPicker,
|
|
3214
3132
|
{
|
|
3215
3133
|
showOutsideDays,
|
|
@@ -3309,7 +3227,7 @@ function Calendar({
|
|
|
3309
3227
|
},
|
|
3310
3228
|
components: {
|
|
3311
3229
|
Root: ({ className: className2, rootRef, ...props2 }) => {
|
|
3312
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3313
3231
|
"div",
|
|
3314
3232
|
{
|
|
3315
3233
|
"data-slot": "calendar",
|
|
@@ -3321,7 +3239,7 @@ function Calendar({
|
|
|
3321
3239
|
},
|
|
3322
3240
|
Chevron: ({ className: className2, orientation, ...props2 }) => {
|
|
3323
3241
|
if (orientation === "left") {
|
|
3324
|
-
return /* @__PURE__ */
|
|
3242
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3325
3243
|
"svg",
|
|
3326
3244
|
{
|
|
3327
3245
|
className: cn("size-4", className2),
|
|
@@ -3333,11 +3251,11 @@ function Calendar({
|
|
|
3333
3251
|
strokeLinejoin: "round",
|
|
3334
3252
|
...props2
|
|
3335
3253
|
},
|
|
3336
|
-
/* @__PURE__ */
|
|
3254
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "15 18 9 12 15 6" })
|
|
3337
3255
|
);
|
|
3338
3256
|
}
|
|
3339
3257
|
if (orientation === "right") {
|
|
3340
|
-
return /* @__PURE__ */
|
|
3258
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3341
3259
|
"svg",
|
|
3342
3260
|
{
|
|
3343
3261
|
className: cn("size-4", className2),
|
|
@@ -3349,10 +3267,10 @@ function Calendar({
|
|
|
3349
3267
|
strokeLinejoin: "round",
|
|
3350
3268
|
...props2
|
|
3351
3269
|
},
|
|
3352
|
-
/* @__PURE__ */
|
|
3270
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "9 18 15 12 9 6" })
|
|
3353
3271
|
);
|
|
3354
3272
|
}
|
|
3355
|
-
return /* @__PURE__ */
|
|
3273
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3356
3274
|
"svg",
|
|
3357
3275
|
{
|
|
3358
3276
|
className: cn("size-4", className2),
|
|
@@ -3364,12 +3282,12 @@ function Calendar({
|
|
|
3364
3282
|
strokeLinejoin: "round",
|
|
3365
3283
|
...props2
|
|
3366
3284
|
},
|
|
3367
|
-
/* @__PURE__ */
|
|
3285
|
+
/* @__PURE__ */ React19.createElement("polyline", { points: "6 9 12 15 18 9" })
|
|
3368
3286
|
);
|
|
3369
3287
|
},
|
|
3370
3288
|
DayButton: CalendarDayButton,
|
|
3371
3289
|
WeekNumber: ({ children, ...props2 }) => {
|
|
3372
|
-
return /* @__PURE__ */
|
|
3290
|
+
return /* @__PURE__ */ React19.createElement("td", { ...props2 }, /* @__PURE__ */ React19.createElement("div", { className: "flex size-(--cell-size) items-center justify-center text-center" }, children));
|
|
3373
3291
|
},
|
|
3374
3292
|
...components
|
|
3375
3293
|
},
|
|
@@ -3384,11 +3302,11 @@ function CalendarDayButton({
|
|
|
3384
3302
|
...props
|
|
3385
3303
|
}) {
|
|
3386
3304
|
const defaultClassNames = getDefaultClassNames();
|
|
3387
|
-
const ref =
|
|
3388
|
-
|
|
3305
|
+
const ref = React19.useRef(null);
|
|
3306
|
+
React19.useEffect(() => {
|
|
3389
3307
|
if (modifiers.focused) ref.current?.focus();
|
|
3390
3308
|
}, [modifiers.focused]);
|
|
3391
|
-
return /* @__PURE__ */
|
|
3309
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3392
3310
|
Button,
|
|
3393
3311
|
{
|
|
3394
3312
|
ref,
|
|
@@ -3440,7 +3358,7 @@ function DatePickerDayButton({
|
|
|
3440
3358
|
children,
|
|
3441
3359
|
...props
|
|
3442
3360
|
}) {
|
|
3443
|
-
return /* @__PURE__ */
|
|
3361
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3444
3362
|
"button",
|
|
3445
3363
|
{
|
|
3446
3364
|
type: "button",
|
|
@@ -3476,18 +3394,18 @@ function DatePicker({
|
|
|
3476
3394
|
showIcon = true,
|
|
3477
3395
|
...props
|
|
3478
3396
|
}) {
|
|
3479
|
-
const [isOpen, setIsOpen] =
|
|
3480
|
-
const [hasInteracted, setHasInteracted] =
|
|
3481
|
-
const [selectedMonth, setSelectedMonth] =
|
|
3397
|
+
const [isOpen, setIsOpen] = React19.useState(false);
|
|
3398
|
+
const [hasInteracted, setHasInteracted] = React19.useState(false);
|
|
3399
|
+
const [selectedMonth, setSelectedMonth] = React19.useState(
|
|
3482
3400
|
value || /* @__PURE__ */ new Date()
|
|
3483
3401
|
);
|
|
3484
|
-
const inputRef =
|
|
3485
|
-
|
|
3402
|
+
const inputRef = React19.useRef(null);
|
|
3403
|
+
React19.useEffect(() => {
|
|
3486
3404
|
if (value) {
|
|
3487
3405
|
setSelectedMonth(value);
|
|
3488
3406
|
}
|
|
3489
3407
|
}, [value]);
|
|
3490
|
-
const disabledMatchers =
|
|
3408
|
+
const disabledMatchers = React19.useMemo(() => {
|
|
3491
3409
|
const matchers = [];
|
|
3492
3410
|
if (minDate) {
|
|
3493
3411
|
matchers.push({ before: minDate });
|
|
@@ -3503,7 +3421,7 @@ function DatePicker({
|
|
|
3503
3421
|
}
|
|
3504
3422
|
return matchers;
|
|
3505
3423
|
}, [disabledDates, isDateDisabled, maxDate, minDate]);
|
|
3506
|
-
const handleDateSelect =
|
|
3424
|
+
const handleDateSelect = React19.useCallback(
|
|
3507
3425
|
(date) => {
|
|
3508
3426
|
if (!date) return;
|
|
3509
3427
|
onChange(date);
|
|
@@ -3513,7 +3431,7 @@ function DatePicker({
|
|
|
3513
3431
|
},
|
|
3514
3432
|
[onBlur, onChange]
|
|
3515
3433
|
);
|
|
3516
|
-
const handleClear =
|
|
3434
|
+
const handleClear = React19.useCallback(
|
|
3517
3435
|
(e) => {
|
|
3518
3436
|
e.stopPropagation();
|
|
3519
3437
|
onChange(null);
|
|
@@ -3522,7 +3440,7 @@ function DatePicker({
|
|
|
3522
3440
|
},
|
|
3523
3441
|
[onChange]
|
|
3524
3442
|
);
|
|
3525
|
-
const handleOpenChange =
|
|
3443
|
+
const handleOpenChange = React19.useCallback(
|
|
3526
3444
|
(nextOpen) => {
|
|
3527
3445
|
if (disabled) {
|
|
3528
3446
|
setIsOpen(false);
|
|
@@ -3542,12 +3460,12 @@ function DatePicker({
|
|
|
3542
3460
|
},
|
|
3543
3461
|
[disabled, hasInteracted, isOpen, onBlur]
|
|
3544
3462
|
);
|
|
3545
|
-
const handleInputBlur =
|
|
3463
|
+
const handleInputBlur = React19.useCallback(() => {
|
|
3546
3464
|
if (!isOpen) {
|
|
3547
3465
|
onBlur?.();
|
|
3548
3466
|
}
|
|
3549
3467
|
}, [isOpen, onBlur]);
|
|
3550
|
-
const handleInputClick =
|
|
3468
|
+
const handleInputClick = React19.useCallback(() => {
|
|
3551
3469
|
if (!hasInteracted) {
|
|
3552
3470
|
setHasInteracted(true);
|
|
3553
3471
|
}
|
|
@@ -3555,20 +3473,20 @@ function DatePicker({
|
|
|
3555
3473
|
const hasValue = Boolean(value);
|
|
3556
3474
|
const displayValue = formatDate(value, format);
|
|
3557
3475
|
const combinedClassName = cn("relative", className);
|
|
3558
|
-
return /* @__PURE__ */
|
|
3476
|
+
return /* @__PURE__ */ React19.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React19.createElement(
|
|
3559
3477
|
"input",
|
|
3560
3478
|
{
|
|
3561
3479
|
type: "hidden",
|
|
3562
3480
|
name,
|
|
3563
3481
|
value: value ? value.toISOString() : ""
|
|
3564
3482
|
}
|
|
3565
|
-
), /* @__PURE__ */
|
|
3483
|
+
), /* @__PURE__ */ React19.createElement(Popover, { open: isOpen, onOpenChange: handleOpenChange }, /* @__PURE__ */ React19.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React19.createElement(
|
|
3566
3484
|
"span",
|
|
3567
3485
|
{
|
|
3568
3486
|
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
3569
3487
|
"aria-hidden": "true"
|
|
3570
3488
|
},
|
|
3571
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ React19.createElement(
|
|
3572
3490
|
"svg",
|
|
3573
3491
|
{
|
|
3574
3492
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3581,9 +3499,9 @@ function DatePicker({
|
|
|
3581
3499
|
strokeLinejoin: "round",
|
|
3582
3500
|
strokeWidth: "2"
|
|
3583
3501
|
},
|
|
3584
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ React19.createElement("path", { d: "M8 2v4m8-4v4m5 8V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8M3 10h18m-5 10l2 2l4-4" })
|
|
3585
3503
|
)
|
|
3586
|
-
), /* @__PURE__ */
|
|
3504
|
+
), /* @__PURE__ */ React19.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React19.createElement(
|
|
3587
3505
|
"input",
|
|
3588
3506
|
{
|
|
3589
3507
|
ref: inputRef,
|
|
@@ -3610,7 +3528,7 @@ function DatePicker({
|
|
|
3610
3528
|
"aria-required": required || props["aria-required"],
|
|
3611
3529
|
readOnly: true
|
|
3612
3530
|
}
|
|
3613
|
-
)), clearable && value && !disabled && /* @__PURE__ */
|
|
3531
|
+
)), clearable && value && !disabled && /* @__PURE__ */ React19.createElement(
|
|
3614
3532
|
"button",
|
|
3615
3533
|
{
|
|
3616
3534
|
type: "button",
|
|
@@ -3620,7 +3538,7 @@ function DatePicker({
|
|
|
3620
3538
|
tabIndex: -1
|
|
3621
3539
|
},
|
|
3622
3540
|
"\u2715"
|
|
3623
|
-
)), !disabled && /* @__PURE__ */
|
|
3541
|
+
)), !disabled && /* @__PURE__ */ React19.createElement(
|
|
3624
3542
|
PopoverContent,
|
|
3625
3543
|
{
|
|
3626
3544
|
align: "start",
|
|
@@ -3630,7 +3548,7 @@ function DatePicker({
|
|
|
3630
3548
|
event.preventDefault();
|
|
3631
3549
|
}
|
|
3632
3550
|
},
|
|
3633
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ React19.createElement(
|
|
3634
3552
|
Calendar,
|
|
3635
3553
|
{
|
|
3636
3554
|
mode: "single",
|
|
@@ -3714,11 +3632,11 @@ function TimePicker({
|
|
|
3714
3632
|
showIcon = true,
|
|
3715
3633
|
...props
|
|
3716
3634
|
}) {
|
|
3717
|
-
const inputRef =
|
|
3718
|
-
const [nativeValue, setNativeValue] =
|
|
3635
|
+
const inputRef = React19.useRef(null);
|
|
3636
|
+
const [nativeValue, setNativeValue] = React19.useState(
|
|
3719
3637
|
normalizeToNativeTime(value)
|
|
3720
3638
|
);
|
|
3721
|
-
|
|
3639
|
+
React19.useEffect(() => {
|
|
3722
3640
|
setNativeValue(normalizeToNativeTime(value));
|
|
3723
3641
|
}, [value]);
|
|
3724
3642
|
const handleChange = (e) => {
|
|
@@ -3734,13 +3652,13 @@ function TimePicker({
|
|
|
3734
3652
|
};
|
|
3735
3653
|
const hasValue = Boolean(value);
|
|
3736
3654
|
const stepInSeconds = Math.max(1, minuteStep * 60);
|
|
3737
|
-
return /* @__PURE__ */
|
|
3655
|
+
return /* @__PURE__ */ React19.createElement("div", { className: cn("relative", className) }, /* @__PURE__ */ React19.createElement("input", { type: "hidden", name, value }), /* @__PURE__ */ React19.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React19.createElement(
|
|
3738
3656
|
"span",
|
|
3739
3657
|
{
|
|
3740
3658
|
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
3741
3659
|
"aria-hidden": "true"
|
|
3742
3660
|
},
|
|
3743
|
-
/* @__PURE__ */
|
|
3661
|
+
/* @__PURE__ */ React19.createElement(
|
|
3744
3662
|
"svg",
|
|
3745
3663
|
{
|
|
3746
3664
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3753,10 +3671,10 @@ function TimePicker({
|
|
|
3753
3671
|
strokeLinejoin: "round",
|
|
3754
3672
|
strokeWidth: "2"
|
|
3755
3673
|
},
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
/* @__PURE__ */
|
|
3674
|
+
/* @__PURE__ */ React19.createElement("circle", { cx: "12", cy: "12", r: "10" }),
|
|
3675
|
+
/* @__PURE__ */ React19.createElement("path", { d: "M12 6v6l4 2" })
|
|
3758
3676
|
)
|
|
3759
|
-
), /* @__PURE__ */
|
|
3677
|
+
), /* @__PURE__ */ React19.createElement(
|
|
3760
3678
|
Input,
|
|
3761
3679
|
{
|
|
3762
3680
|
ref: inputRef,
|
|
@@ -3781,7 +3699,7 @@ function TimePicker({
|
|
|
3781
3699
|
"aria-required": required || props["aria-required"],
|
|
3782
3700
|
...props
|
|
3783
3701
|
}
|
|
3784
|
-
), clearable && value && !disabled && /* @__PURE__ */
|
|
3702
|
+
), clearable && value && !disabled && /* @__PURE__ */ React19.createElement(
|
|
3785
3703
|
Button,
|
|
3786
3704
|
{
|
|
3787
3705
|
type: "button",
|
|
@@ -3792,7 +3710,7 @@ function TimePicker({
|
|
|
3792
3710
|
"aria-label": "Clear time",
|
|
3793
3711
|
tabIndex: -1
|
|
3794
3712
|
},
|
|
3795
|
-
/* @__PURE__ */
|
|
3713
|
+
/* @__PURE__ */ React19.createElement(
|
|
3796
3714
|
"svg",
|
|
3797
3715
|
{
|
|
3798
3716
|
width: "14",
|
|
@@ -3805,8 +3723,8 @@ function TimePicker({
|
|
|
3805
3723
|
strokeLinejoin: "round",
|
|
3806
3724
|
"aria-hidden": "true"
|
|
3807
3725
|
},
|
|
3808
|
-
/* @__PURE__ */
|
|
3809
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
3727
|
+
/* @__PURE__ */ React19.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
3810
3728
|
)
|
|
3811
3729
|
)));
|
|
3812
3730
|
}
|
|
@@ -3853,23 +3771,23 @@ function DateRangePicker({
|
|
|
3853
3771
|
separator = " - ",
|
|
3854
3772
|
...props
|
|
3855
3773
|
}) {
|
|
3856
|
-
const [isOpen, setIsOpen] =
|
|
3857
|
-
const [hasInteracted, setHasInteracted] =
|
|
3858
|
-
const [selectedMonth, setSelectedMonth] =
|
|
3774
|
+
const [isOpen, setIsOpen] = React19.useState(false);
|
|
3775
|
+
const [hasInteracted, setHasInteracted] = React19.useState(false);
|
|
3776
|
+
const [selectedMonth, setSelectedMonth] = React19.useState(
|
|
3859
3777
|
value.start || /* @__PURE__ */ new Date()
|
|
3860
3778
|
);
|
|
3861
|
-
const [rangeStart, setRangeStart] =
|
|
3862
|
-
const [rangeEnd, setRangeEnd] =
|
|
3863
|
-
const [hoverDate, setHoverDate] =
|
|
3864
|
-
const inputRef =
|
|
3865
|
-
|
|
3779
|
+
const [rangeStart, setRangeStart] = React19.useState(value.start);
|
|
3780
|
+
const [rangeEnd, setRangeEnd] = React19.useState(value.end);
|
|
3781
|
+
const [hoverDate, setHoverDate] = React19.useState(null);
|
|
3782
|
+
const inputRef = React19.useRef(null);
|
|
3783
|
+
React19.useEffect(() => {
|
|
3866
3784
|
setRangeStart(value.start);
|
|
3867
3785
|
setRangeEnd(value.end);
|
|
3868
3786
|
if (value.start) {
|
|
3869
3787
|
setSelectedMonth(value.start);
|
|
3870
3788
|
}
|
|
3871
3789
|
}, [value]);
|
|
3872
|
-
const disabledMatchers =
|
|
3790
|
+
const disabledMatchers = React19.useMemo(() => {
|
|
3873
3791
|
const matchers = [];
|
|
3874
3792
|
if (minDate) {
|
|
3875
3793
|
matchers.push({ before: minDate });
|
|
@@ -3885,7 +3803,7 @@ function DateRangePicker({
|
|
|
3885
3803
|
}
|
|
3886
3804
|
return matchers;
|
|
3887
3805
|
}, [disabledDates, isDateDisabled, maxDate, minDate]);
|
|
3888
|
-
const handleDateSelect =
|
|
3806
|
+
const handleDateSelect = React19.useCallback(
|
|
3889
3807
|
(date) => {
|
|
3890
3808
|
if (!rangeStart || rangeEnd) {
|
|
3891
3809
|
setRangeStart(date);
|
|
@@ -3915,7 +3833,7 @@ function DateRangePicker({
|
|
|
3915
3833
|
},
|
|
3916
3834
|
[onBlur, onChange, rangeEnd, rangeStart]
|
|
3917
3835
|
);
|
|
3918
|
-
const handleClear =
|
|
3836
|
+
const handleClear = React19.useCallback(
|
|
3919
3837
|
(e) => {
|
|
3920
3838
|
e.stopPropagation();
|
|
3921
3839
|
setRangeStart(null);
|
|
@@ -3927,7 +3845,7 @@ function DateRangePicker({
|
|
|
3927
3845
|
},
|
|
3928
3846
|
[onChange]
|
|
3929
3847
|
);
|
|
3930
|
-
const handleOpenChange =
|
|
3848
|
+
const handleOpenChange = React19.useCallback(
|
|
3931
3849
|
(nextOpen) => {
|
|
3932
3850
|
if (disabled) {
|
|
3933
3851
|
setIsOpen(false);
|
|
@@ -3948,17 +3866,17 @@ function DateRangePicker({
|
|
|
3948
3866
|
},
|
|
3949
3867
|
[disabled, hasInteracted, isOpen, onBlur]
|
|
3950
3868
|
);
|
|
3951
|
-
const handleInputBlur =
|
|
3869
|
+
const handleInputBlur = React19.useCallback(() => {
|
|
3952
3870
|
if (!isOpen) {
|
|
3953
3871
|
onBlur?.();
|
|
3954
3872
|
}
|
|
3955
3873
|
}, [isOpen, onBlur]);
|
|
3956
|
-
const handleInputClick =
|
|
3874
|
+
const handleInputClick = React19.useCallback(() => {
|
|
3957
3875
|
if (!hasInteracted) {
|
|
3958
3876
|
setHasInteracted(true);
|
|
3959
3877
|
}
|
|
3960
3878
|
}, [hasInteracted]);
|
|
3961
|
-
const RangeDayButton =
|
|
3879
|
+
const RangeDayButton = React19.useCallback(
|
|
3962
3880
|
({
|
|
3963
3881
|
day,
|
|
3964
3882
|
modifiers,
|
|
@@ -3977,7 +3895,7 @@ function DateRangePicker({
|
|
|
3977
3895
|
const isInHoverRange = !!rangeStart && !rangeEnd && !!hoverDate && isDateInRange(date, rangeStart, hoverDate);
|
|
3978
3896
|
const isRangeHighlight = (isInCommittedRange || isInHoverRange) && !isRangeEndpoint;
|
|
3979
3897
|
const isToday = isSameDay(date, /* @__PURE__ */ new Date());
|
|
3980
|
-
return /* @__PURE__ */
|
|
3898
|
+
return /* @__PURE__ */ React19.createElement(
|
|
3981
3899
|
"button",
|
|
3982
3900
|
{
|
|
3983
3901
|
type: "button",
|
|
@@ -4021,27 +3939,27 @@ function DateRangePicker({
|
|
|
4021
3939
|
} : void 0;
|
|
4022
3940
|
const displayValue = rangeStart && rangeEnd ? `${formatDate2(rangeStart, format)}${separator}${formatDate2(rangeEnd, format)}` : rangeStart ? formatDate2(rangeStart, format) : "";
|
|
4023
3941
|
const combinedClassName = cn("relative", className);
|
|
4024
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ React19.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React19.createElement(
|
|
4025
3943
|
"input",
|
|
4026
3944
|
{
|
|
4027
3945
|
type: "hidden",
|
|
4028
3946
|
name: `${name}[start]`,
|
|
4029
3947
|
value: rangeStart ? rangeStart.toISOString() : ""
|
|
4030
3948
|
}
|
|
4031
|
-
), /* @__PURE__ */
|
|
3949
|
+
), /* @__PURE__ */ React19.createElement(
|
|
4032
3950
|
"input",
|
|
4033
3951
|
{
|
|
4034
3952
|
type: "hidden",
|
|
4035
3953
|
name: `${name}[end]`,
|
|
4036
3954
|
value: rangeEnd ? rangeEnd.toISOString() : ""
|
|
4037
3955
|
}
|
|
4038
|
-
), /* @__PURE__ */
|
|
3956
|
+
), /* @__PURE__ */ React19.createElement(Popover, { open: isOpen, onOpenChange: handleOpenChange }, /* @__PURE__ */ React19.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React19.createElement(
|
|
4039
3957
|
"span",
|
|
4040
3958
|
{
|
|
4041
3959
|
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
4042
3960
|
"aria-hidden": "true"
|
|
4043
3961
|
},
|
|
4044
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ React19.createElement(
|
|
4045
3963
|
"svg",
|
|
4046
3964
|
{
|
|
4047
3965
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4054,9 +3972,9 @@ function DateRangePicker({
|
|
|
4054
3972
|
strokeLinejoin: "round",
|
|
4055
3973
|
strokeWidth: "2"
|
|
4056
3974
|
},
|
|
4057
|
-
/* @__PURE__ */
|
|
3975
|
+
/* @__PURE__ */ React19.createElement("path", { d: "M8 2v4m8-4v4m5 8V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8M3 10h18m-5 10l2 2l4-4" })
|
|
4058
3976
|
)
|
|
4059
|
-
), /* @__PURE__ */
|
|
3977
|
+
), /* @__PURE__ */ React19.createElement(PopoverTrigger, { asChild: true }, /* @__PURE__ */ React19.createElement(
|
|
4060
3978
|
"input",
|
|
4061
3979
|
{
|
|
4062
3980
|
ref: inputRef,
|
|
@@ -4083,7 +4001,7 @@ function DateRangePicker({
|
|
|
4083
4001
|
"aria-required": required || props["aria-required"],
|
|
4084
4002
|
readOnly: true
|
|
4085
4003
|
}
|
|
4086
|
-
)), clearable && (rangeStart || rangeEnd) && !disabled && /* @__PURE__ */
|
|
4004
|
+
)), clearable && (rangeStart || rangeEnd) && !disabled && /* @__PURE__ */ React19.createElement(
|
|
4087
4005
|
"button",
|
|
4088
4006
|
{
|
|
4089
4007
|
type: "button",
|
|
@@ -4093,7 +4011,7 @@ function DateRangePicker({
|
|
|
4093
4011
|
tabIndex: -1
|
|
4094
4012
|
},
|
|
4095
4013
|
"\u2715"
|
|
4096
|
-
)), !disabled && /* @__PURE__ */
|
|
4014
|
+
)), !disabled && /* @__PURE__ */ React19.createElement(
|
|
4097
4015
|
PopoverContent,
|
|
4098
4016
|
{
|
|
4099
4017
|
align: "start",
|
|
@@ -4103,7 +4021,7 @@ function DateRangePicker({
|
|
|
4103
4021
|
event.preventDefault();
|
|
4104
4022
|
}
|
|
4105
4023
|
},
|
|
4106
|
-
/* @__PURE__ */
|
|
4024
|
+
/* @__PURE__ */ React19.createElement(
|
|
4107
4025
|
Calendar,
|
|
4108
4026
|
{
|
|
4109
4027
|
mode: "range",
|
|
@@ -4126,11 +4044,11 @@ function DateRangePicker({
|
|
|
4126
4044
|
showOutsideDays: true
|
|
4127
4045
|
}
|
|
4128
4046
|
),
|
|
4129
|
-
rangeStart && !rangeEnd && /* @__PURE__ */
|
|
4047
|
+
rangeStart && !rangeEnd && /* @__PURE__ */ React19.createElement("div", { className: "border-t border-input px-3 py-2 text-center text-xs opacity-70" }, "Select end date")
|
|
4130
4048
|
)));
|
|
4131
4049
|
}
|
|
4132
4050
|
DateRangePicker.displayName = "DateRangePicker";
|
|
4133
4051
|
|
|
4134
|
-
export { Checkbox2 as Checkbox, CheckboxGroup, DatePicker, DateRangePicker, FileInput, MultiSelect, Radio, Select2 as Select, Switch2 as Switch, TextArea,
|
|
4135
|
-
//# sourceMappingURL=chunk-
|
|
4136
|
-
//# sourceMappingURL=chunk-
|
|
4052
|
+
export { Checkbox2 as Checkbox, CheckboxGroup, DatePicker, DateRangePicker, FileInput, MultiSelect, Radio, Select2 as Select, Switch2 as Switch, TextArea, TimePicker };
|
|
4053
|
+
//# sourceMappingURL=chunk-4ROWNTY6.js.map
|
|
4054
|
+
//# sourceMappingURL=chunk-4ROWNTY6.js.map
|