@page-speed/forms 0.3.6 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +174 -176
- package/dist/inputs.cjs.map +1 -1
- package/dist/inputs.d.cts +13 -7
- package/dist/inputs.d.ts +13 -7
- package/dist/inputs.js +174 -176
- package/dist/inputs.js.map +1 -1
- package/package.json +1 -1
package/dist/inputs.cjs
CHANGED
|
@@ -43,8 +43,8 @@ function TextInput({
|
|
|
43
43
|
const handleBlur = () => {
|
|
44
44
|
onBlur?.();
|
|
45
45
|
};
|
|
46
|
-
const baseClassName = "text-
|
|
47
|
-
const errorClassName = error ? "
|
|
46
|
+
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";
|
|
47
|
+
const errorClassName = error ? "border-red-500 ring-1 ring-red-500" : "";
|
|
48
48
|
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
49
49
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
50
50
|
"input",
|
|
@@ -90,8 +90,8 @@ function TextArea({
|
|
|
90
90
|
const handleBlur = () => {
|
|
91
91
|
onBlur?.();
|
|
92
92
|
};
|
|
93
|
-
const baseClassName = "
|
|
94
|
-
const errorClassName = error ? "
|
|
93
|
+
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";
|
|
94
|
+
const errorClassName = error ? "border-red-500 ring-1 ring-red-500" : "";
|
|
95
95
|
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
96
96
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
97
97
|
"textarea",
|
|
@@ -128,9 +128,11 @@ function Checkbox({
|
|
|
128
128
|
className = "",
|
|
129
129
|
indeterminate = false,
|
|
130
130
|
label,
|
|
131
|
+
description,
|
|
131
132
|
...props
|
|
132
133
|
}) {
|
|
133
134
|
const inputRef = React7__namespace.useRef(null);
|
|
135
|
+
const checkboxId = props.id || `checkbox-${name}`;
|
|
134
136
|
React7__namespace.useEffect(() => {
|
|
135
137
|
if (inputRef.current) {
|
|
136
138
|
inputRef.current.indeterminate = indeterminate;
|
|
@@ -142,29 +144,41 @@ function Checkbox({
|
|
|
142
144
|
const handleBlur = () => {
|
|
143
145
|
onBlur?.();
|
|
144
146
|
};
|
|
145
|
-
const
|
|
146
|
-
const errorClassName = error ? "checkbox--error" : "";
|
|
147
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
148
|
-
const checkbox = /* @__PURE__ */ React7__namespace.createElement(
|
|
147
|
+
const checkbox = /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
149
148
|
"input",
|
|
150
149
|
{
|
|
151
150
|
ref: inputRef,
|
|
152
151
|
type: "checkbox",
|
|
152
|
+
id: checkboxId,
|
|
153
153
|
name,
|
|
154
154
|
checked: value,
|
|
155
155
|
onChange: handleChange,
|
|
156
156
|
onBlur: handleBlur,
|
|
157
157
|
disabled,
|
|
158
158
|
required,
|
|
159
|
-
className:
|
|
159
|
+
className: `peer relative flex size-4 shrink-0 appearance-none items-center justify-center rounded-lg border border-input bg-transparent outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 ${error ? "border-destructive ring-3 ring-destructive/20" : ""} ${value ? "bg-primary border-primary" : ""} ${className}`,
|
|
160
160
|
"aria-invalid": error || props["aria-invalid"],
|
|
161
|
-
"aria-describedby": props["aria-describedby"],
|
|
161
|
+
"aria-describedby": description ? `${checkboxId}-description` : props["aria-describedby"],
|
|
162
162
|
"aria-required": required || props["aria-required"],
|
|
163
163
|
...props
|
|
164
164
|
}
|
|
165
|
-
);
|
|
165
|
+
), value && /* @__PURE__ */ React7__namespace.createElement("span", { className: "pointer-events-none absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-primary-foreground" }, /* @__PURE__ */ React7__namespace.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7__namespace.createElement("polyline", { points: "20 6 9 17 4 12" }))), indeterminate && !value && /* @__PURE__ */ React7__namespace.createElement("span", { className: "pointer-events-none absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-primary" }, /* @__PURE__ */ React7__namespace.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7__namespace.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))));
|
|
166
166
|
if (label) {
|
|
167
|
-
return /* @__PURE__ */ React7__namespace.createElement(
|
|
167
|
+
return /* @__PURE__ */ React7__namespace.createElement(
|
|
168
|
+
"label",
|
|
169
|
+
{
|
|
170
|
+
className: `flex w-fit gap-2 items-center ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
171
|
+
htmlFor: checkboxId
|
|
172
|
+
},
|
|
173
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, checkbox, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-2 text-sm font-medium" }, label), description && /* @__PURE__ */ React7__namespace.createElement(
|
|
174
|
+
"p",
|
|
175
|
+
{
|
|
176
|
+
className: "text-muted-foreground text-sm",
|
|
177
|
+
id: `${checkboxId}-description`
|
|
178
|
+
},
|
|
179
|
+
description
|
|
180
|
+
)))
|
|
181
|
+
);
|
|
168
182
|
}
|
|
169
183
|
return checkbox;
|
|
170
184
|
}
|
|
@@ -215,15 +229,13 @@ function CheckboxGroup({
|
|
|
215
229
|
const handleBlur = () => {
|
|
216
230
|
onBlur?.();
|
|
217
231
|
};
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
const layoutClassName = `checkbox-group--${layout}`;
|
|
221
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${layoutClassName} ${className}`.trim();
|
|
232
|
+
const layoutClass = layout === "inline" ? "flex flex-row flex-wrap gap-4" : layout === "grid" ? `grid gap-3` : "flex flex-col gap-3";
|
|
233
|
+
const containerClass = `w-full ${layoutClass} ${className}`.trim();
|
|
222
234
|
const maxReached = Boolean(maxSelections && value.length >= maxSelections);
|
|
223
235
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
224
236
|
"div",
|
|
225
237
|
{
|
|
226
|
-
className:
|
|
238
|
+
className: containerClass,
|
|
227
239
|
role: "group",
|
|
228
240
|
"aria-invalid": error || props["aria-invalid"],
|
|
229
241
|
"aria-describedby": props["aria-describedby"],
|
|
@@ -233,25 +245,32 @@ function CheckboxGroup({
|
|
|
233
245
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
234
246
|
} : void 0
|
|
235
247
|
},
|
|
236
|
-
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
237
|
-
description && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
238
|
-
|
|
239
|
-
"
|
|
248
|
+
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium" }, label),
|
|
249
|
+
description && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-muted-foreground text-sm" }, description),
|
|
250
|
+
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */ React7__namespace.createElement(
|
|
251
|
+
"label",
|
|
240
252
|
{
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
className: `flex w-fit gap-2 items-center ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`
|
|
254
|
+
},
|
|
255
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
256
|
+
"input",
|
|
257
|
+
{
|
|
258
|
+
type: "checkbox",
|
|
259
|
+
checked: allSelected,
|
|
260
|
+
ref: (input) => {
|
|
261
|
+
if (input) {
|
|
262
|
+
input.indeterminate = someSelected;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
onChange: (e) => handleSelectAll(e.target.checked),
|
|
266
|
+
onBlur: handleBlur,
|
|
267
|
+
disabled,
|
|
268
|
+
className: "peer relative flex size-4 shrink-0 appearance-none items-center justify-center rounded-lg border border-input bg-transparent outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",
|
|
269
|
+
"aria-label": selectAllLabel
|
|
270
|
+
}
|
|
271
|
+
), allSelected && /* @__PURE__ */ React7__namespace.createElement("span", { className: "pointer-events-none absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-primary-foreground" }, /* @__PURE__ */ React7__namespace.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7__namespace.createElement("polyline", { points: "20 6 9 17 4 12" }))), someSelected && !allSelected && /* @__PURE__ */ React7__namespace.createElement("span", { className: "pointer-events-none absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-primary" }, /* @__PURE__ */ React7__namespace.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7__namespace.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" })))), /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-sm font-medium" }, selectAllLabel))
|
|
272
|
+
),
|
|
273
|
+
options.map((option) => {
|
|
255
274
|
const isChecked = value.includes(option.value);
|
|
256
275
|
const isDisabled = disabled || option.disabled || maxReached && !isChecked;
|
|
257
276
|
const checkboxId = `${name}-${option.value}`;
|
|
@@ -259,10 +278,10 @@ function CheckboxGroup({
|
|
|
259
278
|
"label",
|
|
260
279
|
{
|
|
261
280
|
key: option.value,
|
|
262
|
-
className: `
|
|
281
|
+
className: `flex w-fit gap-2 items-center ${isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
263
282
|
htmlFor: checkboxId
|
|
264
283
|
},
|
|
265
|
-
/* @__PURE__ */ React7__namespace.createElement(
|
|
284
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
266
285
|
"input",
|
|
267
286
|
{
|
|
268
287
|
type: "checkbox",
|
|
@@ -274,21 +293,20 @@ function CheckboxGroup({
|
|
|
274
293
|
onBlur: handleBlur,
|
|
275
294
|
disabled: isDisabled,
|
|
276
295
|
required: required && minSelections ? value.length < minSelections : false,
|
|
277
|
-
className:
|
|
296
|
+
className: `peer relative flex size-4 shrink-0 appearance-none items-center justify-center rounded-lg border border-input bg-transparent outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 ${error ? "border-destructive ring-3 ring-destructive/20" : ""} ${isChecked ? "bg-primary border-primary" : ""}`,
|
|
278
297
|
"aria-describedby": option.description ? `${checkboxId}-description` : props["aria-describedby"]
|
|
279
298
|
}
|
|
280
|
-
),
|
|
281
|
-
|
|
282
|
-
"span",
|
|
299
|
+
), isChecked && /* @__PURE__ */ React7__namespace.createElement("span", { className: "pointer-events-none absolute top-1/2 left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-primary-foreground" }, /* @__PURE__ */ React7__namespace.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7__namespace.createElement("polyline", { points: "20 6 9 17 4 12" })))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, renderOption ? renderOption(option) : /* @__PURE__ */ React7__namespace.createElement(React7__namespace.Fragment, null, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-2 text-sm font-medium" }, option.label), option.description && /* @__PURE__ */ React7__namespace.createElement(
|
|
300
|
+
"p",
|
|
283
301
|
{
|
|
284
|
-
className: "
|
|
302
|
+
className: "text-muted-foreground text-sm",
|
|
285
303
|
id: `${checkboxId}-description`
|
|
286
304
|
},
|
|
287
305
|
option.description
|
|
288
|
-
)))
|
|
306
|
+
))))
|
|
289
307
|
);
|
|
290
|
-
})
|
|
291
|
-
(minSelections || maxSelections) && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
308
|
+
}),
|
|
309
|
+
(minSelections || maxSelections) && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm text-muted-foreground mt-2", "aria-live": "polite" }, minSelections && value.length < minSelections && /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-destructive" }, "Select at least ", minSelections, " option", minSelections !== 1 ? "s" : ""), maxSelections && /* @__PURE__ */ React7__namespace.createElement("span", null, value.length, "/", maxSelections, " selected"))
|
|
292
310
|
);
|
|
293
311
|
}
|
|
294
312
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
@@ -337,22 +355,20 @@ function Radio({
|
|
|
337
355
|
const handleBlur = () => {
|
|
338
356
|
onBlur?.();
|
|
339
357
|
};
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
const layoutClassName = `radio-group--${layout}`;
|
|
343
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${layoutClassName} ${className}`.trim();
|
|
358
|
+
const layoutClass = layout === "inline" ? "flex flex-row flex-wrap gap-4" : "grid w-full gap-2";
|
|
359
|
+
const containerClass = `${layoutClass} ${className}`.trim();
|
|
344
360
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
345
361
|
"div",
|
|
346
362
|
{
|
|
347
|
-
className:
|
|
363
|
+
className: containerClass,
|
|
348
364
|
role: "radiogroup",
|
|
349
365
|
"aria-invalid": error || props["aria-invalid"],
|
|
350
366
|
"aria-describedby": props["aria-describedby"],
|
|
351
367
|
"aria-required": required || props["aria-required"],
|
|
352
368
|
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
353
369
|
},
|
|
354
|
-
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
355
|
-
|
|
370
|
+
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium mb-2" }, label),
|
|
371
|
+
options.map((option, index) => {
|
|
356
372
|
const isChecked = value === option.value;
|
|
357
373
|
const isDisabled = disabled || option.disabled;
|
|
358
374
|
const radioId = `${name}-${option.value}`;
|
|
@@ -360,10 +376,19 @@ function Radio({
|
|
|
360
376
|
"label",
|
|
361
377
|
{
|
|
362
378
|
key: option.value,
|
|
363
|
-
className: `
|
|
364
|
-
htmlFor: radioId
|
|
379
|
+
className: `flex w-fit gap-2 items-center ${isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
380
|
+
htmlFor: radioId,
|
|
381
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
382
|
+
tabIndex: isDisabled ? -1 : 0
|
|
365
383
|
},
|
|
366
|
-
/* @__PURE__ */ React7__namespace.createElement(
|
|
384
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, option.description ? /* @__PURE__ */ React7__namespace.createElement(React7__namespace.Fragment, null, /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center gap-2 text-sm font-medium" }, option.label), /* @__PURE__ */ React7__namespace.createElement(
|
|
385
|
+
"p",
|
|
386
|
+
{
|
|
387
|
+
className: "text-muted-foreground text-sm",
|
|
388
|
+
id: `${radioId}-description`
|
|
389
|
+
},
|
|
390
|
+
option.description
|
|
391
|
+
)) : /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-sm font-medium" }, option.label)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
367
392
|
"input",
|
|
368
393
|
{
|
|
369
394
|
type: "radio",
|
|
@@ -373,23 +398,14 @@ function Radio({
|
|
|
373
398
|
checked: isChecked,
|
|
374
399
|
onChange: (e) => handleChange(e.target.value),
|
|
375
400
|
onBlur: handleBlur,
|
|
376
|
-
onKeyDown: (e) => handleKeyDown(e, index),
|
|
377
401
|
disabled: isDisabled,
|
|
378
402
|
required,
|
|
379
|
-
className:
|
|
403
|
+
className: `peer relative flex aspect-square size-4 shrink-0 appearance-none rounded-full border border-input outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 ${error ? "border-destructive" : ""} ${isChecked ? "border-primary bg-primary" : "bg-transparent"}`,
|
|
380
404
|
"aria-describedby": option.description ? `${radioId}-description` : props["aria-describedby"]
|
|
381
405
|
}
|
|
382
|
-
),
|
|
383
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "radio-content" }, /* @__PURE__ */ React7__namespace.createElement("span", { className: "radio-label" }, option.label), option.description && /* @__PURE__ */ React7__namespace.createElement(
|
|
384
|
-
"span",
|
|
385
|
-
{
|
|
386
|
-
className: "radio-description",
|
|
387
|
-
id: `${radioId}-description`
|
|
388
|
-
},
|
|
389
|
-
option.description
|
|
390
|
-
))
|
|
406
|
+
), isChecked && /* @__PURE__ */ React7__namespace.createElement("span", { className: "pointer-events-none absolute top-1/2 left-1/2 flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center text-primary-foreground" }, /* @__PURE__ */ React7__namespace.createElement("svg", { className: "size-2 fill-current", viewBox: "0 0 24 24" }, /* @__PURE__ */ React7__namespace.createElement("circle", { cx: "12", cy: "12", r: "10" })))))
|
|
391
407
|
);
|
|
392
|
-
})
|
|
408
|
+
})
|
|
393
409
|
);
|
|
394
410
|
}
|
|
395
411
|
Radio.displayName = "Radio";
|
|
@@ -554,11 +570,7 @@ function Select({
|
|
|
554
570
|
};
|
|
555
571
|
}
|
|
556
572
|
}, [isOpen]);
|
|
557
|
-
const
|
|
558
|
-
const errorClassName = error ? "select--error" : "";
|
|
559
|
-
const disabledClassName = disabled ? "select--disabled" : "";
|
|
560
|
-
const openClassName = isOpen ? "select--open" : "";
|
|
561
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
573
|
+
const combinedClassName = `relative w-full ${className}`.trim();
|
|
562
574
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
563
575
|
"div",
|
|
564
576
|
{
|
|
@@ -586,7 +598,7 @@ function Select({
|
|
|
586
598
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
587
599
|
"div",
|
|
588
600
|
{
|
|
589
|
-
className: "
|
|
601
|
+
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" : ""}`,
|
|
590
602
|
onClick: handleToggle,
|
|
591
603
|
role: "combobox",
|
|
592
604
|
"aria-expanded": isOpen,
|
|
@@ -597,39 +609,39 @@ function Select({
|
|
|
597
609
|
"aria-disabled": disabled,
|
|
598
610
|
tabIndex: disabled ? -1 : 0
|
|
599
611
|
},
|
|
600
|
-
/* @__PURE__ */ React7__namespace.createElement("span", { className: "
|
|
601
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
612
|
+
/* @__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)),
|
|
613
|
+
/* @__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(
|
|
602
614
|
"button",
|
|
603
615
|
{
|
|
604
616
|
type: "button",
|
|
605
|
-
className: "
|
|
617
|
+
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",
|
|
606
618
|
onClick: handleClear,
|
|
607
619
|
"aria-label": "Clear selection",
|
|
608
620
|
tabIndex: -1
|
|
609
621
|
},
|
|
610
622
|
"\u2715"
|
|
611
|
-
), /* @__PURE__ */ React7__namespace.createElement("span", { className: "
|
|
623
|
+
), /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-muted-foreground text-xs leading-none", "aria-hidden": "true" }, isOpen ? "\u25B2" : "\u25BC"))
|
|
612
624
|
),
|
|
613
|
-
isOpen && /* @__PURE__ */ React7__namespace.createElement("div", { id: dropdownId, className: "
|
|
625
|
+
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(
|
|
614
626
|
"input",
|
|
615
627
|
{
|
|
616
628
|
ref: searchInputRef,
|
|
617
629
|
type: "text",
|
|
618
|
-
className: "
|
|
630
|
+
className: "w-full border border-input rounded px-2 py-1 text-sm bg-transparent outline-none focus:ring-1 focus:ring-ring",
|
|
619
631
|
placeholder: "Search...",
|
|
620
632
|
value: searchQuery,
|
|
621
633
|
onChange: handleSearchChange,
|
|
622
634
|
onClick: (e) => e.stopPropagation(),
|
|
623
635
|
"aria-label": "Search options"
|
|
624
636
|
}
|
|
625
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
637
|
+
)), /* @__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 ? (
|
|
626
638
|
// Render grouped options
|
|
627
639
|
optionGroups.map((group, groupIndex) => {
|
|
628
640
|
const groupOptions = group.options.filter(
|
|
629
641
|
(opt) => filteredOptions.includes(opt)
|
|
630
642
|
);
|
|
631
643
|
if (groupOptions.length === 0) return null;
|
|
632
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: groupIndex, className: "
|
|
644
|
+
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) => {
|
|
633
645
|
const globalIndex = filteredOptions.indexOf(option);
|
|
634
646
|
const isSelected = value === option.value;
|
|
635
647
|
const isFocused = globalIndex === focusedIndex;
|
|
@@ -638,7 +650,7 @@ function Select({
|
|
|
638
650
|
"div",
|
|
639
651
|
{
|
|
640
652
|
key: option.value,
|
|
641
|
-
className: `
|
|
653
|
+
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" : ""}`,
|
|
642
654
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
643
655
|
role: "option",
|
|
644
656
|
"aria-selected": isSelected,
|
|
@@ -658,7 +670,7 @@ function Select({
|
|
|
658
670
|
"div",
|
|
659
671
|
{
|
|
660
672
|
key: option.value,
|
|
661
|
-
className: `
|
|
673
|
+
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" : ""}`,
|
|
662
674
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
663
675
|
role: "option",
|
|
664
676
|
"aria-selected": isSelected,
|
|
@@ -938,11 +950,7 @@ function FileInput({
|
|
|
938
950
|
}
|
|
939
951
|
};
|
|
940
952
|
}, [value, imageToCrop]);
|
|
941
|
-
const
|
|
942
|
-
const errorClassName = error ? "file-input--error" : "";
|
|
943
|
-
const dragClassName = dragActive ? "file-input--drag-active" : "";
|
|
944
|
-
const disabledClassName = disabled ? "file-input--disabled" : "";
|
|
945
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${dragClassName} ${disabledClassName} ${className}`.trim();
|
|
953
|
+
const combinedClassName = `${className}`.trim();
|
|
946
954
|
return /* @__PURE__ */ React7__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
947
955
|
"input",
|
|
948
956
|
{
|
|
@@ -955,7 +963,6 @@ function FileInput({
|
|
|
955
963
|
multiple,
|
|
956
964
|
disabled,
|
|
957
965
|
required: required && value.length === 0,
|
|
958
|
-
className: "file-input__native",
|
|
959
966
|
"aria-invalid": error || props["aria-invalid"],
|
|
960
967
|
"aria-describedby": props["aria-describedby"],
|
|
961
968
|
"aria-required": required || props["aria-required"],
|
|
@@ -964,7 +971,7 @@ function FileInput({
|
|
|
964
971
|
), /* @__PURE__ */ React7__namespace.createElement(
|
|
965
972
|
"div",
|
|
966
973
|
{
|
|
967
|
-
className: "
|
|
974
|
+
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" : ""}`,
|
|
968
975
|
onDragEnter: handleDrag,
|
|
969
976
|
onDragLeave: handleDrag,
|
|
970
977
|
onDragOver: handleDrag,
|
|
@@ -976,10 +983,10 @@ function FileInput({
|
|
|
976
983
|
"aria-label": placeholder,
|
|
977
984
|
"aria-disabled": disabled
|
|
978
985
|
},
|
|
979
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
986
|
+
/* @__PURE__ */ React7__namespace.createElement("div", { className: "flex flex-col items-center gap-2 text-center" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
980
987
|
"svg",
|
|
981
988
|
{
|
|
982
|
-
className: "
|
|
989
|
+
className: "text-muted-foreground",
|
|
983
990
|
width: "48",
|
|
984
991
|
height: "48",
|
|
985
992
|
viewBox: "0 0 24 24",
|
|
@@ -993,30 +1000,36 @@ function FileInput({
|
|
|
993
1000
|
/* @__PURE__ */ React7__namespace.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
994
1001
|
/* @__PURE__ */ React7__namespace.createElement("polyline", { points: "17 8 12 3 7 8" }),
|
|
995
1002
|
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
996
|
-
), /* @__PURE__ */ React7__namespace.createElement("p", { className: "
|
|
997
|
-
), value.length > 0 && /* @__PURE__ */ React7__namespace.createElement("ul", { className: "
|
|
1003
|
+
), /* @__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)))
|
|
1004
|
+
), value.length > 0 && /* @__PURE__ */ React7__namespace.createElement("ul", { className: "flex flex-col gap-2 mt-4", role: "list" }, value.map((file, index) => {
|
|
998
1005
|
const previewUrl = showPreview ? getPreviewUrl(file) : null;
|
|
999
|
-
return /* @__PURE__ */ React7__namespace.createElement("li", { key: `${file.name}-${index}`, className: "
|
|
1006
|
+
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(
|
|
1000
1007
|
"img",
|
|
1001
1008
|
{
|
|
1002
1009
|
src: previewUrl,
|
|
1003
1010
|
alt: file.name,
|
|
1004
|
-
className: "
|
|
1011
|
+
className: "w-12 h-12 rounded object-cover",
|
|
1005
1012
|
width: "48",
|
|
1006
1013
|
height: "48"
|
|
1007
1014
|
}
|
|
1008
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1015
|
+
), /* @__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(
|
|
1009
1016
|
"div",
|
|
1010
1017
|
{
|
|
1011
|
-
className: "
|
|
1012
|
-
style: { width: `${uploadProgress[file.name]}%` },
|
|
1018
|
+
className: "h-1.5 bg-muted rounded-full overflow-hidden flex-1",
|
|
1013
1019
|
role: "progressbar",
|
|
1014
1020
|
"aria-valuenow": uploadProgress[file.name],
|
|
1015
1021
|
"aria-valuemin": 0,
|
|
1016
1022
|
"aria-valuemax": 100,
|
|
1017
1023
|
"aria-label": `Upload progress: ${uploadProgress[file.name]}%`
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1024
|
+
},
|
|
1025
|
+
/* @__PURE__ */ React7__namespace.createElement(
|
|
1026
|
+
"div",
|
|
1027
|
+
{
|
|
1028
|
+
className: "h-full bg-primary transition-all",
|
|
1029
|
+
style: { width: `${uploadProgress[file.name]}%` }
|
|
1030
|
+
}
|
|
1031
|
+
)
|
|
1032
|
+
), /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-xs text-muted-foreground" }, uploadProgress[file.name], "%"))), enableCropping && file.type.startsWith("image/") && /* @__PURE__ */ React7__namespace.createElement(
|
|
1020
1033
|
"button",
|
|
1021
1034
|
{
|
|
1022
1035
|
type: "button",
|
|
@@ -1025,7 +1038,7 @@ function FileInput({
|
|
|
1025
1038
|
handleCrop(file);
|
|
1026
1039
|
},
|
|
1027
1040
|
disabled,
|
|
1028
|
-
className: "
|
|
1041
|
+
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",
|
|
1029
1042
|
"aria-label": `Crop ${file.name}`
|
|
1030
1043
|
},
|
|
1031
1044
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1053,7 +1066,7 @@ function FileInput({
|
|
|
1053
1066
|
handleRemove(index);
|
|
1054
1067
|
},
|
|
1055
1068
|
disabled,
|
|
1056
|
-
className: "
|
|
1069
|
+
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",
|
|
1057
1070
|
"aria-label": `Remove ${file.name}`
|
|
1058
1071
|
},
|
|
1059
1072
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1073,26 +1086,26 @@ function FileInput({
|
|
|
1073
1086
|
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1074
1087
|
)
|
|
1075
1088
|
));
|
|
1076
|
-
})), cropperOpen && imageToCrop && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1089
|
+
})), cropperOpen && imageToCrop && /* @__PURE__ */ React7__namespace.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1077
1090
|
"div",
|
|
1078
1091
|
{
|
|
1079
|
-
className: "
|
|
1092
|
+
className: "absolute inset-0 bg-black/50",
|
|
1080
1093
|
onClick: handleCropCancel,
|
|
1081
1094
|
"aria-label": "Close cropper"
|
|
1082
1095
|
}
|
|
1083
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1096
|
+
), /* @__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(
|
|
1084
1097
|
"button",
|
|
1085
1098
|
{
|
|
1086
1099
|
type: "button",
|
|
1087
|
-
className: "
|
|
1100
|
+
className: "flex items-center justify-center h-8 w-8 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
1088
1101
|
onClick: handleCropCancel,
|
|
1089
1102
|
"aria-label": "Close"
|
|
1090
1103
|
},
|
|
1091
1104
|
"\u2715"
|
|
1092
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1105
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "p-4" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1093
1106
|
"div",
|
|
1094
1107
|
{
|
|
1095
|
-
className: "
|
|
1108
|
+
className: "relative w-full h-96 bg-muted rounded-md overflow-hidden",
|
|
1096
1109
|
onMouseDown: (e) => {
|
|
1097
1110
|
e.preventDefault();
|
|
1098
1111
|
const startX = e.clientX - crop.x;
|
|
@@ -1116,7 +1129,7 @@ function FileInput({
|
|
|
1116
1129
|
{
|
|
1117
1130
|
src: imageToCrop.url,
|
|
1118
1131
|
alt: "Crop preview",
|
|
1119
|
-
className: "
|
|
1132
|
+
className: "absolute inset-0 w-full h-full object-contain",
|
|
1120
1133
|
style: {
|
|
1121
1134
|
transform: `translate(${crop.x}px, ${crop.y}px) scale(${zoom})`
|
|
1122
1135
|
},
|
|
@@ -1146,15 +1159,15 @@ function FileInput({
|
|
|
1146
1159
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
1147
1160
|
"div",
|
|
1148
1161
|
{
|
|
1149
|
-
className: "
|
|
1162
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 border-2 border-primary rounded pointer-events-none",
|
|
1150
1163
|
style: {
|
|
1151
1164
|
width: cropAspectRatio ? `${Math.min(80, 80 * cropAspectRatio)}%` : "80%",
|
|
1152
1165
|
aspectRatio: cropAspectRatio ? String(cropAspectRatio) : void 0
|
|
1153
1166
|
}
|
|
1154
1167
|
},
|
|
1155
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1168
|
+
/* @__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))
|
|
1156
1169
|
)
|
|
1157
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1170
|
+
), /* @__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(
|
|
1158
1171
|
"input",
|
|
1159
1172
|
{
|
|
1160
1173
|
id: "zoom-slider",
|
|
@@ -1164,14 +1177,14 @@ function FileInput({
|
|
|
1164
1177
|
step: "0.1",
|
|
1165
1178
|
value: zoom,
|
|
1166
1179
|
onChange: (e) => onZoomChange(parseFloat(e.target.value)),
|
|
1167
|
-
className: "
|
|
1180
|
+
className: "flex-1 h-2 bg-muted rounded-lg appearance-none cursor-pointer",
|
|
1168
1181
|
"aria-label": "Zoom level"
|
|
1169
1182
|
}
|
|
1170
|
-
))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1183
|
+
))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "flex items-center justify-end gap-2 p-4 border-t border-border" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1171
1184
|
"button",
|
|
1172
1185
|
{
|
|
1173
1186
|
type: "button",
|
|
1174
|
-
className: "
|
|
1187
|
+
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",
|
|
1175
1188
|
onClick: handleCropCancel
|
|
1176
1189
|
},
|
|
1177
1190
|
"Cancel"
|
|
@@ -1179,7 +1192,7 @@ function FileInput({
|
|
|
1179
1192
|
"button",
|
|
1180
1193
|
{
|
|
1181
1194
|
type: "button",
|
|
1182
|
-
className: "
|
|
1195
|
+
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",
|
|
1183
1196
|
onClick: handleCropSave
|
|
1184
1197
|
},
|
|
1185
1198
|
"Save"
|
|
@@ -1327,27 +1340,27 @@ function DatePicker({
|
|
|
1327
1340
|
const handleNextMonth = () => {
|
|
1328
1341
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1329
1342
|
};
|
|
1330
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
1343
|
+
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(
|
|
1331
1344
|
"button",
|
|
1332
1345
|
{
|
|
1333
1346
|
type: "button",
|
|
1334
|
-
className: "
|
|
1347
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1335
1348
|
onClick: handlePrevMonth,
|
|
1336
1349
|
"aria-label": "Previous month"
|
|
1337
1350
|
},
|
|
1338
1351
|
"\u2190"
|
|
1339
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1352
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7__namespace.createElement(
|
|
1340
1353
|
"button",
|
|
1341
1354
|
{
|
|
1342
1355
|
type: "button",
|
|
1343
|
-
className: "
|
|
1356
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1344
1357
|
onClick: handleNextMonth,
|
|
1345
1358
|
"aria-label": "Next month"
|
|
1346
1359
|
},
|
|
1347
1360
|
"\u2192"
|
|
1348
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1361
|
+
)), /* @__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) => {
|
|
1349
1362
|
if (!date) {
|
|
1350
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}
|
|
1363
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}` });
|
|
1351
1364
|
}
|
|
1352
1365
|
const isSelected = value && date.toDateString() === value.toDateString();
|
|
1353
1366
|
const isToday = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
@@ -1357,7 +1370,7 @@ function DatePicker({
|
|
|
1357
1370
|
{
|
|
1358
1371
|
key: date.toISOString(),
|
|
1359
1372
|
type: "button",
|
|
1360
|
-
className: `
|
|
1373
|
+
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" : ""} ${isToday ? "border border-primary" : ""} ${disabled2 ? "cursor-not-allowed opacity-50 pointer-events-none" : ""}`,
|
|
1361
1374
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1362
1375
|
disabled: disabled2,
|
|
1363
1376
|
"aria-label": formatDate(date, format)
|
|
@@ -1366,11 +1379,7 @@ function DatePicker({
|
|
|
1366
1379
|
);
|
|
1367
1380
|
})));
|
|
1368
1381
|
};
|
|
1369
|
-
const
|
|
1370
|
-
const errorClassName = error ? "datepicker--error" : "";
|
|
1371
|
-
const disabledClassName = disabled ? "datepicker--disabled" : "";
|
|
1372
|
-
const openClassName = isOpen ? "datepicker--open" : "";
|
|
1373
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1382
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1374
1383
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1375
1384
|
"input",
|
|
1376
1385
|
{
|
|
@@ -1378,7 +1387,7 @@ function DatePicker({
|
|
|
1378
1387
|
name,
|
|
1379
1388
|
value: value ? value.toISOString() : ""
|
|
1380
1389
|
}
|
|
1381
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1390
|
+
), /* @__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(
|
|
1382
1391
|
"svg",
|
|
1383
1392
|
{
|
|
1384
1393
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1397,7 +1406,7 @@ function DatePicker({
|
|
|
1397
1406
|
{
|
|
1398
1407
|
ref: inputRef,
|
|
1399
1408
|
type: "text",
|
|
1400
|
-
className:
|
|
1409
|
+
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" : ""}`,
|
|
1401
1410
|
value: inputValue,
|
|
1402
1411
|
onChange: handleInputChange,
|
|
1403
1412
|
onClick: handleToggle,
|
|
@@ -1414,13 +1423,13 @@ function DatePicker({
|
|
|
1414
1423
|
"button",
|
|
1415
1424
|
{
|
|
1416
1425
|
type: "button",
|
|
1417
|
-
className: "
|
|
1426
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1418
1427
|
onClick: handleClear,
|
|
1419
1428
|
"aria-label": "Clear date",
|
|
1420
1429
|
tabIndex: -1
|
|
1421
1430
|
},
|
|
1422
1431
|
"\u2715"
|
|
1423
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1432
|
+
)), 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()));
|
|
1424
1433
|
}
|
|
1425
1434
|
DatePicker.displayName = "DatePicker";
|
|
1426
1435
|
function parseTimeString(timeStr, use24Hour) {
|
|
@@ -1553,11 +1562,7 @@ function TimePicker({
|
|
|
1553
1562
|
}
|
|
1554
1563
|
return mins;
|
|
1555
1564
|
}, [minuteStep]);
|
|
1556
|
-
const
|
|
1557
|
-
const errorClassName = error ? "timepicker--error" : "";
|
|
1558
|
-
const disabledClassName = disabled ? "timepicker--disabled" : "";
|
|
1559
|
-
const openClassName = isOpen ? "timepicker--open" : "";
|
|
1560
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1565
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1561
1566
|
const displayValue = formatTimeValue(timeValue, use24Hour);
|
|
1562
1567
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1563
1568
|
"input",
|
|
@@ -1566,7 +1571,7 @@ function TimePicker({
|
|
|
1566
1571
|
name,
|
|
1567
1572
|
value
|
|
1568
1573
|
}
|
|
1569
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1574
|
+
), /* @__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(
|
|
1570
1575
|
"svg",
|
|
1571
1576
|
{
|
|
1572
1577
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1586,7 +1591,7 @@ function TimePicker({
|
|
|
1586
1591
|
{
|
|
1587
1592
|
ref: inputRef,
|
|
1588
1593
|
type: "text",
|
|
1589
|
-
className:
|
|
1594
|
+
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" : ""}`,
|
|
1590
1595
|
value: displayValue,
|
|
1591
1596
|
onClick: handleToggle,
|
|
1592
1597
|
onBlur,
|
|
@@ -1602,13 +1607,13 @@ function TimePicker({
|
|
|
1602
1607
|
"button",
|
|
1603
1608
|
{
|
|
1604
1609
|
type: "button",
|
|
1605
|
-
className: "
|
|
1610
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1606
1611
|
onClick: handleClear,
|
|
1607
1612
|
"aria-label": "Clear time",
|
|
1608
1613
|
tabIndex: -1
|
|
1609
1614
|
},
|
|
1610
1615
|
"\u2715"
|
|
1611
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1616
|
+
)), 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) => {
|
|
1612
1617
|
const displayHour = use24Hour ? hour : hour;
|
|
1613
1618
|
const isSelected = use24Hour ? timeValue?.hour === (hour === 0 ? 12 : hour > 12 ? hour - 12 : hour) && timeValue?.period === (hour >= 12 ? "PM" : "AM") : timeValue?.hour === hour;
|
|
1614
1619
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1616,7 +1621,7 @@ function TimePicker({
|
|
|
1616
1621
|
{
|
|
1617
1622
|
key: hour,
|
|
1618
1623
|
type: "button",
|
|
1619
|
-
className: `
|
|
1624
|
+
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" : ""}`,
|
|
1620
1625
|
onClick: () => {
|
|
1621
1626
|
if (use24Hour) {
|
|
1622
1627
|
const hour12 = hour === 0 ? 12 : hour > 12 ? hour - 12 : hour;
|
|
@@ -1636,24 +1641,24 @@ function TimePicker({
|
|
|
1636
1641
|
},
|
|
1637
1642
|
String(displayHour).padStart(2, "0")
|
|
1638
1643
|
);
|
|
1639
|
-
}))), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1644
|
+
}))), /* @__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) => {
|
|
1640
1645
|
const isSelected = timeValue?.minute === minute;
|
|
1641
1646
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
1642
1647
|
"button",
|
|
1643
1648
|
{
|
|
1644
1649
|
key: minute,
|
|
1645
1650
|
type: "button",
|
|
1646
|
-
className: `
|
|
1651
|
+
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" : ""}`,
|
|
1647
1652
|
onClick: () => handleMinuteChange(minute),
|
|
1648
1653
|
"aria-label": `${String(minute).padStart(2, "0")} minutes`
|
|
1649
1654
|
},
|
|
1650
1655
|
String(minute).padStart(2, "0")
|
|
1651
1656
|
);
|
|
1652
|
-
}))), !use24Hour && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1657
|
+
}))), !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(
|
|
1653
1658
|
"button",
|
|
1654
1659
|
{
|
|
1655
1660
|
type: "button",
|
|
1656
|
-
className: `
|
|
1661
|
+
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" : ""}`,
|
|
1657
1662
|
onClick: () => handlePeriodChange("AM")
|
|
1658
1663
|
},
|
|
1659
1664
|
"AM"
|
|
@@ -1661,7 +1666,7 @@ function TimePicker({
|
|
|
1661
1666
|
"button",
|
|
1662
1667
|
{
|
|
1663
1668
|
type: "button",
|
|
1664
|
-
className: `
|
|
1669
|
+
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" : ""}`,
|
|
1665
1670
|
onClick: () => handlePeriodChange("PM")
|
|
1666
1671
|
},
|
|
1667
1672
|
"PM"
|
|
@@ -1800,27 +1805,27 @@ function DateRangePicker({
|
|
|
1800
1805
|
const handleNextMonth = () => {
|
|
1801
1806
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1802
1807
|
};
|
|
1803
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
1808
|
+
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(
|
|
1804
1809
|
"button",
|
|
1805
1810
|
{
|
|
1806
1811
|
type: "button",
|
|
1807
|
-
className: "
|
|
1812
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1808
1813
|
onClick: handlePrevMonth,
|
|
1809
1814
|
"aria-label": "Previous month"
|
|
1810
1815
|
},
|
|
1811
1816
|
"\u2190"
|
|
1812
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1817
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7__namespace.createElement(
|
|
1813
1818
|
"button",
|
|
1814
1819
|
{
|
|
1815
1820
|
type: "button",
|
|
1816
|
-
className: "
|
|
1821
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1817
1822
|
onClick: handleNextMonth,
|
|
1818
1823
|
"aria-label": "Next month"
|
|
1819
1824
|
},
|
|
1820
1825
|
"\u2192"
|
|
1821
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1826
|
+
)), /* @__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) => {
|
|
1822
1827
|
if (!date) {
|
|
1823
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}
|
|
1828
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}` });
|
|
1824
1829
|
}
|
|
1825
1830
|
const isStart = rangeStart && date.toDateString() === rangeStart.toDateString();
|
|
1826
1831
|
const isEnd = rangeEnd && date.toDateString() === rangeEnd.toDateString();
|
|
@@ -1833,7 +1838,7 @@ function DateRangePicker({
|
|
|
1833
1838
|
{
|
|
1834
1839
|
key: date.toISOString(),
|
|
1835
1840
|
type: "button",
|
|
1836
|
-
className: `
|
|
1841
|
+
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" : ""}`,
|
|
1837
1842
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1838
1843
|
onMouseEnter: () => setHoverDate(date),
|
|
1839
1844
|
onMouseLeave: () => setHoverDate(null),
|
|
@@ -1844,11 +1849,7 @@ function DateRangePicker({
|
|
|
1844
1849
|
);
|
|
1845
1850
|
})));
|
|
1846
1851
|
};
|
|
1847
|
-
const
|
|
1848
|
-
const errorClassName = error ? "daterangepicker--error" : "";
|
|
1849
|
-
const disabledClassName = disabled ? "daterangepicker--disabled" : "";
|
|
1850
|
-
const openClassName = isOpen ? "daterangepicker--open" : "";
|
|
1851
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1852
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1852
1853
|
const displayValue = rangeStart && rangeEnd ? `${formatDate2(rangeStart, format)}${separator}${formatDate2(rangeEnd, format)}` : rangeStart ? formatDate2(rangeStart, format) : "";
|
|
1853
1854
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1854
1855
|
"input",
|
|
@@ -1864,7 +1865,7 @@ function DateRangePicker({
|
|
|
1864
1865
|
name: `${name}[end]`,
|
|
1865
1866
|
value: rangeEnd ? rangeEnd.toISOString() : ""
|
|
1866
1867
|
}
|
|
1867
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1868
|
+
), /* @__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(
|
|
1868
1869
|
"svg",
|
|
1869
1870
|
{
|
|
1870
1871
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1882,7 +1883,7 @@ function DateRangePicker({
|
|
|
1882
1883
|
"input",
|
|
1883
1884
|
{
|
|
1884
1885
|
type: "text",
|
|
1885
|
-
className:
|
|
1886
|
+
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" : ""}`,
|
|
1886
1887
|
value: displayValue,
|
|
1887
1888
|
onClick: handleToggle,
|
|
1888
1889
|
onBlur,
|
|
@@ -1898,13 +1899,13 @@ function DateRangePicker({
|
|
|
1898
1899
|
"button",
|
|
1899
1900
|
{
|
|
1900
1901
|
type: "button",
|
|
1901
|
-
className: "
|
|
1902
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1902
1903
|
onClick: handleClear,
|
|
1903
1904
|
"aria-label": "Clear date range",
|
|
1904
1905
|
tabIndex: -1
|
|
1905
1906
|
},
|
|
1906
1907
|
"\u2715"
|
|
1907
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1908
|
+
)), 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")));
|
|
1908
1909
|
}
|
|
1909
1910
|
DateRangePicker.displayName = "DateRangePicker";
|
|
1910
1911
|
function htmlToMarkdown(html) {
|
|
@@ -2059,17 +2060,13 @@ function RichTextEditor({
|
|
|
2059
2060
|
}
|
|
2060
2061
|
}
|
|
2061
2062
|
};
|
|
2062
|
-
const
|
|
2063
|
-
const errorClassName = error ? "richtexteditor--error" : "";
|
|
2064
|
-
const disabledClassName = disabled ? "richtexteditor--disabled" : "";
|
|
2065
|
-
const modeClassName = `richtexteditor--${currentMode}`;
|
|
2066
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${modeClassName} ${className}`.trim();
|
|
2063
|
+
const combinedClassName = `rounded-md border border-input ${error ? "border-red-500 ring-1 ring-red-500" : ""} ${disabled ? "opacity-50 cursor-not-allowed" : ""} ${className}`.trim();
|
|
2067
2064
|
const editorStyle = {
|
|
2068
2065
|
minHeight,
|
|
2069
2066
|
maxHeight,
|
|
2070
2067
|
overflowY: maxHeight ? "auto" : void 0
|
|
2071
2068
|
};
|
|
2072
|
-
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: "
|
|
2069
|
+
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) => {
|
|
2073
2070
|
const button = toolbarConfig[buttonName];
|
|
2074
2071
|
if (!button) return null;
|
|
2075
2072
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -2077,7 +2074,7 @@ function RichTextEditor({
|
|
|
2077
2074
|
{
|
|
2078
2075
|
key: buttonName,
|
|
2079
2076
|
type: "button",
|
|
2080
|
-
className: "
|
|
2077
|
+
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",
|
|
2081
2078
|
onClick: () => editorRef.current && button.action(editorRef.current),
|
|
2082
2079
|
title: button.title,
|
|
2083
2080
|
disabled: disabled || currentMode === "markdown",
|
|
@@ -2089,18 +2086,18 @@ function RichTextEditor({
|
|
|
2089
2086
|
"button",
|
|
2090
2087
|
{
|
|
2091
2088
|
type: "button",
|
|
2092
|
-
className: "
|
|
2089
|
+
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",
|
|
2093
2090
|
onClick: handleModeToggle,
|
|
2094
2091
|
disabled,
|
|
2095
2092
|
title: `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`,
|
|
2096
2093
|
"aria-label": `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`
|
|
2097
2094
|
},
|
|
2098
2095
|
currentMode === "wysiwyg" ? "MD" : "WYSIWYG"
|
|
2099
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
2096
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { style: editorStyle }, currentMode === "wysiwyg" ? /* @__PURE__ */ React7__namespace.createElement(
|
|
2100
2097
|
"div",
|
|
2101
2098
|
{
|
|
2102
2099
|
ref: editorRef,
|
|
2103
|
-
className: "
|
|
2100
|
+
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",
|
|
2104
2101
|
role: "textbox",
|
|
2105
2102
|
contentEditable: !disabled,
|
|
2106
2103
|
onInput: handleWysiwygChange,
|
|
@@ -2115,7 +2112,7 @@ function RichTextEditor({
|
|
|
2115
2112
|
"textarea",
|
|
2116
2113
|
{
|
|
2117
2114
|
ref: textareaRef,
|
|
2118
|
-
className: "
|
|
2115
|
+
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",
|
|
2119
2116
|
value: content,
|
|
2120
2117
|
onChange: handleMarkdownChange,
|
|
2121
2118
|
onBlur,
|
|
@@ -2124,7 +2121,8 @@ function RichTextEditor({
|
|
|
2124
2121
|
placeholder,
|
|
2125
2122
|
"aria-invalid": error || props["aria-invalid"] ? "true" : "false",
|
|
2126
2123
|
"aria-describedby": props["aria-describedby"],
|
|
2127
|
-
"aria-required": required || props["aria-required"]
|
|
2124
|
+
"aria-required": required || props["aria-required"],
|
|
2125
|
+
style: editorStyle
|
|
2128
2126
|
}
|
|
2129
2127
|
)));
|
|
2130
2128
|
}
|