@datum-cloud/datum-ui 0.4.0 → 0.6.0-alpha.3e04d8c

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 (290) hide show
  1. package/README.md +81 -39
  2. package/dist/adapter-context-rWveHhDd.mjs +25 -0
  3. package/dist/alert/index.mjs +2 -3
  4. package/dist/{alert-BC2Mccfo.mjs → alert-BDj6od5I.mjs} +2 -4
  5. package/dist/app-navigation/index.mjs +4 -12
  6. package/dist/{app-navigation-DsCKgfPe.mjs → app-navigation-84ro28PU.mjs} +5 -8
  7. package/dist/autocomplete/index.mjs +2 -7
  8. package/dist/{autocomplete-DRB_kSVx.mjs → autocomplete-CkYJueBL.mjs} +7 -9
  9. package/dist/autosearch/index.mjs +195 -0
  10. package/dist/avatar/index.mjs +2 -4
  11. package/dist/{avatar-DyLq0xkt.mjs → avatar-BtKVcvO4.mjs} +2 -4
  12. package/dist/avatar-stack/index.mjs +2 -6
  13. package/dist/{avatar-stack-BT0dBswq.mjs → avatar-stack-oVr8tsU7.mjs} +4 -6
  14. package/dist/badge/index.mjs +2 -3
  15. package/dist/{badge-BgFj4Nsc.mjs → badge-DJR33ftJ.mjs} +2 -4
  16. package/dist/breadcrumb/index.mjs +2 -4
  17. package/dist/{breadcrumb-CJNaYyk1.mjs → breadcrumb-B-9G347O.mjs} +2 -4
  18. package/dist/button/index.mjs +3 -4
  19. package/dist/{button-0N61fmAR.mjs → button-BllvE9Lm.mjs} +3 -5
  20. package/dist/{button-D6AORsOz.mjs → button-D3RrsMfQ.mjs} +2 -4
  21. package/dist/{link-button-Cby0p4LW.mjs → button-fO8nazJE.mjs} +3 -5
  22. package/dist/button-group/index.mjs +2 -5
  23. package/dist/{button-group-BDk8btAy.mjs → button-group-CYPka2zz.mjs} +3 -5
  24. package/dist/calendar/index.mjs +2 -5
  25. package/dist/{calendar-BtfraIvX.mjs → calendar-DEkCw7I1.mjs} +4 -6
  26. package/dist/{calendar-date-picker-B9mxJM7f.mjs → calendar-date-picker-CDT-8Ha8.mjs} +8 -9
  27. package/dist/card/index.mjs +2 -4
  28. package/dist/{card-BiHXFt4s.mjs → card-DKG1Cwlj.mjs} +3 -6
  29. package/dist/chart/index.mjs +2 -4
  30. package/dist/{chart-CL0i-xIt.mjs → chart-CUa21ynK.mjs} +2 -4
  31. package/dist/checkbox/index.mjs +2 -4
  32. package/dist/{checkbox-CQrjygFt.mjs → checkbox-I5BvrMPe.mjs} +3 -6
  33. package/dist/{close.icon-D2r5q3bj.mjs → close.icon-HCfS4Y-N.mjs} +2 -4
  34. package/dist/{cn-DWCc1QRE.mjs → cn-D2KYQ917.mjs} +1 -3
  35. package/dist/code-editor/index.mjs +2 -0
  36. package/dist/{col-C9PDhvm5.mjs → col-1T0Q3SlH.mjs} +2 -7
  37. package/dist/collapsible/index.mjs +2 -3
  38. package/dist/{collapsible-Dw71o2um.mjs → collapsible-CUphkSBt.mjs} +1 -3
  39. package/dist/combobox/index.mjs +2 -0
  40. package/dist/combobox-B-C9lJeD.mjs +97 -0
  41. package/dist/command/index.mjs +2 -5
  42. package/dist/{command-DVroicgn.mjs → command-DqHWukGK.mjs} +3 -5
  43. package/dist/components/features/autocomplete/autocomplete.d.ts +1 -1
  44. package/dist/components/features/autocomplete/autocomplete.d.ts.map +1 -1
  45. package/dist/components/features/autocomplete/autocomplete.types.d.ts +2 -0
  46. package/dist/components/features/autocomplete/autocomplete.types.d.ts.map +1 -1
  47. package/dist/components/features/autosearch/autosearch.d.ts +35 -0
  48. package/dist/components/features/autosearch/autosearch.d.ts.map +1 -0
  49. package/dist/components/features/autosearch/autosearch.types.d.ts +51 -0
  50. package/dist/components/features/autosearch/autosearch.types.d.ts.map +1 -0
  51. package/dist/components/features/autosearch/index.d.ts +3 -0
  52. package/dist/components/features/autosearch/index.d.ts.map +1 -0
  53. package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts +2 -1
  54. package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts.map +1 -1
  55. package/dist/components/features/code-editor/code-editor-tabs.d.ts +63 -0
  56. package/dist/components/features/code-editor/code-editor-tabs.d.ts.map +1 -0
  57. package/dist/components/features/code-editor/code-editor.d.ts +58 -0
  58. package/dist/components/features/code-editor/code-editor.d.ts.map +1 -0
  59. package/dist/components/features/code-editor/index.d.ts +6 -0
  60. package/dist/components/features/code-editor/index.d.ts.map +1 -0
  61. package/dist/components/features/code-editor/lib/editor.d.ts +7 -0
  62. package/dist/components/features/code-editor/lib/editor.d.ts.map +1 -0
  63. package/dist/components/features/code-editor/types.d.ts +98 -0
  64. package/dist/components/features/code-editor/types.d.ts.map +1 -0
  65. package/dist/components/features/combobox/combobox.d.ts +27 -0
  66. package/dist/components/features/combobox/combobox.d.ts.map +1 -0
  67. package/dist/components/features/combobox/index.d.ts +3 -0
  68. package/dist/components/features/combobox/index.d.ts.map +1 -0
  69. package/dist/components/features/combobox/types.d.ts +84 -0
  70. package/dist/components/features/combobox/types.d.ts.map +1 -0
  71. package/dist/components/features/date-time-picker/date-time-picker.d.ts +9 -0
  72. package/dist/components/features/date-time-picker/date-time-picker.d.ts.map +1 -0
  73. package/dist/components/features/date-time-picker/index.d.ts +3 -0
  74. package/dist/components/features/date-time-picker/index.d.ts.map +1 -0
  75. package/dist/components/features/date-time-picker/types.d.ts +59 -0
  76. package/dist/components/features/date-time-picker/types.d.ts.map +1 -0
  77. package/dist/components/features/date-time-picker/utils/format.d.ts +13 -0
  78. package/dist/components/features/date-time-picker/utils/format.d.ts.map +1 -0
  79. package/dist/components/features/date-time-picker/utils/index.d.ts +3 -0
  80. package/dist/components/features/date-time-picker/utils/index.d.ts.map +1 -0
  81. package/dist/components/features/date-time-picker/utils/timezone.d.ts +23 -0
  82. package/dist/components/features/date-time-picker/utils/timezone.d.ts.map +1 -0
  83. package/dist/components/features/form/adapter-context.d.ts +17 -0
  84. package/dist/components/features/form/adapter-context.d.ts.map +1 -0
  85. package/dist/components/features/form/adapter-types.d.ts +120 -0
  86. package/dist/components/features/form/adapter-types.d.ts.map +1 -0
  87. package/dist/components/features/form/adapters/conform/conform-adapter.d.ts +9 -0
  88. package/dist/components/features/form/adapters/conform/conform-adapter.d.ts.map +1 -0
  89. package/dist/components/features/form/adapters/conform/conform-provider.d.ts +22 -0
  90. package/dist/components/features/form/adapters/conform/conform-provider.d.ts.map +1 -0
  91. package/dist/components/features/form/adapters/conform/index.d.ts +3 -0
  92. package/dist/components/features/form/adapters/conform/index.d.ts.map +1 -0
  93. package/dist/components/features/form/adapters/rhf/index.d.ts +3 -0
  94. package/dist/components/features/form/adapters/rhf/index.d.ts.map +1 -0
  95. package/dist/components/features/form/adapters/rhf/rhf-adapter.d.ts +10 -0
  96. package/dist/components/features/form/adapters/rhf/rhf-adapter.d.ts.map +1 -0
  97. package/dist/components/features/form/adapters/rhf/rhf-provider.d.ts +22 -0
  98. package/dist/components/features/form/adapters/rhf/rhf-provider.d.ts.map +1 -0
  99. package/dist/components/features/form/components/form-autocomplete.d.ts.map +1 -1
  100. package/dist/components/features/form/components/form-autosearch.d.ts +37 -0
  101. package/dist/components/features/form/components/form-autosearch.d.ts.map +1 -0
  102. package/dist/components/features/form/components/form-checkbox.d.ts.map +1 -1
  103. package/dist/components/features/form/components/form-combobox.d.ts +80 -0
  104. package/dist/components/features/form/components/form-combobox.d.ts.map +1 -0
  105. package/dist/components/features/form/components/form-copy-box.d.ts +3 -0
  106. package/dist/components/features/form/components/form-copy-box.d.ts.map +1 -1
  107. package/dist/components/features/form/components/form-custom.d.ts.map +1 -1
  108. package/dist/components/features/form/components/form-date-picker.d.ts +40 -0
  109. package/dist/components/features/form/components/form-date-picker.d.ts.map +1 -0
  110. package/dist/components/features/form/components/form-date-time-picker.d.ts +39 -0
  111. package/dist/components/features/form/components/form-date-time-picker.d.ts.map +1 -0
  112. package/dist/components/features/form/components/form-dialog.d.ts.map +1 -1
  113. package/dist/components/features/form/components/form-field-array.d.ts +5 -17
  114. package/dist/components/features/form/components/form-field-array.d.ts.map +1 -1
  115. package/dist/components/features/form/components/form-field.d.ts +7 -21
  116. package/dist/components/features/form/components/form-field.d.ts.map +1 -1
  117. package/dist/components/features/form/components/form-input-group.d.ts +4 -4
  118. package/dist/components/features/form/components/form-input-group.d.ts.map +1 -1
  119. package/dist/components/features/form/components/form-input.d.ts.map +1 -1
  120. package/dist/components/features/form/components/form-radio-group.d.ts.map +1 -1
  121. package/dist/components/features/form/components/form-root.d.ts +5 -25
  122. package/dist/components/features/form/components/form-root.d.ts.map +1 -1
  123. package/dist/components/features/form/components/form-select.d.ts.map +1 -1
  124. package/dist/components/features/form/components/form-switch.d.ts.map +1 -1
  125. package/dist/components/features/form/components/form-textarea.d.ts.map +1 -1
  126. package/dist/components/features/form/components/form-time-picker.d.ts +21 -0
  127. package/dist/components/features/form/components/form-time-picker.d.ts.map +1 -0
  128. package/dist/components/features/form/components/form-transfer.d.ts +37 -0
  129. package/dist/components/features/form/components/form-transfer.d.ts.map +1 -0
  130. package/dist/components/features/form/components/index.d.ts +7 -1
  131. package/dist/components/features/form/components/index.d.ts.map +1 -1
  132. package/dist/components/features/form/components/stepper/form-stepper.d.ts.map +1 -1
  133. package/dist/components/features/form/context/form-context.d.ts +2 -2
  134. package/dist/components/features/form/context/form-context.d.ts.map +1 -1
  135. package/dist/components/features/form/hooks/index.d.ts +1 -1
  136. package/dist/components/features/form/hooks/index.d.ts.map +1 -1
  137. package/dist/components/features/form/hooks/use-field.d.ts +12 -18
  138. package/dist/components/features/form/hooks/use-field.d.ts.map +1 -1
  139. package/dist/components/features/form/hooks/use-form-state.d.ts +36 -0
  140. package/dist/components/features/form/hooks/use-form-state.d.ts.map +1 -0
  141. package/dist/components/features/form/hooks/use-watch.d.ts +9 -20
  142. package/dist/components/features/form/hooks/use-watch.d.ts.map +1 -1
  143. package/dist/components/features/form/index.d.ts +69 -45
  144. package/dist/components/features/form/index.d.ts.map +1 -1
  145. package/dist/components/features/form/stepper/index.d.ts +17 -0
  146. package/dist/components/features/form/stepper/index.d.ts.map +1 -0
  147. package/dist/components/features/form/types/index.d.ts +68 -32
  148. package/dist/components/features/form/types/index.d.ts.map +1 -1
  149. package/dist/components/features/form/utils/get-field-constraints.d.ts +33 -0
  150. package/dist/components/features/form/utils/get-field-constraints.d.ts.map +1 -0
  151. package/dist/components/features/form/utils/get-schema-defaults.d.ts +24 -0
  152. package/dist/components/features/form/utils/get-schema-defaults.d.ts.map +1 -0
  153. package/dist/components/features/form/utils/zod-helpers.d.ts +12 -0
  154. package/dist/components/features/form/utils/zod-helpers.d.ts.map +1 -0
  155. package/dist/components/features/index.d.ts +1 -0
  156. package/dist/components/features/index.d.ts.map +1 -1
  157. package/dist/components/features/time-picker/index.d.ts +3 -0
  158. package/dist/components/features/time-picker/index.d.ts.map +1 -0
  159. package/dist/components/features/time-picker/time-picker.d.ts +22 -0
  160. package/dist/components/features/time-picker/time-picker.d.ts.map +1 -0
  161. package/dist/components/features/time-picker/types.d.ts +31 -0
  162. package/dist/components/features/time-picker/types.d.ts.map +1 -0
  163. package/dist/components/features/transfer/components/index.d.ts +9 -0
  164. package/dist/components/features/transfer/components/index.d.ts.map +1 -0
  165. package/dist/components/features/transfer/components/transfer-group.d.ts +7 -0
  166. package/dist/components/features/transfer/components/transfer-group.d.ts.map +1 -0
  167. package/dist/components/features/transfer/components/transfer-item.d.ts +10 -0
  168. package/dist/components/features/transfer/components/transfer-item.d.ts.map +1 -0
  169. package/dist/components/features/transfer/components/transfer-panel.d.ts +18 -0
  170. package/dist/components/features/transfer/components/transfer-panel.d.ts.map +1 -0
  171. package/dist/components/features/transfer/components/transfer-search.d.ts +9 -0
  172. package/dist/components/features/transfer/components/transfer-search.d.ts.map +1 -0
  173. package/dist/components/features/transfer/hooks/use-transfer-dnd.d.ts +26 -0
  174. package/dist/components/features/transfer/hooks/use-transfer-dnd.d.ts.map +1 -0
  175. package/dist/components/features/transfer/hooks/use-transfer-state.d.ts +20 -0
  176. package/dist/components/features/transfer/hooks/use-transfer-state.d.ts.map +1 -0
  177. package/dist/components/features/transfer/index.d.ts +3 -0
  178. package/dist/components/features/transfer/index.d.ts.map +1 -0
  179. package/dist/components/features/transfer/transfer.d.ts +6 -0
  180. package/dist/components/features/transfer/transfer.d.ts.map +1 -0
  181. package/dist/components/features/transfer/types.d.ts +69 -0
  182. package/dist/components/features/transfer/types.d.ts.map +1 -0
  183. package/dist/components/toast.d.ts +2 -0
  184. package/dist/components/toast.d.ts.map +1 -0
  185. package/dist/data-table/index.mjs +21 -51
  186. package/dist/date-picker/index.mjs +3 -10
  187. package/dist/date-time-picker/index.mjs +2 -0
  188. package/dist/date-time-picker-BomrW07W.mjs +178 -0
  189. package/dist/dialog/index.mjs +2 -5
  190. package/dist/{dialog-B0B3Kbfk.mjs → dialog-Bm2H9lrx.mjs} +4 -6
  191. package/dist/{dialog-DdrHeboM.mjs → dialog-DASRaFxD.mjs} +2 -4
  192. package/dist/dropdown/index.mjs +2 -3
  193. package/dist/{dropdown-Cdx7rOKv.mjs → dropdown-DZiAt-jS.mjs} +3 -5
  194. package/dist/{dropdown-menu-CdShrDz_.mjs → dropdown-menu-lALvDnab.mjs} +5 -7
  195. package/dist/dropzone/index.mjs +2 -5
  196. package/dist/{dropzone-B6kSN3DY.mjs → dropzone-ogtpQ4fy.mjs} +5 -8
  197. package/dist/empty-content/index.mjs +2 -3
  198. package/dist/{empty-content-B1lwLr40.mjs → empty-content-C63GPJ5d.mjs} +3 -9
  199. package/dist/form/adapters/conform/index.mjs +327 -0
  200. package/dist/form/adapters/rhf/index.mjs +267 -0
  201. package/dist/form/index.mjs +3 -146
  202. package/dist/form/stepper/index.mjs +541 -0
  203. package/dist/form-D8OnRHdd.mjs +1653 -0
  204. package/dist/form-context-Ccxm-wqL.mjs +17 -0
  205. package/dist/get-field-constraints-BicgDkfH.mjs +51 -0
  206. package/dist/grid/index.mjs +2 -3
  207. package/dist/hooks/index.mjs +3 -4
  208. package/dist/{use-debounce-MnfjH51L.mjs → hooks-D8r2M2U6.mjs} +1 -3
  209. package/dist/hover-card/index.mjs +2 -4
  210. package/dist/{hover-card-CEIauuie.mjs → hover-card-DDWWD5Hx.mjs} +2 -4
  211. package/dist/{icon-wrapper-BBK4z4tj.mjs → icon-wrapper-DuLp3RM1.mjs} +1 -3
  212. package/dist/icons/index.mjs +4 -5
  213. package/dist/index.mjs +66 -71
  214. package/dist/input/index.mjs +2 -5
  215. package/dist/{input-DEMoi_8F.mjs → input-DOmNpcQJ.mjs} +2 -4
  216. package/dist/{input-CYFN0Ap2.mjs → input-FKGqZypx.mjs} +3 -5
  217. package/dist/input-group/index.mjs +2 -7
  218. package/dist/{input-group-DJgYpOlq.mjs → input-group-DDtz-RT7.mjs} +5 -7
  219. package/dist/input-number/index.mjs +2 -6
  220. package/dist/{input-number-Cuy9CCg_.mjs → input-number-a7uydAsw.mjs} +4 -6
  221. package/dist/input-with-addons/index.mjs +28 -3
  222. package/dist/label/index.mjs +2 -4
  223. package/dist/{label-mOg07fuQ.mjs → label-cnAhY-ej.mjs} +3 -6
  224. package/dist/loader-overlay/index.mjs +2 -3
  225. package/dist/{loader-overlay-8IWX_1Ga.mjs → loader-overlay-BTFdkp7W.mjs} +3 -5
  226. package/dist/map/index.mjs +2 -14
  227. package/dist/{map-CaI1EshG.mjs → map-CWIQ-eql.mjs} +10 -14
  228. package/dist/{map-leaflet-imports-J7w1V7mh.mjs → map-leaflet-imports-CRSKA79m.mjs} +1 -2
  229. package/dist/more-actions/index.mjs +2 -5
  230. package/dist/{more-actions-BO5ikUxY.mjs → more-actions-ILnEZq_E.mjs} +5 -7
  231. package/dist/nprogress/index.mjs +1 -3
  232. package/dist/page-title/index.mjs +2 -3
  233. package/dist/{page-title-DWteBy1E.mjs → page-title-ChsnpBiH.mjs} +2 -4
  234. package/dist/popover/index.mjs +2 -4
  235. package/dist/{popover-ugw5MpuT.mjs → popover-FJAcbYoH.mjs} +2 -4
  236. package/dist/radio-group/index.mjs +2 -4
  237. package/dist/{radio-group-_gMymwnb.mjs → radio-group-CiITR0LO.mjs} +3 -6
  238. package/dist/select/index.mjs +2 -4
  239. package/dist/{select-BZOKWjlH.mjs → select-CiLR_DiQ.mjs} +3 -6
  240. package/dist/separator/index.mjs +2 -4
  241. package/dist/{separator-BzyALya2.mjs → separator-DXVTncCK.mjs} +2 -4
  242. package/dist/sheet/index.mjs +3 -5
  243. package/dist/{sheet-BX6lae56.mjs → sheet-BzXksqYY.mjs} +4 -6
  244. package/dist/{sheet-DAcFjaGw.mjs → sheet-Di3b-oPu.mjs} +2 -4
  245. package/dist/sidebar/index.mjs +2 -10
  246. package/dist/{sidebar-B3EV33mG.mjs → sidebar-BnhnjvfO.mjs} +10 -14
  247. package/dist/skeleton/index.mjs +2 -5
  248. package/dist/{skeleton-2vQ0vFQk.mjs → skeleton-BKl4mfJt.mjs} +2 -4
  249. package/dist/{skeleton-BgOwIgE0.mjs → skeleton-D1MUhAVo.mjs} +3 -5
  250. package/dist/spinner/index.mjs +2 -4
  251. package/dist/{spinner-osyXAlhr.mjs → spinner-OyOf9-Yu.mjs} +2 -4
  252. package/dist/{spinner.icon-C0MbtgqX.mjs → spinner.icon-C-vjSM6o.mjs} +2 -4
  253. package/dist/stepper/index.mjs +2 -5
  254. package/dist/{stepper-BMsn7I78.mjs → stepper-DvIOp0hh.mjs} +3 -5
  255. package/dist/switch/index.mjs +2 -4
  256. package/dist/{switch-C60FpEal.mjs → switch-DQJQhPIQ.mjs} +3 -6
  257. package/dist/table/index.mjs +2 -4
  258. package/dist/{table-Cl3UzIhI.mjs → table-Cdsh-39-.mjs} +2 -4
  259. package/dist/tabs/index.mjs +50 -3
  260. package/dist/tag-input/index.mjs +2 -5
  261. package/dist/{tag-input-DR2gukhL.mjs → tag-input-T9cUX9-G.mjs} +5 -7
  262. package/dist/task-queue/index.mjs +2 -7
  263. package/dist/{task-queue-dropdown-C9KHKbGh.mjs → task-queue-dropdown-Wcbj-f0V.mjs} +10 -30
  264. package/dist/textarea/index.mjs +2 -5
  265. package/dist/{textarea-CVo38n3S.mjs → textarea-94vq_G_S.mjs} +2 -4
  266. package/dist/{textarea-CZF5n57i.mjs → textarea-BwD-MmTV.mjs} +3 -5
  267. package/dist/theme/index.mjs +2 -3
  268. package/dist/{theme.provider-TUHlMsjM.mjs → themes-DG1md8FI.mjs} +1 -6
  269. package/dist/time-picker/index.mjs +2 -0
  270. package/dist/time-picker-BoF7pZZ2.mjs +43 -0
  271. package/dist/{to-api-format-naIpF-NI.mjs → to-api-format-Bh3c01gr.mjs} +9 -18
  272. package/dist/toast/index.mjs +3 -3
  273. package/dist/{use-toast-By9HuFwP.mjs → toast-BWnN5fax.mjs} +5 -42
  274. package/dist/toast-DpxlFNNx.mjs +37 -0
  275. package/dist/tooltip/index.mjs +2 -4
  276. package/dist/{tooltip-CuX2jQA9.mjs → tooltip-Cruvl5F6.mjs} +3 -6
  277. package/dist/transfer/index.mjs +2 -0
  278. package/dist/transfer-B2n8pgEQ.mjs +260 -0
  279. package/dist/types-BZNk3q65.mjs +357 -0
  280. package/dist/typography/index.mjs +2 -3
  281. package/dist/{typography-Iap9fU5P.mjs → typography-ClB8k55E.mjs} +2 -4
  282. package/dist/{use-copy-to-clipboard-n29wJwvW.mjs → use-copy-to-clipboard-uNeeVHC4.mjs} +2 -4
  283. package/dist/utils/index.mjs +2 -3
  284. package/dist/{utils-DJboNGQM.mjs → utils-C8KwMfT_.mjs} +1 -3
  285. package/dist/visually-hidden/index.mjs +2 -3
  286. package/dist/{visuallyhidden-BJsQCmg-.mjs → visuallyhidden-BLUsJpYH.mjs} +1 -3
  287. package/package.json +85 -3
  288. package/dist/input-with-addons-B8rzNhpq.mjs +0 -30
  289. package/dist/tabs-DJU7JA3h.mjs +0 -52
  290. package/dist/use-stepper-DigoyHhX.mjs +0 -2017
@@ -0,0 +1,267 @@
1
+ import { t as FormAdapterProvider } from "../../../adapter-context-rWveHhDd.mjs";
2
+ import { n as getObjectShape, t as getFieldConstraints } from "../../../get-field-constraints-BicgDkfH.mjs";
3
+ import * as React$1 from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { zodResolver } from "@hookform/resolvers/zod";
6
+ import { FormProvider, useController, useFieldArray, useForm, useFormContext, useWatch } from "react-hook-form";
7
+ //#region src/components/features/form/utils/get-schema-defaults.ts
8
+ /**
9
+ * Derive default values from a Zod schema that match what React Hook Form's
10
+ * `useController` will produce when fields register.
11
+ *
12
+ * This is critical for RHF's `isDirty` tracking: RHF compares current values
13
+ * against `_defaultValues`. Without explicit defaults, RHF uses `{}` as the
14
+ * baseline, so when `useController` registers fields (e.g. `username: ''`),
15
+ * the form is immediately considered dirty.
16
+ *
17
+ * By passing these schema-derived defaults to `useForm({ defaultValues })`,
18
+ * the baseline matches the registered values and `isDirty` starts as `false`.
19
+ *
20
+ * Maps Zod field types to their `useController` registration values:
21
+ * - string -> `''`
22
+ * - number -> `undefined`
23
+ * - boolean -> `false`
24
+ * - array -> `[]`
25
+ * - object -> `{}` (recursive)
26
+ * - optional/nullable wrappers -> unwrap and derive inner default
27
+ * - `.default()` -> use the provided default value
28
+ */
29
+ function getSchemaDefaults(schema) {
30
+ const shape = getObjectShape(schema);
31
+ if (!shape) return {};
32
+ const defaults = {};
33
+ for (const [key, fieldSchema] of Object.entries(shape)) defaults[key] = getFieldDefault(fieldSchema);
34
+ return defaults;
35
+ }
36
+ /**
37
+ * Get the default value for a Zod field type that matches what RHF's
38
+ * `useController` will produce when registering the field.
39
+ *
40
+ * Unwraps optional/nullable/default wrappers to find the inner type,
41
+ * then returns the natural "empty" value for that type.
42
+ */
43
+ function getFieldDefault(schema) {
44
+ const { type } = schema.def;
45
+ if (type === "default") return schema.def.defaultValue;
46
+ if (type === "optional" || type === "nullable") {
47
+ const innerDef = schema.def;
48
+ return getFieldDefault(innerDef.innerType);
49
+ }
50
+ if (type === "pipe") {
51
+ const pipeDef = schema.def;
52
+ return getFieldDefault(pipeDef.in);
53
+ }
54
+ if (type === "string") return "";
55
+ if (type === "number" || type === "bigint" || type === "nan") return void 0;
56
+ if (type === "boolean") return false;
57
+ if (type === "array") return [];
58
+ if (type === "object") return getSchemaDefaults(schema);
59
+ }
60
+ //#endregion
61
+ //#region src/components/features/form/adapters/rhf/rhf-adapter.tsx
62
+ const RHFFormIdContext = React$1.createContext("form");
63
+ /** Create a React Hook Form instance and normalize it to the adapter interface. */
64
+ function useRHFCreateForm(props) {
65
+ const { schema, defaultValues, mode, id, onSubmit, formRef } = props;
66
+ const modeMap = {
67
+ onBlur: "onBlur",
68
+ onChange: "onChange",
69
+ onSubmit: "onSubmit"
70
+ };
71
+ const schemaDefaults = React$1.useMemo(() => getSchemaDefaults(schema), [schema]);
72
+ const mergedDefaults = React$1.useMemo(() => ({
73
+ ...schemaDefaults,
74
+ ...defaultValues
75
+ }), [schemaDefaults, defaultValues]);
76
+ const form = useForm({
77
+ resolver: zodResolver(schema),
78
+ defaultValues: mergedDefaults,
79
+ mode: modeMap[mode]
80
+ });
81
+ const { errors, isDirty, isValid, dirtyFields, touchedFields } = form.formState;
82
+ const constraints = React$1.useMemo(() => getFieldConstraints(schema), [schema]);
83
+ const onSubmitRef = React$1.useRef(onSubmit);
84
+ onSubmitRef.current = onSubmit;
85
+ const normalizedFields = React$1.useMemo(() => {
86
+ const result = {};
87
+ for (const [key, constraint] of Object.entries(constraints)) {
88
+ const fieldError = errors[key];
89
+ result[key] = {
90
+ id: `${id ?? "form"}-${key}`,
91
+ errors: fieldError?.message ? [String(fieldError.message)] : [],
92
+ required: constraint.required,
93
+ isDirty: Boolean(dirtyFields[key]),
94
+ isTouched: Boolean(touchedFields[key])
95
+ };
96
+ }
97
+ return result;
98
+ }, [
99
+ constraints,
100
+ errors,
101
+ id,
102
+ dirtyFields,
103
+ touchedFields
104
+ ]);
105
+ const formState = React$1.useMemo(() => ({
106
+ isDirty,
107
+ isValid,
108
+ isSubmitted: false,
109
+ submitCount: 0,
110
+ dirtyFields: Object.fromEntries(Object.entries(dirtyFields).map(([k, v]) => [k, Boolean(v)])),
111
+ touchedFields: Object.fromEntries(Object.entries(touchedFields).map(([k, v]) => [k, Boolean(v)]))
112
+ }), [
113
+ isDirty,
114
+ isValid,
115
+ dirtyFields,
116
+ touchedFields
117
+ ]);
118
+ const handleSubmit = React$1.useMemo(() => form.handleSubmit((data) => {
119
+ onSubmitRef.current?.(data);
120
+ }), [form]);
121
+ const formProps = React$1.useMemo(() => ({
122
+ id,
123
+ onSubmit: handleSubmit,
124
+ noValidate: true
125
+ }), [id, handleSubmit]);
126
+ return React$1.useMemo(() => ({
127
+ id: id ?? "form",
128
+ fields: normalizedFields,
129
+ formProps,
130
+ formState,
131
+ submit: () => formRef?.current?.requestSubmit(),
132
+ reset: () => form.reset(),
133
+ getValues: () => form.getValues(),
134
+ raw: form
135
+ }), [
136
+ id,
137
+ normalizedFields,
138
+ formProps,
139
+ formState,
140
+ form,
141
+ formRef
142
+ ]);
143
+ }
144
+ /** Resolve a field by name and return its normalized state. */
145
+ function useRHFField(name) {
146
+ const form = useFormContext();
147
+ const formId = React$1.use(RHFFormIdContext);
148
+ const { field, fieldState } = useController({
149
+ name,
150
+ control: form.control
151
+ });
152
+ return React$1.useMemo(() => ({
153
+ name: field.name,
154
+ id: `${formId}-${name}`,
155
+ errors: fieldState.error?.message ? [String(fieldState.error.message)] : [],
156
+ required: false,
157
+ isDirty: fieldState.isDirty,
158
+ isTouched: fieldState.isTouched,
159
+ value: field.value,
160
+ change: (value) => field.onChange(value),
161
+ blur: () => field.onBlur(),
162
+ focus: () => form.setFocus(name)
163
+ }), [
164
+ field,
165
+ fieldState,
166
+ name,
167
+ formId,
168
+ form
169
+ ]);
170
+ }
171
+ /** Watch a single field's value reactively. */
172
+ function useRHFWatchHook(name) {
173
+ return useWatch({
174
+ name,
175
+ control: useFormContext().control
176
+ });
177
+ }
178
+ /** Watch multiple fields' values reactively. */
179
+ function useRHFWatchAllHook(names) {
180
+ const values = useWatch({
181
+ name: names,
182
+ control: useFormContext().control
183
+ });
184
+ const namesKey = names.join(",");
185
+ return React$1.useMemo(() => {
186
+ const result = {};
187
+ names.forEach((n, index) => {
188
+ result[n] = values[index];
189
+ });
190
+ return result;
191
+ }, [namesKey, values]);
192
+ }
193
+ /** Get field array helpers for a given array field name. */
194
+ function useRHFFieldArrayHook(name) {
195
+ const { fields, append, remove, move } = useFieldArray({
196
+ name,
197
+ control: useFormContext().control
198
+ });
199
+ return {
200
+ items: React$1.useMemo(() => fields.map((field, index) => ({
201
+ id: field.id,
202
+ key: field.id,
203
+ name: `${name}.${index}`
204
+ })), [fields, name]),
205
+ append: React$1.useCallback((defaultValue) => {
206
+ append(defaultValue ?? {});
207
+ }, [append]),
208
+ remove,
209
+ move
210
+ };
211
+ }
212
+ /**
213
+ * Wraps children in React Hook Form's FormProvider so that useFormContext()
214
+ * and useController() work inside field components.
215
+ */
216
+ function RHFFormProviderWrapper({ instance, children }) {
217
+ const form = instance.raw;
218
+ return /* @__PURE__ */ jsx(RHFFormIdContext, {
219
+ value: instance.id,
220
+ children: /* @__PURE__ */ jsx(FormProvider, {
221
+ ...form,
222
+ children
223
+ })
224
+ });
225
+ }
226
+ /**
227
+ * React Hook Form adapter implementing the `FormAdapter` interface.
228
+ *
229
+ * Maps react-hook-form's `useForm` / `useController` / `useWatch` APIs
230
+ * to the normalized form adapter contract. Uses `@hookform/resolvers/zod`
231
+ * for Zod schema validation.
232
+ */
233
+ const rhfAdapter = {
234
+ name: "React Hook Form",
235
+ useCreateForm: useRHFCreateForm,
236
+ useField: useRHFField,
237
+ useWatch: useRHFWatchHook,
238
+ useWatchAll: useRHFWatchAllHook,
239
+ useFieldArray: useRHFFieldArrayHook,
240
+ FormProvider: RHFFormProviderWrapper
241
+ };
242
+ //#endregion
243
+ //#region src/components/features/form/adapters/rhf/rhf-provider.tsx
244
+ /**
245
+ * Wrap your application with this provider to use React Hook Form as the form backend.
246
+ *
247
+ * @example
248
+ * ```tsx
249
+ * import { RHFAdapter } from '@datum-cloud/datum-ui/form/adapters/rhf'
250
+ *
251
+ * function App() {
252
+ * return (
253
+ * <RHFAdapter>
254
+ * <MyApp />
255
+ * </RHFAdapter>
256
+ * )
257
+ * }
258
+ * ```
259
+ */
260
+ function RHFAdapter({ children }) {
261
+ return /* @__PURE__ */ jsx(FormAdapterProvider, {
262
+ adapter: rhfAdapter,
263
+ children
264
+ });
265
+ }
266
+ //#endregion
267
+ export { RHFAdapter, rhfAdapter };
@@ -1,146 +1,3 @@
1
- import "../utils-DJboNGQM.mjs";
2
- import "../button-D6AORsOz.mjs";
3
- import "../checkbox-CQrjygFt.mjs";
4
- import "../dialog-DdrHeboM.mjs";
5
- import "../command-DVroicgn.mjs";
6
- import "../input-DEMoi_8F.mjs";
7
- import "../textarea-CVo38n3S.mjs";
8
- import "../label-mOg07fuQ.mjs";
9
- import "../popover-ugw5MpuT.mjs";
10
- import "../radio-group-_gMymwnb.mjs";
11
- import "../select-BZOKWjlH.mjs";
12
- import "../tooltip-CuX2jQA9.mjs";
13
- import "../switch-C60FpEal.mjs";
14
- import { A as FormButton, C as FormField, D as FormCustom, E as FormDescription, O as FormCopyBox, S as FormFieldArray, T as FormDialog, _ as FormSelectItem, a as FormInputGroup, b as FormRadioItem, c as FormStep, d as useWatch, f as useWatchAll, g as FormSelect, h as FormSubmit, i as useField, j as FormAutocomplete, k as FormCheckbox, l as FormStepper, m as FormSwitch, n as useFormContext, o as StepperNavigation, p as FormTextarea, r as useFieldContext, s as StepperControls, t as useStepper, u as FormWhen, v as FormRoot, w as FormError, x as FormInput, y as FormRadioGroup } from "../use-stepper-DigoyHhX.mjs";
15
-
16
- //#region src/components/features/form/index.ts
17
- /**
18
- * Datum Form Library
19
- *
20
- * A compound component pattern form library built on top of Conform.js and Zod
21
- * for easy form creation with built-in validation, error handling, and accessibility features.
22
- *
23
- * @example Basic Usage
24
- * ```tsx
25
- * import { Form } from './';
26
- * import { z } from 'zod';
27
- *
28
- * const userSchema = z.object({
29
- * name: z.string().min(2),
30
- * email: z.string().email(),
31
- * });
32
- *
33
- * function UserForm() {
34
- * return (
35
- * <Form.Root schema={userSchema} onSubmit={(data) => console.log(data)}>
36
- * <Form.Field name="name" label="Name" required>
37
- * <Form.Input />
38
- * </Form.Field>
39
- * <Form.Field name="email" label="Email" required>
40
- * <Form.Input type="email" />
41
- * </Form.Field>
42
- * <Form.Submit>Save</Form.Submit>
43
- * </Form.Root>
44
- * );
45
- * }
46
- * ```
47
- *
48
- * @example Multi-Step Form
49
- * ```tsx
50
- * const steps = [
51
- * { id: 'account', label: 'Account', schema: accountSchema },
52
- * { id: 'profile', label: 'Profile', schema: profileSchema },
53
- * ];
54
- *
55
- * <Form.Stepper steps={steps} onComplete={handleComplete}>
56
- * <Form.StepperNavigation />
57
- * <Form.Step id="account">...</Form.Step>
58
- * <Form.Step id="profile">...</Form.Step>
59
- * <Form.StepperControls />
60
- * </Form.Stepper>
61
- * ```
62
- *
63
- * @example Conditional Fields
64
- * ```tsx
65
- * <Form.Field name="contactMethod">
66
- * <Form.Select>
67
- * <Form.SelectItem value="email">Email</Form.SelectItem>
68
- * <Form.SelectItem value="phone">Phone</Form.SelectItem>
69
- * </Form.Select>
70
- * </Form.Field>
71
- *
72
- * <Form.When field="contactMethod" is="email">
73
- * <Form.Field name="email"><Form.Input type="email" /></Form.Field>
74
- * </Form.When>
75
- * ```
76
- */
77
- /**
78
- * Form compound component
79
- *
80
- * Contains all form-related components as properties:
81
- * - Form.Root - Main form container
82
- * - Form.Field - Field wrapper with label and error handling
83
- * - Form.Input - Text input
84
- * - Form.Textarea - Multi-line text input
85
- * - Form.Select - Dropdown select
86
- * - Form.SelectItem - Select option
87
- * - Form.Checkbox - Checkbox input
88
- * - Form.Switch - Toggle switch
89
- * - Form.RadioGroup - Radio button group
90
- * - Form.RadioItem - Radio button option
91
- * - Form.Submit - Submit button with loading state
92
- * - Form.Error - Error display
93
- * - Form.Description - Helper text
94
- * - Form.Autocomplete - Searchable select with virtualization
95
- * - Form.When - Conditional rendering
96
- * - Form.FieldArray - Dynamic array of fields
97
- * - Form.Custom - Escape hatch for custom implementations
98
- * - Form.Stepper - Multi-step form container
99
- * - Form.Step - Individual step content
100
- * - Form.StepperNavigation - Step progress indicators
101
- * - Form.StepperControls - Previous/Next/Submit buttons
102
- *
103
- * Hooks available:
104
- * - Form.useFormContext - Access form context
105
- * - Form.useFieldContext - Access field context
106
- * - Form.useField - Access and control a specific field
107
- * - Form.useWatch - Watch a field's value
108
- * - Form.useWatchAll - Watch multiple fields
109
- * - Form.useStepper - Access stepper context
110
- */
111
- const Form = {
112
- Root: FormRoot,
113
- Field: FormField,
114
- Submit: FormSubmit,
115
- Button: FormButton,
116
- Error: FormError,
117
- Description: FormDescription,
118
- Input: FormInput,
119
- Textarea: FormTextarea,
120
- Select: FormSelect,
121
- SelectItem: FormSelectItem,
122
- Checkbox: FormCheckbox,
123
- Switch: FormSwitch,
124
- RadioGroup: FormRadioGroup,
125
- RadioItem: FormRadioItem,
126
- CopyBox: FormCopyBox,
127
- Autocomplete: FormAutocomplete,
128
- InputGroup: FormInputGroup,
129
- When: FormWhen,
130
- FieldArray: FormFieldArray,
131
- Custom: FormCustom,
132
- Stepper: FormStepper,
133
- Step: FormStep,
134
- StepperNavigation,
135
- StepperControls,
136
- Dialog: FormDialog,
137
- useFormContext,
138
- useFieldContext,
139
- useField,
140
- useWatch,
141
- useWatchAll,
142
- useStepper
143
- };
144
-
145
- //#endregion
146
- export { Form, FormAutocomplete, FormButton, FormCheckbox, FormCopyBox, FormCustom, FormDescription, FormDialog, FormError, FormField, FormFieldArray, FormInput, FormRadioGroup, FormRadioItem, FormRoot, FormSelect, FormSelectItem, FormStep, FormStepper, FormSubmit, FormSwitch, FormTextarea, FormWhen, StepperControls, StepperNavigation, useField, useFieldContext, useFormContext, useStepper, useWatch, useWatchAll };
1
+ import { A as FormCheckbox, C as FormDialog, D as FormCustom, E as FormDatePicker, M as FormAutosearch, N as FormAutocomplete, O as FormCopyBox, S as FormError, T as FormDateTimePicker, _ as FormRadioGroup, a as useField, b as FormFieldArray, c as useWatchAll, d as FormTextarea, f as FormSwitch, g as FormRoot, h as FormSelectItem, i as useFieldContext, j as FormButton, k as FormCombobox, l as FormTransfer, m as FormSelect, n as useFormState, o as FormWhen, p as FormSubmit, r as useFormContext, s as useWatch, t as Form, u as FormTimePicker, v as FormRadioItem, w as FormDescription, x as FormField, y as FormInput } from "../form-D8OnRHdd.mjs";
2
+ import { n as useAdapter, t as FormAdapterProvider } from "../adapter-context-rWveHhDd.mjs";
3
+ export { Form, FormAdapterProvider, FormAutocomplete, FormAutosearch, FormButton, FormCheckbox, FormCombobox, FormCopyBox, FormCustom, FormDatePicker, FormDateTimePicker, FormDescription, FormDialog, FormError, FormField, FormFieldArray, FormInput, FormRadioGroup, FormRadioItem, FormRoot, FormSelect, FormSelectItem, FormSubmit, FormSwitch, FormTextarea, FormTimePicker, FormTransfer, FormWhen, useAdapter, useField, useFieldContext, useFormContext, useFormState, useWatch, useWatchAll };