@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.js
CHANGED
|
@@ -21,8 +21,8 @@ function TextInput({
|
|
|
21
21
|
const handleBlur = () => {
|
|
22
22
|
onBlur?.();
|
|
23
23
|
};
|
|
24
|
-
const baseClassName = "text-
|
|
25
|
-
const errorClassName = error ? "
|
|
24
|
+
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";
|
|
25
|
+
const errorClassName = error ? "border-red-500 ring-1 ring-red-500" : "";
|
|
26
26
|
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
27
27
|
return /* @__PURE__ */ React7.createElement(
|
|
28
28
|
"input",
|
|
@@ -68,8 +68,8 @@ function TextArea({
|
|
|
68
68
|
const handleBlur = () => {
|
|
69
69
|
onBlur?.();
|
|
70
70
|
};
|
|
71
|
-
const baseClassName = "
|
|
72
|
-
const errorClassName = error ? "
|
|
71
|
+
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";
|
|
72
|
+
const errorClassName = error ? "border-red-500 ring-1 ring-red-500" : "";
|
|
73
73
|
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
74
74
|
return /* @__PURE__ */ React7.createElement(
|
|
75
75
|
"textarea",
|
|
@@ -106,9 +106,11 @@ function Checkbox({
|
|
|
106
106
|
className = "",
|
|
107
107
|
indeterminate = false,
|
|
108
108
|
label,
|
|
109
|
+
description,
|
|
109
110
|
...props
|
|
110
111
|
}) {
|
|
111
112
|
const inputRef = React7.useRef(null);
|
|
113
|
+
const checkboxId = props.id || `checkbox-${name}`;
|
|
112
114
|
React7.useEffect(() => {
|
|
113
115
|
if (inputRef.current) {
|
|
114
116
|
inputRef.current.indeterminate = indeterminate;
|
|
@@ -120,29 +122,41 @@ function Checkbox({
|
|
|
120
122
|
const handleBlur = () => {
|
|
121
123
|
onBlur?.();
|
|
122
124
|
};
|
|
123
|
-
const
|
|
124
|
-
const errorClassName = error ? "checkbox--error" : "";
|
|
125
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${className}`.trim();
|
|
126
|
-
const checkbox = /* @__PURE__ */ React7.createElement(
|
|
125
|
+
const checkbox = /* @__PURE__ */ React7.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7.createElement(
|
|
127
126
|
"input",
|
|
128
127
|
{
|
|
129
128
|
ref: inputRef,
|
|
130
129
|
type: "checkbox",
|
|
130
|
+
id: checkboxId,
|
|
131
131
|
name,
|
|
132
132
|
checked: value,
|
|
133
133
|
onChange: handleChange,
|
|
134
134
|
onBlur: handleBlur,
|
|
135
135
|
disabled,
|
|
136
136
|
required,
|
|
137
|
-
className:
|
|
137
|
+
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}`,
|
|
138
138
|
"aria-invalid": error || props["aria-invalid"],
|
|
139
|
-
"aria-describedby": props["aria-describedby"],
|
|
139
|
+
"aria-describedby": description ? `${checkboxId}-description` : props["aria-describedby"],
|
|
140
140
|
"aria-required": required || props["aria-required"],
|
|
141
141
|
...props
|
|
142
142
|
}
|
|
143
|
-
);
|
|
143
|
+
), value && /* @__PURE__ */ React7.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.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7.createElement("polyline", { points: "20 6 9 17 4 12" }))), indeterminate && !value && /* @__PURE__ */ React7.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.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))));
|
|
144
144
|
if (label) {
|
|
145
|
-
return /* @__PURE__ */ React7.createElement(
|
|
145
|
+
return /* @__PURE__ */ React7.createElement(
|
|
146
|
+
"label",
|
|
147
|
+
{
|
|
148
|
+
className: `flex w-fit gap-2 items-center ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
149
|
+
htmlFor: checkboxId
|
|
150
|
+
},
|
|
151
|
+
/* @__PURE__ */ React7.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, checkbox, /* @__PURE__ */ React7.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-2 text-sm font-medium" }, label), description && /* @__PURE__ */ React7.createElement(
|
|
152
|
+
"p",
|
|
153
|
+
{
|
|
154
|
+
className: "text-muted-foreground text-sm",
|
|
155
|
+
id: `${checkboxId}-description`
|
|
156
|
+
},
|
|
157
|
+
description
|
|
158
|
+
)))
|
|
159
|
+
);
|
|
146
160
|
}
|
|
147
161
|
return checkbox;
|
|
148
162
|
}
|
|
@@ -193,15 +207,13 @@ function CheckboxGroup({
|
|
|
193
207
|
const handleBlur = () => {
|
|
194
208
|
onBlur?.();
|
|
195
209
|
};
|
|
196
|
-
const
|
|
197
|
-
const
|
|
198
|
-
const layoutClassName = `checkbox-group--${layout}`;
|
|
199
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${layoutClassName} ${className}`.trim();
|
|
210
|
+
const layoutClass = layout === "inline" ? "flex flex-row flex-wrap gap-4" : layout === "grid" ? `grid gap-3` : "flex flex-col gap-3";
|
|
211
|
+
const containerClass = `w-full ${layoutClass} ${className}`.trim();
|
|
200
212
|
const maxReached = Boolean(maxSelections && value.length >= maxSelections);
|
|
201
213
|
return /* @__PURE__ */ React7.createElement(
|
|
202
214
|
"div",
|
|
203
215
|
{
|
|
204
|
-
className:
|
|
216
|
+
className: containerClass,
|
|
205
217
|
role: "group",
|
|
206
218
|
"aria-invalid": error || props["aria-invalid"],
|
|
207
219
|
"aria-describedby": props["aria-describedby"],
|
|
@@ -211,25 +223,32 @@ function CheckboxGroup({
|
|
|
211
223
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
212
224
|
} : void 0
|
|
213
225
|
},
|
|
214
|
-
label && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
215
|
-
description && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
216
|
-
|
|
217
|
-
"
|
|
226
|
+
label && /* @__PURE__ */ React7.createElement("div", { className: "text-sm font-medium" }, label),
|
|
227
|
+
description && /* @__PURE__ */ React7.createElement("div", { className: "text-muted-foreground text-sm" }, description),
|
|
228
|
+
showSelectAll && enabledOptions.length > 0 && /* @__PURE__ */ React7.createElement(
|
|
229
|
+
"label",
|
|
218
230
|
{
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
className: `flex w-fit gap-2 items-center ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`
|
|
232
|
+
},
|
|
233
|
+
/* @__PURE__ */ React7.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, /* @__PURE__ */ React7.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7.createElement(
|
|
234
|
+
"input",
|
|
235
|
+
{
|
|
236
|
+
type: "checkbox",
|
|
237
|
+
checked: allSelected,
|
|
238
|
+
ref: (input) => {
|
|
239
|
+
if (input) {
|
|
240
|
+
input.indeterminate = someSelected;
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
onChange: (e) => handleSelectAll(e.target.checked),
|
|
244
|
+
onBlur: handleBlur,
|
|
245
|
+
disabled,
|
|
246
|
+
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",
|
|
247
|
+
"aria-label": selectAllLabel
|
|
248
|
+
}
|
|
249
|
+
), allSelected && /* @__PURE__ */ React7.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.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7.createElement("polyline", { points: "20 6 9 17 4 12" }))), someSelected && !allSelected && /* @__PURE__ */ React7.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.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" })))), /* @__PURE__ */ React7.createElement("span", { className: "text-sm font-medium" }, selectAllLabel))
|
|
250
|
+
),
|
|
251
|
+
options.map((option) => {
|
|
233
252
|
const isChecked = value.includes(option.value);
|
|
234
253
|
const isDisabled = disabled || option.disabled || maxReached && !isChecked;
|
|
235
254
|
const checkboxId = `${name}-${option.value}`;
|
|
@@ -237,10 +256,10 @@ function CheckboxGroup({
|
|
|
237
256
|
"label",
|
|
238
257
|
{
|
|
239
258
|
key: option.value,
|
|
240
|
-
className: `
|
|
259
|
+
className: `flex w-fit gap-2 items-center ${isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
241
260
|
htmlFor: checkboxId
|
|
242
261
|
},
|
|
243
|
-
/* @__PURE__ */ React7.createElement(
|
|
262
|
+
/* @__PURE__ */ React7.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, /* @__PURE__ */ React7.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7.createElement(
|
|
244
263
|
"input",
|
|
245
264
|
{
|
|
246
265
|
type: "checkbox",
|
|
@@ -252,21 +271,20 @@ function CheckboxGroup({
|
|
|
252
271
|
onBlur: handleBlur,
|
|
253
272
|
disabled: isDisabled,
|
|
254
273
|
required: required && minSelections ? value.length < minSelections : false,
|
|
255
|
-
className:
|
|
274
|
+
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" : ""}`,
|
|
256
275
|
"aria-describedby": option.description ? `${checkboxId}-description` : props["aria-describedby"]
|
|
257
276
|
}
|
|
258
|
-
),
|
|
259
|
-
|
|
260
|
-
"span",
|
|
277
|
+
), isChecked && /* @__PURE__ */ React7.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.createElement("svg", { className: "size-3", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3" }, /* @__PURE__ */ React7.createElement("polyline", { points: "20 6 9 17 4 12" })))), /* @__PURE__ */ React7.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, renderOption ? renderOption(option) : /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-2 text-sm font-medium" }, option.label), option.description && /* @__PURE__ */ React7.createElement(
|
|
278
|
+
"p",
|
|
261
279
|
{
|
|
262
|
-
className: "
|
|
280
|
+
className: "text-muted-foreground text-sm",
|
|
263
281
|
id: `${checkboxId}-description`
|
|
264
282
|
},
|
|
265
283
|
option.description
|
|
266
|
-
)))
|
|
284
|
+
))))
|
|
267
285
|
);
|
|
268
|
-
})
|
|
269
|
-
(minSelections || maxSelections) && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
286
|
+
}),
|
|
287
|
+
(minSelections || maxSelections) && /* @__PURE__ */ React7.createElement("div", { className: "text-sm text-muted-foreground mt-2", "aria-live": "polite" }, minSelections && value.length < minSelections && /* @__PURE__ */ React7.createElement("span", { className: "text-destructive" }, "Select at least ", minSelections, " option", minSelections !== 1 ? "s" : ""), maxSelections && /* @__PURE__ */ React7.createElement("span", null, value.length, "/", maxSelections, " selected"))
|
|
270
288
|
);
|
|
271
289
|
}
|
|
272
290
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
@@ -315,22 +333,20 @@ function Radio({
|
|
|
315
333
|
const handleBlur = () => {
|
|
316
334
|
onBlur?.();
|
|
317
335
|
};
|
|
318
|
-
const
|
|
319
|
-
const
|
|
320
|
-
const layoutClassName = `radio-group--${layout}`;
|
|
321
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${layoutClassName} ${className}`.trim();
|
|
336
|
+
const layoutClass = layout === "inline" ? "flex flex-row flex-wrap gap-4" : "grid w-full gap-2";
|
|
337
|
+
const containerClass = `${layoutClass} ${className}`.trim();
|
|
322
338
|
return /* @__PURE__ */ React7.createElement(
|
|
323
339
|
"div",
|
|
324
340
|
{
|
|
325
|
-
className:
|
|
341
|
+
className: containerClass,
|
|
326
342
|
role: "radiogroup",
|
|
327
343
|
"aria-invalid": error || props["aria-invalid"],
|
|
328
344
|
"aria-describedby": props["aria-describedby"],
|
|
329
345
|
"aria-required": required || props["aria-required"],
|
|
330
346
|
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
331
347
|
},
|
|
332
|
-
label && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
333
|
-
|
|
348
|
+
label && /* @__PURE__ */ React7.createElement("div", { className: "text-sm font-medium mb-2" }, label),
|
|
349
|
+
options.map((option, index) => {
|
|
334
350
|
const isChecked = value === option.value;
|
|
335
351
|
const isDisabled = disabled || option.disabled;
|
|
336
352
|
const radioId = `${name}-${option.value}`;
|
|
@@ -338,10 +354,19 @@ function Radio({
|
|
|
338
354
|
"label",
|
|
339
355
|
{
|
|
340
356
|
key: option.value,
|
|
341
|
-
className: `
|
|
342
|
-
htmlFor: radioId
|
|
357
|
+
className: `flex w-fit gap-2 items-center ${isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
358
|
+
htmlFor: radioId,
|
|
359
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
360
|
+
tabIndex: isDisabled ? -1 : 0
|
|
343
361
|
},
|
|
344
|
-
/* @__PURE__ */ React7.createElement(
|
|
362
|
+
/* @__PURE__ */ React7.createElement("div", { className: "flex w-full flex-row items-center gap-2" }, /* @__PURE__ */ React7.createElement("div", { className: "flex flex-1 flex-col gap-0.5" }, option.description ? /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-2 text-sm font-medium" }, option.label), /* @__PURE__ */ React7.createElement(
|
|
363
|
+
"p",
|
|
364
|
+
{
|
|
365
|
+
className: "text-muted-foreground text-sm",
|
|
366
|
+
id: `${radioId}-description`
|
|
367
|
+
},
|
|
368
|
+
option.description
|
|
369
|
+
)) : /* @__PURE__ */ React7.createElement("span", { className: "text-sm font-medium" }, option.label)), /* @__PURE__ */ React7.createElement("div", { className: "relative" }, /* @__PURE__ */ React7.createElement(
|
|
345
370
|
"input",
|
|
346
371
|
{
|
|
347
372
|
type: "radio",
|
|
@@ -351,23 +376,14 @@ function Radio({
|
|
|
351
376
|
checked: isChecked,
|
|
352
377
|
onChange: (e) => handleChange(e.target.value),
|
|
353
378
|
onBlur: handleBlur,
|
|
354
|
-
onKeyDown: (e) => handleKeyDown(e, index),
|
|
355
379
|
disabled: isDisabled,
|
|
356
380
|
required,
|
|
357
|
-
className:
|
|
381
|
+
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"}`,
|
|
358
382
|
"aria-describedby": option.description ? `${radioId}-description` : props["aria-describedby"]
|
|
359
383
|
}
|
|
360
|
-
),
|
|
361
|
-
/* @__PURE__ */ React7.createElement("div", { className: "radio-content" }, /* @__PURE__ */ React7.createElement("span", { className: "radio-label" }, option.label), option.description && /* @__PURE__ */ React7.createElement(
|
|
362
|
-
"span",
|
|
363
|
-
{
|
|
364
|
-
className: "radio-description",
|
|
365
|
-
id: `${radioId}-description`
|
|
366
|
-
},
|
|
367
|
-
option.description
|
|
368
|
-
))
|
|
384
|
+
), isChecked && /* @__PURE__ */ React7.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.createElement("svg", { className: "size-2 fill-current", viewBox: "0 0 24 24" }, /* @__PURE__ */ React7.createElement("circle", { cx: "12", cy: "12", r: "10" })))))
|
|
369
385
|
);
|
|
370
|
-
})
|
|
386
|
+
})
|
|
371
387
|
);
|
|
372
388
|
}
|
|
373
389
|
Radio.displayName = "Radio";
|
|
@@ -532,11 +548,7 @@ function Select({
|
|
|
532
548
|
};
|
|
533
549
|
}
|
|
534
550
|
}, [isOpen]);
|
|
535
|
-
const
|
|
536
|
-
const errorClassName = error ? "select--error" : "";
|
|
537
|
-
const disabledClassName = disabled ? "select--disabled" : "";
|
|
538
|
-
const openClassName = isOpen ? "select--open" : "";
|
|
539
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
551
|
+
const combinedClassName = `relative w-full ${className}`.trim();
|
|
540
552
|
return /* @__PURE__ */ React7.createElement(
|
|
541
553
|
"div",
|
|
542
554
|
{
|
|
@@ -564,7 +576,7 @@ function Select({
|
|
|
564
576
|
/* @__PURE__ */ React7.createElement(
|
|
565
577
|
"div",
|
|
566
578
|
{
|
|
567
|
-
className: "
|
|
579
|
+
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" : ""}`,
|
|
568
580
|
onClick: handleToggle,
|
|
569
581
|
role: "combobox",
|
|
570
582
|
"aria-expanded": isOpen,
|
|
@@ -575,39 +587,39 @@ function Select({
|
|
|
575
587
|
"aria-disabled": disabled,
|
|
576
588
|
tabIndex: disabled ? -1 : 0
|
|
577
589
|
},
|
|
578
|
-
/* @__PURE__ */ React7.createElement("span", { className: "
|
|
579
|
-
/* @__PURE__ */ React7.createElement("div", { className: "
|
|
590
|
+
/* @__PURE__ */ React7.createElement("span", { className: "flex items-center flex-1 overflow-hidden text-ellipsis" }, selectedOption ? renderOption ? renderOption(selectedOption) : selectedOption.label : /* @__PURE__ */ React7.createElement("span", { className: "text-muted-foreground" }, placeholder)),
|
|
591
|
+
/* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-1 ml-2" }, loading && /* @__PURE__ */ React7.createElement("span", { className: "text-xs" }, "\u23F3"), clearable && value && !disabled && !loading && /* @__PURE__ */ React7.createElement(
|
|
580
592
|
"button",
|
|
581
593
|
{
|
|
582
594
|
type: "button",
|
|
583
|
-
className: "
|
|
595
|
+
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",
|
|
584
596
|
onClick: handleClear,
|
|
585
597
|
"aria-label": "Clear selection",
|
|
586
598
|
tabIndex: -1
|
|
587
599
|
},
|
|
588
600
|
"\u2715"
|
|
589
|
-
), /* @__PURE__ */ React7.createElement("span", { className: "
|
|
601
|
+
), /* @__PURE__ */ React7.createElement("span", { className: "text-muted-foreground text-xs leading-none", "aria-hidden": "true" }, isOpen ? "\u25B2" : "\u25BC"))
|
|
590
602
|
),
|
|
591
|
-
isOpen && /* @__PURE__ */ React7.createElement("div", { id: dropdownId, className: "
|
|
603
|
+
isOpen && /* @__PURE__ */ React7.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.createElement("div", { className: "p-2 border-b border-border" }, /* @__PURE__ */ React7.createElement(
|
|
592
604
|
"input",
|
|
593
605
|
{
|
|
594
606
|
ref: searchInputRef,
|
|
595
607
|
type: "text",
|
|
596
|
-
className: "
|
|
608
|
+
className: "w-full border border-input rounded px-2 py-1 text-sm bg-transparent outline-none focus:ring-1 focus:ring-ring",
|
|
597
609
|
placeholder: "Search...",
|
|
598
610
|
value: searchQuery,
|
|
599
611
|
onChange: handleSearchChange,
|
|
600
612
|
onClick: (e) => e.stopPropagation(),
|
|
601
613
|
"aria-label": "Search options"
|
|
602
614
|
}
|
|
603
|
-
)), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
615
|
+
)), /* @__PURE__ */ React7.createElement("div", { className: "max-h-64 overflow-y-auto p-1" }, filteredOptions.length === 0 ? /* @__PURE__ */ React7.createElement("div", { className: "py-2 px-3 text-center text-sm text-muted-foreground" }, "No options found") : optionGroups.length > 0 ? (
|
|
604
616
|
// Render grouped options
|
|
605
617
|
optionGroups.map((group, groupIndex) => {
|
|
606
618
|
const groupOptions = group.options.filter(
|
|
607
619
|
(opt) => filteredOptions.includes(opt)
|
|
608
620
|
);
|
|
609
621
|
if (groupOptions.length === 0) return null;
|
|
610
|
-
return /* @__PURE__ */ React7.createElement("div", { key: groupIndex, className: "
|
|
622
|
+
return /* @__PURE__ */ React7.createElement("div", { key: groupIndex, className: "py-1" }, /* @__PURE__ */ React7.createElement("div", { className: "py-1.5 px-2 text-xs font-semibold text-muted-foreground" }, group.label), groupOptions.map((option) => {
|
|
611
623
|
const globalIndex = filteredOptions.indexOf(option);
|
|
612
624
|
const isSelected = value === option.value;
|
|
613
625
|
const isFocused = globalIndex === focusedIndex;
|
|
@@ -616,7 +628,7 @@ function Select({
|
|
|
616
628
|
"div",
|
|
617
629
|
{
|
|
618
630
|
key: option.value,
|
|
619
|
-
className: `
|
|
631
|
+
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" : ""}`,
|
|
620
632
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
621
633
|
role: "option",
|
|
622
634
|
"aria-selected": isSelected,
|
|
@@ -636,7 +648,7 @@ function Select({
|
|
|
636
648
|
"div",
|
|
637
649
|
{
|
|
638
650
|
key: option.value,
|
|
639
|
-
className: `
|
|
651
|
+
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" : ""}`,
|
|
640
652
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
641
653
|
role: "option",
|
|
642
654
|
"aria-selected": isSelected,
|
|
@@ -916,11 +928,7 @@ function FileInput({
|
|
|
916
928
|
}
|
|
917
929
|
};
|
|
918
930
|
}, [value, imageToCrop]);
|
|
919
|
-
const
|
|
920
|
-
const errorClassName = error ? "file-input--error" : "";
|
|
921
|
-
const dragClassName = dragActive ? "file-input--drag-active" : "";
|
|
922
|
-
const disabledClassName = disabled ? "file-input--disabled" : "";
|
|
923
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${dragClassName} ${disabledClassName} ${className}`.trim();
|
|
931
|
+
const combinedClassName = `${className}`.trim();
|
|
924
932
|
return /* @__PURE__ */ React7.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7.createElement(
|
|
925
933
|
"input",
|
|
926
934
|
{
|
|
@@ -933,7 +941,6 @@ function FileInput({
|
|
|
933
941
|
multiple,
|
|
934
942
|
disabled,
|
|
935
943
|
required: required && value.length === 0,
|
|
936
|
-
className: "file-input__native",
|
|
937
944
|
"aria-invalid": error || props["aria-invalid"],
|
|
938
945
|
"aria-describedby": props["aria-describedby"],
|
|
939
946
|
"aria-required": required || props["aria-required"],
|
|
@@ -942,7 +949,7 @@ function FileInput({
|
|
|
942
949
|
), /* @__PURE__ */ React7.createElement(
|
|
943
950
|
"div",
|
|
944
951
|
{
|
|
945
|
-
className: "
|
|
952
|
+
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" : ""}`,
|
|
946
953
|
onDragEnter: handleDrag,
|
|
947
954
|
onDragLeave: handleDrag,
|
|
948
955
|
onDragOver: handleDrag,
|
|
@@ -954,10 +961,10 @@ function FileInput({
|
|
|
954
961
|
"aria-label": placeholder,
|
|
955
962
|
"aria-disabled": disabled
|
|
956
963
|
},
|
|
957
|
-
/* @__PURE__ */ React7.createElement("div", { className: "
|
|
964
|
+
/* @__PURE__ */ React7.createElement("div", { className: "flex flex-col items-center gap-2 text-center" }, /* @__PURE__ */ React7.createElement(
|
|
958
965
|
"svg",
|
|
959
966
|
{
|
|
960
|
-
className: "
|
|
967
|
+
className: "text-muted-foreground",
|
|
961
968
|
width: "48",
|
|
962
969
|
height: "48",
|
|
963
970
|
viewBox: "0 0 24 24",
|
|
@@ -971,30 +978,36 @@ function FileInput({
|
|
|
971
978
|
/* @__PURE__ */ React7.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
972
979
|
/* @__PURE__ */ React7.createElement("polyline", { points: "17 8 12 3 7 8" }),
|
|
973
980
|
/* @__PURE__ */ React7.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
974
|
-
), /* @__PURE__ */ React7.createElement("p", { className: "
|
|
975
|
-
), value.length > 0 && /* @__PURE__ */ React7.createElement("ul", { className: "
|
|
981
|
+
), /* @__PURE__ */ React7.createElement("p", { className: "text-sm font-medium" }, value.length > 0 ? `${value.length} file(s) selected` : placeholder), accept && /* @__PURE__ */ React7.createElement("p", { className: "text-xs text-muted-foreground" }, "Accepted: ", accept), maxSize && /* @__PURE__ */ React7.createElement("p", { className: "text-xs text-muted-foreground" }, "Max size: ", formatFileSize(maxSize)))
|
|
982
|
+
), value.length > 0 && /* @__PURE__ */ React7.createElement("ul", { className: "flex flex-col gap-2 mt-4", role: "list" }, value.map((file, index) => {
|
|
976
983
|
const previewUrl = showPreview ? getPreviewUrl(file) : null;
|
|
977
|
-
return /* @__PURE__ */ React7.createElement("li", { key: `${file.name}-${index}`, className: "
|
|
984
|
+
return /* @__PURE__ */ React7.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.createElement(
|
|
978
985
|
"img",
|
|
979
986
|
{
|
|
980
987
|
src: previewUrl,
|
|
981
988
|
alt: file.name,
|
|
982
|
-
className: "
|
|
989
|
+
className: "w-12 h-12 rounded object-cover",
|
|
983
990
|
width: "48",
|
|
984
991
|
height: "48"
|
|
985
992
|
}
|
|
986
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
993
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col flex-1 min-w-0" }, /* @__PURE__ */ React7.createElement("span", { className: "text-sm font-medium truncate" }, file.name), /* @__PURE__ */ React7.createElement("span", { className: "text-xs text-muted-foreground" }, formatFileSize(file.size)), showProgress && uploadProgress[file.name] !== void 0 && /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-2 mt-1" }, /* @__PURE__ */ React7.createElement(
|
|
987
994
|
"div",
|
|
988
995
|
{
|
|
989
|
-
className: "
|
|
990
|
-
style: { width: `${uploadProgress[file.name]}%` },
|
|
996
|
+
className: "h-1.5 bg-muted rounded-full overflow-hidden flex-1",
|
|
991
997
|
role: "progressbar",
|
|
992
998
|
"aria-valuenow": uploadProgress[file.name],
|
|
993
999
|
"aria-valuemin": 0,
|
|
994
1000
|
"aria-valuemax": 100,
|
|
995
1001
|
"aria-label": `Upload progress: ${uploadProgress[file.name]}%`
|
|
996
|
-
}
|
|
997
|
-
|
|
1002
|
+
},
|
|
1003
|
+
/* @__PURE__ */ React7.createElement(
|
|
1004
|
+
"div",
|
|
1005
|
+
{
|
|
1006
|
+
className: "h-full bg-primary transition-all",
|
|
1007
|
+
style: { width: `${uploadProgress[file.name]}%` }
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
), /* @__PURE__ */ React7.createElement("span", { className: "text-xs text-muted-foreground" }, uploadProgress[file.name], "%"))), enableCropping && file.type.startsWith("image/") && /* @__PURE__ */ React7.createElement(
|
|
998
1011
|
"button",
|
|
999
1012
|
{
|
|
1000
1013
|
type: "button",
|
|
@@ -1003,7 +1016,7 @@ function FileInput({
|
|
|
1003
1016
|
handleCrop(file);
|
|
1004
1017
|
},
|
|
1005
1018
|
disabled,
|
|
1006
|
-
className: "
|
|
1019
|
+
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",
|
|
1007
1020
|
"aria-label": `Crop ${file.name}`
|
|
1008
1021
|
},
|
|
1009
1022
|
/* @__PURE__ */ React7.createElement(
|
|
@@ -1031,7 +1044,7 @@ function FileInput({
|
|
|
1031
1044
|
handleRemove(index);
|
|
1032
1045
|
},
|
|
1033
1046
|
disabled,
|
|
1034
|
-
className: "
|
|
1047
|
+
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",
|
|
1035
1048
|
"aria-label": `Remove ${file.name}`
|
|
1036
1049
|
},
|
|
1037
1050
|
/* @__PURE__ */ React7.createElement(
|
|
@@ -1051,26 +1064,26 @@ function FileInput({
|
|
|
1051
1064
|
/* @__PURE__ */ React7.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1052
1065
|
)
|
|
1053
1066
|
));
|
|
1054
|
-
})), cropperOpen && imageToCrop && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1067
|
+
})), cropperOpen && imageToCrop && /* @__PURE__ */ React7.createElement("div", { className: "fixed inset-0 z-50 flex items-center justify-center" }, /* @__PURE__ */ React7.createElement(
|
|
1055
1068
|
"div",
|
|
1056
1069
|
{
|
|
1057
|
-
className: "
|
|
1070
|
+
className: "absolute inset-0 bg-black/50",
|
|
1058
1071
|
onClick: handleCropCancel,
|
|
1059
1072
|
"aria-label": "Close cropper"
|
|
1060
1073
|
}
|
|
1061
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1074
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "relative bg-popover border border-border rounded-lg shadow-lg max-w-3xl w-full mx-4" }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-between p-4 border-b border-border" }, /* @__PURE__ */ React7.createElement("h3", { className: "text-lg font-semibold" }, "Crop Image"), /* @__PURE__ */ React7.createElement(
|
|
1062
1075
|
"button",
|
|
1063
1076
|
{
|
|
1064
1077
|
type: "button",
|
|
1065
|
-
className: "
|
|
1078
|
+
className: "flex items-center justify-center h-8 w-8 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
1066
1079
|
onClick: handleCropCancel,
|
|
1067
1080
|
"aria-label": "Close"
|
|
1068
1081
|
},
|
|
1069
1082
|
"\u2715"
|
|
1070
|
-
)), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1083
|
+
)), /* @__PURE__ */ React7.createElement("div", { className: "p-4" }, /* @__PURE__ */ React7.createElement(
|
|
1071
1084
|
"div",
|
|
1072
1085
|
{
|
|
1073
|
-
className: "
|
|
1086
|
+
className: "relative w-full h-96 bg-muted rounded-md overflow-hidden",
|
|
1074
1087
|
onMouseDown: (e) => {
|
|
1075
1088
|
e.preventDefault();
|
|
1076
1089
|
const startX = e.clientX - crop.x;
|
|
@@ -1094,7 +1107,7 @@ function FileInput({
|
|
|
1094
1107
|
{
|
|
1095
1108
|
src: imageToCrop.url,
|
|
1096
1109
|
alt: "Crop preview",
|
|
1097
|
-
className: "
|
|
1110
|
+
className: "absolute inset-0 w-full h-full object-contain",
|
|
1098
1111
|
style: {
|
|
1099
1112
|
transform: `translate(${crop.x}px, ${crop.y}px) scale(${zoom})`
|
|
1100
1113
|
},
|
|
@@ -1124,15 +1137,15 @@ function FileInput({
|
|
|
1124
1137
|
/* @__PURE__ */ React7.createElement(
|
|
1125
1138
|
"div",
|
|
1126
1139
|
{
|
|
1127
|
-
className: "
|
|
1140
|
+
className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 border-2 border-primary rounded pointer-events-none",
|
|
1128
1141
|
style: {
|
|
1129
1142
|
width: cropAspectRatio ? `${Math.min(80, 80 * cropAspectRatio)}%` : "80%",
|
|
1130
1143
|
aspectRatio: cropAspectRatio ? String(cropAspectRatio) : void 0
|
|
1131
1144
|
}
|
|
1132
1145
|
},
|
|
1133
|
-
/* @__PURE__ */ React7.createElement("div", { className: "
|
|
1146
|
+
/* @__PURE__ */ React7.createElement("div", { className: "absolute inset-0 grid grid-cols-3 grid-rows-3" }, /* @__PURE__ */ React7.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-r border-b border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-b border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React7.createElement("div", { className: "border-r border-primary/30" }), /* @__PURE__ */ React7.createElement("div", null))
|
|
1134
1147
|
)
|
|
1135
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1148
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-3 mt-4" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "zoom-slider", className: "text-sm font-medium whitespace-nowrap" }, "Zoom: ", zoom.toFixed(1), "x"), /* @__PURE__ */ React7.createElement(
|
|
1136
1149
|
"input",
|
|
1137
1150
|
{
|
|
1138
1151
|
id: "zoom-slider",
|
|
@@ -1142,14 +1155,14 @@ function FileInput({
|
|
|
1142
1155
|
step: "0.1",
|
|
1143
1156
|
value: zoom,
|
|
1144
1157
|
onChange: (e) => onZoomChange(parseFloat(e.target.value)),
|
|
1145
|
-
className: "
|
|
1158
|
+
className: "flex-1 h-2 bg-muted rounded-lg appearance-none cursor-pointer",
|
|
1146
1159
|
"aria-label": "Zoom level"
|
|
1147
1160
|
}
|
|
1148
|
-
))), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1161
|
+
))), /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-end gap-2 p-4 border-t border-border" }, /* @__PURE__ */ React7.createElement(
|
|
1149
1162
|
"button",
|
|
1150
1163
|
{
|
|
1151
1164
|
type: "button",
|
|
1152
|
-
className: "
|
|
1165
|
+
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",
|
|
1153
1166
|
onClick: handleCropCancel
|
|
1154
1167
|
},
|
|
1155
1168
|
"Cancel"
|
|
@@ -1157,7 +1170,7 @@ function FileInput({
|
|
|
1157
1170
|
"button",
|
|
1158
1171
|
{
|
|
1159
1172
|
type: "button",
|
|
1160
|
-
className: "
|
|
1173
|
+
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",
|
|
1161
1174
|
onClick: handleCropSave
|
|
1162
1175
|
},
|
|
1163
1176
|
"Save"
|
|
@@ -1305,27 +1318,27 @@ function DatePicker({
|
|
|
1305
1318
|
const handleNextMonth = () => {
|
|
1306
1319
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1307
1320
|
};
|
|
1308
|
-
return /* @__PURE__ */ React7.createElement("div", {
|
|
1321
|
+
return /* @__PURE__ */ React7.createElement("div", { role: "grid", "aria-label": "Calendar" }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-between pb-2 border-b border-border" }, /* @__PURE__ */ React7.createElement(
|
|
1309
1322
|
"button",
|
|
1310
1323
|
{
|
|
1311
1324
|
type: "button",
|
|
1312
|
-
className: "
|
|
1325
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1313
1326
|
onClick: handlePrevMonth,
|
|
1314
1327
|
"aria-label": "Previous month"
|
|
1315
1328
|
},
|
|
1316
1329
|
"\u2190"
|
|
1317
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1330
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7.createElement(
|
|
1318
1331
|
"button",
|
|
1319
1332
|
{
|
|
1320
1333
|
type: "button",
|
|
1321
|
-
className: "
|
|
1334
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1322
1335
|
onClick: handleNextMonth,
|
|
1323
1336
|
"aria-label": "Next month"
|
|
1324
1337
|
},
|
|
1325
1338
|
"\u2192"
|
|
1326
|
-
)), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1339
|
+
)), /* @__PURE__ */ React7.createElement("div", { className: "grid grid-cols-7 gap-1 mt-2" }, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */ React7.createElement("div", { key: day, className: "flex items-center justify-center h-8 w-full text-xs text-muted-foreground font-medium" }, day))), /* @__PURE__ */ React7.createElement("div", { className: "grid grid-cols-7 gap-1" }, days.map((date, index) => {
|
|
1327
1340
|
if (!date) {
|
|
1328
|
-
return /* @__PURE__ */ React7.createElement("div", { key: `empty-${index}
|
|
1341
|
+
return /* @__PURE__ */ React7.createElement("div", { key: `empty-${index}` });
|
|
1329
1342
|
}
|
|
1330
1343
|
const isSelected = value && date.toDateString() === value.toDateString();
|
|
1331
1344
|
const isToday = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
@@ -1335,7 +1348,7 @@ function DatePicker({
|
|
|
1335
1348
|
{
|
|
1336
1349
|
key: date.toISOString(),
|
|
1337
1350
|
type: "button",
|
|
1338
|
-
className: `
|
|
1351
|
+
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" : ""}`,
|
|
1339
1352
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1340
1353
|
disabled: disabled2,
|
|
1341
1354
|
"aria-label": formatDate(date, format)
|
|
@@ -1344,11 +1357,7 @@ function DatePicker({
|
|
|
1344
1357
|
);
|
|
1345
1358
|
})));
|
|
1346
1359
|
};
|
|
1347
|
-
const
|
|
1348
|
-
const errorClassName = error ? "datepicker--error" : "";
|
|
1349
|
-
const disabledClassName = disabled ? "datepicker--disabled" : "";
|
|
1350
|
-
const openClassName = isOpen ? "datepicker--open" : "";
|
|
1351
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1360
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1352
1361
|
return /* @__PURE__ */ React7.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7.createElement(
|
|
1353
1362
|
"input",
|
|
1354
1363
|
{
|
|
@@ -1356,7 +1365,7 @@ function DatePicker({
|
|
|
1356
1365
|
name,
|
|
1357
1366
|
value: value ? value.toISOString() : ""
|
|
1358
1367
|
}
|
|
1359
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1368
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React7.createElement("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none", "aria-hidden": "true" }, /* @__PURE__ */ React7.createElement(
|
|
1360
1369
|
"svg",
|
|
1361
1370
|
{
|
|
1362
1371
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1375,7 +1384,7 @@ function DatePicker({
|
|
|
1375
1384
|
{
|
|
1376
1385
|
ref: inputRef,
|
|
1377
1386
|
type: "text",
|
|
1378
|
-
className:
|
|
1387
|
+
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" : ""}`,
|
|
1379
1388
|
value: inputValue,
|
|
1380
1389
|
onChange: handleInputChange,
|
|
1381
1390
|
onClick: handleToggle,
|
|
@@ -1392,13 +1401,13 @@ function DatePicker({
|
|
|
1392
1401
|
"button",
|
|
1393
1402
|
{
|
|
1394
1403
|
type: "button",
|
|
1395
|
-
className: "
|
|
1404
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1396
1405
|
onClick: handleClear,
|
|
1397
1406
|
"aria-label": "Clear date",
|
|
1398
1407
|
tabIndex: -1
|
|
1399
1408
|
},
|
|
1400
1409
|
"\u2715"
|
|
1401
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1410
|
+
)), isOpen && !disabled && /* @__PURE__ */ React7.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()));
|
|
1402
1411
|
}
|
|
1403
1412
|
DatePicker.displayName = "DatePicker";
|
|
1404
1413
|
function parseTimeString(timeStr, use24Hour) {
|
|
@@ -1531,11 +1540,7 @@ function TimePicker({
|
|
|
1531
1540
|
}
|
|
1532
1541
|
return mins;
|
|
1533
1542
|
}, [minuteStep]);
|
|
1534
|
-
const
|
|
1535
|
-
const errorClassName = error ? "timepicker--error" : "";
|
|
1536
|
-
const disabledClassName = disabled ? "timepicker--disabled" : "";
|
|
1537
|
-
const openClassName = isOpen ? "timepicker--open" : "";
|
|
1538
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1543
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1539
1544
|
const displayValue = formatTimeValue(timeValue, use24Hour);
|
|
1540
1545
|
return /* @__PURE__ */ React7.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7.createElement(
|
|
1541
1546
|
"input",
|
|
@@ -1544,7 +1549,7 @@ function TimePicker({
|
|
|
1544
1549
|
name,
|
|
1545
1550
|
value
|
|
1546
1551
|
}
|
|
1547
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1552
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React7.createElement("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none", "aria-hidden": "true" }, /* @__PURE__ */ React7.createElement(
|
|
1548
1553
|
"svg",
|
|
1549
1554
|
{
|
|
1550
1555
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1564,7 +1569,7 @@ function TimePicker({
|
|
|
1564
1569
|
{
|
|
1565
1570
|
ref: inputRef,
|
|
1566
1571
|
type: "text",
|
|
1567
|
-
className:
|
|
1572
|
+
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" : ""}`,
|
|
1568
1573
|
value: displayValue,
|
|
1569
1574
|
onClick: handleToggle,
|
|
1570
1575
|
onBlur,
|
|
@@ -1580,13 +1585,13 @@ function TimePicker({
|
|
|
1580
1585
|
"button",
|
|
1581
1586
|
{
|
|
1582
1587
|
type: "button",
|
|
1583
|
-
className: "
|
|
1588
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1584
1589
|
onClick: handleClear,
|
|
1585
1590
|
"aria-label": "Clear time",
|
|
1586
1591
|
tabIndex: -1
|
|
1587
1592
|
},
|
|
1588
1593
|
"\u2715"
|
|
1589
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1594
|
+
)), isOpen && !disabled && /* @__PURE__ */ React7.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.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col flex-1" }, /* @__PURE__ */ React7.createElement("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center" }, use24Hour ? "Hour" : "Hour"), /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col gap-1 max-h-48 overflow-y-auto" }, hours.map((hour) => {
|
|
1590
1595
|
const displayHour = use24Hour ? hour : hour;
|
|
1591
1596
|
const isSelected = use24Hour ? timeValue?.hour === (hour === 0 ? 12 : hour > 12 ? hour - 12 : hour) && timeValue?.period === (hour >= 12 ? "PM" : "AM") : timeValue?.hour === hour;
|
|
1592
1597
|
return /* @__PURE__ */ React7.createElement(
|
|
@@ -1594,7 +1599,7 @@ function TimePicker({
|
|
|
1594
1599
|
{
|
|
1595
1600
|
key: hour,
|
|
1596
1601
|
type: "button",
|
|
1597
|
-
className: `
|
|
1602
|
+
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" : ""}`,
|
|
1598
1603
|
onClick: () => {
|
|
1599
1604
|
if (use24Hour) {
|
|
1600
1605
|
const hour12 = hour === 0 ? 12 : hour > 12 ? hour - 12 : hour;
|
|
@@ -1614,24 +1619,24 @@ function TimePicker({
|
|
|
1614
1619
|
},
|
|
1615
1620
|
String(displayHour).padStart(2, "0")
|
|
1616
1621
|
);
|
|
1617
|
-
}))), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1622
|
+
}))), /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col flex-1" }, /* @__PURE__ */ React7.createElement("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center" }, "Minute"), /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col gap-1 max-h-48 overflow-y-auto" }, minutes.map((minute) => {
|
|
1618
1623
|
const isSelected = timeValue?.minute === minute;
|
|
1619
1624
|
return /* @__PURE__ */ React7.createElement(
|
|
1620
1625
|
"button",
|
|
1621
1626
|
{
|
|
1622
1627
|
key: minute,
|
|
1623
1628
|
type: "button",
|
|
1624
|
-
className: `
|
|
1629
|
+
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" : ""}`,
|
|
1625
1630
|
onClick: () => handleMinuteChange(minute),
|
|
1626
1631
|
"aria-label": `${String(minute).padStart(2, "0")} minutes`
|
|
1627
1632
|
},
|
|
1628
1633
|
String(minute).padStart(2, "0")
|
|
1629
1634
|
);
|
|
1630
|
-
}))), !use24Hour && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1635
|
+
}))), !use24Hour && /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col w-20" }, /* @__PURE__ */ React7.createElement("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center" }, "Period"), /* @__PURE__ */ React7.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ React7.createElement(
|
|
1631
1636
|
"button",
|
|
1632
1637
|
{
|
|
1633
1638
|
type: "button",
|
|
1634
|
-
className: `
|
|
1639
|
+
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" : ""}`,
|
|
1635
1640
|
onClick: () => handlePeriodChange("AM")
|
|
1636
1641
|
},
|
|
1637
1642
|
"AM"
|
|
@@ -1639,7 +1644,7 @@ function TimePicker({
|
|
|
1639
1644
|
"button",
|
|
1640
1645
|
{
|
|
1641
1646
|
type: "button",
|
|
1642
|
-
className: `
|
|
1647
|
+
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" : ""}`,
|
|
1643
1648
|
onClick: () => handlePeriodChange("PM")
|
|
1644
1649
|
},
|
|
1645
1650
|
"PM"
|
|
@@ -1778,27 +1783,27 @@ function DateRangePicker({
|
|
|
1778
1783
|
const handleNextMonth = () => {
|
|
1779
1784
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1780
1785
|
};
|
|
1781
|
-
return /* @__PURE__ */ React7.createElement("div", {
|
|
1786
|
+
return /* @__PURE__ */ React7.createElement("div", { role: "grid", "aria-label": "Calendar" }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-between pb-2 border-b border-border" }, /* @__PURE__ */ React7.createElement(
|
|
1782
1787
|
"button",
|
|
1783
1788
|
{
|
|
1784
1789
|
type: "button",
|
|
1785
|
-
className: "
|
|
1790
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1786
1791
|
onClick: handlePrevMonth,
|
|
1787
1792
|
"aria-label": "Previous month"
|
|
1788
1793
|
},
|
|
1789
1794
|
"\u2190"
|
|
1790
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1795
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7.createElement(
|
|
1791
1796
|
"button",
|
|
1792
1797
|
{
|
|
1793
1798
|
type: "button",
|
|
1794
|
-
className: "
|
|
1799
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1795
1800
|
onClick: handleNextMonth,
|
|
1796
1801
|
"aria-label": "Next month"
|
|
1797
1802
|
},
|
|
1798
1803
|
"\u2192"
|
|
1799
|
-
)), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1804
|
+
)), /* @__PURE__ */ React7.createElement("div", { className: "grid grid-cols-7 gap-1 mt-2" }, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => /* @__PURE__ */ React7.createElement("div", { key: day, className: "flex items-center justify-center h-8 w-full text-xs text-muted-foreground font-medium" }, day))), /* @__PURE__ */ React7.createElement("div", { className: "grid grid-cols-7 gap-1" }, days.map((date, index) => {
|
|
1800
1805
|
if (!date) {
|
|
1801
|
-
return /* @__PURE__ */ React7.createElement("div", { key: `empty-${index}
|
|
1806
|
+
return /* @__PURE__ */ React7.createElement("div", { key: `empty-${index}` });
|
|
1802
1807
|
}
|
|
1803
1808
|
const isStart = rangeStart && date.toDateString() === rangeStart.toDateString();
|
|
1804
1809
|
const isEnd = rangeEnd && date.toDateString() === rangeEnd.toDateString();
|
|
@@ -1811,7 +1816,7 @@ function DateRangePicker({
|
|
|
1811
1816
|
{
|
|
1812
1817
|
key: date.toISOString(),
|
|
1813
1818
|
type: "button",
|
|
1814
|
-
className: `
|
|
1819
|
+
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" : ""}`,
|
|
1815
1820
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1816
1821
|
onMouseEnter: () => setHoverDate(date),
|
|
1817
1822
|
onMouseLeave: () => setHoverDate(null),
|
|
@@ -1822,11 +1827,7 @@ function DateRangePicker({
|
|
|
1822
1827
|
);
|
|
1823
1828
|
})));
|
|
1824
1829
|
};
|
|
1825
|
-
const
|
|
1826
|
-
const errorClassName = error ? "daterangepicker--error" : "";
|
|
1827
|
-
const disabledClassName = disabled ? "daterangepicker--disabled" : "";
|
|
1828
|
-
const openClassName = isOpen ? "daterangepicker--open" : "";
|
|
1829
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1830
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1830
1831
|
const displayValue = rangeStart && rangeEnd ? `${formatDate2(rangeStart, format)}${separator}${formatDate2(rangeEnd, format)}` : rangeStart ? formatDate2(rangeStart, format) : "";
|
|
1831
1832
|
return /* @__PURE__ */ React7.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7.createElement(
|
|
1832
1833
|
"input",
|
|
@@ -1842,7 +1843,7 @@ function DateRangePicker({
|
|
|
1842
1843
|
name: `${name}[end]`,
|
|
1843
1844
|
value: rangeEnd ? rangeEnd.toISOString() : ""
|
|
1844
1845
|
}
|
|
1845
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1846
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React7.createElement("span", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none", "aria-hidden": "true" }, /* @__PURE__ */ React7.createElement(
|
|
1846
1847
|
"svg",
|
|
1847
1848
|
{
|
|
1848
1849
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1860,7 +1861,7 @@ function DateRangePicker({
|
|
|
1860
1861
|
"input",
|
|
1861
1862
|
{
|
|
1862
1863
|
type: "text",
|
|
1863
|
-
className:
|
|
1864
|
+
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" : ""}`,
|
|
1864
1865
|
value: displayValue,
|
|
1865
1866
|
onClick: handleToggle,
|
|
1866
1867
|
onBlur,
|
|
@@ -1876,13 +1877,13 @@ function DateRangePicker({
|
|
|
1876
1877
|
"button",
|
|
1877
1878
|
{
|
|
1878
1879
|
type: "button",
|
|
1879
|
-
className: "
|
|
1880
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1880
1881
|
onClick: handleClear,
|
|
1881
1882
|
"aria-label": "Clear date range",
|
|
1882
1883
|
tabIndex: -1
|
|
1883
1884
|
},
|
|
1884
1885
|
"\u2715"
|
|
1885
|
-
)), isOpen && !disabled && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
1886
|
+
)), isOpen && !disabled && /* @__PURE__ */ React7.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.createElement("div", { className: "text-xs text-muted-foreground text-center pt-2 border-t border-border mt-2" }, "Select end date")));
|
|
1886
1887
|
}
|
|
1887
1888
|
DateRangePicker.displayName = "DateRangePicker";
|
|
1888
1889
|
function htmlToMarkdown(html) {
|
|
@@ -2037,17 +2038,13 @@ function RichTextEditor({
|
|
|
2037
2038
|
}
|
|
2038
2039
|
}
|
|
2039
2040
|
};
|
|
2040
|
-
const
|
|
2041
|
-
const errorClassName = error ? "richtexteditor--error" : "";
|
|
2042
|
-
const disabledClassName = disabled ? "richtexteditor--disabled" : "";
|
|
2043
|
-
const modeClassName = `richtexteditor--${currentMode}`;
|
|
2044
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${modeClassName} ${className}`.trim();
|
|
2041
|
+
const combinedClassName = `rounded-md border border-input ${error ? "border-red-500 ring-1 ring-red-500" : ""} ${disabled ? "opacity-50 cursor-not-allowed" : ""} ${className}`.trim();
|
|
2045
2042
|
const editorStyle = {
|
|
2046
2043
|
minHeight,
|
|
2047
2044
|
maxHeight,
|
|
2048
2045
|
overflowY: maxHeight ? "auto" : void 0
|
|
2049
2046
|
};
|
|
2050
|
-
return /* @__PURE__ */ React7.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7.createElement("input", { type: "hidden", name, value: content }), showToolbar && /* @__PURE__ */ React7.createElement("div", { className: "
|
|
2047
|
+
return /* @__PURE__ */ React7.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7.createElement("input", { type: "hidden", name, value: content }), showToolbar && /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-between p-2 border-b border-border bg-muted/50" }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-1" }, toolbarButtons.map((buttonName) => {
|
|
2051
2048
|
const button = toolbarConfig[buttonName];
|
|
2052
2049
|
if (!button) return null;
|
|
2053
2050
|
return /* @__PURE__ */ React7.createElement(
|
|
@@ -2055,7 +2052,7 @@ function RichTextEditor({
|
|
|
2055
2052
|
{
|
|
2056
2053
|
key: buttonName,
|
|
2057
2054
|
type: "button",
|
|
2058
|
-
className: "
|
|
2055
|
+
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",
|
|
2059
2056
|
onClick: () => editorRef.current && button.action(editorRef.current),
|
|
2060
2057
|
title: button.title,
|
|
2061
2058
|
disabled: disabled || currentMode === "markdown",
|
|
@@ -2067,18 +2064,18 @@ function RichTextEditor({
|
|
|
2067
2064
|
"button",
|
|
2068
2065
|
{
|
|
2069
2066
|
type: "button",
|
|
2070
|
-
className: "
|
|
2067
|
+
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",
|
|
2071
2068
|
onClick: handleModeToggle,
|
|
2072
2069
|
disabled,
|
|
2073
2070
|
title: `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`,
|
|
2074
2071
|
"aria-label": `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`
|
|
2075
2072
|
},
|
|
2076
2073
|
currentMode === "wysiwyg" ? "MD" : "WYSIWYG"
|
|
2077
|
-
)), /* @__PURE__ */ React7.createElement("div", {
|
|
2074
|
+
)), /* @__PURE__ */ React7.createElement("div", { style: editorStyle }, currentMode === "wysiwyg" ? /* @__PURE__ */ React7.createElement(
|
|
2078
2075
|
"div",
|
|
2079
2076
|
{
|
|
2080
2077
|
ref: editorRef,
|
|
2081
|
-
className: "
|
|
2078
|
+
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",
|
|
2082
2079
|
role: "textbox",
|
|
2083
2080
|
contentEditable: !disabled,
|
|
2084
2081
|
onInput: handleWysiwygChange,
|
|
@@ -2093,7 +2090,7 @@ function RichTextEditor({
|
|
|
2093
2090
|
"textarea",
|
|
2094
2091
|
{
|
|
2095
2092
|
ref: textareaRef,
|
|
2096
|
-
className: "
|
|
2093
|
+
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",
|
|
2097
2094
|
value: content,
|
|
2098
2095
|
onChange: handleMarkdownChange,
|
|
2099
2096
|
onBlur,
|
|
@@ -2102,7 +2099,8 @@ function RichTextEditor({
|
|
|
2102
2099
|
placeholder,
|
|
2103
2100
|
"aria-invalid": error || props["aria-invalid"] ? "true" : "false",
|
|
2104
2101
|
"aria-describedby": props["aria-describedby"],
|
|
2105
|
-
"aria-required": required || props["aria-required"]
|
|
2102
|
+
"aria-required": required || props["aria-required"],
|
|
2103
|
+
style: editorStyle
|
|
2106
2104
|
}
|
|
2107
2105
|
)));
|
|
2108
2106
|
}
|