@dimasbaguspm/versaur 0.0.16 → 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 (78) hide show
  1. package/dist/{js → assets}/styles.css +37 -0
  2. package/dist/js/bottom-sheet-BRv-oJL-.js +646 -0
  3. package/dist/js/description-list-DZQF212Z.js +1786 -0
  4. package/dist/js/email-input-BIbrfs5q.js +1731 -0
  5. package/dist/js/forms/index.js +16 -16
  6. package/dist/js/index.js +44 -41
  7. package/dist/js/overlays/index.js +3 -4
  8. package/dist/js/primitive/index.js +12 -11
  9. package/dist/js/providers/index.js +5 -0
  10. package/dist/js/snackbar-DH8jCh2V.js +50 -0
  11. package/dist/js/use-snackbars-oPoF7J5t.js +94 -0
  12. package/dist/types/feedbacks/loading-indicator/index.d.ts +2 -1
  13. package/dist/types/forms/chip-multiple-input/chip-multiple-input.atoms.d.ts +10 -0
  14. package/dist/types/forms/chip-multiple-input/chip-multiple-input.d.ts +5 -0
  15. package/dist/types/forms/chip-multiple-input/index.d.ts +2 -0
  16. package/dist/types/forms/{chip-input → chip-multiple-input}/types.d.ts +16 -4
  17. package/dist/types/forms/chip-single-input/chip-single-input.atoms.d.ts +10 -0
  18. package/dist/types/forms/chip-single-input/chip-single-input.d.ts +5 -0
  19. package/dist/types/forms/chip-single-input/index.d.ts +2 -0
  20. package/dist/types/forms/chip-single-input/types.d.ts +67 -0
  21. package/dist/types/forms/date-single-picker-input/date-single-picker-input.d.ts +1 -8
  22. package/dist/types/forms/date-single-picker-input/index.d.ts +1 -1
  23. package/dist/types/forms/date-single-picker-input/types.d.ts +12 -66
  24. package/dist/types/forms/email-input/email-input.d.ts +8 -0
  25. package/dist/types/forms/email-input/index.d.ts +2 -0
  26. package/dist/types/forms/email-input/types.d.ts +6 -0
  27. package/dist/types/forms/index.d.ts +5 -2
  28. package/dist/types/forms/price-input/index.d.ts +2 -0
  29. package/dist/types/forms/price-input/price-input.d.ts +6 -0
  30. package/dist/types/forms/price-input/types.d.ts +15 -0
  31. package/dist/types/forms/price-input/use-price-input.d.ts +6 -0
  32. package/dist/types/forms/search-input/index.d.ts +2 -0
  33. package/dist/types/forms/search-input/search-input.d.ts +8 -0
  34. package/dist/types/forms/search-input/types.d.ts +35 -0
  35. package/dist/types/forms/segment-multiple-input/types.d.ts +1 -5
  36. package/dist/types/forms/segment-single-input/types.d.ts +1 -5
  37. package/dist/types/forms/switch-input/index.d.ts +2 -3
  38. package/dist/types/forms/time-picker-input/time-picker-input.d.ts +4 -4
  39. package/dist/types/forms/time-picker-input/types.d.ts +2 -38
  40. package/dist/types/index.d.ts +1 -0
  41. package/dist/types/layouts/page-layout/index.d.ts +2 -1
  42. package/dist/types/overlays/menu/index.d.ts +2 -2
  43. package/dist/types/overlays/modal/types.d.ts +1 -1
  44. package/dist/types/primitive/anchor/types.d.ts +8 -2
  45. package/dist/types/primitive/description-list/description-list.atoms.d.ts +13 -0
  46. package/dist/types/primitive/description-list/description-list.d.ts +6 -0
  47. package/dist/types/primitive/description-list/index.d.ts +2 -0
  48. package/dist/types/primitive/description-list/types.d.ts +46 -0
  49. package/dist/types/primitive/index.d.ts +1 -0
  50. package/dist/types/providers/index.d.ts +1 -0
  51. package/dist/types/providers/snackbars-provider/index.d.ts +3 -0
  52. package/dist/types/providers/snackbars-provider/provider.d.ts +7 -0
  53. package/dist/types/providers/snackbars-provider/types.d.ts +28 -0
  54. package/dist/types/providers/snackbars-provider/use-snackbars-queue.d.ts +9 -0
  55. package/dist/types/providers/snackbars-provider/use-snackbars.d.ts +4 -0
  56. package/dist/{js → utils}/enforce-subpath-import.js +61 -51
  57. package/package.json +8 -4
  58. package/dist/js/bottom-sheet-Difan0U1.js +0 -340
  59. package/dist/js/calendar-CUjVZ7Ap.js +0 -811
  60. package/dist/js/menu-Bm-yPIMN.js +0 -310
  61. package/dist/js/switch-input-Bx6_2zG9.js +0 -2035
  62. package/dist/js/tile-BjhJ5Mvl.js +0 -939
  63. package/dist/types/forms/calculator-input/calculator-input.atoms.d.ts +0 -11
  64. package/dist/types/forms/calculator-input/calculator-input.d.ts +0 -8
  65. package/dist/types/forms/calculator-input/index.d.ts +0 -1
  66. package/dist/types/forms/calculator-input/types.d.ts +0 -51
  67. package/dist/types/forms/chip-input/chip-input.atoms.d.ts +0 -10
  68. package/dist/types/forms/chip-input/chip-input.d.ts +0 -5
  69. package/dist/types/forms/chip-input/index.d.ts +0 -2
  70. package/dist/types/forms/date-range-picker-input/date-range-picker-input.d.ts +0 -10
  71. package/dist/types/forms/date-range-picker-input/index.d.ts +0 -2
  72. package/dist/types/forms/date-range-picker-input/types.d.ts +0 -64
  73. package/dist/types/forms/date-range-picker-input/use-date-range-picker.d.ts +0 -13
  74. package/dist/types/forms/date-single-picker-input/date-single-picker-input.atoms.d.ts +0 -13
  75. package/dist/types/forms/date-single-picker-input/date-single-picker-input.docked.d.ts +0 -14
  76. package/dist/types/forms/date-single-picker-input/date-single-picker-input.modal.d.ts +0 -15
  77. package/dist/types/forms/date-single-picker-input/use-date-single-picker.d.ts +0 -10
  78. package/dist/types/forms/time-picker-input/time-picker-input.atoms.d.ts +0 -15
@@ -1,2035 +0,0 @@
1
- import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
2
- import React__default, { useState, useRef, createContext, useContext, useEffect, useId, useCallback } from "react";
3
- import { I as Icon, C as Calculator, B as Button, b as Calendar, T as Text } from "./calendar-CUjVZ7Ap.js";
4
- import { a as Modal, M as Menu } from "./menu-Bm-yPIMN.js";
5
- import { CalculatorIcon, Check, Clock } 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: n,
43
- rightContent: o,
44
- helperText: s,
45
- error: c,
46
- className: u,
47
- disabled: a,
48
- id: r,
49
- ...i
50
- }, x) => {
51
- const l = React__default.useId(), g = r || l, d = !!c;
52
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
53
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
54
- "label",
55
- {
56
- htmlFor: g,
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
- n && /* @__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: n
68
- }
69
- ),
70
- /* @__PURE__ */ jsxRuntimeExports.jsx(
71
- "input",
72
- {
73
- ref: x,
74
- id: g,
75
- "aria-invalid": d,
76
- "aria-disabled": a,
77
- disabled: a,
78
- className: cn(
79
- textInputVariants({
80
- variant: d ? "danger" : e
81
- }),
82
- n ? "pl-9" : "pl-3",
83
- o ? "pr-9" : "pr-3",
84
- "h-10"
85
- ),
86
- ...i
87
- }
88
- ),
89
- o && /* @__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: o
95
- }
96
- )
97
- ] }),
98
- d && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: c }),
99
- !d && s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-gray-600", children: s })
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: n, disabled: o, id: s, ...c }, u) => {
285
- const a = useCheckboxContext(), r = React__default.useId(), i = s || r, x = o || a.disabled, l = a.error ? "danger" : a.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: i,
293
- disabled: x,
294
- className: cn(
295
- checkboxVariants({
296
- variant: l,
297
- size: a.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
- a.size === "sm" && "after:w-[3px] after:h-[6px]",
303
- a.size === "md" && "after:w-[4px] after:h-[8px]",
304
- a.size === "lg" && "after:w-[6px] after:h-[10px]",
305
- "checked:after:opacity-100",
306
- // Outline variants use colored checkmark
307
- l?.includes("outline") && "checked:after:border-current",
308
- n
309
- ),
310
- ...c
311
- }
312
- ) }),
313
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
314
- /* @__PURE__ */ jsxRuntimeExports.jsx(
315
- "label",
316
- {
317
- htmlFor: i,
318
- className: checkboxLabelVariants({
319
- size: a.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
- a.size === "sm" && "text-xs",
331
- a.size === "md" && "text-xs",
332
- a.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: n,
347
- helperText: o,
348
- error: s,
349
- direction: c = "vertical",
350
- className: u,
351
- disabled: a,
352
- children: r,
353
- ...i
354
- }, x) => {
355
- const l = !!s, g = {
356
- variant: e,
357
- size: t,
358
- disabled: a,
359
- error: l
360
- };
361
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxContext.Provider, { value: g, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: x, className: cn("w-full", u), ...i, children: [
362
- n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: n }),
363
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: checkboxGroupVariants({ direction: c }), children: r }),
364
- l && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
365
- !l && o && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
366
- ] }) });
367
- }
368
- );
369
- CheckboxInputRoot.displayName = "CheckboxInput";
370
- const CheckboxInput = Object.assign(CheckboxInputRoot, {
371
- Option: CheckboxOption
372
- }), ChipInputContext = createContext(
373
- null
374
- ), useChipInputContext = () => {
375
- const e = useContext(ChipInputContext);
376
- if (!e)
377
- throw new Error("useChipInputContext must be used within ChipInputContext");
378
- return e;
379
- }, chipOptionVariants = cva(
380
- [
381
- "inline-flex items-center bg-white font-regular transition-colors duration-200 cursor-pointer border border-border"
382
- ].join(" "),
383
- {
384
- variants: {
385
- variant: {
386
- primary: [
387
- "hover:bg-primary-soft",
388
- "hover:border-primary-light",
389
- "focus:border-primary-light",
390
- "data-[selected=true]:bg-primary-soft",
391
- "data-[selected=true]:border-primary"
392
- ].join(" "),
393
- secondary: [
394
- "hover:bg-secondary-soft",
395
- "hover:border-secondary-light",
396
- "focus:border-secondary-light",
397
- "data-[selected=true]:bg-secondary-soft",
398
- "data-[selected=true]:border-secondary"
399
- ].join(" "),
400
- tertiary: [
401
- "hover:bg-tertiary-soft",
402
- "hover:border-tertiary-light",
403
- "focus:border-tertiary-light",
404
- "data-[selected=true]:bg-tertiary-soft",
405
- "data-[selected=true]:border-tertiary"
406
- ].join(" "),
407
- ghost: [
408
- "hover:bg-ghost-soft",
409
- "hover:border-ghost-light",
410
- "focus:border-ghost-light",
411
- "data-[selected=true]:bg-ghost-soft",
412
- "data-[selected=true]:border-ghost"
413
- ].join(" "),
414
- neutral: [
415
- "hover:bg-gray-soft",
416
- "hover:border-gray-light",
417
- "focus:border-gray-light",
418
- "data-[selected=true]:bg-gray-soft",
419
- "data-[selected=true]:border-gray"
420
- ].join(" "),
421
- success: [
422
- "hover:bg-success-soft",
423
- "hover:border-success-light",
424
- "focus:border-success-light",
425
- "data-[selected=true]:bg-success-soft",
426
- "data-[selected=true]:border-success"
427
- ].join(" "),
428
- info: [
429
- "hover:bg-info-soft",
430
- "hover:border-info-light",
431
- "focus:border-info-light",
432
- "data-[selected=true]:bg-info-soft",
433
- "data-[selected=true]:border-info"
434
- ].join(" "),
435
- warning: [
436
- "hover:bg-warning-soft",
437
- "hover:border-warning-light",
438
- "focus:border-warning-light",
439
- "data-[selected=true]:bg-warning-soft",
440
- "data-[selected=true]:border-warning"
441
- ].join(" "),
442
- danger: [
443
- "hover:bg-danger-soft",
444
- "hover:border-danger-light",
445
- "focus:border-danger-light",
446
- "data-[selected=true]:bg-danger-soft",
447
- "data-[selected=true]:border-danger"
448
- ].join(" ")
449
- },
450
- selected: {
451
- true: "",
452
- false: ""
453
- },
454
- shape: {
455
- circle: "rounded-full",
456
- rounded: "rounded-lg"
457
- },
458
- size: {
459
- sm: "px-2 py-1 text-xs gap-1",
460
- md: "px-3 py-1.5 text-sm gap-1.5",
461
- lg: "px-4 py-2 text-base gap-2"
462
- }
463
- },
464
- defaultVariants: {
465
- variant: "primary",
466
- selected: !1,
467
- shape: "circle",
468
- size: "sm"
469
- }
470
- }
471
- ), ChipOption = React__default.forwardRef(
472
- ({
473
- children: e,
474
- className: t,
475
- disabled: n,
476
- id: o,
477
- value: s,
478
- check: c,
479
- defaultCheck: u = !1,
480
- ...a
481
- }, r) => {
482
- const i = useChipInputContext(), x = React__default.useId(), l = o || x, g = n || i.disabled, d = i.error ? "danger" : i.variant || "primary", m = i.shape || "circle", f = i.size || "sm", h = i.value?.includes(s) ?? !1, w = (j) => {
483
- if (!g) {
484
- const b = i.value || [];
485
- let C;
486
- h ? C = b.filter((I) => I !== s) : C = [...b, s], i.onChange?.(C);
487
- }
488
- a.onChange?.(j);
489
- }, y = f === "lg" ? 20 : f === "md" ? 18 : 16;
490
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
491
- /* @__PURE__ */ jsxRuntimeExports.jsx(
492
- "input",
493
- {
494
- ref: r,
495
- type: "checkbox",
496
- id: l,
497
- name: `${i.name}[]`,
498
- value: s,
499
- checked: h,
500
- disabled: g,
501
- onChange: w,
502
- className: "sr-only",
503
- ...a
504
- }
505
- ),
506
- /* @__PURE__ */ jsxRuntimeExports.jsx(
507
- "label",
508
- {
509
- htmlFor: l,
510
- "data-selected": h,
511
- className: cn(
512
- chipOptionVariants({
513
- variant: d,
514
- selected: h,
515
- shape: m,
516
- size: f
517
- }),
518
- g && "opacity-50 cursor-not-allowed pointer-events-none",
519
- t
520
- ),
521
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center", children: [
522
- (c || u) && /* @__PURE__ */ jsxRuntimeExports.jsx(
523
- "span",
524
- {
525
- className: cn(
526
- "flex items-center",
527
- "transition-transform transition-opacity duration-200",
528
- h ? "opacity-100 scale-100 mr-1" : "opacity-0 scale-75"
529
- ),
530
- "aria-hidden": "true",
531
- children: h && (c || /* @__PURE__ */ jsxRuntimeExports.jsx(
532
- Check,
533
- {
534
- size: y,
535
- className: d === "primary" ? "text-primary" : d === "secondary" ? "text-secondary" : d === "tertiary" ? "text-tertiary" : d === "ghost" ? "text-ghost" : d === "success" ? "text-success" : d === "info" ? "text-info" : d === "warning" ? "text-warning" : d === "danger" ? "text-danger" : "text-primary"
536
- }
537
- ))
538
- }
539
- ),
540
- e
541
- ] })
542
- }
543
- )
544
- ] });
545
- }
546
- );
547
- ChipOption.displayName = "ChipOption";
548
- const ChipInputRoot = React__default.forwardRef(
549
- ({
550
- variant: e = "primary",
551
- shape: t = "circle",
552
- size: n = "sm",
553
- label: o,
554
- helperText: s,
555
- error: c,
556
- className: u,
557
- disabled: a,
558
- name: r,
559
- value: i = [],
560
- onChange: x,
561
- children: l,
562
- ...g
563
- }, d) => {
564
- const m = !!c, f = {
565
- variant: e,
566
- shape: t,
567
- size: n,
568
- disabled: a,
569
- error: m,
570
- name: r,
571
- value: i,
572
- onChange: x
573
- };
574
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ChipInputContext.Provider, { value: f, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: d, className: cn("w-full", u), ...g, children: [
575
- o && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: o }),
576
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: l }),
577
- m && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: c }),
578
- !m && s && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: s })
579
- ] }) });
580
- }
581
- ), ChipInput = Object.assign(ChipInputRoot, {
582
- Option: ChipOption
583
- }), dateSinglePickerInputVariants = textInputVariants, DateSinglePickerTrigger = React__default.forwardRef(
584
- ({
585
- leftContent: e,
586
- rightContent: t,
587
- hasError: n,
588
- variant: o = "primary",
589
- value: s,
590
- placeholder: c = "Select date",
591
- formatDate: u,
592
- className: a,
593
- ...r
594
- }, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
595
- "button",
596
- {
597
- ref: i,
598
- type: "button",
599
- "aria-invalid": n,
600
- className: cn(
601
- dateSinglePickerInputVariants({
602
- variant: n ? "danger" : o
603
- }),
604
- e ? "pl-9" : "pl-3",
605
- t ? "pr-9" : "pr-3",
606
- "h-10 flex items-center justify-between cursor-pointer w-full relative",
607
- "text-left",
608
- a
609
- ),
610
- ...r,
611
- children: [
612
- e && /* @__PURE__ */ jsxRuntimeExports.jsx(
613
- "span",
614
- {
615
- className: "absolute left-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5",
616
- "data-testid": "left-content",
617
- children: e
618
- }
619
- ),
620
- /* @__PURE__ */ jsxRuntimeExports.jsx(
621
- "span",
622
- {
623
- className: cn(
624
- "flex-1",
625
- e ? "ml-2" : "",
626
- t ? "mr-2" : ""
627
- ),
628
- children: u ? u(s) : c
629
- }
630
- ),
631
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
632
- "span",
633
- {
634
- className: "absolute right-2.5 top-0 bottom-0 pointer-events-none text-gray-500 flex items-center justify-center w-5",
635
- "data-testid": "right-content",
636
- children: t
637
- }
638
- )
639
- ]
640
- }
641
- )
642
- );
643
- DateSinglePickerTrigger.displayName = "DateSinglePickerTrigger";
644
- const DateSinglePickerDocked = ({
645
- open: e,
646
- value: t,
647
- onChange: n,
648
- handleMenuClose: o
649
- }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu, { isOpen: e, onOutsideClick: o, children: [
650
- /* @__PURE__ */ jsxRuntimeExports.jsx(Menu.Trigger, { className: "absolute top-[90%] left-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": "true" }) }),
651
- /* @__PURE__ */ jsxRuntimeExports.jsx(Menu.Content, { className: "drop-shadow-lg rounded-lg bg-white border border-neutral", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
652
- Calendar,
653
- {
654
- value: t,
655
- onChange: (s) => {
656
- s instanceof Date && n(s);
657
- }
658
- }
659
- ) })
660
- ] }), DateSinglePickerModal = ({
661
- open: e,
662
- setOpen: t,
663
- value: n,
664
- onChange: o,
665
- label: s,
666
- buttonRef: c
667
- }) => {
668
- const [u, a] = useState(
669
- n
670
- );
671
- useEffect(() => {
672
- a(n);
673
- }, [n, e]);
674
- const r = () => {
675
- t(!1), a(n), c.current?.focus();
676
- }, i = () => {
677
- u && (o(u), t(!1), c.current?.focus());
678
- };
679
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
680
- Modal,
681
- {
682
- isOpen: e,
683
- onOpenChange: t,
684
- placement: "top",
685
- size: "md",
686
- "aria-label": s ? String(s) : "Select date",
687
- disableOverlayClose: !1,
688
- disableEscClose: !1,
689
- children: [
690
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Body, { className: "px-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
691
- Calendar,
692
- {
693
- value: u,
694
- onChange: (x) => {
695
- x instanceof Date && a(x);
696
- }
697
- }
698
- ) }),
699
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal.Footer, { className: "px-6", children: [
700
- /* @__PURE__ */ jsxRuntimeExports.jsx(
701
- Button,
702
- {
703
- onClick: r,
704
- variant: "ghost",
705
- type: "button",
706
- size: "sm",
707
- children: "Cancel"
708
- }
709
- ),
710
- /* @__PURE__ */ jsxRuntimeExports.jsx(
711
- Button,
712
- {
713
- onClick: i,
714
- variant: "primary",
715
- type: "button",
716
- disabled: !u,
717
- size: "sm",
718
- children: "Confirm"
719
- }
720
- )
721
- ] })
722
- ]
723
- }
724
- );
725
- };
726
- function useDateSinglePicker({ id: e }) {
727
- const [t, n] = useState(!1), o = useId(), s = e || o, c = useRef(null), u = useCallback(
728
- (r) => {
729
- (r.key === "ArrowDown" || r.key === "Enter" || r.key === " ") && n(!0);
730
- },
731
- []
732
- ), a = useCallback(() => {
733
- n(!1), c.current?.focus();
734
- }, []);
735
- return {
736
- open: t,
737
- setOpen: n,
738
- inputId: s,
739
- buttonRef: c,
740
- handleKeyDown: u,
741
- handleMenuClose: a
742
- };
743
- }
744
- const DateSinglePickerInput = React__default.forwardRef(
745
- ({
746
- value: e,
747
- onChange: t,
748
- label: n,
749
- leftContent: o,
750
- rightContent: s,
751
- helperText: c,
752
- error: u,
753
- variant: a = "primary",
754
- disabled: r,
755
- placeholder: i = "Select date",
756
- id: x,
757
- type: l = "docked",
758
- ...g
759
- }, d) => {
760
- if (e === void 0 || typeof t != "function")
761
- throw new Error(
762
- "DateSinglePickerInput is a controlled component: value and onChange are required."
763
- );
764
- const {
765
- open: m,
766
- setOpen: f,
767
- inputId: h,
768
- buttonRef: w,
769
- handleKeyDown: y,
770
- handleMenuClose: j
771
- } = useDateSinglePicker({ id: x }), b = !!u, C = (R) => R ? R.toLocaleDateString(void 0, {
772
- year: "numeric",
773
- month: "short",
774
- day: "numeric"
775
- }) : typeof i == "string" ? i : "Select date", I = (R) => typeof g.formatDate == "function" ? g.formatDate(R) : C(R), k = () => f((R) => !R), p = y, E = (R) => {
776
- t?.(R), w.current?.focus();
777
- };
778
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative w-full", children: [
779
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
780
- n && /* @__PURE__ */ jsxRuntimeExports.jsx(
781
- "label",
782
- {
783
- htmlFor: h,
784
- className: "block text-sm font-medium text-foreground mb-2",
785
- children: n
786
- }
787
- ),
788
- /* @__PURE__ */ jsxRuntimeExports.jsx(
789
- DateSinglePickerTrigger,
790
- {
791
- ref: (R) => {
792
- w.current = R, typeof d == "function" ? d(R) : d && (d.current = R);
793
- },
794
- id: h,
795
- "aria-haspopup": "dialog",
796
- "aria-expanded": m,
797
- "aria-controls": m ? `${h}-calendar` : void 0,
798
- "aria-invalid": b,
799
- "aria-disabled": r,
800
- disabled: r,
801
- leftContent: o,
802
- rightContent: s,
803
- hasError: b,
804
- variant: a,
805
- value: e,
806
- placeholder: typeof i == "string" ? i : "Select date",
807
- formatDate: I,
808
- onClick: k,
809
- onKeyDown: p,
810
- tabIndex: 0,
811
- ...g
812
- }
813
- ),
814
- b && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: u }),
815
- c && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-muted-foreground", children: c })
816
- ] }),
817
- l === "docked" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
818
- DateSinglePickerDocked,
819
- {
820
- open: m,
821
- value: e,
822
- onChange: E,
823
- inputId: h,
824
- handleMenuClose: j
825
- }
826
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
827
- DateSinglePickerModal,
828
- {
829
- open: m,
830
- setOpen: f,
831
- value: e,
832
- onChange: E,
833
- label: typeof n == "string" ? n : void 0,
834
- buttonRef: w
835
- }
836
- )
837
- ] });
838
- }
839
- ), radioGroupVariants = cva("space-y-2", {
840
- variants: {
841
- direction: {
842
- vertical: "space-y-2 space-x-0",
843
- horizontal: "flex flex-wrap gap-4 space-y-0"
844
- }
845
- },
846
- defaultVariants: {
847
- direction: "vertical"
848
- }
849
- }), radioOptionVariants = cva(
850
- "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",
851
- {
852
- variants: {
853
- variant: {
854
- // Core variants using Versaur color system
855
- primary: "border-primary/40 checked:bg-primary checked:border-primary focus:ring-primary/20",
856
- secondary: "border-secondary/40 checked:bg-secondary checked:border-secondary focus:ring-secondary/20",
857
- tertiary: "border-tertiary/40 checked:bg-tertiary checked:border-tertiary focus:ring-tertiary/20",
858
- ghost: "border-ghost/40 checked:bg-ghost checked:border-ghost focus:ring-ghost/20",
859
- neutral: "border-gray-300 checked:bg-gray-500 checked:border-gray-500 focus:ring-gray-400/20",
860
- // Outline variants
861
- "primary-outline": "border-primary checked:bg-white checked:border-primary focus:ring-primary/20",
862
- "secondary-outline": "border-secondary checked:bg-white checked:border-secondary focus:ring-secondary/20",
863
- "tertiary-outline": "border-tertiary checked:bg-white checked:border-tertiary focus:ring-tertiary/20",
864
- "ghost-outline": "border-ghost checked:bg-white checked:border-ghost focus:ring-ghost/20",
865
- "neutral-outline": "border-gray-400 checked:bg-white checked:border-gray-400 focus:ring-gray-500/20",
866
- // Semantic variants
867
- success: "border-success/40 checked:bg-success checked:border-success focus:ring-success/20",
868
- "success-outline": "border-success checked:bg-white checked:border-success focus:ring-success/20",
869
- info: "border-info/40 checked:bg-info checked:border-info focus:ring-info/20",
870
- "info-outline": "border-info checked:bg-white checked:border-info focus:ring-info/20",
871
- warning: "border-warning/40 checked:bg-warning checked:border-warning focus:ring-warning/20",
872
- "warning-outline": "border-warning checked:bg-white checked:border-warning focus:ring-warning/20",
873
- danger: "border-danger/40 checked:bg-danger checked:border-danger focus:ring-danger/20",
874
- "danger-outline": "border-danger checked:bg-white checked:border-danger focus:ring-danger/20"
875
- },
876
- size: {
877
- sm: "h-3 w-3",
878
- md: "h-4 w-4",
879
- lg: "h-5 w-5"
880
- }
881
- },
882
- defaultVariants: {
883
- variant: "primary",
884
- size: "md"
885
- }
886
- }
887
- ), radioLabelVariants = cva(
888
- "text-foreground cursor-pointer select-none",
889
- {
890
- variants: {
891
- size: {
892
- sm: "text-xs",
893
- md: "text-sm",
894
- lg: "text-base"
895
- },
896
- disabled: {
897
- true: "opacity-50 cursor-not-allowed",
898
- false: ""
899
- }
900
- },
901
- defaultVariants: {
902
- size: "md",
903
- disabled: !1
904
- }
905
- }
906
- ), RadioInputContext = createContext(
907
- null
908
- ), useRadioInputContext = () => {
909
- const e = useContext(RadioInputContext);
910
- if (!e)
911
- throw new Error(
912
- "useRadioInputContext must be used within RadioInputContext"
913
- );
914
- return e;
915
- }, RadioOption = React__default.forwardRef(
916
- ({ children: e, description: t, className: n, disabled: o, id: s, value: c, ...u }, a) => {
917
- const r = useRadioInputContext(), i = React__default.useId(), x = s || i, l = o || r.disabled, g = r.error ? "danger" : r.variant || "primary";
918
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
919
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
920
- "input",
921
- {
922
- ref: a,
923
- type: "radio",
924
- id: x,
925
- name: r.name,
926
- value: c,
927
- disabled: l,
928
- className: cn(
929
- radioOptionVariants({
930
- variant: g,
931
- size: r.size
932
- }),
933
- // Custom radio dot styling using ::before - centered positioning with size variants
934
- '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',
935
- // Size-specific radio dot dimensions
936
- r.size === "sm" && "before:w-[6px] before:h-[6px]",
937
- r.size === "md" && "before:w-[8px] before:h-[8px]",
938
- r.size === "lg" && "before:w-[10px] before:h-[10px]",
939
- "checked:before:opacity-100",
940
- // Outline variants use colored radio dot
941
- g?.includes("outline") && "checked:before:bg-current",
942
- n
943
- ),
944
- ...u
945
- }
946
- ) }),
947
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
948
- /* @__PURE__ */ jsxRuntimeExports.jsx(
949
- "label",
950
- {
951
- htmlFor: x,
952
- className: radioLabelVariants({
953
- size: r.size,
954
- disabled: l
955
- }),
956
- children: e
957
- }
958
- ),
959
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
960
- "div",
961
- {
962
- className: cn(
963
- "text-gray-600 mt-1",
964
- r.size === "sm" && "text-xs",
965
- r.size === "md" && "text-xs",
966
- r.size === "lg" && "text-sm",
967
- l && "opacity-50"
968
- ),
969
- children: t
970
- }
971
- )
972
- ] })
973
- ] });
974
- }
975
- ), RadioInputRoot = React__default.forwardRef(
976
- ({
977
- variant: e = "primary",
978
- size: t = "md",
979
- label: n,
980
- helperText: o,
981
- error: s,
982
- direction: c = "vertical",
983
- className: u,
984
- disabled: a,
985
- name: r,
986
- children: i,
987
- ...x
988
- }, l) => {
989
- const g = !!s, d = {
990
- variant: e,
991
- size: t,
992
- disabled: a,
993
- error: g,
994
- name: r
995
- };
996
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RadioInputContext.Provider, { value: d, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: l, className: cn("w-full", u), ...x, children: [
997
- n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: n }),
998
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: radioGroupVariants({ direction: c }), children: i }),
999
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
1000
- !g && o && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
1001
- ] }) });
1002
- }
1003
- ), RadioInput = Object.assign(RadioInputRoot, {
1004
- Option: RadioOption
1005
- }), segmentGroupVariants$1 = cva(
1006
- "inline-flex rounded-lg border overflow-hidden bg-neutral/50 p-1",
1007
- {
1008
- variants: {
1009
- variant: {
1010
- // Core variants using Versaur color system
1011
- primary: "border-primary/20",
1012
- secondary: "border-secondary/20",
1013
- tertiary: "border-tertiary/20",
1014
- ghost: "border-ghost/20",
1015
- neutral: "border-gray-200",
1016
- // Outline variants
1017
- "primary-outline": "border-primary",
1018
- "secondary-outline": "border-secondary",
1019
- "tertiary-outline": "border-tertiary",
1020
- "ghost-outline": "border-ghost",
1021
- "neutral-outline": "border-gray-400",
1022
- // Semantic variants
1023
- success: "border-success/20",
1024
- "success-outline": "border-success",
1025
- info: "border-info/20",
1026
- "info-outline": "border-info",
1027
- warning: "border-warning/20",
1028
- "warning-outline": "border-warning",
1029
- danger: "border-danger/20",
1030
- "danger-outline": "border-danger"
1031
- },
1032
- size: {
1033
- sm: "text-xs",
1034
- md: "text-sm",
1035
- lg: "text-base"
1036
- },
1037
- error: {
1038
- true: "border-danger",
1039
- false: ""
1040
- }
1041
- },
1042
- defaultVariants: {
1043
- variant: "primary",
1044
- size: "md",
1045
- error: !1
1046
- }
1047
- }
1048
- ), segmentOptionVariants$1 = cva(
1049
- "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",
1050
- {
1051
- variants: {
1052
- variant: {
1053
- // Core variants using Versaur color system
1054
- primary: "text-ghost hover:text-primary focus:ring-primary/30",
1055
- secondary: "text-ghost hover:text-secondary focus:ring-secondary/30",
1056
- tertiary: "text-ghost hover:text-tertiary focus:ring-tertiary/30",
1057
- ghost: "text-ghost hover:text-ghost focus:ring-ghost/30",
1058
- neutral: "text-ghost hover:text-gray-700 focus:ring-gray-400/30",
1059
- // Outline variants
1060
- "primary-outline": "text-primary hover:bg-primary/10 focus:ring-primary/30",
1061
- "secondary-outline": "text-secondary hover:bg-secondary/10 focus:ring-secondary/30",
1062
- "tertiary-outline": "text-tertiary hover:bg-tertiary/10 focus:ring-tertiary/30",
1063
- "ghost-outline": "text-ghost hover:bg-ghost/10 focus:ring-ghost/30",
1064
- "neutral-outline": "text-gray-600 hover:bg-gray-100 focus:ring-gray-500/30",
1065
- // Semantic variants
1066
- success: "text-ghost hover:text-success focus:ring-success/30",
1067
- "success-outline": "text-success hover:bg-success/10 focus:ring-success/30",
1068
- info: "text-ghost hover:text-info focus:ring-info/30",
1069
- "info-outline": "text-info hover:bg-info/10 focus:ring-info/30",
1070
- warning: "text-ghost hover:text-warning focus:ring-warning/30",
1071
- "warning-outline": "text-warning hover:bg-warning/10 focus:ring-warning/30",
1072
- danger: "text-ghost hover:text-danger focus:ring-danger/30",
1073
- "danger-outline": "text-danger hover:bg-danger/10 focus:ring-danger/30"
1074
- },
1075
- size: {
1076
- sm: "px-2 py-1.5 text-xs",
1077
- md: "px-3 py-2 text-sm",
1078
- lg: "px-4 py-2.5 text-base"
1079
- },
1080
- rounded: {
1081
- first: "rounded-l-md",
1082
- middle: "",
1083
- last: "rounded-r-md",
1084
- single: "rounded-md"
1085
- }
1086
- },
1087
- defaultVariants: {
1088
- variant: "primary",
1089
- size: "md",
1090
- rounded: "middle"
1091
- }
1092
- }
1093
- ), getSegmentSelectedClasses$1 = (e) => {
1094
- const t = {
1095
- // Core variants - override hover text color changes
1096
- primary: "bg-primary text-white shadow-sm hover:text-white",
1097
- secondary: "bg-secondary text-white shadow-sm hover:text-white",
1098
- tertiary: "bg-tertiary text-white shadow-sm hover:text-white",
1099
- ghost: "bg-ghost text-white shadow-sm hover:text-white",
1100
- neutral: "bg-gray-500 text-white shadow-sm hover:text-white",
1101
- // Outline variants - override hover text color changes
1102
- "primary-outline": "bg-primary text-white shadow-sm hover:text-white",
1103
- "secondary-outline": "bg-secondary text-white shadow-sm hover:text-white",
1104
- "tertiary-outline": "bg-tertiary text-white shadow-sm hover:text-white",
1105
- "ghost-outline": "bg-ghost text-white shadow-sm hover:text-white",
1106
- "neutral-outline": "bg-gray-500 text-white shadow-sm hover:text-white",
1107
- // Semantic variants - override hover text color changes
1108
- success: "bg-success text-white shadow-sm hover:text-white",
1109
- "success-outline": "bg-success text-white shadow-sm hover:text-white",
1110
- info: "bg-info text-white shadow-sm hover:text-white",
1111
- "info-outline": "bg-info text-white shadow-sm hover:text-white",
1112
- warning: "bg-warning text-white shadow-sm hover:text-white",
1113
- "warning-outline": "bg-warning text-white shadow-sm hover:text-white",
1114
- danger: "bg-danger text-white shadow-sm hover:text-white",
1115
- "danger-outline": "bg-danger text-white shadow-sm hover:text-white"
1116
- };
1117
- return t[e || "primary"] || t.primary;
1118
- }, SegmentSingleInputContext = createContext(null), useSegmentSingleInputContext = () => {
1119
- const e = useContext(SegmentSingleInputContext);
1120
- if (!e)
1121
- throw new Error(
1122
- "useSegmentSingleInputContext must be used within SegmentSingleInputContext"
1123
- );
1124
- return e;
1125
- }, SegmentOption$1 = React__default.forwardRef(
1126
- ({ children: e, className: t, disabled: n, id: o, value: s, position: c = "middle", ...u }, a) => {
1127
- const r = useSegmentSingleInputContext(), i = React__default.useId(), x = o || i, l = n || r.disabled, g = r.error ? "danger" : r.variant || "primary", d = r.value === s, m = (f) => {
1128
- if (!l) {
1129
- const h = r.value === s ? null : s;
1130
- r.onChange?.(h);
1131
- }
1132
- u.onChange?.(f);
1133
- };
1134
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1135
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1136
- "input",
1137
- {
1138
- ref: a,
1139
- type: "radio",
1140
- id: x,
1141
- name: r.name,
1142
- value: s,
1143
- checked: d,
1144
- disabled: l,
1145
- onChange: m,
1146
- className: "sr-only",
1147
- ...u
1148
- }
1149
- ),
1150
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1151
- "label",
1152
- {
1153
- htmlFor: x,
1154
- className: cn(
1155
- segmentOptionVariants$1({
1156
- variant: g,
1157
- size: r.size,
1158
- rounded: c
1159
- }),
1160
- // Apply selected state styling
1161
- d && getSegmentSelectedClasses$1(g),
1162
- d && "relative z-10",
1163
- // Apply disabled styling directly since labels don't support disabled attribute
1164
- l && "opacity-50 cursor-not-allowed pointer-events-none",
1165
- r.fullWidth && "flex-1 min-w-0",
1166
- t
1167
- ),
1168
- children: e
1169
- }
1170
- )
1171
- ] });
1172
- }
1173
- );
1174
- SegmentOption$1.displayName = "SegmentOption";
1175
- const SegmentSingleInputRoot = React__default.forwardRef(
1176
- ({
1177
- variant: e = "primary",
1178
- size: t = "md",
1179
- label: n,
1180
- helperText: o,
1181
- error: s,
1182
- className: c,
1183
- disabled: u,
1184
- name: a,
1185
- value: r,
1186
- onChange: i,
1187
- children: x,
1188
- fullWidth: l = !1,
1189
- ...g
1190
- }, d) => {
1191
- const m = !!s, f = {
1192
- variant: e,
1193
- size: t,
1194
- disabled: u,
1195
- error: m,
1196
- name: a,
1197
- value: r,
1198
- onChange: i,
1199
- fullWidth: l
1200
- }, h = React__default.Children.toArray(x), w = h.map((y, j) => {
1201
- if (React__default.isValidElement(y)) {
1202
- let b;
1203
- return h.length === 1 ? b = "single" : j === 0 ? b = "first" : j === h.length - 1 ? b = "last" : b = "middle", React__default.cloneElement(
1204
- y,
1205
- { position: b }
1206
- );
1207
- }
1208
- return y;
1209
- });
1210
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSingleInputContext.Provider, { value: f, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1211
- "div",
1212
- {
1213
- ref: d,
1214
- className: cn(l ? "w-full" : "", c),
1215
- ...g,
1216
- children: [
1217
- n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: n }),
1218
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1219
- "div",
1220
- {
1221
- className: cn(
1222
- segmentGroupVariants$1({
1223
- variant: m ? "danger" : e,
1224
- size: t,
1225
- error: m
1226
- }),
1227
- l ? "flex w-full" : ""
1228
- ),
1229
- children: w
1230
- }
1231
- ),
1232
- m && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
1233
- !m && o && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
1234
- ]
1235
- }
1236
- ) });
1237
- }
1238
- ), SegmentSingleInput = Object.assign(SegmentSingleInputRoot, {
1239
- Option: SegmentOption$1
1240
- }), segmentGroupVariants = cva(
1241
- "inline-flex rounded-lg border overflow-hidden bg-neutral/50 p-1",
1242
- {
1243
- variants: {
1244
- variant: {
1245
- // Core variants using Versaur color system
1246
- primary: "border-primary/20",
1247
- secondary: "border-secondary/20",
1248
- tertiary: "border-tertiary/20",
1249
- ghost: "border-ghost/20",
1250
- neutral: "border-gray-200",
1251
- // Outline variants
1252
- "primary-outline": "border-primary",
1253
- "secondary-outline": "border-secondary",
1254
- "tertiary-outline": "border-tertiary",
1255
- "ghost-outline": "border-ghost",
1256
- "neutral-outline": "border-gray-400",
1257
- // Semantic variants
1258
- success: "border-success/20",
1259
- "success-outline": "border-success",
1260
- info: "border-info/20",
1261
- "info-outline": "border-info",
1262
- warning: "border-warning/20",
1263
- "warning-outline": "border-warning",
1264
- danger: "border-danger/20",
1265
- "danger-outline": "border-danger"
1266
- },
1267
- size: {
1268
- sm: "text-xs",
1269
- md: "text-sm",
1270
- lg: "text-base"
1271
- },
1272
- error: {
1273
- true: "border-danger",
1274
- false: ""
1275
- }
1276
- },
1277
- defaultVariants: {
1278
- variant: "primary",
1279
- size: "md",
1280
- error: !1
1281
- }
1282
- }
1283
- ), segmentOptionVariants = cva(
1284
- "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",
1285
- {
1286
- variants: {
1287
- variant: {
1288
- // Core variants using Versaur color system
1289
- primary: "text-ghost hover:text-primary focus:ring-primary/30",
1290
- secondary: "text-ghost hover:text-secondary focus:ring-secondary/30",
1291
- tertiary: "text-ghost hover:text-tertiary focus:ring-tertiary/30",
1292
- ghost: "text-ghost hover:text-ghost focus:ring-ghost/30",
1293
- neutral: "text-ghost hover:text-gray-700 focus:ring-gray-400/30",
1294
- // Outline variants
1295
- "primary-outline": "text-primary hover:bg-primary/10 focus:ring-primary/30",
1296
- "secondary-outline": "text-secondary hover:bg-secondary/10 focus:ring-secondary/30",
1297
- "tertiary-outline": "text-tertiary hover:bg-tertiary/10 focus:ring-tertiary/30",
1298
- "ghost-outline": "text-ghost hover:bg-ghost/10 focus:ring-ghost/30",
1299
- "neutral-outline": "text-gray-600 hover:bg-gray-100 focus:ring-gray-500/30",
1300
- // Semantic variants
1301
- success: "text-ghost hover:text-success focus:ring-success/30",
1302
- "success-outline": "text-success hover:bg-success/10 focus:ring-success/30",
1303
- info: "text-ghost hover:text-info focus:ring-info/30",
1304
- "info-outline": "text-info hover:bg-info/10 focus:ring-info/30",
1305
- warning: "text-ghost hover:text-warning focus:ring-warning/30",
1306
- "warning-outline": "text-warning hover:bg-warning/10 focus:ring-warning/30",
1307
- danger: "text-ghost hover:text-danger focus:ring-danger/30",
1308
- "danger-outline": "text-danger hover:bg-danger/10 focus:ring-danger/30"
1309
- },
1310
- size: {
1311
- sm: "px-2 py-1.5 text-xs",
1312
- md: "px-3 py-2 text-sm",
1313
- lg: "px-4 py-2.5 text-base"
1314
- },
1315
- rounded: {
1316
- first: "rounded-l-md",
1317
- middle: "",
1318
- last: "rounded-r-md",
1319
- single: "rounded-md"
1320
- }
1321
- },
1322
- defaultVariants: {
1323
- variant: "primary",
1324
- size: "md",
1325
- rounded: "middle"
1326
- }
1327
- }
1328
- ), getSegmentSelectedClasses = (e) => {
1329
- const t = {
1330
- // Core variants - override hover text color changes
1331
- primary: "bg-primary text-white shadow-sm hover:text-white",
1332
- secondary: "bg-secondary text-white shadow-sm hover:text-white",
1333
- tertiary: "bg-tertiary text-white shadow-sm hover:text-white",
1334
- ghost: "bg-ghost text-white shadow-sm hover:text-white",
1335
- neutral: "bg-gray-500 text-white shadow-sm hover:text-white",
1336
- // Outline variants - override hover text color changes
1337
- "primary-outline": "bg-primary text-white shadow-sm hover:text-white",
1338
- "secondary-outline": "bg-secondary text-white shadow-sm hover:text-white",
1339
- "tertiary-outline": "bg-tertiary text-white shadow-sm hover:text-white",
1340
- "ghost-outline": "bg-ghost text-white shadow-sm hover:text-white",
1341
- "neutral-outline": "bg-gray-500 text-white shadow-sm hover:text-white",
1342
- // Semantic variants - override hover text color changes
1343
- success: "bg-success text-white shadow-sm hover:text-white",
1344
- "success-outline": "bg-success text-white shadow-sm hover:text-white",
1345
- info: "bg-info text-white shadow-sm hover:text-white",
1346
- "info-outline": "bg-info text-white shadow-sm hover:text-white",
1347
- warning: "bg-warning text-white shadow-sm hover:text-white",
1348
- "warning-outline": "bg-warning text-white shadow-sm hover:text-white",
1349
- danger: "bg-danger text-white shadow-sm hover:text-white",
1350
- "danger-outline": "bg-danger text-white shadow-sm hover:text-white"
1351
- };
1352
- return t[e || "primary"] || t.primary;
1353
- }, SegmentMultipleInputContext = createContext(null), useSegmentMultipleInputContext = () => {
1354
- const e = useContext(SegmentMultipleInputContext);
1355
- if (!e)
1356
- throw new Error(
1357
- "useSegmentMultipleInputContext must be used within SegmentMultipleInputContext"
1358
- );
1359
- return e;
1360
- }, SegmentOption = React__default.forwardRef(
1361
- ({ children: e, className: t, disabled: n, id: o, value: s, position: c = "middle", ...u }, a) => {
1362
- const r = useSegmentMultipleInputContext(), i = React__default.useId(), x = o || i, l = n || r.disabled, g = r.error ? "danger" : r.variant || "primary", d = r.value?.includes(s) ?? !1, m = (f) => {
1363
- if (!l) {
1364
- const h = r.value || [];
1365
- let w;
1366
- d ? w = h.filter((y) => y !== s) : w = [...h, s], r.onChange?.(w);
1367
- }
1368
- u.onChange?.(f);
1369
- };
1370
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1371
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1372
- "input",
1373
- {
1374
- ref: a,
1375
- type: "checkbox",
1376
- id: x,
1377
- name: `${r.name}[]`,
1378
- value: s,
1379
- checked: d,
1380
- disabled: l,
1381
- onChange: m,
1382
- className: "sr-only",
1383
- ...u
1384
- }
1385
- ),
1386
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1387
- "label",
1388
- {
1389
- htmlFor: x,
1390
- className: cn(
1391
- segmentOptionVariants({
1392
- variant: g,
1393
- size: r.size,
1394
- rounded: c
1395
- }),
1396
- // Apply selected state styling
1397
- d && getSegmentSelectedClasses(g),
1398
- d && "relative z-10",
1399
- // Apply disabled styling directly since labels don't support disabled attribute
1400
- l && "opacity-50 cursor-not-allowed pointer-events-none",
1401
- t
1402
- ),
1403
- children: e
1404
- }
1405
- )
1406
- ] });
1407
- }
1408
- );
1409
- SegmentOption.displayName = "SegmentOption";
1410
- const SegmentMultipleInputRoot = React__default.forwardRef(
1411
- ({
1412
- variant: e = "primary",
1413
- size: t = "md",
1414
- label: n,
1415
- helperText: o,
1416
- error: s,
1417
- className: c,
1418
- disabled: u,
1419
- name: a,
1420
- value: r = [],
1421
- onChange: i,
1422
- children: x,
1423
- fullWidth: l = !1,
1424
- ...g
1425
- }, d) => {
1426
- const m = !!s, f = {
1427
- variant: e,
1428
- size: t,
1429
- disabled: u,
1430
- error: m,
1431
- name: a,
1432
- value: r,
1433
- onChange: i
1434
- }, h = React__default.Children.toArray(x), w = h.map((y, j) => {
1435
- if (React__default.isValidElement(y)) {
1436
- let b;
1437
- return h.length === 1 ? b = "single" : j === 0 ? b = "first" : j === h.length - 1 ? b = "last" : b = "middle", React__default.cloneElement(
1438
- y,
1439
- { position: b }
1440
- );
1441
- }
1442
- return y;
1443
- });
1444
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentMultipleInputContext.Provider, { value: f, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1445
- "div",
1446
- {
1447
- ref: d,
1448
- className: cn(
1449
- l ? "flex w-full flex-col" : "w-full",
1450
- c
1451
- ),
1452
- ...g,
1453
- children: [
1454
- n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block text-sm font-medium text-foreground mb-3", children: n }),
1455
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1456
- "div",
1457
- {
1458
- className: cn(
1459
- segmentGroupVariants({
1460
- variant: m ? "danger" : e,
1461
- size: t,
1462
- error: m
1463
- }),
1464
- l && "flex w-full"
1465
- ),
1466
- children: w
1467
- }
1468
- ),
1469
- m && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-danger", role: "alert", children: s }),
1470
- !m && o && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-sm text-gray-600", children: o })
1471
- ]
1472
- }
1473
- ) });
1474
- }
1475
- ), SegmentMultipleInput = Object.assign(SegmentMultipleInputRoot, {
1476
- Option: SegmentOption
1477
- }), selectInputVariants = cva(
1478
- "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",
1479
- {
1480
- variants: {
1481
- variant: {
1482
- // Core variants using Versaur color system
1483
- primary: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
1484
- secondary: "border-secondary/30 text-foreground focus:border-secondary focus:ring-secondary/20",
1485
- tertiary: "border-tertiary/30 text-foreground focus:border-tertiary focus:ring-tertiary/20",
1486
- ghost: "border-ghost/30 text-foreground focus:border-ghost focus:ring-ghost/20",
1487
- neutral: "border-gray-300 text-foreground focus:border-gray-400 focus:ring-gray-400/20",
1488
- // Outline variants
1489
- "primary-outline": "border-primary text-foreground focus:border-primary focus:ring-primary/20",
1490
- "secondary-outline": "border-secondary text-foreground focus:border-secondary focus:ring-secondary/20",
1491
- "tertiary-outline": "border-tertiary text-foreground focus:border-tertiary focus:ring-tertiary/20",
1492
- "ghost-outline": "border-ghost text-foreground focus:border-ghost focus:ring-ghost/20",
1493
- "neutral-outline": "border-gray-400 text-foreground focus:border-gray-500 focus:ring-gray-500/20",
1494
- // Semantic variants
1495
- success: "border-success/30 text-foreground focus:border-success focus:ring-success/20",
1496
- "success-outline": "border-success text-foreground focus:border-success focus:ring-success/20",
1497
- info: "border-info/30 text-foreground focus:border-info focus:ring-info/20",
1498
- "info-outline": "border-info text-foreground focus:border-info focus:ring-info/20",
1499
- warning: "border-warning/30 text-foreground focus:border-warning focus:ring-warning/20",
1500
- "warning-outline": "border-warning text-foreground focus:border-warning focus:ring-warning/20",
1501
- danger: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
1502
- "danger-outline": "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20"
1503
- }
1504
- },
1505
- defaultVariants: {
1506
- variant: "primary"
1507
- }
1508
- }
1509
- ), SelectInput = React__default.forwardRef(
1510
- ({
1511
- variant: e = "primary",
1512
- label: t,
1513
- helperText: n,
1514
- error: o,
1515
- className: s,
1516
- disabled: c,
1517
- id: u,
1518
- placeholder: a,
1519
- children: r,
1520
- ...i
1521
- }, x) => {
1522
- const l = React__default.useId(), g = u || l, d = !!o;
1523
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1524
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1525
- "label",
1526
- {
1527
- htmlFor: g,
1528
- className: "block text-sm font-medium text-foreground mb-2",
1529
- children: t
1530
- }
1531
- ),
1532
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("relative w-full", s), children: [
1533
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1534
- "select",
1535
- {
1536
- ref: x,
1537
- id: g,
1538
- "aria-invalid": d,
1539
- "aria-disabled": c,
1540
- disabled: c,
1541
- className: cn(
1542
- selectInputVariants({
1543
- variant: d ? "danger" : e
1544
- }),
1545
- "h-10 pl-3"
1546
- ),
1547
- ...i,
1548
- children: [
1549
- a && /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", disabled: !0, hidden: !0, children: a }),
1550
- r
1551
- ]
1552
- }
1553
- ),
1554
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1555
- "svg",
1556
- {
1557
- className: "w-5 h-5 text-gray-400",
1558
- xmlns: "http://www.w3.org/2000/svg",
1559
- viewBox: "0 0 20 20",
1560
- fill: "currentColor",
1561
- "aria-hidden": "true",
1562
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1563
- "path",
1564
- {
1565
- fillRule: "evenodd",
1566
- 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",
1567
- clipRule: "evenodd"
1568
- }
1569
- )
1570
- }
1571
- ) })
1572
- ] }),
1573
- d && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: o }),
1574
- !d && n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-gray-600", children: n })
1575
- ] });
1576
- }
1577
- );
1578
- SelectInput.displayName = "SelectInput";
1579
- const textAreaInputVariants = cva(
1580
- "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",
1581
- {
1582
- variants: {
1583
- variant: {
1584
- // Core variants using Versaur color system
1585
- primary: "border-primary/30 text-foreground focus:border-primary focus:ring-primary/20",
1586
- secondary: "border-secondary/30 text-foreground focus:border-secondary focus:ring-secondary/20",
1587
- tertiary: "border-tertiary/30 text-foreground focus:border-tertiary focus:ring-tertiary/20",
1588
- ghost: "border-ghost/30 text-foreground focus:border-ghost focus:ring-ghost/20",
1589
- neutral: "border-gray-300 text-foreground focus:border-gray-400 focus:ring-gray-400/20",
1590
- // Outline variants
1591
- "primary-outline": "border-primary text-foreground focus:border-primary focus:ring-primary/20",
1592
- "secondary-outline": "border-secondary text-foreground focus:border-secondary focus:ring-secondary/20",
1593
- "tertiary-outline": "border-tertiary text-foreground focus:border-tertiary focus:ring-tertiary/20",
1594
- "ghost-outline": "border-ghost text-foreground focus:border-ghost focus:ring-ghost/20",
1595
- "neutral-outline": "border-gray-400 text-foreground focus:border-gray-500 focus:ring-gray-500/20",
1596
- // Semantic variants
1597
- success: "border-success/30 text-foreground focus:border-success focus:ring-success/20",
1598
- "success-outline": "border-success text-foreground focus:border-success focus:ring-success/20",
1599
- info: "border-info/30 text-foreground focus:border-info focus:ring-info/20",
1600
- "info-outline": "border-info text-foreground focus:border-info focus:ring-info/20",
1601
- warning: "border-warning/30 text-foreground focus:border-warning focus:ring-warning/20",
1602
- "warning-outline": "border-warning text-foreground focus:border-warning focus:ring-warning/20",
1603
- danger: "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20",
1604
- "danger-outline": "border-danger bg-danger/5 text-foreground focus:border-danger focus:ring-danger/20"
1605
- },
1606
- fieldSizing: {
1607
- content: "field-sizing-content resize-none",
1608
- fixed: "resize-y"
1609
- }
1610
- },
1611
- defaultVariants: {
1612
- variant: "primary",
1613
- fieldSizing: "fixed"
1614
- }
1615
- }
1616
- ), TextAreaInput = React__default.forwardRef(
1617
- ({
1618
- variant: e = "primary",
1619
- label: t,
1620
- helperText: n,
1621
- error: o,
1622
- className: s,
1623
- disabled: c,
1624
- id: u,
1625
- minRows: a = 3,
1626
- maxRows: r,
1627
- fieldSizing: i = "fixed",
1628
- style: x,
1629
- rows: l,
1630
- ...g
1631
- }, d) => {
1632
- const m = React__default.useId(), f = u || m, h = !!o, w = l || a, y = i === "content" ? void 0 : r, j = {
1633
- ...i === "content" && { fieldSizing: "content" },
1634
- ...y && {
1635
- maxHeight: `${y * 1.5}rem`
1636
- // Approximate line height
1637
- },
1638
- ...x
1639
- };
1640
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
1641
- t && /* @__PURE__ */ jsxRuntimeExports.jsx(
1642
- "label",
1643
- {
1644
- htmlFor: f,
1645
- className: "block text-sm font-medium text-foreground mb-2",
1646
- children: t
1647
- }
1648
- ),
1649
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("relative w-full", s), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1650
- "textarea",
1651
- {
1652
- ref: d,
1653
- id: f,
1654
- rows: w,
1655
- "aria-invalid": h,
1656
- "aria-disabled": c,
1657
- disabled: c,
1658
- style: j,
1659
- className: cn(
1660
- textAreaInputVariants({
1661
- variant: h ? "danger" : e,
1662
- fieldSizing: i
1663
- }),
1664
- "px-3 py-2"
1665
- ),
1666
- ...g
1667
- }
1668
- ) }),
1669
- h && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-danger", role: "alert", children: o }),
1670
- !h && n && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-sm text-gray-600", children: n })
1671
- ] });
1672
- }
1673
- );
1674
- TextAreaInput.displayName = "TextAreaInput";
1675
- const timeSegmentButtonVariants = cva(
1676
- "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",
1677
- {
1678
- variants: {
1679
- active: {
1680
- true: "bg-primary text-white",
1681
- false: "bg-neutral text-foreground"
1682
- },
1683
- size: {
1684
- sm: "h-8 px-3 text-sm",
1685
- md: "h-10 px-4 text-base",
1686
- lg: "h-12 px-6 text-lg"
1687
- }
1688
- },
1689
- defaultVariants: {
1690
- active: !1,
1691
- size: "md"
1692
- }
1693
- }
1694
- ), TimeField = ({
1695
- value: e,
1696
- onChange: t,
1697
- label: n,
1698
- "aria-label": o,
1699
- disabled: s
1700
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1701
- "input",
1702
- {
1703
- type: "text",
1704
- inputMode: "numeric",
1705
- pattern: "[0-9]*",
1706
- maxLength: 2,
1707
- value: e,
1708
- onChange: (c) => t(c.target.value),
1709
- className: "w-12 h-12 text-center text-2xl border-b-2 border-primary bg-transparent focus:outline-none focus:border-primary",
1710
- "aria-label": o || n,
1711
- disabled: s,
1712
- autoComplete: "off"
1713
- }
1714
- ), AmPmSegment = ({
1715
- value: e,
1716
- onChange: t,
1717
- disabled: n
1718
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 ml-4", children: ["AM", "PM"].map((o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1719
- "button",
1720
- {
1721
- type: "button",
1722
- className: cn(
1723
- timeSegmentButtonVariants({
1724
- active: e === o,
1725
- size: "sm"
1726
- })
1727
- ),
1728
- "aria-pressed": e === o,
1729
- onClick: () => t(o),
1730
- disabled: n,
1731
- children: o
1732
- },
1733
- o
1734
- )) }), TimePickerInput = ({
1735
- value: e,
1736
- onChange: t,
1737
- label: n,
1738
- helperText: o,
1739
- disabled: s,
1740
- error: c,
1741
- placement: u,
1742
- "aria-label": a,
1743
- "aria-labelledby": r,
1744
- "aria-describedby": i
1745
- }) => {
1746
- const [x, l] = useState(!1), g = (k) => {
1747
- const p = k.match(/^(\d{1,2}):(\d{2})\s?(AM|PM)$/i);
1748
- return p ? {
1749
- hour: p[1],
1750
- minute: p[2],
1751
- period: p[3].toUpperCase()
1752
- } : { hour: "", minute: "", period: "AM" };
1753
- }, [{ hour: d, minute: m, period: f }, h] = useState(() => g(e)), w = () => {
1754
- s || (h(g(e)), l(!0));
1755
- }, y = (k) => {
1756
- let p = k.replace(/[^\d]/g, "");
1757
- p.length > 2 && (p = p.slice(0, 2)), Number(p) > 12 && (p = "12"), h((E) => ({ ...E, hour: p }));
1758
- }, j = (k) => {
1759
- let p = k.replace(/[^\d]/g, "");
1760
- p.length > 2 && (p = p.slice(0, 2)), Number(p) > 59 && (p = "59"), h((E) => ({ ...E, minute: p }));
1761
- }, b = (k) => {
1762
- h((p) => ({ ...p, period: k }));
1763
- }, C = () => {
1764
- h(g(e)), l(!1);
1765
- }, I = () => {
1766
- const k = d.padStart(2, "0") || "12", p = m.padStart(2, "0") || "00";
1767
- t(`${k}:${p} ${f}`), l(!1);
1768
- };
1769
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1770
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1771
- TextInput,
1772
- {
1773
- label: n,
1774
- value: e,
1775
- onClick: w,
1776
- readOnly: !0,
1777
- disabled: s,
1778
- error: c,
1779
- helperText: o,
1780
- "aria-label": a,
1781
- "aria-labelledby": r,
1782
- "aria-describedby": i,
1783
- className: "cursor-pointer bg-white",
1784
- rightContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { as: Clock, size: "sm", color: "ghost" })
1785
- }
1786
- ),
1787
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1788
- Modal,
1789
- {
1790
- isOpen: x,
1791
- onOpenChange: l,
1792
- placement: u,
1793
- size: "sm",
1794
- "aria-label": a,
1795
- "aria-labelledby": r,
1796
- "aria-describedby": i,
1797
- children: [
1798
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Header, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "lg", fontWeight: "semibold", children: "Select time" }) }),
1799
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal.Body, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-center py-2", children: [
1800
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1801
- TimeField,
1802
- {
1803
- value: d,
1804
- onChange: y,
1805
- label: "Hour",
1806
- "aria-label": "Hour",
1807
- disabled: s
1808
- }
1809
- ),
1810
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "2xl", className: "select-none", children: ":" }),
1811
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1812
- TimeField,
1813
- {
1814
- value: m,
1815
- onChange: j,
1816
- label: "Minute",
1817
- "aria-label": "Minute",
1818
- disabled: s
1819
- }
1820
- ),
1821
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1822
- AmPmSegment,
1823
- {
1824
- value: f === "AM" ? "AM" : "PM",
1825
- onChange: b,
1826
- disabled: s
1827
- }
1828
- )
1829
- ] }) }),
1830
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal.Footer, { children: [
1831
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "md", onClick: C, children: "Cancel" }),
1832
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "primary", size: "md", onClick: I, children: "Confirm" })
1833
- ] })
1834
- ]
1835
- }
1836
- )
1837
- ] });
1838
- }, switchVariants = cva(
1839
- "relative inline-flex items-center transition-colors duration-200 border border-transparent",
1840
- {
1841
- variants: {
1842
- color: {
1843
- primary: "",
1844
- secondary: "",
1845
- tertiary: "",
1846
- ghost: "",
1847
- neutral: "",
1848
- success: "",
1849
- info: "",
1850
- warning: "",
1851
- danger: ""
1852
- },
1853
- size: {
1854
- sm: "h-4 w-8",
1855
- md: "h-5 w-10",
1856
- lg: "h-6 w-12"
1857
- },
1858
- disabled: {
1859
- true: "opacity-50 cursor-not-allowed",
1860
- false: ""
1861
- },
1862
- checked: {
1863
- true: "",
1864
- false: ""
1865
- }
1866
- },
1867
- defaultVariants: {
1868
- color: "primary",
1869
- size: "md",
1870
- disabled: !1,
1871
- checked: !1
1872
- },
1873
- compoundVariants: [
1874
- {
1875
- checked: !0,
1876
- color: "primary",
1877
- class: "bg-primary"
1878
- },
1879
- {
1880
- checked: !0,
1881
- color: "secondary",
1882
- class: "bg-secondary"
1883
- },
1884
- { checked: !0, color: "tertiary", class: "bg-tertiary" },
1885
- { checked: !0, color: "ghost", class: "bg-ghost" },
1886
- { checked: !0, color: "neutral", class: "bg-neutral" },
1887
- { checked: !0, color: "success", class: "bg-success" },
1888
- { checked: !0, color: "info", class: "bg-info" },
1889
- { checked: !0, color: "warning", class: "bg-warning" },
1890
- { checked: !0, color: "danger", class: "bg-danger" },
1891
- { checked: !1, class: "bg-white border-border" }
1892
- ]
1893
- }
1894
- ), thumbVariants = cva(
1895
- "absolute rounded-full transition-transform duration-200",
1896
- {
1897
- variants: {
1898
- size: {
1899
- sm: "h-3 w-3",
1900
- md: "h-4 w-4",
1901
- lg: "h-5 w-5"
1902
- },
1903
- checked: {
1904
- true: "translate-x-full bg-white left-1.5",
1905
- false: "bg-neutral left-0.5"
1906
- }
1907
- },
1908
- defaultVariants: {
1909
- size: "md",
1910
- checked: !1
1911
- }
1912
- }
1913
- ), SwitchTrack = ({
1914
- color: e = "primary",
1915
- size: t = "md",
1916
- disabled: n = !1,
1917
- className: o,
1918
- checked: s
1919
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
1920
- "span",
1921
- {
1922
- className: cn(
1923
- switchVariants({ color: e, size: t, disabled: n, checked: s }),
1924
- "rounded-full pointer-events-none",
1925
- o
1926
- ),
1927
- "aria-hidden": "true"
1928
- }
1929
- ), 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: n = "top", disabled: o = !1 }) => e ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1930
- "label",
1931
- {
1932
- htmlFor: t,
1933
- className: cn(
1934
- "text-sm select-none font-medium text-foreground",
1935
- n === "inline" ? "ml-2 mb-0" : "mb-1",
1936
- o && "opacity-50 cursor-not-allowed"
1937
- ),
1938
- children: e
1939
- }
1940
- ) : null, SwitchInput = React__default.forwardRef(
1941
- ({
1942
- checked: e,
1943
- defaultChecked: t,
1944
- onCheckedChange: n,
1945
- color: o = "primary",
1946
- size: s = "md",
1947
- label: c,
1948
- labelPlacement: u = "top",
1949
- disabled: a = !1,
1950
- className: r,
1951
- id: i,
1952
- ariaLabel: x,
1953
- ...l
1954
- }, g) => {
1955
- const [d, m] = useState(
1956
- t ?? !1
1957
- ), f = useId(), h = i || f, w = typeof e == "boolean", y = w ? e : d, j = (b) => {
1958
- w || m(b.target.checked), n?.(b.target.checked);
1959
- };
1960
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1961
- "div",
1962
- {
1963
- className: cn(
1964
- "flex flex-col",
1965
- u === "inline" && "flex-row items-center",
1966
- r
1967
- ),
1968
- children: [
1969
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1970
- SwitchLabel,
1971
- {
1972
- label: c,
1973
- htmlFor: h,
1974
- placement: u,
1975
- disabled: a
1976
- }
1977
- ),
1978
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
1979
- "span",
1980
- {
1981
- className: cn(
1982
- "relative flex items-center",
1983
- u === "inline" && "ml-2"
1984
- ),
1985
- children: [
1986
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1987
- "input",
1988
- {
1989
- ref: g,
1990
- type: "checkbox",
1991
- id: h,
1992
- "aria-label": x || c,
1993
- checked: y,
1994
- disabled: a,
1995
- onChange: j,
1996
- className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer z-10",
1997
- ...l
1998
- }
1999
- ),
2000
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2001
- SwitchTrack,
2002
- {
2003
- color: o,
2004
- size: s,
2005
- disabled: a,
2006
- checked: y
2007
- }
2008
- ),
2009
- /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchThumb, { size: s, checked: y })
2010
- ]
2011
- }
2012
- )
2013
- ]
2014
- }
2015
- );
2016
- }
2017
- );
2018
- SwitchInput.displayName = "SwitchInput";
2019
- export {
2020
- CalculatorInput as C,
2021
- DateSinglePickerInput as D,
2022
- RadioInput as R,
2023
- SegmentSingleInput as S,
2024
- TextInput as T,
2025
- CheckboxInput as a,
2026
- ChipInput as b,
2027
- SegmentMultipleInput as c,
2028
- SelectInput as d,
2029
- TextAreaInput as e,
2030
- TimePickerInput as f,
2031
- SwitchInput as g,
2032
- SwitchTrack as h,
2033
- SwitchThumb as i,
2034
- SwitchLabel as j
2035
- };