@boxcustodia/library 2.0.0-alpha.19 → 2.0.0-alpha.20

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 (265) hide show
  1. package/dist/components/button/button.cjs.js +1 -1
  2. package/dist/components/button/button.es.js +19 -18
  3. package/dist/components/button/components/base-button.cjs.js +1 -1
  4. package/dist/components/button/components/base-button.es.js +20 -20
  5. package/dist/components/calendar/calendar.cjs.js +1 -1
  6. package/dist/components/calendar/calendar.es.js +1 -0
  7. package/dist/components/date-picker/date-input.cjs.js +1 -1
  8. package/dist/components/date-picker/date-input.es.js +92 -75
  9. package/dist/components/date-picker/date-picker.cjs.js +1 -1
  10. package/dist/components/date-picker/date-picker.es.js +104 -95
  11. package/dist/components/date-picker/date-picker.utils.cjs.js +1 -1
  12. package/dist/components/date-picker/date-picker.utils.es.js +51 -43
  13. package/dist/components/date-picker/use-hidden-field-value.cjs.js +1 -0
  14. package/dist/components/date-picker/use-hidden-field-value.es.js +11 -0
  15. package/dist/components/menu/menu.es.js +1 -9
  16. package/dist/components/otp/otp.cjs.js +2 -0
  17. package/dist/components/otp/otp.es.js +93 -0
  18. package/dist/components/password/password.cjs.js +1 -1
  19. package/dist/components/password/password.es.js +2 -2
  20. package/dist/components/select/select.cjs.js +1 -1
  21. package/dist/components/select/select.es.js +68 -60
  22. package/dist/hooks/internal/is-apple-device.cjs.js +1 -0
  23. package/dist/hooks/internal/is-apple-device.es.js +9 -0
  24. package/dist/hooks/internal/use-latest-ref.cjs.js +1 -0
  25. package/dist/hooks/internal/use-latest-ref.es.js +11 -0
  26. package/dist/hooks/use-array/use-array.cjs.js +1 -1
  27. package/dist/hooks/use-array/use-array.es.js +54 -42
  28. package/dist/hooks/use-async/use-async.cjs.js +1 -1
  29. package/dist/hooks/use-async/use-async.es.js +53 -20
  30. package/dist/hooks/use-boolean/use-boolean.cjs.js +1 -0
  31. package/dist/hooks/use-boolean/use-boolean.es.js +25 -0
  32. package/dist/hooks/use-click-outside/use-click-outside.cjs.js +1 -1
  33. package/dist/hooks/use-click-outside/use-click-outside.es.js +26 -12
  34. package/dist/hooks/use-debounce-callback/use-debounced-callback.cjs.js +1 -1
  35. package/dist/hooks/use-debounce-callback/use-debounced-callback.es.js +27 -10
  36. package/dist/hooks/use-debounce-value/use-debounced-value.cjs.js +1 -1
  37. package/dist/hooks/use-debounce-value/use-debounced-value.es.js +7 -9
  38. package/dist/hooks/use-disclosure/use-disclosure.cjs.js +1 -1
  39. package/dist/hooks/use-disclosure/use-disclosure.es.js +21 -11
  40. package/dist/hooks/use-document-title/use-document-title.cjs.js +1 -1
  41. package/dist/hooks/use-document-title/use-document-title.es.js +14 -12
  42. package/dist/hooks/use-event-listener/use-event-listener.cjs.js +1 -1
  43. package/dist/hooks/use-event-listener/use-event-listener.es.js +17 -9
  44. package/dist/hooks/use-hotkey/use-hotkey.cjs.js +1 -1
  45. package/dist/hooks/use-hotkey/use-hotkey.es.js +30 -14
  46. package/dist/hooks/use-hotkey/utils/is-input-field.cjs.js +1 -1
  47. package/dist/hooks/use-hotkey/utils/is-input-field.es.js +4 -2
  48. package/dist/hooks/use-hotkey/utils/match-and-run.cjs.js +1 -0
  49. package/dist/hooks/use-hotkey/utils/match-and-run.es.js +12 -0
  50. package/dist/hooks/use-hotkey/utils/match-key-modifiers.cjs.js +1 -1
  51. package/dist/hooks/use-hotkey/utils/match-key-modifiers.es.js +13 -12
  52. package/dist/hooks/use-hover/use-hover.cjs.js +1 -1
  53. package/dist/hooks/use-hover/use-hover.es.js +32 -17
  54. package/dist/hooks/use-is-visible/use-is-visible.cjs.js +1 -1
  55. package/dist/hooks/use-is-visible/use-is-visible.es.js +31 -27
  56. package/dist/hooks/use-local-storage/use-local-storage.cjs.js +1 -1
  57. package/dist/hooks/use-local-storage/use-local-storage.es.js +52 -20
  58. package/dist/hooks/use-media-query/use-media-query.cjs.js +1 -1
  59. package/dist/hooks/use-media-query/use-media-query.es.js +21 -11
  60. package/dist/hooks/use-mutation/use-mutation.cjs.js +1 -1
  61. package/dist/hooks/use-mutation/use-mutation.es.js +36 -22
  62. package/dist/hooks/use-object/use-object.cjs.js +1 -1
  63. package/dist/hooks/use-object/use-object.es.js +26 -22
  64. package/dist/hooks/use-prevent-page-close/use-prevent-page-close.cjs.js +1 -0
  65. package/dist/hooks/use-prevent-page-close/use-prevent-page-close.es.js +14 -0
  66. package/dist/hooks/use-step/use-step.cjs.js +1 -1
  67. package/dist/hooks/use-step/use-step.es.js +25 -24
  68. package/dist/index.cjs.js +1 -1
  69. package/dist/index.es.js +308 -300
  70. package/dist/src/components/date-picker/date-picker.utils.d.ts +17 -0
  71. package/dist/src/components/date-picker/use-hidden-field-value.d.ts +12 -0
  72. package/dist/src/components/index.d.ts +1 -0
  73. package/dist/src/hooks/index.d.ts +2 -2
  74. package/dist/src/hooks/internal/index.d.ts +2 -0
  75. package/dist/src/hooks/internal/is-apple-device.d.ts +12 -0
  76. package/dist/src/hooks/internal/use-latest-ref.d.ts +12 -0
  77. package/dist/src/hooks/use-array/use-array.d.ts +24 -11
  78. package/dist/src/hooks/use-async/use-async.d.ts +16 -13
  79. package/dist/src/hooks/use-boolean/index.d.ts +1 -0
  80. package/dist/src/hooks/use-boolean/use-boolean.d.ts +15 -0
  81. package/dist/src/hooks/use-boolean/use-boolean.test.d.ts +1 -0
  82. package/dist/src/hooks/use-click-outside/use-click-outside.d.ts +23 -1
  83. package/dist/src/hooks/use-debounce-callback/use-debounced-callback.d.ts +19 -1
  84. package/dist/src/hooks/use-debounce-value/use-debounced-value.d.ts +10 -1
  85. package/dist/src/hooks/use-disclosure/use-disclosure.d.ts +17 -8
  86. package/dist/src/hooks/use-document-title/use-document-title.d.ts +11 -0
  87. package/dist/src/hooks/use-event-listener/use-event-listener.d.ts +18 -1
  88. package/dist/src/hooks/use-hotkey/index.d.ts +2 -1
  89. package/dist/src/hooks/use-hotkey/use-hotkey.d.ts +62 -5
  90. package/dist/src/hooks/use-hotkey/utils/index.d.ts +4 -3
  91. package/dist/src/hooks/use-hotkey/utils/is-input-field.d.ts +12 -2
  92. package/dist/src/hooks/use-hotkey/utils/is-input-field.test.d.ts +1 -0
  93. package/dist/src/hooks/use-hotkey/utils/match-and-run.d.ts +36 -0
  94. package/dist/src/hooks/use-hotkey/utils/match-and-run.test.d.ts +1 -0
  95. package/dist/src/hooks/use-hotkey/utils/match-key-modifiers.d.ts +20 -6
  96. package/dist/src/hooks/use-hotkey/utils/match-key-modifiers.test.d.ts +1 -0
  97. package/dist/src/hooks/use-hover/use-hover.d.ts +8 -4
  98. package/dist/src/hooks/use-is-visible/use-is-visible.d.ts +28 -4
  99. package/dist/src/hooks/use-local-storage/use-local-storage.d.ts +13 -2
  100. package/dist/src/hooks/use-media-query/use-media-query.d.ts +10 -1
  101. package/dist/src/hooks/use-media-query/use-media-query.test.d.ts +1 -0
  102. package/dist/src/hooks/use-mutation/use-mutation.d.ts +18 -11
  103. package/dist/src/hooks/use-object/use-object.d.ts +15 -6
  104. package/dist/src/hooks/use-prevent-page-close/index.d.ts +1 -0
  105. package/dist/src/hooks/use-prevent-page-close/use-prevent-page-close.d.ts +10 -0
  106. package/dist/src/hooks/use-prevent-page-close/use-prevent-page-close.test.d.ts +1 -0
  107. package/dist/src/hooks/use-step/use-step.d.ts +18 -11
  108. package/dist/src/utils/form.d.ts +10 -0
  109. package/package.json +1 -1
  110. package/src/components/alert-dialog/alert-dialog.test.tsx +13 -9
  111. package/src/components/auto-complete/auto-complete.test.tsx +4 -14
  112. package/src/components/avatar/avatar.test.tsx +7 -12
  113. package/src/components/button/button.test.tsx +10 -15
  114. package/src/components/button/button.tsx +14 -9
  115. package/src/components/button/components/base-button.tsx +2 -4
  116. package/src/components/calendar/calendar.test.tsx +12 -19
  117. package/src/components/calendar/calendar.tsx +4 -0
  118. package/src/components/card/card.test.tsx +4 -6
  119. package/src/components/checkbox/checkbox.test.tsx +12 -8
  120. package/src/components/checkbox-group/checkbox-group.test.tsx +7 -8
  121. package/src/components/combobox/combobox.test.tsx +24 -21
  122. package/src/components/date-picker/date-input-form.test.tsx +77 -0
  123. package/src/components/date-picker/date-input.stories.tsx +30 -18
  124. package/src/components/date-picker/date-input.tsx +77 -44
  125. package/src/components/date-picker/date-picker.stories.tsx +31 -1
  126. package/src/components/date-picker/date-picker.test.tsx +3 -13
  127. package/src/components/date-picker/date-picker.tsx +35 -16
  128. package/src/components/date-picker/date-picker.utils.test.ts +32 -14
  129. package/src/components/date-picker/date-picker.utils.ts +33 -0
  130. package/src/components/date-picker/use-date-input-popover.test.ts +3 -1
  131. package/src/components/date-picker/use-hidden-field-value.ts +23 -0
  132. package/src/components/dialog/dialog.test.tsx +10 -8
  133. package/src/components/dropzone/dropzone.test.tsx +11 -13
  134. package/src/components/empty/empty.test.tsx +4 -3
  135. package/src/components/field/field.test.tsx +12 -13
  136. package/src/components/form/form.stories.tsx +16 -1
  137. package/src/components/index.ts +1 -0
  138. package/src/components/label/label.test.tsx +3 -3
  139. package/src/components/menu/menu.tsx +1 -5
  140. package/src/components/number-input/number-input.test.tsx +6 -2
  141. package/src/components/password/password.test.tsx +20 -6
  142. package/src/components/password/password.tsx +2 -2
  143. package/src/components/popover/popover.test.tsx +4 -4
  144. package/src/components/progress/progress.test.tsx +7 -8
  145. package/src/components/radio-group/radio-group.test.tsx +17 -11
  146. package/src/components/select/select.test.tsx +10 -10
  147. package/src/components/select/select.tsx +9 -1
  148. package/src/components/stepper/stepper.stories.tsx +11 -15
  149. package/src/components/stepper/stepper.test.tsx +6 -4
  150. package/src/components/switch/switch.test.tsx +3 -3
  151. package/src/components/table/table.test.tsx +9 -3
  152. package/src/components/tabs/tabs.test.tsx +6 -2
  153. package/src/components/tag/tag.test.tsx +1 -3
  154. package/src/components/textarea/textarea.test.tsx +4 -1
  155. package/src/components/timeline/timeline.test.tsx +10 -5
  156. package/src/components/toast/toast.test.tsx +11 -14
  157. package/src/components/tooltip/tooltip.test.tsx +1 -5
  158. package/src/components/tree/tree.test.tsx +3 -1
  159. package/src/hooks/index.ts +2 -2
  160. package/src/hooks/internal/index.ts +2 -0
  161. package/src/hooks/internal/is-apple-device.test.ts +41 -0
  162. package/src/hooks/internal/is-apple-device.ts +33 -0
  163. package/src/hooks/internal/use-isomorphic-layout-effect.ts +3 -1
  164. package/src/hooks/internal/use-latest-ref.ts +21 -0
  165. package/src/hooks/use-array/use-array.stories.tsx +435 -64
  166. package/src/hooks/use-array/use-array.test.tsx +398 -15
  167. package/src/hooks/use-array/use-array.ts +105 -66
  168. package/src/hooks/use-async/use-async.stories.tsx +255 -131
  169. package/src/hooks/use-async/use-async.test.ts +397 -0
  170. package/src/hooks/use-async/use-async.ts +117 -39
  171. package/src/hooks/use-boolean/index.ts +1 -0
  172. package/src/hooks/use-boolean/use-boolean.stories.tsx +377 -0
  173. package/src/hooks/use-boolean/use-boolean.test.tsx +177 -0
  174. package/src/hooks/use-boolean/use-boolean.ts +50 -0
  175. package/src/hooks/use-click-outside/use-click-outside.stories.tsx +188 -18
  176. package/src/hooks/use-click-outside/use-click-outside.test.tsx +89 -10
  177. package/src/hooks/use-click-outside/use-click-outside.ts +62 -16
  178. package/src/hooks/use-debounce-callback/use-debounced-callback.stories.tsx +141 -41
  179. package/src/hooks/use-debounce-callback/use-debounced-callback.test.ts +217 -9
  180. package/src/hooks/use-debounce-callback/use-debounced-callback.ts +71 -11
  181. package/src/hooks/use-debounce-value/use-debounced-value.stories.tsx +247 -47
  182. package/src/hooks/use-debounce-value/use-debounced-value.test.ts +105 -10
  183. package/src/hooks/use-debounce-value/use-debounced-value.ts +19 -10
  184. package/src/hooks/use-disclosure/use-disclosure.stories.tsx +305 -14
  185. package/src/hooks/use-disclosure/use-disclosure.test.ts +198 -50
  186. package/src/hooks/use-disclosure/use-disclosure.ts +49 -29
  187. package/src/hooks/use-document-title/use-document-title.stories.tsx +54 -0
  188. package/src/hooks/use-document-title/use-document-title.test.tsx +26 -0
  189. package/src/hooks/use-document-title/{use-document-title.tsx → use-document-title.ts} +17 -3
  190. package/src/hooks/use-event-listener/use-event-listener.stories.tsx +105 -9
  191. package/src/hooks/use-event-listener/use-event-listener.test.tsx +77 -10
  192. package/src/hooks/use-event-listener/use-event-listener.ts +71 -11
  193. package/src/hooks/use-focus-trap/use-focus-trap.test.ts +31 -6
  194. package/src/hooks/use-focus-trap/use-focus-trap.ts +3 -2
  195. package/src/hooks/use-hotkey/index.ts +9 -1
  196. package/src/hooks/use-hotkey/use-hotkey.stories.tsx +279 -74
  197. package/src/hooks/use-hotkey/use-hotkey.test.tsx +286 -34
  198. package/src/hooks/use-hotkey/use-hotkey.ts +141 -17
  199. package/src/hooks/use-hotkey/utils/index.ts +8 -3
  200. package/src/hooks/use-hotkey/utils/is-input-field.test.ts +78 -0
  201. package/src/hooks/use-hotkey/utils/is-input-field.ts +31 -10
  202. package/src/hooks/use-hotkey/utils/match-and-run.test.ts +203 -0
  203. package/src/hooks/use-hotkey/utils/match-and-run.ts +62 -0
  204. package/src/hooks/use-hotkey/utils/match-key-modifiers.test.ts +65 -0
  205. package/src/hooks/use-hotkey/utils/match-key-modifiers.ts +39 -12
  206. package/src/hooks/use-hover/use-hover.stories.tsx +258 -80
  207. package/src/hooks/use-hover/use-hover.test.tsx +266 -26
  208. package/src/hooks/use-hover/use-hover.tsx +93 -28
  209. package/src/hooks/use-is-visible/use-is-visible.stories.tsx +193 -46
  210. package/src/hooks/use-is-visible/use-is-visible.test.tsx +235 -7
  211. package/src/hooks/use-is-visible/use-is-visible.ts +114 -0
  212. package/src/hooks/use-local-storage/use-local-storage.stories.tsx +129 -29
  213. package/src/hooks/use-local-storage/use-local-storage.test.ts +106 -41
  214. package/src/hooks/use-local-storage/use-local-storage.ts +100 -31
  215. package/src/hooks/use-media-query/use-media-query.stories.tsx +86 -26
  216. package/src/hooks/use-media-query/use-media-query.test.ts +132 -0
  217. package/src/hooks/use-media-query/use-media-query.ts +39 -14
  218. package/src/hooks/use-memoized-fn/use-memoized-fn.ts +0 -1
  219. package/src/hooks/use-mutation/use-mutation.stories.tsx +260 -94
  220. package/src/hooks/use-mutation/use-mutation.test.ts +359 -0
  221. package/src/hooks/use-mutation/use-mutation.ts +97 -0
  222. package/src/hooks/use-object/use-object.stories.tsx +310 -79
  223. package/src/hooks/use-object/use-object.test.tsx +235 -56
  224. package/src/hooks/use-object/use-object.ts +59 -0
  225. package/src/hooks/use-pagination/use-pagination.tsx +0 -1
  226. package/src/hooks/use-prevent-page-close/index.ts +1 -0
  227. package/src/hooks/use-prevent-page-close/use-prevent-page-close.stories.tsx +39 -0
  228. package/src/hooks/use-prevent-page-close/use-prevent-page-close.test.ts +89 -0
  229. package/src/hooks/use-prevent-page-close/use-prevent-page-close.ts +27 -0
  230. package/src/hooks/use-range-pagination/use-range-pagination.test.tsx +1 -1
  231. package/src/hooks/use-range-pagination/use-range-pagination.tsx +1 -1
  232. package/src/hooks/use-selection/use-selection.ts +0 -1
  233. package/src/hooks/use-step/use-step.stories.tsx +178 -65
  234. package/src/hooks/use-step/use-step.test.ts +178 -53
  235. package/src/hooks/use-step/use-step.ts +57 -49
  236. package/src/utils/form.test.tsx +13 -8
  237. package/src/utils/form.tsx +10 -0
  238. package/src/utils/functions/getFormData.test.ts +1 -1
  239. package/dist/hooks/use-hotkey/utils/create-hotkey-listener.cjs.js +0 -1
  240. package/dist/hooks/use-hotkey/utils/create-hotkey-listener.es.js +0 -10
  241. package/dist/hooks/use-prevent-close-window/use-prevent-close-window.cjs.js +0 -1
  242. package/dist/hooks/use-prevent-close-window/use-prevent-close-window.es.js +0 -15
  243. package/dist/hooks/use-toggle/use-toggle.cjs.js +0 -1
  244. package/dist/hooks/use-toggle/use-toggle.es.js +0 -10
  245. package/dist/src/hooks/use-hotkey/utils/create-hotkey-listener.d.ts +0 -1
  246. package/dist/src/hooks/use-prevent-close-window/index.d.ts +0 -1
  247. package/dist/src/hooks/use-prevent-close-window/use-prevent-close-window.d.ts +0 -13
  248. package/dist/src/hooks/use-toggle/index.d.ts +0 -1
  249. package/dist/src/hooks/use-toggle/use-toggle.d.ts +0 -3
  250. package/src/hooks/use-async/use-async.test.tsx +0 -68
  251. package/src/hooks/use-hotkey/utils/create-hotkey-listener.ts +0 -25
  252. package/src/hooks/use-is-visible/use-is-visible.tsx +0 -49
  253. package/src/hooks/use-mutation/use-mutation.test.tsx +0 -83
  254. package/src/hooks/use-mutation/use-mutation.tsx +0 -59
  255. package/src/hooks/use-object/use-object.tsx +0 -46
  256. package/src/hooks/use-prevent-close-window/index.ts +0 -1
  257. package/src/hooks/use-prevent-close-window/use-prevent-close-window.stories.tsx +0 -32
  258. package/src/hooks/use-prevent-close-window/use-prevent-close-window.test.ts +0 -79
  259. package/src/hooks/use-prevent-close-window/use-prevent-close-window.ts +0 -33
  260. package/src/hooks/use-toggle/index.ts +0 -1
  261. package/src/hooks/use-toggle/use-toggle.stories.tsx +0 -25
  262. package/src/hooks/use-toggle/use-toggle.test.tsx +0 -64
  263. package/src/hooks/use-toggle/use-toggle.ts +0 -14
  264. /package/dist/src/{hooks/use-prevent-close-window/use-prevent-close-window.test.d.ts → components/date-picker/date-input-form.test.d.ts} +0 -0
  265. /package/dist/src/hooks/{use-toggle/use-toggle.test.d.ts → internal/is-apple-device.test.d.ts} +0 -0
@@ -1,22 +1,23 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
3
- import { useControllableState as V } from "@radix-ui/react-use-controllable-state";
4
- import { CalendarIcon as R } from "lucide-react";
5
- import { useState as S, useRef as T } from "react";
6
- import { formatRangeDate as y, formatMultipleDates as N, formatSingleDate as O } from "./date-picker.utils.es.js";
2
+ import { jsx as o, jsxs as V } from "react/jsx-runtime";
3
+ import { useControllableState as S } from "@radix-ui/react-use-controllable-state";
4
+ import { CalendarIcon as N } from "lucide-react";
5
+ import { useState as C, useRef as O } from "react";
6
+ import { formatRangeDate as y, formatMultipleDates as R, formatISODate as T, formatSingleDate as F } from "./date-picker.utils.es.js";
7
+ import { useHiddenFieldValue as I } from "./use-hidden-field-value.es.js";
7
8
  import { Calendar as k } from "../calendar/calendar.es.js";
8
- import { cn as P } from "../../lib/cn.es.js";
9
- import { PopoverRoot as w, PopoverTrigger as M, PopoverPopup as j } from "../popover/popover.es.js";
10
- import { inputBaseClasses as D } from "../input/input.es.js";
11
- import { FieldControl as E } from "../field/field.es.js";
12
- function L(n) {
13
- return n.mode === "range" ? /* @__PURE__ */ t(I, { ...n }) : n.mode === "multiple" ? /* @__PURE__ */ t($, { ...n }) : /* @__PURE__ */ t(F, { ...n });
9
+ import { cn as b } from "../../lib/cn.es.js";
10
+ import { PopoverRoot as w, PopoverTrigger as D, PopoverPopup as M } from "../popover/popover.es.js";
11
+ import { inputBaseClasses as j } from "../input/input.es.js";
12
+ import { FieldControl as E, FieldRoot as $ } from "../field/field.es.js";
13
+ function X(a) {
14
+ return a.mode === "range" ? /* @__PURE__ */ o(B, { ...a }) : a.mode === "multiple" ? /* @__PURE__ */ o(G, { ...a }) : /* @__PURE__ */ o(A, { ...a });
14
15
  }
15
16
  const x = ({
16
- open: n,
17
+ open: a,
17
18
  onOpenChange: u,
18
- displayText: p,
19
- hasValue: f,
19
+ displayText: f,
20
+ hasValue: p,
20
21
  disabled: m,
21
22
  className: i,
22
23
  classNames: d,
@@ -26,78 +27,86 @@ const x = ({
26
27
  formValue: v,
27
28
  required: c
28
29
  }) => {
29
- const r = T(null);
30
- return /* @__PURE__ */ C(w, { "data-slot": s, open: n, onOpenChange: u, children: [
31
- /* @__PURE__ */ C(
32
- M,
30
+ const r = O(null), n = I(v);
31
+ return /* @__PURE__ */ V(w, { "data-slot": s, open: a, onOpenChange: u, children: [
32
+ /* @__PURE__ */ V(
33
+ D,
33
34
  {
34
- render: /* @__PURE__ */ t(
35
+ render: /* @__PURE__ */ o(
35
36
  "button",
36
37
  {
37
38
  ref: r,
38
39
  disabled: m,
39
- className: P(
40
- D,
40
+ className: b(
41
+ j,
41
42
  "inline-flex items-center gap-2 h-8 cursor-pointer text-left",
42
43
  "focus-visible:border-ring",
43
44
  "aria-invalid:border-error focus-visible:aria-invalid:ring-error/20",
44
- "group-data-[invalid]:border-error focus-visible:group-data-[invalid]:ring-error/20",
45
+ // Attribute selector (specificity 0,2,0) beats `border-input`;
46
+ // `group-data-[invalid]` ties and loses. Matches the OTP convention.
47
+ // The `focus-visible` variant re-asserts the error border so it is
48
+ // not washed out by `focus-visible:border-ring` while focused.
49
+ "in-[[data-slot=field][data-invalid]]:border-error focus-visible:in-[[data-slot=field][data-invalid]]:border-error focus-visible:in-[[data-slot=field][data-invalid]]:ring-error/20",
45
50
  "disabled:cursor-not-allowed disabled:opacity-50",
46
- !f && "text-muted-foreground",
51
+ !p && "text-muted-foreground",
47
52
  i
48
53
  )
49
54
  }
50
55
  ),
51
56
  children: [
52
- /* @__PURE__ */ t(R, { className: "shrink-0" }),
53
- /* @__PURE__ */ t("span", { className: "truncate", children: p })
57
+ /* @__PURE__ */ o("span", { className: "flex-1 truncate", children: f }),
58
+ /* @__PURE__ */ o(
59
+ N,
60
+ {
61
+ "data-slot": "date-picker-icon",
62
+ className: "shrink-0 text-muted-foreground"
63
+ }
64
+ )
54
65
  ]
55
66
  }
56
67
  ),
57
- /* @__PURE__ */ t(
68
+ /* @__PURE__ */ o(
58
69
  E,
59
70
  {
60
- render: /* @__PURE__ */ t(
71
+ render: /* @__PURE__ */ o(
61
72
  "input",
62
73
  {
74
+ ref: n,
63
75
  type: "text",
64
76
  tabIndex: -1,
65
77
  "aria-hidden": "true",
66
78
  className: "sr-only",
67
- value: v,
68
- onChange: () => {
69
- },
70
79
  required: c,
71
80
  onFocus: () => r.current?.focus()
72
81
  }
73
82
  )
74
83
  }
75
84
  ),
76
- /* @__PURE__ */ C(
77
- j,
85
+ /* @__PURE__ */ o(
86
+ M,
78
87
  {
79
- className: P("w-auto p-0", d?.popup),
88
+ className: b("w-auto p-0", d?.popup),
80
89
  align: "start",
81
90
  "data-slot": `${s}-content`,
82
- children: [
91
+ children: /* @__PURE__ */ V($, { className: "contents", children: [
83
92
  g,
84
- l && /* @__PURE__ */ t(
93
+ l && /* @__PURE__ */ o(
85
94
  "div",
86
95
  {
87
- className: P("p-2", d?.footer),
96
+ className: b("p-2", d?.footer),
88
97
  "data-slot": `${s}-footer`,
89
98
  children: l
90
99
  }
91
100
  )
92
- ]
101
+ ] })
93
102
  }
94
103
  )
95
104
  ] });
96
- }, F = ({
97
- value: n,
105
+ }, A = ({
106
+ value: a,
98
107
  defaultValue: u,
99
- onValueChange: p,
100
- placeholder: f = "Seleccionar fecha",
108
+ onValueChange: f,
109
+ placeholder: p = "Seleccionar fecha",
101
110
  disabled: m,
102
111
  disabledDate: i,
103
112
  renderFooter: d,
@@ -105,53 +114,53 @@ const x = ({
105
114
  classNames: l,
106
115
  required: s
107
116
  }) => {
108
- const [v, c] = S(!1), [r, a] = V({
109
- prop: n,
110
- onChange: (e) => p?.(e ?? null),
117
+ const [v, c] = C(!1), [r, n] = S({
118
+ prop: a,
119
+ onChange: (e) => f?.(e ?? null),
111
120
  defaultProp: u ?? null
112
- }), o = {
121
+ }), t = {
113
122
  mode: "single",
114
123
  value: r ?? null,
115
- clear: () => a(null),
124
+ clear: () => n(null),
116
125
  selectToday: () => {
117
126
  const e = /* @__PURE__ */ new Date();
118
- i?.(e) || a(e);
127
+ i?.(e) || n(e);
119
128
  },
120
- setValue: (e) => a(e)
129
+ setValue: (e) => n(e)
121
130
  };
122
- return /* @__PURE__ */ t(
131
+ return /* @__PURE__ */ o(
123
132
  x,
124
133
  {
125
134
  slot: "date-picker",
126
135
  open: v,
127
136
  onOpenChange: c,
128
- displayText: O(r, f),
137
+ displayText: F(r, p),
129
138
  hasValue: !!r,
130
139
  disabled: m,
131
140
  className: g,
132
141
  classNames: l,
133
- footer: d?.(o),
134
- formValue: O(r, ""),
142
+ footer: d?.(t),
143
+ formValue: T(r),
135
144
  required: s,
136
- children: /* @__PURE__ */ t(
145
+ children: /* @__PURE__ */ o(
137
146
  k,
138
147
  {
139
- className: P("border-none", l?.calendar),
148
+ className: b("border-none", l?.calendar),
140
149
  mode: "single",
141
150
  selected: r ?? void 0,
142
151
  onSelect: (e) => {
143
- i && e && i(e) || (a(e ?? null), c(!1));
152
+ i && e && i(e) || (n(e ?? null), c(!1));
144
153
  },
145
154
  disabled: i
146
155
  }
147
156
  )
148
157
  }
149
158
  );
150
- }, b = { start: null, end: null }, I = ({
151
- value: n,
159
+ }, P = { start: null, end: null }, B = ({
160
+ value: a,
152
161
  defaultValue: u,
153
- onValueChange: p,
154
- placeholder: f = "Seleccionar rango",
162
+ onValueChange: f,
163
+ placeholder: p = "Seleccionar rango",
155
164
  disabled: m,
156
165
  disabledDate: i,
157
166
  renderFooter: d,
@@ -159,58 +168,58 @@ const x = ({
159
168
  classNames: l,
160
169
  required: s
161
170
  }) => {
162
- const [v, c] = S(!1), [r, a] = V({
163
- prop: n,
164
- onChange: (h) => p?.(h ?? b),
165
- defaultProp: u ?? b
166
- }), o = r ?? b, e = {
171
+ const [v, c] = C(!1), [r, n] = S({
172
+ prop: a,
173
+ onChange: (h) => f?.(h ?? P),
174
+ defaultProp: u ?? P
175
+ }), t = r ?? P, e = {
167
176
  mode: "range",
168
- value: o,
169
- clear: () => a(b),
170
- setValue: (h) => a(h)
177
+ value: t,
178
+ clear: () => n(P),
179
+ setValue: (h) => n(h)
171
180
  };
172
- return /* @__PURE__ */ t(
181
+ return /* @__PURE__ */ o(
173
182
  x,
174
183
  {
175
184
  slot: "date-picker",
176
185
  open: v,
177
186
  onOpenChange: c,
178
187
  displayText: y(
179
- o.start || o.end ? o : void 0,
180
- f
188
+ t.start || t.end ? t : void 0,
189
+ p
181
190
  ),
182
- hasValue: !!(o.start || o.end),
191
+ hasValue: !!(t.start || t.end),
183
192
  disabled: m,
184
193
  className: g,
185
194
  classNames: l,
186
195
  footer: d?.(e),
187
196
  formValue: y(
188
- o.start || o.end ? o : void 0,
197
+ t.start || t.end ? t : void 0,
189
198
  ""
190
199
  ),
191
200
  required: s,
192
- children: /* @__PURE__ */ t(
201
+ children: /* @__PURE__ */ o(
193
202
  k,
194
203
  {
195
- className: P("border-none", l?.calendar),
204
+ className: b("border-none", l?.calendar),
196
205
  mode: "range",
197
206
  selected: {
198
- from: o.start ?? void 0,
199
- to: o.end ?? void 0
207
+ from: t.start ?? void 0,
208
+ to: t.end ?? void 0
200
209
  },
201
210
  onSelect: (h) => {
202
- a({ start: h?.from ?? null, end: h?.to ?? null });
211
+ n({ start: h?.from ?? null, end: h?.to ?? null });
203
212
  },
204
213
  disabled: i
205
214
  }
206
215
  )
207
216
  }
208
217
  );
209
- }, $ = ({
210
- value: n,
218
+ }, G = ({
219
+ value: a,
211
220
  defaultValue: u,
212
- onValueChange: p,
213
- placeholder: f = "Seleccionar fechas",
221
+ onValueChange: f,
222
+ placeholder: p = "Seleccionar fechas",
214
223
  disabled: m,
215
224
  disabledDate: i,
216
225
  renderFooter: d,
@@ -218,38 +227,38 @@ const x = ({
218
227
  classNames: l,
219
228
  required: s
220
229
  }) => {
221
- const [v, c] = S(!1), [r, a] = V({
222
- prop: n,
223
- onChange: (e) => p?.(e ?? []),
230
+ const [v, c] = C(!1), [r, n] = S({
231
+ prop: a,
232
+ onChange: (e) => f?.(e ?? []),
224
233
  defaultProp: u ?? []
225
- }), o = {
234
+ }), t = {
226
235
  mode: "multiple",
227
236
  value: r ?? [],
228
- clear: () => a([]),
229
- setValue: (e) => a(e)
237
+ clear: () => n([]),
238
+ setValue: (e) => n(e)
230
239
  };
231
- return /* @__PURE__ */ t(
240
+ return /* @__PURE__ */ o(
232
241
  x,
233
242
  {
234
243
  slot: "date-picker",
235
244
  open: v,
236
245
  onOpenChange: c,
237
- displayText: N(r, f),
246
+ displayText: R(r, p),
238
247
  hasValue: (r?.length ?? 0) > 0,
239
248
  disabled: m,
240
249
  className: g,
241
250
  classNames: l,
242
- footer: d?.(o),
243
- formValue: N(r, ""),
251
+ footer: d?.(t),
252
+ formValue: R(r, ""),
244
253
  required: s,
245
- children: /* @__PURE__ */ t(
254
+ children: /* @__PURE__ */ o(
246
255
  k,
247
256
  {
248
- className: P("border-none", l?.calendar),
257
+ className: b("border-none", l?.calendar),
249
258
  mode: "multiple",
250
259
  selected: r ?? [],
251
260
  onSelect: (e) => {
252
- a(e ?? []);
261
+ n(e ?? []);
253
262
  },
254
263
  disabled: i
255
264
  }
@@ -258,5 +267,5 @@ const x = ({
258
267
  );
259
268
  };
260
269
  export {
261
- L as DatePicker
270
+ X as DatePicker
262
271
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("date-fns"),g="dd/MM/yyyy",S=(e,a)=>!e||!o.isDate(e)?a:o.format(e,g),$=(e,a)=>{if(!e)return a;const{start:i,end:u}=e;if(!i&&!u)return a;const N=i&&o.isDate(i)?o.format(i,g):"...",h=u&&o.isDate(u)?o.format(u,g):"...";return`${N} → ${h}`},M=(e,a)=>!e||e.length===0?a:e.length===1?o.format(e[0],g):`${e.length} fechas seleccionadas`,T=e=>o.isDate(e)?o.format(e,g):"",A=e=>{const a=e.trim();if(!a)return null;const i=/^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/.exec(a);if(!i)return null;const[,u,N,h]=i,n=Number(u),m=Number(N),l=h;let f=Number(l);if(Number.isNaN(n)||Number.isNaN(m)||Number.isNaN(f)||(l.length<=2&&(f=2e3+f),n<1||n>31||m<1||m>12))return null;const s=new Date(f,m-1,n);return s.getFullYear()!==f||s.getMonth()!==m-1||s.getDate()!==n?null:s},P=(e,a)=>{const i=(a.lastKey==="Backspace"||a.lastKey==="Delete")&&e.length<a.previousValue.length,u=e.includes("/"),N=e.trim().endsWith("/");if((e.match(/\//g)??[]).length>=2){const r=e.split("/"),t=(r[0]??"").replace(/\D/g,"").slice(0,2),b=(r[1]??"").replace(/\D/g,"").slice(0,2),p=(r[2]??"").replace(/\D/g,"").slice(0,4);return!t&&!b&&!p?"":`${t}/${b}/${p}`}const n=e.replace(/\D/g,"").slice(0,8);if(!n)return"";if(n.length<=2){let r=n;if(n.length===1&&(u||N)&&!i){let t=Number(r);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>31&&(t=31),r=t.toString().padStart(2,"0"),r+="/"}else if(n.length===2&&!i){let t=Number(r);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>31&&(t=31),r=t.toString().padStart(2,"0"),r+="/"}return r}const m=n.slice(0,2);let l=Number(m);Number.isNaN(l)&&(l=1),l<1&&(l=1),l>31&&(l=31);const f=l.toString().padStart(2,"0"),s=n.slice(2,4),d=n.slice(4);let c="";if(s.length===0)c="";else if(s.length===1&&d.length===0){const r=N&&!i&&s.length===1;if(s==="0"||s==="1")if(r){let t=Number(s);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>12&&(t=12),c=t.toString().padStart(2,"0")}else c=s;else{let t=Number(s);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>12&&(t=12),c=t.toString().padStart(2,"0")}}else{let r=Number(s);Number.isNaN(r)&&(r=1),r<1&&(r=1),r>12&&(r=12),c=r.toString().padStart(2,"0")}const D=`${f}/${c}`,y=!d&&c.length===2&&!i;return d?`${D}/${d}`:y?`${D}/`:D};exports.DISPLAY_DATE_FORMAT=g;exports.formatDate=T;exports.formatMultipleDates=M;exports.formatRangeDate=$;exports.formatSingleDate=S;exports.maskDateInput=P;exports.parseInputToDate=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("date-fns"),g="dd/MM/yyyy",S=(e,n)=>!e||!o.isDate(e)?n:o.format(e,g),M=e=>!e||!o.isDate(e)?"":o.format(e,"yyyy-MM-dd"),$=(e,n)=>{if(!e)return n;const{start:i,end:u}=e;if(!i&&!u)return n;const N=i&&o.isDate(i)?o.format(i,g):"...",h=u&&o.isDate(u)?o.format(u,g):"...";return`${N} → ${h}`},I=(e,n)=>!e||e.length===0?n:e.length===1?o.format(e[0],g):`${e.length} fechas seleccionadas`,T=e=>o.isDate(e)?o.format(e,g):"",P=(e,n)=>{if(!e)return;Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set?.call(e,n),e.dispatchEvent(new Event("input",{bubbles:!0}))},v=e=>{const n=e.trim();if(!n)return null;const i=/^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/.exec(n);if(!i)return null;const[,u,N,h]=i,s=Number(u),m=Number(N),l=h;let c=Number(l);if(Number.isNaN(s)||Number.isNaN(m)||Number.isNaN(c)||(l.length<=2&&(c=2e3+c),s<1||s>31||m<1||m>12))return null;const a=new Date(c,m-1,s);return a.getFullYear()!==c||a.getMonth()!==m-1||a.getDate()!==s?null:a},A=(e,n)=>{const i=(n.lastKey==="Backspace"||n.lastKey==="Delete")&&e.length<n.previousValue.length,u=e.includes("/"),N=e.trim().endsWith("/");if((e.match(/\//g)??[]).length>=2){const r=e.split("/"),t=(r[0]??"").replace(/\D/g,"").slice(0,2),b=(r[1]??"").replace(/\D/g,"").slice(0,2),p=(r[2]??"").replace(/\D/g,"").slice(0,4);return!t&&!b&&!p?"":`${t}/${b}/${p}`}const s=e.replace(/\D/g,"").slice(0,8);if(!s)return"";if(s.length<=2){let r=s;if(s.length===1&&(u||N)&&!i){let t=Number(r);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>31&&(t=31),r=t.toString().padStart(2,"0"),r+="/"}else if(s.length===2&&!i){let t=Number(r);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>31&&(t=31),r=t.toString().padStart(2,"0"),r+="/"}return r}const m=s.slice(0,2);let l=Number(m);Number.isNaN(l)&&(l=1),l<1&&(l=1),l>31&&(l=31);const c=l.toString().padStart(2,"0"),a=s.slice(2,4),D=s.slice(4);let f="";if(a.length===0)f="";else if(a.length===1&&D.length===0){const r=N&&!i&&a.length===1;if(a==="0"||a==="1")if(r){let t=Number(a);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>12&&(t=12),f=t.toString().padStart(2,"0")}else f=a;else{let t=Number(a);Number.isNaN(t)&&(t=1),t<1&&(t=1),t>12&&(t=12),f=t.toString().padStart(2,"0")}}else{let r=Number(a);Number.isNaN(r)&&(r=1),r<1&&(r=1),r>12&&(r=12),f=r.toString().padStart(2,"0")}const d=`${c}/${f}`,y=!D&&f.length===2&&!i;return D?`${d}/${D}`:y?`${d}/`:d};exports.DISPLAY_DATE_FORMAT=g;exports.emitNativeInputChange=P;exports.formatDate=T;exports.formatISODate=M;exports.formatMultipleDates=I;exports.formatRangeDate=$;exports.formatSingleDate=S;exports.maskDateInput=A;exports.parseInputToDate=v;
@@ -1,73 +1,81 @@
1
- import { isDate as b, format as N } from "date-fns";
2
- const g = "dd/MM/yyyy", k = (e, i) => !e || !b(e) ? i : N(e, g), P = (e, i) => {
3
- if (!e) return i;
1
+ import { isDate as g, format as N } from "date-fns";
2
+ const h = "dd/MM/yyyy", I = (e, n) => !e || !g(e) ? n : N(e, h), P = (e) => !e || !g(e) ? "" : N(e, "yyyy-MM-dd"), k = (e, n) => {
3
+ if (!e) return n;
4
4
  const { start: a, end: o } = e;
5
- if (!a && !o) return i;
6
- const f = a && b(a) ? N(a, g) : "...", h = o && b(o) ? N(o, g) : "...";
7
- return `${f} → ${h}`;
8
- }, A = (e, i) => !e || e.length === 0 ? i : e.length === 1 ? N(e[0], g) : `${e.length} fechas seleccionadas`, R = (e) => b(e) ? N(e, g) : "", T = (e) => {
9
- const i = e.trim();
10
- if (!i) return null;
11
- const a = /^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/.exec(i);
5
+ if (!a && !o) return n;
6
+ const f = a && g(a) ? N(a, h) : "...", d = o && g(o) ? N(o, h) : "...";
7
+ return `${f} → ${d}`;
8
+ }, v = (e, n) => !e || e.length === 0 ? n : e.length === 1 ? N(e[0], h) : `${e.length} fechas seleccionadas`, T = (e) => g(e) ? N(e, h) : "", A = (e, n) => {
9
+ if (!e) return;
10
+ Object.getOwnPropertyDescriptor(
11
+ HTMLInputElement.prototype,
12
+ "value"
13
+ )?.set?.call(e, n), e.dispatchEvent(new Event("input", { bubbles: !0 }));
14
+ }, E = (e) => {
15
+ const n = e.trim();
16
+ if (!n) return null;
17
+ const a = /^(\d{1,2})\/(\d{1,2})\/(\d{1,4})$/.exec(n);
12
18
  if (!a) return null;
13
- const [, o, f, h] = a, n = Number(o), u = Number(f), l = h;
19
+ const [, o, f, d] = a, s = Number(o), u = Number(f), l = d;
14
20
  let c = Number(l);
15
- if (Number.isNaN(n) || Number.isNaN(u) || Number.isNaN(c) || (l.length <= 2 && (c = 2e3 + c), n < 1 || n > 31 || u < 1 || u > 12))
21
+ if (Number.isNaN(s) || Number.isNaN(u) || Number.isNaN(c) || (l.length <= 2 && (c = 2e3 + c), s < 1 || s > 31 || u < 1 || u > 12))
16
22
  return null;
17
- const s = new Date(c, u - 1, n);
18
- return s.getFullYear() !== c || s.getMonth() !== u - 1 || s.getDate() !== n ? null : s;
19
- }, Y = (e, i) => {
20
- const a = (i.lastKey === "Backspace" || i.lastKey === "Delete") && e.length < i.previousValue.length, o = e.includes("/"), f = e.trim().endsWith("/");
23
+ const i = new Date(c, u - 1, s);
24
+ return i.getFullYear() !== c || i.getMonth() !== u - 1 || i.getDate() !== s ? null : i;
25
+ }, O = (e, n) => {
26
+ const a = (n.lastKey === "Backspace" || n.lastKey === "Delete") && e.length < n.previousValue.length, o = e.includes("/"), f = e.trim().endsWith("/");
21
27
  if ((e.match(/\//g) ?? []).length >= 2) {
22
- const r = e.split("/"), t = (r[0] ?? "").replace(/\D/g, "").slice(0, 2), D = (r[1] ?? "").replace(/\D/g, "").slice(0, 2), p = (r[2] ?? "").replace(/\D/g, "").slice(0, 4);
23
- return !t && !D && !p ? "" : `${t}/${D}/${p}`;
28
+ const r = e.split("/"), t = (r[0] ?? "").replace(/\D/g, "").slice(0, 2), p = (r[1] ?? "").replace(/\D/g, "").slice(0, 2), D = (r[2] ?? "").replace(/\D/g, "").slice(0, 4);
29
+ return !t && !p && !D ? "" : `${t}/${p}/${D}`;
24
30
  }
25
- const n = e.replace(/\D/g, "").slice(0, 8);
26
- if (!n)
31
+ const s = e.replace(/\D/g, "").slice(0, 8);
32
+ if (!s)
27
33
  return "";
28
- if (n.length <= 2) {
29
- let r = n;
30
- if (n.length === 1 && (o || f) && !a) {
34
+ if (s.length <= 2) {
35
+ let r = s;
36
+ if (s.length === 1 && (o || f) && !a) {
31
37
  let t = Number(r);
32
38
  Number.isNaN(t) && (t = 1), t < 1 && (t = 1), t > 31 && (t = 31), r = t.toString().padStart(2, "0"), r += "/";
33
- } else if (n.length === 2 && !a) {
39
+ } else if (s.length === 2 && !a) {
34
40
  let t = Number(r);
35
41
  Number.isNaN(t) && (t = 1), t < 1 && (t = 1), t > 31 && (t = 31), r = t.toString().padStart(2, "0"), r += "/";
36
42
  }
37
43
  return r;
38
44
  }
39
- const u = n.slice(0, 2);
45
+ const u = s.slice(0, 2);
40
46
  let l = Number(u);
41
47
  Number.isNaN(l) && (l = 1), l < 1 && (l = 1), l > 31 && (l = 31);
42
- const c = l.toString().padStart(2, "0"), s = n.slice(2, 4), d = n.slice(4);
48
+ const c = l.toString().padStart(2, "0"), i = s.slice(2, 4), b = s.slice(4);
43
49
  let m = "";
44
- if (s.length === 0)
50
+ if (i.length === 0)
45
51
  m = "";
46
- else if (s.length === 1 && d.length === 0) {
47
- const r = f && !a && s.length === 1;
48
- if (s === "0" || s === "1")
52
+ else if (i.length === 1 && b.length === 0) {
53
+ const r = f && !a && i.length === 1;
54
+ if (i === "0" || i === "1")
49
55
  if (r) {
50
- let t = Number(s);
56
+ let t = Number(i);
51
57
  Number.isNaN(t) && (t = 1), t < 1 && (t = 1), t > 12 && (t = 12), m = t.toString().padStart(2, "0");
52
58
  } else
53
- m = s;
59
+ m = i;
54
60
  else {
55
- let t = Number(s);
61
+ let t = Number(i);
56
62
  Number.isNaN(t) && (t = 1), t < 1 && (t = 1), t > 12 && (t = 12), m = t.toString().padStart(2, "0");
57
63
  }
58
64
  } else {
59
- let r = Number(s);
65
+ let r = Number(i);
60
66
  Number.isNaN(r) && (r = 1), r < 1 && (r = 1), r > 12 && (r = 12), m = r.toString().padStart(2, "0");
61
67
  }
62
- const y = `${c}/${m}`, S = !d && m.length === 2 && !a;
63
- return d ? `${y}/${d}` : S ? `${y}/` : y;
68
+ const y = `${c}/${m}`, S = !b && m.length === 2 && !a;
69
+ return b ? `${y}/${b}` : S ? `${y}/` : y;
64
70
  };
65
71
  export {
66
- g as DISPLAY_DATE_FORMAT,
67
- R as formatDate,
68
- A as formatMultipleDates,
69
- P as formatRangeDate,
70
- k as formatSingleDate,
71
- Y as maskDateInput,
72
- T as parseInputToDate
72
+ h as DISPLAY_DATE_FORMAT,
73
+ A as emitNativeInputChange,
74
+ T as formatDate,
75
+ P as formatISODate,
76
+ v as formatMultipleDates,
77
+ k as formatRangeDate,
78
+ I as formatSingleDate,
79
+ O as maskDateInput,
80
+ E as parseInputToDate
73
81
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),i=require("./date-picker.utils.cjs.js");function n(e){const t=u.useRef(null);return u.useEffect(()=>{i.emitNativeInputChange(t.current,e)},[e]),t}exports.useHiddenFieldValue=n;
@@ -0,0 +1,11 @@
1
+ import { useRef as r, useEffect as n } from "react";
2
+ import { emitNativeInputChange as u } from "./date-picker.utils.es.js";
3
+ function o(e) {
4
+ const t = r(null);
5
+ return n(() => {
6
+ u(t.current, e);
7
+ }, [e]), t;
8
+ }
9
+ export {
10
+ o as useHiddenFieldValue
11
+ };
@@ -27,15 +27,7 @@ function l(o, c) {
27
27
  }
28
28
  case "radio-group": {
29
29
  const { type: u, value: e, onValueChange: r, items: n } = o;
30
- return /* @__PURE__ */ t(
31
- C,
32
- {
33
- value: e,
34
- onValueChange: r,
35
- children: n.map((p, a) => l(p, a))
36
- },
37
- c
38
- );
30
+ return /* @__PURE__ */ t(C, { value: e, onValueChange: r, children: n.map((p, a) => l(p, a)) }, c);
39
31
  }
40
32
  case "label": {
41
33
  const { type: u, label: e, ...r } = o;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@base-ui/react/otp-field"),f=require("react"),g=require("../divider/divider.cjs.js"),s=require("../../lib/cn.cjs.js");function l({className:t,size:a="default",...r}){return e.jsx(i.OTPFieldPreview.Root,{className:s.cn("flex items-center gap-2 has-disabled:opacity-64 has-disabled:**:data-[slot=otp-input]:shadow-none has-disabled:**:data-[slot=otp-input]:before:shadow-none!",t),"data-size":a,"data-slot":"otp",...r})}function u({className:t,...a}){return e.jsx(i.OTPFieldPreview.Input,{className:s.cn("in-[[data-slot=otp][data-size=lg]]:size-10 size-9 min-w-0 rounded-lg border border-input bg-background text-center in-[[data-slot=otp][data-size=lg]]:text-lg text-base text-foreground in-[[data-slot=otp][data-size=lg]]:leading-10 leading-9 outline-none transition-shadow focus-visible:z-10 focus-visible:border-ring aria-invalid:border-error focus-visible:aria-invalid:border-error focus-visible:aria-invalid:ring-error/20 in-[[data-slot=field][data-invalid]]:border-error in-[[data-slot=field][data-invalid]]:focus-visible:border-error in-[[data-slot=field][data-invalid]]:focus-visible:ring-error/20 sm:in-[[data-slot=otp][data-size=lg]]:size-9 sm:size-8 sm:in-[[data-slot=otp][data-size=lg]]:text-base sm:text-sm sm:in-[[data-slot=otp][data-size=lg]]:leading-9 sm:leading-8",t),"data-slot":"otp-input",spellCheck:!1,...a})}function c({className:t,...a}){return e.jsx(i.OTPFieldPreview.Separator,{render:e.jsx(g.Divider,{className:s.cn("rounded-full bg-input data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:w-3",t),orientation:"horizontal",...a})})}function v({split:t,inputProps:a,size:r,length:o,"aria-invalid":d,...p}){const b={...d?{"aria-invalid":!0}:{},...a};return e.jsx(l,{size:r,length:o,"aria-invalid":d,...p,children:Array.from({length:o},(P,n)=>e.jsxs(f.Fragment,{children:[e.jsx(u,{"aria-label":`Character ${n+1} of ${o}`,...b}),t===n+1&&e.jsx(c,{})]},n))})}Object.defineProperty(exports,"OTPPrimitive",{enumerable:!0,get:()=>i.OTPFieldPreview});exports.OTP=v;exports.OTPInput=u;exports.OTPRoot=l;exports.OTPSeparator=c;
@@ -0,0 +1,93 @@
1
+ "use client";
2
+ import { jsx as i, jsxs as u } from "react/jsx-runtime";
3
+ import { OTPFieldPreview as n } from "@base-ui/react/otp-field";
4
+ import { OTPFieldPreview as N } from "@base-ui/react/otp-field";
5
+ import { Fragment as f } from "react";
6
+ import { Divider as m } from "../divider/divider.es.js";
7
+ import { cn as s } from "../../lib/cn.es.js";
8
+ function b({
9
+ className: a,
10
+ size: t = "default",
11
+ ...o
12
+ }) {
13
+ return /* @__PURE__ */ i(
14
+ n.Root,
15
+ {
16
+ className: s(
17
+ "flex items-center gap-2 has-disabled:opacity-64 has-disabled:**:data-[slot=otp-input]:shadow-none has-disabled:**:data-[slot=otp-input]:before:shadow-none!",
18
+ a
19
+ ),
20
+ "data-size": t,
21
+ "data-slot": "otp",
22
+ ...o
23
+ }
24
+ );
25
+ }
26
+ function c({
27
+ className: a,
28
+ ...t
29
+ }) {
30
+ return /* @__PURE__ */ i(
31
+ n.Input,
32
+ {
33
+ className: s(
34
+ "in-[[data-slot=otp][data-size=lg]]:size-10 size-9 min-w-0 rounded-lg border border-input bg-background text-center in-[[data-slot=otp][data-size=lg]]:text-lg text-base text-foreground in-[[data-slot=otp][data-size=lg]]:leading-10 leading-9 outline-none transition-shadow focus-visible:z-10 focus-visible:border-ring aria-invalid:border-error focus-visible:aria-invalid:border-error focus-visible:aria-invalid:ring-error/20 in-[[data-slot=field][data-invalid]]:border-error in-[[data-slot=field][data-invalid]]:focus-visible:border-error in-[[data-slot=field][data-invalid]]:focus-visible:ring-error/20 sm:in-[[data-slot=otp][data-size=lg]]:size-9 sm:size-8 sm:in-[[data-slot=otp][data-size=lg]]:text-base sm:text-sm sm:in-[[data-slot=otp][data-size=lg]]:leading-9 sm:leading-8",
35
+ a
36
+ ),
37
+ "data-slot": "otp-input",
38
+ spellCheck: !1,
39
+ ...t
40
+ }
41
+ );
42
+ }
43
+ function g({
44
+ className: a,
45
+ ...t
46
+ }) {
47
+ return /* @__PURE__ */ i(
48
+ n.Separator,
49
+ {
50
+ render: /* @__PURE__ */ i(
51
+ m,
52
+ {
53
+ className: s(
54
+ "rounded-full bg-input data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:w-3",
55
+ a
56
+ ),
57
+ orientation: "horizontal",
58
+ ...t
59
+ }
60
+ )
61
+ }
62
+ );
63
+ }
64
+ function O({
65
+ split: a,
66
+ inputProps: t,
67
+ size: o,
68
+ length: r,
69
+ "aria-invalid": d,
70
+ ...l
71
+ }) {
72
+ const p = {
73
+ ...d ? { "aria-invalid": !0 } : {},
74
+ ...t
75
+ };
76
+ return /* @__PURE__ */ i(b, { size: o, length: r, "aria-invalid": d, ...l, children: Array.from({ length: r }, (v, e) => /* @__PURE__ */ u(f, { children: [
77
+ /* @__PURE__ */ i(
78
+ c,
79
+ {
80
+ "aria-label": `Character ${e + 1} of ${r}`,
81
+ ...p
82
+ }
83
+ ),
84
+ a === e + 1 && /* @__PURE__ */ i(g, {})
85
+ ] }, e)) });
86
+ }
87
+ export {
88
+ O as OTP,
89
+ c as OTPInput,
90
+ N as OTPPrimitive,
91
+ b as OTPRoot,
92
+ g as OTPSeparator
93
+ };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("lucide-react"),m=require("@base-ui/react/input"),x=require("../../hooks/use-toggle/use-toggle.cjs.js"),o=require("../../lib/cn.cjs.js");function i({className:d,showIcon:l=e.jsx(n.Eye,{className:"h-4 w-4"}),hideIcon:c=e.jsx(n.EyeOff,{className:"h-4 w-4"}),onShow:u,onHide:g,toggleable:h=!0,onValueChange:s,classNames:t,...w}){const[r,b]=x.useToggle(!1),p=()=>{b(),r?g?.():u?.()},f=s?a=>s(a.target.value,a):void 0;return e.jsxs("div",{className:o.cn("relative inline-flex h-8 w-full items-center text-sm","rounded-md border border-input bg-background transition-shadow","focus-within:border-ring","aria-invalid:border-error focus-within:aria-invalid:ring-error/20","has-aria-invalid:border-error focus-within:has-aria-invalid:ring-error/20","has-disabled:cursor-not-allowed has-disabled:opacity-50","[&::-ms-clear]:hidden [&::-ms-reveal]:hidden",d),"data-slot":"password",children:[e.jsx(m.Input,{...w,onChange:f,type:r?"text":"password",className:o.cn("min-w-0 flex-1 bg-transparent pl-3 outline-none","placeholder:text-muted-foreground","disabled:cursor-not-allowed",t?.input)}),e.jsx("button",{"data-slot":"password-toggle",type:"button",onClick:p,disabled:!h,className:o.cn("flex shrink-0 items-center px-2 text-muted-foreground transition-colors","hover:text-foreground","disabled:cursor-not-allowed disabled:opacity-50",t?.toggle),children:r?c:l})]})}exports.Password=i;exports.PasswordRoot=i;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("lucide-react"),m=require("@base-ui/react/input"),x=require("../../hooks/use-boolean/use-boolean.cjs.js"),o=require("../../lib/cn.cjs.js");function i({className:d,showIcon:l=e.jsx(n.Eye,{className:"h-4 w-4"}),hideIcon:c=e.jsx(n.EyeOff,{className:"h-4 w-4"}),onShow:u,onHide:g,toggleable:h=!0,onValueChange:s,classNames:t,...w}){const[r,{toggle:b}]=x.useBoolean(!1),p=()=>{b(),r?g?.():u?.()},f=s?a=>s(a.target.value,a):void 0;return e.jsxs("div",{className:o.cn("relative inline-flex h-8 w-full items-center text-sm","rounded-md border border-input bg-background transition-shadow","focus-within:border-ring","aria-invalid:border-error focus-within:aria-invalid:ring-error/20","has-aria-invalid:border-error focus-within:has-aria-invalid:ring-error/20","has-disabled:cursor-not-allowed has-disabled:opacity-50","[&::-ms-clear]:hidden [&::-ms-reveal]:hidden",d),"data-slot":"password",children:[e.jsx(m.Input,{...w,onChange:f,type:r?"text":"password",className:o.cn("min-w-0 flex-1 bg-transparent pl-3 outline-none","placeholder:text-muted-foreground","disabled:cursor-not-allowed",t?.input)}),e.jsx("button",{"data-slot":"password-toggle",type:"button",onClick:p,disabled:!h,className:o.cn("flex shrink-0 items-center px-2 text-muted-foreground transition-colors","hover:text-foreground","disabled:cursor-not-allowed disabled:opacity-50",t?.toggle),children:r?c:l})]})}exports.Password=i;exports.PasswordRoot=i;