@caffeinebounce/ui 0.62.2

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 (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -0
  3. package/dist/FinancialStatementTable-BNUrdTU4.d.cts +249 -0
  4. package/dist/FinancialStatementTable-BNUrdTU4.d.ts +249 -0
  5. package/dist/NewsletterSignup-BPreFi5W.d.cts +37 -0
  6. package/dist/NewsletterSignup-BPreFi5W.d.ts +37 -0
  7. package/dist/TestimonialsSection-DtPu2OeR.d.ts +736 -0
  8. package/dist/TestimonialsSection-z-yotRfv.d.cts +736 -0
  9. package/dist/UnifiedTableControls-CG299y9h.d.ts +1233 -0
  10. package/dist/UnifiedTableControls-CIjRpNhy.d.cts +1233 -0
  11. package/dist/blog.d.cts +99 -0
  12. package/dist/blog.d.ts +99 -0
  13. package/dist/blog.js +292 -0
  14. package/dist/blog.mjs +279 -0
  15. package/dist/button-BHnoRUkF.d.cts +34 -0
  16. package/dist/button-BHnoRUkF.d.ts +34 -0
  17. package/dist/charts.d.cts +80 -0
  18. package/dist/charts.d.ts +80 -0
  19. package/dist/charts.js +19 -0
  20. package/dist/charts.mjs +2 -0
  21. package/dist/chunk-33JR5SYE.js +44 -0
  22. package/dist/chunk-3NDB4YPC.js +247 -0
  23. package/dist/chunk-5RW4PYZ6.js +1504 -0
  24. package/dist/chunk-5THF4YP6.mjs +155 -0
  25. package/dist/chunk-6BUBNZPG.mjs +164 -0
  26. package/dist/chunk-6DVWMJ3H.mjs +7029 -0
  27. package/dist/chunk-6TGV2DNP.js +120 -0
  28. package/dist/chunk-72JGQ7IJ.mjs +1498 -0
  29. package/dist/chunk-7DHKQODW.mjs +2932 -0
  30. package/dist/chunk-7IKHZKAC.js +160 -0
  31. package/dist/chunk-ADIDI7AJ.js +11 -0
  32. package/dist/chunk-BFWX5GJZ.mjs +940 -0
  33. package/dist/chunk-BMFQG6RA.mjs +5537 -0
  34. package/dist/chunk-C4UT5V3P.js +65 -0
  35. package/dist/chunk-CC4KUIKC.js +2004 -0
  36. package/dist/chunk-D3QXPL47.mjs +1814 -0
  37. package/dist/chunk-DQWHYBV2.js +36 -0
  38. package/dist/chunk-E42B4GSB.js +993 -0
  39. package/dist/chunk-ESZ7CBA2.js +1007 -0
  40. package/dist/chunk-EYJJQVV4.js +111 -0
  41. package/dist/chunk-FRRS2YZH.mjs +129 -0
  42. package/dist/chunk-G5TQWWQA.mjs +37 -0
  43. package/dist/chunk-GAIQJCAZ.js +5612 -0
  44. package/dist/chunk-GMBGWOCR.mjs +48 -0
  45. package/dist/chunk-GUSTCU2W.mjs +105 -0
  46. package/dist/chunk-HBLKVQIQ.mjs +23 -0
  47. package/dist/chunk-HMAMMC72.js +26 -0
  48. package/dist/chunk-IMKLN273.mjs +9 -0
  49. package/dist/chunk-J6OLBSZR.js +250 -0
  50. package/dist/chunk-JAE45W2T.js +28 -0
  51. package/dist/chunk-JORVSG52.js +606 -0
  52. package/dist/chunk-KB7UXIQZ.mjs +984 -0
  53. package/dist/chunk-KGGQ5NZV.js +186 -0
  54. package/dist/chunk-KHCC5UKW.mjs +22 -0
  55. package/dist/chunk-KRRIRS6A.mjs +1945 -0
  56. package/dist/chunk-LQCVRWVF.js +48 -0
  57. package/dist/chunk-MHZXUOGN.mjs +168 -0
  58. package/dist/chunk-MPZFPU4X.js +349 -0
  59. package/dist/chunk-MVYRNJA6.js +74 -0
  60. package/dist/chunk-N6AFNFZR.mjs +565 -0
  61. package/dist/chunk-OFQLWSUR.mjs +214 -0
  62. package/dist/chunk-OLAAXLXY.mjs +219 -0
  63. package/dist/chunk-OZZWDIOY.js +1859 -0
  64. package/dist/chunk-PZRI43EZ.js +111 -0
  65. package/dist/chunk-Q256HRYD.js +176 -0
  66. package/dist/chunk-Q52ZEL62.mjs +223 -0
  67. package/dist/chunk-R26Y7LGJ.js +142 -0
  68. package/dist/chunk-RBUYW6QQ.js +39 -0
  69. package/dist/chunk-RVEFPVZF.mjs +43 -0
  70. package/dist/chunk-SORWLKOK.js +96 -0
  71. package/dist/chunk-STEP6C4C.mjs +33 -0
  72. package/dist/chunk-T5R6HUDG.mjs +22 -0
  73. package/dist/chunk-T6ZBA6VJ.js +7109 -0
  74. package/dist/chunk-UM7WMXIU.js +2995 -0
  75. package/dist/chunk-VBD4Q5LL.mjs +117 -0
  76. package/dist/chunk-WOITB4JL.js +195 -0
  77. package/dist/chunk-YKZEKJMZ.mjs +71 -0
  78. package/dist/chunk-YL7RZRHM.mjs +103 -0
  79. package/dist/chunk-YSLD2HLP.mjs +346 -0
  80. package/dist/chunk-ZFLZA7UP.mjs +140 -0
  81. package/dist/chunk-ZKUIUE7W.mjs +26 -0
  82. package/dist/chunk-ZOA7B32D.js +248 -0
  83. package/dist/data-table.d.cts +46 -0
  84. package/dist/data-table.d.ts +46 -0
  85. package/dist/data-table.js +270 -0
  86. package/dist/data-table.mjs +13 -0
  87. package/dist/editor.d.cts +89 -0
  88. package/dist/editor.d.ts +89 -0
  89. package/dist/editor.js +10 -0
  90. package/dist/editor.mjs +1 -0
  91. package/dist/forms.d.cts +142 -0
  92. package/dist/forms.d.ts +142 -0
  93. package/dist/forms.js +24 -0
  94. package/dist/forms.mjs +11 -0
  95. package/dist/hooks-8ORd7T1A.d.cts +751 -0
  96. package/dist/hooks-B2jU1GVT.d.ts +751 -0
  97. package/dist/hooks.d.cts +6 -0
  98. package/dist/hooks.d.ts +6 -0
  99. package/dist/hooks.js +99 -0
  100. package/dist/hooks.mjs +10 -0
  101. package/dist/index.d.cts +3141 -0
  102. package/dist/index.d.ts +3141 -0
  103. package/dist/index.js +7332 -0
  104. package/dist/index.mjs +5876 -0
  105. package/dist/layouts-DPfDDF53.d.cts +1001 -0
  106. package/dist/layouts-DPfDDF53.d.ts +1001 -0
  107. package/dist/layouts.d.cts +4 -0
  108. package/dist/layouts.d.ts +4 -0
  109. package/dist/layouts.js +100 -0
  110. package/dist/layouts.mjs +11 -0
  111. package/dist/marketing-3d.d.cts +51 -0
  112. package/dist/marketing-3d.d.ts +51 -0
  113. package/dist/marketing-3d.js +553 -0
  114. package/dist/marketing-3d.mjs +526 -0
  115. package/dist/marketing.d.cts +583 -0
  116. package/dist/marketing.d.ts +583 -0
  117. package/dist/marketing.js +299 -0
  118. package/dist/marketing.mjs +10 -0
  119. package/dist/media.d.cts +29 -0
  120. package/dist/media.d.ts +29 -0
  121. package/dist/media.js +189 -0
  122. package/dist/media.mjs +182 -0
  123. package/dist/navigation.d.cts +591 -0
  124. package/dist/navigation.d.ts +591 -0
  125. package/dist/navigation.js +108 -0
  126. package/dist/navigation.mjs +15 -0
  127. package/dist/portal.d.cts +58 -0
  128. package/dist/portal.d.ts +58 -0
  129. package/dist/portal.js +403 -0
  130. package/dist/portal.mjs +395 -0
  131. package/dist/primitives.d.cts +508 -0
  132. package/dist/primitives.d.ts +508 -0
  133. package/dist/primitives.js +295 -0
  134. package/dist/primitives.mjs +14 -0
  135. package/dist/settings.d.cts +216 -0
  136. package/dist/settings.d.ts +216 -0
  137. package/dist/settings.js +34 -0
  138. package/dist/settings.mjs +9 -0
  139. package/dist/shared-Dqn36QHZ.d.cts +4 -0
  140. package/dist/shared-Dqn36QHZ.d.ts +4 -0
  141. package/dist/styles.css +1213 -0
  142. package/package.json +189 -0
  143. package/styles.css +1 -0
@@ -0,0 +1,565 @@
1
+ import { Label } from './chunk-KHCC5UKW.mjs';
2
+ import { Separator } from './chunk-ZKUIUE7W.mjs';
3
+ import { cn } from './chunk-IMKLN273.mjs';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { OTPInput, OTPInputContext } from 'input-otp';
6
+ import { EyeOffIcon, EyeIcon, MinusIcon, CheckIcon, CheckCircle2Icon, InfoIcon } from 'lucide-react';
7
+ import * as React2 from 'react';
8
+ import { useMemo, useState, useRef, useEffect } from 'react';
9
+ import { cva } from 'class-variance-authority';
10
+
11
+ function Textarea({ className, ...props }) {
12
+ return /* @__PURE__ */ jsx(
13
+ "textarea",
14
+ {
15
+ "data-slot": "textarea",
16
+ className: cn(
17
+ "border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex min-h-16 w-full min-w-0 max-w-full rounded-box border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm break-words [overflow-wrap:anywhere]",
18
+ className
19
+ ),
20
+ ...props
21
+ }
22
+ );
23
+ }
24
+ function InputOTP({
25
+ className,
26
+ containerClassName,
27
+ ...props
28
+ }) {
29
+ return /* @__PURE__ */ jsx(
30
+ OTPInput,
31
+ {
32
+ "data-slot": "input-otp",
33
+ containerClassName: cn(
34
+ "flex items-center gap-2 has-disabled:opacity-50",
35
+ containerClassName
36
+ ),
37
+ className: cn("disabled:cursor-not-allowed", className),
38
+ ...props
39
+ }
40
+ );
41
+ }
42
+ function InputOTPGroup({ className, ...props }) {
43
+ return /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ "data-slot": "input-otp-group",
47
+ className: cn("flex items-center", className),
48
+ ...props
49
+ }
50
+ );
51
+ }
52
+ function InputOTPSlot({
53
+ index,
54
+ className,
55
+ ...props
56
+ }) {
57
+ const inputOTPContext = React2.useContext(OTPInputContext);
58
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
59
+ return /* @__PURE__ */ jsxs(
60
+ "div",
61
+ {
62
+ "data-slot": "input-otp-slot",
63
+ "data-active": isActive,
64
+ className: cn(
65
+ "relative flex h-14 w-12 items-center justify-center border border-input bg-background text-xl font-semibold shadow-sm transition-all outline-none",
66
+ "first:rounded-l-lg last:rounded-r-lg -ml-px first:ml-0",
67
+ isActive && "z-10 ring-2 ring-ring ring-offset-2 ring-offset-background",
68
+ className
69
+ ),
70
+ ...props,
71
+ children: [
72
+ char,
73
+ hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-6 w-px animate-caret-blink bg-foreground duration-1000" }) })
74
+ ]
75
+ }
76
+ );
77
+ }
78
+ function InputOTPSeparator({ ...props }) {
79
+ return /* @__PURE__ */ jsx("div", { "data-slot": "input-otp-separator", "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx(MinusIcon, { className: "h-4 w-4 text-muted-foreground" }) });
80
+ }
81
+ function Checkbox({
82
+ className,
83
+ checked,
84
+ onCheckedChange,
85
+ disabled,
86
+ ...props
87
+ }) {
88
+ return /* @__PURE__ */ jsx(
89
+ "label",
90
+ {
91
+ className: cn(
92
+ "inline-flex items-center",
93
+ disabled && "opacity-50 cursor-not-allowed"
94
+ ),
95
+ children: /* @__PURE__ */ jsxs("span", { className: "relative", children: [
96
+ /* @__PURE__ */ jsx(
97
+ "input",
98
+ {
99
+ type: "checkbox",
100
+ checked,
101
+ disabled,
102
+ onChange: (e) => onCheckedChange?.(e.target.checked),
103
+ className: "peer sr-only",
104
+ ...props
105
+ }
106
+ ),
107
+ /* @__PURE__ */ jsx(
108
+ "span",
109
+ {
110
+ "data-slot": "checkbox",
111
+ className: cn(
112
+ "border-input bg-background peer-focus-visible:ring-ring/50 peer-focus-visible:ring-[3px] flex size-4 shrink-0 items-center justify-center rounded-sm border shadow-xs transition-colors",
113
+ "peer-checked:bg-primary peer-checked:border-primary peer-checked:text-primary-foreground",
114
+ "peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
115
+ className
116
+ ),
117
+ children: checked && /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5 stroke-3" })
118
+ }
119
+ )
120
+ ] })
121
+ }
122
+ );
123
+ }
124
+ function FieldSet({ className, ...props }) {
125
+ return /* @__PURE__ */ jsx(
126
+ "fieldset",
127
+ {
128
+ "data-slot": "field-set",
129
+ className: cn(
130
+ "flex flex-col gap-6",
131
+ "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
132
+ className
133
+ ),
134
+ ...props
135
+ }
136
+ );
137
+ }
138
+ function FieldLegend({
139
+ className,
140
+ variant = "legend",
141
+ ...props
142
+ }) {
143
+ return /* @__PURE__ */ jsx(
144
+ "legend",
145
+ {
146
+ "data-slot": "field-legend",
147
+ "data-variant": variant,
148
+ className: cn(
149
+ "mb-3 font-medium",
150
+ "data-[variant=legend]:text-base",
151
+ "data-[variant=label]:text-sm",
152
+ className
153
+ ),
154
+ ...props
155
+ }
156
+ );
157
+ }
158
+ function FieldGroup({ className, ...props }) {
159
+ return /* @__PURE__ */ jsx(
160
+ "div",
161
+ {
162
+ "data-slot": "field-group",
163
+ className: cn(
164
+ "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
165
+ className
166
+ ),
167
+ ...props
168
+ }
169
+ );
170
+ }
171
+ var fieldVariants = cva(
172
+ "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
173
+ {
174
+ variants: {
175
+ orientation: {
176
+ vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
177
+ horizontal: [
178
+ "flex-row items-center",
179
+ "[&>[data-slot=field-label]]:flex-auto",
180
+ "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
181
+ ],
182
+ responsive: [
183
+ "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
184
+ "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
185
+ "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
186
+ ]
187
+ }
188
+ },
189
+ defaultVariants: {
190
+ orientation: "vertical"
191
+ }
192
+ }
193
+ );
194
+ function Field({
195
+ className,
196
+ orientation = "vertical",
197
+ ...props
198
+ }) {
199
+ return /* @__PURE__ */ jsx(
200
+ "fieldset",
201
+ {
202
+ "data-slot": "field",
203
+ "data-orientation": orientation,
204
+ className: cn(fieldVariants({ orientation }), className),
205
+ ...props
206
+ }
207
+ );
208
+ }
209
+ function FieldContent({ className, ...props }) {
210
+ return /* @__PURE__ */ jsx(
211
+ "div",
212
+ {
213
+ "data-slot": "field-content",
214
+ className: cn(
215
+ "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
216
+ className
217
+ ),
218
+ ...props
219
+ }
220
+ );
221
+ }
222
+ function FieldLabel({
223
+ className,
224
+ ...props
225
+ }) {
226
+ return /* @__PURE__ */ jsx(
227
+ Label,
228
+ {
229
+ "data-slot": "field-label",
230
+ className: cn(
231
+ "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
232
+ "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-box has-[>[data-slot=field]]:border *:data-[slot=field]:p-4",
233
+ "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
234
+ className
235
+ ),
236
+ ...props
237
+ }
238
+ );
239
+ }
240
+ function FieldTitle({ className, ...props }) {
241
+ return /* @__PURE__ */ jsx(
242
+ "div",
243
+ {
244
+ "data-slot": "field-label",
245
+ className: cn(
246
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
247
+ className
248
+ ),
249
+ ...props
250
+ }
251
+ );
252
+ }
253
+ function FieldDescription({ className, ...props }) {
254
+ return /* @__PURE__ */ jsx(
255
+ "p",
256
+ {
257
+ "data-slot": "field-description",
258
+ className: cn(
259
+ "text-muted-foreground text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance",
260
+ "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
261
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
262
+ className
263
+ ),
264
+ ...props
265
+ }
266
+ );
267
+ }
268
+ function FieldSeparator({
269
+ children,
270
+ className,
271
+ ...props
272
+ }) {
273
+ return /* @__PURE__ */ jsxs(
274
+ "div",
275
+ {
276
+ "data-slot": "field-separator",
277
+ "data-content": !!children,
278
+ className: cn(
279
+ "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
280
+ className
281
+ ),
282
+ ...props,
283
+ children: [
284
+ /* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
285
+ children && /* @__PURE__ */ jsx(
286
+ "span",
287
+ {
288
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
289
+ "data-slot": "field-separator-content",
290
+ children
291
+ }
292
+ )
293
+ ]
294
+ }
295
+ );
296
+ }
297
+ function FieldError({
298
+ className,
299
+ children,
300
+ errors,
301
+ ...props
302
+ }) {
303
+ const content = useMemo(() => {
304
+ if (children) {
305
+ return children;
306
+ }
307
+ if (!errors?.length) {
308
+ return null;
309
+ }
310
+ const uniqueErrors = [
311
+ ...new Map(errors.map((error) => [error?.message, error])).values()
312
+ ];
313
+ if (uniqueErrors?.length === 1) {
314
+ return uniqueErrors[0]?.message;
315
+ }
316
+ return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
317
+ (error) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, error.message)
318
+ ) });
319
+ }, [children, errors]);
320
+ if (!content) {
321
+ return null;
322
+ }
323
+ return /* @__PURE__ */ jsx(
324
+ "div",
325
+ {
326
+ role: "alert",
327
+ "data-slot": "field-error",
328
+ className: cn("text-destructive text-xs font-normal -mt-2.5", className),
329
+ ...props,
330
+ children: content
331
+ }
332
+ );
333
+ }
334
+ var PasswordInput = React2.forwardRef(({ className, ...props }, ref) => {
335
+ const [showPassword, setShowPassword] = React2.useState(false);
336
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
337
+ /* @__PURE__ */ jsx(
338
+ "input",
339
+ {
340
+ ref,
341
+ type: showPassword ? "text" : "password",
342
+ "data-slot": "input",
343
+ "data-autofill-aware": "true",
344
+ className: cn(
345
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-box border bg-transparent px-3 py-1 pr-10 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
346
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
347
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
348
+ className
349
+ ),
350
+ ...props
351
+ }
352
+ ),
353
+ /* @__PURE__ */ jsx(
354
+ "button",
355
+ {
356
+ type: "button",
357
+ onClick: () => setShowPassword(!showPassword),
358
+ className: "text-muted-foreground hover:text-foreground absolute right-0 top-0 flex h-9 w-10 items-center justify-center rounded-r-box transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
359
+ tabIndex: -1,
360
+ "aria-label": showPassword ? "Hide password" : "Show password",
361
+ children: showPassword ? /* @__PURE__ */ jsx(EyeOffIcon, { className: "h-4 w-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(EyeIcon, { className: "h-4 w-4", "aria-hidden": "true" })
362
+ }
363
+ )
364
+ ] });
365
+ });
366
+ PasswordInput.displayName = "PasswordInput";
367
+ var defaultPasswordRules = [
368
+ {
369
+ id: "min-length",
370
+ label: "Must be at least 8 characters long",
371
+ validator: (password) => password.length >= 8
372
+ },
373
+ {
374
+ id: "uppercase",
375
+ label: "Must contain an uppercase letter",
376
+ validator: (password) => /[A-Z]/.test(password)
377
+ },
378
+ {
379
+ id: "special",
380
+ label: "Must contain a special character",
381
+ validator: (password) => /[!@#$%^&*(),.?":{}|<>]/.test(password)
382
+ }
383
+ ];
384
+ var extendedPasswordRules = [...defaultPasswordRules];
385
+ function PasswordRequirements({
386
+ password,
387
+ rules = defaultPasswordRules,
388
+ className,
389
+ ...props
390
+ }) {
391
+ return /* @__PURE__ */ jsx("ul", { className: cn("flex flex-col gap-1.5 text-xs", className), ...props, children: rules.map((rule) => {
392
+ const isMet = password.length > 0 && rule.validator(password);
393
+ return /* @__PURE__ */ jsxs(
394
+ "li",
395
+ {
396
+ className: cn(
397
+ "flex items-center gap-1.5 transition-colors duration-200",
398
+ isMet ? "text-green-600" : "text-muted-foreground"
399
+ ),
400
+ children: [
401
+ isMet ? /* @__PURE__ */ jsx(CheckCircle2Icon, { className: "h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx(InfoIcon, { className: "h-3.5 w-3.5 shrink-0" }),
402
+ /* @__PURE__ */ jsx("span", { children: rule.label })
403
+ ]
404
+ },
405
+ rule.id
406
+ );
407
+ }) });
408
+ }
409
+ function VerificationCodeInput({
410
+ length = 6,
411
+ value = "",
412
+ onChange,
413
+ onComplete,
414
+ disabled = false,
415
+ autoFocus = true,
416
+ className
417
+ }) {
418
+ const [code, setCode] = useState(
419
+ value.split("").concat(Array(length - value.length).fill(""))
420
+ );
421
+ const inputRefs = useRef([]);
422
+ const hiddenInputRef = useRef(null);
423
+ useEffect(() => {
424
+ if (autoFocus && hiddenInputRef.current) {
425
+ hiddenInputRef.current.focus();
426
+ }
427
+ }, [autoFocus]);
428
+ useEffect(() => {
429
+ const newCode = value.split("").concat(Array(length - value.length).fill(""));
430
+ setCode(newCode.slice(0, length));
431
+ }, [value, length]);
432
+ const handleHiddenInput = (e) => {
433
+ const inputValue = e.target.value.replace(/\D/g, "").slice(0, length);
434
+ const newCode = inputValue.split("").concat(Array(length - inputValue.length).fill(""));
435
+ setCode(newCode);
436
+ onChange?.(inputValue);
437
+ setTimeout(() => {
438
+ if (inputValue.length === length) {
439
+ onComplete?.(inputValue);
440
+ inputRefs.current[length - 1]?.focus();
441
+ } else if (inputValue.length > 0) {
442
+ inputRefs.current[Math.min(inputValue.length, length - 1)]?.focus();
443
+ }
444
+ }, 0);
445
+ };
446
+ const handleChange = (index, e) => {
447
+ const inputValue = e.target.value;
448
+ if (inputValue.length > 1) {
449
+ const pastedCode = inputValue.replace(/\D/g, "").slice(0, length);
450
+ const newCode2 = pastedCode.split("").concat(Array(length - pastedCode.length).fill(""));
451
+ setCode(newCode2);
452
+ onChange?.(pastedCode);
453
+ if (pastedCode.length === length) {
454
+ onComplete?.(pastedCode);
455
+ inputRefs.current[length - 1]?.blur();
456
+ } else {
457
+ inputRefs.current[Math.min(pastedCode.length, length - 1)]?.focus();
458
+ }
459
+ return;
460
+ }
461
+ const digit = inputValue.replace(/\D/g, "");
462
+ const newCode = [...code];
463
+ newCode[index] = digit;
464
+ setCode(newCode);
465
+ const codeString = newCode.join("");
466
+ onChange?.(codeString);
467
+ if (digit && index < length - 1) {
468
+ inputRefs.current[index + 1]?.focus();
469
+ }
470
+ const isComplete = newCode.every((d) => d !== "");
471
+ if (isComplete && codeString.length === length) {
472
+ onComplete?.(codeString);
473
+ }
474
+ };
475
+ const handleKeyDown = (index, e) => {
476
+ if (e.key === "Backspace") {
477
+ if (!code[index] && index > 0) {
478
+ inputRefs.current[index - 1]?.focus();
479
+ const newCode = [...code];
480
+ newCode[index - 1] = "";
481
+ setCode(newCode);
482
+ onChange?.(newCode.join(""));
483
+ } else {
484
+ const newCode = [...code];
485
+ newCode[index] = "";
486
+ setCode(newCode);
487
+ onChange?.(newCode.join(""));
488
+ }
489
+ } else if (e.key === "ArrowLeft" && index > 0) {
490
+ inputRefs.current[index - 1]?.focus();
491
+ } else if (e.key === "ArrowRight" && index < length - 1) {
492
+ inputRefs.current[index + 1]?.focus();
493
+ }
494
+ };
495
+ const handlePaste = (e) => {
496
+ e.preventDefault();
497
+ const pastedData = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
498
+ if (pastedData.length === 0) return;
499
+ const newCode = pastedData.split("").concat(Array(length - pastedData.length).fill(""));
500
+ setCode(newCode.slice(0, length));
501
+ onChange?.(pastedData);
502
+ setTimeout(() => {
503
+ if (pastedData.length === length) {
504
+ onComplete?.(pastedData);
505
+ inputRefs.current[length - 1]?.focus();
506
+ } else {
507
+ inputRefs.current[Math.min(pastedData.length, length - 1)]?.focus();
508
+ }
509
+ }, 0);
510
+ };
511
+ const handleHiddenFocus = () => {
512
+ const firstEmptyIndex = code.indexOf("");
513
+ const targetIndex = firstEmptyIndex === -1 ? 0 : firstEmptyIndex;
514
+ inputRefs.current[targetIndex]?.focus();
515
+ };
516
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), onPaste: handlePaste, children: [
517
+ /* @__PURE__ */ jsx(
518
+ "input",
519
+ {
520
+ ref: hiddenInputRef,
521
+ type: "text",
522
+ inputMode: "numeric",
523
+ pattern: "[0-9]*",
524
+ autoComplete: "one-time-code",
525
+ name: "otp",
526
+ id: "otp-input",
527
+ value: code.join(""),
528
+ onChange: handleHiddenInput,
529
+ onFocus: handleHiddenFocus,
530
+ disabled,
531
+ className: "absolute inset-0 w-full h-full opacity-0 cursor-text z-10",
532
+ style: { caretColor: "transparent" },
533
+ "aria-label": "One-time code"
534
+ }
535
+ ),
536
+ /* @__PURE__ */ jsx("div", { className: "flex gap-2 justify-center", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
537
+ "input",
538
+ {
539
+ ref: (el) => {
540
+ inputRefs.current[index] = el;
541
+ },
542
+ type: "text",
543
+ inputMode: "numeric",
544
+ pattern: "[0-9]*",
545
+ autoComplete: "one-time-code",
546
+ maxLength: length,
547
+ value: code[index] || "",
548
+ onChange: (e) => handleChange(index, e),
549
+ onKeyDown: (e) => handleKeyDown(index, e),
550
+ onPaste: handlePaste,
551
+ disabled,
552
+ className: cn(
553
+ "w-12 h-14 text-center text-xl font-semibold rounded-lg border border-input bg-background",
554
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
555
+ "disabled:cursor-not-allowed disabled:opacity-50",
556
+ "transition-colors"
557
+ ),
558
+ "aria-label": `Digit ${index + 1}`
559
+ },
560
+ index
561
+ )) })
562
+ ] });
563
+ }
564
+
565
+ export { Checkbox, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, PasswordInput, PasswordRequirements, Textarea, VerificationCodeInput, defaultPasswordRules, extendedPasswordRules };