@page-speed/forms 0.3.7 → 0.4.2
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 +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +2 -2
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/inputs.cjs +335 -237
- package/dist/inputs.cjs.map +1 -1
- package/dist/inputs.d.cts +13 -2
- package/dist/inputs.d.ts +13 -2
- package/dist/inputs.js +335 -237
- package/dist/inputs.js.map +1 -1
- package/package.json +4 -2
package/dist/inputs.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React7 = require('react');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
4
6
|
|
|
5
7
|
function _interopNamespace(e) {
|
|
6
8
|
if (e && e.__esModule) return e;
|
|
@@ -43,8 +45,8 @@ function TextInput({
|
|
|
43
45
|
const handleBlur = () => {
|
|
44
46
|
onBlur?.();
|
|
45
47
|
};
|
|
46
|
-
const baseClassName = "text-
|
|
47
|
-
const errorClassName = error ? "
|
|
48
|
+
const baseClassName = "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm";
|
|
49
|
+
const errorClassName = error ? "border-red-500 ring-1 ring-red-500" : "";
|
|
48
50
|
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
49
51
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
50
52
|
"input",
|
|
@@ -90,8 +92,8 @@ function TextArea({
|
|
|
90
92
|
const handleBlur = () => {
|
|
91
93
|
onBlur?.();
|
|
92
94
|
};
|
|
93
|
-
const baseClassName = "
|
|
94
|
-
const errorClassName = error ? "
|
|
95
|
+
const baseClassName = "flex min-h-20 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm";
|
|
96
|
+
const errorClassName = error ? "border-red-500 ring-1 ring-red-500" : "";
|
|
95
97
|
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
96
98
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
97
99
|
"textarea",
|
|
@@ -117,6 +119,11 @@ function TextArea({
|
|
|
117
119
|
);
|
|
118
120
|
}
|
|
119
121
|
TextArea.displayName = "TextArea";
|
|
122
|
+
function cn(...inputs) {
|
|
123
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/inputs/Checkbox.tsx
|
|
120
127
|
function Checkbox({
|
|
121
128
|
name,
|
|
122
129
|
value,
|
|
@@ -129,6 +136,7 @@ function Checkbox({
|
|
|
129
136
|
indeterminate = false,
|
|
130
137
|
label,
|
|
131
138
|
description,
|
|
139
|
+
checkboxVariant = "boxed",
|
|
132
140
|
...props
|
|
133
141
|
}) {
|
|
134
142
|
const inputRef = React7__namespace.useRef(null);
|
|
@@ -144,39 +152,97 @@ function Checkbox({
|
|
|
144
152
|
const handleBlur = () => {
|
|
145
153
|
onBlur?.();
|
|
146
154
|
};
|
|
147
|
-
const
|
|
148
|
-
const errorClassName = error ? "checkbox--error" : "";
|
|
149
|
-
const checkedClassName = value ? "checkbox--checked" : "";
|
|
150
|
-
const disabledClassName = disabled ? "checkbox--disabled" : "";
|
|
151
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${checkedClassName} ${disabledClassName} ${className}`.trim();
|
|
155
|
+
const isActive = value || indeterminate && !value;
|
|
152
156
|
const checkbox = /* @__PURE__ */ React7__namespace.createElement(
|
|
153
|
-
"
|
|
157
|
+
"div",
|
|
154
158
|
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
159
|
+
className: cn(
|
|
160
|
+
"relative inline-flex items-center justify-center",
|
|
161
|
+
!label && className
|
|
162
|
+
)
|
|
163
|
+
},
|
|
164
|
+
/* @__PURE__ */ React7__namespace.createElement(
|
|
165
|
+
"input",
|
|
166
|
+
{
|
|
167
|
+
ref: inputRef,
|
|
168
|
+
type: "checkbox",
|
|
169
|
+
id: checkboxId,
|
|
170
|
+
name,
|
|
171
|
+
checked: value,
|
|
172
|
+
onChange: handleChange,
|
|
173
|
+
onBlur: handleBlur,
|
|
174
|
+
disabled,
|
|
175
|
+
required,
|
|
176
|
+
className: "peer sr-only",
|
|
177
|
+
"aria-invalid": error || props["aria-invalid"],
|
|
178
|
+
"aria-describedby": description ? `${checkboxId}-description` : props["aria-describedby"],
|
|
179
|
+
"aria-required": required || props["aria-required"],
|
|
180
|
+
...props
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ React7__namespace.createElement(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
className: cn(
|
|
187
|
+
"flex shrink-0 items-center justify-center rounded-full border-2 transition-colors size-6",
|
|
188
|
+
!error && isActive && "border-primary bg-primary text-primary-foreground",
|
|
189
|
+
!error && !isActive && "border-input bg-transparent",
|
|
190
|
+
error && isActive && "border-destructive bg-destructive text-destructive-foreground",
|
|
191
|
+
error && !isActive && "border-destructive bg-transparent",
|
|
192
|
+
disabled && "opacity-50",
|
|
193
|
+
"peer-focus-visible:ring-2 peer-focus-visible:ring-ring/50 peer-focus-visible:ring-offset-1"
|
|
194
|
+
)
|
|
195
|
+
},
|
|
196
|
+
value && /* @__PURE__ */ React7__namespace.createElement(
|
|
197
|
+
"svg",
|
|
198
|
+
{
|
|
199
|
+
className: "size-3.5",
|
|
200
|
+
viewBox: "0 0 24 24",
|
|
201
|
+
fill: "none",
|
|
202
|
+
stroke: "currentColor",
|
|
203
|
+
strokeWidth: "3",
|
|
204
|
+
strokeLinecap: "round",
|
|
205
|
+
strokeLinejoin: "round"
|
|
206
|
+
},
|
|
207
|
+
/* @__PURE__ */ React7__namespace.createElement("polyline", { points: "20 6 9 17 4 12" })
|
|
208
|
+
),
|
|
209
|
+
indeterminate && !value && /* @__PURE__ */ React7__namespace.createElement(
|
|
210
|
+
"svg",
|
|
211
|
+
{
|
|
212
|
+
className: "size-3.5",
|
|
213
|
+
viewBox: "0 0 24 24",
|
|
214
|
+
fill: "none",
|
|
215
|
+
stroke: "currentColor",
|
|
216
|
+
strokeWidth: "3",
|
|
217
|
+
strokeLinecap: "round",
|
|
218
|
+
strokeLinejoin: "round"
|
|
219
|
+
},
|
|
220
|
+
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
221
|
+
)
|
|
222
|
+
)
|
|
170
223
|
);
|
|
171
224
|
if (label) {
|
|
172
|
-
return /* @__PURE__ */ React7__namespace.createElement(
|
|
173
|
-
"
|
|
225
|
+
return /* @__PURE__ */ React7__namespace.createElement(
|
|
226
|
+
"label",
|
|
174
227
|
{
|
|
175
|
-
className:
|
|
176
|
-
|
|
228
|
+
className: cn(
|
|
229
|
+
"w-full h-full flex gap-3 p-3 duration-200",
|
|
230
|
+
checkboxVariant === "boxed" && "border rounded-lg hover:ring-2",
|
|
231
|
+
checkboxVariant === "boxed" && value && "ring-2",
|
|
232
|
+
disabled ? "opacity-50 cursor-not-allowed hover:ring-0" : "cursor-pointer",
|
|
233
|
+
className
|
|
234
|
+
),
|
|
235
|
+
htmlFor: checkboxId
|
|
177
236
|
},
|
|
178
|
-
description
|
|
179
|
-
|
|
237
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex w-full flex-row gap-2" }, checkbox, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col gap-0.5" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium" }, label), description && /* @__PURE__ */ React7__namespace.createElement(
|
|
238
|
+
"p",
|
|
239
|
+
{
|
|
240
|
+
className: "text-xs opacity-75",
|
|
241
|
+
id: `${checkboxId}-description`
|
|
242
|
+
},
|
|
243
|
+
description
|
|
244
|
+
)))
|
|
245
|
+
);
|
|
180
246
|
}
|
|
181
247
|
return checkbox;
|
|
182
248
|
}
|
|
@@ -209,6 +275,18 @@ function CheckboxGroup({
|
|
|
209
275
|
).length;
|
|
210
276
|
const allSelected = selectedEnabledCount === enabledOptions.length;
|
|
211
277
|
const someSelected = selectedEnabledCount > 0 && !allSelected;
|
|
278
|
+
const checkboxVariant = React7__namespace.useMemo(() => {
|
|
279
|
+
if (options.some((opt) => opt.description)) {
|
|
280
|
+
return "boxed";
|
|
281
|
+
}
|
|
282
|
+
return "inline";
|
|
283
|
+
}, [options]);
|
|
284
|
+
const countableValue = React7__namespace.useMemo(() => {
|
|
285
|
+
if (value?.length > 0) {
|
|
286
|
+
return value.length;
|
|
287
|
+
}
|
|
288
|
+
return 0;
|
|
289
|
+
}, [value]);
|
|
212
290
|
const handleChange = (optionValue, checked) => {
|
|
213
291
|
const newValues = checked ? [...value, optionValue] : value.filter((v) => v !== optionValue);
|
|
214
292
|
if (maxSelections && checked && newValues.length > maxSelections) {
|
|
@@ -227,15 +305,18 @@ function CheckboxGroup({
|
|
|
227
305
|
const handleBlur = () => {
|
|
228
306
|
onBlur?.();
|
|
229
307
|
};
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
308
|
+
const maxReached = Boolean(maxSelections && countableValue >= maxSelections);
|
|
309
|
+
const containerClass = cn(
|
|
310
|
+
"w-full gap-3",
|
|
311
|
+
layout === "stacked" && "flex flex-col",
|
|
312
|
+
layout === "inline" && "flex flex-row flex-wrap",
|
|
313
|
+
layout === "grid" && "grid",
|
|
314
|
+
className
|
|
315
|
+
);
|
|
235
316
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
236
317
|
"div",
|
|
237
318
|
{
|
|
238
|
-
className:
|
|
319
|
+
className: containerClass,
|
|
239
320
|
role: "group",
|
|
240
321
|
"aria-invalid": error || props["aria-invalid"],
|
|
241
322
|
"aria-describedby": props["aria-describedby"],
|
|
@@ -245,62 +326,56 @@ function CheckboxGroup({
|
|
|
245
326
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
246
327
|
} : void 0
|
|
247
328
|
},
|
|
248
|
-
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
249
|
-
description && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
250
|
-
|
|
251
|
-
|
|
329
|
+
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium" }, label),
|
|
330
|
+
description && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-muted-foreground text-sm" }, description),
|
|
331
|
+
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */ React7__namespace.createElement(
|
|
332
|
+
Checkbox,
|
|
252
333
|
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
input.indeterminate = someSelected;
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
onChange: (e) => handleSelectAll(e.target.checked),
|
|
334
|
+
name: `${name}-select-all`,
|
|
335
|
+
id: `${name}-select-all`,
|
|
336
|
+
value: allSelected,
|
|
337
|
+
onChange: handleSelectAll,
|
|
261
338
|
onBlur: handleBlur,
|
|
339
|
+
indeterminate: someSelected,
|
|
340
|
+
label: selectAllLabel,
|
|
341
|
+
checkboxVariant: "inline",
|
|
262
342
|
disabled,
|
|
263
|
-
className: "checkbox-input",
|
|
264
343
|
"aria-label": selectAllLabel
|
|
265
344
|
}
|
|
266
|
-
),
|
|
345
|
+
),
|
|
346
|
+
options.map((option) => {
|
|
267
347
|
const isChecked = value.includes(option.value);
|
|
268
348
|
const isDisabled = disabled || option.disabled || maxReached && !isChecked;
|
|
269
|
-
const checkboxId = `${name}-${option.value}`;
|
|
270
349
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
271
|
-
|
|
350
|
+
Checkbox,
|
|
272
351
|
{
|
|
273
352
|
key: option.value,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
onBlur: handleBlur,
|
|
287
|
-
disabled: isDisabled,
|
|
288
|
-
required: required && minSelections ? value.length < minSelections : false,
|
|
289
|
-
className: "checkbox-input",
|
|
290
|
-
"aria-describedby": option.description ? `${checkboxId}-description` : props["aria-describedby"]
|
|
291
|
-
}
|
|
292
|
-
),
|
|
293
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "checkbox-content" }, renderOption ? renderOption(option) : /* @__PURE__ */ React7__namespace.createElement(React7__namespace.Fragment, null, /* @__PURE__ */ React7__namespace.createElement("span", { className: "checkbox-label" }, option.label), option.description && /* @__PURE__ */ React7__namespace.createElement(
|
|
294
|
-
"span",
|
|
295
|
-
{
|
|
296
|
-
className: "checkbox-description",
|
|
297
|
-
id: `${checkboxId}-description`
|
|
298
|
-
},
|
|
299
|
-
option.description
|
|
300
|
-
)))
|
|
353
|
+
name,
|
|
354
|
+
id: `${name}-${option.value}`,
|
|
355
|
+
value: isChecked,
|
|
356
|
+
onChange: (checked) => handleChange(option.value, checked),
|
|
357
|
+
onBlur: handleBlur,
|
|
358
|
+
disabled: isDisabled,
|
|
359
|
+
required: required && minSelections ? value.length < minSelections : false,
|
|
360
|
+
error,
|
|
361
|
+
label: renderOption ? renderOption(option) : option.label,
|
|
362
|
+
description: renderOption ? void 0 : option.description,
|
|
363
|
+
checkboxVariant
|
|
364
|
+
}
|
|
301
365
|
);
|
|
302
|
-
})
|
|
303
|
-
(minSelections || maxSelections) && /* @__PURE__ */ React7__namespace.createElement(
|
|
366
|
+
}),
|
|
367
|
+
(minSelections || maxSelections) && /* @__PURE__ */ React7__namespace.createElement(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
className: cn(
|
|
371
|
+
"text-sm p-2 rounded-lg border font-semibold mt-2",
|
|
372
|
+
minSelections && countableValue < minSelections ? "border-destructive bg-destructive/80 text-destructive-foreground" : "border-border bg-card text-card-foreground"
|
|
373
|
+
),
|
|
374
|
+
"aria-live": "polite"
|
|
375
|
+
},
|
|
376
|
+
minSelections && countableValue < minSelections && /* @__PURE__ */ React7__namespace.createElement("span", null, "Select at least ", minSelections, " option", minSelections !== 1 ? "s" : ""),
|
|
377
|
+
maxSelections && /* @__PURE__ */ React7__namespace.createElement("span", null, countableValue, "/", maxSelections, " selected")
|
|
378
|
+
)
|
|
304
379
|
);
|
|
305
380
|
}
|
|
306
381
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
@@ -314,6 +389,7 @@ function Radio({
|
|
|
314
389
|
error = false,
|
|
315
390
|
className = "",
|
|
316
391
|
layout = "stacked",
|
|
392
|
+
radioVariant = "inline",
|
|
317
393
|
label,
|
|
318
394
|
options,
|
|
319
395
|
...props
|
|
@@ -349,59 +425,83 @@ function Radio({
|
|
|
349
425
|
const handleBlur = () => {
|
|
350
426
|
onBlur?.();
|
|
351
427
|
};
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
428
|
+
const containerClass = cn(
|
|
429
|
+
"w-full gap-3",
|
|
430
|
+
layout === "stacked" && "flex flex-col",
|
|
431
|
+
layout === "inline" && "flex flex-row flex-wrap",
|
|
432
|
+
className
|
|
433
|
+
);
|
|
356
434
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
357
435
|
"div",
|
|
358
436
|
{
|
|
359
|
-
className:
|
|
437
|
+
className: containerClass,
|
|
360
438
|
role: "radiogroup",
|
|
361
439
|
"aria-invalid": error || props["aria-invalid"],
|
|
362
440
|
"aria-describedby": props["aria-describedby"],
|
|
363
441
|
"aria-required": required || props["aria-required"],
|
|
364
442
|
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
365
443
|
},
|
|
366
|
-
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
367
|
-
|
|
444
|
+
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium mb-2" }, label),
|
|
445
|
+
options.map((option, index) => {
|
|
368
446
|
const isChecked = value === option.value;
|
|
369
447
|
const isDisabled = disabled || option.disabled;
|
|
370
448
|
const radioId = `${name}-${option.value}`;
|
|
449
|
+
const hasDescription = option.description != null && option.description !== "";
|
|
450
|
+
const radioIndicator = /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative inline-flex items-center justify-center" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
451
|
+
"input",
|
|
452
|
+
{
|
|
453
|
+
type: "radio",
|
|
454
|
+
id: radioId,
|
|
455
|
+
name,
|
|
456
|
+
value: option.value,
|
|
457
|
+
checked: isChecked,
|
|
458
|
+
onChange: (e) => handleChange(e.target.value),
|
|
459
|
+
onBlur: handleBlur,
|
|
460
|
+
disabled: isDisabled,
|
|
461
|
+
required,
|
|
462
|
+
className: "peer sr-only",
|
|
463
|
+
"aria-describedby": hasDescription ? `${radioId}-description` : props["aria-describedby"]
|
|
464
|
+
}
|
|
465
|
+
), /* @__PURE__ */ React7__namespace.createElement(
|
|
466
|
+
"div",
|
|
467
|
+
{
|
|
468
|
+
className: cn(
|
|
469
|
+
"flex shrink-0 items-center justify-center rounded-full border-2 transition-colors size-6",
|
|
470
|
+
!error && isChecked && "border-primary bg-transparent",
|
|
471
|
+
!error && !isChecked && "border-input bg-transparent",
|
|
472
|
+
error && isChecked && "border-destructive bg-transparent",
|
|
473
|
+
error && !isChecked && "border-destructive bg-transparent",
|
|
474
|
+
isDisabled && "opacity-50",
|
|
475
|
+
"peer-focus-visible:ring-2 peer-focus-visible:ring-ring/50 peer-focus-visible:ring-offset-1"
|
|
476
|
+
)
|
|
477
|
+
},
|
|
478
|
+
isChecked && /* @__PURE__ */ React7__namespace.createElement("div", { className: "size-3 rounded-full bg-primary" })
|
|
479
|
+
));
|
|
480
|
+
const labelContent = /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col gap-0.5" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium" }, option.label), hasDescription && /* @__PURE__ */ React7__namespace.createElement(
|
|
481
|
+
"p",
|
|
482
|
+
{
|
|
483
|
+
className: "text-xs opacity-75",
|
|
484
|
+
id: `${radioId}-description`
|
|
485
|
+
},
|
|
486
|
+
option.description
|
|
487
|
+
));
|
|
371
488
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
372
489
|
"label",
|
|
373
490
|
{
|
|
374
491
|
key: option.value,
|
|
375
|
-
className:
|
|
492
|
+
className: cn(
|
|
493
|
+
"w-full h-full flex gap-3 p-3 duration-200",
|
|
494
|
+
radioVariant === "boxed" && "border rounded-lg hover:ring-2",
|
|
495
|
+
radioVariant === "boxed" && isChecked && "ring-2",
|
|
496
|
+
isDisabled ? "opacity-50 cursor-not-allowed hover:ring-0" : "cursor-pointer"
|
|
497
|
+
),
|
|
376
498
|
htmlFor: radioId,
|
|
377
499
|
onKeyDown: (e) => handleKeyDown(e, index),
|
|
378
|
-
tabIndex: 0
|
|
500
|
+
tabIndex: isDisabled ? -1 : 0
|
|
379
501
|
},
|
|
380
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
381
|
-
"span",
|
|
382
|
-
{
|
|
383
|
-
className: "radio-description",
|
|
384
|
-
id: `${radioId}-description`
|
|
385
|
-
},
|
|
386
|
-
option.description
|
|
387
|
-
)), /* @__PURE__ */ React7__namespace.createElement(
|
|
388
|
-
"input",
|
|
389
|
-
{
|
|
390
|
-
type: "radio",
|
|
391
|
-
id: radioId,
|
|
392
|
-
name,
|
|
393
|
-
value: option.value,
|
|
394
|
-
checked: isChecked,
|
|
395
|
-
onChange: (e) => handleChange(e.target.value),
|
|
396
|
-
onBlur: handleBlur,
|
|
397
|
-
disabled: isDisabled,
|
|
398
|
-
required,
|
|
399
|
-
className: "radio-input",
|
|
400
|
-
"aria-describedby": option.description ? `${radioId}-description` : props["aria-describedby"]
|
|
401
|
-
}
|
|
402
|
-
))
|
|
502
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, radioVariant === "inline" && radioIndicator, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, labelContent), radioVariant === "boxed" && radioIndicator)
|
|
403
503
|
);
|
|
404
|
-
})
|
|
504
|
+
})
|
|
405
505
|
);
|
|
406
506
|
}
|
|
407
507
|
Radio.displayName = "Radio";
|
|
@@ -566,11 +666,7 @@ function Select({
|
|
|
566
666
|
};
|
|
567
667
|
}
|
|
568
668
|
}, [isOpen]);
|
|
569
|
-
const
|
|
570
|
-
const errorClassName = error ? "select--error" : "";
|
|
571
|
-
const disabledClassName = disabled ? "select--disabled" : "";
|
|
572
|
-
const openClassName = isOpen ? "select--open" : "";
|
|
573
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
669
|
+
const combinedClassName = `relative w-full ${className}`.trim();
|
|
574
670
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
575
671
|
"div",
|
|
576
672
|
{
|
|
@@ -598,7 +694,7 @@ function Select({
|
|
|
598
694
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
599
695
|
"div",
|
|
600
696
|
{
|
|
601
|
-
className: "
|
|
697
|
+
className: `flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm cursor-pointer transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring ${disabled ? "cursor-not-allowed opacity-50 pointer-events-none" : ""} ${error ? "border-red-500 ring-1 ring-red-500" : ""}`,
|
|
602
698
|
onClick: handleToggle,
|
|
603
699
|
role: "combobox",
|
|
604
700
|
"aria-expanded": isOpen,
|
|
@@ -609,39 +705,39 @@ function Select({
|
|
|
609
705
|
"aria-disabled": disabled,
|
|
610
706
|
tabIndex: disabled ? -1 : 0
|
|
611
707
|
},
|
|
612
|
-
/* @__PURE__ */ React7__namespace.createElement("span", { className: "
|
|
613
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
708
|
+
/* @__PURE__ */ React7__namespace.createElement("span", { className: "flex items-center flex-1 overflow-hidden text-ellipsis" }, selectedOption ? renderOption ? renderOption(selectedOption) : selectedOption.label : /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-muted-foreground" }, placeholder)),
|
|
709
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-1 ml-2" }, loading && /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-xs" }, "\u23F3"), clearable && value && !disabled && !loading && /* @__PURE__ */ React7__namespace.createElement(
|
|
614
710
|
"button",
|
|
615
711
|
{
|
|
616
712
|
type: "button",
|
|
617
|
-
className: "
|
|
713
|
+
className: "flex items-center justify-center h-4 w-4 rounded-sm border-none bg-transparent text-muted-foreground cursor-pointer text-xs p-0 transition-opacity hover:opacity-70",
|
|
618
714
|
onClick: handleClear,
|
|
619
715
|
"aria-label": "Clear selection",
|
|
620
716
|
tabIndex: -1
|
|
621
717
|
},
|
|
622
718
|
"\u2715"
|
|
623
|
-
), /* @__PURE__ */ React7__namespace.createElement("span", { className: "
|
|
719
|
+
), /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-muted-foreground text-xs leading-none", "aria-hidden": "true" }, isOpen ? "\u25B2" : "\u25BC"))
|
|
624
720
|
),
|
|
625
|
-
isOpen && /* @__PURE__ */ React7__namespace.createElement("div", { id: dropdownId, className: "
|
|
721
|
+
isOpen && /* @__PURE__ */ React7__namespace.createElement("div", { id: dropdownId, 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", role: "listbox" }, searchable && /* @__PURE__ */ React7__namespace.createElement("div", { className: "p-2 border-b border-border" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
626
722
|
"input",
|
|
627
723
|
{
|
|
628
724
|
ref: searchInputRef,
|
|
629
725
|
type: "text",
|
|
630
|
-
className: "
|
|
726
|
+
className: "w-full border border-input rounded px-2 py-1 text-sm bg-transparent outline-none focus:ring-1 focus:ring-ring",
|
|
631
727
|
placeholder: "Search...",
|
|
632
728
|
value: searchQuery,
|
|
633
729
|
onChange: handleSearchChange,
|
|
634
730
|
onClick: (e) => e.stopPropagation(),
|
|
635
731
|
"aria-label": "Search options"
|
|
636
732
|
}
|
|
637
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
733
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "max-h-64 overflow-y-auto p-1" }, filteredOptions.length === 0 ? /* @__PURE__ */ React7__namespace.createElement("div", { className: "py-2 px-3 text-center text-sm text-muted-foreground" }, "No options found") : optionGroups.length > 0 ? (
|
|
638
734
|
// Render grouped options
|
|
639
735
|
optionGroups.map((group, groupIndex) => {
|
|
640
736
|
const groupOptions = group.options.filter(
|
|
641
737
|
(opt) => filteredOptions.includes(opt)
|
|
642
738
|
);
|
|
643
739
|
if (groupOptions.length === 0) return null;
|
|
644
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: groupIndex, className: "
|
|
740
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: groupIndex, className: "py-1" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "py-1.5 px-2 text-xs font-semibold text-muted-foreground" }, group.label), groupOptions.map((option) => {
|
|
645
741
|
const globalIndex = filteredOptions.indexOf(option);
|
|
646
742
|
const isSelected = value === option.value;
|
|
647
743
|
const isFocused = globalIndex === focusedIndex;
|
|
@@ -650,7 +746,7 @@ function Select({
|
|
|
650
746
|
"div",
|
|
651
747
|
{
|
|
652
748
|
key: option.value,
|
|
653
|
-
className: `
|
|
749
|
+
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-accent hover:text-accent-foreground ${isFocused ? "bg-accent text-accent-foreground" : ""} ${isSelected ? "font-medium bg-accent" : ""} ${isDisabled ? "pointer-events-none opacity-50" : ""}`,
|
|
654
750
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
655
751
|
role: "option",
|
|
656
752
|
"aria-selected": isSelected,
|
|
@@ -670,7 +766,7 @@ function Select({
|
|
|
670
766
|
"div",
|
|
671
767
|
{
|
|
672
768
|
key: option.value,
|
|
673
|
-
className: `
|
|
769
|
+
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-accent hover:text-accent-foreground ${isFocused ? "bg-accent text-accent-foreground" : ""} ${isSelected ? "font-medium bg-accent" : ""} ${isDisabled ? "pointer-events-none opacity-50" : ""}`,
|
|
674
770
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
675
771
|
role: "option",
|
|
676
772
|
"aria-selected": isSelected,
|
|
@@ -950,11 +1046,7 @@ function FileInput({
|
|
|
950
1046
|
}
|
|
951
1047
|
};
|
|
952
1048
|
}, [value, imageToCrop]);
|
|
953
|
-
const
|
|
954
|
-
const errorClassName = error ? "file-input--error" : "";
|
|
955
|
-
const dragClassName = dragActive ? "file-input--drag-active" : "";
|
|
956
|
-
const disabledClassName = disabled ? "file-input--disabled" : "";
|
|
957
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${dragClassName} ${disabledClassName} ${className}`.trim();
|
|
1049
|
+
const combinedClassName = `${className}`.trim();
|
|
958
1050
|
return /* @__PURE__ */ React7__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
959
1051
|
"input",
|
|
960
1052
|
{
|
|
@@ -967,7 +1059,6 @@ function FileInput({
|
|
|
967
1059
|
multiple,
|
|
968
1060
|
disabled,
|
|
969
1061
|
required: required && value.length === 0,
|
|
970
|
-
className: "file-input__native",
|
|
971
1062
|
"aria-invalid": error || props["aria-invalid"],
|
|
972
1063
|
"aria-describedby": props["aria-describedby"],
|
|
973
1064
|
"aria-required": required || props["aria-required"],
|
|
@@ -976,7 +1067,7 @@ function FileInput({
|
|
|
976
1067
|
), /* @__PURE__ */ React7__namespace.createElement(
|
|
977
1068
|
"div",
|
|
978
1069
|
{
|
|
979
|
-
className: "
|
|
1070
|
+
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-accent/50 hover:border-ring ${dragActive ? "bg-accent border-ring" : ""} ${disabled ? "cursor-not-allowed opacity-50" : ""} ${error ? "border-red-500" : ""}`,
|
|
980
1071
|
onDragEnter: handleDrag,
|
|
981
1072
|
onDragLeave: handleDrag,
|
|
982
1073
|
onDragOver: handleDrag,
|
|
@@ -988,10 +1079,10 @@ function FileInput({
|
|
|
988
1079
|
"aria-label": placeholder,
|
|
989
1080
|
"aria-disabled": disabled
|
|
990
1081
|
},
|
|
991
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1082
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col items-center gap-2 text-center" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
992
1083
|
"svg",
|
|
993
1084
|
{
|
|
994
|
-
className: "
|
|
1085
|
+
className: "text-muted-foreground",
|
|
995
1086
|
width: "48",
|
|
996
1087
|
height: "48",
|
|
997
1088
|
viewBox: "0 0 24 24",
|
|
@@ -1005,30 +1096,36 @@ function FileInput({
|
|
|
1005
1096
|
/* @__PURE__ */ React7__namespace.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1006
1097
|
/* @__PURE__ */ React7__namespace.createElement("polyline", { points: "17 8 12 3 7 8" }),
|
|
1007
1098
|
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
1008
|
-
), /* @__PURE__ */ React7__namespace.createElement("p", { className: "
|
|
1009
|
-
), value.length > 0 && /* @__PURE__ */ React7__namespace.createElement("ul", { className: "
|
|
1099
|
+
), /* @__PURE__ */ React7__namespace.createElement("p", { className: "text-sm font-medium" }, value.length > 0 ? `${value.length} file(s) selected` : placeholder), accept && /* @__PURE__ */ React7__namespace.createElement("p", { className: "text-xs text-muted-foreground" }, "Accepted: ", accept), maxSize && /* @__PURE__ */ React7__namespace.createElement("p", { className: "text-xs text-muted-foreground" }, "Max size: ", formatFileSize(maxSize)))
|
|
1100
|
+
), value.length > 0 && /* @__PURE__ */ React7__namespace.createElement("ul", { className: "flex flex-col gap-2 mt-4", role: "list" }, value.map((file, index) => {
|
|
1010
1101
|
const previewUrl = showPreview ? getPreviewUrl(file) : null;
|
|
1011
|
-
return /* @__PURE__ */ React7__namespace.createElement("li", { key: `${file.name}-${index}`, className: "
|
|
1102
|
+
return /* @__PURE__ */ React7__namespace.createElement("li", { key: `${file.name}-${index}`, className: "flex items-center gap-3 p-3 rounded-md border border-border bg-card hover:bg-accent/50 transition-colors" }, previewUrl && /* @__PURE__ */ React7__namespace.createElement(
|
|
1012
1103
|
"img",
|
|
1013
1104
|
{
|
|
1014
1105
|
src: previewUrl,
|
|
1015
1106
|
alt: file.name,
|
|
1016
|
-
className: "
|
|
1107
|
+
className: "w-12 h-12 rounded object-cover",
|
|
1017
1108
|
width: "48",
|
|
1018
1109
|
height: "48"
|
|
1019
1110
|
}
|
|
1020
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1111
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col flex-1 min-w-0" }, /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-sm font-medium truncate" }, file.name), /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-xs text-muted-foreground" }, formatFileSize(file.size)), showProgress && uploadProgress[file.name] !== void 0 && /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-2 mt-1" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1021
1112
|
"div",
|
|
1022
1113
|
{
|
|
1023
|
-
className: "
|
|
1024
|
-
style: { width: `${uploadProgress[file.name]}%` },
|
|
1114
|
+
className: "h-1.5 bg-muted rounded-full overflow-hidden flex-1",
|
|
1025
1115
|
role: "progressbar",
|
|
1026
1116
|
"aria-valuenow": uploadProgress[file.name],
|
|
1027
1117
|
"aria-valuemin": 0,
|
|
1028
1118
|
"aria-valuemax": 100,
|
|
1029
1119
|
"aria-label": `Upload progress: ${uploadProgress[file.name]}%`
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1120
|
+
},
|
|
1121
|
+
/* @__PURE__ */ React7__namespace.createElement(
|
|
1122
|
+
"div",
|
|
1123
|
+
{
|
|
1124
|
+
className: "h-full bg-primary transition-all",
|
|
1125
|
+
style: { width: `${uploadProgress[file.name]}%` }
|
|
1126
|
+
}
|
|
1127
|
+
)
|
|
1128
|
+
), /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-xs text-muted-foreground" }, uploadProgress[file.name], "%"))), enableCropping && file.type.startsWith("image/") && /* @__PURE__ */ React7__namespace.createElement(
|
|
1032
1129
|
"button",
|
|
1033
1130
|
{
|
|
1034
1131
|
type: "button",
|
|
@@ -1037,7 +1134,7 @@ function FileInput({
|
|
|
1037
1134
|
handleCrop(file);
|
|
1038
1135
|
},
|
|
1039
1136
|
disabled,
|
|
1040
|
-
className: "
|
|
1137
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
1041
1138
|
"aria-label": `Crop ${file.name}`
|
|
1042
1139
|
},
|
|
1043
1140
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1065,7 +1162,7 @@ function FileInput({
|
|
|
1065
1162
|
handleRemove(index);
|
|
1066
1163
|
},
|
|
1067
1164
|
disabled,
|
|
1068
|
-
className: "
|
|
1165
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
1069
1166
|
"aria-label": `Remove ${file.name}`
|
|
1070
1167
|
},
|
|
1071
1168
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1085,26 +1182,26 @@ function FileInput({
|
|
|
1085
1182
|
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1086
1183
|
)
|
|
1087
1184
|
));
|
|
1088
|
-
})), cropperOpen && imageToCrop && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1185
|
+
})), cropperOpen && imageToCrop && /* @__PURE__ */ React7__namespace.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1089
1186
|
"div",
|
|
1090
1187
|
{
|
|
1091
|
-
className: "
|
|
1188
|
+
className: "absolute inset-0 bg-black/50",
|
|
1092
1189
|
onClick: handleCropCancel,
|
|
1093
1190
|
"aria-label": "Close cropper"
|
|
1094
1191
|
}
|
|
1095
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1192
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative bg-popover border border-border rounded-lg shadow-lg max-w-3xl w-full mx-4" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center justify-between p-4 border-b border-border" }, /* @__PURE__ */ React7__namespace.createElement("h3", { className: "text-lg font-semibold" }, "Crop Image"), /* @__PURE__ */ React7__namespace.createElement(
|
|
1096
1193
|
"button",
|
|
1097
1194
|
{
|
|
1098
1195
|
type: "button",
|
|
1099
|
-
className: "
|
|
1196
|
+
className: "flex items-center justify-center h-8 w-8 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
1100
1197
|
onClick: handleCropCancel,
|
|
1101
1198
|
"aria-label": "Close"
|
|
1102
1199
|
},
|
|
1103
1200
|
"\u2715"
|
|
1104
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1201
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "p-4" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1105
1202
|
"div",
|
|
1106
1203
|
{
|
|
1107
|
-
className: "
|
|
1204
|
+
className: "relative w-full h-96 bg-muted rounded-md overflow-hidden",
|
|
1108
1205
|
onMouseDown: (e) => {
|
|
1109
1206
|
e.preventDefault();
|
|
1110
1207
|
const startX = e.clientX - crop.x;
|
|
@@ -1128,7 +1225,7 @@ function FileInput({
|
|
|
1128
1225
|
{
|
|
1129
1226
|
src: imageToCrop.url,
|
|
1130
1227
|
alt: "Crop preview",
|
|
1131
|
-
className: "
|
|
1228
|
+
className: "absolute inset-0 w-full h-full object-contain",
|
|
1132
1229
|
style: {
|
|
1133
1230
|
transform: `translate(${crop.x}px, ${crop.y}px) scale(${zoom})`
|
|
1134
1231
|
},
|
|
@@ -1158,15 +1255,15 @@ function FileInput({
|
|
|
1158
1255
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
1159
1256
|
"div",
|
|
1160
1257
|
{
|
|
1161
|
-
className: "
|
|
1258
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 border-2 border-primary rounded pointer-events-none",
|
|
1162
1259
|
style: {
|
|
1163
1260
|
width: cropAspectRatio ? `${Math.min(80, 80 * cropAspectRatio)}%` : "80%",
|
|
1164
1261
|
aspectRatio: cropAspectRatio ? String(cropAspectRatio) : void 0
|
|
1165
1262
|
}
|
|
1166
1263
|
},
|
|
1167
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1264
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "absolute inset-0 grid grid-cols-3 grid-rows-3" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React7__namespace.createElement("div", null))
|
|
1168
1265
|
)
|
|
1169
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1266
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-3 mt-4" }, /* @__PURE__ */ React7__namespace.createElement("label", { htmlFor: "zoom-slider", className: "text-sm font-medium whitespace-nowrap" }, "Zoom: ", zoom.toFixed(1), "x"), /* @__PURE__ */ React7__namespace.createElement(
|
|
1170
1267
|
"input",
|
|
1171
1268
|
{
|
|
1172
1269
|
id: "zoom-slider",
|
|
@@ -1176,14 +1273,14 @@ function FileInput({
|
|
|
1176
1273
|
step: "0.1",
|
|
1177
1274
|
value: zoom,
|
|
1178
1275
|
onChange: (e) => onZoomChange(parseFloat(e.target.value)),
|
|
1179
|
-
className: "
|
|
1276
|
+
className: "flex-1 h-2 bg-muted rounded-lg appearance-none cursor-pointer",
|
|
1180
1277
|
"aria-label": "Zoom level"
|
|
1181
1278
|
}
|
|
1182
|
-
))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1279
|
+
))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center justify-end gap-2 p-4 border-t border-border" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1183
1280
|
"button",
|
|
1184
1281
|
{
|
|
1185
1282
|
type: "button",
|
|
1186
|
-
className: "
|
|
1283
|
+
className: "inline-flex items-center justify-center h-9 rounded-md px-4 text-sm font-medium border border-input bg-transparent hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
1187
1284
|
onClick: handleCropCancel
|
|
1188
1285
|
},
|
|
1189
1286
|
"Cancel"
|
|
@@ -1191,7 +1288,7 @@ function FileInput({
|
|
|
1191
1288
|
"button",
|
|
1192
1289
|
{
|
|
1193
1290
|
type: "button",
|
|
1194
|
-
className: "
|
|
1291
|
+
className: "inline-flex items-center justify-center h-9 rounded-md px-4 text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",
|
|
1195
1292
|
onClick: handleCropSave
|
|
1196
1293
|
},
|
|
1197
1294
|
"Save"
|
|
@@ -1252,7 +1349,9 @@ function DatePicker({
|
|
|
1252
1349
|
}) {
|
|
1253
1350
|
const [isOpen, setIsOpen] = React7__namespace.useState(false);
|
|
1254
1351
|
const [inputValue, setInputValue] = React7__namespace.useState("");
|
|
1255
|
-
const [selectedMonth, setSelectedMonth] = React7__namespace.useState(
|
|
1352
|
+
const [selectedMonth, setSelectedMonth] = React7__namespace.useState(
|
|
1353
|
+
value || /* @__PURE__ */ new Date()
|
|
1354
|
+
);
|
|
1256
1355
|
const containerRef = React7__namespace.useRef(null);
|
|
1257
1356
|
const inputRef = React7__namespace.useRef(null);
|
|
1258
1357
|
React7__namespace.useEffect(() => {
|
|
@@ -1339,27 +1438,34 @@ function DatePicker({
|
|
|
1339
1438
|
const handleNextMonth = () => {
|
|
1340
1439
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1341
1440
|
};
|
|
1342
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
1441
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { role: "grid", "aria-label": "Calendar" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center justify-between pb-2 border-b border-border" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1343
1442
|
"button",
|
|
1344
1443
|
{
|
|
1345
1444
|
type: "button",
|
|
1346
|
-
className: "
|
|
1445
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-primary hover:text-primary-foreground cursor-pointer",
|
|
1347
1446
|
onClick: handlePrevMonth,
|
|
1348
1447
|
"aria-label": "Previous month"
|
|
1349
1448
|
},
|
|
1350
1449
|
"\u2190"
|
|
1351
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1450
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7__namespace.createElement(
|
|
1352
1451
|
"button",
|
|
1353
1452
|
{
|
|
1354
1453
|
type: "button",
|
|
1355
|
-
className: "
|
|
1454
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-primary hover:text-primary-foreground cursor-pointer",
|
|
1356
1455
|
onClick: handleNextMonth,
|
|
1357
1456
|
"aria-label": "Next month"
|
|
1358
1457
|
},
|
|
1359
1458
|
"\u2192"
|
|
1360
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1459
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "grid grid-cols-7 gap-1 mt-2" }, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */ React7__namespace.createElement(
|
|
1460
|
+
"div",
|
|
1461
|
+
{
|
|
1462
|
+
key: day,
|
|
1463
|
+
className: "flex items-center justify-center h-8 w-full text-xs font-medium"
|
|
1464
|
+
},
|
|
1465
|
+
day
|
|
1466
|
+
))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "grid grid-cols-7 gap-1" }, days.map((date, index) => {
|
|
1361
1467
|
if (!date) {
|
|
1362
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}
|
|
1468
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}` });
|
|
1363
1469
|
}
|
|
1364
1470
|
const isSelected = value && date.toDateString() === value.toDateString();
|
|
1365
1471
|
const isToday = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
@@ -1369,7 +1475,7 @@ function DatePicker({
|
|
|
1369
1475
|
{
|
|
1370
1476
|
key: date.toISOString(),
|
|
1371
1477
|
type: "button",
|
|
1372
|
-
className: `
|
|
1478
|
+
className: `flex items-center justify-center h-8 w-full rounded border-none bg-transparent cursor-pointer text-sm transition-colors hover:bg-primary hover:text-primary-foreground ${isSelected ? "bg-primary text-primary-foreground font-semibold" : ""} ${isToday ? "border border-primary" : ""} ${disabled2 ? "cursor-not-allowed opacity-50 pointer-events-none" : ""}`,
|
|
1373
1479
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1374
1480
|
disabled: disabled2,
|
|
1375
1481
|
"aria-label": formatDate(date, format)
|
|
@@ -1378,11 +1484,7 @@ function DatePicker({
|
|
|
1378
1484
|
);
|
|
1379
1485
|
})));
|
|
1380
1486
|
};
|
|
1381
|
-
const
|
|
1382
|
-
const errorClassName = error ? "datepicker--error" : "";
|
|
1383
|
-
const disabledClassName = disabled ? "datepicker--disabled" : "";
|
|
1384
|
-
const openClassName = isOpen ? "datepicker--open" : "";
|
|
1385
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1487
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1386
1488
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1387
1489
|
"input",
|
|
1388
1490
|
{
|
|
@@ -1390,26 +1492,33 @@ function DatePicker({
|
|
|
1390
1492
|
name,
|
|
1391
1493
|
value: value ? value.toISOString() : ""
|
|
1392
1494
|
}
|
|
1393
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1394
|
-
"
|
|
1495
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React7__namespace.createElement(
|
|
1496
|
+
"span",
|
|
1395
1497
|
{
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
height: "18",
|
|
1399
|
-
viewBox: "0 0 24 24",
|
|
1400
|
-
fill: "none",
|
|
1401
|
-
stroke: "currentColor",
|
|
1402
|
-
strokeLinecap: "round",
|
|
1403
|
-
strokeLinejoin: "round",
|
|
1404
|
-
strokeWidth: "2"
|
|
1498
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
|
|
1499
|
+
"aria-hidden": "true"
|
|
1405
1500
|
},
|
|
1406
|
-
/* @__PURE__ */ React7__namespace.createElement(
|
|
1407
|
-
|
|
1501
|
+
/* @__PURE__ */ React7__namespace.createElement(
|
|
1502
|
+
"svg",
|
|
1503
|
+
{
|
|
1504
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1505
|
+
width: "18",
|
|
1506
|
+
height: "18",
|
|
1507
|
+
viewBox: "0 0 24 24",
|
|
1508
|
+
fill: "none",
|
|
1509
|
+
stroke: "currentColor",
|
|
1510
|
+
strokeLinecap: "round",
|
|
1511
|
+
strokeLinejoin: "round",
|
|
1512
|
+
strokeWidth: "2"
|
|
1513
|
+
},
|
|
1514
|
+
/* @__PURE__ */ React7__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" })
|
|
1515
|
+
)
|
|
1516
|
+
), /* @__PURE__ */ React7__namespace.createElement(
|
|
1408
1517
|
"input",
|
|
1409
1518
|
{
|
|
1410
1519
|
ref: inputRef,
|
|
1411
1520
|
type: "text",
|
|
1412
|
-
className:
|
|
1521
|
+
className: `flex h-9 w-full rounded-md border border-input bg-transparent ${showIcon ? "pl-10" : "pl-3"} ${clearable && value ? "pr-10" : "pr-3"} py-1 text-base shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm ${error ? "border-red-500 ring-1 ring-red-500" : ""}`,
|
|
1413
1522
|
value: inputValue,
|
|
1414
1523
|
onChange: handleInputChange,
|
|
1415
1524
|
onClick: handleToggle,
|
|
@@ -1426,13 +1535,13 @@ function DatePicker({
|
|
|
1426
1535
|
"button",
|
|
1427
1536
|
{
|
|
1428
1537
|
type: "button",
|
|
1429
|
-
className: "
|
|
1538
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 transition-colors",
|
|
1430
1539
|
onClick: handleClear,
|
|
1431
1540
|
"aria-label": "Clear date",
|
|
1432
1541
|
tabIndex: -1
|
|
1433
1542
|
},
|
|
1434
1543
|
"\u2715"
|
|
1435
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1544
|
+
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "absolute z-50 top-full mt-1 min-w-full rounded-md border border-border bg-popover text-popover-foreground shadow-md p-3" }, renderCalendar()));
|
|
1436
1545
|
}
|
|
1437
1546
|
DatePicker.displayName = "DatePicker";
|
|
1438
1547
|
function parseTimeString(timeStr, use24Hour) {
|
|
@@ -1565,11 +1674,7 @@ function TimePicker({
|
|
|
1565
1674
|
}
|
|
1566
1675
|
return mins;
|
|
1567
1676
|
}, [minuteStep]);
|
|
1568
|
-
const
|
|
1569
|
-
const errorClassName = error ? "timepicker--error" : "";
|
|
1570
|
-
const disabledClassName = disabled ? "timepicker--disabled" : "";
|
|
1571
|
-
const openClassName = isOpen ? "timepicker--open" : "";
|
|
1572
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1677
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1573
1678
|
const displayValue = formatTimeValue(timeValue, use24Hour);
|
|
1574
1679
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1575
1680
|
"input",
|
|
@@ -1578,7 +1683,7 @@ function TimePicker({
|
|
|
1578
1683
|
name,
|
|
1579
1684
|
value
|
|
1580
1685
|
}
|
|
1581
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1686
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React7__namespace.createElement("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none", "aria-hidden": "true" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1582
1687
|
"svg",
|
|
1583
1688
|
{
|
|
1584
1689
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1598,7 +1703,7 @@ function TimePicker({
|
|
|
1598
1703
|
{
|
|
1599
1704
|
ref: inputRef,
|
|
1600
1705
|
type: "text",
|
|
1601
|
-
className:
|
|
1706
|
+
className: `flex h-9 w-full rounded-md border border-input bg-transparent ${showIcon ? "pl-10" : "pl-3"} ${clearable && value ? "pr-10" : "pr-3"} py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm ${error ? "border-red-500 ring-1 ring-red-500" : ""}`,
|
|
1602
1707
|
value: displayValue,
|
|
1603
1708
|
onClick: handleToggle,
|
|
1604
1709
|
onBlur,
|
|
@@ -1614,13 +1719,13 @@ function TimePicker({
|
|
|
1614
1719
|
"button",
|
|
1615
1720
|
{
|
|
1616
1721
|
type: "button",
|
|
1617
|
-
className: "
|
|
1722
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1618
1723
|
onClick: handleClear,
|
|
1619
1724
|
"aria-label": "Clear time",
|
|
1620
1725
|
tabIndex: -1
|
|
1621
1726
|
},
|
|
1622
1727
|
"\u2715"
|
|
1623
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1728
|
+
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "absolute z-50 top-full mt-1 min-w-full rounded-md border border-border bg-popover text-popover-foreground shadow-md p-3" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col flex-1" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center" }, use24Hour ? "Hour" : "Hour"), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col gap-1 max-h-48 overflow-y-auto" }, hours.map((hour) => {
|
|
1624
1729
|
const displayHour = use24Hour ? hour : hour;
|
|
1625
1730
|
const isSelected = use24Hour ? timeValue?.hour === (hour === 0 ? 12 : hour > 12 ? hour - 12 : hour) && timeValue?.period === (hour >= 12 ? "PM" : "AM") : timeValue?.hour === hour;
|
|
1626
1731
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1628,7 +1733,7 @@ function TimePicker({
|
|
|
1628
1733
|
{
|
|
1629
1734
|
key: hour,
|
|
1630
1735
|
type: "button",
|
|
1631
|
-
className: `
|
|
1736
|
+
className: `flex items-center justify-center h-8 w-full rounded border-none bg-transparent cursor-pointer text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${isSelected ? "bg-primary text-primary-foreground font-semibold" : ""}`,
|
|
1632
1737
|
onClick: () => {
|
|
1633
1738
|
if (use24Hour) {
|
|
1634
1739
|
const hour12 = hour === 0 ? 12 : hour > 12 ? hour - 12 : hour;
|
|
@@ -1648,24 +1753,24 @@ function TimePicker({
|
|
|
1648
1753
|
},
|
|
1649
1754
|
String(displayHour).padStart(2, "0")
|
|
1650
1755
|
);
|
|
1651
|
-
}))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1756
|
+
}))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col flex-1" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center" }, "Minute"), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col gap-1 max-h-48 overflow-y-auto" }, minutes.map((minute) => {
|
|
1652
1757
|
const isSelected = timeValue?.minute === minute;
|
|
1653
1758
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
1654
1759
|
"button",
|
|
1655
1760
|
{
|
|
1656
1761
|
key: minute,
|
|
1657
1762
|
type: "button",
|
|
1658
|
-
className: `
|
|
1763
|
+
className: `flex items-center justify-center h-8 w-full rounded border-none bg-transparent cursor-pointer text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${isSelected ? "bg-primary text-primary-foreground font-semibold" : ""}`,
|
|
1659
1764
|
onClick: () => handleMinuteChange(minute),
|
|
1660
1765
|
"aria-label": `${String(minute).padStart(2, "0")} minutes`
|
|
1661
1766
|
},
|
|
1662
1767
|
String(minute).padStart(2, "0")
|
|
1663
1768
|
);
|
|
1664
|
-
}))), !use24Hour && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1769
|
+
}))), !use24Hour && /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col w-20" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center" }, "Period"), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1665
1770
|
"button",
|
|
1666
1771
|
{
|
|
1667
1772
|
type: "button",
|
|
1668
|
-
className: `
|
|
1773
|
+
className: `flex items-center justify-center h-8 w-full rounded border-none bg-transparent cursor-pointer text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${timeValue?.period === "AM" ? "bg-primary text-primary-foreground font-semibold" : ""}`,
|
|
1669
1774
|
onClick: () => handlePeriodChange("AM")
|
|
1670
1775
|
},
|
|
1671
1776
|
"AM"
|
|
@@ -1673,7 +1778,7 @@ function TimePicker({
|
|
|
1673
1778
|
"button",
|
|
1674
1779
|
{
|
|
1675
1780
|
type: "button",
|
|
1676
|
-
className: `
|
|
1781
|
+
className: `flex items-center justify-center h-8 w-full rounded border-none bg-transparent cursor-pointer text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${timeValue?.period === "PM" ? "bg-primary text-primary-foreground font-semibold" : ""}`,
|
|
1677
1782
|
onClick: () => handlePeriodChange("PM")
|
|
1678
1783
|
},
|
|
1679
1784
|
"PM"
|
|
@@ -1812,27 +1917,27 @@ function DateRangePicker({
|
|
|
1812
1917
|
const handleNextMonth = () => {
|
|
1813
1918
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1814
1919
|
};
|
|
1815
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
1920
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { role: "grid", "aria-label": "Calendar" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center justify-between pb-2 border-b border-border" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1816
1921
|
"button",
|
|
1817
1922
|
{
|
|
1818
1923
|
type: "button",
|
|
1819
|
-
className: "
|
|
1924
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1820
1925
|
onClick: handlePrevMonth,
|
|
1821
1926
|
"aria-label": "Previous month"
|
|
1822
1927
|
},
|
|
1823
1928
|
"\u2190"
|
|
1824
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1929
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7__namespace.createElement(
|
|
1825
1930
|
"button",
|
|
1826
1931
|
{
|
|
1827
1932
|
type: "button",
|
|
1828
|
-
className: "
|
|
1933
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1829
1934
|
onClick: handleNextMonth,
|
|
1830
1935
|
"aria-label": "Next month"
|
|
1831
1936
|
},
|
|
1832
1937
|
"\u2192"
|
|
1833
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1938
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "grid grid-cols-7 gap-1 mt-2" }, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */ React7__namespace.createElement("div", { key: day, className: "flex items-center justify-center h-8 w-full text-xs text-muted-foreground font-medium" }, day))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "grid grid-cols-7 gap-1" }, days.map((date, index) => {
|
|
1834
1939
|
if (!date) {
|
|
1835
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}
|
|
1940
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}` });
|
|
1836
1941
|
}
|
|
1837
1942
|
const isStart = rangeStart && date.toDateString() === rangeStart.toDateString();
|
|
1838
1943
|
const isEnd = rangeEnd && date.toDateString() === rangeEnd.toDateString();
|
|
@@ -1845,7 +1950,7 @@ function DateRangePicker({
|
|
|
1845
1950
|
{
|
|
1846
1951
|
key: date.toISOString(),
|
|
1847
1952
|
type: "button",
|
|
1848
|
-
className: `
|
|
1953
|
+
className: `flex items-center justify-center h-8 w-full rounded border-none bg-transparent cursor-pointer text-sm transition-colors hover:bg-accent hover:text-accent-foreground ${isStart || isEnd ? "bg-primary text-primary-foreground font-semibold" : ""} ${isInRange || isInHoverRange ? "bg-accent/50" : ""} ${isToday ? "border border-primary" : ""} ${disabled2 ? "cursor-not-allowed opacity-50 pointer-events-none" : ""}`,
|
|
1849
1954
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1850
1955
|
onMouseEnter: () => setHoverDate(date),
|
|
1851
1956
|
onMouseLeave: () => setHoverDate(null),
|
|
@@ -1856,11 +1961,7 @@ function DateRangePicker({
|
|
|
1856
1961
|
);
|
|
1857
1962
|
})));
|
|
1858
1963
|
};
|
|
1859
|
-
const
|
|
1860
|
-
const errorClassName = error ? "daterangepicker--error" : "";
|
|
1861
|
-
const disabledClassName = disabled ? "daterangepicker--disabled" : "";
|
|
1862
|
-
const openClassName = isOpen ? "daterangepicker--open" : "";
|
|
1863
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1964
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1864
1965
|
const displayValue = rangeStart && rangeEnd ? `${formatDate2(rangeStart, format)}${separator}${formatDate2(rangeEnd, format)}` : rangeStart ? formatDate2(rangeStart, format) : "";
|
|
1865
1966
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1866
1967
|
"input",
|
|
@@ -1876,7 +1977,7 @@ function DateRangePicker({
|
|
|
1876
1977
|
name: `${name}[end]`,
|
|
1877
1978
|
value: rangeEnd ? rangeEnd.toISOString() : ""
|
|
1878
1979
|
}
|
|
1879
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1980
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React7__namespace.createElement("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none", "aria-hidden": "true" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1880
1981
|
"svg",
|
|
1881
1982
|
{
|
|
1882
1983
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1894,7 +1995,7 @@ function DateRangePicker({
|
|
|
1894
1995
|
"input",
|
|
1895
1996
|
{
|
|
1896
1997
|
type: "text",
|
|
1897
|
-
className:
|
|
1998
|
+
className: `flex h-9 w-full rounded-md border border-input bg-transparent ${showIcon ? "pl-10" : "pl-3"} ${clearable && (rangeStart || rangeEnd) ? "pr-10" : "pr-3"} py-1 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm ${error ? "border-red-500 ring-1 ring-red-500" : ""}`,
|
|
1898
1999
|
value: displayValue,
|
|
1899
2000
|
onClick: handleToggle,
|
|
1900
2001
|
onBlur,
|
|
@@ -1910,13 +2011,13 @@ function DateRangePicker({
|
|
|
1910
2011
|
"button",
|
|
1911
2012
|
{
|
|
1912
2013
|
type: "button",
|
|
1913
|
-
className: "
|
|
2014
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1914
2015
|
onClick: handleClear,
|
|
1915
2016
|
"aria-label": "Clear date range",
|
|
1916
2017
|
tabIndex: -1
|
|
1917
2018
|
},
|
|
1918
2019
|
"\u2715"
|
|
1919
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
2020
|
+
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "absolute z-50 top-full mt-1 min-w-full rounded-md border border-border bg-popover text-popover-foreground shadow-md p-3" }, renderCalendar(), rangeStart && !rangeEnd && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-xs text-muted-foreground text-center pt-2 border-t border-border mt-2" }, "Select end date")));
|
|
1920
2021
|
}
|
|
1921
2022
|
DateRangePicker.displayName = "DateRangePicker";
|
|
1922
2023
|
function htmlToMarkdown(html) {
|
|
@@ -2071,17 +2172,13 @@ function RichTextEditor({
|
|
|
2071
2172
|
}
|
|
2072
2173
|
}
|
|
2073
2174
|
};
|
|
2074
|
-
const
|
|
2075
|
-
const errorClassName = error ? "richtexteditor--error" : "";
|
|
2076
|
-
const disabledClassName = disabled ? "richtexteditor--disabled" : "";
|
|
2077
|
-
const modeClassName = `richtexteditor--${currentMode}`;
|
|
2078
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${modeClassName} ${className}`.trim();
|
|
2175
|
+
const combinedClassName = `rounded-md border border-input ${error ? "border-red-500 ring-1 ring-red-500" : ""} ${disabled ? "opacity-50 cursor-not-allowed" : ""} ${className}`.trim();
|
|
2079
2176
|
const editorStyle = {
|
|
2080
2177
|
minHeight,
|
|
2081
2178
|
maxHeight,
|
|
2082
2179
|
overflowY: maxHeight ? "auto" : void 0
|
|
2083
2180
|
};
|
|
2084
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement("input", { type: "hidden", name, value: content }), showToolbar && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
2181
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement("input", { type: "hidden", name, value: content }), showToolbar && /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center justify-between p-2 border-b border-border bg-muted/50" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-1" }, toolbarButtons.map((buttonName) => {
|
|
2085
2182
|
const button = toolbarConfig[buttonName];
|
|
2086
2183
|
if (!button) return null;
|
|
2087
2184
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -2089,7 +2186,7 @@ function RichTextEditor({
|
|
|
2089
2186
|
{
|
|
2090
2187
|
key: buttonName,
|
|
2091
2188
|
type: "button",
|
|
2092
|
-
className: "
|
|
2189
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
2093
2190
|
onClick: () => editorRef.current && button.action(editorRef.current),
|
|
2094
2191
|
title: button.title,
|
|
2095
2192
|
disabled: disabled || currentMode === "markdown",
|
|
@@ -2101,18 +2198,18 @@ function RichTextEditor({
|
|
|
2101
2198
|
"button",
|
|
2102
2199
|
{
|
|
2103
2200
|
type: "button",
|
|
2104
|
-
className: "
|
|
2201
|
+
className: "flex items-center justify-center h-8 px-3 rounded border-none bg-transparent hover:bg-accent text-xs font-medium text-muted-foreground hover:text-foreground cursor-pointer transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
2105
2202
|
onClick: handleModeToggle,
|
|
2106
2203
|
disabled,
|
|
2107
2204
|
title: `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`,
|
|
2108
2205
|
"aria-label": `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`
|
|
2109
2206
|
},
|
|
2110
2207
|
currentMode === "wysiwyg" ? "MD" : "WYSIWYG"
|
|
2111
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
2208
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { style: editorStyle }, currentMode === "wysiwyg" ? /* @__PURE__ */ React7__namespace.createElement(
|
|
2112
2209
|
"div",
|
|
2113
2210
|
{
|
|
2114
2211
|
ref: editorRef,
|
|
2115
|
-
className: "
|
|
2212
|
+
className: "w-full p-3 text-base md:text-sm outline-none bg-transparent focus-visible:outline-none [&:empty:before]:content-[attr(data-placeholder)] [&:empty:before]:text-muted-foreground",
|
|
2116
2213
|
role: "textbox",
|
|
2117
2214
|
contentEditable: !disabled,
|
|
2118
2215
|
onInput: handleWysiwygChange,
|
|
@@ -2127,7 +2224,7 @@ function RichTextEditor({
|
|
|
2127
2224
|
"textarea",
|
|
2128
2225
|
{
|
|
2129
2226
|
ref: textareaRef,
|
|
2130
|
-
className: "
|
|
2227
|
+
className: "w-full p-3 text-base md:text-sm outline-none bg-transparent resize-none focus-visible:outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
2131
2228
|
value: content,
|
|
2132
2229
|
onChange: handleMarkdownChange,
|
|
2133
2230
|
onBlur,
|
|
@@ -2136,7 +2233,8 @@ function RichTextEditor({
|
|
|
2136
2233
|
placeholder,
|
|
2137
2234
|
"aria-invalid": error || props["aria-invalid"] ? "true" : "false",
|
|
2138
2235
|
"aria-describedby": props["aria-describedby"],
|
|
2139
|
-
"aria-required": required || props["aria-required"]
|
|
2236
|
+
"aria-required": required || props["aria-required"],
|
|
2237
|
+
style: editorStyle
|
|
2140
2238
|
}
|
|
2141
2239
|
)));
|
|
2142
2240
|
}
|