@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,1653 @@
1
+ import { t as cn } from "./cn-D2KYQ917.mjs";
2
+ import { t as Button } from "./button-BllvE9Lm.mjs";
3
+ import { t as Icon } from "./icon-wrapper-DuLp3RM1.mjs";
4
+ import { t as Checkbox } from "./checkbox-I5BvrMPe.mjs";
5
+ import { t as Dialog } from "./dialog-Bm2H9lrx.mjs";
6
+ import { t as Input } from "./input-FKGqZypx.mjs";
7
+ import { t as Label } from "./label-cnAhY-ej.mjs";
8
+ import { n as RadioGroupItem, t as RadioGroup } from "./radio-group-CiITR0LO.mjs";
9
+ import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-CiLR_DiQ.mjs";
10
+ import { t as Tooltip } from "./tooltip-Cruvl5F6.mjs";
11
+ import { t as Switch } from "./switch-DQJQhPIQ.mjs";
12
+ import { t as Textarea } from "./textarea-BwD-MmTV.mjs";
13
+ import { t as Autocomplete } from "./autocomplete-CkYJueBL.mjs";
14
+ import { t as CalendarDatePicker } from "./calendar-date-picker-CDT-8Ha8.mjs";
15
+ import { t as toast } from "./toast-BWnN5fax.mjs";
16
+ import { Autosearch } from "./autosearch/index.mjs";
17
+ import { n as useFormContext$1, t as FormProvider } from "./form-context-Ccxm-wqL.mjs";
18
+ import { t as Combobox } from "./combobox-B-C9lJeD.mjs";
19
+ import { t as useCopyToClipboard } from "./use-copy-to-clipboard-uNeeVHC4.mjs";
20
+ import { t as DateTimePicker } from "./date-time-picker-BomrW07W.mjs";
21
+ import { n as useAdapter } from "./adapter-context-rWveHhDd.mjs";
22
+ import { InputWithAddons } from "./input-with-addons/index.mjs";
23
+ import { t as TimePicker } from "./time-picker-BoF7pZZ2.mjs";
24
+ import { t as Transfer } from "./transfer-B2n8pgEQ.mjs";
25
+ import { CheckIcon, CircleHelp, CopyIcon } from "lucide-react";
26
+ import * as React$1 from "react";
27
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
28
+ //#region src/components/features/form/context/field-context.tsx
29
+ const FieldContext = React$1.createContext(null);
30
+ function FieldProvider({ children, value }) {
31
+ return /* @__PURE__ */ jsx(FieldContext, {
32
+ value,
33
+ children
34
+ });
35
+ }
36
+ function useFieldContext$1() {
37
+ const context = React$1.use(FieldContext);
38
+ if (!context) throw new Error("useFieldContext must be used within a Form.Field component. Make sure your input component is wrapped with Form.Field.");
39
+ return context;
40
+ }
41
+ /**
42
+ * Optional field context - returns null if not within a Form.Field
43
+ * Useful for components that can work both inside and outside Form.Field
44
+ */
45
+ function useOptionalFieldContext() {
46
+ return React$1.use(FieldContext);
47
+ }
48
+ //#endregion
49
+ //#region src/components/features/form/components/form-autocomplete.tsx
50
+ /**
51
+ * Form.Autocomplete - Searchable select component
52
+ *
53
+ * Automatically wired to the parent Form.Field context.
54
+ * Supports flat/grouped options, virtualization, custom rendering, and async search.
55
+ *
56
+ * @example Basic usage
57
+ * ```tsx
58
+ * <Form.Field name="timezone" label="Timezone" required>
59
+ * <Form.Autocomplete
60
+ * options={timezones}
61
+ * placeholder="Select timezone..."
62
+ * />
63
+ * </Form.Field>
64
+ * ```
65
+ *
66
+ * @example Async search
67
+ * ```tsx
68
+ * <Form.Field name="userId" label="User">
69
+ * <Form.Autocomplete
70
+ * options={users ?? []}
71
+ * onSearchChange={setSearch}
72
+ * loading={isLoading}
73
+ * placeholder="Search users..."
74
+ * />
75
+ * </Form.Field>
76
+ * ```
77
+ *
78
+ * @example Grouped options
79
+ * ```tsx
80
+ * <Form.Field name="role" label="Role" required>
81
+ * <Form.Autocomplete
82
+ * options={roleGroups}
83
+ * placeholder="Select a role..."
84
+ * />
85
+ * </Form.Field>
86
+ * ```
87
+ */
88
+ function FormAutocomplete({ disabled, className, ...props }) {
89
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
90
+ const isDisabled = disabled ?? fieldDisabled;
91
+ const hasErrors = errors && errors.length > 0;
92
+ const value = fieldState?.value != null ? String(fieldState.value) : "";
93
+ return /* @__PURE__ */ jsx(Autocomplete, {
94
+ ...props,
95
+ name: fieldState?.name,
96
+ id,
97
+ value,
98
+ onValueChange: (val) => fieldState?.change(val),
99
+ disabled: isDisabled,
100
+ triggerClassName: cn(hasErrors && "border-destructive", props.triggerClassName),
101
+ className
102
+ });
103
+ }
104
+ FormAutocomplete.displayName = "Form.Autocomplete";
105
+ //#endregion
106
+ //#region src/components/features/form/components/form-autosearch.tsx
107
+ /**
108
+ * Form.Autosearch - Search-first input with dropdown results
109
+ *
110
+ * Automatically wired to the parent Form.Field context.
111
+ * Shows a text input that triggers search and displays results in a popover.
112
+ * Different from Form.Autocomplete which shows all options upfront.
113
+ *
114
+ * @example Basic usage
115
+ * ```tsx
116
+ * <Form.Field name="userId" label="User" required>
117
+ * <Form.Autosearch
118
+ * options={users}
119
+ * onSearch={handleSearch}
120
+ * loading={isSearching}
121
+ * placeholder="Search users..."
122
+ * />
123
+ * </Form.Field>
124
+ * ```
125
+ *
126
+ * @example With debounce control
127
+ * ```tsx
128
+ * <Form.Field name="email" label="Email">
129
+ * <Form.Autosearch
130
+ * options={searchResults}
131
+ * onSearch={debouncedSearch}
132
+ * searchDebounceMs={500}
133
+ * placeholder="Type email to search..."
134
+ * />
135
+ * </Form.Field>
136
+ * ```
137
+ */
138
+ function FormAutosearch({ disabled, className, inputClassName, ...props }) {
139
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
140
+ const isDisabled = disabled ?? fieldDisabled;
141
+ const hasErrors = errors && errors.length > 0;
142
+ const value = fieldState?.value != null ? String(fieldState.value) : "";
143
+ return /* @__PURE__ */ jsx(Autosearch, {
144
+ ...props,
145
+ name: fieldState?.name,
146
+ id,
147
+ value,
148
+ onValueChange: (val) => fieldState?.change(val),
149
+ disabled: isDisabled,
150
+ inputClassName: cn(hasErrors && "border-destructive", inputClassName),
151
+ className
152
+ });
153
+ }
154
+ FormAutosearch.displayName = "Form.Autosearch";
155
+ //#endregion
156
+ //#region src/components/features/form/components/form-button.tsx
157
+ /**
158
+ * Form.Button - A button for non-submit actions within a form
159
+ *
160
+ * Automatically gets disabled when the form is submitting.
161
+ * Use this for cancel buttons, reset buttons, or other actions.
162
+ *
163
+ * @example
164
+ * ```tsx
165
+ * <Form.Button onClick={() => navigate(-1)}>
166
+ * Cancel
167
+ * </Form.Button>
168
+ *
169
+ * <Form.Button onClick={() => form.reset()} type="secondary">
170
+ * Reset
171
+ * </Form.Button>
172
+ * ```
173
+ */
174
+ function FormButton({ children, onClick, type = "quaternary", theme = "borderless", size, disabled, className, disableOnSubmit = true }) {
175
+ const { isSubmitting } = useFormContext$1();
176
+ return /* @__PURE__ */ jsx(Button, {
177
+ htmlType: "button",
178
+ type,
179
+ theme,
180
+ size,
181
+ disabled: disabled || disableOnSubmit && isSubmitting,
182
+ className,
183
+ onClick,
184
+ children
185
+ });
186
+ }
187
+ FormButton.displayName = "Form.Button";
188
+ //#endregion
189
+ //#region src/components/features/form/components/form-checkbox.tsx
190
+ /**
191
+ * Form.Checkbox - Checkbox input component
192
+ *
193
+ * Automatically wired to the parent Form.Field context.
194
+ *
195
+ * @example
196
+ * ```tsx
197
+ * <Form.Field name="terms">
198
+ * <Form.Checkbox label="I agree to the terms and conditions" />
199
+ * </Form.Field>
200
+ * ```
201
+ */
202
+ function FormCheckbox({ label, disabled, className }) {
203
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
204
+ const isDisabled = disabled ?? fieldDisabled;
205
+ const hasErrors = errors && errors.length > 0;
206
+ const checked = Boolean(fieldState?.value);
207
+ return /* @__PURE__ */ jsxs("div", {
208
+ className: cn("flex items-center space-x-2", className),
209
+ children: [/* @__PURE__ */ jsx(Checkbox, {
210
+ id,
211
+ checked,
212
+ onCheckedChange: (value) => fieldState?.change(Boolean(value)),
213
+ disabled: isDisabled,
214
+ "aria-invalid": hasErrors || void 0,
215
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
216
+ }), label && /* @__PURE__ */ jsx(Label, {
217
+ htmlFor: id,
218
+ className: cn("cursor-pointer text-sm font-normal", isDisabled && "cursor-not-allowed opacity-70"),
219
+ children: label
220
+ })]
221
+ });
222
+ }
223
+ FormCheckbox.displayName = "Form.Checkbox";
224
+ //#endregion
225
+ //#region src/components/features/form/components/form-combobox.tsx
226
+ function FormCombobox({ options, placeholder, searchPlaceholder, emptyMessage, disabled, className, triggerClassName, contentClassName, searchable = true, showDropdownArrow = true, clearable = false, "data-testid": testId, modal }) {
227
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
228
+ const isDisabled = disabled ?? fieldDisabled;
229
+ const hasErrors = errors && errors.length > 0;
230
+ const handleChange = React$1.useCallback((value) => {
231
+ fieldState?.change(value ?? "");
232
+ }, [fieldState]);
233
+ return /* @__PURE__ */ jsx(Combobox, {
234
+ id,
235
+ options,
236
+ value: fieldState?.value ?? "",
237
+ onChange: handleChange,
238
+ placeholder,
239
+ searchPlaceholder,
240
+ emptyMessage,
241
+ disabled: isDisabled,
242
+ searchable,
243
+ showDropdownArrow,
244
+ clearable,
245
+ modal,
246
+ className,
247
+ triggerClassName: cn(hasErrors && "border-destructive", triggerClassName),
248
+ contentClassName,
249
+ "data-testid": testId
250
+ });
251
+ }
252
+ FormCombobox.displayName = "Form.Combobox";
253
+ //#endregion
254
+ //#region src/components/features/form/components/form-copy-box.tsx
255
+ /**
256
+ * Form.CopyBox - Read-only field with copy-to-clipboard functionality
257
+ *
258
+ * Displays field value in a read-only box with a copy button.
259
+ * Automatically gets value from Form.Field context.
260
+ *
261
+ * @example Basic usage
262
+ * ```tsx
263
+ * <Form.Field name="organizationId" label="Organization ID">
264
+ * <Form.CopyBox />
265
+ * </Form.Field>
266
+ * ```
267
+ *
268
+ * @example With icon-only button
269
+ * ```tsx
270
+ * <Form.Field name="apiKey" label="API Key">
271
+ * <Form.CopyBox variant="icon-only" />
272
+ * </Form.Field>
273
+ * ```
274
+ *
275
+ * @example With placeholder
276
+ * ```tsx
277
+ * <Form.Field name="webhookUrl" label="Webhook URL">
278
+ * <Form.CopyBox placeholder="Not configured" />
279
+ * </Form.Field>
280
+ * ```
281
+ */
282
+ function FormCopyBox({ variant = "default", className, contentClassName, buttonClassName, placeholder = "" }) {
283
+ const { fieldState } = useFieldContext$1();
284
+ const [copied, copy] = useCopyToClipboard();
285
+ const value = fieldState?.value != null ? String(fieldState.value) : "";
286
+ const displayValue = value || placeholder;
287
+ const copyToClipboard = () => {
288
+ if (!value) return;
289
+ copy(value).then(() => {
290
+ toast.success("Copied to clipboard");
291
+ });
292
+ };
293
+ return /* @__PURE__ */ jsxs("div", {
294
+ className: cn("group border-input flex h-10 w-full overflow-hidden rounded-lg border bg-[#F6F6F580] text-xs focus-within:outline-hidden", className),
295
+ children: [/* @__PURE__ */ jsx("div", {
296
+ className: cn("flex w-full items-center overflow-hidden px-3 py-2 text-xs opacity-50", contentClassName),
297
+ children: /* @__PURE__ */ jsx("span", {
298
+ className: "truncate",
299
+ children: displayValue
300
+ })
301
+ }), /* @__PURE__ */ jsx("div", {
302
+ className: "flex items-center py-2 pr-3",
303
+ children: variant === "icon-only" ? /* @__PURE__ */ jsx("button", {
304
+ type: "button",
305
+ className: cn("text-muted-foreground hover:text-foreground flex size-7 items-center justify-center rounded-sm transition-colors", buttonClassName),
306
+ onClick: copyToClipboard,
307
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) : /* @__PURE__ */ jsx(CopyIcon, { className: "size-4" })
308
+ }) : /* @__PURE__ */ jsxs(Button, {
309
+ type: "quaternary",
310
+ theme: "outline",
311
+ size: "small",
312
+ className: cn("h-7 w-fit gap-1 px-2 text-xs", buttonClassName),
313
+ onClick: copyToClipboard,
314
+ children: [/* @__PURE__ */ jsx(CopyIcon, { className: "size-3!" }), copied ? "Copied" : "Copy"]
315
+ })
316
+ })]
317
+ });
318
+ }
319
+ FormCopyBox.displayName = "Form.CopyBox";
320
+ //#endregion
321
+ //#region src/components/features/form/components/form-custom.tsx
322
+ /**
323
+ * Form.Custom - Escape hatch for custom implementations
324
+ *
325
+ * Provides access to the underlying form context for complex use cases
326
+ * that don't fit the standard component patterns.
327
+ *
328
+ * @example
329
+ * ```tsx
330
+ * <Form.Custom>
331
+ * {({ form, fields, submit, reset }) => (
332
+ * <MyCustomComponent
333
+ * fields={fields}
334
+ * onCustomAction={() => {
335
+ * // Do something custom
336
+ * submit();
337
+ * }}
338
+ * />
339
+ * )}
340
+ * </Form.Custom>
341
+ * ```
342
+ */
343
+ function FormCustom({ children }) {
344
+ const ctx = useFormContext$1();
345
+ return /* @__PURE__ */ jsx(Fragment$1, { children: children({
346
+ form: ctx.form,
347
+ fields: ctx.fields,
348
+ isSubmitting: ctx.isSubmitting,
349
+ isDirty: ctx.isDirty,
350
+ isValid: ctx.isValid,
351
+ isSubmitted: ctx.isSubmitted,
352
+ submitCount: ctx.submitCount,
353
+ dirtyFields: ctx.dirtyFields,
354
+ touchedFields: ctx.touchedFields,
355
+ submit: ctx.submit,
356
+ reset: ctx.reset
357
+ }) });
358
+ }
359
+ FormCustom.displayName = "Form.Custom";
360
+ //#endregion
361
+ //#region src/components/features/form/components/form-date-picker.tsx
362
+ function FormDatePicker({ placeholder, disabled, className, triggerClassName, numberOfMonths = 1, minDate: minDateProp, maxDate: maxDateProp, disableFuture, disablePast, modal }) {
363
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
364
+ const isDisabled = disabled ?? fieldDisabled;
365
+ const hasErrors = errors && errors.length > 0;
366
+ const currentValue = React$1.useMemo(() => {
367
+ const val = fieldState?.value;
368
+ if (!val) return {
369
+ from: void 0,
370
+ to: void 0
371
+ };
372
+ if (val instanceof Date) return {
373
+ from: val,
374
+ to: val
375
+ };
376
+ if (typeof val === "string") {
377
+ const date = new Date(val);
378
+ return {
379
+ from: date,
380
+ to: date
381
+ };
382
+ }
383
+ if (typeof val === "object" && "from" in val) return val;
384
+ return {
385
+ from: void 0,
386
+ to: void 0
387
+ };
388
+ }, [fieldState?.value]);
389
+ const minDate = minDateProp;
390
+ const maxDate = maxDateProp;
391
+ return /* @__PURE__ */ jsx(CalendarDatePicker, {
392
+ id,
393
+ date: currentValue,
394
+ onDateSelect: React$1.useCallback((range) => {
395
+ if (!range) {
396
+ fieldState?.change(void 0);
397
+ return;
398
+ }
399
+ if (numberOfMonths === 1) fieldState?.change(range.from.toISOString());
400
+ else fieldState?.change({
401
+ from: range.from.toISOString(),
402
+ to: range.to?.toISOString()
403
+ });
404
+ }, [fieldState, numberOfMonths]),
405
+ numberOfMonths,
406
+ placeholder,
407
+ disabled: isDisabled,
408
+ minDate,
409
+ maxDate,
410
+ disableFuture,
411
+ disablePast,
412
+ variant: "outline",
413
+ modal,
414
+ className: cn(className),
415
+ triggerClassName: cn(triggerClassName),
416
+ "aria-invalid": hasErrors || void 0,
417
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
418
+ });
419
+ }
420
+ FormDatePicker.displayName = "Form.DatePicker";
421
+ //#endregion
422
+ //#region src/components/features/form/components/form-date-time-picker.tsx
423
+ function FormDateTimePicker({ minDate: minDateProp, maxDate: maxDateProp, disabledDates, timezone, showTimezoneIndicator, placeholder, disabled, className, modal }) {
424
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
425
+ const isDisabled = disabled ?? fieldDisabled;
426
+ const hasErrors = errors && errors.length > 0;
427
+ const currentValue = React$1.useMemo(() => {
428
+ const val = fieldState?.value;
429
+ if (!val) return void 0;
430
+ if (typeof val === "string") return val;
431
+ }, [fieldState?.value]);
432
+ const minDate = minDateProp;
433
+ const maxDate = maxDateProp;
434
+ return /* @__PURE__ */ jsx(DateTimePicker, {
435
+ value: currentValue,
436
+ onChange: React$1.useCallback((value) => {
437
+ fieldState?.change(value);
438
+ }, [fieldState]),
439
+ minDate,
440
+ maxDate,
441
+ disabledDates,
442
+ timezone,
443
+ showTimezoneIndicator,
444
+ placeholder,
445
+ disabled: isDisabled,
446
+ modal,
447
+ className: cn(className),
448
+ "aria-invalid": hasErrors || void 0,
449
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
450
+ });
451
+ }
452
+ FormDateTimePicker.displayName = "Form.DateTimePicker";
453
+ //#endregion
454
+ //#region src/components/features/form/components/form-description.tsx
455
+ /**
456
+ * Form.Description - Display field description/helper text
457
+ *
458
+ * @example
459
+ * ```tsx
460
+ * <Form.Field name="password">
461
+ * <Form.Input type="password" />
462
+ * <Form.Description>
463
+ * Must be at least 8 characters with one uppercase letter
464
+ * </Form.Description>
465
+ * </Form.Field>
466
+ * ```
467
+ */
468
+ function FormDescription({ children, className }) {
469
+ const fieldContext = useOptionalFieldContext();
470
+ return /* @__PURE__ */ jsx("p", {
471
+ id: fieldContext ? `${fieldContext.id}-description` : void 0,
472
+ className: cn("text-muted-foreground text-xs text-wrap", className),
473
+ children
474
+ });
475
+ }
476
+ FormDescription.displayName = "Form.Description";
477
+ //#endregion
478
+ //#region src/components/features/form/components/form-dialog.tsx
479
+ /**
480
+ * Form.Dialog - A dialog with an integrated form
481
+ *
482
+ * Combines Dialog and Form.Root into a single component with:
483
+ * - Automatic dialog state management (controlled or uncontrolled)
484
+ * - Built-in header with title and description
485
+ * - Built-in footer with submit and cancel buttons
486
+ * - Auto-close on successful submission
487
+ * - Prevents accidental close during submission
488
+ * - Supports render function pattern for form state access
489
+ *
490
+ * @example Basic usage
491
+ * ```tsx
492
+ * <Form.Dialog
493
+ * title="Add User"
494
+ * description="Enter user details"
495
+ * schema={userSchema}
496
+ * onSubmit={handleSubmit}
497
+ * trigger={<Button>Add User</Button>}
498
+ * >
499
+ * <Form.Field name="name" label="Name" required>
500
+ * <Form.Input />
501
+ * </Form.Field>
502
+ * <Form.Field name="email" label="Email" required>
503
+ * <Form.Input type="email" />
504
+ * </Form.Field>
505
+ * </Form.Dialog>
506
+ * ```
507
+ *
508
+ * @example With render function for form state access
509
+ * ```tsx
510
+ * <Form.Dialog
511
+ * title="Edit User"
512
+ * schema={userSchema}
513
+ * defaultValues={user}
514
+ * onSubmit={handleSubmit}
515
+ * trigger={<Button>Edit</Button>}
516
+ * >
517
+ * {({ form, fields, isSubmitting, reset }) => (
518
+ * <>
519
+ * <Form.Field name="name" label="Name">
520
+ * <Form.Input />
521
+ * </Form.Field>
522
+ * <Button variant="ghost" onClick={reset} disabled={isSubmitting}>
523
+ * Reset
524
+ * </Button>
525
+ * </>
526
+ * )}
527
+ * </Form.Dialog>
528
+ * ```
529
+ */
530
+ function FormDialog({ open, onOpenChange, defaultOpen, title, description, trigger, schema, defaultValues, onSubmit, onSuccess, onError, submitText = "Submit", submitTextLoading = "Submitting...", cancelText = "Cancel", showCancel = true, submitType = "primary", loading, formComponent, telemetry, className, formClassName, children }) {
531
+ const [internalOpen, setInternalOpen] = React$1.useState(defaultOpen ?? false);
532
+ const [internalIsSubmitting, setInternalIsSubmitting] = React$1.useState(false);
533
+ const isSubmitting = loading ?? internalIsSubmitting;
534
+ const isControlled = open !== void 0;
535
+ const isOpen = isControlled ? open : internalOpen;
536
+ const handleOpenChange = React$1.useCallback((value) => {
537
+ if (!value && isSubmitting) return;
538
+ if (!isControlled) setInternalOpen(value);
539
+ onOpenChange?.(value);
540
+ }, [
541
+ isControlled,
542
+ isSubmitting,
543
+ onOpenChange
544
+ ]);
545
+ const handleSubmit = React$1.useCallback(async (data) => {
546
+ if (loading === void 0) setInternalIsSubmitting(true);
547
+ try {
548
+ await onSubmit?.(data);
549
+ onSuccess?.(data);
550
+ } finally {
551
+ if (loading === void 0) setInternalIsSubmitting(false);
552
+ }
553
+ }, [
554
+ onSubmit,
555
+ onSuccess,
556
+ loading
557
+ ]);
558
+ const handleCancel = React$1.useCallback(() => {
559
+ handleOpenChange(false);
560
+ }, [handleOpenChange]);
561
+ return /* @__PURE__ */ jsxs(Dialog, {
562
+ open: isOpen,
563
+ onOpenChange: handleOpenChange,
564
+ children: [trigger && /* @__PURE__ */ jsx(Dialog.Trigger, { children: trigger }), /* @__PURE__ */ jsx(Dialog.Content, {
565
+ className,
566
+ children: /* @__PURE__ */ jsx(Form.Root, {
567
+ schema,
568
+ defaultValues,
569
+ onSubmit: handleSubmit,
570
+ onError,
571
+ isSubmitting,
572
+ mode: "onSubmit",
573
+ formComponent,
574
+ telemetry,
575
+ className: cn("space-y-0", formClassName),
576
+ children: (renderProps) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
577
+ /* @__PURE__ */ jsx(Dialog.Header, {
578
+ title,
579
+ description,
580
+ onClose: handleCancel,
581
+ className: "border-b",
582
+ descriptionClassName: "text-foreground/80"
583
+ }),
584
+ /* @__PURE__ */ jsx(Dialog.Body, {
585
+ className: "space-y-0",
586
+ children: typeof children === "function" ? children(renderProps) : children
587
+ }),
588
+ /* @__PURE__ */ jsxs(Dialog.Footer, {
589
+ className: "border-t",
590
+ children: [showCancel && /* @__PURE__ */ jsx(Form.Button, {
591
+ type: "quaternary",
592
+ theme: "outline",
593
+ onClick: handleCancel,
594
+ disableOnSubmit: true,
595
+ children: cancelText
596
+ }), /* @__PURE__ */ jsx(Form.Submit, {
597
+ type: submitType,
598
+ children: isSubmitting ? submitTextLoading : submitText
599
+ })]
600
+ })
601
+ ] })
602
+ })
603
+ })]
604
+ });
605
+ }
606
+ FormDialog.displayName = "Form.Dialog";
607
+ //#endregion
608
+ //#region src/components/features/form/components/form-error.tsx
609
+ /**
610
+ * Form.Error - Display field errors
611
+ *
612
+ * Can be used inside Form.Field to display errors automatically,
613
+ * or standalone with custom rendering.
614
+ *
615
+ * @example
616
+ * ```tsx
617
+ * // Inside Form.Field - displays field errors automatically
618
+ * <Form.Field name="email">
619
+ * <Form.Input />
620
+ * <Form.Error />
621
+ * </Form.Field>
622
+ *
623
+ * // Custom rendering
624
+ * <Form.Field name="email">
625
+ * <Form.Input />
626
+ * <Form.Error>
627
+ * {(errors) => errors.map(e => <span key={e}>{e}</span>)}
628
+ * </Form.Error>
629
+ * </Form.Field>
630
+ * ```
631
+ */
632
+ function FormError({ children, className }) {
633
+ const errors = useOptionalFieldContext()?.errors;
634
+ if (!errors || errors.length === 0) return null;
635
+ if (typeof children === "function") return /* @__PURE__ */ jsx(Fragment$1, { children: children(errors) });
636
+ return /* @__PURE__ */ jsx("ul", {
637
+ className: cn("text-destructive space-y-1 text-sm font-medium", errors.length > 1 && "list-disc pl-4", className),
638
+ role: "alert",
639
+ "aria-live": "polite",
640
+ children: errors.map((error) => /* @__PURE__ */ jsx("li", {
641
+ className: "text-wrap",
642
+ children: error
643
+ }, error))
644
+ });
645
+ }
646
+ FormError.displayName = "Form.Error";
647
+ //#endregion
648
+ //#region src/components/features/form/components/form-field.tsx
649
+ function FieldLabel({ htmlFor, label, hasErrors, required, tooltip, className }) {
650
+ const [isTooltipVisible, setIsTooltipVisible] = React$1.useState(false);
651
+ return /* @__PURE__ */ jsxs("div", {
652
+ className: "relative flex w-fit items-center space-x-2",
653
+ children: [/* @__PURE__ */ jsxs(Label, {
654
+ htmlFor,
655
+ className: cn("text-foreground/80 gap-0 text-xs font-semibold", hasErrors && "text-destructive", className),
656
+ children: [label, required && /* @__PURE__ */ jsx("span", {
657
+ className: "text-destructive/80 align-super text-sm leading-0",
658
+ "aria-hidden": "true",
659
+ children: "*"
660
+ })]
661
+ }), tooltip && /* @__PURE__ */ jsx(Tooltip, {
662
+ message: tooltip,
663
+ open: isTooltipVisible,
664
+ onOpenChange: setIsTooltipVisible,
665
+ side: "bottom",
666
+ contentClassName: "max-w-xs text-wrap",
667
+ children: /* @__PURE__ */ jsx(Icon, {
668
+ icon: CircleHelp,
669
+ className: cn("text-ring absolute top-0.5 -right-3 size-3.5 cursor-pointer transition-opacity duration-400")
670
+ })
671
+ })]
672
+ });
673
+ }
674
+ /**
675
+ * Form.Field - Field wrapper that provides label, errors, and description.
676
+ * Uses the active adapter to resolve field state by name.
677
+ *
678
+ * @example Standard usage
679
+ * ```tsx
680
+ * <Form.Field name="email" label="Email" required>
681
+ * <Form.Input type="email" />
682
+ * </Form.Field>
683
+ * ```
684
+ *
685
+ * @example Render function for custom components
686
+ * ```tsx
687
+ * <Form.Field name="role" label="Role">
688
+ * {({ control, meta }) => (
689
+ * <CustomSelect value={control.value} onChange={control.change} />
690
+ * )}
691
+ * </Form.Field>
692
+ * ```
693
+ */
694
+ function FormField({ name, children, label, description, tooltip, required = false, disabled = false, className, labelClassName }) {
695
+ const adapter = useAdapter();
696
+ const { fields, isSubmitting, form } = useFormContext$1();
697
+ const fieldState = adapter.useField(name);
698
+ const errors = fieldState.errors;
699
+ const hasErrors = errors.length > 0;
700
+ const fieldId = fieldState.id;
701
+ const descriptionId = description ? `${fieldId}-description` : void 0;
702
+ const errorId = hasErrors ? `${fieldId}-error` : void 0;
703
+ const fieldRequired = required || fieldState.required;
704
+ const contextValue = React$1.useMemo(() => ({
705
+ name,
706
+ id: fieldId,
707
+ errors,
708
+ required: fieldRequired,
709
+ disabled,
710
+ fieldState
711
+ }), [
712
+ name,
713
+ fieldId,
714
+ errors,
715
+ fieldRequired,
716
+ disabled,
717
+ fieldState
718
+ ]);
719
+ const isRenderFunction = typeof children === "function";
720
+ const renderContent = () => {
721
+ if (isRenderFunction) return children({
722
+ field: fieldState,
723
+ control: {
724
+ value: fieldState.value,
725
+ change: fieldState.change,
726
+ blur: fieldState.blur,
727
+ focus: fieldState.focus
728
+ },
729
+ meta: {
730
+ name,
731
+ id: fieldId,
732
+ errors,
733
+ required: fieldRequired,
734
+ disabled
735
+ },
736
+ fields,
737
+ form,
738
+ isSubmitting
739
+ });
740
+ return children;
741
+ };
742
+ return /* @__PURE__ */ jsx(FieldProvider, {
743
+ value: contextValue,
744
+ children: /* @__PURE__ */ jsxs("div", {
745
+ className: cn("flex flex-col space-y-2", className),
746
+ children: [
747
+ label && /* @__PURE__ */ jsx(FieldLabel, {
748
+ htmlFor: fieldId,
749
+ label,
750
+ hasErrors,
751
+ required: fieldRequired,
752
+ tooltip,
753
+ className: labelClassName
754
+ }),
755
+ renderContent(),
756
+ description && /* @__PURE__ */ jsx("p", {
757
+ id: descriptionId,
758
+ className: "text-ring text-xs text-wrap",
759
+ children: description
760
+ }),
761
+ hasErrors && /* @__PURE__ */ jsx("ul", {
762
+ id: errorId,
763
+ className: cn("text-destructive space-y-1 text-xs font-medium", errors.length > 1 && "list-disc pl-4"),
764
+ role: "alert",
765
+ "aria-live": "polite",
766
+ children: errors.map((error) => /* @__PURE__ */ jsx("li", {
767
+ className: "text-wrap",
768
+ children: error
769
+ }, error))
770
+ })
771
+ ]
772
+ })
773
+ });
774
+ }
775
+ FormField.displayName = "Form.Field";
776
+ //#endregion
777
+ //#region src/components/features/form/components/form-field-array.tsx
778
+ /**
779
+ * Form.FieldArray - Dynamic array of fields with append/remove/move helpers.
780
+ *
781
+ * @example
782
+ * ```tsx
783
+ * <Form.FieldArray name="members">
784
+ * {({ fields, append, remove }) => (
785
+ * <>
786
+ * {fields.map((field, index) => (
787
+ * <div key={field.key}>
788
+ * <Form.Field name={`members.${index}.email`} label="Email">
789
+ * <Form.Input type="email" />
790
+ * </Form.Field>
791
+ * <button onClick={() => remove(index)}>Remove</button>
792
+ * </div>
793
+ * ))}
794
+ * <button onClick={() => append({})}>Add Member</button>
795
+ * </>
796
+ * )}
797
+ * </Form.FieldArray>
798
+ * ```
799
+ */
800
+ function FormFieldArray({ name, children }) {
801
+ const fieldArray = useAdapter().useFieldArray(name);
802
+ return /* @__PURE__ */ jsx(Fragment$1, { children: children({
803
+ fields: fieldArray.items,
804
+ append: fieldArray.append,
805
+ remove: fieldArray.remove,
806
+ move: fieldArray.move
807
+ }) });
808
+ }
809
+ FormFieldArray.displayName = "Form.FieldArray";
810
+ //#endregion
811
+ //#region src/components/features/form/components/form-input.tsx
812
+ /**
813
+ * Form.Input - Text input component
814
+ *
815
+ * Automatically wired to the parent Form.Field context.
816
+ *
817
+ * @example
818
+ * ```tsx
819
+ * <Form.Field name="email" label="Email" required>
820
+ * <Form.Input type="email" placeholder="john@example.com" />
821
+ * </Form.Field>
822
+ * ```
823
+ */
824
+ function FormInput({ ref, type = "text", className, disabled, ...props }) {
825
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
826
+ const isDisabled = disabled ?? fieldDisabled;
827
+ const hasErrors = errors && errors.length > 0;
828
+ return /* @__PURE__ */ jsx(Input, {
829
+ ...props,
830
+ ref,
831
+ id,
832
+ name: fieldState?.name,
833
+ type,
834
+ value: fieldState?.value ?? "",
835
+ onChange: (e) => fieldState?.change(e.target.value),
836
+ onBlur: () => fieldState?.blur(),
837
+ className: cn("!text-xs", className),
838
+ disabled: isDisabled,
839
+ "aria-invalid": hasErrors || void 0,
840
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
841
+ });
842
+ }
843
+ FormInput.displayName = "Form.Input";
844
+ //#endregion
845
+ //#region src/components/features/form/components/form-input-group.tsx
846
+ /**
847
+ * Form.InputGroup - Input with leading/trailing addons
848
+ *
849
+ * Automatically wired to the parent Form.Field context.
850
+ *
851
+ * @example
852
+ * ```tsx
853
+ * <Form.Field name="website" label="Website" required>
854
+ * <Form.InputGroup leading="https://" placeholder="example.com" />
855
+ * </Form.Field>
856
+ * ```
857
+ */
858
+ function FormInputGroup({ ref, className, disabled, ...props }) {
859
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
860
+ const isDisabled = disabled ?? fieldDisabled;
861
+ const hasErrors = errors && errors.length > 0;
862
+ return /* @__PURE__ */ jsx(InputWithAddons, {
863
+ ...props,
864
+ ref,
865
+ id,
866
+ name: fieldState?.name,
867
+ value: fieldState?.value ?? "",
868
+ onChange: (e) => fieldState?.change(e.target.value),
869
+ onBlur: () => fieldState?.blur(),
870
+ className: cn("text-xs!", className),
871
+ disabled: isDisabled,
872
+ "aria-invalid": hasErrors || void 0,
873
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
874
+ });
875
+ }
876
+ FormInputGroup.displayName = "Form.InputGroup";
877
+ //#endregion
878
+ //#region src/components/features/form/components/form-radio-group.tsx
879
+ /**
880
+ * Form.RadioGroup - Radio button group component
881
+ *
882
+ * Automatically wired to the parent Form.Field context.
883
+ *
884
+ * @example
885
+ * ```tsx
886
+ * <Form.Field name="plan" label="Select Plan" required>
887
+ * <Form.RadioGroup orientation="vertical">
888
+ * <Form.RadioItem value="free" label="Free" description="Basic features" />
889
+ * <Form.RadioItem value="pro" label="Pro" description="Advanced features" />
890
+ * <Form.RadioItem value="enterprise" label="Enterprise" description="Custom solutions" />
891
+ * </Form.RadioGroup>
892
+ * </Form.Field>
893
+ * ```
894
+ */
895
+ function FormRadioGroup({ orientation = "vertical", disabled, className, children }) {
896
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
897
+ const isDisabled = disabled ?? fieldDisabled;
898
+ const hasErrors = errors && errors.length > 0;
899
+ return /* @__PURE__ */ jsx(RadioGroup, {
900
+ value: fieldState?.value != null ? String(fieldState.value) : void 0,
901
+ onValueChange: (val) => fieldState?.change(val),
902
+ disabled: isDisabled,
903
+ "aria-invalid": hasErrors || void 0,
904
+ "aria-describedby": hasErrors ? `${id}-error` : void 0,
905
+ className: cn(orientation === "horizontal" ? "flex flex-row space-x-4" : "flex flex-col space-y-2", className),
906
+ children
907
+ });
908
+ }
909
+ FormRadioGroup.displayName = "Form.RadioGroup";
910
+ /**
911
+ * Form.RadioItem - Individual radio button option
912
+ *
913
+ * @example
914
+ * ```tsx
915
+ * <Form.RadioItem value="option1" label="Option 1" />
916
+ * ```
917
+ */
918
+ function FormRadioItem({ value, label, description, disabled }) {
919
+ const { id: fieldId } = useFieldContext$1();
920
+ const radioId = `${fieldId}-radio-${value}`;
921
+ return /* @__PURE__ */ jsxs("div", {
922
+ className: "flex items-start space-x-2",
923
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
924
+ id: radioId,
925
+ value,
926
+ disabled,
927
+ className: "mt-1"
928
+ }), /* @__PURE__ */ jsxs("div", {
929
+ className: "flex flex-col",
930
+ children: [/* @__PURE__ */ jsx(Label, {
931
+ htmlFor: radioId,
932
+ className: cn("cursor-pointer text-sm font-normal", disabled && "cursor-not-allowed opacity-70"),
933
+ children: label
934
+ }), description && /* @__PURE__ */ jsx("span", {
935
+ className: "text-muted-foreground text-xs",
936
+ children: description
937
+ })]
938
+ })]
939
+ });
940
+ }
941
+ FormRadioItem.displayName = "Form.RadioItem";
942
+ //#endregion
943
+ //#region src/components/features/form/components/form-root.tsx
944
+ /**
945
+ * Form.Root - Root form container that integrates with the active adapter.
946
+ *
947
+ * @example Standard usage
948
+ * ```tsx
949
+ * <Form.Root schema={schema} onSubmit={handleSubmit}>
950
+ * <Form.Field name="email" label="Email">
951
+ * <Form.Input type="email" />
952
+ * </Form.Field>
953
+ * <Form.Submit>Save</Form.Submit>
954
+ * </Form.Root>
955
+ * ```
956
+ *
957
+ * @example Render function for form state access
958
+ * ```tsx
959
+ * <Form.Root schema={schema}>
960
+ * {({ form, fields, isSubmitting }) => (
961
+ * <Form.Field name="email"><Form.Input /></Form.Field>
962
+ * )}
963
+ * </Form.Root>
964
+ * ```
965
+ */
966
+ function FormRoot({ schema, children, onSubmit, action, method = "POST", formComponent: FormComp = "form", id, name, defaultValues, mode = "onBlur", isSubmitting: externalIsSubmitting, onError, onSuccess, telemetry, className }) {
967
+ const adapter = useAdapter();
968
+ const [internalIsSubmitting, setInternalIsSubmitting] = React$1.useState(false);
969
+ const isSubmitting = externalIsSubmitting ?? internalIsSubmitting;
970
+ const [isSubmitted, setIsSubmitted] = React$1.useState(false);
971
+ const [submitCount, setSubmitCount] = React$1.useState(0);
972
+ const formRef = React$1.useRef(null);
973
+ const wrappedOnSubmit = React$1.useCallback(async (data) => {
974
+ setInternalIsSubmitting(true);
975
+ setIsSubmitted(true);
976
+ setSubmitCount((prev) => prev + 1);
977
+ try {
978
+ await onSubmit?.(data);
979
+ telemetry?.onSuccess?.({
980
+ formName: name ?? "",
981
+ formId: id
982
+ });
983
+ onSuccess?.(data);
984
+ } catch (error) {
985
+ const err = error instanceof Error ? error : new Error(String(error));
986
+ telemetry?.onError?.({
987
+ formName: name ?? "",
988
+ formId: id,
989
+ error: err
990
+ });
991
+ telemetry?.captureError?.(err, {
992
+ formName: name ?? "",
993
+ formId: id
994
+ });
995
+ onError?.(error);
996
+ } finally {
997
+ setInternalIsSubmitting(false);
998
+ }
999
+ }, [
1000
+ onSubmit,
1001
+ onSuccess,
1002
+ onError,
1003
+ telemetry,
1004
+ name,
1005
+ id
1006
+ ]);
1007
+ const instance = adapter.useCreateForm({
1008
+ schema,
1009
+ defaultValues,
1010
+ mode,
1011
+ id,
1012
+ onSubmit: onSubmit ? wrappedOnSubmit : void 0,
1013
+ formRef
1014
+ });
1015
+ const { formState } = instance;
1016
+ const contextValue = React$1.useMemo(() => ({
1017
+ form: instance,
1018
+ fields: instance.fields,
1019
+ isSubmitting,
1020
+ isDirty: formState.isDirty,
1021
+ isValid: formState.isValid,
1022
+ isSubmitted,
1023
+ submitCount,
1024
+ dirtyFields: formState.dirtyFields,
1025
+ touchedFields: formState.touchedFields,
1026
+ submit: () => formRef.current?.requestSubmit(),
1027
+ reset: () => instance.reset(),
1028
+ formId: instance.id
1029
+ }), [
1030
+ instance,
1031
+ isSubmitting,
1032
+ formState,
1033
+ isSubmitted,
1034
+ submitCount
1035
+ ]);
1036
+ const isRenderFunction = typeof children === "function";
1037
+ const renderProps = React$1.useMemo(() => ({
1038
+ form: instance,
1039
+ fields: instance.fields,
1040
+ isSubmitting,
1041
+ isDirty: formState.isDirty,
1042
+ isValid: formState.isValid,
1043
+ isSubmitted,
1044
+ submitCount,
1045
+ dirtyFields: formState.dirtyFields,
1046
+ touchedFields: formState.touchedFields,
1047
+ submit: () => formRef.current?.requestSubmit(),
1048
+ reset: () => instance.reset()
1049
+ }), [
1050
+ instance,
1051
+ isSubmitting,
1052
+ formState,
1053
+ isSubmitted,
1054
+ submitCount
1055
+ ]);
1056
+ const renderChildren = () => {
1057
+ if (isRenderFunction) return children(renderProps);
1058
+ return children;
1059
+ };
1060
+ return /* @__PURE__ */ jsx(FormProvider, {
1061
+ value: contextValue,
1062
+ children: /* @__PURE__ */ jsx(adapter.FormProvider, {
1063
+ instance,
1064
+ children: /* @__PURE__ */ jsx(FormComp, {
1065
+ ref: formRef,
1066
+ ...instance.formProps,
1067
+ method,
1068
+ action,
1069
+ className: cn("space-y-6", className),
1070
+ autoComplete: "off",
1071
+ noValidate: true,
1072
+ onSubmit: (e) => {
1073
+ e.stopPropagation();
1074
+ telemetry?.onSubmit?.({
1075
+ formName: name ?? "",
1076
+ formId: id
1077
+ });
1078
+ const adapterSubmit = instance.formProps.onSubmit;
1079
+ adapterSubmit?.(e);
1080
+ },
1081
+ children: renderChildren()
1082
+ })
1083
+ })
1084
+ });
1085
+ }
1086
+ FormRoot.displayName = "Form.Root";
1087
+ //#endregion
1088
+ //#region src/components/features/form/components/form-select.tsx
1089
+ /**
1090
+ * Form.Select - Select dropdown component
1091
+ *
1092
+ * Automatically wired to the parent Form.Field context.
1093
+ *
1094
+ * @example
1095
+ * ```tsx
1096
+ * <Form.Field name="country" label="Country" required>
1097
+ * <Form.Select placeholder="Select a country">
1098
+ * <Form.SelectItem value="us">United States</Form.SelectItem>
1099
+ * <Form.SelectItem value="uk">United Kingdom</Form.SelectItem>
1100
+ * <Form.SelectItem value="ca">Canada</Form.SelectItem>
1101
+ * </Form.Select>
1102
+ * </Form.Field>
1103
+ * ```
1104
+ */
1105
+ function FormSelect({ placeholder, disabled, className, children }) {
1106
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
1107
+ const isDisabled = disabled ?? fieldDisabled;
1108
+ const hasErrors = errors && errors.length > 0;
1109
+ return /* @__PURE__ */ jsxs(Select, {
1110
+ value: fieldState?.value != null ? String(fieldState.value) : void 0,
1111
+ onValueChange: (val) => fieldState?.change(val),
1112
+ disabled: isDisabled,
1113
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
1114
+ id,
1115
+ className: cn(className),
1116
+ "aria-invalid": hasErrors || void 0,
1117
+ "aria-describedby": hasErrors ? `${id}-error` : void 0,
1118
+ onBlur: () => fieldState?.blur(),
1119
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
1120
+ }), /* @__PURE__ */ jsx(SelectContent, { children })]
1121
+ });
1122
+ }
1123
+ FormSelect.displayName = "Form.Select";
1124
+ /**
1125
+ * Form.SelectItem - Individual select option
1126
+ *
1127
+ * @example
1128
+ * ```tsx
1129
+ * <Form.SelectItem value="option1">Option 1</Form.SelectItem>
1130
+ * ```
1131
+ */
1132
+ function FormSelectItem({ value, children, disabled }) {
1133
+ return /* @__PURE__ */ jsx(SelectItem, {
1134
+ value,
1135
+ disabled,
1136
+ children
1137
+ });
1138
+ }
1139
+ FormSelectItem.displayName = "Form.SelectItem";
1140
+ //#endregion
1141
+ //#region src/components/features/form/components/form-submit.tsx
1142
+ /**
1143
+ * Form.Submit - Submit button with automatic loading state
1144
+ *
1145
+ * @example
1146
+ * ```tsx
1147
+ * <Form.Submit loadingText="Saving...">
1148
+ * Save Changes
1149
+ * </Form.Submit>
1150
+ * ```
1151
+ */
1152
+ function FormSubmit({ children, loadingText, loading = false, ...props }) {
1153
+ const { isSubmitting } = useFormContext$1();
1154
+ const isLoading = loading || isSubmitting;
1155
+ return /* @__PURE__ */ jsx(Button, {
1156
+ htmlType: "submit",
1157
+ disabled: props.disabled || isLoading,
1158
+ loading: isLoading,
1159
+ ...props,
1160
+ children: isLoading && loadingText ? loadingText : children
1161
+ });
1162
+ }
1163
+ FormSubmit.displayName = "Form.Submit";
1164
+ //#endregion
1165
+ //#region src/components/features/form/components/form-switch.tsx
1166
+ /**
1167
+ * Form.Switch - Toggle switch component
1168
+ *
1169
+ * Automatically wired to the parent Form.Field context.
1170
+ *
1171
+ * @example
1172
+ * ```tsx
1173
+ * <Form.Field name="notifications">
1174
+ * <Form.Switch label="Enable email notifications" />
1175
+ * </Form.Field>
1176
+ * ```
1177
+ */
1178
+ function FormSwitch({ label, disabled, className }) {
1179
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
1180
+ const isDisabled = disabled ?? fieldDisabled;
1181
+ const hasErrors = errors && errors.length > 0;
1182
+ const checked = Boolean(fieldState?.value);
1183
+ return /* @__PURE__ */ jsxs("div", {
1184
+ className: cn("flex items-center space-x-2", className),
1185
+ children: [/* @__PURE__ */ jsx(Switch, {
1186
+ id,
1187
+ checked,
1188
+ onCheckedChange: (value) => fieldState?.change(Boolean(value)),
1189
+ disabled: isDisabled,
1190
+ "aria-invalid": hasErrors || void 0,
1191
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
1192
+ }), label && /* @__PURE__ */ jsx(Label, {
1193
+ htmlFor: id,
1194
+ className: cn("cursor-pointer text-sm font-normal", isDisabled && "cursor-not-allowed opacity-70"),
1195
+ children: label
1196
+ })]
1197
+ });
1198
+ }
1199
+ FormSwitch.displayName = "Form.Switch";
1200
+ //#endregion
1201
+ //#region src/components/features/form/components/form-textarea.tsx
1202
+ /**
1203
+ * Form.Textarea - Multi-line text input component
1204
+ *
1205
+ * Automatically wired to the parent Form.Field context.
1206
+ *
1207
+ * @example
1208
+ * ```tsx
1209
+ * <Form.Field name="bio" label="Bio">
1210
+ * <Form.Textarea rows={4} placeholder="Tell us about yourself..." />
1211
+ * </Form.Field>
1212
+ * ```
1213
+ */
1214
+ function FormTextarea({ ref, className, disabled, rows = 3, ...props }) {
1215
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
1216
+ const isDisabled = disabled ?? fieldDisabled;
1217
+ const hasErrors = errors && errors.length > 0;
1218
+ return /* @__PURE__ */ jsx(Textarea, {
1219
+ ...props,
1220
+ ref,
1221
+ id,
1222
+ name: fieldState?.name,
1223
+ value: fieldState?.value ?? "",
1224
+ onChange: (e) => fieldState?.change(e.target.value),
1225
+ onBlur: () => fieldState?.blur(),
1226
+ rows,
1227
+ className: cn(className),
1228
+ disabled: isDisabled,
1229
+ "aria-invalid": hasErrors || void 0,
1230
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
1231
+ });
1232
+ }
1233
+ FormTextarea.displayName = "Form.Textarea";
1234
+ //#endregion
1235
+ //#region src/components/features/form/components/form-time-picker.tsx
1236
+ function FormTimePicker({ min, max, step, placeholder, disabled, className }) {
1237
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
1238
+ const isDisabled = disabled ?? fieldDisabled;
1239
+ const hasErrors = errors && errors.length > 0;
1240
+ return /* @__PURE__ */ jsx(TimePicker, {
1241
+ id,
1242
+ value: fieldState?.value ?? "",
1243
+ onChange: React$1.useCallback((value) => {
1244
+ fieldState?.change(value || void 0);
1245
+ }, [fieldState]),
1246
+ min,
1247
+ max,
1248
+ step,
1249
+ placeholder,
1250
+ disabled: isDisabled,
1251
+ className: cn(className),
1252
+ "aria-invalid": hasErrors || void 0,
1253
+ "aria-describedby": hasErrors ? `${id}-error` : void 0
1254
+ });
1255
+ }
1256
+ FormTimePicker.displayName = "Form.TimePicker";
1257
+ //#endregion
1258
+ //#region src/components/features/form/components/form-transfer.tsx
1259
+ /**
1260
+ * Form.Transfer - Transfer list component for selecting multiple items
1261
+ *
1262
+ * Automatically wired to the parent Form.Field context.
1263
+ * Displays minItems/maxItems constraints when provided.
1264
+ *
1265
+ * @example
1266
+ * ```tsx
1267
+ * <Form.Field name="teams" label="Select Teams">
1268
+ * <Form.Transfer
1269
+ * items={teams}
1270
+ * itemKey="id"
1271
+ * itemLabel="name"
1272
+ * minItems={2}
1273
+ * maxItems={5}
1274
+ * />
1275
+ * </Form.Field>
1276
+ * ```
1277
+ */
1278
+ function FormTransfer({ disabled, minItems, maxItems, ...props }) {
1279
+ const { id, errors, disabled: fieldDisabled, fieldState } = useFieldContext$1();
1280
+ const isDisabled = disabled ?? fieldDisabled;
1281
+ const hasErrors = errors && errors.length > 0;
1282
+ const value = Array.isArray(fieldState?.value) ? fieldState.value : [];
1283
+ const handleChange = React$1.useCallback((newValue) => {
1284
+ fieldState?.change(newValue);
1285
+ }, [fieldState]);
1286
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
1287
+ "aria-invalid": hasErrors || void 0,
1288
+ "aria-describedby": hasErrors ? `${id}-error` : void 0,
1289
+ children: /* @__PURE__ */ jsx(Transfer, {
1290
+ ...props,
1291
+ value,
1292
+ onChange: handleChange,
1293
+ disabled: isDisabled
1294
+ })
1295
+ }), (minItems != null || maxItems != null) && /* @__PURE__ */ jsx("p", {
1296
+ className: "text-sm text-muted-foreground mt-2",
1297
+ children: minItems != null && maxItems != null ? `Select between ${minItems} and ${maxItems} items` : minItems != null ? `Select at least ${minItems} items` : `Select up to ${maxItems} items`
1298
+ })] });
1299
+ }
1300
+ FormTransfer.displayName = "Form.Transfer";
1301
+ //#endregion
1302
+ //#region src/components/features/form/hooks/use-watch.ts
1303
+ /**
1304
+ * Hook to watch a field's value reactively.
1305
+ * Delegates to the active adapter's useWatch implementation.
1306
+ *
1307
+ * @example
1308
+ * ```tsx
1309
+ * function ConditionalField() {
1310
+ * const contactMethod = useWatch('contactMethod')
1311
+ * if (contactMethod === 'email') {
1312
+ * return <Form.Field name="email"><Form.Input type="email" /></Form.Field>
1313
+ * }
1314
+ * return null
1315
+ * }
1316
+ * ```
1317
+ */
1318
+ function useWatch(name) {
1319
+ return useAdapter().useWatch(name);
1320
+ }
1321
+ /**
1322
+ * Hook to watch multiple fields at once.
1323
+ * Delegates to the active adapter's useWatchAll implementation.
1324
+ *
1325
+ * @example
1326
+ * ```tsx
1327
+ * function Summary() {
1328
+ * const values = useWatchAll(['firstName', 'lastName', 'email'])
1329
+ * return <div>Name: {values.firstName} {values.lastName}</div>
1330
+ * }
1331
+ * ```
1332
+ */
1333
+ function useWatchAll(names) {
1334
+ return useAdapter().useWatchAll(names);
1335
+ }
1336
+ //#endregion
1337
+ //#region src/components/features/form/components/form-when.tsx
1338
+ /**
1339
+ * Form.When - Conditional rendering based on field values
1340
+ *
1341
+ * Renders children only when the specified field matches the condition.
1342
+ *
1343
+ * @example
1344
+ * ```tsx
1345
+ * // Render when field equals value
1346
+ * <Form.When field="contactMethod" is="email">
1347
+ * <Form.Field name="email"><Form.Input type="email" /></Form.Field>
1348
+ * </Form.When>
1349
+ *
1350
+ * // Render when field does not equal value
1351
+ * <Form.When field="contactMethod" isNot="none">
1352
+ * <Form.Field name="contact"><Form.Input /></Form.Field>
1353
+ * </Form.When>
1354
+ *
1355
+ * // Render when field value is in array
1356
+ * <Form.When field="role" in={['admin', 'moderator']}>
1357
+ * <Form.Field name="permissions"><Form.Input /></Form.Field>
1358
+ * </Form.When>
1359
+ *
1360
+ * // Render when field value is not in array
1361
+ * <Form.When field="status" notIn={['archived', 'deleted']}>
1362
+ * <Form.Field name="actions"><Form.Input /></Form.Field>
1363
+ * </Form.When>
1364
+ * ```
1365
+ */
1366
+ function FormWhen({ field, is, isNot, in: inArray, notIn, children }) {
1367
+ const value = useWatch(field);
1368
+ let shouldRender = true;
1369
+ if (is !== void 0) shouldRender = value === is;
1370
+ if (isNot !== void 0 && shouldRender) shouldRender = value !== isNot;
1371
+ if (inArray !== void 0 && shouldRender) shouldRender = inArray.includes(value);
1372
+ if (notIn !== void 0 && shouldRender) shouldRender = !notIn.includes(value);
1373
+ if (!shouldRender) return null;
1374
+ return /* @__PURE__ */ jsx(Fragment$1, { children });
1375
+ }
1376
+ FormWhen.displayName = "Form.When";
1377
+ //#endregion
1378
+ //#region src/components/features/form/hooks/use-field.ts
1379
+ /**
1380
+ * Hook to access and control a specific field.
1381
+ * Delegates to the active adapter's useField implementation.
1382
+ *
1383
+ * @example
1384
+ * ```tsx
1385
+ * function MyCustomInput({ name }: { name: string }) {
1386
+ * const { field, control, meta, errors } = useField(name)
1387
+ * return (
1388
+ * <input
1389
+ * name={meta.name}
1390
+ * id={meta.id}
1391
+ * value={control.value ?? ''}
1392
+ * onChange={(e) => control.change(e.target.value)}
1393
+ * onBlur={control.blur}
1394
+ * aria-invalid={!!errors?.length}
1395
+ * />
1396
+ * )
1397
+ * }
1398
+ * ```
1399
+ */
1400
+ function useField(name) {
1401
+ const fieldState = useAdapter().useField(name);
1402
+ return {
1403
+ field: fieldState,
1404
+ control: {
1405
+ value: fieldState.value,
1406
+ change: fieldState.change,
1407
+ blur: fieldState.blur,
1408
+ focus: fieldState.focus
1409
+ },
1410
+ meta: {
1411
+ name: fieldState.name,
1412
+ id: fieldState.id,
1413
+ errors: fieldState.errors,
1414
+ required: fieldState.required,
1415
+ disabled: false
1416
+ },
1417
+ errors: fieldState.errors
1418
+ };
1419
+ }
1420
+ //#endregion
1421
+ //#region src/components/features/form/hooks/use-field-context.ts
1422
+ /**
1423
+ * Hook to access the current field context
1424
+ * Must be used within a Form.Field component
1425
+ *
1426
+ * @example
1427
+ * ```tsx
1428
+ * function MyInput() {
1429
+ * const { name, id, errors, required, disabled, fieldMeta } = useFieldContext();
1430
+ *
1431
+ * return (
1432
+ * <input
1433
+ * name={name}
1434
+ * id={id}
1435
+ * required={required}
1436
+ * disabled={disabled}
1437
+ * aria-invalid={!!errors?.length}
1438
+ * />
1439
+ * );
1440
+ * }
1441
+ * ```
1442
+ */
1443
+ function useFieldContext() {
1444
+ return useFieldContext$1();
1445
+ }
1446
+ //#endregion
1447
+ //#region src/components/features/form/hooks/use-form-context.ts
1448
+ /**
1449
+ * Hook to access the form context
1450
+ *
1451
+ * @example
1452
+ * ```tsx
1453
+ * function MyComponent() {
1454
+ * const { form, fields, isSubmitting, submit, reset } = useFormContext();
1455
+ *
1456
+ * return (
1457
+ * <button onClick={submit} disabled={isSubmitting}>
1458
+ * Submit
1459
+ * </button>
1460
+ * );
1461
+ * }
1462
+ * ```
1463
+ */
1464
+ function useFormContext() {
1465
+ return useFormContext$1();
1466
+ }
1467
+ //#endregion
1468
+ //#region src/components/features/form/hooks/use-form-state.ts
1469
+ /**
1470
+ * Hook to access form-level state (dirty, valid, submitted, etc.)
1471
+ *
1472
+ * @example
1473
+ * ```tsx
1474
+ * function SaveButton() {
1475
+ * const { isDirty, isSubmitting, isValid } = useFormState()
1476
+ *
1477
+ * return (
1478
+ * <button
1479
+ * type="submit"
1480
+ * disabled={!isDirty || isSubmitting || !isValid}
1481
+ * >
1482
+ * Save Changes
1483
+ * </button>
1484
+ * )
1485
+ * }
1486
+ * ```
1487
+ */
1488
+ function useFormState() {
1489
+ const ctx = useFormContext$1();
1490
+ return {
1491
+ isDirty: ctx.isDirty,
1492
+ isValid: ctx.isValid,
1493
+ isSubmitting: ctx.isSubmitting,
1494
+ isSubmitted: ctx.isSubmitted,
1495
+ submitCount: ctx.submitCount,
1496
+ dirtyFields: ctx.dirtyFields,
1497
+ touchedFields: ctx.touchedFields
1498
+ };
1499
+ }
1500
+ //#endregion
1501
+ //#region src/components/features/form/index.ts
1502
+ /**
1503
+ * Datum Form Library
1504
+ *
1505
+ * A compound component pattern form library with pluggable adapter support.
1506
+ * Choose between Conform.js or React Hook Form as your form backend,
1507
+ * with Zod for schema validation.
1508
+ *
1509
+ * ## Adapter Setup
1510
+ *
1511
+ * Wrap your app with an adapter provider:
1512
+ *
1513
+ * ```tsx
1514
+ * // Conform adapter
1515
+ * import { ConformAdapter } from '@datum-cloud/datum-ui/form/adapters/conform'
1516
+ * <ConformAdapter><App /></ConformAdapter>
1517
+ *
1518
+ * // React Hook Form adapter
1519
+ * import { RHFAdapter } from '@datum-cloud/datum-ui/form/adapters/rhf'
1520
+ * <RHFAdapter><App /></RHFAdapter>
1521
+ * ```
1522
+ *
1523
+ * @example Basic Usage
1524
+ * ```tsx
1525
+ * import { Form } from '@datum-cloud/datum-ui/form';
1526
+ * import { z } from 'zod';
1527
+ *
1528
+ * const userSchema = z.object({
1529
+ * name: z.string().min(2),
1530
+ * email: z.string().email(),
1531
+ * });
1532
+ *
1533
+ * function UserForm() {
1534
+ * return (
1535
+ * <Form.Root schema={userSchema} onSubmit={(data) => console.log(data)}>
1536
+ * <Form.Field name="name" label="Name" required>
1537
+ * <Form.Input />
1538
+ * </Form.Field>
1539
+ * <Form.Field name="email" label="Email" required>
1540
+ * <Form.Input type="email" />
1541
+ * </Form.Field>
1542
+ * <Form.Submit>Save</Form.Submit>
1543
+ * </Form.Root>
1544
+ * );
1545
+ * }
1546
+ * ```
1547
+ *
1548
+ * @example Multi-Step Form (separate import)
1549
+ * ```tsx
1550
+ * import { FormStepper, FormStep, StepperNavigation, StepperControls } from '@datum-cloud/datum-ui/form/stepper';
1551
+ *
1552
+ * const steps = [
1553
+ * { id: 'account', label: 'Account', schema: accountSchema },
1554
+ * { id: 'profile', label: 'Profile', schema: profileSchema },
1555
+ * ];
1556
+ *
1557
+ * <FormStepper steps={steps} onComplete={handleComplete}>
1558
+ * <StepperNavigation />
1559
+ * <FormStep id="account">...</FormStep>
1560
+ * <FormStep id="profile">...</FormStep>
1561
+ * <StepperControls />
1562
+ * </FormStepper>
1563
+ * ```
1564
+ *
1565
+ * @example Form State
1566
+ * ```tsx
1567
+ * <Form.Root schema={schema} onSubmit={handleSubmit}>
1568
+ * {({ isDirty, isValid, isSubmitted, submitCount }) => (
1569
+ * <>
1570
+ * <Form.Field name="name"><Form.Input /></Form.Field>
1571
+ * <Form.Submit disabled={!isDirty || !isValid}>Save</Form.Submit>
1572
+ * {isSubmitted && <p>Submitted {submitCount} time(s)</p>}
1573
+ * </>
1574
+ * )}
1575
+ * </Form.Root>
1576
+ * ```
1577
+ *
1578
+ * @example Conditional Fields
1579
+ * ```tsx
1580
+ * <Form.Field name="contactMethod">
1581
+ * <Form.Select>
1582
+ * <Form.SelectItem value="email">Email</Form.SelectItem>
1583
+ * <Form.SelectItem value="phone">Phone</Form.SelectItem>
1584
+ * </Form.Select>
1585
+ * </Form.Field>
1586
+ *
1587
+ * <Form.When field="contactMethod" is="email">
1588
+ * <Form.Field name="email"><Form.Input type="email" /></Form.Field>
1589
+ * </Form.When>
1590
+ * ```
1591
+ */
1592
+ /**
1593
+ * Form compound component
1594
+ *
1595
+ * Requires an adapter provider at the application root:
1596
+ * - `<ConformAdapter>` from `@datum-cloud/datum-ui/form/adapters/conform`
1597
+ * - `<RHFAdapter>` from `@datum-cloud/datum-ui/form/adapters/rhf`
1598
+ *
1599
+ * Components:
1600
+ * - Form.Root - Main form container
1601
+ * - Form.Field - Field wrapper with label and error handling
1602
+ * - Form.Input, Form.Textarea, Form.Select, Form.Checkbox, Form.Switch, Form.RadioGroup
1603
+ * - Form.Autocomplete, Form.CopyBox, Form.InputGroup
1604
+ * - Form.When - Conditional rendering
1605
+ * - Form.FieldArray - Dynamic array of fields
1606
+ * - Form.Custom - Escape hatch for custom implementations
1607
+ * - Form.Dialog - Form rendered inside a Dialog
1608
+ * - Form.Submit, Form.Button, Form.Error, Form.Description
1609
+ *
1610
+ * Stepper (separate import):
1611
+ * - `@datum-cloud/datum-ui/form/stepper` provides FormStepper, FormStep, StepperNavigation, StepperControls, useStepper
1612
+ *
1613
+ * Hooks:
1614
+ * - Form.useFormContext, Form.useFormState, Form.useFieldContext, Form.useField
1615
+ * - Form.useWatch, Form.useWatchAll
1616
+ */
1617
+ const Form = {
1618
+ Root: FormRoot,
1619
+ Field: FormField,
1620
+ Submit: FormSubmit,
1621
+ Button: FormButton,
1622
+ Error: FormError,
1623
+ Description: FormDescription,
1624
+ Input: FormInput,
1625
+ Textarea: FormTextarea,
1626
+ Select: FormSelect,
1627
+ SelectItem: FormSelectItem,
1628
+ Checkbox: FormCheckbox,
1629
+ Switch: FormSwitch,
1630
+ RadioGroup: FormRadioGroup,
1631
+ RadioItem: FormRadioItem,
1632
+ CopyBox: FormCopyBox,
1633
+ Autocomplete: FormAutocomplete,
1634
+ Autosearch: FormAutosearch,
1635
+ Combobox: FormCombobox,
1636
+ InputGroup: FormInputGroup,
1637
+ DatePicker: FormDatePicker,
1638
+ DateTimePicker: FormDateTimePicker,
1639
+ TimePicker: FormTimePicker,
1640
+ Transfer: FormTransfer,
1641
+ When: FormWhen,
1642
+ FieldArray: FormFieldArray,
1643
+ Custom: FormCustom,
1644
+ Dialog: FormDialog,
1645
+ useFormContext,
1646
+ useFormState,
1647
+ useFieldContext,
1648
+ useField,
1649
+ useWatch,
1650
+ useWatchAll
1651
+ };
1652
+ //#endregion
1653
+ export { FormCheckbox as A, FormDialog as C, FormCustom as D, FormDatePicker as E, FormAutosearch as M, FormAutocomplete as N, FormCopyBox as O, FormError as S, FormDateTimePicker as T, FormRadioGroup as _, useField as a, FormFieldArray as b, useWatchAll as c, FormTextarea as d, FormSwitch as f, FormRoot as g, FormSelectItem as h, useFieldContext as i, FormButton as j, FormCombobox as k, FormTransfer as l, FormSelect as m, useFormState as n, FormWhen as o, FormSubmit as p, useFormContext as r, useWatch as s, Form as t, FormTimePicker as u, FormRadioItem as v, FormDescription as w, FormField as x, FormInput as y };