@dimasbaguspm/versaur 0.0.17 → 0.0.18

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.
Files changed (48) hide show
  1. package/dist/{js → assets}/styles.css +37 -0
  2. package/dist/js/{bottom-sheet-CHRSxXRE.js → bottom-sheet-BRv-oJL-.js} +285 -140
  3. package/dist/js/{tile-B9bt2AY6.js → description-list-DZQF212Z.js} +639 -629
  4. package/dist/js/email-input-BIbrfs5q.js +1731 -0
  5. package/dist/js/feedbacks/index.js +1 -1
  6. package/dist/js/{form-layout-Dhlv-FZL.js → form-layout-4ASWdXn8.js} +1 -1
  7. package/dist/js/forms/index.js +14 -17
  8. package/dist/js/{index-C1uJQB34.js → index-DOdDlCoL.js} +2 -2
  9. package/dist/js/index.js +46 -45
  10. package/dist/js/layouts/index.js +1 -1
  11. package/dist/js/navigation/index.js +1 -1
  12. package/dist/js/overlays/index.js +4 -5
  13. package/dist/js/primitive/index.js +14 -12
  14. package/dist/js/providers/index.js +5 -0
  15. package/dist/js/{skeleton-QEyPZAuF.js → skeleton-BNZyaRjo.js} +1 -1
  16. package/dist/js/snackbar-DH8jCh2V.js +50 -0
  17. package/dist/js/{tabs-DYcTvVao.js → tabs-BbOkYchB.js} +1 -1
  18. package/dist/js/use-snackbars-oPoF7J5t.js +94 -0
  19. package/dist/types/feedbacks/loading-indicator/index.d.ts +2 -1
  20. package/dist/types/forms/chip-single-input/index.d.ts +2 -1
  21. package/dist/types/forms/index.d.ts +0 -1
  22. package/dist/types/forms/price-input/index.d.ts +1 -1
  23. package/dist/types/forms/switch-input/index.d.ts +2 -3
  24. package/dist/types/forms/time-picker-input/time-picker-input.d.ts +4 -4
  25. package/dist/types/forms/time-picker-input/types.d.ts +2 -38
  26. package/dist/types/index.d.ts +1 -0
  27. package/dist/types/layouts/page-layout/index.d.ts +2 -1
  28. package/dist/types/overlays/menu/index.d.ts +2 -2
  29. package/dist/types/primitive/description-list/description-list.atoms.d.ts +13 -0
  30. package/dist/types/primitive/description-list/description-list.d.ts +6 -0
  31. package/dist/types/primitive/description-list/index.d.ts +2 -0
  32. package/dist/types/primitive/description-list/types.d.ts +46 -0
  33. package/dist/types/primitive/index.d.ts +1 -0
  34. package/dist/types/providers/index.d.ts +1 -0
  35. package/dist/types/providers/snackbars-provider/index.d.ts +3 -0
  36. package/dist/types/providers/snackbars-provider/provider.d.ts +7 -0
  37. package/dist/types/providers/snackbars-provider/types.d.ts +28 -0
  38. package/dist/types/providers/snackbars-provider/use-snackbars-queue.d.ts +9 -0
  39. package/dist/types/providers/snackbars-provider/use-snackbars.d.ts +4 -0
  40. package/dist/{js → utils}/enforce-subpath-import.js +61 -54
  41. package/package.json +8 -4
  42. package/dist/js/email-input-CVyrFzqL.js +0 -1820
  43. package/dist/js/modal-FqewbVts.js +0 -150
  44. package/dist/types/forms/calculator-input/calculator-input.atoms.d.ts +0 -11
  45. package/dist/types/forms/calculator-input/calculator-input.d.ts +0 -8
  46. package/dist/types/forms/calculator-input/index.d.ts +0 -1
  47. package/dist/types/forms/calculator-input/types.d.ts +0 -51
  48. package/dist/types/forms/time-picker-input/time-picker-input.atoms.d.ts +0 -15
@@ -1,1820 +0,0 @@
1
- import { a as cva, j as jsxRuntimeExports, c as cn } from "./index-C1uJQB34.js";
2
- import React__default, { useState, useRef, createContext, useContext, forwardRef, useId, useEffect } from "react";
3
- import { I as Icon, C as Calculator, d as Button, h as Text } from "./tile-B9bt2AY6.js";
4
- import { M as Modal } from "./modal-FqewbVts.js";
5
- import { CalculatorIcon, Check, Calendar, SearchIcon, Clock, Banknote, MailIcon } from "lucide-react";
6
- const textInputVariants = cva(
7
- "block w-full rounded-md border bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none disabled:bg-gray-50",
8
- {
9
- variants: {
10
- variant: {
11
- // Core variants using Versaur color system
12
- primary: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
13
- secondary: "border-secondary/30 text-foreground focus:border-secondary focus:ring-secondary/20",
14
- tertiary: "border-tertiary/30 text-foreground focus:border-tertiary focus:ring-tertiary/20",
15
- ghost: "border-ghost/30 text-foreground focus:border-ghost focus:ring-ghost/20",
16
- neutral: "border-gray-300 text-foreground focus:border-gray-400 focus:ring-gray-400/20",
17
- // Outline variants
18
- "primary-outline": "border-primary text-foreground focus:border-primary focus:ring-primary/20",
19
- "secondary-outline": "border-secondary text-foreground focus:border-secondary focus:ring-secondary/20",
20
- "tertiary-outline": "border-tertiary text-foreground focus:border-tertiary focus:ring-tertiary/20",
21
- "ghost-outline": "border-ghost text-foreground focus:border-ghost focus:ring-ghost/20",
22
- "neutral-outline": "border-gray-400 text-foreground focus:border-gray-500 focus:ring-gray-500/20",
23
- // Semantic variants
24
- success: "border-success/30 text-foreground focus:border-success focus:ring-success/20",
25
- "success-outline": "border-success text-foreground focus:border-success focus:ring-success/20",
26
- info: "border-info/30 text-foreground focus:border-info focus:ring-info/20",
27
- "info-outline": "border-info text-foreground focus:border-info focus:ring-info/20",
28
- warning: "border-warning/30 text-foreground focus:border-warning focus:ring-warning/20",
29
- "warning-outline": "border-warning text-foreground focus:border-warning focus:ring-warning/20",
30
- danger: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
31
- "danger-outline": "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20"
32
- }
33
- },
34
- defaultVariants: {
35
- variant: "primary"
36
- }
37
- }
38
- ), TextInput = React__default.forwardRef(
39
- ({
40
- variant: e = "primary",
41
- label: t,
42
- leftContent: i,
43
- rightContent: s,
44
- helperText: n,
45
- error: l,
46
- className: u,
47
- disabled: o,
48
- id: r,
49
- ...d
50
- }, x) => {
51
- const c = React__default.useId(), a = r || c, g = !!l;
52
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
53
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
54
- "label",
55
- {
56
- htmlFor: a,
57
- className: "block text-sm font-medium text-foreground mb-2",
58
- children: t
59
- }
60
- ),
61
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("relative w-full", u), children: [
62
- i && /* @__PURE__ */ jsxRuntimeExports.jsx(
63
- "span",
64
- {
65
- className: "absolute left-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5",
66
- "data-testid": "left-content",
67
- children: i
68
- }
69
- ),
70
- /* @__PURE__ */ jsxRuntimeExports.jsx(
71
- "input",
72
- {
73
- ref: x,
74
- id: a,
75
- "aria-invalid": g,
76
- "aria-disabled": o,
77
- disabled: o,
78
- className: cn(
79
- textInputVariants({
80
- variant: g ? "danger" : e
81
- }),
82
- i ? "pl-9" : "pl-3",
83
- s ? "pr-9" : "pr-3",
84
- "h-10"
85
- ),
86
- ...d
87
- }
88
- ),
89
- s && /* @__PURE__ */ jsxRuntimeExports.jsx(
90
- "span",
91
- {
92
- className: "absolute right-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5",
93
- "data-testid": "right-content",
94
- children: s
95
- }
96
- )
97
- ] }),
98
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: l }),
99
- !g && n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-gray-600", children: n })
100
- ] });
101
- }
102
- );
103
- TextInput.displayName = "TextInput";
104
- const DEFAULT_HEADER = "Enter Amount", CalculatorInput = ({
105
- value,
106
- onChange,
107
- placeholder,
108
- disabled,
109
- modalProps,
110
- headerLabel,
111
- label,
112
- helperText,
113
- error,
114
- ...rest
115
- }) => {
116
- const [open, setOpen] = useState(!1), inputRef = useRef(null), [calculatorValue, setCalculatorValue] = useState(
117
- value === "" ? "" : String(value)
118
- ), [lastValidValue, setLastValidValue] = useState(value ?? ""), handleCalculatorChange = (v) => {
119
- setCalculatorValue(v);
120
- let result = null;
121
- try {
122
- if (/^[\d+\-*/.\s]+$/.test(v)) {
123
- const evalResult = eval(v);
124
- typeof evalResult == "number" && !isNaN(evalResult) && (result = evalResult);
125
- }
126
- } catch {
127
- }
128
- result !== null && setLastValidValue(result);
129
- }, handleOpen = () => {
130
- setCalculatorValue(value === "" ? "" : String(value)), setOpen(!0);
131
- }, handleOk = () => {
132
- const trimmed = calculatorValue.trim();
133
- let result = null;
134
- try {
135
- if (/^[\d+\-*/.\s]+$/.test(trimmed)) {
136
- const evalResult = eval(trimmed);
137
- typeof evalResult == "number" && !isNaN(evalResult) && (result = evalResult);
138
- }
139
- } catch {
140
- }
141
- result !== null ? (onChange(result), setLastValidValue(result)) : onChange(lastValidValue), setOpen(!1);
142
- }, handleClear = () => {
143
- setCalculatorValue(""), setLastValidValue(""), onChange("");
144
- };
145
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
146
- /* @__PURE__ */ jsxRuntimeExports.jsx(
147
- TextInput,
148
- {
149
- ref: inputRef,
150
- type: "text",
151
- label,
152
- value: value === "" ? "" : value,
153
- onClick: disabled ? void 0 : handleOpen,
154
- readOnly: !0,
155
- disabled,
156
- error,
157
- helperText,
158
- rightContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: CalculatorIcon, size: "sm", color: "ghost" }),
159
- placeholder,
160
- "aria-label": rest["aria-label"],
161
- "aria-labelledby": rest["aria-labelledby"],
162
- "aria-describedby": rest["aria-describedby"],
163
- className: "cursor-pointer bg-white"
164
- }
165
- ),
166
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
167
- Modal,
168
- {
169
- isOpen: open,
170
- onOpenChange: setOpen,
171
- disableOverlayClose: !!disabled,
172
- disableEscClose: !!disabled,
173
- size: "sm",
174
- "aria-label": rest["aria-label"],
175
- "aria-labelledby": rest["aria-labelledby"],
176
- "aria-describedby": rest["aria-describedby"],
177
- ...modalProps,
178
- children: [
179
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Header, { children: headerLabel ?? DEFAULT_HEADER }),
180
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Body, { className: "flex flex-col items-center justify-center pb-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
181
- Calculator,
182
- {
183
- initialValue: typeof value == "number" ? value : "",
184
- onChange: handleCalculatorChange,
185
- disabled
186
- }
187
- ) }),
188
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal.Footer, { className: "pb-4 pt-0", children: [
189
- /* @__PURE__ */ jsxRuntimeExports.jsx(
190
- Button,
191
- {
192
- variant: "neutral-ghost",
193
- onClick: handleClear,
194
- disabled,
195
- children: "Clear"
196
- }
197
- ),
198
- /* @__PURE__ */ jsxRuntimeExports.jsx(
199
- Button,
200
- {
201
- variant: "primary-ghost",
202
- onClick: handleOk,
203
- disabled,
204
- children: "OK"
205
- }
206
- )
207
- ] })
208
- ]
209
- }
210
- )
211
- ] });
212
- }, checkboxGroupVariants = cva("space-y-2", {
213
- variants: {
214
- direction: {
215
- vertical: "space-y-2 space-x-0",
216
- horizontal: "flex flex-wrap gap-4 space-y-0"
217
- }
218
- },
219
- defaultVariants: {
220
- direction: "vertical"
221
- }
222
- }), checkboxVariants = cva(
223
- "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",
224
- {
225
- variants: {
226
- variant: {
227
- // Core variants using Versaur color system
228
- primary: "border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20",
229
- secondary: "border-secondary/40 checked:bg-secondary checked:border-secondary focus:ring-secondary/20",
230
- tertiary: "border-tertiary/40 checked:bg-tertiary checked:border-tertiary focus:ring-tertiary/20",
231
- ghost: "border-ghost/40 checked:bg-ghost checked:border-ghost focus:ring-ghost/20",
232
- neutral: "border-gray-300 checked:bg-gray-500 checked:border-gray-500 focus:ring-gray-400/20",
233
- // Outline variants
234
- "primary-outline": "border-primary checked:bg-white checked:border-primary focus:ring-primary/20",
235
- "secondary-outline": "border-secondary checked:bg-white checked:border-secondary focus:ring-secondary/20",
236
- "tertiary-outline": "border-tertiary checked:bg-white checked:border-tertiary focus:ring-tertiary/20",
237
- "ghost-outline": "border-ghost checked:bg-white checked:border-ghost focus:ring-ghost/20",
238
- "neutral-outline": "border-gray-400 checked:bg-white checked:border-gray-400 focus:ring-gray-500/20",
239
- // Semantic variants
240
- success: "border-success/40 checked:bg-success checked:border-success focus:ring-success/20",
241
- "success-outline": "border-success checked:bg-white checked:border-success focus:ring-success/20",
242
- info: "border-info/40 checked:bg-info checked:border-info focus:ring-info/20",
243
- "info-outline": "border-info checked:bg-white checked:border-info focus:ring-info/20",
244
- warning: "border-warning/40 checked:bg-warning checked:border-warning focus:ring-warning/20",
245
- "warning-outline": "border-warning checked:bg-white checked:border-warning focus:ring-warning/20",
246
- danger: "border-danger/40 checked:bg-danger checked:border-danger focus:ring-danger/20",
247
- "danger-outline": "border-danger checked:bg-white checked:border-danger focus:ring-danger/20"
248
- },
249
- size: {
250
- sm: "h-3 w-3",
251
- md: "h-4 w-4",
252
- lg: "h-5 w-5"
253
- }
254
- },
255
- defaultVariants: {
256
- variant: "primary",
257
- size: "md"
258
- }
259
- }
260
- ), checkboxLabelVariants = cva(
261
- "text-foreground cursor-pointer select-none",
262
- {
263
- variants: {
264
- size: {
265
- sm: "text-xs",
266
- md: "text-sm",
267
- lg: "text-base"
268
- },
269
- disabled: {
270
- true: "opacity-50 cursor-not-allowed",
271
- false: ""
272
- }
273
- },
274
- defaultVariants: {
275
- size: "md",
276
- disabled: !1
277
- }
278
- }
279
- ), CheckboxContext = createContext(null), useCheckboxContext = () => {
280
- const e = useContext(CheckboxContext);
281
- if (!e)
282
- throw new Error("CheckboxOption must be used within CheckboxInput");
283
- return e;
284
- }, CheckboxOption = React__default.forwardRef(({ children: e, description: t, className: i, disabled: s, id: n, ...l }, u) => {
285
- const o = useCheckboxContext(), r = React__default.useId(), d = n || r, x = s || o.disabled, c = o.error ? "danger" : o.variant || "primary";
286
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
287
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
288
- "input",
289
- {
290
- ref: u,
291
- type: "checkbox",
292
- id: d,
293
- disabled: x,
294
- className: cn(
295
- checkboxVariants({
296
- variant: c,
297
- size: o.size
298
- }),
299
- // Custom checkmark styling using ::after - centered positioning with size variants
300
- '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',
301
- // Size-specific checkmark dimensions
302
- o.size === "sm" && "after:w-[3px] after:h-[6px]",
303
- o.size === "md" && "after:w-[4px] after:h-[8px]",
304
- o.size === "lg" && "after:w-[6px] after:h-[10px]",
305
- "checked:after:opacity-100",
306
- // Outline variants use colored checkmark
307
- c?.includes("outline") && "checked:after:border-current",
308
- i
309
- ),
310
- ...l
311
- }
312
- ) }),
313
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
314
- /* @__PURE__ */ jsxRuntimeExports.jsx(
315
- "label",
316
- {
317
- htmlFor: d,
318
- className: checkboxLabelVariants({
319
- size: o.size,
320
- disabled: x
321
- }),
322
- children: e
323
- }
324
- ),
325
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
326
- "div",
327
- {
328
- className: cn(
329
- "text-gray-600 mt-1",
330
- o.size === "sm" && "text-xs",
331
- o.size === "md" && "text-xs",
332
- o.size === "lg" && "text-sm",
333
- x && "opacity-50"
334
- ),
335
- children: t
336
- }
337
- )
338
- ] })
339
- ] });
340
- });
341
- CheckboxOption.displayName = "CheckboxOption";
342
- const CheckboxInputRoot = React__default.forwardRef(
343
- ({
344
- variant: e = "primary",
345
- size: t = "md",
346
- label: i,
347
- helperText: s,
348
- error: n,
349
- direction: l = "vertical",
350
- className: u,
351
- disabled: o,
352
- children: r,
353
- ...d
354
- }, x) => {
355
- const c = !!n, a = {
356
- variant: e,
357
- size: t,
358
- disabled: o,
359
- error: c
360
- };
361
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxContext.Provider, { value: a, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: x, className: cn("w-full", u), ...d, children: [
362
- i && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: i }),
363
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: checkboxGroupVariants({ direction: l }), children: r }),
364
- c && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: n }),
365
- !c && s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: s })
366
- ] }) });
367
- }
368
- );
369
- CheckboxInputRoot.displayName = "CheckboxInput";
370
- const CheckboxInput = Object.assign(CheckboxInputRoot, {
371
- Option: CheckboxOption
372
- }), ChipMultipleInputContext = createContext(null), useChipMultipleInputContext = () => {
373
- const e = useContext(ChipMultipleInputContext);
374
- if (!e)
375
- throw new Error(
376
- "useChipMultipleInputContext must be used within ChipMultipleInputContext"
377
- );
378
- return e;
379
- }, chipOptionVariants = cva(
380
- "inline-flex items-center bg-white font-regular transition-colors duration-200 cursor-pointer border border-border",
381
- {
382
- variants: {
383
- variant: {
384
- primary: [
385
- "hover:bg-primary-soft",
386
- "hover:border-primary-light",
387
- "focus:border-primary-light",
388
- "data-[selected=true]:bg-primary-soft",
389
- "data-[selected=true]:border-primary"
390
- ].join(" "),
391
- secondary: [
392
- "hover:bg-secondary-soft",
393
- "hover:border-secondary-light",
394
- "focus:border-secondary-light",
395
- "data-[selected=true]:bg-secondary-soft",
396
- "data-[selected=true]:border-secondary"
397
- ].join(" "),
398
- tertiary: [
399
- "hover:bg-tertiary-soft",
400
- "hover:border-tertiary-light",
401
- "focus:border-tertiary-light",
402
- "data-[selected=true]:bg-tertiary-soft",
403
- "data-[selected=true]:border-tertiary"
404
- ].join(" "),
405
- ghost: [
406
- "hover:bg-ghost-soft",
407
- "hover:border-ghost-light",
408
- "focus:border-ghost-light",
409
- "data-[selected=true]:bg-ghost-soft",
410
- "data-[selected=true]:border-ghost"
411
- ].join(" "),
412
- neutral: [
413
- "hover:bg-gray-soft",
414
- "hover:border-gray-light",
415
- "focus:border-gray-light",
416
- "data-[selected=true]:bg-gray-soft",
417
- "data-[selected=true]:border-gray"
418
- ].join(" "),
419
- success: [
420
- "hover:bg-success-soft",
421
- "hover:border-success-light",
422
- "focus:border-success-light",
423
- "data-[selected=true]:bg-success-soft",
424
- "data-[selected=true]:border-success"
425
- ].join(" "),
426
- info: [
427
- "hover:bg-info-soft",
428
- "hover:border-info-light",
429
- "focus:border-info-light",
430
- "data-[selected=true]:bg-info-soft",
431
- "data-[selected=true]:border-info"
432
- ].join(" "),
433
- warning: [
434
- "hover:bg-warning-soft",
435
- "hover:border-warning-light",
436
- "focus:border-warning-light",
437
- "data-[selected=true]:bg-warning-soft",
438
- "data-[selected=true]:border-warning"
439
- ].join(" "),
440
- danger: [
441
- "hover:bg-danger-soft",
442
- "hover:border-danger-light",
443
- "focus:border-danger-light",
444
- "data-[selected=true]:bg-danger-soft",
445
- "data-[selected=true]:border-danger"
446
- ].join(" ")
447
- },
448
- selected: {
449
- true: "",
450
- false: ""
451
- },
452
- shape: {
453
- circle: "rounded-full",
454
- rounded: "rounded-lg"
455
- },
456
- size: {
457
- sm: "px-3 py-1 text-xs min-h-[32px]",
458
- md: "px-4 py-2 text-sm min-h-[40px]",
459
- lg: "px-5 py-2.5 text-base min-h-[48px]"
460
- }
461
- }
462
- }
463
- ), ChipMultipleOption = React__default.forwardRef(
464
- ({
465
- children: e,
466
- className: t,
467
- disabled: i,
468
- id: s,
469
- value: n,
470
- check: l,
471
- defaultCheck: u = !1,
472
- ...o
473
- }, r) => {
474
- const d = useChipMultipleInputContext(), x = React__default.useId(), c = s || x, a = i || d.disabled, g = d.error ? "danger" : d.variant || "primary", h = d.shape || "circle", b = d.size || "sm", f = d.value?.includes(n) ?? !1, y = (w) => {
475
- if (!a) {
476
- const R = d.value || [];
477
- let C;
478
- f ? C = R.filter((k) => k !== n) : C = [...R, n], d.onChange?.(C);
479
- }
480
- o.onChange?.(w);
481
- }, m = b === "lg" ? 20 : b === "md" ? 18 : 16;
482
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
483
- /* @__PURE__ */ jsxRuntimeExports.jsx(
484
- "input",
485
- {
486
- ref: r,
487
- type: "checkbox",
488
- id: c,
489
- name: `${d.name}[]`,
490
- value: n,
491
- checked: f,
492
- disabled: a,
493
- onChange: y,
494
- className: "sr-only",
495
- ...o
496
- }
497
- ),
498
- /* @__PURE__ */ jsxRuntimeExports.jsx(
499
- "label",
500
- {
501
- htmlFor: c,
502
- "data-selected": f,
503
- className: cn(
504
- chipOptionVariants({
505
- variant: g,
506
- selected: f,
507
- shape: h,
508
- size: b
509
- }),
510
- a && "opacity-50 cursor-not-allowed pointer-events-none",
511
- t
512
- ),
513
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center", children: [
514
- (l || u) && /* @__PURE__ */ jsxRuntimeExports.jsx(
515
- "span",
516
- {
517
- className: cn(
518
- "flex items-center",
519
- "transition-transform transition-opacity duration-200",
520
- f ? "opacity-100 scale-100 mr-1" : "opacity-0 scale-75"
521
- ),
522
- "aria-hidden": "true",
523
- children: f && (l || /* @__PURE__ */ jsxRuntimeExports.jsx(
524
- Check,
525
- {
526
- size: m,
527
- className: g === "primary" ? "text-primary" : g === "secondary" ? "text-secondary" : g === "tertiary" ? "text-tertiary" : g === "ghost" ? "text-ghost" : g === "success" ? "text-success" : g === "info" ? "text-info" : g === "warning" ? "text-warning" : g === "danger" ? "text-danger" : "text-primary"
528
- }
529
- ))
530
- }
531
- ),
532
- e
533
- ] })
534
- }
535
- )
536
- ] });
537
- }
538
- );
539
- ChipMultipleOption.displayName = "ChipMultipleOption";
540
- const ChipMultipleInputRoot = React__default.forwardRef(
541
- ({
542
- variant: e = "primary",
543
- shape: t = "circle",
544
- size: i = "sm",
545
- label: s,
546
- helperText: n,
547
- error: l,
548
- className: u,
549
- disabled: o,
550
- name: r,
551
- value: d = [],
552
- onChange: x,
553
- children: c,
554
- ...a
555
- }, g) => {
556
- const h = !!l, b = {
557
- variant: e,
558
- shape: t,
559
- size: i,
560
- disabled: o,
561
- error: h,
562
- name: r,
563
- value: d,
564
- onChange: x
565
- };
566
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ChipMultipleInputContext.Provider, { value: b, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: g, className: cn("w-full", u), ...a, children: [
567
- s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: s }),
568
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: c }),
569
- h && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: l }),
570
- !h && n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: n })
571
- ] }) });
572
- }
573
- ), ChipMultipleInput = Object.assign(ChipMultipleInputRoot, {
574
- Option: ChipMultipleOption
575
- });
576
- function defaultDateFormatter(e) {
577
- if (!e) return "";
578
- const t = new Date(e);
579
- return isNaN(t.getTime()) ? e : t.toLocaleDateString(void 0, {
580
- year: "numeric",
581
- month: "short",
582
- day: "numeric"
583
- });
584
- }
585
- const DateSinglePickerInput = React__default.forwardRef(function e({ value: t = "", onChange: i, label: s, formatter: n, ...l }, u) {
586
- const o = useRef(null), r = (a) => {
587
- o.current = a, typeof u == "function" ? u(a) : u && typeof u == "object" && (u.current = a);
588
- }, d = () => {
589
- o.current && (typeof o.current.showPicker == "function" ? o.current.showPicker() : o.current.focus());
590
- }, x = (a) => {
591
- i(a.target.value);
592
- }, c = (n ?? defaultDateFormatter)(t);
593
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
594
- /* @__PURE__ */ jsxRuntimeExports.jsx(
595
- TextInput,
596
- {
597
- type: "text",
598
- value: c,
599
- label: s,
600
- readOnly: !0,
601
- tabIndex: 0,
602
- "aria-hidden": "true",
603
- onClick: d,
604
- leftContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: Calendar, color: "inherit", size: "sm" }),
605
- "data-testid": "date-single-picker-visible-input",
606
- ...l
607
- }
608
- ),
609
- /* @__PURE__ */ jsxRuntimeExports.jsx(
610
- "input",
611
- {
612
- ref: r,
613
- type: "date",
614
- value: t,
615
- onChange: x,
616
- style: {
617
- position: "absolute",
618
- opacity: 0,
619
- pointerEvents: "none",
620
- width: 0,
621
- height: 0
622
- },
623
- tabIndex: -1,
624
- "aria-label": typeof s == "string" ? s : void 0
625
- }
626
- )
627
- ] });
628
- }), radioGroupVariants = cva("space-y-2", {
629
- variants: {
630
- direction: {
631
- vertical: "space-y-2 space-x-0",
632
- horizontal: "flex flex-wrap gap-4 space-y-0"
633
- }
634
- },
635
- defaultVariants: {
636
- direction: "vertical"
637
- }
638
- }), radioOptionVariants = cva(
639
- "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",
640
- {
641
- variants: {
642
- variant: {
643
- // Core variants using Versaur color system
644
- primary: "border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20",
645
- secondary: "border-secondary/40 checked:bg-secondary checked:border-secondary focus:ring-secondary/20",
646
- tertiary: "border-tertiary/40 checked:bg-tertiary checked:border-tertiary focus:ring-tertiary/20",
647
- ghost: "border-ghost/40 checked:bg-ghost checked:border-ghost focus:ring-ghost/20",
648
- neutral: "border-gray-300 checked:bg-gray-500 checked:border-gray-500 focus:ring-gray-400/20",
649
- // Outline variants
650
- "primary-outline": "border-primary checked:bg-white checked:border-primary focus:ring-primary/20",
651
- "secondary-outline": "border-secondary checked:bg-white checked:border-secondary focus:ring-secondary/20",
652
- "tertiary-outline": "border-tertiary checked:bg-white checked:border-tertiary focus:ring-tertiary/20",
653
- "ghost-outline": "border-ghost checked:bg-white checked:border-ghost focus:ring-ghost/20",
654
- "neutral-outline": "border-gray-400 checked:bg-white checked:border-gray-400 focus:ring-gray-500/20",
655
- // Semantic variants
656
- success: "border-success/40 checked:bg-success checked:border-success focus:ring-success/20",
657
- "success-outline": "border-success checked:bg-white checked:border-success focus:ring-success/20",
658
- info: "border-info/40 checked:bg-info checked:border-info focus:ring-info/20",
659
- "info-outline": "border-info checked:bg-white checked:border-info focus:ring-info/20",
660
- warning: "border-warning/40 checked:bg-warning checked:border-warning focus:ring-warning/20",
661
- "warning-outline": "border-warning checked:bg-white checked:border-warning focus:ring-warning/20",
662
- danger: "border-danger/40 checked:bg-danger checked:border-danger focus:ring-danger/20",
663
- "danger-outline": "border-danger checked:bg-white checked:border-danger focus:ring-danger/20"
664
- },
665
- size: {
666
- sm: "h-3 w-3",
667
- md: "h-4 w-4",
668
- lg: "h-5 w-5"
669
- }
670
- },
671
- defaultVariants: {
672
- variant: "primary",
673
- size: "md"
674
- }
675
- }
676
- ), radioLabelVariants = cva(
677
- "text-foreground cursor-pointer select-none",
678
- {
679
- variants: {
680
- size: {
681
- sm: "text-xs",
682
- md: "text-sm",
683
- lg: "text-base"
684
- },
685
- disabled: {
686
- true: "opacity-50 cursor-not-allowed",
687
- false: ""
688
- }
689
- },
690
- defaultVariants: {
691
- size: "md",
692
- disabled: !1
693
- }
694
- }
695
- ), RadioInputContext = createContext(
696
- null
697
- ), useRadioInputContext = () => {
698
- const e = useContext(RadioInputContext);
699
- if (!e)
700
- throw new Error(
701
- "useRadioInputContext must be used within RadioInputContext"
702
- );
703
- return e;
704
- }, RadioOption = React__default.forwardRef(
705
- ({ children: e, description: t, className: i, disabled: s, id: n, value: l, ...u }, o) => {
706
- const r = useRadioInputContext(), d = React__default.useId(), x = n || d, c = s || r.disabled, a = r.error ? "danger" : r.variant || "primary";
707
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
708
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
709
- "input",
710
- {
711
- ref: o,
712
- type: "radio",
713
- id: x,
714
- name: r.name,
715
- value: l,
716
- disabled: c,
717
- className: cn(
718
- radioOptionVariants({
719
- variant: a,
720
- size: r.size
721
- }),
722
- // Custom radio dot styling using ::before - centered positioning with size variants
723
- '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',
724
- // Size-specific radio dot dimensions
725
- r.size === "sm" && "before:w-[6px] before:h-[6px]",
726
- r.size === "md" && "before:w-[8px] before:h-[8px]",
727
- r.size === "lg" && "before:w-[10px] before:h-[10px]",
728
- "checked:before:opacity-100",
729
- // Outline variants use colored radio dot
730
- a?.includes("outline") && "checked:before:bg-current",
731
- i
732
- ),
733
- ...u
734
- }
735
- ) }),
736
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
737
- /* @__PURE__ */ jsxRuntimeExports.jsx(
738
- "label",
739
- {
740
- htmlFor: x,
741
- className: radioLabelVariants({
742
- size: r.size,
743
- disabled: c
744
- }),
745
- children: e
746
- }
747
- ),
748
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
749
- "div",
750
- {
751
- className: cn(
752
- "text-gray-600 mt-1",
753
- r.size === "sm" && "text-xs",
754
- r.size === "md" && "text-xs",
755
- r.size === "lg" && "text-sm",
756
- c && "opacity-50"
757
- ),
758
- children: t
759
- }
760
- )
761
- ] })
762
- ] });
763
- }
764
- ), RadioInputRoot = React__default.forwardRef(
765
- ({
766
- variant: e = "primary",
767
- size: t = "md",
768
- label: i,
769
- helperText: s,
770
- error: n,
771
- direction: l = "vertical",
772
- className: u,
773
- disabled: o,
774
- name: r,
775
- children: d,
776
- ...x
777
- }, c) => {
778
- const a = !!n, g = {
779
- variant: e,
780
- size: t,
781
- disabled: o,
782
- error: a,
783
- name: r
784
- };
785
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RadioInputContext.Provider, { value: g, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: c, className: cn("w-full", u), ...x, children: [
786
- i && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: i }),
787
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: radioGroupVariants({ direction: l }), children: d }),
788
- a && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: n }),
789
- !a && s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: s })
790
- ] }) });
791
- }
792
- ), RadioInput = Object.assign(RadioInputRoot, {
793
- Option: RadioOption
794
- }), segmentGroupVariants$1 = cva(
795
- "flex flex-row rounded-full border overflow-hidden p-1 gap-0.25",
796
- {
797
- variants: {
798
- variant: {
799
- // Core variants using Versaur color system
800
- primary: "border-primary-light",
801
- secondary: "border-secondary-light",
802
- tertiary: "border-tertiary-light",
803
- ghost: "border-ghost-light",
804
- neutral: "border-gray-200",
805
- // Semantic variants
806
- success: "border-success-light",
807
- info: "border-info-light",
808
- warning: "border-warning-light",
809
- danger: "border-danger-light"
810
- },
811
- size: {
812
- sm: "text-xs",
813
- md: "text-sm",
814
- lg: "text-base"
815
- },
816
- error: {
817
- true: "border-danger",
818
- false: ""
819
- }
820
- },
821
- defaultVariants: {
822
- variant: "primary",
823
- size: "md",
824
- error: !1
825
- }
826
- }
827
- ), segmentOptionVariants$1 = cva(
828
- "inline relative flex flex-row items-center px-3 py-2 text-center font-medium transition-all duration-200 cursor-pointer border-0 bg-transparent outline-none focus:ring-2 focus:ring-offset-1 flex-1",
829
- {
830
- variants: {
831
- variant: {
832
- // Core variants using Versaur color system
833
- primary: "text-ghost hover:text-primary focus:ring-primary/30",
834
- secondary: "text-ghost hover:text-secondary focus:ring-secondary/30",
835
- tertiary: "text-ghost hover:text-tertiary focus:ring-tertiary/30",
836
- ghost: "text-ghost hover:text-ghost focus:ring-ghost/30",
837
- neutral: "text-ghost hover:text-gray-700 focus:ring-gray-400/30",
838
- // Semantic variants
839
- success: "text-ghost hover:text-success focus:ring-success/30",
840
- info: "text-ghost hover:text-info focus:ring-info/30",
841
- warning: "text-ghost hover:text-warning focus:ring-warning/30",
842
- danger: "text-ghost hover:text-danger focus:ring-danger/30"
843
- },
844
- size: {
845
- sm: "px-2 py-1.5 text-xs",
846
- md: "px-3 py-2 text-sm",
847
- lg: "px-4 py-2.5 text-base"
848
- },
849
- rounded: {
850
- first: "rounded-l-full",
851
- middle: "",
852
- last: "rounded-r-full",
853
- single: "rounded-full"
854
- }
855
- },
856
- defaultVariants: {
857
- variant: "primary",
858
- size: "md",
859
- rounded: "middle"
860
- }
861
- }
862
- ), getSegmentSelectedClasses$1 = (e) => {
863
- const t = {
864
- // Core variants - override hover text color changes
865
- primary: "bg-primary text-white hover:text-white",
866
- secondary: "bg-secondary text-white hover:text-white",
867
- tertiary: "bg-tertiary text-white hover:text-white",
868
- ghost: "bg-ghost text-white hover:text-white",
869
- neutral: "bg-gray-500 text-white hover:text-white",
870
- // Semantic variants - override hover text color changes
871
- success: "bg-success text-white hover:text-white",
872
- info: "bg-info text-white hover:text-white",
873
- warning: "bg-warning text-white hover:text-white",
874
- danger: "bg-danger text-white hover:text-white"
875
- };
876
- return t[e || "primary"] || t.primary;
877
- }, SegmentSingleInputContext = createContext(null), useSegmentSingleInputContext = () => {
878
- const e = useContext(SegmentSingleInputContext);
879
- if (!e)
880
- throw new Error(
881
- "useSegmentSingleInputContext must be used within SegmentSingleInputContext"
882
- );
883
- return e;
884
- }, SegmentOption$1 = React__default.forwardRef(
885
- ({ children: e, className: t, disabled: i, id: s, value: n, position: l = "middle", ...u }, o) => {
886
- const r = useSegmentSingleInputContext(), d = React__default.useId(), x = s || d, c = i || r.disabled, a = r.error ? "danger" : r.variant || "primary", g = r.value === n, h = (b) => {
887
- if (!c) {
888
- const f = r.value === n ? null : n;
889
- r.onChange?.(f);
890
- }
891
- u.onChange?.(b);
892
- };
893
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
894
- /* @__PURE__ */ jsxRuntimeExports.jsx(
895
- "input",
896
- {
897
- ref: o,
898
- type: "radio",
899
- id: x,
900
- name: r.name,
901
- value: n,
902
- checked: g,
903
- disabled: c,
904
- onChange: h,
905
- className: "sr-only",
906
- ...u
907
- }
908
- ),
909
- /* @__PURE__ */ jsxRuntimeExports.jsx(
910
- "label",
911
- {
912
- htmlFor: x,
913
- className: cn(
914
- "flex flex-row items-center justify-center",
915
- segmentOptionVariants$1({
916
- variant: a,
917
- size: r.size,
918
- rounded: l
919
- }),
920
- g && getSegmentSelectedClasses$1(a),
921
- c && "opacity-50 cursor-not-allowed pointer-events-none",
922
- t
923
- ),
924
- children: e
925
- }
926
- )
927
- ] });
928
- }
929
- );
930
- SegmentOption$1.displayName = "SegmentOption";
931
- const SegmentSingleInputRoot = React__default.forwardRef(
932
- ({
933
- variant: e = "primary",
934
- size: t = "md",
935
- label: i,
936
- helperText: s,
937
- error: n,
938
- disabled: l,
939
- name: u,
940
- value: o,
941
- onChange: r,
942
- children: d,
943
- ...x
944
- }, c) => {
945
- const a = !!n, g = {
946
- variant: e,
947
- size: t,
948
- disabled: l,
949
- error: a,
950
- name: u,
951
- value: o,
952
- onChange: r
953
- }, h = React__default.Children.toArray(d), b = h.map((f, y) => {
954
- if (React__default.isValidElement(f)) {
955
- let m;
956
- return h.length === 1 ? m = "single" : y === 0 ? m = "first" : y === h.length - 1 ? m = "last" : m = "middle", React__default.cloneElement(
957
- f,
958
- { position: m }
959
- );
960
- }
961
- return f;
962
- });
963
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSingleInputContext.Provider, { value: g, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: c, ...x, children: [
964
- i && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: i }),
965
- /* @__PURE__ */ jsxRuntimeExports.jsx(
966
- "div",
967
- {
968
- className: cn(
969
- segmentGroupVariants$1({
970
- variant: a ? "danger" : e,
971
- size: t,
972
- error: a
973
- })
974
- ),
975
- children: b
976
- }
977
- ),
978
- a && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: n }),
979
- !a && s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: s })
980
- ] }) });
981
- }
982
- ), SegmentSingleInput = Object.assign(SegmentSingleInputRoot, {
983
- Option: SegmentOption$1
984
- }), segmentGroupVariants = cva(
985
- "flex flex-row rounded-full border overflow-hidden p-1 gap-0.25",
986
- {
987
- variants: {
988
- variant: {
989
- // Core variants using Versaur color system
990
- primary: "border-primary-light",
991
- secondary: "border-secondary-light",
992
- tertiary: "border-tertiary-light",
993
- ghost: "border-ghost-light",
994
- neutral: "border-gray-200",
995
- // Semantic variants
996
- success: "border-success-light",
997
- info: "border-info-light",
998
- warning: "border-warning-light",
999
- danger: "border-danger-light"
1000
- },
1001
- size: {
1002
- sm: "text-xs",
1003
- md: "text-sm",
1004
- lg: "text-base"
1005
- },
1006
- error: {
1007
- true: "border-danger",
1008
- false: ""
1009
- }
1010
- },
1011
- defaultVariants: {
1012
- variant: "primary",
1013
- size: "md",
1014
- error: !1
1015
- }
1016
- }
1017
- ), segmentOptionVariants = cva(
1018
- "inline relative flex flex-row items-center px-3 py-2 text-center font-medium transition-all duration-200 cursor-pointer border-0 bg-transparent outline-none focus:ring-2 focus:ring-offset-1 flex-1",
1019
- {
1020
- variants: {
1021
- variant: {
1022
- // Core variants using Versaur color system
1023
- primary: "text-ghost hover:text-primary focus:ring-primary/30",
1024
- secondary: "text-ghost hover:text-secondary focus:ring-secondary/30",
1025
- tertiary: "text-ghost hover:text-tertiary focus:ring-tertiary/30",
1026
- ghost: "text-ghost hover:text-ghost focus:ring-ghost/30",
1027
- neutral: "text-ghost hover:text-gray-700 focus:ring-gray-400/30",
1028
- // Semantic variants
1029
- success: "text-ghost hover:text-success focus:ring-success/30",
1030
- info: "text-ghost hover:text-info focus:ring-info/30",
1031
- warning: "text-ghost hover:text-warning focus:ring-warning/30",
1032
- danger: "text-ghost hover:text-danger focus:ring-danger/30"
1033
- },
1034
- size: {
1035
- sm: "px-2 py-1.5 text-xs",
1036
- md: "px-3 py-2 text-sm",
1037
- lg: "px-4 py-2.5 text-base"
1038
- },
1039
- rounded: {
1040
- first: "rounded-l-full",
1041
- middle: "",
1042
- last: "rounded-r-full",
1043
- single: "rounded-full"
1044
- }
1045
- },
1046
- defaultVariants: {
1047
- variant: "primary",
1048
- size: "md",
1049
- rounded: "middle"
1050
- }
1051
- }
1052
- ), getSegmentSelectedClasses = (e) => {
1053
- const t = {
1054
- // Core variants - override hover text color changes
1055
- primary: "bg-primary text-white hover:text-white",
1056
- secondary: "bg-secondary text-white hover:text-white",
1057
- tertiary: "bg-tertiary text-white hover:text-white",
1058
- ghost: "bg-ghost text-white hover:text-white",
1059
- neutral: "bg-gray-500 text-white hover:text-white",
1060
- // Semantic variants - override hover text color changes
1061
- success: "bg-success text-white hover:text-white",
1062
- info: "bg-info text-white hover:text-white",
1063
- warning: "bg-warning text-white hover:text-white",
1064
- danger: "bg-danger text-white hover:text-white"
1065
- };
1066
- return t[e || "primary"] || t.primary;
1067
- }, SegmentMultipleInputContext = createContext(null), useSegmentMultipleInputContext = () => {
1068
- const e = useContext(SegmentMultipleInputContext);
1069
- if (!e)
1070
- throw new Error(
1071
- "useSegmentMultipleInputContext must be used within SegmentMultipleInputContext"
1072
- );
1073
- return e;
1074
- }, SegmentOption = React__default.forwardRef(
1075
- ({ children: e, className: t, disabled: i, id: s, value: n, position: l = "middle", ...u }, o) => {
1076
- const r = useSegmentMultipleInputContext(), d = React__default.useId(), x = s || d, c = i || r.disabled, a = r.error ? "danger" : r.variant || "primary", g = r.value?.includes(n) ?? !1, h = (b) => {
1077
- if (!c) {
1078
- const f = r.value || [];
1079
- let y;
1080
- g ? y = f.filter((m) => m !== n) : y = [...f, n], r.onChange?.(y);
1081
- }
1082
- u.onChange?.(b);
1083
- };
1084
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1085
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1086
- "input",
1087
- {
1088
- ref: o,
1089
- type: "checkbox",
1090
- id: x,
1091
- name: `${r.name}[]`,
1092
- value: n,
1093
- checked: g,
1094
- disabled: c,
1095
- onChange: h,
1096
- className: "sr-only",
1097
- ...u
1098
- }
1099
- ),
1100
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1101
- "label",
1102
- {
1103
- htmlFor: x,
1104
- className: cn(
1105
- "flex flex-row items-center justify-center",
1106
- segmentOptionVariants({
1107
- variant: a,
1108
- size: r.size,
1109
- rounded: l
1110
- }),
1111
- g && getSegmentSelectedClasses(a),
1112
- c && "opacity-50 cursor-not-allowed pointer-events-none",
1113
- t
1114
- ),
1115
- children: e
1116
- }
1117
- )
1118
- ] });
1119
- }
1120
- );
1121
- SegmentOption.displayName = "SegmentOption";
1122
- const SegmentMultipleInputRoot = React__default.forwardRef(
1123
- ({
1124
- variant: e = "primary",
1125
- size: t = "md",
1126
- label: i,
1127
- helperText: s,
1128
- error: n,
1129
- disabled: l,
1130
- name: u,
1131
- value: o = [],
1132
- onChange: r,
1133
- children: d,
1134
- ...x
1135
- }, c) => {
1136
- const a = !!n, g = {
1137
- variant: e,
1138
- size: t,
1139
- disabled: l,
1140
- error: a,
1141
- name: u,
1142
- value: o,
1143
- onChange: r
1144
- }, h = React__default.Children.toArray(d), b = h.map((f, y) => {
1145
- if (React__default.isValidElement(f)) {
1146
- let m;
1147
- return h.length === 1 ? m = "single" : y === 0 ? m = "first" : y === h.length - 1 ? m = "last" : m = "middle", React__default.cloneElement(
1148
- f,
1149
- { position: m }
1150
- );
1151
- }
1152
- return f;
1153
- });
1154
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentMultipleInputContext.Provider, { value: g, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: c, ...x, children: [
1155
- i && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: i }),
1156
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1157
- "div",
1158
- {
1159
- className: cn(
1160
- segmentGroupVariants({
1161
- variant: a ? "danger" : e,
1162
- size: t,
1163
- error: a
1164
- })
1165
- ),
1166
- children: b
1167
- }
1168
- ),
1169
- a && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: n }),
1170
- !a && s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: s })
1171
- ] }) });
1172
- }
1173
- ), SegmentMultipleInput = Object.assign(SegmentMultipleInputRoot, {
1174
- Option: SegmentOption
1175
- }), SearchInput = forwardRef(
1176
- ({
1177
- autoComplete: e = "off",
1178
- spellCheck: t = !1,
1179
- inputMode: i = "search",
1180
- placeholder: s = "Search...",
1181
- maxLength: n = 256,
1182
- enterKeyHint: l = "search",
1183
- "aria-label": u = "Search",
1184
- // internal default, not in props
1185
- ...o
1186
- }, r) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1187
- TextInput,
1188
- {
1189
- ref: r,
1190
- type: "search",
1191
- inputMode: i,
1192
- autoComplete: e,
1193
- spellCheck: t,
1194
- placeholder: s,
1195
- maxLength: n,
1196
- enterKeyHint: l,
1197
- "aria-label": u,
1198
- leftContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: SearchIcon, color: "inherit", size: "sm" }),
1199
- ...o
1200
- }
1201
- )
1202
- ), selectInputVariants = cva(
1203
- "block w-full rounded-md border bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none disabled:bg-gray-50 appearance-none bg-no-repeat bg-right pr-10",
1204
- {
1205
- variants: {
1206
- variant: {
1207
- // Core variants using Versaur color system
1208
- primary: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
1209
- secondary: "border-secondary/30 text-foreground focus:border-secondary focus:ring-secondary/20",
1210
- tertiary: "border-tertiary/30 text-foreground focus:border-tertiary focus:ring-tertiary/20",
1211
- ghost: "border-ghost/30 text-foreground focus:border-ghost focus:ring-ghost/20",
1212
- neutral: "border-gray-300 text-foreground focus:border-gray-400 focus:ring-gray-400/20",
1213
- // Outline variants
1214
- "primary-outline": "border-primary text-foreground focus:border-primary focus:ring-primary/20",
1215
- "secondary-outline": "border-secondary text-foreground focus:border-secondary focus:ring-secondary/20",
1216
- "tertiary-outline": "border-tertiary text-foreground focus:border-tertiary focus:ring-tertiary/20",
1217
- "ghost-outline": "border-ghost text-foreground focus:border-ghost focus:ring-ghost/20",
1218
- "neutral-outline": "border-gray-400 text-foreground focus:border-gray-500 focus:ring-gray-500/20",
1219
- // Semantic variants
1220
- success: "border-success/30 text-foreground focus:border-success focus:ring-success/20",
1221
- "success-outline": "border-success text-foreground focus:border-success focus:ring-success/20",
1222
- info: "border-info/30 text-foreground focus:border-info focus:ring-info/20",
1223
- "info-outline": "border-info text-foreground focus:border-info focus:ring-info/20",
1224
- warning: "border-warning/30 text-foreground focus:border-warning focus:ring-warning/20",
1225
- "warning-outline": "border-warning text-foreground focus:border-warning focus:ring-warning/20",
1226
- danger: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
1227
- "danger-outline": "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20"
1228
- }
1229
- },
1230
- defaultVariants: {
1231
- variant: "primary"
1232
- }
1233
- }
1234
- ), SelectInput = React__default.forwardRef(
1235
- ({
1236
- variant: e = "primary",
1237
- label: t,
1238
- helperText: i,
1239
- error: s,
1240
- className: n,
1241
- disabled: l,
1242
- id: u,
1243
- placeholder: o,
1244
- children: r,
1245
- ...d
1246
- }, x) => {
1247
- const c = React__default.useId(), a = u || c, g = !!s;
1248
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1249
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1250
- "label",
1251
- {
1252
- htmlFor: a,
1253
- className: "block text-sm font-medium text-foreground mb-2",
1254
- children: t
1255
- }
1256
- ),
1257
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("relative w-full", n), children: [
1258
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1259
- "select",
1260
- {
1261
- ref: x,
1262
- id: a,
1263
- "aria-invalid": g,
1264
- "aria-disabled": l,
1265
- disabled: l,
1266
- className: cn(
1267
- selectInputVariants({
1268
- variant: g ? "danger" : e
1269
- }),
1270
- "h-10 pl-3"
1271
- ),
1272
- ...d,
1273
- children: [
1274
- o && /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", disabled: !0, hidden: !0, children: o }),
1275
- r
1276
- ]
1277
- }
1278
- ),
1279
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1280
- "svg",
1281
- {
1282
- className: "w-5 h-5 text-gray-400",
1283
- xmlns: "http://www.w3.org/2000/svg",
1284
- viewBox: "0 0 20 20",
1285
- fill: "currentColor",
1286
- "aria-hidden": "true",
1287
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1288
- "path",
1289
- {
1290
- fillRule: "evenodd",
1291
- d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
1292
- clipRule: "evenodd"
1293
- }
1294
- )
1295
- }
1296
- ) })
1297
- ] }),
1298
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: s }),
1299
- !g && i && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-gray-600", children: i })
1300
- ] });
1301
- }
1302
- );
1303
- SelectInput.displayName = "SelectInput";
1304
- const textAreaInputVariants = cva(
1305
- "block w-full rounded-md border bg-white transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none disabled:bg-gray-50",
1306
- {
1307
- variants: {
1308
- variant: {
1309
- // Core variants using Versaur color system
1310
- primary: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
1311
- secondary: "border-secondary/30 text-foreground focus:border-secondary focus:ring-secondary/20",
1312
- tertiary: "border-tertiary/30 text-foreground focus:border-tertiary focus:ring-tertiary/20",
1313
- ghost: "border-ghost/30 text-foreground focus:border-ghost focus:ring-ghost/20",
1314
- neutral: "border-gray-300 text-foreground focus:border-gray-400 focus:ring-gray-400/20",
1315
- // Outline variants
1316
- "primary-outline": "border-primary text-foreground focus:border-primary focus:ring-primary/20",
1317
- "secondary-outline": "border-secondary text-foreground focus:border-secondary focus:ring-secondary/20",
1318
- "tertiary-outline": "border-tertiary text-foreground focus:border-tertiary focus:ring-tertiary/20",
1319
- "ghost-outline": "border-ghost text-foreground focus:border-ghost focus:ring-ghost/20",
1320
- "neutral-outline": "border-gray-400 text-foreground focus:border-gray-500 focus:ring-gray-500/20",
1321
- // Semantic variants
1322
- success: "border-success/30 text-foreground focus:border-success focus:ring-success/20",
1323
- "success-outline": "border-success text-foreground focus:border-success focus:ring-success/20",
1324
- info: "border-info/30 text-foreground focus:border-info focus:ring-info/20",
1325
- "info-outline": "border-info text-foreground focus:border-info focus:ring-info/20",
1326
- warning: "border-warning/30 text-foreground focus:border-warning focus:ring-warning/20",
1327
- "warning-outline": "border-warning text-foreground focus:border-warning focus:ring-warning/20",
1328
- danger: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
1329
- "danger-outline": "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20"
1330
- },
1331
- fieldSizing: {
1332
- content: "field-sizing-content resize-none",
1333
- fixed: "resize-y"
1334
- }
1335
- },
1336
- defaultVariants: {
1337
- variant: "primary",
1338
- fieldSizing: "fixed"
1339
- }
1340
- }
1341
- ), TextAreaInput = React__default.forwardRef(
1342
- ({
1343
- variant: e = "primary",
1344
- label: t,
1345
- helperText: i,
1346
- error: s,
1347
- className: n,
1348
- disabled: l,
1349
- id: u,
1350
- minRows: o = 3,
1351
- maxRows: r,
1352
- fieldSizing: d = "fixed",
1353
- style: x,
1354
- rows: c,
1355
- ...a
1356
- }, g) => {
1357
- const h = React__default.useId(), b = u || h, f = !!s, y = c || o, m = d === "content" ? void 0 : r, w = {
1358
- ...d === "content" && { fieldSizing: "content" },
1359
- ...m && {
1360
- maxHeight: `${m * 1.5}rem`
1361
- // Approximate line height
1362
- },
1363
- ...x
1364
- };
1365
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1366
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
1367
- "label",
1368
- {
1369
- htmlFor: b,
1370
- className: "block text-sm font-medium text-foreground mb-2",
1371
- children: t
1372
- }
1373
- ),
1374
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("relative w-full", n), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1375
- "textarea",
1376
- {
1377
- ref: g,
1378
- id: b,
1379
- rows: y,
1380
- "aria-invalid": f,
1381
- "aria-disabled": l,
1382
- disabled: l,
1383
- style: w,
1384
- className: cn(
1385
- textAreaInputVariants({
1386
- variant: f ? "danger" : e,
1387
- fieldSizing: d
1388
- }),
1389
- "px-3 py-2"
1390
- ),
1391
- ...a
1392
- }
1393
- ) }),
1394
- f && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: s }),
1395
- !f && i && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-gray-600", children: i })
1396
- ] });
1397
- }
1398
- );
1399
- TextAreaInput.displayName = "TextAreaInput";
1400
- const timeSegmentButtonVariants = cva(
1401
- "inline-flex items-center justify-center rounded-md font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
1402
- {
1403
- variants: {
1404
- active: {
1405
- true: "bg-primary text-white",
1406
- false: "bg-neutral text-foreground"
1407
- },
1408
- size: {
1409
- sm: "h-8 px-3 text-sm",
1410
- md: "h-10 px-4 text-base",
1411
- lg: "h-12 px-6 text-lg"
1412
- }
1413
- },
1414
- defaultVariants: {
1415
- active: !1,
1416
- size: "md"
1417
- }
1418
- }
1419
- ), TimeField = ({
1420
- value: e,
1421
- onChange: t,
1422
- label: i,
1423
- "aria-label": s,
1424
- disabled: n
1425
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1426
- "input",
1427
- {
1428
- type: "text",
1429
- inputMode: "numeric",
1430
- pattern: "[0-9]*",
1431
- maxLength: 2,
1432
- value: e,
1433
- onChange: (l) => t(l.target.value),
1434
- className: "w-12 h-12 text-center text-2xl border-b-2 border-primary bg-transparent focus:outline-none focus:border-primary",
1435
- "aria-label": s || i,
1436
- disabled: n,
1437
- autoComplete: "off"
1438
- }
1439
- ), AmPmSegment = ({
1440
- value: e,
1441
- onChange: t,
1442
- disabled: i
1443
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 ml-4", children: ["AM", "PM"].map((s) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1444
- "button",
1445
- {
1446
- type: "button",
1447
- className: cn(
1448
- timeSegmentButtonVariants({
1449
- active: e === s,
1450
- size: "sm"
1451
- })
1452
- ),
1453
- "aria-pressed": e === s,
1454
- onClick: () => t(s),
1455
- disabled: i,
1456
- children: s
1457
- },
1458
- s
1459
- )) }), TimePickerInput = ({
1460
- value: e,
1461
- onChange: t,
1462
- label: i,
1463
- helperText: s,
1464
- disabled: n,
1465
- error: l,
1466
- placement: u = "top",
1467
- "aria-label": o,
1468
- "aria-labelledby": r,
1469
- "aria-describedby": d
1470
- }) => {
1471
- const [x, c] = useState(!1), a = (j) => {
1472
- const p = j.match(/^(\d{1,2}):(\d{2})\s?(AM|PM)$/i);
1473
- return p ? {
1474
- hour: p[1],
1475
- minute: p[2],
1476
- period: p[3].toUpperCase()
1477
- } : { hour: "", minute: "", period: "AM" };
1478
- }, [{ hour: g, minute: h, period: b }, f] = useState(() => a(e)), y = () => {
1479
- n || (f(a(e)), c(!0));
1480
- }, m = (j) => {
1481
- let p = j.replace(/[^\d]/g, "");
1482
- p.length > 2 && (p = p.slice(0, 2)), Number(p) > 12 && (p = "12"), f((E) => ({ ...E, hour: p }));
1483
- }, w = (j) => {
1484
- let p = j.replace(/[^\d]/g, "");
1485
- p.length > 2 && (p = p.slice(0, 2)), Number(p) > 59 && (p = "59"), f((E) => ({ ...E, minute: p }));
1486
- }, R = (j) => {
1487
- f((p) => ({ ...p, period: j }));
1488
- }, C = () => {
1489
- f(a(e)), c(!1);
1490
- }, k = () => {
1491
- const j = g.padStart(2, "0") || "12", p = h.padStart(2, "0") || "00";
1492
- t(`${j}:${p} ${b}`), c(!1);
1493
- };
1494
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1495
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1496
- TextInput,
1497
- {
1498
- label: i,
1499
- value: e,
1500
- onClick: y,
1501
- readOnly: !0,
1502
- disabled: n,
1503
- error: l,
1504
- helperText: s,
1505
- "aria-label": o,
1506
- "aria-labelledby": r,
1507
- "aria-describedby": d,
1508
- className: "cursor-pointer bg-white",
1509
- leftContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: Clock, size: "sm", color: "inherit" })
1510
- }
1511
- ),
1512
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1513
- Modal,
1514
- {
1515
- isOpen: x,
1516
- onOpenChange: c,
1517
- placement: u,
1518
- size: "fit-content",
1519
- "aria-label": o,
1520
- "aria-labelledby": r,
1521
- "aria-describedby": d,
1522
- children: [
1523
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Header, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "lg", fontWeight: "semibold", children: "Select time" }) }),
1524
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Body, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-center py-2", children: [
1525
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1526
- TimeField,
1527
- {
1528
- value: g,
1529
- onChange: m,
1530
- label: "Hour",
1531
- "aria-label": "Hour",
1532
- disabled: n
1533
- }
1534
- ),
1535
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "2xl", className: "select-none", children: ":" }),
1536
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1537
- TimeField,
1538
- {
1539
- value: h,
1540
- onChange: w,
1541
- label: "Minute",
1542
- "aria-label": "Minute",
1543
- disabled: n
1544
- }
1545
- ),
1546
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1547
- AmPmSegment,
1548
- {
1549
- value: b === "AM" ? "AM" : "PM",
1550
- onChange: R,
1551
- disabled: n
1552
- }
1553
- )
1554
- ] }) }),
1555
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal.Footer, { children: [
1556
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "sm", onClick: C, children: "Cancel" }),
1557
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "primary-ghost", size: "sm", onClick: k, children: "Confirm" })
1558
- ] })
1559
- ]
1560
- }
1561
- )
1562
- ] });
1563
- }, switchVariants = cva(
1564
- "relative inline-flex items-center transition-colors duration-200 border border-transparent",
1565
- {
1566
- variants: {
1567
- color: {
1568
- primary: "",
1569
- secondary: "",
1570
- tertiary: "",
1571
- ghost: "",
1572
- neutral: "",
1573
- success: "",
1574
- info: "",
1575
- warning: "",
1576
- danger: ""
1577
- },
1578
- size: {
1579
- sm: "h-4 w-8",
1580
- md: "h-5 w-10",
1581
- lg: "h-6 w-12"
1582
- },
1583
- disabled: {
1584
- true: "opacity-50 cursor-not-allowed",
1585
- false: ""
1586
- },
1587
- checked: {
1588
- true: "",
1589
- false: ""
1590
- }
1591
- },
1592
- defaultVariants: {
1593
- color: "primary",
1594
- size: "md",
1595
- disabled: !1,
1596
- checked: !1
1597
- },
1598
- compoundVariants: [
1599
- {
1600
- checked: !0,
1601
- color: "primary",
1602
- class: "bg-primary"
1603
- },
1604
- {
1605
- checked: !0,
1606
- color: "secondary",
1607
- class: "bg-secondary"
1608
- },
1609
- { checked: !0, color: "tertiary", class: "bg-tertiary" },
1610
- { checked: !0, color: "ghost", class: "bg-ghost" },
1611
- { checked: !0, color: "neutral", class: "bg-neutral" },
1612
- { checked: !0, color: "success", class: "bg-success" },
1613
- { checked: !0, color: "info", class: "bg-info" },
1614
- { checked: !0, color: "warning", class: "bg-warning" },
1615
- { checked: !0, color: "danger", class: "bg-danger" },
1616
- { checked: !1, class: "bg-white border-border" }
1617
- ]
1618
- }
1619
- ), thumbVariants = cva(
1620
- "absolute rounded-full transition-transform duration-200",
1621
- {
1622
- variants: {
1623
- size: {
1624
- sm: "h-3 w-3",
1625
- md: "h-4 w-4",
1626
- lg: "h-5 w-5"
1627
- },
1628
- checked: {
1629
- true: "translate-x-full bg-white left-1.5",
1630
- false: "bg-neutral left-0.5"
1631
- }
1632
- },
1633
- defaultVariants: {
1634
- size: "md",
1635
- checked: !1
1636
- }
1637
- }
1638
- ), SwitchTrack = ({
1639
- color: e = "primary",
1640
- size: t = "md",
1641
- disabled: i = !1,
1642
- className: s,
1643
- checked: n
1644
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1645
- "span",
1646
- {
1647
- className: cn(
1648
- switchVariants({ color: e, size: t, disabled: i, checked: n }),
1649
- "rounded-full pointer-events-none",
1650
- s
1651
- ),
1652
- "aria-hidden": "true"
1653
- }
1654
- ), SwitchThumb = ({ size: e = "md", checked: t = !1 }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: cn(thumbVariants({ size: e, checked: t })), "aria-hidden": "true" }), SwitchLabel = ({ label: e, htmlFor: t, placement: i = "top", disabled: s = !1 }) => e ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1655
- "label",
1656
- {
1657
- htmlFor: t,
1658
- className: cn(
1659
- "text-sm select-none font-medium text-foreground",
1660
- i === "inline" ? "ml-2 mb-0" : "mb-1",
1661
- s && "opacity-50 cursor-not-allowed"
1662
- ),
1663
- children: e
1664
- }
1665
- ) : null, SwitchInput = React__default.forwardRef(
1666
- ({
1667
- checked: e,
1668
- defaultChecked: t,
1669
- onCheckedChange: i,
1670
- color: s = "primary",
1671
- size: n = "md",
1672
- label: l,
1673
- labelPlacement: u = "top",
1674
- disabled: o = !1,
1675
- className: r,
1676
- id: d,
1677
- ariaLabel: x,
1678
- ...c
1679
- }, a) => {
1680
- const [g, h] = useState(
1681
- t ?? !1
1682
- ), b = useId(), f = d || b, y = typeof e == "boolean", m = y ? e : g, w = (R) => {
1683
- y || h(R.target.checked), i?.(R.target.checked);
1684
- };
1685
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1686
- "div",
1687
- {
1688
- className: cn(
1689
- "flex flex-col",
1690
- u === "inline" && "flex-row items-center",
1691
- r
1692
- ),
1693
- children: [
1694
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1695
- SwitchLabel,
1696
- {
1697
- label: l,
1698
- htmlFor: f,
1699
- placement: u,
1700
- disabled: o
1701
- }
1702
- ),
1703
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1704
- "span",
1705
- {
1706
- className: cn(
1707
- "relative flex items-center",
1708
- u === "inline" && "ml-2"
1709
- ),
1710
- children: [
1711
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1712
- "input",
1713
- {
1714
- ref: a,
1715
- type: "checkbox",
1716
- id: f,
1717
- "aria-label": x || l,
1718
- checked: m,
1719
- disabled: o,
1720
- onChange: w,
1721
- className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer z-10",
1722
- ...c
1723
- }
1724
- ),
1725
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1726
- SwitchTrack,
1727
- {
1728
- color: s,
1729
- size: n,
1730
- disabled: o,
1731
- checked: m
1732
- }
1733
- ),
1734
- /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchThumb, { size: n, checked: m })
1735
- ]
1736
- }
1737
- )
1738
- ]
1739
- }
1740
- );
1741
- }
1742
- );
1743
- SwitchInput.displayName = "SwitchInput";
1744
- function usePriceInputSync(e, t) {
1745
- useEffect(() => {
1746
- typeof e == "number" && !isNaN(e) ? t(`${e}`) : e === "" || e === null || e === void 0 ? t("") : typeof e == "string" && t(e);
1747
- }, [e, t]);
1748
- }
1749
- const PriceInput = ({
1750
- value: e,
1751
- onChange: t,
1752
- allowNegative: i = !1,
1753
- inputProps: s,
1754
- label: n,
1755
- helperText: l,
1756
- error: u,
1757
- variant: o,
1758
- ...r
1759
- }) => {
1760
- const d = useRef(null), [x, c] = useState(
1761
- e === "" ? "" : String(e)
1762
- );
1763
- usePriceInputSync(e, c);
1764
- const a = (g) => {
1765
- let h = g.target.value.replace(/[^\d.,-]/g, "");
1766
- i || (h = h.replace(/-/g, "")), c(h), t(h);
1767
- };
1768
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
1769
- TextInput,
1770
- {
1771
- ref: d,
1772
- type: "text",
1773
- label: n,
1774
- value: x,
1775
- onChange: a,
1776
- error: u,
1777
- helperText: l,
1778
- placeholder: r.placeholder,
1779
- leftContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: Banknote, color: "inherit", size: "sm" }),
1780
- variant: o,
1781
- inputMode: "numeric",
1782
- autoComplete: "off",
1783
- pattern: i ? "^-?[\\d,.]*$" : "^[\\d,.]*$",
1784
- ...s,
1785
- ...r
1786
- }
1787
- );
1788
- }, EmailInput = forwardRef(
1789
- (e, t) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1790
- TextInput,
1791
- {
1792
- ...e,
1793
- ref: t,
1794
- type: "email",
1795
- autoComplete: "email",
1796
- inputMode: "email",
1797
- leftContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: MailIcon, color: "inherit", size: "sm" })
1798
- }
1799
- )
1800
- );
1801
- export {
1802
- CalculatorInput as C,
1803
- DateSinglePickerInput as D,
1804
- EmailInput as E,
1805
- PriceInput as P,
1806
- RadioInput as R,
1807
- SegmentSingleInput as S,
1808
- TextInput as T,
1809
- CheckboxInput as a,
1810
- ChipMultipleInput as b,
1811
- SegmentMultipleInput as c,
1812
- SearchInput as d,
1813
- SelectInput as e,
1814
- TextAreaInput as f,
1815
- TimePickerInput as g,
1816
- SwitchInput as h,
1817
- SwitchTrack as i,
1818
- SwitchThumb as j,
1819
- SwitchLabel as k
1820
- };