@page-speed/forms 0.4.8 → 0.4.9
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/core.cjs +15 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +15 -2
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +86 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +82 -3
- package/dist/index.js.map +1 -1
- package/dist/inputs.cjs +914 -699
- package/dist/inputs.cjs.map +1 -1
- package/dist/inputs.d.cts +93 -182
- package/dist/inputs.d.ts +93 -182
- package/dist/inputs.js +911 -697
- package/dist/inputs.js.map +1 -1
- package/dist/{types-4ppM117e.d.cts → types-DuX3q6A4.d.cts} +1 -1
- package/dist/{types-4ppM117e.d.ts → types-DuX3q6A4.d.ts} +1 -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 +12 -2
package/dist/inputs.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React17 = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
|
+
var radixUi = require('radix-ui');
|
|
6
7
|
var useOnClickOutside = require('@opensite/hooks/useOnClickOutside');
|
|
7
8
|
|
|
8
9
|
function _interopNamespace(e) {
|
|
@@ -23,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
23
24
|
return Object.freeze(n);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
var
|
|
27
|
+
var React17__namespace = /*#__PURE__*/_interopNamespace(React17);
|
|
27
28
|
|
|
28
29
|
// src/inputs/TextInput.tsx
|
|
29
30
|
function cn(...inputs) {
|
|
@@ -31,6 +32,36 @@ function cn(...inputs) {
|
|
|
31
32
|
}
|
|
32
33
|
var INPUT_AUTOFILL_RESET_CLASSES = "autofill:bg-transparent autofill:text-foreground [&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))] [&:-webkit-autofill]:[caret-color:hsl(var(--foreground))] [&:-webkit-autofill]:[box-shadow:0_0_0px_1000px_hsl(var(--background))_inset] [&:-webkit-autofill:hover]:[box-shadow:0_0_0px_1000px_hsl(var(--background))_inset] [&:-webkit-autofill:focus]:[box-shadow:0_0_0px_1000px_hsl(var(--background))_inset] [&:-webkit-autofill]:[transition:background-color_9999s_ease-out,color_9999s_ease-out]";
|
|
33
34
|
|
|
35
|
+
// src/components/ui/input.tsx
|
|
36
|
+
function Input({ className, type, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
38
|
+
"input",
|
|
39
|
+
{
|
|
40
|
+
type,
|
|
41
|
+
"data-slot": "input",
|
|
42
|
+
className: cn(
|
|
43
|
+
// Core structure - no hardcoded colors, uses CSS variables
|
|
44
|
+
"flex h-9 w-full min-w-0 rounded-md border border-input",
|
|
45
|
+
"bg-transparent px-3 py-1 text-base shadow-sm",
|
|
46
|
+
"transition-colors outline-none md:text-sm",
|
|
47
|
+
// Focus state - uses ring-ring CSS variable (adapts to theme)
|
|
48
|
+
"focus-visible:ring-1 focus-visible:ring-ring",
|
|
49
|
+
// Error state - uses destructive CSS variables (adapts to theme)
|
|
50
|
+
"aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive",
|
|
51
|
+
// Disabled state - no color hardcoding
|
|
52
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
53
|
+
// File input specific - inherits text color from parent
|
|
54
|
+
"file:inline-flex file:h-7 file:border-0 file:bg-transparent",
|
|
55
|
+
"file:text-sm file:font-medium",
|
|
56
|
+
// Autofill reset - prevents browser from overriding our dynamic colors
|
|
57
|
+
INPUT_AUTOFILL_RESET_CLASSES,
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
34
65
|
// src/inputs/TextInput.tsx
|
|
35
66
|
function TextInput({
|
|
36
67
|
name,
|
|
@@ -53,17 +84,8 @@ function TextInput({
|
|
|
53
84
|
onBlur?.();
|
|
54
85
|
};
|
|
55
86
|
const hasValue = String(value ?? "").trim().length > 0;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
59
|
-
"disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
60
|
-
INPUT_AUTOFILL_RESET_CLASSES,
|
|
61
|
-
!error && hasValue && "ring-2 ring-ring",
|
|
62
|
-
error && "border-destructive ring-1 ring-destructive",
|
|
63
|
-
className
|
|
64
|
-
);
|
|
65
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
66
|
-
"input",
|
|
87
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
88
|
+
Input,
|
|
67
89
|
{
|
|
68
90
|
type,
|
|
69
91
|
id,
|
|
@@ -74,7 +96,12 @@ function TextInput({
|
|
|
74
96
|
placeholder,
|
|
75
97
|
disabled,
|
|
76
98
|
required,
|
|
77
|
-
className:
|
|
99
|
+
className: cn(
|
|
100
|
+
// Valid value indicator - ring-2 when has value and no error
|
|
101
|
+
!error && hasValue && "ring-2 ring-ring",
|
|
102
|
+
// Error state - handled by Input component via aria-invalid
|
|
103
|
+
className
|
|
104
|
+
),
|
|
78
105
|
"aria-invalid": error || props["aria-invalid"],
|
|
79
106
|
"aria-describedby": props["aria-describedby"],
|
|
80
107
|
"aria-required": required || props["aria-required"],
|
|
@@ -83,6 +110,30 @@ function TextInput({
|
|
|
83
110
|
);
|
|
84
111
|
}
|
|
85
112
|
TextInput.displayName = "TextInput";
|
|
113
|
+
function Textarea({ className, ...props }) {
|
|
114
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
115
|
+
"textarea",
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "textarea",
|
|
118
|
+
className: cn(
|
|
119
|
+
// Core structure - uses CSS variables only
|
|
120
|
+
"flex field-sizing-content min-h-16 w-full rounded-md border border-input",
|
|
121
|
+
"bg-transparent px-3 py-2 text-base shadow-xs",
|
|
122
|
+
"transition-[color,box-shadow] outline-none md:text-sm",
|
|
123
|
+
// Focus state - uses ring-ring CSS variable
|
|
124
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
125
|
+
// Error state - uses destructive CSS variables
|
|
126
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
127
|
+
// Disabled state
|
|
128
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
129
|
+
className
|
|
130
|
+
),
|
|
131
|
+
...props
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/inputs/TextArea.tsx
|
|
86
137
|
function TextArea({
|
|
87
138
|
name,
|
|
88
139
|
value,
|
|
@@ -107,17 +158,8 @@ function TextArea({
|
|
|
107
158
|
onBlur?.();
|
|
108
159
|
};
|
|
109
160
|
const hasValue = String(value ?? "").trim().length > 0;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
113
|
-
"disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
114
|
-
INPUT_AUTOFILL_RESET_CLASSES,
|
|
115
|
-
!error && hasValue && "ring-2 ring-ring",
|
|
116
|
-
error && "border-destructive ring-1 ring-destructive",
|
|
117
|
-
className
|
|
118
|
-
);
|
|
119
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
120
|
-
"textarea",
|
|
161
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
162
|
+
Textarea,
|
|
121
163
|
{
|
|
122
164
|
name,
|
|
123
165
|
value: value ?? "",
|
|
@@ -126,7 +168,12 @@ function TextArea({
|
|
|
126
168
|
placeholder,
|
|
127
169
|
disabled,
|
|
128
170
|
required,
|
|
129
|
-
className:
|
|
171
|
+
className: cn(
|
|
172
|
+
// Valid value indicator - ring-2 when has value and no error
|
|
173
|
+
!error && hasValue && "ring-2 ring-ring",
|
|
174
|
+
// Error state - handled by Textarea component via aria-invalid
|
|
175
|
+
className
|
|
176
|
+
),
|
|
130
177
|
rows,
|
|
131
178
|
cols,
|
|
132
179
|
maxLength,
|
|
@@ -140,6 +187,175 @@ function TextArea({
|
|
|
140
187
|
);
|
|
141
188
|
}
|
|
142
189
|
TextArea.displayName = "TextArea";
|
|
190
|
+
function Checkbox({
|
|
191
|
+
className,
|
|
192
|
+
...props
|
|
193
|
+
}) {
|
|
194
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
195
|
+
radixUi.Checkbox.Root,
|
|
196
|
+
{
|
|
197
|
+
"data-slot": "checkbox",
|
|
198
|
+
className: cn(
|
|
199
|
+
// Core structure - uses CSS variables
|
|
200
|
+
"peer size-4 shrink-0 rounded-[4px] border border-input bg-transparent shadow-xs",
|
|
201
|
+
"transition-shadow outline-none",
|
|
202
|
+
// Checked state - uses primary CSS variables
|
|
203
|
+
"data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
204
|
+
"data-[state=checked]:border-primary",
|
|
205
|
+
// Focus state - uses ring-ring CSS variable
|
|
206
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
207
|
+
// Error state - uses destructive CSS variables
|
|
208
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
209
|
+
// Disabled state
|
|
210
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
211
|
+
className
|
|
212
|
+
),
|
|
213
|
+
...props
|
|
214
|
+
},
|
|
215
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
216
|
+
radixUi.Checkbox.Indicator,
|
|
217
|
+
{
|
|
218
|
+
"data-slot": "checkbox-indicator",
|
|
219
|
+
className: "grid place-content-center text-current transition-none"
|
|
220
|
+
},
|
|
221
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
222
|
+
"svg",
|
|
223
|
+
{
|
|
224
|
+
className: "size-3.5",
|
|
225
|
+
viewBox: "0 0 24 24",
|
|
226
|
+
fill: "none",
|
|
227
|
+
stroke: "currentColor",
|
|
228
|
+
strokeWidth: "3",
|
|
229
|
+
strokeLinecap: "round",
|
|
230
|
+
strokeLinejoin: "round"
|
|
231
|
+
},
|
|
232
|
+
/* @__PURE__ */ React17__namespace.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
233
|
+
)
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
function Label({
|
|
238
|
+
className,
|
|
239
|
+
...props
|
|
240
|
+
}) {
|
|
241
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
242
|
+
radixUi.Label.Root,
|
|
243
|
+
{
|
|
244
|
+
"data-slot": "label",
|
|
245
|
+
className: cn(
|
|
246
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
247
|
+
className
|
|
248
|
+
),
|
|
249
|
+
...props
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/inputs/Checkbox.tsx
|
|
255
|
+
function Checkbox2({
|
|
256
|
+
name,
|
|
257
|
+
value,
|
|
258
|
+
onChange,
|
|
259
|
+
onBlur,
|
|
260
|
+
disabled = false,
|
|
261
|
+
required = false,
|
|
262
|
+
error = false,
|
|
263
|
+
className = "",
|
|
264
|
+
label,
|
|
265
|
+
description,
|
|
266
|
+
useChoiceCard = false,
|
|
267
|
+
...props
|
|
268
|
+
}) {
|
|
269
|
+
const checkboxId = props.id || `checkbox-${name}`;
|
|
270
|
+
const handleCheckedChange = (checked) => {
|
|
271
|
+
onChange(checked);
|
|
272
|
+
};
|
|
273
|
+
const handleBlur = () => {
|
|
274
|
+
onBlur?.();
|
|
275
|
+
};
|
|
276
|
+
const showChoiceCard = useChoiceCard || !!description;
|
|
277
|
+
const checkbox = /* @__PURE__ */ React17__namespace.createElement(React17__namespace.Fragment, null, /* @__PURE__ */ React17__namespace.createElement(
|
|
278
|
+
"input",
|
|
279
|
+
{
|
|
280
|
+
type: "checkbox",
|
|
281
|
+
name,
|
|
282
|
+
checked: value,
|
|
283
|
+
onChange: () => {
|
|
284
|
+
},
|
|
285
|
+
disabled,
|
|
286
|
+
required,
|
|
287
|
+
tabIndex: -1,
|
|
288
|
+
"aria-hidden": "true",
|
|
289
|
+
style: {
|
|
290
|
+
position: "absolute",
|
|
291
|
+
width: "1px",
|
|
292
|
+
height: "1px",
|
|
293
|
+
padding: 0,
|
|
294
|
+
margin: "-1px",
|
|
295
|
+
overflow: "hidden",
|
|
296
|
+
clip: "rect(0, 0, 0, 0)",
|
|
297
|
+
whiteSpace: "nowrap",
|
|
298
|
+
border: 0
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
302
|
+
Checkbox,
|
|
303
|
+
{
|
|
304
|
+
id: checkboxId,
|
|
305
|
+
checked: value,
|
|
306
|
+
onCheckedChange: handleCheckedChange,
|
|
307
|
+
onBlur: handleBlur,
|
|
308
|
+
disabled,
|
|
309
|
+
"aria-invalid": error || props["aria-invalid"],
|
|
310
|
+
"aria-describedby": description ? `${checkboxId}-description` : props["aria-describedby"],
|
|
311
|
+
"aria-required": required || props["aria-required"],
|
|
312
|
+
...props
|
|
313
|
+
}
|
|
314
|
+
));
|
|
315
|
+
if (!label) {
|
|
316
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className }, checkbox);
|
|
317
|
+
}
|
|
318
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
319
|
+
"label",
|
|
320
|
+
{
|
|
321
|
+
htmlFor: checkboxId,
|
|
322
|
+
className: cn(
|
|
323
|
+
"flex gap-3 p-3 duration-200",
|
|
324
|
+
showChoiceCard && "border rounded-lg hover:ring-2 hover:ring-ring/50",
|
|
325
|
+
showChoiceCard && value && "ring-2 ring-ring",
|
|
326
|
+
showChoiceCard && error && "border-destructive",
|
|
327
|
+
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
328
|
+
className
|
|
329
|
+
)
|
|
330
|
+
},
|
|
331
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
332
|
+
"div",
|
|
333
|
+
{
|
|
334
|
+
className: cn(
|
|
335
|
+
"flex w-full gap-3",
|
|
336
|
+
showChoiceCard ? "items-start" : "items-center"
|
|
337
|
+
)
|
|
338
|
+
},
|
|
339
|
+
checkbox,
|
|
340
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
341
|
+
Label,
|
|
342
|
+
{
|
|
343
|
+
htmlFor: checkboxId,
|
|
344
|
+
className: "cursor-pointer font-medium leading-none"
|
|
345
|
+
},
|
|
346
|
+
label
|
|
347
|
+
), description && /* @__PURE__ */ React17__namespace.createElement(
|
|
348
|
+
"p",
|
|
349
|
+
{
|
|
350
|
+
id: `${checkboxId}-description`,
|
|
351
|
+
className: "text-sm opacity-70 leading-snug"
|
|
352
|
+
},
|
|
353
|
+
description
|
|
354
|
+
))
|
|
355
|
+
)
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
Checkbox2.displayName = "Checkbox";
|
|
143
359
|
var LabelGroup = ({
|
|
144
360
|
labelHtmlFor,
|
|
145
361
|
required = false,
|
|
@@ -155,11 +371,11 @@ var LabelGroup = ({
|
|
|
155
371
|
variant === "legend" ? "mb-1.5" : "mb-1 block",
|
|
156
372
|
primaryClassName
|
|
157
373
|
);
|
|
158
|
-
const requiredIndicator = required ? /* @__PURE__ */
|
|
374
|
+
const requiredIndicator = required ? /* @__PURE__ */ React17__namespace.createElement("span", { className: "text-destructive pl-0.5", "aria-label": "required" }, "*") : null;
|
|
159
375
|
let primaryElement = null;
|
|
160
376
|
if (primary) {
|
|
161
377
|
if (variant === "label") {
|
|
162
|
-
primaryElement = /* @__PURE__ */
|
|
378
|
+
primaryElement = /* @__PURE__ */ React17__namespace.createElement(
|
|
163
379
|
"label",
|
|
164
380
|
{
|
|
165
381
|
htmlFor: labelHtmlFor,
|
|
@@ -170,12 +386,12 @@ var LabelGroup = ({
|
|
|
170
386
|
requiredIndicator
|
|
171
387
|
);
|
|
172
388
|
} else if (variant === "legend") {
|
|
173
|
-
primaryElement = /* @__PURE__ */
|
|
389
|
+
primaryElement = /* @__PURE__ */ React17__namespace.createElement("legend", { "data-slot": "field-legend", className: primaryClasses }, primary, requiredIndicator);
|
|
174
390
|
} else {
|
|
175
|
-
primaryElement = /* @__PURE__ */
|
|
391
|
+
primaryElement = /* @__PURE__ */ React17__namespace.createElement("div", { "data-slot": "field-label", className: primaryClasses }, primary, requiredIndicator);
|
|
176
392
|
}
|
|
177
393
|
}
|
|
178
|
-
const secondaryElement = secondary ? /* @__PURE__ */
|
|
394
|
+
const secondaryElement = secondary ? /* @__PURE__ */ React17__namespace.createElement(
|
|
179
395
|
"p",
|
|
180
396
|
{
|
|
181
397
|
"data-slot": "field-description",
|
|
@@ -186,148 +402,12 @@ var LabelGroup = ({
|
|
|
186
402
|
) : null;
|
|
187
403
|
if (!primaryElement && !secondaryElement) return null;
|
|
188
404
|
if (variant === "legend") {
|
|
189
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ React17__namespace.createElement(React17__namespace.Fragment, null, primaryElement, secondaryElement);
|
|
190
406
|
}
|
|
191
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, primaryElement, secondaryElement);
|
|
192
408
|
};
|
|
193
409
|
|
|
194
|
-
// src/inputs/
|
|
195
|
-
function Checkbox({
|
|
196
|
-
name,
|
|
197
|
-
value,
|
|
198
|
-
onChange,
|
|
199
|
-
onBlur,
|
|
200
|
-
disabled = false,
|
|
201
|
-
required = false,
|
|
202
|
-
error = false,
|
|
203
|
-
className = "",
|
|
204
|
-
indeterminate = false,
|
|
205
|
-
label,
|
|
206
|
-
description,
|
|
207
|
-
useChoiceCard = false,
|
|
208
|
-
...props
|
|
209
|
-
}) {
|
|
210
|
-
const inputRef = React9__namespace.useRef(null);
|
|
211
|
-
const checkboxId = props.id || `checkbox-${name}`;
|
|
212
|
-
React9__namespace.useEffect(() => {
|
|
213
|
-
if (inputRef.current) {
|
|
214
|
-
inputRef.current.indeterminate = indeterminate;
|
|
215
|
-
}
|
|
216
|
-
}, [indeterminate]);
|
|
217
|
-
const handleChange = (e) => {
|
|
218
|
-
onChange(e.target.checked);
|
|
219
|
-
};
|
|
220
|
-
const handleBlur = () => {
|
|
221
|
-
onBlur?.();
|
|
222
|
-
};
|
|
223
|
-
const isActive = value || indeterminate && !value;
|
|
224
|
-
const checkbox = /* @__PURE__ */ React9__namespace.createElement(
|
|
225
|
-
"div",
|
|
226
|
-
{
|
|
227
|
-
className: cn(
|
|
228
|
-
"relative inline-flex items-center justify-center",
|
|
229
|
-
!label && className
|
|
230
|
-
)
|
|
231
|
-
},
|
|
232
|
-
/* @__PURE__ */ React9__namespace.createElement(
|
|
233
|
-
"input",
|
|
234
|
-
{
|
|
235
|
-
ref: inputRef,
|
|
236
|
-
type: "checkbox",
|
|
237
|
-
id: checkboxId,
|
|
238
|
-
name,
|
|
239
|
-
checked: value,
|
|
240
|
-
onChange: handleChange,
|
|
241
|
-
onBlur: handleBlur,
|
|
242
|
-
disabled,
|
|
243
|
-
required,
|
|
244
|
-
className: "peer sr-only",
|
|
245
|
-
"aria-invalid": error || props["aria-invalid"],
|
|
246
|
-
"aria-describedby": description ? `${checkboxId}-description` : props["aria-describedby"],
|
|
247
|
-
"aria-required": required || props["aria-required"],
|
|
248
|
-
...props
|
|
249
|
-
}
|
|
250
|
-
),
|
|
251
|
-
/* @__PURE__ */ React9__namespace.createElement(
|
|
252
|
-
"div",
|
|
253
|
-
{
|
|
254
|
-
className: cn(
|
|
255
|
-
"flex shrink-0 items-center justify-center rounded-full border-2 transition-colors size-6",
|
|
256
|
-
!error && isActive && "border-primary bg-primary text-primary-foreground",
|
|
257
|
-
!error && !isActive && "border-input bg-transparent",
|
|
258
|
-
error && isActive && "border-destructive bg-destructive text-destructive-foreground",
|
|
259
|
-
error && !isActive && "border-destructive bg-transparent",
|
|
260
|
-
disabled && "opacity-50",
|
|
261
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-ring/50 peer-focus-visible:ring-offset-1"
|
|
262
|
-
)
|
|
263
|
-
},
|
|
264
|
-
value && /* @__PURE__ */ React9__namespace.createElement(
|
|
265
|
-
"svg",
|
|
266
|
-
{
|
|
267
|
-
className: "size-3.5",
|
|
268
|
-
viewBox: "0 0 24 24",
|
|
269
|
-
fill: "none",
|
|
270
|
-
stroke: "currentColor",
|
|
271
|
-
strokeWidth: "3",
|
|
272
|
-
strokeLinecap: "round",
|
|
273
|
-
strokeLinejoin: "round"
|
|
274
|
-
},
|
|
275
|
-
/* @__PURE__ */ React9__namespace.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
276
|
-
),
|
|
277
|
-
indeterminate && !value && /* @__PURE__ */ React9__namespace.createElement(
|
|
278
|
-
"svg",
|
|
279
|
-
{
|
|
280
|
-
className: "size-3.5",
|
|
281
|
-
viewBox: "0 0 24 24",
|
|
282
|
-
fill: "none",
|
|
283
|
-
stroke: "currentColor",
|
|
284
|
-
strokeWidth: "3",
|
|
285
|
-
strokeLinecap: "round",
|
|
286
|
-
strokeLinejoin: "round"
|
|
287
|
-
},
|
|
288
|
-
/* @__PURE__ */ React9__namespace.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
289
|
-
)
|
|
290
|
-
)
|
|
291
|
-
);
|
|
292
|
-
if (label) {
|
|
293
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
294
|
-
"label",
|
|
295
|
-
{
|
|
296
|
-
className: cn(
|
|
297
|
-
"w-full h-full flex gap-3 p-3 duration-200",
|
|
298
|
-
useChoiceCard && "border rounded-lg hover:ring-2",
|
|
299
|
-
useChoiceCard && value && "ring-2",
|
|
300
|
-
disabled ? "opacity-50 cursor-not-allowed hover:ring-0" : "cursor-pointer",
|
|
301
|
-
className
|
|
302
|
-
),
|
|
303
|
-
htmlFor: checkboxId
|
|
304
|
-
},
|
|
305
|
-
/* @__PURE__ */ React9__namespace.createElement(
|
|
306
|
-
"div",
|
|
307
|
-
{
|
|
308
|
-
className: cn(
|
|
309
|
-
"flex w-full flex-row gap-2",
|
|
310
|
-
useChoiceCard ? "items-start" : "items-center"
|
|
311
|
-
)
|
|
312
|
-
},
|
|
313
|
-
checkbox,
|
|
314
|
-
/* @__PURE__ */ React9__namespace.createElement(
|
|
315
|
-
LabelGroup,
|
|
316
|
-
{
|
|
317
|
-
variant: "text",
|
|
318
|
-
primary: label,
|
|
319
|
-
secondary: description,
|
|
320
|
-
secondaryId: description ? `${checkboxId}-description` : void 0,
|
|
321
|
-
primaryClassName: "mb-0",
|
|
322
|
-
secondaryClassName: "text-xs opacity-75"
|
|
323
|
-
}
|
|
324
|
-
)
|
|
325
|
-
)
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
return checkbox;
|
|
329
|
-
}
|
|
330
|
-
Checkbox.displayName = "Checkbox";
|
|
410
|
+
// src/inputs/CheckboxGroup.tsx
|
|
331
411
|
function CheckboxGroup({
|
|
332
412
|
name,
|
|
333
413
|
value = [],
|
|
@@ -356,11 +436,11 @@ function CheckboxGroup({
|
|
|
356
436
|
).length;
|
|
357
437
|
const allSelected = selectedEnabledCount === enabledOptions.length;
|
|
358
438
|
const someSelected = selectedEnabledCount > 0 && !allSelected;
|
|
359
|
-
const useChoiceCard =
|
|
439
|
+
const useChoiceCard = React17__namespace.useMemo(() => {
|
|
360
440
|
if (!options) return false;
|
|
361
441
|
return options?.some((opt) => opt.description);
|
|
362
442
|
}, [options]);
|
|
363
|
-
const countableValue =
|
|
443
|
+
const countableValue = React17__namespace.useMemo(() => {
|
|
364
444
|
if (value?.length > 0) {
|
|
365
445
|
return value.length;
|
|
366
446
|
}
|
|
@@ -385,7 +465,7 @@ function CheckboxGroup({
|
|
|
385
465
|
onBlur?.();
|
|
386
466
|
};
|
|
387
467
|
const maxReached = Boolean(maxSelections && countableValue >= maxSelections);
|
|
388
|
-
const containerClass =
|
|
468
|
+
const containerClass = React17__namespace.useMemo(() => {
|
|
389
469
|
return cn(
|
|
390
470
|
"w-full gap-3 grid grid-cols-1 border-0 m-0 p-0 min-w-0",
|
|
391
471
|
(layout === "grid" || layout === "inline") && "md:grid-cols-2",
|
|
@@ -394,7 +474,7 @@ function CheckboxGroup({
|
|
|
394
474
|
}, [layout, className]);
|
|
395
475
|
const groupDescriptionId = description ? `${name}-description` : void 0;
|
|
396
476
|
const groupAriaDescribedBy = [props["aria-describedby"], groupDescriptionId].filter(Boolean).join(" ") || void 0;
|
|
397
|
-
return /* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
398
478
|
"fieldset",
|
|
399
479
|
{
|
|
400
480
|
className: containerClass,
|
|
@@ -404,7 +484,7 @@ function CheckboxGroup({
|
|
|
404
484
|
"aria-required": required || props["aria-required"],
|
|
405
485
|
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
406
486
|
},
|
|
407
|
-
/* @__PURE__ */
|
|
487
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
408
488
|
LabelGroup,
|
|
409
489
|
{
|
|
410
490
|
labelHtmlFor: name,
|
|
@@ -415,8 +495,8 @@ function CheckboxGroup({
|
|
|
415
495
|
primary: label
|
|
416
496
|
}
|
|
417
497
|
),
|
|
418
|
-
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */
|
|
419
|
-
|
|
498
|
+
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */ React17__namespace.createElement(
|
|
499
|
+
Checkbox2,
|
|
420
500
|
{
|
|
421
501
|
name: `${name}-select-all`,
|
|
422
502
|
id: `${name}-select-all`,
|
|
@@ -433,8 +513,8 @@ function CheckboxGroup({
|
|
|
433
513
|
options.map((option) => {
|
|
434
514
|
const isChecked = value.includes(option.value);
|
|
435
515
|
const isDisabled = disabled || option.disabled || maxReached && !isChecked;
|
|
436
|
-
return /* @__PURE__ */
|
|
437
|
-
|
|
516
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
517
|
+
Checkbox2,
|
|
438
518
|
{
|
|
439
519
|
key: option.value,
|
|
440
520
|
name,
|
|
@@ -451,7 +531,7 @@ function CheckboxGroup({
|
|
|
451
531
|
}
|
|
452
532
|
);
|
|
453
533
|
}),
|
|
454
|
-
(minSelections || maxSelections) && /* @__PURE__ */
|
|
534
|
+
(minSelections || maxSelections) && /* @__PURE__ */ React17__namespace.createElement(
|
|
455
535
|
"div",
|
|
456
536
|
{
|
|
457
537
|
className: cn(
|
|
@@ -460,12 +540,66 @@ function CheckboxGroup({
|
|
|
460
540
|
),
|
|
461
541
|
"aria-live": "polite"
|
|
462
542
|
},
|
|
463
|
-
minSelections && countableValue < minSelections && /* @__PURE__ */
|
|
464
|
-
maxSelections && /* @__PURE__ */
|
|
543
|
+
minSelections && countableValue < minSelections && /* @__PURE__ */ React17__namespace.createElement("span", null, "Select at least ", minSelections, " option", minSelections !== 1 ? "s" : ""),
|
|
544
|
+
maxSelections && /* @__PURE__ */ React17__namespace.createElement("span", null, countableValue, "/", maxSelections, " selected")
|
|
465
545
|
)
|
|
466
546
|
);
|
|
467
547
|
}
|
|
468
548
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
549
|
+
function RadioGroup({
|
|
550
|
+
className,
|
|
551
|
+
...props
|
|
552
|
+
}) {
|
|
553
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
554
|
+
radixUi.RadioGroup.Root,
|
|
555
|
+
{
|
|
556
|
+
"data-slot": "radio-group",
|
|
557
|
+
className: cn("grid gap-3", className),
|
|
558
|
+
...props
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
function RadioGroupItem({
|
|
563
|
+
className,
|
|
564
|
+
...props
|
|
565
|
+
}) {
|
|
566
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
567
|
+
radixUi.RadioGroup.Item,
|
|
568
|
+
{
|
|
569
|
+
"data-slot": "radio-group-item",
|
|
570
|
+
className: cn(
|
|
571
|
+
// Core structure - uses CSS variables
|
|
572
|
+
"aspect-square size-4 shrink-0 rounded-full border border-input bg-transparent shadow-xs",
|
|
573
|
+
"text-primary transition-[color,box-shadow] outline-none",
|
|
574
|
+
// Focus state - uses ring-ring CSS variable
|
|
575
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
576
|
+
// Error state - uses destructive CSS variables
|
|
577
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
578
|
+
// Disabled state
|
|
579
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
580
|
+
className
|
|
581
|
+
),
|
|
582
|
+
...props
|
|
583
|
+
},
|
|
584
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
585
|
+
radixUi.RadioGroup.Indicator,
|
|
586
|
+
{
|
|
587
|
+
"data-slot": "radio-group-indicator",
|
|
588
|
+
className: "relative flex items-center justify-center"
|
|
589
|
+
},
|
|
590
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
591
|
+
"svg",
|
|
592
|
+
{
|
|
593
|
+
className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2",
|
|
594
|
+
viewBox: "0 0 24 24"
|
|
595
|
+
},
|
|
596
|
+
/* @__PURE__ */ React17__namespace.createElement("circle", { cx: "12", cy: "12", r: "12" })
|
|
597
|
+
)
|
|
598
|
+
)
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// src/inputs/Radio.tsx
|
|
469
603
|
function Radio({
|
|
470
604
|
name,
|
|
471
605
|
value,
|
|
@@ -481,146 +615,433 @@ function Radio({
|
|
|
481
615
|
options,
|
|
482
616
|
...props
|
|
483
617
|
}) {
|
|
484
|
-
const
|
|
485
|
-
onChange(
|
|
486
|
-
};
|
|
487
|
-
const handleKeyDown = (e, currentIndex) => {
|
|
488
|
-
if (e.key === "ArrowDown" || e.key === "ArrowRight") {
|
|
489
|
-
e.preventDefault();
|
|
490
|
-
let nextIndex = (currentIndex + 1) % options.length;
|
|
491
|
-
let attempts = 0;
|
|
492
|
-
while (options[nextIndex].disabled && attempts < options.length && !disabled) {
|
|
493
|
-
nextIndex = (nextIndex + 1) % options.length;
|
|
494
|
-
attempts++;
|
|
495
|
-
}
|
|
496
|
-
if (!options[nextIndex].disabled) {
|
|
497
|
-
handleChange(options[nextIndex].value);
|
|
498
|
-
}
|
|
499
|
-
} else if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
|
|
500
|
-
e.preventDefault();
|
|
501
|
-
let prevIndex = (currentIndex - 1 + options.length) % options.length;
|
|
502
|
-
let attempts = 0;
|
|
503
|
-
while (options[prevIndex].disabled && attempts < options.length && !disabled) {
|
|
504
|
-
prevIndex = (prevIndex - 1 + options.length) % options.length;
|
|
505
|
-
attempts++;
|
|
506
|
-
}
|
|
507
|
-
if (!options[prevIndex].disabled) {
|
|
508
|
-
handleChange(options[prevIndex].value);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
618
|
+
const handleValueChange = (selectedValue) => {
|
|
619
|
+
onChange(selectedValue);
|
|
511
620
|
};
|
|
512
621
|
const handleBlur = () => {
|
|
513
622
|
onBlur?.();
|
|
514
623
|
};
|
|
515
|
-
const useChoiceCard =
|
|
624
|
+
const useChoiceCard = React17__namespace.useMemo(() => {
|
|
516
625
|
return options.some((option) => option.description);
|
|
517
626
|
}, [options]);
|
|
518
|
-
const containerClass = React9__namespace.useMemo(() => {
|
|
519
|
-
return cn(
|
|
520
|
-
"w-full gap-3 grid grid-cols-1 border-0 m-0 p-0 min-w-0",
|
|
521
|
-
(layout === "grid" || layout === "inline") && "md:grid-cols-2",
|
|
522
|
-
className
|
|
523
|
-
);
|
|
524
|
-
}, [layout, className]);
|
|
525
627
|
const groupDescriptionId = description ? `${name}-description` : void 0;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
"fieldset",
|
|
628
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: cn("w-full", className) }, (label || description) && /* @__PURE__ */ React17__namespace.createElement("div", { className: "mb-3" }, label && /* @__PURE__ */ React17__namespace.createElement(Label, { className: "text-base font-medium block mb-1" }, label), description && /* @__PURE__ */ React17__namespace.createElement(
|
|
629
|
+
"p",
|
|
529
630
|
{
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
"aria-invalid": error || props["aria-invalid"],
|
|
533
|
-
"aria-describedby": groupAriaDescribedBy,
|
|
534
|
-
"aria-required": required || props["aria-required"],
|
|
535
|
-
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
631
|
+
id: groupDescriptionId,
|
|
632
|
+
className: "text-sm opacity-70"
|
|
536
633
|
},
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
634
|
+
description
|
|
635
|
+
)), /* @__PURE__ */ React17__namespace.createElement(
|
|
636
|
+
RadioGroup,
|
|
637
|
+
{
|
|
638
|
+
name,
|
|
639
|
+
value,
|
|
640
|
+
onValueChange: handleValueChange,
|
|
641
|
+
onBlur: handleBlur,
|
|
642
|
+
disabled,
|
|
643
|
+
required,
|
|
644
|
+
className: cn(
|
|
645
|
+
"gap-3",
|
|
646
|
+
layout === "grid" && "grid grid-cols-1 md:grid-cols-2",
|
|
647
|
+
layout === "inline" && "flex flex-wrap"
|
|
648
|
+
),
|
|
649
|
+
"aria-invalid": error || props["aria-invalid"],
|
|
650
|
+
"aria-describedby": groupDescriptionId || props["aria-describedby"],
|
|
651
|
+
"aria-required": required || props["aria-required"]
|
|
652
|
+
},
|
|
653
|
+
options.map((option) => {
|
|
654
|
+
const isSelected = value === option.value;
|
|
548
655
|
const isDisabled = disabled || option.disabled;
|
|
549
656
|
const radioId = `${name}-${option.value}`;
|
|
550
|
-
const hasDescription = option.description
|
|
551
|
-
|
|
552
|
-
"input",
|
|
553
|
-
{
|
|
554
|
-
type: "radio",
|
|
555
|
-
id: radioId,
|
|
556
|
-
name,
|
|
557
|
-
value: option.value,
|
|
558
|
-
checked: isChecked,
|
|
559
|
-
onChange: (e) => handleChange(e.target.value),
|
|
560
|
-
onBlur: handleBlur,
|
|
561
|
-
disabled: isDisabled,
|
|
562
|
-
required,
|
|
563
|
-
className: "peer sr-only",
|
|
564
|
-
"aria-describedby": hasDescription ? `${radioId}-description` : props["aria-describedby"]
|
|
565
|
-
}
|
|
566
|
-
), /* @__PURE__ */ React9__namespace.createElement(
|
|
567
|
-
"div",
|
|
568
|
-
{
|
|
569
|
-
className: cn(
|
|
570
|
-
"flex shrink-0 items-center justify-center rounded-full border-2 transition-colors size-6",
|
|
571
|
-
!error && isChecked && "border-primary bg-transparent",
|
|
572
|
-
!error && !isChecked && "border-input bg-transparent",
|
|
573
|
-
error && isChecked && "border-destructive bg-transparent",
|
|
574
|
-
error && !isChecked && "border-destructive bg-transparent",
|
|
575
|
-
isDisabled && "opacity-50",
|
|
576
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-ring/50 peer-focus-visible:ring-offset-1"
|
|
577
|
-
)
|
|
578
|
-
},
|
|
579
|
-
isChecked && /* @__PURE__ */ React9__namespace.createElement("div", { className: "size-3 rounded-full bg-primary" })
|
|
580
|
-
));
|
|
581
|
-
const labelContent = /* @__PURE__ */ React9__namespace.createElement(
|
|
582
|
-
LabelGroup,
|
|
583
|
-
{
|
|
584
|
-
variant: "text",
|
|
585
|
-
primary: option.label,
|
|
586
|
-
secondary: hasDescription ? option.description : void 0,
|
|
587
|
-
secondaryId: hasDescription ? `${radioId}-description` : void 0,
|
|
588
|
-
primaryClassName: "mb-0",
|
|
589
|
-
secondaryClassName: "text-xs opacity-75"
|
|
590
|
-
}
|
|
591
|
-
);
|
|
592
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
657
|
+
const hasDescription = !!option.description;
|
|
658
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
593
659
|
"label",
|
|
594
660
|
{
|
|
595
661
|
key: option.value,
|
|
596
|
-
className: cn(
|
|
597
|
-
"w-full h-full flex gap-3 p-3 duration-200",
|
|
598
|
-
useChoiceCard && "border rounded-lg hover:ring-2",
|
|
599
|
-
useChoiceCard && isChecked && "ring-2",
|
|
600
|
-
isDisabled ? "opacity-50 cursor-not-allowed hover:ring-0" : "cursor-pointer"
|
|
601
|
-
),
|
|
602
662
|
htmlFor: radioId,
|
|
603
|
-
|
|
604
|
-
|
|
663
|
+
className: cn(
|
|
664
|
+
"flex gap-3 p-3 duration-200",
|
|
665
|
+
useChoiceCard && "border rounded-lg hover:ring-2 hover:ring-ring/50",
|
|
666
|
+
useChoiceCard && isSelected && "ring-2 ring-ring",
|
|
667
|
+
useChoiceCard && error && "border-destructive",
|
|
668
|
+
isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
669
|
+
)
|
|
605
670
|
},
|
|
606
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
607
672
|
"div",
|
|
608
673
|
{
|
|
609
674
|
className: cn(
|
|
610
|
-
"flex w-full
|
|
675
|
+
"flex w-full gap-3",
|
|
611
676
|
useChoiceCard ? "items-start" : "items-center"
|
|
612
677
|
)
|
|
613
678
|
},
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
679
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
680
|
+
RadioGroupItem,
|
|
681
|
+
{
|
|
682
|
+
value: option.value,
|
|
683
|
+
id: radioId,
|
|
684
|
+
disabled: isDisabled,
|
|
685
|
+
className: "mt-0.5",
|
|
686
|
+
"aria-describedby": hasDescription ? `${radioId}-description` : void 0
|
|
687
|
+
}
|
|
688
|
+
),
|
|
689
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-col gap-1 flex-1" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
690
|
+
Label,
|
|
691
|
+
{
|
|
692
|
+
htmlFor: radioId,
|
|
693
|
+
className: "cursor-pointer font-medium leading-none"
|
|
694
|
+
},
|
|
695
|
+
option.label
|
|
696
|
+
), option.description && /* @__PURE__ */ React17__namespace.createElement(
|
|
697
|
+
"p",
|
|
698
|
+
{
|
|
699
|
+
id: `${radioId}-description`,
|
|
700
|
+
className: "text-sm opacity-70 leading-snug"
|
|
701
|
+
},
|
|
702
|
+
option.description
|
|
703
|
+
))
|
|
617
704
|
)
|
|
618
705
|
);
|
|
619
706
|
})
|
|
620
|
-
);
|
|
707
|
+
));
|
|
621
708
|
}
|
|
622
709
|
Radio.displayName = "Radio";
|
|
710
|
+
function Switch({
|
|
711
|
+
className,
|
|
712
|
+
size = "default",
|
|
713
|
+
...props
|
|
714
|
+
}) {
|
|
715
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
716
|
+
radixUi.Switch.Root,
|
|
717
|
+
{
|
|
718
|
+
"data-slot": "switch",
|
|
719
|
+
"data-size": size,
|
|
720
|
+
className: cn(
|
|
721
|
+
// Core structure - uses CSS variables
|
|
722
|
+
"peer group/switch inline-flex shrink-0 items-center rounded-full",
|
|
723
|
+
"border border-transparent shadow-xs transition-all outline-none",
|
|
724
|
+
// State-based backgrounds - use CSS variables
|
|
725
|
+
"data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
726
|
+
// Focus state
|
|
727
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
728
|
+
// Disabled state
|
|
729
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
730
|
+
// Size variants
|
|
731
|
+
"data-[size=default]:h-[1.15rem] data-[size=default]:w-8",
|
|
732
|
+
"data-[size=sm]:h-3.5 data-[size=sm]:w-6",
|
|
733
|
+
className
|
|
734
|
+
),
|
|
735
|
+
...props
|
|
736
|
+
},
|
|
737
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
738
|
+
radixUi.Switch.Thumb,
|
|
739
|
+
{
|
|
740
|
+
"data-slot": "switch-thumb",
|
|
741
|
+
className: cn(
|
|
742
|
+
// Thumb appearance - inherits from parent theme
|
|
743
|
+
"bg-background pointer-events-none block rounded-full ring-0 transition-transform",
|
|
744
|
+
// Size variants
|
|
745
|
+
"group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3",
|
|
746
|
+
// Position based on state
|
|
747
|
+
"data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
748
|
+
)
|
|
749
|
+
}
|
|
750
|
+
)
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// src/inputs/Switch.tsx
|
|
755
|
+
function Switch2({
|
|
756
|
+
name,
|
|
757
|
+
value,
|
|
758
|
+
onChange,
|
|
759
|
+
onBlur,
|
|
760
|
+
disabled = false,
|
|
761
|
+
required = false,
|
|
762
|
+
error = false,
|
|
763
|
+
className = "",
|
|
764
|
+
label,
|
|
765
|
+
description,
|
|
766
|
+
size = "default",
|
|
767
|
+
...props
|
|
768
|
+
}) {
|
|
769
|
+
const switchId = props.id || `switch-${name}`;
|
|
770
|
+
const handleCheckedChange = (checked) => {
|
|
771
|
+
onChange(checked);
|
|
772
|
+
};
|
|
773
|
+
const handleBlur = () => {
|
|
774
|
+
onBlur?.();
|
|
775
|
+
};
|
|
776
|
+
const switchElement = /* @__PURE__ */ React17__namespace.createElement(
|
|
777
|
+
Switch,
|
|
778
|
+
{
|
|
779
|
+
id: switchId,
|
|
780
|
+
checked: value,
|
|
781
|
+
onCheckedChange: handleCheckedChange,
|
|
782
|
+
onBlur: handleBlur,
|
|
783
|
+
disabled,
|
|
784
|
+
size,
|
|
785
|
+
"aria-invalid": error || props["aria-invalid"],
|
|
786
|
+
"aria-describedby": description ? `${switchId}-description` : props["aria-describedby"],
|
|
787
|
+
"aria-required": required || props["aria-required"],
|
|
788
|
+
...props
|
|
789
|
+
}
|
|
790
|
+
);
|
|
791
|
+
if (!label) {
|
|
792
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className }, switchElement);
|
|
793
|
+
}
|
|
794
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
795
|
+
"label",
|
|
796
|
+
{
|
|
797
|
+
htmlFor: switchId,
|
|
798
|
+
className: cn(
|
|
799
|
+
"flex items-center gap-3 cursor-pointer",
|
|
800
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
801
|
+
className
|
|
802
|
+
)
|
|
803
|
+
},
|
|
804
|
+
switchElement,
|
|
805
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
806
|
+
Label,
|
|
807
|
+
{
|
|
808
|
+
htmlFor: switchId,
|
|
809
|
+
className: "cursor-pointer font-medium leading-none"
|
|
810
|
+
},
|
|
811
|
+
label
|
|
812
|
+
), description && /* @__PURE__ */ React17__namespace.createElement(
|
|
813
|
+
"p",
|
|
814
|
+
{
|
|
815
|
+
id: `${switchId}-description`,
|
|
816
|
+
className: "text-sm opacity-70 leading-snug"
|
|
817
|
+
},
|
|
818
|
+
description
|
|
819
|
+
))
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
Switch2.displayName = "Switch";
|
|
623
823
|
function Select({
|
|
824
|
+
...props
|
|
825
|
+
}) {
|
|
826
|
+
return /* @__PURE__ */ React17__namespace.createElement(radixUi.Select.Root, { "data-slot": "select", ...props });
|
|
827
|
+
}
|
|
828
|
+
function SelectGroup({
|
|
829
|
+
...props
|
|
830
|
+
}) {
|
|
831
|
+
return /* @__PURE__ */ React17__namespace.createElement(radixUi.Select.Group, { "data-slot": "select-group", ...props });
|
|
832
|
+
}
|
|
833
|
+
function SelectValue({
|
|
834
|
+
...props
|
|
835
|
+
}) {
|
|
836
|
+
return /* @__PURE__ */ React17__namespace.createElement(radixUi.Select.Value, { "data-slot": "select-value", ...props });
|
|
837
|
+
}
|
|
838
|
+
function SelectTrigger({
|
|
839
|
+
className,
|
|
840
|
+
size = "default",
|
|
841
|
+
children,
|
|
842
|
+
...props
|
|
843
|
+
}) {
|
|
844
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
845
|
+
radixUi.Select.Trigger,
|
|
846
|
+
{
|
|
847
|
+
"data-slot": "select-trigger",
|
|
848
|
+
"data-size": size,
|
|
849
|
+
className: cn(
|
|
850
|
+
// Core structure - uses CSS variables
|
|
851
|
+
"flex w-fit items-center justify-between gap-2 rounded-md border border-input",
|
|
852
|
+
"bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs",
|
|
853
|
+
"transition-[color,box-shadow] outline-none",
|
|
854
|
+
// Focus state
|
|
855
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
856
|
+
// Error state
|
|
857
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
858
|
+
// Disabled state
|
|
859
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
860
|
+
// Size variants
|
|
861
|
+
"data-[size=default]:h-9 data-[size=sm]:h-8",
|
|
862
|
+
// Value styling
|
|
863
|
+
"*:data-[slot=select-value]:line-clamp-1",
|
|
864
|
+
"*:data-[slot=select-value]:flex",
|
|
865
|
+
"*:data-[slot=select-value]:items-center",
|
|
866
|
+
"*:data-[slot=select-value]:gap-2",
|
|
867
|
+
// SVG styling
|
|
868
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
869
|
+
className
|
|
870
|
+
),
|
|
871
|
+
...props
|
|
872
|
+
},
|
|
873
|
+
children,
|
|
874
|
+
/* @__PURE__ */ React17__namespace.createElement(radixUi.Select.Icon, { asChild: true }, /* @__PURE__ */ React17__namespace.createElement(
|
|
875
|
+
"svg",
|
|
876
|
+
{
|
|
877
|
+
className: "size-4 opacity-50",
|
|
878
|
+
viewBox: "0 0 24 24",
|
|
879
|
+
fill: "none",
|
|
880
|
+
stroke: "currentColor",
|
|
881
|
+
strokeWidth: "2",
|
|
882
|
+
strokeLinecap: "round",
|
|
883
|
+
strokeLinejoin: "round"
|
|
884
|
+
},
|
|
885
|
+
/* @__PURE__ */ React17__namespace.createElement("polyline", { points: "6 9 12 15 18 9" })
|
|
886
|
+
))
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
function SelectContent({
|
|
890
|
+
className,
|
|
891
|
+
children,
|
|
892
|
+
position = "item-aligned",
|
|
893
|
+
align = "center",
|
|
894
|
+
...props
|
|
895
|
+
}) {
|
|
896
|
+
return /* @__PURE__ */ React17__namespace.createElement(radixUi.Select.Portal, null, /* @__PURE__ */ React17__namespace.createElement(
|
|
897
|
+
radixUi.Select.Content,
|
|
898
|
+
{
|
|
899
|
+
"data-slot": "select-content",
|
|
900
|
+
className: cn(
|
|
901
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
902
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
903
|
+
className
|
|
904
|
+
),
|
|
905
|
+
position,
|
|
906
|
+
align,
|
|
907
|
+
...props
|
|
908
|
+
},
|
|
909
|
+
/* @__PURE__ */ React17__namespace.createElement(SelectScrollUpButton, null),
|
|
910
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
911
|
+
radixUi.Select.Viewport,
|
|
912
|
+
{
|
|
913
|
+
className: cn(
|
|
914
|
+
"p-1",
|
|
915
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
916
|
+
)
|
|
917
|
+
},
|
|
918
|
+
children
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ React17__namespace.createElement(SelectScrollDownButton, null)
|
|
921
|
+
));
|
|
922
|
+
}
|
|
923
|
+
function SelectLabel({
|
|
924
|
+
className,
|
|
925
|
+
...props
|
|
926
|
+
}) {
|
|
927
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
928
|
+
radixUi.Select.Label,
|
|
929
|
+
{
|
|
930
|
+
"data-slot": "select-label",
|
|
931
|
+
className: cn("px-2 py-1.5 text-xs opacity-70", className),
|
|
932
|
+
...props
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
function SelectItem({
|
|
937
|
+
className,
|
|
938
|
+
children,
|
|
939
|
+
...props
|
|
940
|
+
}) {
|
|
941
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
942
|
+
radixUi.Select.Item,
|
|
943
|
+
{
|
|
944
|
+
"data-slot": "select-item",
|
|
945
|
+
className: cn(
|
|
946
|
+
// Core structure - inherits text color
|
|
947
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-sm",
|
|
948
|
+
"py-1.5 pr-8 pl-2 text-sm outline-hidden select-none",
|
|
949
|
+
// Focus state - uses accent CSS variable
|
|
950
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
951
|
+
// Disabled state
|
|
952
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
953
|
+
// SVG styling
|
|
954
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
955
|
+
// Span styling
|
|
956
|
+
"*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
957
|
+
className
|
|
958
|
+
),
|
|
959
|
+
...props
|
|
960
|
+
},
|
|
961
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
962
|
+
"span",
|
|
963
|
+
{
|
|
964
|
+
"data-slot": "select-item-indicator",
|
|
965
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center"
|
|
966
|
+
},
|
|
967
|
+
/* @__PURE__ */ React17__namespace.createElement(radixUi.Select.ItemIndicator, null, /* @__PURE__ */ React17__namespace.createElement(
|
|
968
|
+
"svg",
|
|
969
|
+
{
|
|
970
|
+
className: "size-4",
|
|
971
|
+
viewBox: "0 0 24 24",
|
|
972
|
+
fill: "none",
|
|
973
|
+
stroke: "currentColor",
|
|
974
|
+
strokeWidth: "3",
|
|
975
|
+
strokeLinecap: "round",
|
|
976
|
+
strokeLinejoin: "round"
|
|
977
|
+
},
|
|
978
|
+
/* @__PURE__ */ React17__namespace.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
979
|
+
))
|
|
980
|
+
),
|
|
981
|
+
/* @__PURE__ */ React17__namespace.createElement(radixUi.Select.ItemText, null, children)
|
|
982
|
+
);
|
|
983
|
+
}
|
|
984
|
+
function SelectScrollUpButton({
|
|
985
|
+
className,
|
|
986
|
+
...props
|
|
987
|
+
}) {
|
|
988
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
989
|
+
radixUi.Select.ScrollUpButton,
|
|
990
|
+
{
|
|
991
|
+
"data-slot": "select-scroll-up-button",
|
|
992
|
+
className: cn(
|
|
993
|
+
"flex cursor-default items-center justify-center py-1",
|
|
994
|
+
className
|
|
995
|
+
),
|
|
996
|
+
...props
|
|
997
|
+
},
|
|
998
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
999
|
+
"svg",
|
|
1000
|
+
{
|
|
1001
|
+
className: "size-4",
|
|
1002
|
+
viewBox: "0 0 24 24",
|
|
1003
|
+
fill: "none",
|
|
1004
|
+
stroke: "currentColor",
|
|
1005
|
+
strokeWidth: "2",
|
|
1006
|
+
strokeLinecap: "round",
|
|
1007
|
+
strokeLinejoin: "round"
|
|
1008
|
+
},
|
|
1009
|
+
/* @__PURE__ */ React17__namespace.createElement("polyline", { points: "18 15 12 9 6 15" })
|
|
1010
|
+
)
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
function SelectScrollDownButton({
|
|
1014
|
+
className,
|
|
1015
|
+
...props
|
|
1016
|
+
}) {
|
|
1017
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1018
|
+
radixUi.Select.ScrollDownButton,
|
|
1019
|
+
{
|
|
1020
|
+
"data-slot": "select-scroll-down-button",
|
|
1021
|
+
className: cn(
|
|
1022
|
+
"flex cursor-default items-center justify-center py-1",
|
|
1023
|
+
className
|
|
1024
|
+
),
|
|
1025
|
+
...props
|
|
1026
|
+
},
|
|
1027
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1028
|
+
"svg",
|
|
1029
|
+
{
|
|
1030
|
+
className: "size-4",
|
|
1031
|
+
viewBox: "0 0 24 24",
|
|
1032
|
+
fill: "none",
|
|
1033
|
+
stroke: "currentColor",
|
|
1034
|
+
strokeWidth: "2",
|
|
1035
|
+
strokeLinecap: "round",
|
|
1036
|
+
strokeLinejoin: "round"
|
|
1037
|
+
},
|
|
1038
|
+
/* @__PURE__ */ React17__namespace.createElement("polyline", { points: "6 9 12 15 18 9" })
|
|
1039
|
+
)
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// src/inputs/Select.tsx
|
|
1044
|
+
function Select2({
|
|
624
1045
|
name,
|
|
625
1046
|
value,
|
|
626
1047
|
onChange,
|
|
@@ -631,290 +1052,83 @@ function Select({
|
|
|
631
1052
|
error = false,
|
|
632
1053
|
className = "",
|
|
633
1054
|
placeholder = "Select...",
|
|
634
|
-
searchable = true,
|
|
635
|
-
clearable = true,
|
|
636
|
-
loading = false,
|
|
637
1055
|
options = [],
|
|
638
1056
|
optionGroups = [],
|
|
639
1057
|
renderOption,
|
|
640
1058
|
...props
|
|
641
1059
|
}) {
|
|
642
|
-
const [
|
|
643
|
-
const
|
|
644
|
-
const [focusedIndex, setFocusedIndex] = React9__namespace.useState(-1);
|
|
645
|
-
const [hasInteracted, setHasInteracted] = React9__namespace.useState(false);
|
|
646
|
-
const triggerRef = React9__namespace.useRef(null);
|
|
647
|
-
const dropdownRef = React9__namespace.useRef(null);
|
|
648
|
-
const searchInputRef = React9__namespace.useRef(null);
|
|
649
|
-
const dropdownId = `${name}-dropdown`;
|
|
650
|
-
const allOptions = React9__namespace.useMemo(() => {
|
|
1060
|
+
const [hasInteracted, setHasInteracted] = React17__namespace.useState(false);
|
|
1061
|
+
const allOptions = React17__namespace.useMemo(() => {
|
|
651
1062
|
if (optionGroups.length > 0) {
|
|
652
1063
|
return optionGroups.flatMap((group) => group.options);
|
|
653
1064
|
}
|
|
654
1065
|
return options;
|
|
655
1066
|
}, [options, optionGroups]);
|
|
656
|
-
const filteredOptions = React9__namespace.useMemo(() => {
|
|
657
|
-
if (!searchQuery.trim()) {
|
|
658
|
-
return allOptions;
|
|
659
|
-
}
|
|
660
|
-
const query = searchQuery.toLowerCase();
|
|
661
|
-
return allOptions.filter((option) => {
|
|
662
|
-
const label = typeof option.label === "string" ? option.label : String(option.label);
|
|
663
|
-
return label.toLowerCase().includes(query);
|
|
664
|
-
});
|
|
665
|
-
}, [allOptions, searchQuery]);
|
|
666
|
-
const selectedOption = React9__namespace.useMemo(() => {
|
|
667
|
-
return allOptions.find((opt) => opt.value === value);
|
|
668
|
-
}, [allOptions, value]);
|
|
669
1067
|
const hasValue = Boolean(value);
|
|
670
|
-
const
|
|
671
|
-
onChange(
|
|
672
|
-
setIsOpen(false);
|
|
673
|
-
setSearchQuery("");
|
|
674
|
-
setFocusedIndex(-1);
|
|
675
|
-
};
|
|
676
|
-
const handleClear = (e) => {
|
|
677
|
-
e.stopPropagation();
|
|
678
|
-
onChange("");
|
|
679
|
-
setSearchQuery("");
|
|
680
|
-
setFocusedIndex(-1);
|
|
1068
|
+
const handleValueChange = (newValue) => {
|
|
1069
|
+
onChange(newValue);
|
|
681
1070
|
};
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
setHasInteracted(true);
|
|
688
|
-
}
|
|
689
|
-
if (newIsOpen && searchable && searchInputRef.current) {
|
|
690
|
-
setTimeout(() => searchInputRef.current?.focus(), 0);
|
|
691
|
-
}
|
|
692
|
-
if (newIsOpen) {
|
|
1071
|
+
const handleOpenChange = (open) => {
|
|
1072
|
+
if (open) {
|
|
1073
|
+
if (!hasInteracted) {
|
|
1074
|
+
setHasInteracted(true);
|
|
1075
|
+
}
|
|
693
1076
|
onFocus?.();
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
const handleSearchChange = (e) => {
|
|
697
|
-
setSearchQuery(e.target.value);
|
|
698
|
-
setFocusedIndex(0);
|
|
699
|
-
};
|
|
700
|
-
const handleKeyDown = (e) => {
|
|
701
|
-
if (disabled) return;
|
|
702
|
-
switch (e.key) {
|
|
703
|
-
case "ArrowDown":
|
|
704
|
-
e.preventDefault();
|
|
705
|
-
if (!isOpen) {
|
|
706
|
-
setIsOpen(true);
|
|
707
|
-
setFocusedIndex(0);
|
|
708
|
-
} else {
|
|
709
|
-
const enabledOptions = filteredOptions.filter((opt) => !opt.disabled);
|
|
710
|
-
if (enabledOptions.length > 0) {
|
|
711
|
-
const currentIndexInFiltered = focusedIndex;
|
|
712
|
-
const nextIndex = (currentIndexInFiltered + 1) % enabledOptions.length;
|
|
713
|
-
setFocusedIndex(filteredOptions.indexOf(enabledOptions[nextIndex]));
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
break;
|
|
717
|
-
case "ArrowUp":
|
|
718
|
-
e.preventDefault();
|
|
719
|
-
if (isOpen) {
|
|
720
|
-
const enabledOptions = filteredOptions.filter((opt) => !opt.disabled);
|
|
721
|
-
if (enabledOptions.length > 0) {
|
|
722
|
-
const currentIndexInFiltered = focusedIndex;
|
|
723
|
-
const prevIndex = (currentIndexInFiltered - 1 + enabledOptions.length) % enabledOptions.length;
|
|
724
|
-
setFocusedIndex(filteredOptions.indexOf(enabledOptions[prevIndex]));
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
break;
|
|
728
|
-
case "Enter":
|
|
729
|
-
e.preventDefault();
|
|
730
|
-
if (isOpen && focusedIndex >= 0 && focusedIndex < filteredOptions.length) {
|
|
731
|
-
const focusedOption = filteredOptions[focusedIndex];
|
|
732
|
-
if (!focusedOption.disabled) {
|
|
733
|
-
handleSelect(focusedOption.value);
|
|
734
|
-
}
|
|
735
|
-
} else if (!isOpen) {
|
|
736
|
-
setIsOpen(true);
|
|
737
|
-
}
|
|
738
|
-
break;
|
|
739
|
-
case "Escape":
|
|
740
|
-
e.preventDefault();
|
|
741
|
-
if (isOpen) {
|
|
742
|
-
setIsOpen(false);
|
|
743
|
-
setSearchQuery("");
|
|
744
|
-
setFocusedIndex(-1);
|
|
745
|
-
}
|
|
746
|
-
break;
|
|
747
|
-
case " ":
|
|
748
|
-
if (!isOpen && !searchable) {
|
|
749
|
-
e.preventDefault();
|
|
750
|
-
setIsOpen(true);
|
|
751
|
-
}
|
|
752
|
-
break;
|
|
753
|
-
default:
|
|
754
|
-
if (!searchable && e.key.length === 1 && !e.ctrlKey && !e.metaKey) {
|
|
755
|
-
const char = e.key.toLowerCase();
|
|
756
|
-
const matchingOption = filteredOptions.find((opt) => {
|
|
757
|
-
const label = typeof opt.label === "string" ? opt.label : String(opt.label);
|
|
758
|
-
return label.toLowerCase().startsWith(char) && !opt.disabled;
|
|
759
|
-
});
|
|
760
|
-
if (matchingOption) {
|
|
761
|
-
handleSelect(matchingOption.value);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
break;
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
const handleBlur = (event) => {
|
|
768
|
-
const nextTarget = event?.relatedTarget;
|
|
769
|
-
const focusStayedInside = !!triggerRef.current && triggerRef.current.contains(nextTarget) || !!dropdownRef.current && dropdownRef.current.contains(nextTarget);
|
|
770
|
-
if (!nextTarget || !focusStayedInside) {
|
|
1077
|
+
} else if (hasInteracted) {
|
|
771
1078
|
onBlur?.();
|
|
772
1079
|
}
|
|
773
1080
|
};
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
setIsOpen(false);
|
|
777
|
-
setSearchQuery("");
|
|
778
|
-
setFocusedIndex(-1);
|
|
779
|
-
if (hasInteracted) {
|
|
780
|
-
onBlur?.();
|
|
781
|
-
}
|
|
782
|
-
}, [isOpen, hasInteracted, onBlur]);
|
|
783
|
-
useOnClickOutside.useOnClickOutside([triggerRef, dropdownRef], closeDropdown, void 0, {
|
|
784
|
-
capture: true
|
|
785
|
-
});
|
|
786
|
-
const combinedClassName = cn("relative w-full", className);
|
|
787
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
788
|
-
"div",
|
|
1081
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1082
|
+
Select,
|
|
789
1083
|
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1084
|
+
name,
|
|
1085
|
+
value,
|
|
1086
|
+
onValueChange: handleValueChange,
|
|
1087
|
+
onOpenChange: handleOpenChange,
|
|
1088
|
+
disabled,
|
|
1089
|
+
required
|
|
793
1090
|
},
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
|
|
1091
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1092
|
+
SelectTrigger,
|
|
796
1093
|
{
|
|
797
|
-
name,
|
|
798
|
-
value,
|
|
799
|
-
onChange: () => {
|
|
800
|
-
},
|
|
801
|
-
disabled,
|
|
802
|
-
required,
|
|
803
|
-
"aria-hidden": "true",
|
|
804
|
-
tabIndex: -1,
|
|
805
|
-
style: { display: "none" }
|
|
806
|
-
},
|
|
807
|
-
/* @__PURE__ */ React9__namespace.createElement("option", { value: "" }, "Select..."),
|
|
808
|
-
allOptions.map((option) => /* @__PURE__ */ React9__namespace.createElement("option", { key: option.value, value: option.value }, typeof option.label === "string" ? option.label : option.value))
|
|
809
|
-
),
|
|
810
|
-
/* @__PURE__ */ React9__namespace.createElement(
|
|
811
|
-
"div",
|
|
812
|
-
{
|
|
813
|
-
ref: triggerRef,
|
|
814
1094
|
className: cn(
|
|
815
|
-
|
|
816
|
-
"cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1095
|
+
// Valid value indicator - ring-2 when has value and no error
|
|
817
1096
|
!error && hasValue && "ring-2 ring-ring",
|
|
818
|
-
|
|
819
|
-
|
|
1097
|
+
// Error state - handled by SelectTrigger via aria-invalid
|
|
1098
|
+
className
|
|
820
1099
|
),
|
|
821
|
-
onClick: handleToggle,
|
|
822
|
-
role: "combobox",
|
|
823
|
-
"aria-expanded": isOpen,
|
|
824
|
-
"aria-controls": dropdownId,
|
|
825
1100
|
"aria-invalid": error || props["aria-invalid"],
|
|
826
1101
|
"aria-describedby": props["aria-describedby"],
|
|
827
|
-
"aria-required": required || props["aria-required"]
|
|
828
|
-
"aria-disabled": disabled,
|
|
829
|
-
tabIndex: disabled ? -1 : 0
|
|
1102
|
+
"aria-required": required || props["aria-required"]
|
|
830
1103
|
},
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
|
|
833
|
-
|
|
1104
|
+
/* @__PURE__ */ React17__namespace.createElement(SelectValue, { placeholder })
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ React17__namespace.createElement(SelectContent, null, optionGroups.length > 0 ? (
|
|
1107
|
+
// Render grouped options
|
|
1108
|
+
optionGroups.map((group, groupIndex) => /* @__PURE__ */ React17__namespace.createElement(SelectGroup, { key: groupIndex }, /* @__PURE__ */ React17__namespace.createElement(SelectLabel, null, group.label), group.options.map((option) => /* @__PURE__ */ React17__namespace.createElement(
|
|
1109
|
+
SelectItem,
|
|
834
1110
|
{
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
"aria-label": "Clear selection",
|
|
839
|
-
tabIndex: -1
|
|
1111
|
+
key: option.value,
|
|
1112
|
+
value: option.value,
|
|
1113
|
+
disabled: option.disabled
|
|
840
1114
|
},
|
|
841
|
-
|
|
842
|
-
)
|
|
843
|
-
)
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
ref: dropdownRef,
|
|
848
|
-
id: dropdownId,
|
|
849
|
-
className: "absolute z-50 top-full mt-1 min-w-full overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
|
|
850
|
-
role: "listbox"
|
|
851
|
-
},
|
|
852
|
-
searchable && /* @__PURE__ */ React9__namespace.createElement("div", { className: "p-2 border-b border-border" }, /* @__PURE__ */ React9__namespace.createElement(
|
|
853
|
-
"input",
|
|
1115
|
+
renderOption ? renderOption(option) : option.label
|
|
1116
|
+
))))
|
|
1117
|
+
) : (
|
|
1118
|
+
// Render flat options
|
|
1119
|
+
allOptions.map((option) => /* @__PURE__ */ React17__namespace.createElement(
|
|
1120
|
+
SelectItem,
|
|
854
1121
|
{
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
),
|
|
861
|
-
placeholder: "Search...",
|
|
862
|
-
value: searchQuery,
|
|
863
|
-
onChange: handleSearchChange,
|
|
864
|
-
onClick: (e) => e.stopPropagation(),
|
|
865
|
-
"aria-label": "Search options"
|
|
866
|
-
}
|
|
867
|
-
)),
|
|
868
|
-
/* @__PURE__ */ React9__namespace.createElement("div", { className: "max-h-64 overflow-y-auto p-1" }, filteredOptions.length === 0 ? /* @__PURE__ */ React9__namespace.createElement("div", { className: "py-2 px-3 text-center text-sm " }, "No options found") : optionGroups.length > 0 ? (
|
|
869
|
-
// Render grouped options
|
|
870
|
-
optionGroups.map((group, groupIndex) => {
|
|
871
|
-
const groupOptions = group.options.filter(
|
|
872
|
-
(opt) => filteredOptions.includes(opt)
|
|
873
|
-
);
|
|
874
|
-
if (groupOptions.length === 0) return null;
|
|
875
|
-
return /* @__PURE__ */ React9__namespace.createElement("div", { key: groupIndex, className: "py-1" }, /* @__PURE__ */ React9__namespace.createElement("div", { className: "py-1.5 px-2 text-xs font-semibold " }, group.label), groupOptions.map((option) => {
|
|
876
|
-
const globalIndex = filteredOptions.indexOf(option);
|
|
877
|
-
const isSelected = value === option.value;
|
|
878
|
-
const isFocused = globalIndex === focusedIndex;
|
|
879
|
-
const isDisabled = option.disabled;
|
|
880
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
881
|
-
"div",
|
|
882
|
-
{
|
|
883
|
-
key: option.value,
|
|
884
|
-
className: `relative flex w-full cursor-pointer items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:bg-muted ${isFocused ? "bg-muted" : ""} ${isSelected ? "font-medium bg-muted" : ""} ${isDisabled ? "pointer-events-none opacity-50" : ""}`,
|
|
885
|
-
onClick: () => !isDisabled && handleSelect(option.value),
|
|
886
|
-
role: "option",
|
|
887
|
-
"aria-selected": isSelected,
|
|
888
|
-
"aria-disabled": isDisabled
|
|
889
|
-
},
|
|
890
|
-
renderOption ? renderOption(option) : option.label
|
|
891
|
-
);
|
|
892
|
-
}));
|
|
893
|
-
})
|
|
894
|
-
) : (
|
|
895
|
-
// Render flat options
|
|
896
|
-
filteredOptions.map((option, index) => {
|
|
897
|
-
const isSelected = value === option.value;
|
|
898
|
-
const isFocused = index === focusedIndex;
|
|
899
|
-
const isDisabled = option.disabled;
|
|
900
|
-
return /* @__PURE__ */ React9__namespace.createElement(
|
|
901
|
-
"div",
|
|
902
|
-
{
|
|
903
|
-
key: option.value,
|
|
904
|
-
className: `relative flex w-full cursor-pointer items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:bg-muted ${isFocused ? "bg-muted" : ""} ${isSelected ? "font-medium bg-muted" : ""} ${isDisabled ? "pointer-events-none opacity-50" : ""}`,
|
|
905
|
-
onClick: () => !isDisabled && handleSelect(option.value),
|
|
906
|
-
role: "option",
|
|
907
|
-
"aria-selected": isSelected,
|
|
908
|
-
"aria-disabled": isDisabled
|
|
909
|
-
},
|
|
910
|
-
renderOption ? renderOption(option) : option.label
|
|
911
|
-
);
|
|
912
|
-
})
|
|
1122
|
+
key: option.value,
|
|
1123
|
+
value: option.value,
|
|
1124
|
+
disabled: option.disabled
|
|
1125
|
+
},
|
|
1126
|
+
renderOption ? renderOption(option) : option.label
|
|
913
1127
|
))
|
|
914
|
-
)
|
|
1128
|
+
))
|
|
915
1129
|
);
|
|
916
1130
|
}
|
|
917
|
-
|
|
1131
|
+
Select2.displayName = "Select";
|
|
918
1132
|
function MultiSelect({
|
|
919
1133
|
name,
|
|
920
1134
|
value = [],
|
|
@@ -937,21 +1151,21 @@ function MultiSelect({
|
|
|
937
1151
|
renderValue,
|
|
938
1152
|
...props
|
|
939
1153
|
}) {
|
|
940
|
-
const [isOpen, setIsOpen] =
|
|
941
|
-
const [searchQuery, setSearchQuery] =
|
|
942
|
-
const [focusedIndex, setFocusedIndex] =
|
|
943
|
-
const [hasInteracted, setHasInteracted] =
|
|
944
|
-
const triggerRef =
|
|
945
|
-
const dropdownRef =
|
|
946
|
-
const searchInputRef =
|
|
1154
|
+
const [isOpen, setIsOpen] = React17__namespace.useState(false);
|
|
1155
|
+
const [searchQuery, setSearchQuery] = React17__namespace.useState("");
|
|
1156
|
+
const [focusedIndex, setFocusedIndex] = React17__namespace.useState(-1);
|
|
1157
|
+
const [hasInteracted, setHasInteracted] = React17__namespace.useState(false);
|
|
1158
|
+
const triggerRef = React17__namespace.useRef(null);
|
|
1159
|
+
const dropdownRef = React17__namespace.useRef(null);
|
|
1160
|
+
const searchInputRef = React17__namespace.useRef(null);
|
|
947
1161
|
const dropdownId = `${name}-dropdown`;
|
|
948
|
-
const allOptions =
|
|
1162
|
+
const allOptions = React17__namespace.useMemo(() => {
|
|
949
1163
|
if (optionGroups.length > 0) {
|
|
950
1164
|
return optionGroups.flatMap((group) => group.options);
|
|
951
1165
|
}
|
|
952
1166
|
return options;
|
|
953
1167
|
}, [options, optionGroups]);
|
|
954
|
-
const filteredOptions =
|
|
1168
|
+
const filteredOptions = React17__namespace.useMemo(() => {
|
|
955
1169
|
if (!searchQuery.trim()) {
|
|
956
1170
|
return allOptions;
|
|
957
1171
|
}
|
|
@@ -961,11 +1175,11 @@ function MultiSelect({
|
|
|
961
1175
|
return label.toLowerCase().includes(query);
|
|
962
1176
|
});
|
|
963
1177
|
}, [allOptions, searchQuery]);
|
|
964
|
-
const selectedOptions =
|
|
1178
|
+
const selectedOptions = React17__namespace.useMemo(() => {
|
|
965
1179
|
return allOptions.filter((opt) => value.includes(opt.value));
|
|
966
1180
|
}, [allOptions, value]);
|
|
967
1181
|
const hasValue = value.length > 0;
|
|
968
|
-
const isMaxReached =
|
|
1182
|
+
const isMaxReached = React17__namespace.useMemo(() => {
|
|
969
1183
|
return maxSelections !== void 0 && value.length >= maxSelections;
|
|
970
1184
|
}, [maxSelections, value.length]);
|
|
971
1185
|
const handleToggleOption = (optionValue) => {
|
|
@@ -1081,7 +1295,7 @@ function MultiSelect({
|
|
|
1081
1295
|
onBlur?.();
|
|
1082
1296
|
}
|
|
1083
1297
|
};
|
|
1084
|
-
const closeDropdown =
|
|
1298
|
+
const closeDropdown = React17__namespace.useCallback(() => {
|
|
1085
1299
|
if (!isOpen) return;
|
|
1086
1300
|
setIsOpen(false);
|
|
1087
1301
|
setSearchQuery("");
|
|
@@ -1094,14 +1308,14 @@ function MultiSelect({
|
|
|
1094
1308
|
capture: true
|
|
1095
1309
|
});
|
|
1096
1310
|
const combinedClassName = cn("relative w-full", className);
|
|
1097
|
-
return /* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1098
1312
|
"div",
|
|
1099
1313
|
{
|
|
1100
1314
|
className: combinedClassName,
|
|
1101
1315
|
onKeyDown: handleKeyDown,
|
|
1102
1316
|
onBlur: handleBlur
|
|
1103
1317
|
},
|
|
1104
|
-
/* @__PURE__ */
|
|
1318
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1105
1319
|
"select",
|
|
1106
1320
|
{
|
|
1107
1321
|
name,
|
|
@@ -1115,10 +1329,10 @@ function MultiSelect({
|
|
|
1115
1329
|
style: { display: "none" },
|
|
1116
1330
|
multiple: true
|
|
1117
1331
|
},
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
-
allOptions.map((option) => /* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ React17__namespace.createElement("option", { value: "" }, "Select..."),
|
|
1333
|
+
allOptions.map((option) => /* @__PURE__ */ React17__namespace.createElement("option", { key: option.value, value: option.value }, typeof option.label === "string" ? option.label : option.value))
|
|
1120
1334
|
),
|
|
1121
|
-
/* @__PURE__ */
|
|
1335
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1122
1336
|
"div",
|
|
1123
1337
|
{
|
|
1124
1338
|
ref: triggerRef,
|
|
@@ -1139,13 +1353,13 @@ function MultiSelect({
|
|
|
1139
1353
|
"aria-disabled": disabled,
|
|
1140
1354
|
tabIndex: disabled ? -1 : 0
|
|
1141
1355
|
},
|
|
1142
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center flex-1 overflow-hidden" }, selectedOptions.length > 0 ? /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-wrap gap-1" }, selectedOptions.map((option) => /* @__PURE__ */ React17__namespace.createElement(
|
|
1143
1357
|
"span",
|
|
1144
1358
|
{
|
|
1145
1359
|
key: option.value,
|
|
1146
1360
|
className: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium"
|
|
1147
1361
|
},
|
|
1148
|
-
renderValue ? renderValue(option) : /* @__PURE__ */
|
|
1362
|
+
renderValue ? renderValue(option) : /* @__PURE__ */ React17__namespace.createElement(React17__namespace.Fragment, null, /* @__PURE__ */ React17__namespace.createElement("span", { className: "max-w-40 overflow-hidden text-ellipsis whitespace-nowrap" }, option.label), !disabled && /* @__PURE__ */ React17__namespace.createElement(
|
|
1149
1363
|
"button",
|
|
1150
1364
|
{
|
|
1151
1365
|
type: "button",
|
|
@@ -1156,8 +1370,8 @@ function MultiSelect({
|
|
|
1156
1370
|
},
|
|
1157
1371
|
"\u2715"
|
|
1158
1372
|
))
|
|
1159
|
-
))) : /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1373
|
+
))) : /* @__PURE__ */ React17__namespace.createElement("span", { className: "relative" }, placeholder)),
|
|
1374
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center gap-1 ml-2" }, loading && /* @__PURE__ */ React17__namespace.createElement("span", { className: "text-xs" }, "\u23F3"), clearable && value.length > 0 && !disabled && !loading && /* @__PURE__ */ React17__namespace.createElement(
|
|
1161
1375
|
"button",
|
|
1162
1376
|
{
|
|
1163
1377
|
type: "button",
|
|
@@ -1167,9 +1381,9 @@ function MultiSelect({
|
|
|
1167
1381
|
tabIndex: -1
|
|
1168
1382
|
},
|
|
1169
1383
|
"\u2715"
|
|
1170
|
-
), /* @__PURE__ */
|
|
1384
|
+
), /* @__PURE__ */ React17__namespace.createElement("span", { className: "text-xs leading-none", "aria-hidden": "true" }, isOpen ? "\u25B2" : "\u25BC"))
|
|
1171
1385
|
),
|
|
1172
|
-
isOpen && /* @__PURE__ */
|
|
1386
|
+
isOpen && /* @__PURE__ */ React17__namespace.createElement(
|
|
1173
1387
|
"div",
|
|
1174
1388
|
{
|
|
1175
1389
|
ref: dropdownRef,
|
|
@@ -1178,7 +1392,7 @@ function MultiSelect({
|
|
|
1178
1392
|
role: "listbox",
|
|
1179
1393
|
"aria-multiselectable": "true"
|
|
1180
1394
|
},
|
|
1181
|
-
searchable && /* @__PURE__ */
|
|
1395
|
+
searchable && /* @__PURE__ */ React17__namespace.createElement("div", { className: "p-2 border-b border-border" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1182
1396
|
"input",
|
|
1183
1397
|
{
|
|
1184
1398
|
ref: searchInputRef,
|
|
@@ -1194,7 +1408,7 @@ function MultiSelect({
|
|
|
1194
1408
|
"aria-label": "Search options"
|
|
1195
1409
|
}
|
|
1196
1410
|
)),
|
|
1197
|
-
showSelectAll && filteredOptions.length > 0 && /* @__PURE__ */
|
|
1411
|
+
showSelectAll && filteredOptions.length > 0 && /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex gap-2 p-2 border-b border-border" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1198
1412
|
"button",
|
|
1199
1413
|
{
|
|
1200
1414
|
type: "button",
|
|
@@ -1203,7 +1417,7 @@ function MultiSelect({
|
|
|
1203
1417
|
disabled
|
|
1204
1418
|
},
|
|
1205
1419
|
"Select All"
|
|
1206
|
-
), value.length > 0 && /* @__PURE__ */
|
|
1420
|
+
), value.length > 0 && /* @__PURE__ */ React17__namespace.createElement(
|
|
1207
1421
|
"button",
|
|
1208
1422
|
{
|
|
1209
1423
|
type: "button",
|
|
@@ -1213,20 +1427,20 @@ function MultiSelect({
|
|
|
1213
1427
|
},
|
|
1214
1428
|
"Clear All"
|
|
1215
1429
|
)),
|
|
1216
|
-
isMaxReached && /* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1430
|
+
isMaxReached && /* @__PURE__ */ React17__namespace.createElement("div", { className: "px-2 py-1 text-xs font-medium text-amber-600 bg-destructive/80 text-destructive-foreground border-b border-destructive" }, "Maximum ", maxSelections, " selection", maxSelections !== 1 ? "s" : "", " ", "reached"),
|
|
1431
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "max-h-64 overflow-y-auto p-1" }, filteredOptions.length === 0 ? /* @__PURE__ */ React17__namespace.createElement("div", { className: "px-2 py-1 text-center text-sm" }, "No options found") : optionGroups.length > 0 ? (
|
|
1218
1432
|
// Render grouped options
|
|
1219
1433
|
optionGroups.map((group, groupIndex) => {
|
|
1220
1434
|
const groupOptions = group.options.filter(
|
|
1221
1435
|
(opt) => filteredOptions.includes(opt)
|
|
1222
1436
|
);
|
|
1223
1437
|
if (groupOptions.length === 0) return null;
|
|
1224
|
-
return /* @__PURE__ */
|
|
1438
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { key: groupIndex, className: "py-1" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "py-1.5 px-2 text-xs font-semibold " }, group.label), groupOptions.map((option) => {
|
|
1225
1439
|
const globalIndex = filteredOptions.indexOf(option);
|
|
1226
1440
|
const isSelected = value.includes(option.value);
|
|
1227
1441
|
const isFocused = globalIndex === focusedIndex;
|
|
1228
1442
|
const isDisabled = option.disabled || isMaxReached && !isSelected;
|
|
1229
|
-
return /* @__PURE__ */
|
|
1443
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1230
1444
|
"div",
|
|
1231
1445
|
{
|
|
1232
1446
|
key: option.value,
|
|
@@ -1241,8 +1455,8 @@ function MultiSelect({
|
|
|
1241
1455
|
"aria-selected": isSelected,
|
|
1242
1456
|
"aria-disabled": isDisabled
|
|
1243
1457
|
},
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ React17__namespace.createElement("span", { className: "text-base leading-none" }, isSelected ? "\u2611" : "\u2610"),
|
|
1459
|
+
/* @__PURE__ */ React17__namespace.createElement("span", { className: "flex-1" }, renderOption ? renderOption(option) : option.label)
|
|
1246
1460
|
);
|
|
1247
1461
|
}));
|
|
1248
1462
|
})
|
|
@@ -1252,7 +1466,7 @@ function MultiSelect({
|
|
|
1252
1466
|
const isSelected = value.includes(option.value);
|
|
1253
1467
|
const isFocused = index === focusedIndex;
|
|
1254
1468
|
const isDisabled = option.disabled || isMaxReached && !isSelected;
|
|
1255
|
-
return /* @__PURE__ */
|
|
1469
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1256
1470
|
"div",
|
|
1257
1471
|
{
|
|
1258
1472
|
key: option.value,
|
|
@@ -1267,8 +1481,8 @@ function MultiSelect({
|
|
|
1267
1481
|
"aria-selected": isSelected,
|
|
1268
1482
|
"aria-disabled": isDisabled
|
|
1269
1483
|
},
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
/* @__PURE__ */
|
|
1484
|
+
/* @__PURE__ */ React17__namespace.createElement("span", { className: "text-base leading-none" }, isSelected ? "\u2611" : "\u2610"),
|
|
1485
|
+
/* @__PURE__ */ React17__namespace.createElement("span", { className: "flex-1" }, renderOption ? renderOption(option) : option.label)
|
|
1272
1486
|
);
|
|
1273
1487
|
})
|
|
1274
1488
|
))
|
|
@@ -1301,14 +1515,14 @@ function FileInput({
|
|
|
1301
1515
|
onFileRemove,
|
|
1302
1516
|
...props
|
|
1303
1517
|
}) {
|
|
1304
|
-
const inputRef =
|
|
1305
|
-
const [dragActive, setDragActive] =
|
|
1306
|
-
const [cropperOpen, setCropperOpen] =
|
|
1307
|
-
const [imageToCrop, setImageToCrop] =
|
|
1308
|
-
const [crop, setCrop] =
|
|
1309
|
-
const [zoom, setZoom] =
|
|
1310
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
1311
|
-
const validateFile =
|
|
1518
|
+
const inputRef = React17__namespace.useRef(null);
|
|
1519
|
+
const [dragActive, setDragActive] = React17__namespace.useState(false);
|
|
1520
|
+
const [cropperOpen, setCropperOpen] = React17__namespace.useState(false);
|
|
1521
|
+
const [imageToCrop, setImageToCrop] = React17__namespace.useState(null);
|
|
1522
|
+
const [crop, setCrop] = React17__namespace.useState({ x: 0, y: 0 });
|
|
1523
|
+
const [zoom, setZoom] = React17__namespace.useState(1);
|
|
1524
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = React17__namespace.useState(null);
|
|
1525
|
+
const validateFile = React17__namespace.useCallback(
|
|
1312
1526
|
(file) => {
|
|
1313
1527
|
if (accept) {
|
|
1314
1528
|
const acceptedTypes = accept.split(",").map((t) => t.trim());
|
|
@@ -1343,7 +1557,7 @@ function FileInput({
|
|
|
1343
1557
|
},
|
|
1344
1558
|
[accept, maxSize]
|
|
1345
1559
|
);
|
|
1346
|
-
const handleFiles =
|
|
1560
|
+
const handleFiles = React17__namespace.useCallback(
|
|
1347
1561
|
(fileList) => {
|
|
1348
1562
|
if (!fileList || fileList.length === 0) return;
|
|
1349
1563
|
const newFiles = Array.from(fileList);
|
|
@@ -1394,7 +1608,7 @@ function FileInput({
|
|
|
1394
1608
|
onValidationError
|
|
1395
1609
|
]
|
|
1396
1610
|
);
|
|
1397
|
-
const createCroppedImage =
|
|
1611
|
+
const createCroppedImage = React17__namespace.useCallback(
|
|
1398
1612
|
async (imageUrl, cropArea) => {
|
|
1399
1613
|
return new Promise((resolve, reject) => {
|
|
1400
1614
|
const image = new Image();
|
|
@@ -1438,7 +1652,7 @@ function FileInput({
|
|
|
1438
1652
|
},
|
|
1439
1653
|
[]
|
|
1440
1654
|
);
|
|
1441
|
-
const handleCropSave =
|
|
1655
|
+
const handleCropSave = React17__namespace.useCallback(async () => {
|
|
1442
1656
|
if (!imageToCrop || !croppedAreaPixels) return;
|
|
1443
1657
|
try {
|
|
1444
1658
|
const croppedBlob = await createCroppedImage(
|
|
@@ -1471,7 +1685,7 @@ function FileInput({
|
|
|
1471
1685
|
onChange,
|
|
1472
1686
|
multiple
|
|
1473
1687
|
]);
|
|
1474
|
-
const handleCropCancel =
|
|
1688
|
+
const handleCropCancel = React17__namespace.useCallback(() => {
|
|
1475
1689
|
if (imageToCrop) {
|
|
1476
1690
|
URL.revokeObjectURL(imageToCrop.url);
|
|
1477
1691
|
}
|
|
@@ -1481,13 +1695,13 @@ function FileInput({
|
|
|
1481
1695
|
setZoom(1);
|
|
1482
1696
|
setCroppedAreaPixels(null);
|
|
1483
1697
|
}, [imageToCrop]);
|
|
1484
|
-
const onCropChange =
|
|
1698
|
+
const onCropChange = React17__namespace.useCallback((crop2) => {
|
|
1485
1699
|
setCrop(crop2);
|
|
1486
1700
|
}, []);
|
|
1487
|
-
const onZoomChange =
|
|
1701
|
+
const onZoomChange = React17__namespace.useCallback((zoom2) => {
|
|
1488
1702
|
setZoom(zoom2);
|
|
1489
1703
|
}, []);
|
|
1490
|
-
const onCropCompleteInternal =
|
|
1704
|
+
const onCropCompleteInternal = React17__namespace.useCallback(
|
|
1491
1705
|
(_, croppedAreaPixels2) => {
|
|
1492
1706
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
1493
1707
|
},
|
|
@@ -1548,7 +1762,7 @@ function FileInput({
|
|
|
1548
1762
|
}
|
|
1549
1763
|
return null;
|
|
1550
1764
|
};
|
|
1551
|
-
|
|
1765
|
+
React17__namespace.useEffect(() => {
|
|
1552
1766
|
return () => {
|
|
1553
1767
|
value.forEach((file) => {
|
|
1554
1768
|
const previewUrl = getPreviewUrl(file);
|
|
@@ -1562,7 +1776,7 @@ function FileInput({
|
|
|
1562
1776
|
};
|
|
1563
1777
|
}, [value, imageToCrop]);
|
|
1564
1778
|
const combinedClassName = `${className}`.trim();
|
|
1565
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1566
1780
|
"input",
|
|
1567
1781
|
{
|
|
1568
1782
|
ref: inputRef,
|
|
@@ -1579,7 +1793,7 @@ function FileInput({
|
|
|
1579
1793
|
"aria-required": required || props["aria-required"],
|
|
1580
1794
|
style: { display: "none" }
|
|
1581
1795
|
}
|
|
1582
|
-
), /* @__PURE__ */
|
|
1796
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
1583
1797
|
"div",
|
|
1584
1798
|
{
|
|
1585
1799
|
className: `flex min-h-32 w-full cursor-pointer items-center justify-center rounded-md border-2 border-dashed border-input bg-transparent p-6 transition-colors hover:bg-primary/50 hover:border-ring ${dragActive ? "bg-primary text-primary-foreground border-ring" : ""} ${disabled ? "cursor-not-allowed opacity-50" : ""} ${error ? "border-destructive" : ""}`,
|
|
@@ -1594,7 +1808,7 @@ function FileInput({
|
|
|
1594
1808
|
"aria-label": placeholder,
|
|
1595
1809
|
"aria-disabled": disabled
|
|
1596
1810
|
},
|
|
1597
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-col items-center gap-2 text-center" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1598
1812
|
"svg",
|
|
1599
1813
|
{
|
|
1600
1814
|
width: "48",
|
|
@@ -1607,19 +1821,19 @@ function FileInput({
|
|
|
1607
1821
|
strokeLinejoin: "round",
|
|
1608
1822
|
"aria-hidden": "true"
|
|
1609
1823
|
},
|
|
1610
|
-
/* @__PURE__ */
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1613
|
-
), /* @__PURE__ */
|
|
1614
|
-
), value.length > 0 && /* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ React17__namespace.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1825
|
+
/* @__PURE__ */ React17__namespace.createElement("polyline", { points: "17 8 12 3 7 8" }),
|
|
1826
|
+
/* @__PURE__ */ React17__namespace.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
1827
|
+
), /* @__PURE__ */ React17__namespace.createElement("p", { className: "text-sm font-medium" }, value.length > 0 ? `${value.length} file(s) selected` : placeholder), accept && /* @__PURE__ */ React17__namespace.createElement("p", { className: "text-xs" }, "Accepted: ", accept), maxSize && /* @__PURE__ */ React17__namespace.createElement("p", { className: "text-xs " }, "Max size: ", formatFileSize(maxSize)))
|
|
1828
|
+
), value.length > 0 && /* @__PURE__ */ React17__namespace.createElement("ul", { className: "flex flex-col gap-2 mt-4", role: "list" }, value.map((file, index) => {
|
|
1615
1829
|
const previewUrl = showPreview ? getPreviewUrl(file) : null;
|
|
1616
|
-
return /* @__PURE__ */
|
|
1830
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1617
1831
|
"li",
|
|
1618
1832
|
{
|
|
1619
1833
|
key: `${file.name}-${index}`,
|
|
1620
1834
|
className: "flex items-center gap-3 p-3 rounded-md border border-border bg-card text-card-foreground hover:bg-primary/50 transition-colors"
|
|
1621
1835
|
},
|
|
1622
|
-
previewUrl && /* @__PURE__ */
|
|
1836
|
+
previewUrl && /* @__PURE__ */ React17__namespace.createElement(
|
|
1623
1837
|
"img",
|
|
1624
1838
|
{
|
|
1625
1839
|
src: previewUrl,
|
|
@@ -1629,7 +1843,7 @@ function FileInput({
|
|
|
1629
1843
|
height: "48"
|
|
1630
1844
|
}
|
|
1631
1845
|
),
|
|
1632
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "flex flex-col flex-1 min-w-0" }, /* @__PURE__ */ React17__namespace.createElement("span", { className: "text-sm font-medium truncate" }, file.name), /* @__PURE__ */ React17__namespace.createElement("span", { className: "text-xs" }, formatFileSize(file.size)), showProgress && uploadProgress[file.name] !== void 0 && /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center gap-2 mt-1" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1633
1847
|
"div",
|
|
1634
1848
|
{
|
|
1635
1849
|
className: "h-1.5 bg-muted rounded-full overflow-hidden flex-1",
|
|
@@ -1639,15 +1853,15 @@ function FileInput({
|
|
|
1639
1853
|
"aria-valuemax": 100,
|
|
1640
1854
|
"aria-label": `Upload progress: ${uploadProgress[file.name]}%`
|
|
1641
1855
|
},
|
|
1642
|
-
/* @__PURE__ */
|
|
1856
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1643
1857
|
"div",
|
|
1644
1858
|
{
|
|
1645
1859
|
className: "h-full bg-primary transition-all",
|
|
1646
1860
|
style: { width: `${uploadProgress[file.name]}%` }
|
|
1647
1861
|
}
|
|
1648
1862
|
)
|
|
1649
|
-
), /* @__PURE__ */
|
|
1650
|
-
enableCropping && file.type.startsWith("image/") && /* @__PURE__ */
|
|
1863
|
+
), /* @__PURE__ */ React17__namespace.createElement("span", { className: "text-xs " }, uploadProgress[file.name], "%"))),
|
|
1864
|
+
enableCropping && file.type.startsWith("image/") && /* @__PURE__ */ React17__namespace.createElement(
|
|
1651
1865
|
"button",
|
|
1652
1866
|
{
|
|
1653
1867
|
type: "button",
|
|
@@ -1659,7 +1873,7 @@ function FileInput({
|
|
|
1659
1873
|
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-primary hover:text-primary-foreground transition-colors",
|
|
1660
1874
|
"aria-label": `Crop ${file.name}`
|
|
1661
1875
|
},
|
|
1662
|
-
/* @__PURE__ */
|
|
1876
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1663
1877
|
"svg",
|
|
1664
1878
|
{
|
|
1665
1879
|
width: "20",
|
|
@@ -1672,11 +1886,11 @@ function FileInput({
|
|
|
1672
1886
|
strokeLinejoin: "round",
|
|
1673
1887
|
"aria-hidden": "true"
|
|
1674
1888
|
},
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1889
|
+
/* @__PURE__ */ React17__namespace.createElement("path", { d: "M6.13 1L6 16a2 2 0 0 0 2 2h15" }),
|
|
1890
|
+
/* @__PURE__ */ React17__namespace.createElement("path", { d: "M1 6.13L16 6a2 2 0 0 1 2 2v15" })
|
|
1677
1891
|
)
|
|
1678
1892
|
),
|
|
1679
|
-
/* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1680
1894
|
"button",
|
|
1681
1895
|
{
|
|
1682
1896
|
type: "button",
|
|
@@ -1688,7 +1902,7 @@ function FileInput({
|
|
|
1688
1902
|
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-primary hover:text-primary-foreground transition-colors",
|
|
1689
1903
|
"aria-label": `Remove ${file.name}`
|
|
1690
1904
|
},
|
|
1691
|
-
/* @__PURE__ */
|
|
1905
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1692
1906
|
"svg",
|
|
1693
1907
|
{
|
|
1694
1908
|
width: "20",
|
|
@@ -1701,19 +1915,19 @@ function FileInput({
|
|
|
1701
1915
|
strokeLinejoin: "round",
|
|
1702
1916
|
"aria-hidden": "true"
|
|
1703
1917
|
},
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ React17__namespace.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1919
|
+
/* @__PURE__ */ React17__namespace.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1706
1920
|
)
|
|
1707
1921
|
)
|
|
1708
1922
|
);
|
|
1709
|
-
})), cropperOpen && imageToCrop && /* @__PURE__ */
|
|
1923
|
+
})), cropperOpen && imageToCrop && /* @__PURE__ */ React17__namespace.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1710
1924
|
"div",
|
|
1711
1925
|
{
|
|
1712
1926
|
className: "absolute inset-0 bg-black/50",
|
|
1713
1927
|
onClick: handleCropCancel,
|
|
1714
1928
|
"aria-label": "Close cropper"
|
|
1715
1929
|
}
|
|
1716
|
-
), /* @__PURE__ */
|
|
1930
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "relative bg-popover border border-border rounded-lg shadow-lg max-w-3xl w-full mx-4" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center justify-between p-4 border-b border-border" }, /* @__PURE__ */ React17__namespace.createElement("h3", { className: "text-lg font-semibold" }, "Crop Image"), /* @__PURE__ */ React17__namespace.createElement(
|
|
1717
1931
|
"button",
|
|
1718
1932
|
{
|
|
1719
1933
|
type: "button",
|
|
@@ -1722,7 +1936,7 @@ function FileInput({
|
|
|
1722
1936
|
"aria-label": "Close"
|
|
1723
1937
|
},
|
|
1724
1938
|
"\u2715"
|
|
1725
|
-
)), /* @__PURE__ */
|
|
1939
|
+
)), /* @__PURE__ */ React17__namespace.createElement("div", { className: "p-4" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1726
1940
|
"div",
|
|
1727
1941
|
{
|
|
1728
1942
|
className: "relative w-full h-96 bg-muted rounded-md overflow-hidden",
|
|
@@ -1744,7 +1958,7 @@ function FileInput({
|
|
|
1744
1958
|
document.addEventListener("mouseup", handleMouseUp);
|
|
1745
1959
|
}
|
|
1746
1960
|
},
|
|
1747
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1748
1962
|
"img",
|
|
1749
1963
|
{
|
|
1750
1964
|
src: imageToCrop.url,
|
|
@@ -1779,7 +1993,7 @@ function FileInput({
|
|
|
1779
1993
|
}
|
|
1780
1994
|
}
|
|
1781
1995
|
),
|
|
1782
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
1783
1997
|
"div",
|
|
1784
1998
|
{
|
|
1785
1999
|
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 border-2 border-primary rounded pointer-events-none",
|
|
@@ -1788,9 +2002,9 @@ function FileInput({
|
|
|
1788
2002
|
aspectRatio: cropAspectRatio ? String(cropAspectRatio) : void 0
|
|
1789
2003
|
}
|
|
1790
2004
|
},
|
|
1791
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { className: "absolute inset-0 grid grid-cols-3 grid-rows-3" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React17__namespace.createElement("div", null))
|
|
1792
2006
|
)
|
|
1793
|
-
), /* @__PURE__ */
|
|
2007
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center gap-3 mt-4" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1794
2008
|
"label",
|
|
1795
2009
|
{
|
|
1796
2010
|
htmlFor: "zoom-slider",
|
|
@@ -1799,7 +2013,7 @@ function FileInput({
|
|
|
1799
2013
|
"Zoom: ",
|
|
1800
2014
|
zoom.toFixed(1),
|
|
1801
2015
|
"x"
|
|
1802
|
-
), /* @__PURE__ */
|
|
2016
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
1803
2017
|
"input",
|
|
1804
2018
|
{
|
|
1805
2019
|
id: "zoom-slider",
|
|
@@ -1812,7 +2026,7 @@ function FileInput({
|
|
|
1812
2026
|
className: "flex-1 h-2 bg-muted rounded-lg appearance-none cursor-pointer",
|
|
1813
2027
|
"aria-label": "Zoom level"
|
|
1814
2028
|
}
|
|
1815
|
-
))), /* @__PURE__ */
|
|
2029
|
+
))), /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center justify-end gap-2 p-4 border-t border-border" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1816
2030
|
"button",
|
|
1817
2031
|
{
|
|
1818
2032
|
type: "button",
|
|
@@ -1820,7 +2034,7 @@ function FileInput({
|
|
|
1820
2034
|
onClick: handleCropCancel
|
|
1821
2035
|
},
|
|
1822
2036
|
"Cancel"
|
|
1823
|
-
), /* @__PURE__ */
|
|
2037
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
1824
2038
|
"button",
|
|
1825
2039
|
{
|
|
1826
2040
|
type: "button",
|
|
@@ -1862,14 +2076,14 @@ function DatePicker({
|
|
|
1862
2076
|
showIcon = true,
|
|
1863
2077
|
...props
|
|
1864
2078
|
}) {
|
|
1865
|
-
const [isOpen, setIsOpen] =
|
|
1866
|
-
const [hasInteracted, setHasInteracted] =
|
|
1867
|
-
const [selectedMonth, setSelectedMonth] =
|
|
2079
|
+
const [isOpen, setIsOpen] = React17__namespace.useState(false);
|
|
2080
|
+
const [hasInteracted, setHasInteracted] = React17__namespace.useState(false);
|
|
2081
|
+
const [selectedMonth, setSelectedMonth] = React17__namespace.useState(
|
|
1868
2082
|
value || /* @__PURE__ */ new Date()
|
|
1869
2083
|
);
|
|
1870
|
-
const inputRef =
|
|
1871
|
-
const dropdownRef =
|
|
1872
|
-
|
|
2084
|
+
const inputRef = React17__namespace.useRef(null);
|
|
2085
|
+
const dropdownRef = React17__namespace.useRef(null);
|
|
2086
|
+
React17__namespace.useEffect(() => {
|
|
1873
2087
|
if (value) {
|
|
1874
2088
|
setSelectedMonth(value);
|
|
1875
2089
|
}
|
|
@@ -1901,7 +2115,7 @@ function DatePicker({
|
|
|
1901
2115
|
if (isDateDisabled && isDateDisabled(date)) return true;
|
|
1902
2116
|
return false;
|
|
1903
2117
|
};
|
|
1904
|
-
const closeCalendar =
|
|
2118
|
+
const closeCalendar = React17__namespace.useCallback(() => {
|
|
1905
2119
|
if (!isOpen) return;
|
|
1906
2120
|
setIsOpen(false);
|
|
1907
2121
|
if (hasInteracted) {
|
|
@@ -1955,7 +2169,7 @@ function DatePicker({
|
|
|
1955
2169
|
const handleNextMonth = () => {
|
|
1956
2170
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1957
2171
|
};
|
|
1958
|
-
return /* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { role: "grid", "aria-label": "Calendar", className: "w-[248px] max-w-full" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center justify-between pb-3" }, /* @__PURE__ */ React17__namespace.createElement(
|
|
1959
2173
|
"button",
|
|
1960
2174
|
{
|
|
1961
2175
|
type: "button",
|
|
@@ -1964,7 +2178,7 @@ function DatePicker({
|
|
|
1964
2178
|
"aria-label": "Previous month"
|
|
1965
2179
|
},
|
|
1966
2180
|
"\u2039"
|
|
1967
|
-
), /* @__PURE__ */
|
|
2181
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React17__namespace.createElement(
|
|
1968
2182
|
"button",
|
|
1969
2183
|
{
|
|
1970
2184
|
type: "button",
|
|
@@ -1973,13 +2187,13 @@ function DatePicker({
|
|
|
1973
2187
|
"aria-label": "Next month"
|
|
1974
2188
|
},
|
|
1975
2189
|
"\u203A"
|
|
1976
|
-
)), /* @__PURE__ */
|
|
2190
|
+
)), /* @__PURE__ */ React17__namespace.createElement(
|
|
1977
2191
|
"div",
|
|
1978
2192
|
{
|
|
1979
2193
|
className: "grid gap-1 text-xs text-muted-foreground",
|
|
1980
2194
|
style: dayGridStyle
|
|
1981
2195
|
},
|
|
1982
|
-
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */
|
|
2196
|
+
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */ React17__namespace.createElement(
|
|
1983
2197
|
"div",
|
|
1984
2198
|
{
|
|
1985
2199
|
key: day,
|
|
@@ -1987,14 +2201,14 @@ function DatePicker({
|
|
|
1987
2201
|
},
|
|
1988
2202
|
day
|
|
1989
2203
|
))
|
|
1990
|
-
), /* @__PURE__ */
|
|
2204
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "grid gap-1", style: dayGridStyle }, days.map((date, index) => {
|
|
1991
2205
|
if (!date) {
|
|
1992
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { key: `empty-${index}`, className: "h-8 w-8" });
|
|
1993
2207
|
}
|
|
1994
2208
|
const isSelected = value && date.toDateString() === value.toDateString();
|
|
1995
2209
|
const isToday = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
1996
2210
|
const disabled2 = isDisabled(date);
|
|
1997
|
-
return /* @__PURE__ */
|
|
2211
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
1998
2212
|
"button",
|
|
1999
2213
|
{
|
|
2000
2214
|
key: date.toISOString(),
|
|
@@ -2015,20 +2229,20 @@ function DatePicker({
|
|
|
2015
2229
|
})));
|
|
2016
2230
|
};
|
|
2017
2231
|
const combinedClassName = cn("relative", className);
|
|
2018
|
-
return /* @__PURE__ */
|
|
2232
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: combinedClassName, onBlur: handleBlur }, /* @__PURE__ */ React17__namespace.createElement(
|
|
2019
2233
|
"input",
|
|
2020
2234
|
{
|
|
2021
2235
|
type: "hidden",
|
|
2022
2236
|
name,
|
|
2023
2237
|
value: value ? value.toISOString() : ""
|
|
2024
2238
|
}
|
|
2025
|
-
), /* @__PURE__ */
|
|
2239
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React17__namespace.createElement(
|
|
2026
2240
|
"span",
|
|
2027
2241
|
{
|
|
2028
2242
|
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
2029
2243
|
"aria-hidden": "true"
|
|
2030
2244
|
},
|
|
2031
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
2032
2246
|
"svg",
|
|
2033
2247
|
{
|
|
2034
2248
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2041,9 +2255,9 @@ function DatePicker({
|
|
|
2041
2255
|
strokeLinejoin: "round",
|
|
2042
2256
|
strokeWidth: "2"
|
|
2043
2257
|
},
|
|
2044
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ React17__namespace.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" })
|
|
2045
2259
|
)
|
|
2046
|
-
), /* @__PURE__ */
|
|
2260
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
2047
2261
|
"input",
|
|
2048
2262
|
{
|
|
2049
2263
|
ref: inputRef,
|
|
@@ -2068,7 +2282,7 @@ function DatePicker({
|
|
|
2068
2282
|
"aria-required": required || props["aria-required"],
|
|
2069
2283
|
readOnly: true
|
|
2070
2284
|
}
|
|
2071
|
-
), clearable && value && !disabled && /* @__PURE__ */
|
|
2285
|
+
), clearable && value && !disabled && /* @__PURE__ */ React17__namespace.createElement(
|
|
2072
2286
|
"button",
|
|
2073
2287
|
{
|
|
2074
2288
|
type: "button",
|
|
@@ -2078,7 +2292,7 @@ function DatePicker({
|
|
|
2078
2292
|
tabIndex: -1
|
|
2079
2293
|
},
|
|
2080
2294
|
"\u2715"
|
|
2081
|
-
)), isOpen && !disabled && /* @__PURE__ */
|
|
2295
|
+
)), isOpen && !disabled && /* @__PURE__ */ React17__namespace.createElement(
|
|
2082
2296
|
"div",
|
|
2083
2297
|
{
|
|
2084
2298
|
ref: dropdownRef,
|
|
@@ -2145,11 +2359,11 @@ function TimePicker({
|
|
|
2145
2359
|
showIcon = true,
|
|
2146
2360
|
...props
|
|
2147
2361
|
}) {
|
|
2148
|
-
const inputRef =
|
|
2149
|
-
const [nativeValue, setNativeValue] =
|
|
2362
|
+
const inputRef = React17__namespace.useRef(null);
|
|
2363
|
+
const [nativeValue, setNativeValue] = React17__namespace.useState(
|
|
2150
2364
|
normalizeToNativeTime(value)
|
|
2151
2365
|
);
|
|
2152
|
-
|
|
2366
|
+
React17__namespace.useEffect(() => {
|
|
2153
2367
|
setNativeValue(normalizeToNativeTime(value));
|
|
2154
2368
|
}, [value]);
|
|
2155
2369
|
const handleChange = (e) => {
|
|
@@ -2165,13 +2379,13 @@ function TimePicker({
|
|
|
2165
2379
|
};
|
|
2166
2380
|
const hasValue = Boolean(value);
|
|
2167
2381
|
const stepInSeconds = Math.max(1, minuteStep * 60);
|
|
2168
|
-
return /* @__PURE__ */
|
|
2382
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: cn("relative", className) }, /* @__PURE__ */ React17__namespace.createElement("input", { type: "hidden", name, value }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React17__namespace.createElement(
|
|
2169
2383
|
"span",
|
|
2170
2384
|
{
|
|
2171
2385
|
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
2172
2386
|
"aria-hidden": "true"
|
|
2173
2387
|
},
|
|
2174
|
-
/* @__PURE__ */
|
|
2388
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
2175
2389
|
"svg",
|
|
2176
2390
|
{
|
|
2177
2391
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2184,10 +2398,10 @@ function TimePicker({
|
|
|
2184
2398
|
strokeLinejoin: "round",
|
|
2185
2399
|
strokeWidth: "2"
|
|
2186
2400
|
},
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2401
|
+
/* @__PURE__ */ React17__namespace.createElement("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2402
|
+
/* @__PURE__ */ React17__namespace.createElement("path", { d: "M12 6v6l4 2" })
|
|
2189
2403
|
)
|
|
2190
|
-
), /* @__PURE__ */
|
|
2404
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
2191
2405
|
"input",
|
|
2192
2406
|
{
|
|
2193
2407
|
ref: inputRef,
|
|
@@ -2215,7 +2429,7 @@ function TimePicker({
|
|
|
2215
2429
|
"aria-required": required || props["aria-required"],
|
|
2216
2430
|
...props
|
|
2217
2431
|
}
|
|
2218
|
-
), clearable && value && !disabled && /* @__PURE__ */
|
|
2432
|
+
), clearable && value && !disabled && /* @__PURE__ */ React17__namespace.createElement(
|
|
2219
2433
|
"button",
|
|
2220
2434
|
{
|
|
2221
2435
|
type: "button",
|
|
@@ -2268,17 +2482,17 @@ function DateRangePicker({
|
|
|
2268
2482
|
separator = " - ",
|
|
2269
2483
|
...props
|
|
2270
2484
|
}) {
|
|
2271
|
-
const [isOpen, setIsOpen] =
|
|
2272
|
-
const [hasInteracted, setHasInteracted] =
|
|
2273
|
-
const [selectedMonth, setSelectedMonth] =
|
|
2485
|
+
const [isOpen, setIsOpen] = React17__namespace.useState(false);
|
|
2486
|
+
const [hasInteracted, setHasInteracted] = React17__namespace.useState(false);
|
|
2487
|
+
const [selectedMonth, setSelectedMonth] = React17__namespace.useState(
|
|
2274
2488
|
value.start || /* @__PURE__ */ new Date()
|
|
2275
2489
|
);
|
|
2276
|
-
const [rangeStart, setRangeStart] =
|
|
2277
|
-
const [rangeEnd, setRangeEnd] =
|
|
2278
|
-
const [hoverDate, setHoverDate] =
|
|
2279
|
-
const triggerRef =
|
|
2280
|
-
const dropdownRef =
|
|
2281
|
-
|
|
2490
|
+
const [rangeStart, setRangeStart] = React17__namespace.useState(value.start);
|
|
2491
|
+
const [rangeEnd, setRangeEnd] = React17__namespace.useState(value.end);
|
|
2492
|
+
const [hoverDate, setHoverDate] = React17__namespace.useState(null);
|
|
2493
|
+
const triggerRef = React17__namespace.useRef(null);
|
|
2494
|
+
const dropdownRef = React17__namespace.useRef(null);
|
|
2495
|
+
React17__namespace.useEffect(() => {
|
|
2282
2496
|
setRangeStart(value.start);
|
|
2283
2497
|
setRangeEnd(value.end);
|
|
2284
2498
|
if (value.start) {
|
|
@@ -2327,7 +2541,7 @@ function DateRangePicker({
|
|
|
2327
2541
|
if (isDateDisabled && isDateDisabled(date)) return true;
|
|
2328
2542
|
return false;
|
|
2329
2543
|
};
|
|
2330
|
-
const closeCalendar =
|
|
2544
|
+
const closeCalendar = React17__namespace.useCallback(() => {
|
|
2331
2545
|
if (!isOpen) return;
|
|
2332
2546
|
setIsOpen(false);
|
|
2333
2547
|
if (hasInteracted) {
|
|
@@ -2377,7 +2591,7 @@ function DateRangePicker({
|
|
|
2377
2591
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
2378
2592
|
days.push(new Date(year, month, day));
|
|
2379
2593
|
}
|
|
2380
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: "w-[240px] max-w-full" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center justify-between pb-3" }, controls?.prev ? /* @__PURE__ */ React17__namespace.createElement(
|
|
2381
2595
|
"button",
|
|
2382
2596
|
{
|
|
2383
2597
|
type: "button",
|
|
@@ -2386,7 +2600,7 @@ function DateRangePicker({
|
|
|
2386
2600
|
"aria-label": "Previous month"
|
|
2387
2601
|
},
|
|
2388
2602
|
"\u2039"
|
|
2389
|
-
) : /* @__PURE__ */
|
|
2603
|
+
) : /* @__PURE__ */ React17__namespace.createElement("div", { className: "h-8 w-8", "aria-hidden": "true" }), /* @__PURE__ */ React17__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), controls?.next ? /* @__PURE__ */ React17__namespace.createElement(
|
|
2390
2604
|
"button",
|
|
2391
2605
|
{
|
|
2392
2606
|
type: "button",
|
|
@@ -2395,13 +2609,13 @@ function DateRangePicker({
|
|
|
2395
2609
|
"aria-label": "Next month"
|
|
2396
2610
|
},
|
|
2397
2611
|
"\u203A"
|
|
2398
|
-
) : /* @__PURE__ */
|
|
2612
|
+
) : /* @__PURE__ */ React17__namespace.createElement("div", { className: "h-8 w-8", "aria-hidden": "true" })), /* @__PURE__ */ React17__namespace.createElement(
|
|
2399
2613
|
"div",
|
|
2400
2614
|
{
|
|
2401
2615
|
className: "grid gap-1 text-xs text-muted-foreground",
|
|
2402
2616
|
style: dayGridStyle
|
|
2403
2617
|
},
|
|
2404
|
-
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */
|
|
2618
|
+
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */ React17__namespace.createElement(
|
|
2405
2619
|
"div",
|
|
2406
2620
|
{
|
|
2407
2621
|
key: `${month}-${day}`,
|
|
@@ -2409,9 +2623,9 @@ function DateRangePicker({
|
|
|
2409
2623
|
},
|
|
2410
2624
|
day
|
|
2411
2625
|
))
|
|
2412
|
-
), /* @__PURE__ */
|
|
2626
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "grid gap-1", style: dayGridStyle }, days.map((date, index) => {
|
|
2413
2627
|
if (!date) {
|
|
2414
|
-
return /* @__PURE__ */
|
|
2628
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { key: `empty-${month}-${index}`, className: "h-8 w-8" });
|
|
2415
2629
|
}
|
|
2416
2630
|
const isStart = rangeStart && date.toDateString() === rangeStart.toDateString();
|
|
2417
2631
|
const isEnd = rangeEnd && date.toDateString() === rangeEnd.toDateString();
|
|
@@ -2423,7 +2637,7 @@ function DateRangePicker({
|
|
|
2423
2637
|
);
|
|
2424
2638
|
const isToday = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
2425
2639
|
const disabled2 = isDisabled(date);
|
|
2426
|
-
return /* @__PURE__ */
|
|
2640
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
2427
2641
|
"button",
|
|
2428
2642
|
{
|
|
2429
2643
|
key: date.toISOString(),
|
|
@@ -2448,27 +2662,27 @@ function DateRangePicker({
|
|
|
2448
2662
|
};
|
|
2449
2663
|
const combinedClassName = cn("relative", className);
|
|
2450
2664
|
const displayValue = rangeStart && rangeEnd ? `${formatDate2(rangeStart, format)}${separator}${formatDate2(rangeEnd, format)}` : rangeStart ? formatDate2(rangeStart, format) : "";
|
|
2451
|
-
return /* @__PURE__ */
|
|
2665
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: combinedClassName, onBlur: handleBlur }, /* @__PURE__ */ React17__namespace.createElement(
|
|
2452
2666
|
"input",
|
|
2453
2667
|
{
|
|
2454
2668
|
type: "hidden",
|
|
2455
2669
|
name: `${name}[start]`,
|
|
2456
2670
|
value: rangeStart ? rangeStart.toISOString() : ""
|
|
2457
2671
|
}
|
|
2458
|
-
), /* @__PURE__ */
|
|
2672
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
2459
2673
|
"input",
|
|
2460
2674
|
{
|
|
2461
2675
|
type: "hidden",
|
|
2462
2676
|
name: `${name}[end]`,
|
|
2463
2677
|
value: rangeEnd ? rangeEnd.toISOString() : ""
|
|
2464
2678
|
}
|
|
2465
|
-
), /* @__PURE__ */
|
|
2679
|
+
), /* @__PURE__ */ React17__namespace.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React17__namespace.createElement(
|
|
2466
2680
|
"span",
|
|
2467
2681
|
{
|
|
2468
2682
|
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
2469
2683
|
"aria-hidden": "true"
|
|
2470
2684
|
},
|
|
2471
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ React17__namespace.createElement(
|
|
2472
2686
|
"svg",
|
|
2473
2687
|
{
|
|
2474
2688
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2481,9 +2695,9 @@ function DateRangePicker({
|
|
|
2481
2695
|
strokeLinejoin: "round",
|
|
2482
2696
|
strokeWidth: "2"
|
|
2483
2697
|
},
|
|
2484
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ React17__namespace.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" })
|
|
2485
2699
|
)
|
|
2486
|
-
), /* @__PURE__ */
|
|
2700
|
+
), /* @__PURE__ */ React17__namespace.createElement(
|
|
2487
2701
|
"input",
|
|
2488
2702
|
{
|
|
2489
2703
|
ref: triggerRef,
|
|
@@ -2508,7 +2722,7 @@ function DateRangePicker({
|
|
|
2508
2722
|
"aria-required": required || props["aria-required"],
|
|
2509
2723
|
readOnly: true
|
|
2510
2724
|
}
|
|
2511
|
-
), clearable && (rangeStart || rangeEnd) && !disabled && /* @__PURE__ */
|
|
2725
|
+
), clearable && (rangeStart || rangeEnd) && !disabled && /* @__PURE__ */ React17__namespace.createElement(
|
|
2512
2726
|
"button",
|
|
2513
2727
|
{
|
|
2514
2728
|
type: "button",
|
|
@@ -2518,14 +2732,14 @@ function DateRangePicker({
|
|
|
2518
2732
|
tabIndex: -1
|
|
2519
2733
|
},
|
|
2520
2734
|
"\u2715"
|
|
2521
|
-
)), isOpen && !disabled && /* @__PURE__ */
|
|
2735
|
+
)), isOpen && !disabled && /* @__PURE__ */ React17__namespace.createElement(
|
|
2522
2736
|
"div",
|
|
2523
2737
|
{
|
|
2524
2738
|
ref: dropdownRef,
|
|
2525
2739
|
className: "absolute z-50 top-full mt-1 w-fit rounded-md border border-border bg-popover text-popover-foreground shadow-md p-3"
|
|
2526
2740
|
},
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
rangeStart && !rangeEnd && /* @__PURE__ */
|
|
2741
|
+
/* @__PURE__ */ React17__namespace.createElement("div", { role: "grid", "aria-label": "Calendar" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "grid gap-4", style: monthsGridStyle }, renderMonth(selectedMonth, { prev: true }), renderMonth(addMonths(selectedMonth, 1), { next: true }))),
|
|
2742
|
+
rangeStart && !rangeEnd && /* @__PURE__ */ React17__namespace.createElement("div", { className: "text-xs text-center pt-2 border-t border-border mt-2" }, "Select end date")
|
|
2529
2743
|
));
|
|
2530
2744
|
}
|
|
2531
2745
|
DateRangePicker.displayName = "DateRangePicker";
|
|
@@ -2597,11 +2811,11 @@ function RichTextEditor({
|
|
|
2597
2811
|
],
|
|
2598
2812
|
...props
|
|
2599
2813
|
}) {
|
|
2600
|
-
const [currentMode, setCurrentMode] =
|
|
2601
|
-
const [content, setContent] =
|
|
2602
|
-
const editorRef =
|
|
2603
|
-
const textareaRef =
|
|
2604
|
-
|
|
2814
|
+
const [currentMode, setCurrentMode] = React17__namespace.useState(mode);
|
|
2815
|
+
const [content, setContent] = React17__namespace.useState(value);
|
|
2816
|
+
const editorRef = React17__namespace.useRef(null);
|
|
2817
|
+
const textareaRef = React17__namespace.useRef(null);
|
|
2818
|
+
React17__namespace.useEffect(() => {
|
|
2605
2819
|
setContent(value);
|
|
2606
2820
|
if (currentMode === "wysiwyg" && editorRef.current) {
|
|
2607
2821
|
editorRef.current.innerHTML = value;
|
|
@@ -2689,7 +2903,7 @@ function RichTextEditor({
|
|
|
2689
2903
|
}
|
|
2690
2904
|
}
|
|
2691
2905
|
};
|
|
2692
|
-
const hasValue =
|
|
2906
|
+
const hasValue = React17__namespace.useMemo(() => {
|
|
2693
2907
|
if (!content) return false;
|
|
2694
2908
|
const stripped = content.replace(/<[^>]+>/g, "").trim();
|
|
2695
2909
|
return stripped.length > 0;
|
|
@@ -2706,10 +2920,10 @@ function RichTextEditor({
|
|
|
2706
2920
|
maxHeight,
|
|
2707
2921
|
overflowY: maxHeight ? "auto" : void 0
|
|
2708
2922
|
};
|
|
2709
|
-
return /* @__PURE__ */
|
|
2923
|
+
return /* @__PURE__ */ React17__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React17__namespace.createElement("input", { type: "hidden", name, value: content }), showToolbar && /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center justify-between p-2 border-b border-border bg-muted/50" }, /* @__PURE__ */ React17__namespace.createElement("div", { className: "flex items-center gap-1" }, toolbarButtons.map((buttonName) => {
|
|
2710
2924
|
const button = toolbarConfig[buttonName];
|
|
2711
2925
|
if (!button) return null;
|
|
2712
|
-
return /* @__PURE__ */
|
|
2926
|
+
return /* @__PURE__ */ React17__namespace.createElement(
|
|
2713
2927
|
"button",
|
|
2714
2928
|
{
|
|
2715
2929
|
key: buttonName,
|
|
@@ -2722,7 +2936,7 @@ function RichTextEditor({
|
|
|
2722
2936
|
},
|
|
2723
2937
|
button.icon
|
|
2724
2938
|
);
|
|
2725
|
-
})), allowModeSwitch && /* @__PURE__ */
|
|
2939
|
+
})), allowModeSwitch && /* @__PURE__ */ React17__namespace.createElement(
|
|
2726
2940
|
"button",
|
|
2727
2941
|
{
|
|
2728
2942
|
type: "button",
|
|
@@ -2733,7 +2947,7 @@ function RichTextEditor({
|
|
|
2733
2947
|
"aria-label": `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`
|
|
2734
2948
|
},
|
|
2735
2949
|
currentMode === "wysiwyg" ? "MD" : "WYSIWYG"
|
|
2736
|
-
)), /* @__PURE__ */
|
|
2950
|
+
)), /* @__PURE__ */ React17__namespace.createElement("div", { style: editorStyle }, currentMode === "wysiwyg" ? /* @__PURE__ */ React17__namespace.createElement(
|
|
2737
2951
|
"div",
|
|
2738
2952
|
{
|
|
2739
2953
|
ref: editorRef,
|
|
@@ -2748,7 +2962,7 @@ function RichTextEditor({
|
|
|
2748
2962
|
"aria-required": required || props["aria-required"],
|
|
2749
2963
|
suppressContentEditableWarning: true
|
|
2750
2964
|
}
|
|
2751
|
-
) : /* @__PURE__ */
|
|
2965
|
+
) : /* @__PURE__ */ React17__namespace.createElement(
|
|
2752
2966
|
"textarea",
|
|
2753
2967
|
{
|
|
2754
2968
|
ref: textareaRef,
|
|
@@ -2771,7 +2985,7 @@ function RichTextEditor({
|
|
|
2771
2985
|
}
|
|
2772
2986
|
RichTextEditor.displayName = "RichTextEditor";
|
|
2773
2987
|
|
|
2774
|
-
exports.Checkbox =
|
|
2988
|
+
exports.Checkbox = Checkbox2;
|
|
2775
2989
|
exports.CheckboxGroup = CheckboxGroup;
|
|
2776
2990
|
exports.DatePicker = DatePicker;
|
|
2777
2991
|
exports.DateRangePicker = DateRangePicker;
|
|
@@ -2779,7 +2993,8 @@ exports.FileInput = FileInput;
|
|
|
2779
2993
|
exports.MultiSelect = MultiSelect;
|
|
2780
2994
|
exports.Radio = Radio;
|
|
2781
2995
|
exports.RichTextEditor = RichTextEditor;
|
|
2782
|
-
exports.Select =
|
|
2996
|
+
exports.Select = Select2;
|
|
2997
|
+
exports.Switch = Switch2;
|
|
2783
2998
|
exports.TextArea = TextArea;
|
|
2784
2999
|
exports.TextInput = TextInput;
|
|
2785
3000
|
exports.TimePicker = TimePicker;
|