@page-speed/forms 0.3.7 → 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 +162 -176
- package/dist/inputs.cjs.map +1 -1
- package/dist/inputs.js +162 -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",
|
|
@@ -144,12 +144,7 @@ function Checkbox({
|
|
|
144
144
|
const handleBlur = () => {
|
|
145
145
|
onBlur?.();
|
|
146
146
|
};
|
|
147
|
-
const
|
|
148
|
-
const errorClassName = error ? "checkbox--error" : "";
|
|
149
|
-
const checkedClassName = value ? "checkbox--checked" : "";
|
|
150
|
-
const disabledClassName = disabled ? "checkbox--disabled" : "";
|
|
151
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${checkedClassName} ${disabledClassName} ${className}`.trim();
|
|
152
|
-
const checkbox = /* @__PURE__ */ React7__namespace.createElement(
|
|
147
|
+
const checkbox = /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative inline-flex" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
153
148
|
"input",
|
|
154
149
|
{
|
|
155
150
|
ref: inputRef,
|
|
@@ -161,22 +156,29 @@ function Checkbox({
|
|
|
161
156
|
onBlur: handleBlur,
|
|
162
157
|
disabled,
|
|
163
158
|
required,
|
|
164
|
-
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}`,
|
|
165
160
|
"aria-invalid": error || props["aria-invalid"],
|
|
166
161
|
"aria-describedby": description ? `${checkboxId}-description` : props["aria-describedby"],
|
|
167
162
|
"aria-required": required || props["aria-required"],
|
|
168
163
|
...props
|
|
169
164
|
}
|
|
170
|
-
);
|
|
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" }))));
|
|
171
166
|
if (label) {
|
|
172
|
-
return /* @__PURE__ */ React7__namespace.createElement(
|
|
173
|
-
"
|
|
167
|
+
return /* @__PURE__ */ React7__namespace.createElement(
|
|
168
|
+
"label",
|
|
174
169
|
{
|
|
175
|
-
className: "
|
|
176
|
-
|
|
170
|
+
className: `flex w-fit gap-2 items-center ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
171
|
+
htmlFor: checkboxId
|
|
177
172
|
},
|
|
178
|
-
description
|
|
179
|
-
|
|
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
|
+
);
|
|
180
182
|
}
|
|
181
183
|
return checkbox;
|
|
182
184
|
}
|
|
@@ -227,15 +229,13 @@ function CheckboxGroup({
|
|
|
227
229
|
const handleBlur = () => {
|
|
228
230
|
onBlur?.();
|
|
229
231
|
};
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
const layoutClassName = `checkbox-group--${layout}`;
|
|
233
|
-
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();
|
|
234
234
|
const maxReached = Boolean(maxSelections && value.length >= maxSelections);
|
|
235
235
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
236
236
|
"div",
|
|
237
237
|
{
|
|
238
|
-
className:
|
|
238
|
+
className: containerClass,
|
|
239
239
|
role: "group",
|
|
240
240
|
"aria-invalid": error || props["aria-invalid"],
|
|
241
241
|
"aria-describedby": props["aria-describedby"],
|
|
@@ -245,25 +245,32 @@ function CheckboxGroup({
|
|
|
245
245
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
246
246
|
} : void 0
|
|
247
247
|
},
|
|
248
|
-
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
249
|
-
description && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
250
|
-
|
|
251
|
-
"
|
|
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",
|
|
252
252
|
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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) => {
|
|
267
274
|
const isChecked = value.includes(option.value);
|
|
268
275
|
const isDisabled = disabled || option.disabled || maxReached && !isChecked;
|
|
269
276
|
const checkboxId = `${name}-${option.value}`;
|
|
@@ -271,10 +278,10 @@ function CheckboxGroup({
|
|
|
271
278
|
"label",
|
|
272
279
|
{
|
|
273
280
|
key: option.value,
|
|
274
|
-
className: `
|
|
281
|
+
className: `flex w-fit gap-2 items-center ${isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
275
282
|
htmlFor: checkboxId
|
|
276
283
|
},
|
|
277
|
-
/* @__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(
|
|
278
285
|
"input",
|
|
279
286
|
{
|
|
280
287
|
type: "checkbox",
|
|
@@ -286,21 +293,20 @@ function CheckboxGroup({
|
|
|
286
293
|
onBlur: handleBlur,
|
|
287
294
|
disabled: isDisabled,
|
|
288
295
|
required: required && minSelections ? value.length < minSelections : false,
|
|
289
|
-
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" : ""}`,
|
|
290
297
|
"aria-describedby": option.description ? `${checkboxId}-description` : props["aria-describedby"]
|
|
291
298
|
}
|
|
292
|
-
),
|
|
293
|
-
|
|
294
|
-
"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",
|
|
295
301
|
{
|
|
296
|
-
className: "
|
|
302
|
+
className: "text-muted-foreground text-sm",
|
|
297
303
|
id: `${checkboxId}-description`
|
|
298
304
|
},
|
|
299
305
|
option.description
|
|
300
|
-
)))
|
|
306
|
+
))))
|
|
301
307
|
);
|
|
302
|
-
})
|
|
303
|
-
(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"))
|
|
304
310
|
);
|
|
305
311
|
}
|
|
306
312
|
CheckboxGroup.displayName = "CheckboxGroup";
|
|
@@ -349,22 +355,20 @@ function Radio({
|
|
|
349
355
|
const handleBlur = () => {
|
|
350
356
|
onBlur?.();
|
|
351
357
|
};
|
|
352
|
-
const
|
|
353
|
-
const
|
|
354
|
-
const layoutClassName = `radio-group--${layout}`;
|
|
355
|
-
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();
|
|
356
360
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
357
361
|
"div",
|
|
358
362
|
{
|
|
359
|
-
className:
|
|
363
|
+
className: containerClass,
|
|
360
364
|
role: "radiogroup",
|
|
361
365
|
"aria-invalid": error || props["aria-invalid"],
|
|
362
366
|
"aria-describedby": props["aria-describedby"],
|
|
363
367
|
"aria-required": required || props["aria-required"],
|
|
364
368
|
"aria-label": typeof label === "string" ? label : props["aria-label"]
|
|
365
369
|
},
|
|
366
|
-
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
367
|
-
|
|
370
|
+
label && /* @__PURE__ */ React7__namespace.createElement("div", { className: "text-sm font-medium mb-2" }, label),
|
|
371
|
+
options.map((option, index) => {
|
|
368
372
|
const isChecked = value === option.value;
|
|
369
373
|
const isDisabled = disabled || option.disabled;
|
|
370
374
|
const radioId = `${name}-${option.value}`;
|
|
@@ -372,19 +376,19 @@ function Radio({
|
|
|
372
376
|
"label",
|
|
373
377
|
{
|
|
374
378
|
key: option.value,
|
|
375
|
-
className: `
|
|
379
|
+
className: `flex w-fit gap-2 items-center ${isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
376
380
|
htmlFor: radioId,
|
|
377
381
|
onKeyDown: (e) => handleKeyDown(e, index),
|
|
378
|
-
tabIndex: 0
|
|
382
|
+
tabIndex: isDisabled ? -1 : 0
|
|
379
383
|
},
|
|
380
|
-
/* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
381
|
-
"
|
|
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",
|
|
382
386
|
{
|
|
383
|
-
className: "
|
|
387
|
+
className: "text-muted-foreground text-sm",
|
|
384
388
|
id: `${radioId}-description`
|
|
385
389
|
},
|
|
386
390
|
option.description
|
|
387
|
-
)), /* @__PURE__ */ React7__namespace.createElement(
|
|
391
|
+
)) : /* @__PURE__ */ React7__namespace.createElement("span", { className: "text-sm font-medium" }, option.label)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "relative" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
388
392
|
"input",
|
|
389
393
|
{
|
|
390
394
|
type: "radio",
|
|
@@ -396,12 +400,12 @@ function Radio({
|
|
|
396
400
|
onBlur: handleBlur,
|
|
397
401
|
disabled: isDisabled,
|
|
398
402
|
required,
|
|
399
|
-
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"}`,
|
|
400
404
|
"aria-describedby": option.description ? `${radioId}-description` : props["aria-describedby"]
|
|
401
405
|
}
|
|
402
|
-
))
|
|
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" })))))
|
|
403
407
|
);
|
|
404
|
-
})
|
|
408
|
+
})
|
|
405
409
|
);
|
|
406
410
|
}
|
|
407
411
|
Radio.displayName = "Radio";
|
|
@@ -566,11 +570,7 @@ function Select({
|
|
|
566
570
|
};
|
|
567
571
|
}
|
|
568
572
|
}, [isOpen]);
|
|
569
|
-
const
|
|
570
|
-
const errorClassName = error ? "select--error" : "";
|
|
571
|
-
const disabledClassName = disabled ? "select--disabled" : "";
|
|
572
|
-
const openClassName = isOpen ? "select--open" : "";
|
|
573
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
573
|
+
const combinedClassName = `relative w-full ${className}`.trim();
|
|
574
574
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
575
575
|
"div",
|
|
576
576
|
{
|
|
@@ -598,7 +598,7 @@ function Select({
|
|
|
598
598
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
599
599
|
"div",
|
|
600
600
|
{
|
|
601
|
-
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" : ""}`,
|
|
602
602
|
onClick: handleToggle,
|
|
603
603
|
role: "combobox",
|
|
604
604
|
"aria-expanded": isOpen,
|
|
@@ -609,39 +609,39 @@ function Select({
|
|
|
609
609
|
"aria-disabled": disabled,
|
|
610
610
|
tabIndex: disabled ? -1 : 0
|
|
611
611
|
},
|
|
612
|
-
/* @__PURE__ */ React7__namespace.createElement("span", { className: "
|
|
613
|
-
/* @__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(
|
|
614
614
|
"button",
|
|
615
615
|
{
|
|
616
616
|
type: "button",
|
|
617
|
-
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",
|
|
618
618
|
onClick: handleClear,
|
|
619
619
|
"aria-label": "Clear selection",
|
|
620
620
|
tabIndex: -1
|
|
621
621
|
},
|
|
622
622
|
"\u2715"
|
|
623
|
-
), /* @__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"))
|
|
624
624
|
),
|
|
625
|
-
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(
|
|
626
626
|
"input",
|
|
627
627
|
{
|
|
628
628
|
ref: searchInputRef,
|
|
629
629
|
type: "text",
|
|
630
|
-
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",
|
|
631
631
|
placeholder: "Search...",
|
|
632
632
|
value: searchQuery,
|
|
633
633
|
onChange: handleSearchChange,
|
|
634
634
|
onClick: (e) => e.stopPropagation(),
|
|
635
635
|
"aria-label": "Search options"
|
|
636
636
|
}
|
|
637
|
-
)), /* @__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 ? (
|
|
638
638
|
// Render grouped options
|
|
639
639
|
optionGroups.map((group, groupIndex) => {
|
|
640
640
|
const groupOptions = group.options.filter(
|
|
641
641
|
(opt) => filteredOptions.includes(opt)
|
|
642
642
|
);
|
|
643
643
|
if (groupOptions.length === 0) return null;
|
|
644
|
-
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) => {
|
|
645
645
|
const globalIndex = filteredOptions.indexOf(option);
|
|
646
646
|
const isSelected = value === option.value;
|
|
647
647
|
const isFocused = globalIndex === focusedIndex;
|
|
@@ -650,7 +650,7 @@ function Select({
|
|
|
650
650
|
"div",
|
|
651
651
|
{
|
|
652
652
|
key: option.value,
|
|
653
|
-
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" : ""}`,
|
|
654
654
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
655
655
|
role: "option",
|
|
656
656
|
"aria-selected": isSelected,
|
|
@@ -670,7 +670,7 @@ function Select({
|
|
|
670
670
|
"div",
|
|
671
671
|
{
|
|
672
672
|
key: option.value,
|
|
673
|
-
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" : ""}`,
|
|
674
674
|
onClick: () => !isDisabled && handleSelect(option.value),
|
|
675
675
|
role: "option",
|
|
676
676
|
"aria-selected": isSelected,
|
|
@@ -950,11 +950,7 @@ function FileInput({
|
|
|
950
950
|
}
|
|
951
951
|
};
|
|
952
952
|
}, [value, imageToCrop]);
|
|
953
|
-
const
|
|
954
|
-
const errorClassName = error ? "file-input--error" : "";
|
|
955
|
-
const dragClassName = dragActive ? "file-input--drag-active" : "";
|
|
956
|
-
const disabledClassName = disabled ? "file-input--disabled" : "";
|
|
957
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${dragClassName} ${disabledClassName} ${className}`.trim();
|
|
953
|
+
const combinedClassName = `${className}`.trim();
|
|
958
954
|
return /* @__PURE__ */ React7__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
959
955
|
"input",
|
|
960
956
|
{
|
|
@@ -967,7 +963,6 @@ function FileInput({
|
|
|
967
963
|
multiple,
|
|
968
964
|
disabled,
|
|
969
965
|
required: required && value.length === 0,
|
|
970
|
-
className: "file-input__native",
|
|
971
966
|
"aria-invalid": error || props["aria-invalid"],
|
|
972
967
|
"aria-describedby": props["aria-describedby"],
|
|
973
968
|
"aria-required": required || props["aria-required"],
|
|
@@ -976,7 +971,7 @@ function FileInput({
|
|
|
976
971
|
), /* @__PURE__ */ React7__namespace.createElement(
|
|
977
972
|
"div",
|
|
978
973
|
{
|
|
979
|
-
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" : ""}`,
|
|
980
975
|
onDragEnter: handleDrag,
|
|
981
976
|
onDragLeave: handleDrag,
|
|
982
977
|
onDragOver: handleDrag,
|
|
@@ -988,10 +983,10 @@ function FileInput({
|
|
|
988
983
|
"aria-label": placeholder,
|
|
989
984
|
"aria-disabled": disabled
|
|
990
985
|
},
|
|
991
|
-
/* @__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(
|
|
992
987
|
"svg",
|
|
993
988
|
{
|
|
994
|
-
className: "
|
|
989
|
+
className: "text-muted-foreground",
|
|
995
990
|
width: "48",
|
|
996
991
|
height: "48",
|
|
997
992
|
viewBox: "0 0 24 24",
|
|
@@ -1005,30 +1000,36 @@ function FileInput({
|
|
|
1005
1000
|
/* @__PURE__ */ React7__namespace.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1006
1001
|
/* @__PURE__ */ React7__namespace.createElement("polyline", { points: "17 8 12 3 7 8" }),
|
|
1007
1002
|
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
1008
|
-
), /* @__PURE__ */ React7__namespace.createElement("p", { className: "
|
|
1009
|
-
), value.length > 0 && /* @__PURE__ */ React7__namespace.createElement("ul", { className: "
|
|
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) => {
|
|
1010
1005
|
const previewUrl = showPreview ? getPreviewUrl(file) : null;
|
|
1011
|
-
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(
|
|
1012
1007
|
"img",
|
|
1013
1008
|
{
|
|
1014
1009
|
src: previewUrl,
|
|
1015
1010
|
alt: file.name,
|
|
1016
|
-
className: "
|
|
1011
|
+
className: "w-12 h-12 rounded object-cover",
|
|
1017
1012
|
width: "48",
|
|
1018
1013
|
height: "48"
|
|
1019
1014
|
}
|
|
1020
|
-
), /* @__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(
|
|
1021
1016
|
"div",
|
|
1022
1017
|
{
|
|
1023
|
-
className: "
|
|
1024
|
-
style: { width: `${uploadProgress[file.name]}%` },
|
|
1018
|
+
className: "h-1.5 bg-muted rounded-full overflow-hidden flex-1",
|
|
1025
1019
|
role: "progressbar",
|
|
1026
1020
|
"aria-valuenow": uploadProgress[file.name],
|
|
1027
1021
|
"aria-valuemin": 0,
|
|
1028
1022
|
"aria-valuemax": 100,
|
|
1029
1023
|
"aria-label": `Upload progress: ${uploadProgress[file.name]}%`
|
|
1030
|
-
}
|
|
1031
|
-
|
|
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(
|
|
1032
1033
|
"button",
|
|
1033
1034
|
{
|
|
1034
1035
|
type: "button",
|
|
@@ -1037,7 +1038,7 @@ function FileInput({
|
|
|
1037
1038
|
handleCrop(file);
|
|
1038
1039
|
},
|
|
1039
1040
|
disabled,
|
|
1040
|
-
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",
|
|
1041
1042
|
"aria-label": `Crop ${file.name}`
|
|
1042
1043
|
},
|
|
1043
1044
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1065,7 +1066,7 @@ function FileInput({
|
|
|
1065
1066
|
handleRemove(index);
|
|
1066
1067
|
},
|
|
1067
1068
|
disabled,
|
|
1068
|
-
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",
|
|
1069
1070
|
"aria-label": `Remove ${file.name}`
|
|
1070
1071
|
},
|
|
1071
1072
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1085,26 +1086,26 @@ function FileInput({
|
|
|
1085
1086
|
/* @__PURE__ */ React7__namespace.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1086
1087
|
)
|
|
1087
1088
|
));
|
|
1088
|
-
})), 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(
|
|
1089
1090
|
"div",
|
|
1090
1091
|
{
|
|
1091
|
-
className: "
|
|
1092
|
+
className: "absolute inset-0 bg-black/50",
|
|
1092
1093
|
onClick: handleCropCancel,
|
|
1093
1094
|
"aria-label": "Close cropper"
|
|
1094
1095
|
}
|
|
1095
|
-
), /* @__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(
|
|
1096
1097
|
"button",
|
|
1097
1098
|
{
|
|
1098
1099
|
type: "button",
|
|
1099
|
-
className: "
|
|
1100
|
+
className: "flex items-center justify-center h-8 w-8 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
1100
1101
|
onClick: handleCropCancel,
|
|
1101
1102
|
"aria-label": "Close"
|
|
1102
1103
|
},
|
|
1103
1104
|
"\u2715"
|
|
1104
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1105
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { className: "p-4" }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1105
1106
|
"div",
|
|
1106
1107
|
{
|
|
1107
|
-
className: "
|
|
1108
|
+
className: "relative w-full h-96 bg-muted rounded-md overflow-hidden",
|
|
1108
1109
|
onMouseDown: (e) => {
|
|
1109
1110
|
e.preventDefault();
|
|
1110
1111
|
const startX = e.clientX - crop.x;
|
|
@@ -1128,7 +1129,7 @@ function FileInput({
|
|
|
1128
1129
|
{
|
|
1129
1130
|
src: imageToCrop.url,
|
|
1130
1131
|
alt: "Crop preview",
|
|
1131
|
-
className: "
|
|
1132
|
+
className: "absolute inset-0 w-full h-full object-contain",
|
|
1132
1133
|
style: {
|
|
1133
1134
|
transform: `translate(${crop.x}px, ${crop.y}px) scale(${zoom})`
|
|
1134
1135
|
},
|
|
@@ -1158,15 +1159,15 @@ function FileInput({
|
|
|
1158
1159
|
/* @__PURE__ */ React7__namespace.createElement(
|
|
1159
1160
|
"div",
|
|
1160
1161
|
{
|
|
1161
|
-
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",
|
|
1162
1163
|
style: {
|
|
1163
1164
|
width: cropAspectRatio ? `${Math.min(80, 80 * cropAspectRatio)}%` : "80%",
|
|
1164
1165
|
aspectRatio: cropAspectRatio ? String(cropAspectRatio) : void 0
|
|
1165
1166
|
}
|
|
1166
1167
|
},
|
|
1167
|
-
/* @__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))
|
|
1168
1169
|
)
|
|
1169
|
-
), /* @__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(
|
|
1170
1171
|
"input",
|
|
1171
1172
|
{
|
|
1172
1173
|
id: "zoom-slider",
|
|
@@ -1176,14 +1177,14 @@ function FileInput({
|
|
|
1176
1177
|
step: "0.1",
|
|
1177
1178
|
value: zoom,
|
|
1178
1179
|
onChange: (e) => onZoomChange(parseFloat(e.target.value)),
|
|
1179
|
-
className: "
|
|
1180
|
+
className: "flex-1 h-2 bg-muted rounded-lg appearance-none cursor-pointer",
|
|
1180
1181
|
"aria-label": "Zoom level"
|
|
1181
1182
|
}
|
|
1182
|
-
))), /* @__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(
|
|
1183
1184
|
"button",
|
|
1184
1185
|
{
|
|
1185
1186
|
type: "button",
|
|
1186
|
-
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",
|
|
1187
1188
|
onClick: handleCropCancel
|
|
1188
1189
|
},
|
|
1189
1190
|
"Cancel"
|
|
@@ -1191,7 +1192,7 @@ function FileInput({
|
|
|
1191
1192
|
"button",
|
|
1192
1193
|
{
|
|
1193
1194
|
type: "button",
|
|
1194
|
-
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",
|
|
1195
1196
|
onClick: handleCropSave
|
|
1196
1197
|
},
|
|
1197
1198
|
"Save"
|
|
@@ -1339,27 +1340,27 @@ function DatePicker({
|
|
|
1339
1340
|
const handleNextMonth = () => {
|
|
1340
1341
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1341
1342
|
};
|
|
1342
|
-
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(
|
|
1343
1344
|
"button",
|
|
1344
1345
|
{
|
|
1345
1346
|
type: "button",
|
|
1346
|
-
className: "
|
|
1347
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1347
1348
|
onClick: handlePrevMonth,
|
|
1348
1349
|
"aria-label": "Previous month"
|
|
1349
1350
|
},
|
|
1350
1351
|
"\u2190"
|
|
1351
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1352
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7__namespace.createElement(
|
|
1352
1353
|
"button",
|
|
1353
1354
|
{
|
|
1354
1355
|
type: "button",
|
|
1355
|
-
className: "
|
|
1356
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1356
1357
|
onClick: handleNextMonth,
|
|
1357
1358
|
"aria-label": "Next month"
|
|
1358
1359
|
},
|
|
1359
1360
|
"\u2192"
|
|
1360
|
-
)), /* @__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) => {
|
|
1361
1362
|
if (!date) {
|
|
1362
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}
|
|
1363
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}` });
|
|
1363
1364
|
}
|
|
1364
1365
|
const isSelected = value && date.toDateString() === value.toDateString();
|
|
1365
1366
|
const isToday = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
@@ -1369,7 +1370,7 @@ function DatePicker({
|
|
|
1369
1370
|
{
|
|
1370
1371
|
key: date.toISOString(),
|
|
1371
1372
|
type: "button",
|
|
1372
|
-
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" : ""}`,
|
|
1373
1374
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1374
1375
|
disabled: disabled2,
|
|
1375
1376
|
"aria-label": formatDate(date, format)
|
|
@@ -1378,11 +1379,7 @@ function DatePicker({
|
|
|
1378
1379
|
);
|
|
1379
1380
|
})));
|
|
1380
1381
|
};
|
|
1381
|
-
const
|
|
1382
|
-
const errorClassName = error ? "datepicker--error" : "";
|
|
1383
|
-
const disabledClassName = disabled ? "datepicker--disabled" : "";
|
|
1384
|
-
const openClassName = isOpen ? "datepicker--open" : "";
|
|
1385
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1382
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1386
1383
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1387
1384
|
"input",
|
|
1388
1385
|
{
|
|
@@ -1390,7 +1387,7 @@ function DatePicker({
|
|
|
1390
1387
|
name,
|
|
1391
1388
|
value: value ? value.toISOString() : ""
|
|
1392
1389
|
}
|
|
1393
|
-
), /* @__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(
|
|
1394
1391
|
"svg",
|
|
1395
1392
|
{
|
|
1396
1393
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1409,7 +1406,7 @@ function DatePicker({
|
|
|
1409
1406
|
{
|
|
1410
1407
|
ref: inputRef,
|
|
1411
1408
|
type: "text",
|
|
1412
|
-
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" : ""}`,
|
|
1413
1410
|
value: inputValue,
|
|
1414
1411
|
onChange: handleInputChange,
|
|
1415
1412
|
onClick: handleToggle,
|
|
@@ -1426,13 +1423,13 @@ function DatePicker({
|
|
|
1426
1423
|
"button",
|
|
1427
1424
|
{
|
|
1428
1425
|
type: "button",
|
|
1429
|
-
className: "
|
|
1426
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1430
1427
|
onClick: handleClear,
|
|
1431
1428
|
"aria-label": "Clear date",
|
|
1432
1429
|
tabIndex: -1
|
|
1433
1430
|
},
|
|
1434
1431
|
"\u2715"
|
|
1435
|
-
)), 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()));
|
|
1436
1433
|
}
|
|
1437
1434
|
DatePicker.displayName = "DatePicker";
|
|
1438
1435
|
function parseTimeString(timeStr, use24Hour) {
|
|
@@ -1565,11 +1562,7 @@ function TimePicker({
|
|
|
1565
1562
|
}
|
|
1566
1563
|
return mins;
|
|
1567
1564
|
}, [minuteStep]);
|
|
1568
|
-
const
|
|
1569
|
-
const errorClassName = error ? "timepicker--error" : "";
|
|
1570
|
-
const disabledClassName = disabled ? "timepicker--disabled" : "";
|
|
1571
|
-
const openClassName = isOpen ? "timepicker--open" : "";
|
|
1572
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1565
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1573
1566
|
const displayValue = formatTimeValue(timeValue, use24Hour);
|
|
1574
1567
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1575
1568
|
"input",
|
|
@@ -1578,7 +1571,7 @@ function TimePicker({
|
|
|
1578
1571
|
name,
|
|
1579
1572
|
value
|
|
1580
1573
|
}
|
|
1581
|
-
), /* @__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(
|
|
1582
1575
|
"svg",
|
|
1583
1576
|
{
|
|
1584
1577
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1598,7 +1591,7 @@ function TimePicker({
|
|
|
1598
1591
|
{
|
|
1599
1592
|
ref: inputRef,
|
|
1600
1593
|
type: "text",
|
|
1601
|
-
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" : ""}`,
|
|
1602
1595
|
value: displayValue,
|
|
1603
1596
|
onClick: handleToggle,
|
|
1604
1597
|
onBlur,
|
|
@@ -1614,13 +1607,13 @@ function TimePicker({
|
|
|
1614
1607
|
"button",
|
|
1615
1608
|
{
|
|
1616
1609
|
type: "button",
|
|
1617
|
-
className: "
|
|
1610
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1618
1611
|
onClick: handleClear,
|
|
1619
1612
|
"aria-label": "Clear time",
|
|
1620
1613
|
tabIndex: -1
|
|
1621
1614
|
},
|
|
1622
1615
|
"\u2715"
|
|
1623
|
-
)), 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) => {
|
|
1624
1617
|
const displayHour = use24Hour ? hour : hour;
|
|
1625
1618
|
const isSelected = use24Hour ? timeValue?.hour === (hour === 0 ? 12 : hour > 12 ? hour - 12 : hour) && timeValue?.period === (hour >= 12 ? "PM" : "AM") : timeValue?.hour === hour;
|
|
1626
1619
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -1628,7 +1621,7 @@ function TimePicker({
|
|
|
1628
1621
|
{
|
|
1629
1622
|
key: hour,
|
|
1630
1623
|
type: "button",
|
|
1631
|
-
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" : ""}`,
|
|
1632
1625
|
onClick: () => {
|
|
1633
1626
|
if (use24Hour) {
|
|
1634
1627
|
const hour12 = hour === 0 ? 12 : hour > 12 ? hour - 12 : hour;
|
|
@@ -1648,24 +1641,24 @@ function TimePicker({
|
|
|
1648
1641
|
},
|
|
1649
1642
|
String(displayHour).padStart(2, "0")
|
|
1650
1643
|
);
|
|
1651
|
-
}))), /* @__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) => {
|
|
1652
1645
|
const isSelected = timeValue?.minute === minute;
|
|
1653
1646
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
1654
1647
|
"button",
|
|
1655
1648
|
{
|
|
1656
1649
|
key: minute,
|
|
1657
1650
|
type: "button",
|
|
1658
|
-
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" : ""}`,
|
|
1659
1652
|
onClick: () => handleMinuteChange(minute),
|
|
1660
1653
|
"aria-label": `${String(minute).padStart(2, "0")} minutes`
|
|
1661
1654
|
},
|
|
1662
1655
|
String(minute).padStart(2, "0")
|
|
1663
1656
|
);
|
|
1664
|
-
}))), !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(
|
|
1665
1658
|
"button",
|
|
1666
1659
|
{
|
|
1667
1660
|
type: "button",
|
|
1668
|
-
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" : ""}`,
|
|
1669
1662
|
onClick: () => handlePeriodChange("AM")
|
|
1670
1663
|
},
|
|
1671
1664
|
"AM"
|
|
@@ -1673,7 +1666,7 @@ function TimePicker({
|
|
|
1673
1666
|
"button",
|
|
1674
1667
|
{
|
|
1675
1668
|
type: "button",
|
|
1676
|
-
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" : ""}`,
|
|
1677
1670
|
onClick: () => handlePeriodChange("PM")
|
|
1678
1671
|
},
|
|
1679
1672
|
"PM"
|
|
@@ -1812,27 +1805,27 @@ function DateRangePicker({
|
|
|
1812
1805
|
const handleNextMonth = () => {
|
|
1813
1806
|
setSelectedMonth(new Date(year, month + 1, 1));
|
|
1814
1807
|
};
|
|
1815
|
-
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(
|
|
1816
1809
|
"button",
|
|
1817
1810
|
{
|
|
1818
1811
|
type: "button",
|
|
1819
|
-
className: "
|
|
1812
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1820
1813
|
onClick: handlePrevMonth,
|
|
1821
1814
|
"aria-label": "Previous month"
|
|
1822
1815
|
},
|
|
1823
1816
|
"\u2190"
|
|
1824
|
-
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
1817
|
+
), /* @__PURE__ */ React7__namespace.createElement("div", { className: "font-medium text-sm" }, `${monthNames[month]} ${year}`), /* @__PURE__ */ React7__namespace.createElement(
|
|
1825
1818
|
"button",
|
|
1826
1819
|
{
|
|
1827
1820
|
type: "button",
|
|
1828
|
-
className: "
|
|
1821
|
+
className: "flex items-center justify-center h-8 w-8 rounded border-none bg-transparent hover:bg-accent cursor-pointer",
|
|
1829
1822
|
onClick: handleNextMonth,
|
|
1830
1823
|
"aria-label": "Next month"
|
|
1831
1824
|
},
|
|
1832
1825
|
"\u2192"
|
|
1833
|
-
)), /* @__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) => {
|
|
1834
1827
|
if (!date) {
|
|
1835
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}
|
|
1828
|
+
return /* @__PURE__ */ React7__namespace.createElement("div", { key: `empty-${index}` });
|
|
1836
1829
|
}
|
|
1837
1830
|
const isStart = rangeStart && date.toDateString() === rangeStart.toDateString();
|
|
1838
1831
|
const isEnd = rangeEnd && date.toDateString() === rangeEnd.toDateString();
|
|
@@ -1845,7 +1838,7 @@ function DateRangePicker({
|
|
|
1845
1838
|
{
|
|
1846
1839
|
key: date.toISOString(),
|
|
1847
1840
|
type: "button",
|
|
1848
|
-
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" : ""}`,
|
|
1849
1842
|
onClick: () => !disabled2 && handleDateSelect(date),
|
|
1850
1843
|
onMouseEnter: () => setHoverDate(date),
|
|
1851
1844
|
onMouseLeave: () => setHoverDate(null),
|
|
@@ -1856,11 +1849,7 @@ function DateRangePicker({
|
|
|
1856
1849
|
);
|
|
1857
1850
|
})));
|
|
1858
1851
|
};
|
|
1859
|
-
const
|
|
1860
|
-
const errorClassName = error ? "daterangepicker--error" : "";
|
|
1861
|
-
const disabledClassName = disabled ? "daterangepicker--disabled" : "";
|
|
1862
|
-
const openClassName = isOpen ? "daterangepicker--open" : "";
|
|
1863
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${openClassName} ${className}`.trim();
|
|
1852
|
+
const combinedClassName = `relative ${className}`.trim();
|
|
1864
1853
|
const displayValue = rangeStart && rangeEnd ? `${formatDate2(rangeStart, format)}${separator}${formatDate2(rangeEnd, format)}` : rangeStart ? formatDate2(rangeStart, format) : "";
|
|
1865
1854
|
return /* @__PURE__ */ React7__namespace.createElement("div", { ref: containerRef, className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement(
|
|
1866
1855
|
"input",
|
|
@@ -1876,7 +1865,7 @@ function DateRangePicker({
|
|
|
1876
1865
|
name: `${name}[end]`,
|
|
1877
1866
|
value: rangeEnd ? rangeEnd.toISOString() : ""
|
|
1878
1867
|
}
|
|
1879
|
-
), /* @__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(
|
|
1880
1869
|
"svg",
|
|
1881
1870
|
{
|
|
1882
1871
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1894,7 +1883,7 @@ function DateRangePicker({
|
|
|
1894
1883
|
"input",
|
|
1895
1884
|
{
|
|
1896
1885
|
type: "text",
|
|
1897
|
-
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" : ""}`,
|
|
1898
1887
|
value: displayValue,
|
|
1899
1888
|
onClick: handleToggle,
|
|
1900
1889
|
onBlur,
|
|
@@ -1910,13 +1899,13 @@ function DateRangePicker({
|
|
|
1910
1899
|
"button",
|
|
1911
1900
|
{
|
|
1912
1901
|
type: "button",
|
|
1913
|
-
className: "
|
|
1902
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1914
1903
|
onClick: handleClear,
|
|
1915
1904
|
"aria-label": "Clear date range",
|
|
1916
1905
|
tabIndex: -1
|
|
1917
1906
|
},
|
|
1918
1907
|
"\u2715"
|
|
1919
|
-
)), 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")));
|
|
1920
1909
|
}
|
|
1921
1910
|
DateRangePicker.displayName = "DateRangePicker";
|
|
1922
1911
|
function htmlToMarkdown(html) {
|
|
@@ -2071,17 +2060,13 @@ function RichTextEditor({
|
|
|
2071
2060
|
}
|
|
2072
2061
|
}
|
|
2073
2062
|
};
|
|
2074
|
-
const
|
|
2075
|
-
const errorClassName = error ? "richtexteditor--error" : "";
|
|
2076
|
-
const disabledClassName = disabled ? "richtexteditor--disabled" : "";
|
|
2077
|
-
const modeClassName = `richtexteditor--${currentMode}`;
|
|
2078
|
-
const combinedClassName = `${baseClassName} ${errorClassName} ${disabledClassName} ${modeClassName} ${className}`.trim();
|
|
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();
|
|
2079
2064
|
const editorStyle = {
|
|
2080
2065
|
minHeight,
|
|
2081
2066
|
maxHeight,
|
|
2082
2067
|
overflowY: maxHeight ? "auto" : void 0
|
|
2083
2068
|
};
|
|
2084
|
-
return /* @__PURE__ */ React7__namespace.createElement("div", { className: combinedClassName }, /* @__PURE__ */ React7__namespace.createElement("input", { type: "hidden", name, value: content }), showToolbar && /* @__PURE__ */ React7__namespace.createElement("div", { className: "
|
|
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) => {
|
|
2085
2070
|
const button = toolbarConfig[buttonName];
|
|
2086
2071
|
if (!button) return null;
|
|
2087
2072
|
return /* @__PURE__ */ React7__namespace.createElement(
|
|
@@ -2089,7 +2074,7 @@ function RichTextEditor({
|
|
|
2089
2074
|
{
|
|
2090
2075
|
key: buttonName,
|
|
2091
2076
|
type: "button",
|
|
2092
|
-
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",
|
|
2093
2078
|
onClick: () => editorRef.current && button.action(editorRef.current),
|
|
2094
2079
|
title: button.title,
|
|
2095
2080
|
disabled: disabled || currentMode === "markdown",
|
|
@@ -2101,18 +2086,18 @@ function RichTextEditor({
|
|
|
2101
2086
|
"button",
|
|
2102
2087
|
{
|
|
2103
2088
|
type: "button",
|
|
2104
|
-
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",
|
|
2105
2090
|
onClick: handleModeToggle,
|
|
2106
2091
|
disabled,
|
|
2107
2092
|
title: `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`,
|
|
2108
2093
|
"aria-label": `Switch to ${currentMode === "wysiwyg" ? "Markdown" : "WYSIWYG"}`
|
|
2109
2094
|
},
|
|
2110
2095
|
currentMode === "wysiwyg" ? "MD" : "WYSIWYG"
|
|
2111
|
-
)), /* @__PURE__ */ React7__namespace.createElement("div", {
|
|
2096
|
+
)), /* @__PURE__ */ React7__namespace.createElement("div", { style: editorStyle }, currentMode === "wysiwyg" ? /* @__PURE__ */ React7__namespace.createElement(
|
|
2112
2097
|
"div",
|
|
2113
2098
|
{
|
|
2114
2099
|
ref: editorRef,
|
|
2115
|
-
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",
|
|
2116
2101
|
role: "textbox",
|
|
2117
2102
|
contentEditable: !disabled,
|
|
2118
2103
|
onInput: handleWysiwygChange,
|
|
@@ -2127,7 +2112,7 @@ function RichTextEditor({
|
|
|
2127
2112
|
"textarea",
|
|
2128
2113
|
{
|
|
2129
2114
|
ref: textareaRef,
|
|
2130
|
-
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",
|
|
2131
2116
|
value: content,
|
|
2132
2117
|
onChange: handleMarkdownChange,
|
|
2133
2118
|
onBlur,
|
|
@@ -2136,7 +2121,8 @@ function RichTextEditor({
|
|
|
2136
2121
|
placeholder,
|
|
2137
2122
|
"aria-invalid": error || props["aria-invalid"] ? "true" : "false",
|
|
2138
2123
|
"aria-describedby": props["aria-describedby"],
|
|
2139
|
-
"aria-required": required || props["aria-required"]
|
|
2124
|
+
"aria-required": required || props["aria-required"],
|
|
2125
|
+
style: editorStyle
|
|
2140
2126
|
}
|
|
2141
2127
|
)));
|
|
2142
2128
|
}
|