@dimasbaguspm/versaur 0.0.53 → 0.0.55
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/js/forms/index.js +11 -10
- package/dist/js/index.js +47 -46
- package/dist/js/time-picker-input-CYBfc7s_.js +1678 -0
- package/dist/types/forms/date-single-picker-input/types.d.ts +3 -3
- package/dist/types/forms/index.d.ts +1 -0
- package/dist/types/forms/text-input-as-button/index.d.ts +2 -0
- package/dist/types/forms/text-input-as-button/text-input-as-button.d.ts +10 -0
- package/dist/types/forms/text-input-as-button/types.d.ts +53 -0
- package/dist/utils/enforce-subpath-import.js +1 -0
- package/package.json +1 -1
- package/dist/js/time-picker-input-BaM8Wdih.js +0 -1562
|
@@ -0,0 +1,1678 @@
|
|
|
1
|
+
import { c as C, j as e, a as x } from "./index-DOdDlCoL.js";
|
|
2
|
+
import m, { createContext as F, useContext as A, useId as B, forwardRef as O, useRef as T, useEffect as ae, useState as se } from "react";
|
|
3
|
+
import { I as $ } from "./image-rectangle-K9jmTTED.js";
|
|
4
|
+
import { Calendar as oe, MailIcon as ie, Banknote as ce, SearchIcon as le, ChevronDown as de, Clock as ue } from "lucide-react";
|
|
5
|
+
import "./snackbar-DH8jCh2V.js";
|
|
6
|
+
const fe = C("space-y-2", {
|
|
7
|
+
variants: {
|
|
8
|
+
direction: {
|
|
9
|
+
vertical: "space-y-2 space-x-0",
|
|
10
|
+
horizontal: "flex flex-wrap gap-4 space-y-0"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
direction: "vertical"
|
|
15
|
+
}
|
|
16
|
+
}), pe = C(
|
|
17
|
+
"relative h-4 w-4 rounded border cursor-pointer transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed appearance-none bg-white border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20"
|
|
18
|
+
), me = C(
|
|
19
|
+
"text-sm text-foreground cursor-pointer select-none",
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
disabled: {
|
|
23
|
+
true: "opacity-50 cursor-not-allowed",
|
|
24
|
+
false: ""
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
disabled: !1
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
), q = F(null), he = () => {
|
|
32
|
+
const t = A(q);
|
|
33
|
+
if (!t)
|
|
34
|
+
throw new Error("CheckboxOption must be used within CheckboxInput");
|
|
35
|
+
return t;
|
|
36
|
+
}, G = m.forwardRef(({ children: t, description: r, className: n, disabled: o, id: s, ...i }, d) => {
|
|
37
|
+
const l = he(), c = m.useId(), a = s || c, u = o || l.disabled;
|
|
38
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
39
|
+
/* @__PURE__ */ e.jsx("div", { className: "relative flex items-center mt-0.5", children: /* @__PURE__ */ e.jsx(
|
|
40
|
+
"input",
|
|
41
|
+
{
|
|
42
|
+
ref: d,
|
|
43
|
+
type: "checkbox",
|
|
44
|
+
id: a,
|
|
45
|
+
disabled: u,
|
|
46
|
+
className: x(
|
|
47
|
+
pe(),
|
|
48
|
+
// Custom checkmark styling using ::after - centered positioning
|
|
49
|
+
'after:content-[""] after:absolute after:left-1/2 after:top-[45%] after:-translate-x-1/2 after:-translate-y-1/2 after:border-b-2 after:border-r-2 after:border-white after:rotate-45 after:opacity-0 after:transition-opacity after:duration-200',
|
|
50
|
+
// Checkmark dimensions for md size (default)
|
|
51
|
+
"after:w-[4px] after:h-[8px]",
|
|
52
|
+
"checked:after:opacity-100",
|
|
53
|
+
n
|
|
54
|
+
),
|
|
55
|
+
...i
|
|
56
|
+
}
|
|
57
|
+
) }),
|
|
58
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
|
|
59
|
+
/* @__PURE__ */ e.jsx(
|
|
60
|
+
"label",
|
|
61
|
+
{
|
|
62
|
+
htmlFor: a,
|
|
63
|
+
className: me({
|
|
64
|
+
disabled: u
|
|
65
|
+
}),
|
|
66
|
+
children: t
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
r && /* @__PURE__ */ e.jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: x(
|
|
73
|
+
"text-xs text-gray-600 mt-1",
|
|
74
|
+
u && "opacity-50"
|
|
75
|
+
),
|
|
76
|
+
children: r
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] })
|
|
80
|
+
] });
|
|
81
|
+
});
|
|
82
|
+
G.displayName = "CheckboxOption";
|
|
83
|
+
const K = m.forwardRef(
|
|
84
|
+
({
|
|
85
|
+
label: t,
|
|
86
|
+
helperText: r,
|
|
87
|
+
error: n,
|
|
88
|
+
direction: o = "vertical",
|
|
89
|
+
className: s,
|
|
90
|
+
disabled: i,
|
|
91
|
+
required: d,
|
|
92
|
+
children: l,
|
|
93
|
+
...c
|
|
94
|
+
}, a) => {
|
|
95
|
+
const u = !!n, p = {
|
|
96
|
+
disabled: i
|
|
97
|
+
};
|
|
98
|
+
return /* @__PURE__ */ e.jsx(q.Provider, { value: p, children: /* @__PURE__ */ e.jsxs(
|
|
99
|
+
"fieldset",
|
|
100
|
+
{
|
|
101
|
+
ref: a,
|
|
102
|
+
disabled: i,
|
|
103
|
+
className: x("w-full border-0 p-0 m-0", s),
|
|
104
|
+
...c,
|
|
105
|
+
children: [
|
|
106
|
+
t && /* @__PURE__ */ e.jsxs("legend", { className: "block text-sm font-medium text-foreground mb-3", children: [
|
|
107
|
+
t,
|
|
108
|
+
d && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ e.jsx("div", { className: fe({ direction: o }), children: l }),
|
|
111
|
+
u && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: n }),
|
|
112
|
+
!u && r && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-gray-600", children: r })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
) });
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
K.displayName = "CheckboxInput";
|
|
119
|
+
const lt = Object.assign(K, {
|
|
120
|
+
Option: G
|
|
121
|
+
}), _ = F(null), be = () => {
|
|
122
|
+
const t = A(_);
|
|
123
|
+
if (!t)
|
|
124
|
+
throw new Error(
|
|
125
|
+
"useChipSingleInputContext must be used within ChipSingleInputContext"
|
|
126
|
+
);
|
|
127
|
+
return t;
|
|
128
|
+
}, ge = C(
|
|
129
|
+
"inline-flex items-center justify-center rounded-full bg-white transition-colors duration-200 cursor-pointer border border-border hover:bg-primary-soft hover:border-primary-bold focus:border-primary-light data-[selected=true]:bg-primary data-[selected=true]:border-primary data-[selected=true]:text-white",
|
|
130
|
+
{
|
|
131
|
+
variants: {
|
|
132
|
+
size: {
|
|
133
|
+
sm: "h-7 px-3 text-sm min-w-[2.25rem]",
|
|
134
|
+
md: "h-9 px-4 text-sm min-w-[2.5rem]",
|
|
135
|
+
lg: "h-10 px-8 text-lg min-w-[2.75rem]"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
defaultVariants: {
|
|
139
|
+
size: "md"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
), xe = m.forwardRef(({ children: t, className: r, disabled: n, id: o, value: s, ...i }, d) => {
|
|
143
|
+
const { size: l = "md", maxWidth: c, ...a } = be(), u = B(), p = o || u, f = n || a.disabled, h = a.readOnly, b = a.value === s, w = (g) => {
|
|
144
|
+
!f && !h && a.onChange?.(s), i.onChange?.(g);
|
|
145
|
+
};
|
|
146
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
147
|
+
/* @__PURE__ */ e.jsx(
|
|
148
|
+
"input",
|
|
149
|
+
{
|
|
150
|
+
ref: d,
|
|
151
|
+
type: "radio",
|
|
152
|
+
id: p,
|
|
153
|
+
name: a.name,
|
|
154
|
+
value: s,
|
|
155
|
+
checked: b,
|
|
156
|
+
disabled: f,
|
|
157
|
+
readOnly: h,
|
|
158
|
+
onChange: w,
|
|
159
|
+
className: "sr-only",
|
|
160
|
+
...i
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ e.jsx(
|
|
164
|
+
"label",
|
|
165
|
+
{
|
|
166
|
+
htmlFor: p,
|
|
167
|
+
"data-selected": b,
|
|
168
|
+
style: c ? { maxWidth: c } : void 0,
|
|
169
|
+
className: x(
|
|
170
|
+
ge({
|
|
171
|
+
size: l
|
|
172
|
+
}),
|
|
173
|
+
f && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
174
|
+
h && "cursor-default pointer-events-none",
|
|
175
|
+
c && "overflow-hidden",
|
|
176
|
+
r
|
|
177
|
+
),
|
|
178
|
+
children: /* @__PURE__ */ e.jsx(
|
|
179
|
+
"span",
|
|
180
|
+
{
|
|
181
|
+
className: x(
|
|
182
|
+
"flex items-center gap-2",
|
|
183
|
+
c && "truncate min-w-0"
|
|
184
|
+
),
|
|
185
|
+
children: t
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] });
|
|
191
|
+
}), ye = O(
|
|
192
|
+
({
|
|
193
|
+
size: t = "md",
|
|
194
|
+
label: r,
|
|
195
|
+
required: n,
|
|
196
|
+
helperText: o,
|
|
197
|
+
error: s,
|
|
198
|
+
className: i,
|
|
199
|
+
disabled: d,
|
|
200
|
+
readOnly: l,
|
|
201
|
+
maxWidth: c,
|
|
202
|
+
name: a,
|
|
203
|
+
value: u,
|
|
204
|
+
onChange: p,
|
|
205
|
+
children: f,
|
|
206
|
+
...h
|
|
207
|
+
}, b) => {
|
|
208
|
+
const w = !!s, g = {
|
|
209
|
+
size: t,
|
|
210
|
+
disabled: d,
|
|
211
|
+
readOnly: l,
|
|
212
|
+
error: w,
|
|
213
|
+
name: a,
|
|
214
|
+
value: u,
|
|
215
|
+
maxWidth: c,
|
|
216
|
+
onChange: p
|
|
217
|
+
};
|
|
218
|
+
return /* @__PURE__ */ e.jsx(_.Provider, { value: g, children: /* @__PURE__ */ e.jsxs(
|
|
219
|
+
"fieldset",
|
|
220
|
+
{
|
|
221
|
+
ref: b,
|
|
222
|
+
className: x("w-full border-0 p-0 m-0", i),
|
|
223
|
+
disabled: d,
|
|
224
|
+
...h,
|
|
225
|
+
children: [
|
|
226
|
+
r && /* @__PURE__ */ e.jsxs("legend", { className: "block text-sm font-medium text-foreground mb-3 float-none w-auto", children: [
|
|
227
|
+
r,
|
|
228
|
+
n && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: f }),
|
|
231
|
+
w && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
|
|
232
|
+
!w && o && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
) });
|
|
236
|
+
}
|
|
237
|
+
), dt = Object.assign(ye, {
|
|
238
|
+
Option: xe
|
|
239
|
+
}), H = F(null), we = () => {
|
|
240
|
+
const t = A(H);
|
|
241
|
+
if (!t)
|
|
242
|
+
throw new Error(
|
|
243
|
+
"useChipMultipleInputContext must be used within ChipMultipleInputContext"
|
|
244
|
+
);
|
|
245
|
+
return t;
|
|
246
|
+
}, je = C(
|
|
247
|
+
"inline-flex items-center justify-center rounded-full bg-white transition-colors duration-200 cursor-pointer border border-border hover:bg-primary-soft hover:border-primary-bold focus:border-primary-light data-[selected=true]:bg-primary data-[selected=true]:border-primary data-[selected=true]:text-white",
|
|
248
|
+
{
|
|
249
|
+
variants: {
|
|
250
|
+
size: {
|
|
251
|
+
sm: "h-7 px-3 text-sm min-w-[2.25rem]",
|
|
252
|
+
md: "h-9 px-4 text-sm min-w-[2.5rem]",
|
|
253
|
+
lg: "h-10 px-8 text-lg min-w-[2.75rem]"
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
defaultVariants: {
|
|
257
|
+
size: "md"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
), ve = m.forwardRef(({ children: t, className: r, disabled: n, id: o, value: s, ...i }, d) => {
|
|
261
|
+
const { size: l = "md", maxWidth: c, ...a } = we(), u = B(), p = o || u, f = n || a.disabled, h = a.readOnly, b = a.value?.includes(s) ?? !1, w = (g) => {
|
|
262
|
+
if (!f && !h) {
|
|
263
|
+
const k = a.value || [];
|
|
264
|
+
let j;
|
|
265
|
+
b ? j = k.filter((N) => N !== s) : j = [...k, s], a.onChange?.(j);
|
|
266
|
+
}
|
|
267
|
+
i.onChange?.(g);
|
|
268
|
+
};
|
|
269
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
270
|
+
/* @__PURE__ */ e.jsx(
|
|
271
|
+
"input",
|
|
272
|
+
{
|
|
273
|
+
ref: d,
|
|
274
|
+
type: "checkbox",
|
|
275
|
+
id: p,
|
|
276
|
+
name: `${a.name}[]`,
|
|
277
|
+
value: s,
|
|
278
|
+
checked: b,
|
|
279
|
+
disabled: f,
|
|
280
|
+
readOnly: h,
|
|
281
|
+
onChange: w,
|
|
282
|
+
className: "sr-only",
|
|
283
|
+
...i
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ e.jsx(
|
|
287
|
+
"label",
|
|
288
|
+
{
|
|
289
|
+
htmlFor: p,
|
|
290
|
+
"data-selected": b,
|
|
291
|
+
style: c ? { maxWidth: c } : void 0,
|
|
292
|
+
className: x(
|
|
293
|
+
je({
|
|
294
|
+
size: l
|
|
295
|
+
}),
|
|
296
|
+
f && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
297
|
+
h && "cursor-default pointer-events-none",
|
|
298
|
+
c && "overflow-hidden",
|
|
299
|
+
r
|
|
300
|
+
),
|
|
301
|
+
children: /* @__PURE__ */ e.jsx(
|
|
302
|
+
"span",
|
|
303
|
+
{
|
|
304
|
+
className: x(
|
|
305
|
+
"flex items-center gap-2",
|
|
306
|
+
c && "truncate min-w-0"
|
|
307
|
+
),
|
|
308
|
+
children: t
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
] });
|
|
314
|
+
}), ke = O(
|
|
315
|
+
({
|
|
316
|
+
size: t = "md",
|
|
317
|
+
label: r,
|
|
318
|
+
required: n,
|
|
319
|
+
helperText: o,
|
|
320
|
+
error: s,
|
|
321
|
+
className: i,
|
|
322
|
+
disabled: d,
|
|
323
|
+
readOnly: l,
|
|
324
|
+
maxWidth: c,
|
|
325
|
+
name: a,
|
|
326
|
+
value: u = [],
|
|
327
|
+
onChange: p,
|
|
328
|
+
children: f,
|
|
329
|
+
...h
|
|
330
|
+
}, b) => {
|
|
331
|
+
const w = !!s, g = {
|
|
332
|
+
size: t,
|
|
333
|
+
disabled: d,
|
|
334
|
+
readOnly: l,
|
|
335
|
+
error: w,
|
|
336
|
+
name: a,
|
|
337
|
+
value: u,
|
|
338
|
+
maxWidth: c,
|
|
339
|
+
onChange: p
|
|
340
|
+
};
|
|
341
|
+
return /* @__PURE__ */ e.jsx(H.Provider, { value: g, children: /* @__PURE__ */ e.jsxs(
|
|
342
|
+
"fieldset",
|
|
343
|
+
{
|
|
344
|
+
ref: b,
|
|
345
|
+
className: x("w-full border-0 p-0 m-0", i),
|
|
346
|
+
disabled: d,
|
|
347
|
+
...h,
|
|
348
|
+
children: [
|
|
349
|
+
r && /* @__PURE__ */ e.jsxs("legend", { className: "block text-sm font-medium text-foreground mb-3 float-none w-auto", children: [
|
|
350
|
+
r,
|
|
351
|
+
n && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
352
|
+
] }),
|
|
353
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-2", children: f }),
|
|
354
|
+
w && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
|
|
355
|
+
!w && o && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
) });
|
|
359
|
+
}
|
|
360
|
+
), ut = Object.assign(ke, {
|
|
361
|
+
Option: ve
|
|
362
|
+
}), Ie = C(
|
|
363
|
+
"block w-full rounded-md border bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none disabled:bg-gray-50 text-left",
|
|
364
|
+
{
|
|
365
|
+
variants: {
|
|
366
|
+
state: {
|
|
367
|
+
default: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20 hover:border-primary/50",
|
|
368
|
+
error: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
|
|
369
|
+
readOnly: "border-gray-300 bg-gray-50 text-foreground cursor-default focus:ring-0 focus:border-gray-300"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
defaultVariants: {
|
|
373
|
+
state: "default"
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
), J = m.forwardRef(
|
|
377
|
+
({
|
|
378
|
+
label: t,
|
|
379
|
+
leftContent: r,
|
|
380
|
+
rightContent: n,
|
|
381
|
+
helperText: o,
|
|
382
|
+
error: s,
|
|
383
|
+
className: i,
|
|
384
|
+
disabled: d,
|
|
385
|
+
id: l,
|
|
386
|
+
required: c,
|
|
387
|
+
value: a,
|
|
388
|
+
displayValue: u,
|
|
389
|
+
placeholder: p = "",
|
|
390
|
+
name: f,
|
|
391
|
+
...h
|
|
392
|
+
}, b) => {
|
|
393
|
+
const w = m.useId(), g = l || w, k = `${g}-helper`, j = `${g}-error`, N = !!s, V = m.useMemo(() => {
|
|
394
|
+
if (u) return u;
|
|
395
|
+
if (a != null && a !== "") {
|
|
396
|
+
if (typeof a == "string") return a;
|
|
397
|
+
if (typeof a == "number" || typeof a == "boolean")
|
|
398
|
+
return String(a);
|
|
399
|
+
if (Array.isArray(a)) return a.join(", ");
|
|
400
|
+
if (typeof a == "object") return JSON.stringify(a);
|
|
401
|
+
}
|
|
402
|
+
return p;
|
|
403
|
+
}, [a, u, p]), R = m.useMemo(() => a == null ? "" : typeof a == "string" || typeof a == "number" || typeof a == "boolean" ? String(a) : Array.isArray(a) || typeof a == "object" ? JSON.stringify(a) : String(a), [a]), S = a != null && a !== "" && V !== p, E = m.useMemo(() => {
|
|
404
|
+
const z = [];
|
|
405
|
+
return N ? z.push(j) : o && z.push(k), z.length > 0 ? z.join(" ") : void 0;
|
|
406
|
+
}, [N, o, j, k]);
|
|
407
|
+
return /* @__PURE__ */ e.jsxs("div", { className: x("w-full", i), children: [
|
|
408
|
+
t && /* @__PURE__ */ e.jsxs(
|
|
409
|
+
"label",
|
|
410
|
+
{
|
|
411
|
+
htmlFor: g,
|
|
412
|
+
className: "block text-sm font-medium text-foreground mb-2",
|
|
413
|
+
children: [
|
|
414
|
+
t,
|
|
415
|
+
c && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative w-full", children: [
|
|
420
|
+
r && /* @__PURE__ */ e.jsx(
|
|
421
|
+
"span",
|
|
422
|
+
{
|
|
423
|
+
className: "absolute left-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5 z-10",
|
|
424
|
+
"aria-hidden": "true",
|
|
425
|
+
"data-testid": "left-content",
|
|
426
|
+
children: r
|
|
427
|
+
}
|
|
428
|
+
),
|
|
429
|
+
/* @__PURE__ */ e.jsx(
|
|
430
|
+
"button",
|
|
431
|
+
{
|
|
432
|
+
ref: b,
|
|
433
|
+
id: g,
|
|
434
|
+
type: "button",
|
|
435
|
+
disabled: d,
|
|
436
|
+
"aria-invalid": N || void 0,
|
|
437
|
+
"aria-describedby": E,
|
|
438
|
+
"aria-errormessage": N ? j : void 0,
|
|
439
|
+
"aria-required": c || void 0,
|
|
440
|
+
className: x(
|
|
441
|
+
Ie({
|
|
442
|
+
state: N ? "error" : "default"
|
|
443
|
+
}),
|
|
444
|
+
r ? "pl-9" : "pl-3",
|
|
445
|
+
n ? "pr-9" : "pr-3",
|
|
446
|
+
"h-9",
|
|
447
|
+
!S && "text-gray-400"
|
|
448
|
+
),
|
|
449
|
+
...h,
|
|
450
|
+
children: V
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
n && /* @__PURE__ */ e.jsx(
|
|
454
|
+
"span",
|
|
455
|
+
{
|
|
456
|
+
className: "absolute right-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5 z-10",
|
|
457
|
+
"aria-hidden": "true",
|
|
458
|
+
"data-testid": "right-content",
|
|
459
|
+
children: n
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
f && /* @__PURE__ */ e.jsx(
|
|
463
|
+
"input",
|
|
464
|
+
{
|
|
465
|
+
type: "hidden",
|
|
466
|
+
name: f,
|
|
467
|
+
value: R,
|
|
468
|
+
readOnly: !0,
|
|
469
|
+
"data-testid": "hidden-input"
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
] }),
|
|
473
|
+
N && /* @__PURE__ */ e.jsx(
|
|
474
|
+
"div",
|
|
475
|
+
{
|
|
476
|
+
id: j,
|
|
477
|
+
className: "mt-1 text-sm text-danger",
|
|
478
|
+
role: "alert",
|
|
479
|
+
"aria-live": "polite",
|
|
480
|
+
children: s
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
!N && o && /* @__PURE__ */ e.jsx("div", { id: k, className: "mt-1 text-sm text-gray-600", children: o })
|
|
484
|
+
] });
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
J.displayName = "TextInputAsButton";
|
|
488
|
+
function Ne(t) {
|
|
489
|
+
if (!t) return "";
|
|
490
|
+
const r = new Date(t);
|
|
491
|
+
return isNaN(r.getTime()) ? t : r.toLocaleDateString(void 0, {
|
|
492
|
+
year: "numeric",
|
|
493
|
+
month: "short",
|
|
494
|
+
day: "numeric"
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
const ft = m.forwardRef(function({ value: r = "", onChange: n, label: o, formatter: s, min: i, max: d, ...l }, c) {
|
|
498
|
+
const a = T(null), u = (b) => {
|
|
499
|
+
a.current = b, typeof c == "function" ? c(b) : c && typeof c == "object" && (c.current = b);
|
|
500
|
+
}, p = () => {
|
|
501
|
+
a.current && (typeof a.current.showPicker == "function" ? a.current.showPicker() : a.current.focus());
|
|
502
|
+
}, f = (b) => {
|
|
503
|
+
n(b.target.value);
|
|
504
|
+
}, h = (s ?? Ne)(r);
|
|
505
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
|
|
506
|
+
/* @__PURE__ */ e.jsx(
|
|
507
|
+
J,
|
|
508
|
+
{
|
|
509
|
+
onClick: p,
|
|
510
|
+
value: h,
|
|
511
|
+
label: o,
|
|
512
|
+
leftContent: /* @__PURE__ */ e.jsx($, { as: oe, color: "inherit", size: "sm" }),
|
|
513
|
+
"data-testid": "date-single-picker-visible-input",
|
|
514
|
+
...l
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
/* @__PURE__ */ e.jsx(
|
|
518
|
+
"input",
|
|
519
|
+
{
|
|
520
|
+
ref: u,
|
|
521
|
+
type: "date",
|
|
522
|
+
value: r,
|
|
523
|
+
onChange: f,
|
|
524
|
+
min: i,
|
|
525
|
+
max: d,
|
|
526
|
+
className: "sr-only absolute opacity-0 h-0 w-0 pointer-events-none",
|
|
527
|
+
tabIndex: -1,
|
|
528
|
+
"aria-label": typeof o == "string" ? o : void 0
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
] });
|
|
532
|
+
}), Ce = C(
|
|
533
|
+
"block w-full rounded-md border bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none disabled:bg-gray-50",
|
|
534
|
+
{
|
|
535
|
+
variants: {
|
|
536
|
+
state: {
|
|
537
|
+
default: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
|
|
538
|
+
error: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
|
|
539
|
+
readOnly: "border-gray-300 bg-gray-50 text-foreground cursor-default focus:ring-0 focus:border-gray-300"
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
defaultVariants: {
|
|
543
|
+
state: "default"
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
), M = m.forwardRef(
|
|
547
|
+
({
|
|
548
|
+
label: t,
|
|
549
|
+
leftContent: r,
|
|
550
|
+
rightContent: n,
|
|
551
|
+
helperText: o,
|
|
552
|
+
error: s,
|
|
553
|
+
className: i,
|
|
554
|
+
disabled: d,
|
|
555
|
+
readOnly: l,
|
|
556
|
+
id: c,
|
|
557
|
+
required: a,
|
|
558
|
+
...u
|
|
559
|
+
}, p) => {
|
|
560
|
+
const f = m.useId(), h = c || f, b = `${h}-helper`, w = `${h}-error`, g = !!s, k = m.useMemo(() => {
|
|
561
|
+
const j = [];
|
|
562
|
+
return g ? j.push(w) : o && j.push(b), j.length > 0 ? j.join(" ") : void 0;
|
|
563
|
+
}, [g, o, w, b]);
|
|
564
|
+
return /* @__PURE__ */ e.jsxs("div", { className: x("w-full", i), children: [
|
|
565
|
+
t && /* @__PURE__ */ e.jsxs(
|
|
566
|
+
"label",
|
|
567
|
+
{
|
|
568
|
+
htmlFor: h,
|
|
569
|
+
className: "block text-sm font-medium text-foreground mb-2",
|
|
570
|
+
children: [
|
|
571
|
+
t,
|
|
572
|
+
a && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
573
|
+
]
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative w-full", children: [
|
|
577
|
+
r && /* @__PURE__ */ e.jsx(
|
|
578
|
+
"span",
|
|
579
|
+
{
|
|
580
|
+
className: "absolute left-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5",
|
|
581
|
+
"aria-hidden": "true",
|
|
582
|
+
"data-testid": "left-content",
|
|
583
|
+
children: r
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
/* @__PURE__ */ e.jsx(
|
|
587
|
+
"input",
|
|
588
|
+
{
|
|
589
|
+
ref: p,
|
|
590
|
+
id: h,
|
|
591
|
+
required: a,
|
|
592
|
+
disabled: d,
|
|
593
|
+
readOnly: l,
|
|
594
|
+
"aria-invalid": g,
|
|
595
|
+
"aria-describedby": k,
|
|
596
|
+
"aria-errormessage": g ? w : void 0,
|
|
597
|
+
className: x(
|
|
598
|
+
Ce({
|
|
599
|
+
state: g ? "error" : l ? "readOnly" : "default"
|
|
600
|
+
}),
|
|
601
|
+
r ? "pl-9" : "pl-3",
|
|
602
|
+
n ? "pr-9" : "pr-3",
|
|
603
|
+
"h-9"
|
|
604
|
+
),
|
|
605
|
+
...u
|
|
606
|
+
}
|
|
607
|
+
),
|
|
608
|
+
n && /* @__PURE__ */ e.jsx(
|
|
609
|
+
"span",
|
|
610
|
+
{
|
|
611
|
+
className: "absolute right-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5",
|
|
612
|
+
"aria-hidden": "true",
|
|
613
|
+
"data-testid": "right-content",
|
|
614
|
+
children: n
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
] }),
|
|
618
|
+
g && /* @__PURE__ */ e.jsx(
|
|
619
|
+
"div",
|
|
620
|
+
{
|
|
621
|
+
id: w,
|
|
622
|
+
className: "mt-1 text-sm text-danger",
|
|
623
|
+
role: "alert",
|
|
624
|
+
"aria-live": "polite",
|
|
625
|
+
children: s
|
|
626
|
+
}
|
|
627
|
+
),
|
|
628
|
+
!g && o && /* @__PURE__ */ e.jsx("div", { id: b, className: "mt-1 text-sm text-gray-600", children: o })
|
|
629
|
+
] });
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
M.displayName = "TextInput";
|
|
633
|
+
const pt = O(
|
|
634
|
+
(t, r) => /* @__PURE__ */ e.jsx(
|
|
635
|
+
M,
|
|
636
|
+
{
|
|
637
|
+
...t,
|
|
638
|
+
ref: r,
|
|
639
|
+
type: "email",
|
|
640
|
+
autoComplete: "email",
|
|
641
|
+
inputMode: "email",
|
|
642
|
+
leftContent: /* @__PURE__ */ e.jsx($, { as: ie, color: "inherit", size: "sm" })
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
), Ve = "w-9 h-9 text-center border border-primary/30 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50 disabled:pointer-events-none disabled:bg-gray-50 text-sm font-semibold text-foreground", Re = "w-9 h-9 text-center border border-danger rounded-md bg-danger/5 transition-colors focus:outline-none focus:ring-2 focus:ring-danger/20 focus:border-danger disabled:opacity-50 disabled:pointer-events-none disabled:bg-gray-50 text-sm font-semibold text-foreground", Se = (t) => /^\d$/.test(t), W = (t, r) => t?.replace(/\D/g, "").slice(0, r) || "", Q = m.forwardRef(
|
|
646
|
+
({
|
|
647
|
+
value: t,
|
|
648
|
+
onChange: r,
|
|
649
|
+
onKeyDown: n,
|
|
650
|
+
onFocus: o,
|
|
651
|
+
onPaste: s,
|
|
652
|
+
disabled: i,
|
|
653
|
+
error: d,
|
|
654
|
+
secure: l,
|
|
655
|
+
inputRef: c,
|
|
656
|
+
index: a,
|
|
657
|
+
id: u
|
|
658
|
+
}, p) => /* @__PURE__ */ e.jsx(
|
|
659
|
+
"input",
|
|
660
|
+
{
|
|
661
|
+
ref: c,
|
|
662
|
+
id: u,
|
|
663
|
+
type: "text",
|
|
664
|
+
inputMode: "numeric",
|
|
665
|
+
pattern: l ? void 0 : "[0-9]*",
|
|
666
|
+
maxLength: 1,
|
|
667
|
+
value: l ? t ? "•" : "" : t,
|
|
668
|
+
onChange: (f) => {
|
|
669
|
+
const h = f.target.value;
|
|
670
|
+
(h === "" || Se(h)) && r(h);
|
|
671
|
+
},
|
|
672
|
+
onKeyDown: n,
|
|
673
|
+
onFocus: o,
|
|
674
|
+
onPaste: s,
|
|
675
|
+
disabled: i,
|
|
676
|
+
"aria-invalid": d,
|
|
677
|
+
"aria-disabled": i,
|
|
678
|
+
className: d ? Re : Ve,
|
|
679
|
+
autoComplete: "one-time-code",
|
|
680
|
+
"data-testid": `pin-input-${a}`
|
|
681
|
+
}
|
|
682
|
+
)
|
|
683
|
+
);
|
|
684
|
+
Q.displayName = "PinInput";
|
|
685
|
+
const De = m.forwardRef(
|
|
686
|
+
({
|
|
687
|
+
label: t,
|
|
688
|
+
helperText: r,
|
|
689
|
+
error: n,
|
|
690
|
+
disabled: o,
|
|
691
|
+
value: s,
|
|
692
|
+
onChange: i,
|
|
693
|
+
onComplete: d,
|
|
694
|
+
digits: l = 6,
|
|
695
|
+
className: c,
|
|
696
|
+
id: a,
|
|
697
|
+
name: u,
|
|
698
|
+
required: p,
|
|
699
|
+
secure: f = !1,
|
|
700
|
+
...h
|
|
701
|
+
}, b) => {
|
|
702
|
+
const w = m.useId(), g = a || w, k = !!n, j = m.useRef([]), N = W(s, l), V = N.split("").concat(Array(l - N.length).fill("")), R = m.useCallback(
|
|
703
|
+
(v) => {
|
|
704
|
+
const y = W(v, l);
|
|
705
|
+
i(y), y.length === l && d?.(y);
|
|
706
|
+
},
|
|
707
|
+
[i, d, l]
|
|
708
|
+
), S = m.useCallback(
|
|
709
|
+
(v, y) => {
|
|
710
|
+
const I = [...V];
|
|
711
|
+
I[v] = y;
|
|
712
|
+
const D = I.join("").replace(/\s+$/, "");
|
|
713
|
+
R(D), y && v < l - 1 && j.current[v + 1]?.focus();
|
|
714
|
+
},
|
|
715
|
+
[V, R, l]
|
|
716
|
+
), E = m.useCallback(
|
|
717
|
+
(v, y) => {
|
|
718
|
+
if (y.key === "Backspace") {
|
|
719
|
+
if (!V[v] && v > 0) {
|
|
720
|
+
y.preventDefault();
|
|
721
|
+
const I = [...V];
|
|
722
|
+
I[v - 1] = "";
|
|
723
|
+
const D = I.join("").replace(/\s+$/, "");
|
|
724
|
+
R(D), j.current[v - 1]?.focus();
|
|
725
|
+
} else if (V[v]) {
|
|
726
|
+
y.preventDefault();
|
|
727
|
+
const I = [...V];
|
|
728
|
+
I[v] = "";
|
|
729
|
+
const D = I.join("").replace(/\s+$/, "");
|
|
730
|
+
R(D);
|
|
731
|
+
}
|
|
732
|
+
} else y.key === "ArrowLeft" && v > 0 ? (y.preventDefault(), j.current[v - 1]?.focus()) : y.key === "ArrowRight" && v < l - 1 && (y.preventDefault(), j.current[v + 1]?.focus());
|
|
733
|
+
},
|
|
734
|
+
[V, R, l]
|
|
735
|
+
), z = m.useCallback(
|
|
736
|
+
(v) => {
|
|
737
|
+
v.preventDefault();
|
|
738
|
+
const y = v.clipboardData.getData("text"), I = W(y, l);
|
|
739
|
+
if (I.length > 0) {
|
|
740
|
+
R(I);
|
|
741
|
+
const D = Math.min(I.length, l - 1);
|
|
742
|
+
j.current[D]?.focus();
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
[R, l]
|
|
746
|
+
);
|
|
747
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: b, className: x("w-full", c), ...h, children: [
|
|
748
|
+
t && /* @__PURE__ */ e.jsxs(
|
|
749
|
+
"label",
|
|
750
|
+
{
|
|
751
|
+
htmlFor: `${g}-0`,
|
|
752
|
+
className: "block text-sm font-medium text-foreground mb-2",
|
|
753
|
+
children: [
|
|
754
|
+
t,
|
|
755
|
+
p && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
),
|
|
759
|
+
/* @__PURE__ */ e.jsx(
|
|
760
|
+
"div",
|
|
761
|
+
{
|
|
762
|
+
className: "flex gap-2 justify-center",
|
|
763
|
+
role: "group",
|
|
764
|
+
"aria-labelledby": t ? `${g}-label` : void 0,
|
|
765
|
+
"aria-describedby": k ? `${g}-error` : r ? `${g}-helper` : void 0,
|
|
766
|
+
children: V.map((v, y) => /* @__PURE__ */ e.jsx(
|
|
767
|
+
Q,
|
|
768
|
+
{
|
|
769
|
+
value: v,
|
|
770
|
+
onChange: (I) => S(y, I),
|
|
771
|
+
onKeyDown: (I) => E(y, I),
|
|
772
|
+
onFocus: () => {
|
|
773
|
+
const I = j.current[y];
|
|
774
|
+
I && I.select();
|
|
775
|
+
},
|
|
776
|
+
onPaste: z,
|
|
777
|
+
disabled: o,
|
|
778
|
+
error: k,
|
|
779
|
+
secure: f,
|
|
780
|
+
inputRef: (I) => {
|
|
781
|
+
j.current[y] = I;
|
|
782
|
+
},
|
|
783
|
+
index: y,
|
|
784
|
+
id: `${g}-${y}`
|
|
785
|
+
},
|
|
786
|
+
y
|
|
787
|
+
))
|
|
788
|
+
}
|
|
789
|
+
),
|
|
790
|
+
u && /* @__PURE__ */ e.jsx(
|
|
791
|
+
"input",
|
|
792
|
+
{
|
|
793
|
+
type: "hidden",
|
|
794
|
+
name: u,
|
|
795
|
+
value: N,
|
|
796
|
+
required: p
|
|
797
|
+
}
|
|
798
|
+
),
|
|
799
|
+
k && /* @__PURE__ */ e.jsx(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
id: `${g}-error`,
|
|
803
|
+
className: "mt-2 text-sm text-danger",
|
|
804
|
+
role: "alert",
|
|
805
|
+
children: n
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
!k && r && /* @__PURE__ */ e.jsx("div", { id: `${g}-helper`, className: "mt-2 text-sm text-gray-600", children: r })
|
|
809
|
+
] });
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
De.displayName = "PinField";
|
|
813
|
+
function ze(t, r) {
|
|
814
|
+
ae(() => {
|
|
815
|
+
typeof t == "number" && !isNaN(t) ? r(`${t}`) : t === "" || t === null || t === void 0 ? r("") : typeof t == "string" && r(t);
|
|
816
|
+
}, [t, r]);
|
|
817
|
+
}
|
|
818
|
+
function Oe(t, r = !1) {
|
|
819
|
+
if (t === "" || t === "-" && r) return !0;
|
|
820
|
+
const n = r && t.startsWith("-") ? t.slice(1) : t;
|
|
821
|
+
if (r && t.startsWith("-") && n === "") return !0;
|
|
822
|
+
if (n.startsWith(".") || n.startsWith(",") || !/^[\d.,]+$/.test(n)) return !1;
|
|
823
|
+
const o = n.split(",");
|
|
824
|
+
if (o.length > 2) return !1;
|
|
825
|
+
const s = o[0], i = o[1];
|
|
826
|
+
return !(s === "" || !Pe(s) || i !== void 0 && i !== "" && !$e(i));
|
|
827
|
+
}
|
|
828
|
+
function Pe(t) {
|
|
829
|
+
if (t === "") return !1;
|
|
830
|
+
if (!t.includes("."))
|
|
831
|
+
return /^\d+$/.test(t);
|
|
832
|
+
const r = t.split(".");
|
|
833
|
+
if (r[0] === "" || !/^\d{1,3}$/.test(r[0])) return !1;
|
|
834
|
+
for (let n = 1; n < r.length; n++) {
|
|
835
|
+
const o = r[n];
|
|
836
|
+
if (n === r.length - 1) {
|
|
837
|
+
if (o !== "" && !/^\d{1,3}$/.test(o)) return !1;
|
|
838
|
+
} else if (!/^\d{3}$/.test(o)) return !1;
|
|
839
|
+
}
|
|
840
|
+
return !0;
|
|
841
|
+
}
|
|
842
|
+
function $e(t) {
|
|
843
|
+
return /^\d{1,2}$/.test(t);
|
|
844
|
+
}
|
|
845
|
+
function U(t, r = !1) {
|
|
846
|
+
if (t === "") return "";
|
|
847
|
+
const n = t.startsWith("-");
|
|
848
|
+
if (n && !r)
|
|
849
|
+
return U(t.slice(1), !1);
|
|
850
|
+
if (n && t.length === 1) return "-";
|
|
851
|
+
let s = (n ? t.slice(1) : t).replace(/[^\d.,]/g, "");
|
|
852
|
+
const i = s.lastIndexOf(",");
|
|
853
|
+
if (i !== -1) {
|
|
854
|
+
const d = s.slice(0, i).replace(/,/g, ""), l = s.slice(i + 1).replace(/,/g, "");
|
|
855
|
+
s = d + "," + l;
|
|
856
|
+
}
|
|
857
|
+
return s = s.replace(/\.{2,}/g, "."), (n ? "-" : "") + s;
|
|
858
|
+
}
|
|
859
|
+
const mt = ({
|
|
860
|
+
value: t,
|
|
861
|
+
onChange: r,
|
|
862
|
+
allowNegative: n = !1,
|
|
863
|
+
inputProps: o,
|
|
864
|
+
label: s,
|
|
865
|
+
helperText: i,
|
|
866
|
+
error: d,
|
|
867
|
+
...l
|
|
868
|
+
}) => {
|
|
869
|
+
const c = T(null), [a, u] = se(
|
|
870
|
+
t === "" ? "" : String(t)
|
|
871
|
+
);
|
|
872
|
+
ze(t, u);
|
|
873
|
+
const p = (f) => {
|
|
874
|
+
const h = f.target.value, b = U(h, n);
|
|
875
|
+
Oe(b, n) ? (u(b), r(b)) : f.preventDefault();
|
|
876
|
+
};
|
|
877
|
+
return /* @__PURE__ */ e.jsx(
|
|
878
|
+
M,
|
|
879
|
+
{
|
|
880
|
+
ref: c,
|
|
881
|
+
type: "text",
|
|
882
|
+
label: s,
|
|
883
|
+
value: a,
|
|
884
|
+
onChange: p,
|
|
885
|
+
error: d,
|
|
886
|
+
helperText: i,
|
|
887
|
+
placeholder: l.placeholder,
|
|
888
|
+
leftContent: /* @__PURE__ */ e.jsx($, { as: ce, color: "inherit", size: "sm" }),
|
|
889
|
+
inputMode: "numeric",
|
|
890
|
+
autoComplete: "off",
|
|
891
|
+
pattern: "[0-9.,-]*",
|
|
892
|
+
...o,
|
|
893
|
+
...l
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
}, Ee = C("space-y-2", {
|
|
897
|
+
variants: {
|
|
898
|
+
direction: {
|
|
899
|
+
vertical: "space-y-2 space-x-0",
|
|
900
|
+
horizontal: "flex flex-wrap gap-4 space-y-0"
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
defaultVariants: {
|
|
904
|
+
direction: "vertical"
|
|
905
|
+
}
|
|
906
|
+
}), Me = C(
|
|
907
|
+
"relative h-4 w-4 rounded-full border cursor-pointer transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed appearance-none bg-white",
|
|
908
|
+
{
|
|
909
|
+
variants: {
|
|
910
|
+
variant: {
|
|
911
|
+
// Core variants using Versaur color system
|
|
912
|
+
primary: "border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20",
|
|
913
|
+
secondary: "border-secondary/40 checked:bg-secondary checked:border-secondary focus:ring-secondary/20",
|
|
914
|
+
tertiary: "border-tertiary/40 checked:bg-tertiary checked:border-tertiary focus:ring-tertiary/20",
|
|
915
|
+
ghost: "border-ghost/40 checked:bg-ghost checked:border-ghost focus:ring-ghost/20",
|
|
916
|
+
neutral: "border-gray-300 checked:bg-gray-500 checked:border-gray-500 focus:ring-gray-400/20",
|
|
917
|
+
// Outline variants
|
|
918
|
+
"primary-outline": "border-primary checked:bg-white checked:border-primary focus:ring-primary/20",
|
|
919
|
+
"secondary-outline": "border-secondary checked:bg-white checked:border-secondary focus:ring-secondary/20",
|
|
920
|
+
"tertiary-outline": "border-tertiary checked:bg-white checked:border-tertiary focus:ring-tertiary/20",
|
|
921
|
+
"ghost-outline": "border-ghost checked:bg-white checked:border-ghost focus:ring-ghost/20",
|
|
922
|
+
"neutral-outline": "border-gray-400 checked:bg-white checked:border-gray-400 focus:ring-gray-500/20",
|
|
923
|
+
// Semantic variants
|
|
924
|
+
success: "border-success/40 checked:bg-success checked:border-success focus:ring-success/20",
|
|
925
|
+
"success-outline": "border-success checked:bg-white checked:border-success focus:ring-success/20",
|
|
926
|
+
info: "border-info/40 checked:bg-info checked:border-info focus:ring-info/20",
|
|
927
|
+
"info-outline": "border-info checked:bg-white checked:border-info focus:ring-info/20",
|
|
928
|
+
warning: "border-warning/40 checked:bg-warning checked:border-warning focus:ring-warning/20",
|
|
929
|
+
"warning-outline": "border-warning checked:bg-white checked:border-warning focus:ring-warning/20",
|
|
930
|
+
danger: "border-danger/40 checked:bg-danger checked:border-danger focus:ring-danger/20",
|
|
931
|
+
"danger-outline": "border-danger checked:bg-white checked:border-danger focus:ring-danger/20"
|
|
932
|
+
},
|
|
933
|
+
size: {
|
|
934
|
+
sm: "h-3 w-3",
|
|
935
|
+
md: "h-4 w-4",
|
|
936
|
+
lg: "h-5 w-5"
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
defaultVariants: {
|
|
940
|
+
variant: "primary",
|
|
941
|
+
size: "md"
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
), Fe = C(
|
|
945
|
+
"text-foreground cursor-pointer select-none",
|
|
946
|
+
{
|
|
947
|
+
variants: {
|
|
948
|
+
size: {
|
|
949
|
+
sm: "text-xs",
|
|
950
|
+
md: "text-sm",
|
|
951
|
+
lg: "text-base"
|
|
952
|
+
},
|
|
953
|
+
disabled: {
|
|
954
|
+
true: "opacity-50 cursor-not-allowed",
|
|
955
|
+
false: ""
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
defaultVariants: {
|
|
959
|
+
size: "md",
|
|
960
|
+
disabled: !1
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
), X = F(
|
|
964
|
+
null
|
|
965
|
+
), Ae = () => {
|
|
966
|
+
const t = A(X);
|
|
967
|
+
if (!t)
|
|
968
|
+
throw new Error(
|
|
969
|
+
"useRadioInputContext must be used within RadioInputContext"
|
|
970
|
+
);
|
|
971
|
+
return t;
|
|
972
|
+
}, Be = m.forwardRef(
|
|
973
|
+
({ children: t, description: r, className: n, disabled: o, id: s, value: i, ...d }, l) => {
|
|
974
|
+
const c = Ae(), a = m.useId(), u = s || a, p = o || c.disabled, f = c.error ? "danger" : c.variant || "primary";
|
|
975
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
976
|
+
/* @__PURE__ */ e.jsx("div", { className: "relative flex items-center", children: /* @__PURE__ */ e.jsx(
|
|
977
|
+
"input",
|
|
978
|
+
{
|
|
979
|
+
ref: l,
|
|
980
|
+
type: "radio",
|
|
981
|
+
id: u,
|
|
982
|
+
name: c.name,
|
|
983
|
+
value: i,
|
|
984
|
+
disabled: p,
|
|
985
|
+
className: x(
|
|
986
|
+
Me({
|
|
987
|
+
variant: f,
|
|
988
|
+
size: c.size
|
|
989
|
+
}),
|
|
990
|
+
// Custom radio dot styling using ::before - centered positioning with size variants
|
|
991
|
+
'before:content-[""] before:absolute before:left-1/2 before:top-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-white before:opacity-0 before:transition-opacity before:duration-200',
|
|
992
|
+
// Size-specific radio dot dimensions
|
|
993
|
+
c.size === "sm" && "before:w-[6px] before:h-[6px]",
|
|
994
|
+
c.size === "md" && "before:w-[8px] before:h-[8px]",
|
|
995
|
+
c.size === "lg" && "before:w-[10px] before:h-[10px]",
|
|
996
|
+
"checked:before:opacity-100",
|
|
997
|
+
// Outline variants use colored radio dot
|
|
998
|
+
f?.includes("outline") && "checked:before:bg-current",
|
|
999
|
+
n
|
|
1000
|
+
),
|
|
1001
|
+
...d
|
|
1002
|
+
}
|
|
1003
|
+
) }),
|
|
1004
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex-1", children: [
|
|
1005
|
+
/* @__PURE__ */ e.jsx(
|
|
1006
|
+
"label",
|
|
1007
|
+
{
|
|
1008
|
+
htmlFor: u,
|
|
1009
|
+
className: Fe({
|
|
1010
|
+
size: c.size,
|
|
1011
|
+
disabled: p
|
|
1012
|
+
}),
|
|
1013
|
+
children: t
|
|
1014
|
+
}
|
|
1015
|
+
),
|
|
1016
|
+
r && /* @__PURE__ */ e.jsx(
|
|
1017
|
+
"div",
|
|
1018
|
+
{
|
|
1019
|
+
className: x(
|
|
1020
|
+
"text-gray-600 mt-1",
|
|
1021
|
+
c.size === "sm" && "text-xs",
|
|
1022
|
+
c.size === "md" && "text-xs",
|
|
1023
|
+
c.size === "lg" && "text-sm",
|
|
1024
|
+
p && "opacity-50"
|
|
1025
|
+
),
|
|
1026
|
+
children: r
|
|
1027
|
+
}
|
|
1028
|
+
)
|
|
1029
|
+
] })
|
|
1030
|
+
] });
|
|
1031
|
+
}
|
|
1032
|
+
), We = m.forwardRef(
|
|
1033
|
+
({
|
|
1034
|
+
variant: t = "primary",
|
|
1035
|
+
size: r = "md",
|
|
1036
|
+
label: n,
|
|
1037
|
+
helperText: o,
|
|
1038
|
+
error: s,
|
|
1039
|
+
direction: i = "vertical",
|
|
1040
|
+
className: d,
|
|
1041
|
+
disabled: l,
|
|
1042
|
+
name: c,
|
|
1043
|
+
children: a,
|
|
1044
|
+
...u
|
|
1045
|
+
}, p) => {
|
|
1046
|
+
const f = !!s, h = {
|
|
1047
|
+
variant: t,
|
|
1048
|
+
size: r,
|
|
1049
|
+
disabled: l,
|
|
1050
|
+
error: f,
|
|
1051
|
+
name: c
|
|
1052
|
+
};
|
|
1053
|
+
return /* @__PURE__ */ e.jsx(X.Provider, { value: h, children: /* @__PURE__ */ e.jsxs("div", { ref: p, className: x("w-full", d), ...u, children: [
|
|
1054
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: n }),
|
|
1055
|
+
/* @__PURE__ */ e.jsx("div", { className: Ee({ direction: i }), children: a }),
|
|
1056
|
+
f && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
|
|
1057
|
+
!f && o && /* @__PURE__ */ e.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
|
|
1058
|
+
] }) });
|
|
1059
|
+
}
|
|
1060
|
+
), ht = Object.assign(We, {
|
|
1061
|
+
Option: Be
|
|
1062
|
+
}), bt = O(
|
|
1063
|
+
({
|
|
1064
|
+
autoComplete: t = "off",
|
|
1065
|
+
spellCheck: r = !1,
|
|
1066
|
+
inputMode: n = "search",
|
|
1067
|
+
placeholder: o = "Search...",
|
|
1068
|
+
maxLength: s = 256,
|
|
1069
|
+
enterKeyHint: i = "search",
|
|
1070
|
+
"aria-label": d = "Search",
|
|
1071
|
+
// internal default, not in props
|
|
1072
|
+
...l
|
|
1073
|
+
}, c) => /* @__PURE__ */ e.jsx(
|
|
1074
|
+
M,
|
|
1075
|
+
{
|
|
1076
|
+
ref: c,
|
|
1077
|
+
type: "search",
|
|
1078
|
+
inputMode: n,
|
|
1079
|
+
autoComplete: t,
|
|
1080
|
+
spellCheck: r,
|
|
1081
|
+
placeholder: o,
|
|
1082
|
+
maxLength: s,
|
|
1083
|
+
enterKeyHint: i,
|
|
1084
|
+
"aria-label": d,
|
|
1085
|
+
leftContent: /* @__PURE__ */ e.jsx($, { as: le, color: "inherit", size: "sm" }),
|
|
1086
|
+
...l
|
|
1087
|
+
}
|
|
1088
|
+
)
|
|
1089
|
+
), Le = C(
|
|
1090
|
+
"block w-full rounded-md border bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none disabled:bg-gray-50 appearance-none bg-no-repeat bg-right pr-10",
|
|
1091
|
+
{
|
|
1092
|
+
variants: {
|
|
1093
|
+
state: {
|
|
1094
|
+
default: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
|
|
1095
|
+
error: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
|
|
1096
|
+
readOnly: "border-gray-300 bg-gray-50 text-foreground cursor-default focus:ring-0 focus:border-gray-300"
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
defaultVariants: {
|
|
1100
|
+
state: "default"
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
), Y = m.forwardRef(({ value: t, children: r, ...n }, o) => /* @__PURE__ */ e.jsx("option", { ref: o, value: t, ...n, children: r }));
|
|
1104
|
+
Y.displayName = "SelectOption";
|
|
1105
|
+
const Z = m.forwardRef(({ label: t, children: r, ...n }, o) => /* @__PURE__ */ e.jsx("optgroup", { ref: o, label: t, ...n, children: r }));
|
|
1106
|
+
Z.displayName = "SelectOptionGroup";
|
|
1107
|
+
const ee = m.forwardRef(
|
|
1108
|
+
({
|
|
1109
|
+
label: t,
|
|
1110
|
+
helperText: r,
|
|
1111
|
+
error: n,
|
|
1112
|
+
className: o,
|
|
1113
|
+
disabled: s,
|
|
1114
|
+
readOnly: i,
|
|
1115
|
+
id: d,
|
|
1116
|
+
required: l,
|
|
1117
|
+
placeholder: c,
|
|
1118
|
+
children: a,
|
|
1119
|
+
onChange: u,
|
|
1120
|
+
...p
|
|
1121
|
+
}, f) => {
|
|
1122
|
+
const h = m.useId(), b = d || h, w = `${b}-helper`, g = `${b}-error`, k = !!n, j = m.useMemo(() => {
|
|
1123
|
+
const N = [];
|
|
1124
|
+
return k ? N.push(g) : r && N.push(w), N.length > 0 ? N.join(" ") : void 0;
|
|
1125
|
+
}, [k, r, g, w]);
|
|
1126
|
+
return /* @__PURE__ */ e.jsxs("div", { className: x("w-full", o), children: [
|
|
1127
|
+
t && /* @__PURE__ */ e.jsxs(
|
|
1128
|
+
"label",
|
|
1129
|
+
{
|
|
1130
|
+
htmlFor: b,
|
|
1131
|
+
className: "block text-sm font-medium text-foreground mb-2",
|
|
1132
|
+
children: [
|
|
1133
|
+
t,
|
|
1134
|
+
l && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
1135
|
+
]
|
|
1136
|
+
}
|
|
1137
|
+
),
|
|
1138
|
+
/* @__PURE__ */ e.jsxs("div", { className: "relative w-full", children: [
|
|
1139
|
+
/* @__PURE__ */ e.jsxs(
|
|
1140
|
+
"select",
|
|
1141
|
+
{
|
|
1142
|
+
ref: f,
|
|
1143
|
+
id: b,
|
|
1144
|
+
required: l,
|
|
1145
|
+
disabled: s || i,
|
|
1146
|
+
"aria-invalid": k,
|
|
1147
|
+
"aria-describedby": j,
|
|
1148
|
+
"aria-errormessage": k ? g : void 0,
|
|
1149
|
+
onChange: u,
|
|
1150
|
+
className: x(
|
|
1151
|
+
Le({
|
|
1152
|
+
state: k ? "error" : i ? "readOnly" : "default"
|
|
1153
|
+
}),
|
|
1154
|
+
"h-9 pl-3"
|
|
1155
|
+
),
|
|
1156
|
+
...p,
|
|
1157
|
+
children: [
|
|
1158
|
+
c && /* @__PURE__ */ e.jsx("option", { value: "", disabled: !0, hidden: !0, children: c }),
|
|
1159
|
+
a
|
|
1160
|
+
]
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
/* @__PURE__ */ e.jsx(
|
|
1164
|
+
"div",
|
|
1165
|
+
{
|
|
1166
|
+
className: x(
|
|
1167
|
+
"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-transform duration-200"
|
|
1168
|
+
),
|
|
1169
|
+
children: /* @__PURE__ */ e.jsx($, { as: de, size: "sm", color: "gray", "aria-hidden": "true" })
|
|
1170
|
+
}
|
|
1171
|
+
)
|
|
1172
|
+
] }),
|
|
1173
|
+
k && /* @__PURE__ */ e.jsx(
|
|
1174
|
+
"div",
|
|
1175
|
+
{
|
|
1176
|
+
id: g,
|
|
1177
|
+
className: "mt-1 text-sm text-danger",
|
|
1178
|
+
role: "alert",
|
|
1179
|
+
"aria-live": "polite",
|
|
1180
|
+
children: n
|
|
1181
|
+
}
|
|
1182
|
+
),
|
|
1183
|
+
!k && r && /* @__PURE__ */ e.jsx("div", { id: w, className: "mt-1 text-sm text-gray-600", children: r })
|
|
1184
|
+
] });
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
ee.displayName = "SelectInput";
|
|
1188
|
+
const gt = Object.assign(ee, {
|
|
1189
|
+
Option: Y,
|
|
1190
|
+
OptionGroup: Z
|
|
1191
|
+
}), Te = C(
|
|
1192
|
+
"flex gap-3 cursor-pointer border-b border-border select-none transition-colors",
|
|
1193
|
+
{
|
|
1194
|
+
variants: {
|
|
1195
|
+
checked: {
|
|
1196
|
+
true: "",
|
|
1197
|
+
false: ""
|
|
1198
|
+
},
|
|
1199
|
+
disabled: {
|
|
1200
|
+
true: "opacity-50 cursor-not-allowed",
|
|
1201
|
+
false: ""
|
|
1202
|
+
},
|
|
1203
|
+
checkboxPlacement: {
|
|
1204
|
+
top: "items-start",
|
|
1205
|
+
center: "items-center",
|
|
1206
|
+
bottom: "items-end"
|
|
1207
|
+
},
|
|
1208
|
+
hideCheckbox: {
|
|
1209
|
+
true: "",
|
|
1210
|
+
false: "p-4 hover:bg-neutral-light"
|
|
1211
|
+
}
|
|
1212
|
+
},
|
|
1213
|
+
defaultVariants: {
|
|
1214
|
+
checked: !1,
|
|
1215
|
+
disabled: !1,
|
|
1216
|
+
checkboxPlacement: "center",
|
|
1217
|
+
hideCheckbox: !1
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
), qe = C(
|
|
1221
|
+
"relative h-6 w-6 rounded border cursor-pointer transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 appearance-none bg-white border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20",
|
|
1222
|
+
{
|
|
1223
|
+
variants: {
|
|
1224
|
+
checked: {
|
|
1225
|
+
true: "bg-primary border-primary",
|
|
1226
|
+
false: "border-primary/40 bg-white"
|
|
1227
|
+
},
|
|
1228
|
+
disabled: {
|
|
1229
|
+
true: "opacity-50 cursor-not-allowed",
|
|
1230
|
+
false: "active:scale-95"
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
defaultVariants: {
|
|
1234
|
+
checked: !1,
|
|
1235
|
+
disabled: !1
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
), Ge = O(
|
|
1239
|
+
({
|
|
1240
|
+
value: t,
|
|
1241
|
+
children: r,
|
|
1242
|
+
checked: n,
|
|
1243
|
+
id: o,
|
|
1244
|
+
className: s,
|
|
1245
|
+
disabled: i,
|
|
1246
|
+
checkboxPlacement: d = "center",
|
|
1247
|
+
hideCheckbox: l = !1,
|
|
1248
|
+
...c
|
|
1249
|
+
}, a) => {
|
|
1250
|
+
const u = B(), p = o || u, f = typeof r == "function" ? r(n) : r;
|
|
1251
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1252
|
+
"label",
|
|
1253
|
+
{
|
|
1254
|
+
htmlFor: p,
|
|
1255
|
+
className: x(
|
|
1256
|
+
Te({
|
|
1257
|
+
checked: !!n,
|
|
1258
|
+
disabled: !!i,
|
|
1259
|
+
checkboxPlacement: d,
|
|
1260
|
+
hideCheckbox: l
|
|
1261
|
+
}),
|
|
1262
|
+
s
|
|
1263
|
+
),
|
|
1264
|
+
"aria-checked": n,
|
|
1265
|
+
role: "radio",
|
|
1266
|
+
"aria-label": `Select ${t}`,
|
|
1267
|
+
tabIndex: i ? -1 : 0,
|
|
1268
|
+
children: [
|
|
1269
|
+
/* @__PURE__ */ e.jsx(
|
|
1270
|
+
"input",
|
|
1271
|
+
{
|
|
1272
|
+
ref: a,
|
|
1273
|
+
id: p,
|
|
1274
|
+
type: "radio",
|
|
1275
|
+
value: t,
|
|
1276
|
+
checked: n,
|
|
1277
|
+
disabled: i,
|
|
1278
|
+
className: "sr-only",
|
|
1279
|
+
"aria-hidden": !0,
|
|
1280
|
+
"aria-checked": n,
|
|
1281
|
+
...c
|
|
1282
|
+
}
|
|
1283
|
+
),
|
|
1284
|
+
!l && /* @__PURE__ */ e.jsx(
|
|
1285
|
+
"span",
|
|
1286
|
+
{
|
|
1287
|
+
className: x(
|
|
1288
|
+
qe({
|
|
1289
|
+
checked: !!n,
|
|
1290
|
+
disabled: !!i
|
|
1291
|
+
}),
|
|
1292
|
+
// Custom checkmark styling using ::after - centered positioning
|
|
1293
|
+
'after:content-[""] after:absolute after:left-1/2 after:top-[45%] after:-translate-x-1/2 after:-translate-y-1/2 after:border-b-2 after:border-r-2 after:border-white after:rotate-45 after:opacity-0 after:transition-opacity after:duration-200',
|
|
1294
|
+
// Checkmark dimensions scaled up for h-6 w-6 size
|
|
1295
|
+
"after:w-[6px] after:h-[12px]",
|
|
1296
|
+
n && "after:opacity-100"
|
|
1297
|
+
),
|
|
1298
|
+
"aria-hidden": "true"
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1301
|
+
/* @__PURE__ */ e.jsx("span", { className: "flex-1 min-w-0 text-base text-foreground", children: f })
|
|
1302
|
+
]
|
|
1303
|
+
}
|
|
1304
|
+
);
|
|
1305
|
+
}
|
|
1306
|
+
);
|
|
1307
|
+
Ge.displayName = "SelectableSingleInput";
|
|
1308
|
+
const Ke = C(
|
|
1309
|
+
"flex gap-3 cursor-pointer border-b border-border select-none transition-colors",
|
|
1310
|
+
{
|
|
1311
|
+
variants: {
|
|
1312
|
+
checked: {
|
|
1313
|
+
true: "",
|
|
1314
|
+
false: ""
|
|
1315
|
+
},
|
|
1316
|
+
disabled: {
|
|
1317
|
+
true: "opacity-50 cursor-not-allowed",
|
|
1318
|
+
false: ""
|
|
1319
|
+
},
|
|
1320
|
+
checkboxPlacement: {
|
|
1321
|
+
top: "items-start",
|
|
1322
|
+
center: "items-center",
|
|
1323
|
+
bottom: "items-end"
|
|
1324
|
+
},
|
|
1325
|
+
hideCheckbox: {
|
|
1326
|
+
true: "",
|
|
1327
|
+
false: "p-4 hover:bg-neutral-light"
|
|
1328
|
+
}
|
|
1329
|
+
},
|
|
1330
|
+
defaultVariants: {
|
|
1331
|
+
checked: !1,
|
|
1332
|
+
disabled: !1,
|
|
1333
|
+
checkboxPlacement: "center",
|
|
1334
|
+
hideCheckbox: !1
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
), _e = C(
|
|
1338
|
+
"relative h-6 w-6 rounded border cursor-pointer transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 appearance-none bg-white border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20",
|
|
1339
|
+
{
|
|
1340
|
+
variants: {
|
|
1341
|
+
checked: {
|
|
1342
|
+
true: "bg-primary border-primary",
|
|
1343
|
+
false: "border-primary/40 bg-white"
|
|
1344
|
+
},
|
|
1345
|
+
disabled: {
|
|
1346
|
+
true: "opacity-50 cursor-not-allowed",
|
|
1347
|
+
false: "active:scale-95"
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
defaultVariants: {
|
|
1351
|
+
checked: !1,
|
|
1352
|
+
disabled: !1
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
), He = O(
|
|
1356
|
+
({
|
|
1357
|
+
value: t,
|
|
1358
|
+
children: r,
|
|
1359
|
+
checked: n,
|
|
1360
|
+
id: o,
|
|
1361
|
+
className: s,
|
|
1362
|
+
disabled: i,
|
|
1363
|
+
checkboxPlacement: d = "center",
|
|
1364
|
+
hideCheckbox: l = !1,
|
|
1365
|
+
...c
|
|
1366
|
+
}, a) => {
|
|
1367
|
+
const u = B(), p = o || u, f = typeof r == "function" ? r(n) : r;
|
|
1368
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1369
|
+
"label",
|
|
1370
|
+
{
|
|
1371
|
+
htmlFor: p,
|
|
1372
|
+
className: x(
|
|
1373
|
+
Ke({
|
|
1374
|
+
checked: !!n,
|
|
1375
|
+
disabled: !!i,
|
|
1376
|
+
checkboxPlacement: d,
|
|
1377
|
+
hideCheckbox: l
|
|
1378
|
+
}),
|
|
1379
|
+
s
|
|
1380
|
+
),
|
|
1381
|
+
"aria-checked": n,
|
|
1382
|
+
role: "checkbox",
|
|
1383
|
+
"aria-label": `Select ${t}`,
|
|
1384
|
+
tabIndex: i ? -1 : 0,
|
|
1385
|
+
children: [
|
|
1386
|
+
/* @__PURE__ */ e.jsx(
|
|
1387
|
+
"input",
|
|
1388
|
+
{
|
|
1389
|
+
ref: a,
|
|
1390
|
+
id: p,
|
|
1391
|
+
type: "checkbox",
|
|
1392
|
+
value: t,
|
|
1393
|
+
checked: n,
|
|
1394
|
+
disabled: i,
|
|
1395
|
+
className: "sr-only",
|
|
1396
|
+
"aria-hidden": !0,
|
|
1397
|
+
"aria-checked": n,
|
|
1398
|
+
...c
|
|
1399
|
+
}
|
|
1400
|
+
),
|
|
1401
|
+
!l && /* @__PURE__ */ e.jsx(
|
|
1402
|
+
"span",
|
|
1403
|
+
{
|
|
1404
|
+
className: x(
|
|
1405
|
+
_e({
|
|
1406
|
+
checked: !!n,
|
|
1407
|
+
disabled: !!i
|
|
1408
|
+
}),
|
|
1409
|
+
// Custom checkmark styling using ::after - centered positioning
|
|
1410
|
+
'after:content-[""] after:absolute after:left-1/2 after:top-[45%] after:-translate-x-1/2 after:-translate-y-1/2 after:border-b-2 after:border-r-2 after:border-white after:rotate-45 after:opacity-0 after:transition-opacity after:duration-200',
|
|
1411
|
+
// Checkmark dimensions scaled up for h-6 w-6 size
|
|
1412
|
+
"after:w-[6px] after:h-[12px]",
|
|
1413
|
+
n && "after:opacity-100"
|
|
1414
|
+
),
|
|
1415
|
+
"aria-hidden": "true"
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
/* @__PURE__ */ e.jsx("span", { className: "flex-1 min-w-0 text-base text-foreground", children: f })
|
|
1419
|
+
]
|
|
1420
|
+
}
|
|
1421
|
+
);
|
|
1422
|
+
}
|
|
1423
|
+
);
|
|
1424
|
+
He.displayName = "SelectableMultipleInput";
|
|
1425
|
+
const Je = C(
|
|
1426
|
+
"relative inline-flex items-center h-5 w-10 rounded-full transition-colors duration-200 border border-transparent",
|
|
1427
|
+
{
|
|
1428
|
+
variants: {
|
|
1429
|
+
disabled: {
|
|
1430
|
+
true: "opacity-50 cursor-not-allowed",
|
|
1431
|
+
false: ""
|
|
1432
|
+
},
|
|
1433
|
+
checked: {
|
|
1434
|
+
true: "bg-primary",
|
|
1435
|
+
false: "bg-white border-border"
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
defaultVariants: {
|
|
1439
|
+
disabled: !1,
|
|
1440
|
+
checked: !1
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
), Qe = C(
|
|
1444
|
+
"absolute h-4 w-4 rounded-full transition-transform duration-200",
|
|
1445
|
+
{
|
|
1446
|
+
variants: {
|
|
1447
|
+
checked: {
|
|
1448
|
+
true: "translate-x-full bg-white left-1.5",
|
|
1449
|
+
false: "bg-neutral left-0.5"
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
defaultVariants: {
|
|
1453
|
+
checked: !1
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
), Ue = ({ disabled: t = !1, checked: r = !1, className: n }) => /* @__PURE__ */ e.jsx(
|
|
1457
|
+
"span",
|
|
1458
|
+
{
|
|
1459
|
+
className: x(
|
|
1460
|
+
Je({ disabled: t, checked: r }),
|
|
1461
|
+
"pointer-events-none",
|
|
1462
|
+
n
|
|
1463
|
+
),
|
|
1464
|
+
"aria-hidden": "true"
|
|
1465
|
+
}
|
|
1466
|
+
), Xe = ({ checked: t = !1 }) => /* @__PURE__ */ e.jsx("span", { className: x(Qe({ checked: t })), "aria-hidden": "true" }), Ye = ({ label: t, htmlFor: r, disabled: n = !1, required: o = !1 }) => t ? /* @__PURE__ */ e.jsxs(
|
|
1467
|
+
"label",
|
|
1468
|
+
{
|
|
1469
|
+
htmlFor: r,
|
|
1470
|
+
className: x(
|
|
1471
|
+
"text-sm select-none font-medium text-foreground",
|
|
1472
|
+
n && "opacity-50 cursor-not-allowed"
|
|
1473
|
+
),
|
|
1474
|
+
children: [
|
|
1475
|
+
t,
|
|
1476
|
+
o && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
1477
|
+
]
|
|
1478
|
+
}
|
|
1479
|
+
) : null, Ze = m.forwardRef(
|
|
1480
|
+
({
|
|
1481
|
+
value: t,
|
|
1482
|
+
onChange: r,
|
|
1483
|
+
label: n,
|
|
1484
|
+
disabled: o = !1,
|
|
1485
|
+
required: s = !1,
|
|
1486
|
+
className: i,
|
|
1487
|
+
id: d,
|
|
1488
|
+
ariaLabel: l,
|
|
1489
|
+
...c
|
|
1490
|
+
}, a) => {
|
|
1491
|
+
const u = m.useId(), p = d || u, f = t ?? !1, h = (b) => {
|
|
1492
|
+
r?.(b.target.checked);
|
|
1493
|
+
};
|
|
1494
|
+
return /* @__PURE__ */ e.jsxs("div", { className: x("inline-flex items-center gap-2", i), children: [
|
|
1495
|
+
/* @__PURE__ */ e.jsxs("span", { className: "relative inline-flex items-center", children: [
|
|
1496
|
+
/* @__PURE__ */ e.jsx(
|
|
1497
|
+
"input",
|
|
1498
|
+
{
|
|
1499
|
+
ref: a,
|
|
1500
|
+
type: "checkbox",
|
|
1501
|
+
role: "switch",
|
|
1502
|
+
id: p,
|
|
1503
|
+
"aria-label": l || n,
|
|
1504
|
+
"aria-checked": f,
|
|
1505
|
+
checked: f,
|
|
1506
|
+
disabled: o,
|
|
1507
|
+
required: s,
|
|
1508
|
+
onChange: h,
|
|
1509
|
+
className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer z-10 disabled:cursor-not-allowed",
|
|
1510
|
+
...c
|
|
1511
|
+
}
|
|
1512
|
+
),
|
|
1513
|
+
/* @__PURE__ */ e.jsx(Ue, { disabled: o, checked: f }),
|
|
1514
|
+
/* @__PURE__ */ e.jsx(Xe, { checked: f })
|
|
1515
|
+
] }),
|
|
1516
|
+
/* @__PURE__ */ e.jsx(
|
|
1517
|
+
Ye,
|
|
1518
|
+
{
|
|
1519
|
+
label: n,
|
|
1520
|
+
htmlFor: p,
|
|
1521
|
+
disabled: o,
|
|
1522
|
+
required: s
|
|
1523
|
+
}
|
|
1524
|
+
)
|
|
1525
|
+
] });
|
|
1526
|
+
}
|
|
1527
|
+
);
|
|
1528
|
+
Ze.displayName = "SwitchInput";
|
|
1529
|
+
const et = C(
|
|
1530
|
+
"block w-full rounded-md border bg-white text-foreground transition-colors focus:outline-none overflow-y-auto whitespace-pre-wrap break-words",
|
|
1531
|
+
{
|
|
1532
|
+
variants: {
|
|
1533
|
+
state: {
|
|
1534
|
+
default: "border-primary/30 focus:ring-2 focus:ring-primary/20 focus:border-primary",
|
|
1535
|
+
error: "border-danger bg-danger/5 focus:ring-2 focus:border-danger focus:ring-danger/20",
|
|
1536
|
+
disabled: "opacity-50 pointer-events-none bg-gray-50 border-gray-300 cursor-not-allowed",
|
|
1537
|
+
readOnly: "bg-gray-50 cursor-default focus:ring-0 border-gray-300 focus:border-gray-300"
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
defaultVariants: {
|
|
1541
|
+
state: "default"
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
), tt = (t, r, n) => t ? "disabled" : r ? "readOnly" : n ? "error" : "default", rt = (t, r, n) => {
|
|
1545
|
+
if (r || n) {
|
|
1546
|
+
t.preventDefault();
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
t.preventDefault();
|
|
1550
|
+
const o = t.clipboardData.getData("text/plain"), s = window.getSelection();
|
|
1551
|
+
if (!s || !s.rangeCount) return;
|
|
1552
|
+
s.deleteFromDocument();
|
|
1553
|
+
const i = s.getRangeAt(0), d = document.createTextNode(o);
|
|
1554
|
+
i.insertNode(d), i.setStartAfter(d), i.setEndAfter(d), s.removeAllRanges(), s.addRange(i);
|
|
1555
|
+
const l = new Event("input", { bubbles: !0 });
|
|
1556
|
+
t.currentTarget.dispatchEvent(l);
|
|
1557
|
+
}, nt = m.forwardRef(
|
|
1558
|
+
({
|
|
1559
|
+
label: t,
|
|
1560
|
+
helperText: r,
|
|
1561
|
+
error: n,
|
|
1562
|
+
className: o,
|
|
1563
|
+
disabled: s,
|
|
1564
|
+
readOnly: i,
|
|
1565
|
+
id: d,
|
|
1566
|
+
value: l,
|
|
1567
|
+
defaultValue: c,
|
|
1568
|
+
onChange: a,
|
|
1569
|
+
placeholder: u,
|
|
1570
|
+
name: p,
|
|
1571
|
+
row: f = 3,
|
|
1572
|
+
required: h,
|
|
1573
|
+
onBlur: b,
|
|
1574
|
+
onFocus: w,
|
|
1575
|
+
onKeyDown: g,
|
|
1576
|
+
...k
|
|
1577
|
+
}, j) => {
|
|
1578
|
+
const N = m.useId(), V = d || N, R = !!n, S = m.useRef(null), [E, z] = m.useState(c || ""), v = l !== void 0, y = v ? l : E;
|
|
1579
|
+
m.useImperativeHandle(j, () => S.current), m.useEffect(() => {
|
|
1580
|
+
S.current && S.current.textContent !== y && (S.current.textContent = y);
|
|
1581
|
+
}, [y]);
|
|
1582
|
+
const I = tt(s, i, R), D = !y && u, te = (P) => {
|
|
1583
|
+
const L = P.currentTarget.textContent || "";
|
|
1584
|
+
v || z(L), a?.(L);
|
|
1585
|
+
}, re = (P) => {
|
|
1586
|
+
if (s || i) {
|
|
1587
|
+
P.preventDefault();
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
g?.(P);
|
|
1591
|
+
}, ne = () => {
|
|
1592
|
+
S.current?.focus();
|
|
1593
|
+
};
|
|
1594
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1595
|
+
t && /* @__PURE__ */ e.jsxs(
|
|
1596
|
+
"label",
|
|
1597
|
+
{
|
|
1598
|
+
htmlFor: V,
|
|
1599
|
+
className: "block text-sm font-medium text-foreground mb-2 cursor-pointer",
|
|
1600
|
+
onClick: ne,
|
|
1601
|
+
children: [
|
|
1602
|
+
t,
|
|
1603
|
+
h && /* @__PURE__ */ e.jsx("span", { className: "text-danger ml-1", "aria-label": "required", children: "*" })
|
|
1604
|
+
]
|
|
1605
|
+
}
|
|
1606
|
+
),
|
|
1607
|
+
/* @__PURE__ */ e.jsx("div", { className: x("relative w-full", o), children: /* @__PURE__ */ e.jsx(
|
|
1608
|
+
"div",
|
|
1609
|
+
{
|
|
1610
|
+
ref: S,
|
|
1611
|
+
id: V,
|
|
1612
|
+
role: "textbox",
|
|
1613
|
+
"aria-multiline": "true",
|
|
1614
|
+
"aria-invalid": R,
|
|
1615
|
+
"aria-disabled": s,
|
|
1616
|
+
"aria-readonly": i,
|
|
1617
|
+
"aria-required": h,
|
|
1618
|
+
"aria-label": typeof t == "string" ? t : void 0,
|
|
1619
|
+
contentEditable: !s && !i,
|
|
1620
|
+
"data-name": p,
|
|
1621
|
+
onInput: te,
|
|
1622
|
+
onKeyDown: re,
|
|
1623
|
+
onPaste: (P) => rt(P, s, i),
|
|
1624
|
+
onBlur: b,
|
|
1625
|
+
onFocus: w,
|
|
1626
|
+
suppressContentEditableWarning: !0,
|
|
1627
|
+
style: { minHeight: `${f * 1.5 + 1}rem` },
|
|
1628
|
+
className: x(
|
|
1629
|
+
et({ state: I }),
|
|
1630
|
+
"px-3 py-2",
|
|
1631
|
+
D && "empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400"
|
|
1632
|
+
),
|
|
1633
|
+
"data-placeholder": u,
|
|
1634
|
+
...k
|
|
1635
|
+
}
|
|
1636
|
+
) }),
|
|
1637
|
+
R && /* @__PURE__ */ e.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: n }),
|
|
1638
|
+
!R && r && /* @__PURE__ */ e.jsx("div", { className: "mt-1 text-sm text-gray-600", children: r })
|
|
1639
|
+
] });
|
|
1640
|
+
}
|
|
1641
|
+
);
|
|
1642
|
+
nt.displayName = "TextAreaInput";
|
|
1643
|
+
const xt = O(function(r, n) {
|
|
1644
|
+
const o = (s) => {
|
|
1645
|
+
r?.onChange?.(s.target.value);
|
|
1646
|
+
};
|
|
1647
|
+
return /* @__PURE__ */ e.jsx(
|
|
1648
|
+
M,
|
|
1649
|
+
{
|
|
1650
|
+
type: "time",
|
|
1651
|
+
tabIndex: 0,
|
|
1652
|
+
"aria-hidden": "true",
|
|
1653
|
+
leftContent: /* @__PURE__ */ e.jsx($, { as: ue, color: "inherit", size: "sm" }),
|
|
1654
|
+
ref: n,
|
|
1655
|
+
...r,
|
|
1656
|
+
onChange: o
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1659
|
+
});
|
|
1660
|
+
export {
|
|
1661
|
+
lt as C,
|
|
1662
|
+
ft as D,
|
|
1663
|
+
pt as E,
|
|
1664
|
+
De as P,
|
|
1665
|
+
ht as R,
|
|
1666
|
+
bt as S,
|
|
1667
|
+
M as T,
|
|
1668
|
+
dt as a,
|
|
1669
|
+
ut as b,
|
|
1670
|
+
mt as c,
|
|
1671
|
+
gt as d,
|
|
1672
|
+
Ge as e,
|
|
1673
|
+
He as f,
|
|
1674
|
+
Ze as g,
|
|
1675
|
+
J as h,
|
|
1676
|
+
nt as i,
|
|
1677
|
+
xt as j
|
|
1678
|
+
};
|