@timeax/form-palette 0.0.2 → 0.0.4

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 (503) hide show
  1. package/dist/adapters/axios.d.ts +21 -0
  2. package/dist/adapters/axios.d.ts.map +1 -0
  3. package/dist/adapters/axios.js +74 -0
  4. package/dist/adapters/axios.js.map +1 -0
  5. package/dist/adapters/index.d.ts +35 -0
  6. package/dist/adapters/index.d.ts.map +1 -0
  7. package/dist/adapters/index.js +74 -0
  8. package/dist/adapters/index.js.map +1 -0
  9. package/dist/adapters/inertia.d.ts +24 -0
  10. package/dist/adapters/inertia.d.ts.map +1 -0
  11. package/dist/adapters/inertia.js +126 -0
  12. package/dist/adapters/inertia.js.map +1 -0
  13. package/dist/core/adapter-registry.d.ts +30 -0
  14. package/dist/core/adapter-registry.d.ts.map +1 -0
  15. package/{src/core/adapter-registry.ts → dist/core/adapter-registry.js} +10 -28
  16. package/dist/core/adapter-registry.js.map +1 -0
  17. package/{src/core/bound/bind-host.ts → dist/core/bound/bind-host.d.ts} +2 -3
  18. package/dist/core/bound/bind-host.d.ts.map +1 -0
  19. package/dist/core/bound/bind-host.js +2 -0
  20. package/dist/core/bound/bind-host.js.map +1 -0
  21. package/dist/core/bound/observe-bound-field.d.ts +21 -0
  22. package/dist/core/bound/observe-bound-field.d.ts.map +1 -0
  23. package/dist/core/bound/observe-bound-field.js +116 -0
  24. package/dist/core/bound/observe-bound-field.js.map +1 -0
  25. package/dist/core/bound/wait-for-bound-field.d.ts +5 -0
  26. package/dist/core/bound/wait-for-bound-field.d.ts.map +1 -0
  27. package/dist/core/bound/wait-for-bound-field.js +35 -0
  28. package/dist/core/bound/wait-for-bound-field.js.map +1 -0
  29. package/{src/core/context.ts → dist/core/context.d.ts} +2 -6
  30. package/dist/core/context.d.ts.map +1 -0
  31. package/dist/core/context.js +11 -0
  32. package/dist/core/context.js.map +1 -0
  33. package/dist/core/core-provider.d.ts +22 -0
  34. package/dist/core/core-provider.d.ts.map +1 -0
  35. package/{src/core/core-provider.tsx → dist/core/core-provider.js} +209 -364
  36. package/dist/core/core-provider.js.map +1 -0
  37. package/dist/core/core-root.d.ts +26 -0
  38. package/dist/core/core-root.d.ts.map +1 -0
  39. package/dist/core/core-root.js +38 -0
  40. package/dist/core/core-root.js.map +1 -0
  41. package/dist/core/core-shell.d.ts +22 -0
  42. package/dist/core/core-shell.d.ts.map +1 -0
  43. package/dist/core/core-shell.js +8 -0
  44. package/dist/core/core-shell.js.map +1 -0
  45. package/{src/core/errors/error-strip.tsx → dist/core/errors/error-strip.d.ts} +2 -39
  46. package/dist/core/errors/error-strip.d.ts.map +1 -0
  47. package/dist/core/errors/error-strip.js +18 -0
  48. package/dist/core/errors/error-strip.js.map +1 -0
  49. package/dist/core/errors/index.d.ts +4 -0
  50. package/dist/core/errors/index.d.ts.map +1 -0
  51. package/dist/core/errors/index.js +4 -0
  52. package/dist/core/errors/index.js.map +1 -0
  53. package/dist/core/errors/map-error-bag.d.ts +24 -0
  54. package/dist/core/errors/map-error-bag.d.ts.map +1 -0
  55. package/{src/core/errors/map-error-bag.ts → dist/core/errors/map-error-bag.js} +10 -22
  56. package/dist/core/errors/map-error-bag.js.map +1 -0
  57. package/dist/core/errors/map-zod.d.ts +18 -0
  58. package/dist/core/errors/map-zod.d.ts.map +1 -0
  59. package/{src/core/errors/map-zod.ts → dist/core/errors/map-zod.js} +7 -19
  60. package/dist/core/errors/map-zod.js.map +1 -0
  61. package/dist/core/hooks/use-button.d.ts +73 -0
  62. package/dist/core/hooks/use-button.d.ts.map +1 -0
  63. package/dist/core/hooks/use-button.js +116 -0
  64. package/dist/core/hooks/use-button.js.map +1 -0
  65. package/dist/core/hooks/use-core-context.d.ts +9 -0
  66. package/dist/core/hooks/use-core-context.d.ts.map +1 -0
  67. package/{src/core/hooks/use-core-context.ts → dist/core/hooks/use-core-context.js} +3 -6
  68. package/dist/core/hooks/use-core-context.js.map +1 -0
  69. package/dist/core/hooks/use-core-utility.d.ts +1 -0
  70. package/dist/core/hooks/use-core-utility.d.ts.map +1 -0
  71. package/dist/core/hooks/use-core-utility.js +2 -0
  72. package/dist/core/hooks/use-core-utility.js.map +1 -0
  73. package/{src/core/hooks/use-core.ts → dist/core/hooks/use-core.d.ts} +9 -13
  74. package/dist/core/hooks/use-core.d.ts.map +1 -0
  75. package/dist/core/hooks/use-core.js +11 -0
  76. package/dist/core/hooks/use-core.js.map +1 -0
  77. package/dist/core/hooks/use-field.d.ts +141 -0
  78. package/dist/core/hooks/use-field.d.ts.map +1 -0
  79. package/dist/core/hooks/use-field.js +256 -0
  80. package/dist/core/hooks/use-field.js.map +1 -0
  81. package/dist/core/hooks/use-optional-field.d.ts +9 -0
  82. package/dist/core/hooks/use-optional-field.d.ts.map +1 -0
  83. package/dist/core/hooks/use-optional-field.js +146 -0
  84. package/dist/core/hooks/use-optional-field.js.map +1 -0
  85. package/dist/core/index.d.ts +11 -0
  86. package/dist/core/index.d.ts.map +1 -0
  87. package/dist/core/index.js +11 -0
  88. package/dist/core/index.js.map +1 -0
  89. package/dist/core/registry/binder-registry.d.ts +38 -0
  90. package/dist/core/registry/binder-registry.d.ts.map +1 -0
  91. package/dist/core/registry/binder-registry.js +52 -0
  92. package/dist/core/registry/binder-registry.js.map +1 -0
  93. package/dist/core/registry/field-registry.d.ts +86 -0
  94. package/dist/core/registry/field-registry.d.ts.map +1 -0
  95. package/{src/core/registry/field-registry.ts → dist/core/registry/field-registry.js} +56 -70
  96. package/dist/core/registry/field-registry.js.map +1 -0
  97. package/dist/core/test.d.ts +2 -0
  98. package/dist/core/test.d.ts.map +1 -0
  99. package/dist/core/test.js +9 -0
  100. package/dist/core/test.js.map +1 -0
  101. package/dist/index.d.ts +15 -0
  102. package/dist/index.d.ts.map +1 -0
  103. package/{src/index.ts → dist/index.js} +5 -47
  104. package/dist/index.js.map +1 -0
  105. package/{src/input/index.ts → dist/input/index.d.ts} +1 -2
  106. package/dist/input/index.d.ts.map +1 -0
  107. package/dist/input/index.js +3 -0
  108. package/dist/input/index.js.map +1 -0
  109. package/dist/input/input-field.d.ts +15 -0
  110. package/dist/input/input-field.d.ts.map +1 -0
  111. package/dist/input/input-field.js +413 -0
  112. package/dist/input/input-field.js.map +1 -0
  113. package/dist/input/input-layout-graph.d.ts +77 -0
  114. package/dist/input/input-layout-graph.d.ts.map +1 -0
  115. package/dist/input/input-layout-graph.js +108 -0
  116. package/dist/input/input-layout-graph.js.map +1 -0
  117. package/{src/input/input-props.ts → dist/input/input-props.d.ts} +22 -84
  118. package/dist/input/input-props.d.ts.map +1 -0
  119. package/dist/input/input-props.js +4 -0
  120. package/dist/input/input-props.js.map +1 -0
  121. package/dist/lib/get-global-countries.d.ts +3 -0
  122. package/dist/lib/get-global-countries.d.ts.map +1 -0
  123. package/dist/lib/get-global-countries.js +70 -0
  124. package/dist/lib/get-global-countries.js.map +1 -0
  125. package/dist/lib/utils.d.ts +3 -0
  126. package/dist/lib/utils.d.ts.map +1 -0
  127. package/dist/lib/utils.js +6 -0
  128. package/dist/lib/utils.js.map +1 -0
  129. package/dist/presets/index.d.ts +1 -0
  130. package/dist/presets/index.d.ts.map +1 -0
  131. package/dist/presets/index.js +2 -0
  132. package/dist/presets/index.js.map +1 -0
  133. package/dist/presets/shadcn-preset.d.ts +1 -0
  134. package/dist/presets/shadcn-preset.d.ts.map +1 -0
  135. package/dist/presets/shadcn-preset.js +2 -0
  136. package/dist/presets/shadcn-preset.js.map +1 -0
  137. package/dist/presets/shadcn-variants/checkbox.d.ts +212 -0
  138. package/dist/presets/shadcn-variants/checkbox.d.ts.map +1 -0
  139. package/dist/presets/shadcn-variants/checkbox.js +315 -0
  140. package/dist/presets/shadcn-variants/checkbox.js.map +1 -0
  141. package/dist/presets/shadcn-variants/chips.d.ts +154 -0
  142. package/dist/presets/shadcn-variants/chips.d.ts.map +1 -0
  143. package/dist/presets/shadcn-variants/chips.js +266 -0
  144. package/dist/presets/shadcn-variants/chips.js.map +1 -0
  145. package/dist/presets/shadcn-variants/color.d.ts +63 -0
  146. package/dist/presets/shadcn-variants/color.d.ts.map +1 -0
  147. package/dist/presets/shadcn-variants/color.js +96 -0
  148. package/dist/presets/shadcn-variants/color.js.map +1 -0
  149. package/dist/presets/shadcn-variants/custom.d.ts +94 -0
  150. package/dist/presets/shadcn-variants/custom.d.ts.map +1 -0
  151. package/dist/presets/shadcn-variants/custom.js +80 -0
  152. package/dist/presets/shadcn-variants/custom.js.map +1 -0
  153. package/dist/presets/shadcn-variants/date.d.ts +114 -0
  154. package/dist/presets/shadcn-variants/date.d.ts.map +1 -0
  155. package/dist/presets/shadcn-variants/date.js +414 -0
  156. package/dist/presets/shadcn-variants/date.js.map +1 -0
  157. package/dist/presets/shadcn-variants/file.d.ts +79 -0
  158. package/dist/presets/shadcn-variants/file.d.ts.map +1 -0
  159. package/dist/presets/shadcn-variants/file.js +289 -0
  160. package/dist/presets/shadcn-variants/file.js.map +1 -0
  161. package/dist/presets/shadcn-variants/keyvalue.d.ts +35 -0
  162. package/dist/presets/shadcn-variants/keyvalue.d.ts.map +1 -0
  163. package/dist/presets/shadcn-variants/keyvalue.js +215 -0
  164. package/dist/presets/shadcn-variants/keyvalue.js.map +1 -0
  165. package/dist/presets/shadcn-variants/multiselect.d.ts +210 -0
  166. package/dist/presets/shadcn-variants/multiselect.d.ts.map +1 -0
  167. package/dist/presets/shadcn-variants/multiselect.js +352 -0
  168. package/dist/presets/shadcn-variants/multiselect.js.map +1 -0
  169. package/dist/presets/shadcn-variants/number.d.ts +31 -0
  170. package/dist/presets/shadcn-variants/number.d.ts.map +1 -0
  171. package/dist/presets/shadcn-variants/number.js +64 -0
  172. package/dist/presets/shadcn-variants/number.js.map +1 -0
  173. package/dist/presets/shadcn-variants/password.d.ts +195 -0
  174. package/dist/presets/shadcn-variants/password.d.ts.map +1 -0
  175. package/dist/presets/shadcn-variants/password.js +296 -0
  176. package/dist/presets/shadcn-variants/password.js.map +1 -0
  177. package/dist/presets/shadcn-variants/phone.d.ts +69 -0
  178. package/dist/presets/shadcn-variants/phone.d.ts.map +1 -0
  179. package/dist/presets/shadcn-variants/phone.js +308 -0
  180. package/dist/presets/shadcn-variants/phone.js.map +1 -0
  181. package/dist/presets/shadcn-variants/radio.d.ts +172 -0
  182. package/dist/presets/shadcn-variants/radio.d.ts.map +1 -0
  183. package/dist/presets/shadcn-variants/radio.js +192 -0
  184. package/dist/presets/shadcn-variants/radio.js.map +1 -0
  185. package/dist/presets/shadcn-variants/select.d.ts +203 -0
  186. package/dist/presets/shadcn-variants/select.d.ts.map +1 -0
  187. package/dist/presets/shadcn-variants/select.js +285 -0
  188. package/dist/presets/shadcn-variants/select.js.map +1 -0
  189. package/dist/presets/shadcn-variants/slider.d.ts +131 -0
  190. package/dist/presets/shadcn-variants/slider.d.ts.map +1 -0
  191. package/dist/presets/shadcn-variants/slider.js +151 -0
  192. package/dist/presets/shadcn-variants/slider.js.map +1 -0
  193. package/dist/presets/shadcn-variants/text.d.ts +155 -0
  194. package/dist/presets/shadcn-variants/text.d.ts.map +1 -0
  195. package/dist/presets/shadcn-variants/text.js +98 -0
  196. package/dist/presets/shadcn-variants/text.js.map +1 -0
  197. package/dist/presets/shadcn-variants/textarea.d.ts +18 -0
  198. package/dist/presets/shadcn-variants/textarea.d.ts.map +1 -0
  199. package/dist/presets/shadcn-variants/textarea.js +24 -0
  200. package/dist/presets/shadcn-variants/textarea.js.map +1 -0
  201. package/dist/presets/shadcn-variants/toggle.d.ts +61 -0
  202. package/dist/presets/shadcn-variants/toggle.d.ts.map +1 -0
  203. package/dist/presets/shadcn-variants/toggle.js +67 -0
  204. package/dist/presets/shadcn-variants/toggle.js.map +1 -0
  205. package/dist/presets/shadcn-variants/treeselect.d.ts +81 -0
  206. package/dist/presets/shadcn-variants/treeselect.d.ts.map +1 -0
  207. package/dist/presets/shadcn-variants/treeselect.js +317 -0
  208. package/dist/presets/shadcn-variants/treeselect.js.map +1 -0
  209. package/dist/presets/ui/badge.d.ts +10 -0
  210. package/dist/presets/ui/badge.d.ts.map +1 -0
  211. package/dist/presets/ui/badge.js +23 -0
  212. package/dist/presets/ui/badge.js.map +1 -0
  213. package/dist/presets/ui/button.d.ts +11 -0
  214. package/dist/presets/ui/button.d.ts.map +1 -0
  215. package/dist/presets/ui/button.js +34 -0
  216. package/dist/presets/ui/button.js.map +1 -0
  217. package/dist/presets/ui/calendar.d.ts +9 -0
  218. package/dist/presets/ui/calendar.d.ts.map +1 -0
  219. package/dist/presets/ui/calendar.js +76 -0
  220. package/dist/presets/ui/calendar.js.map +1 -0
  221. package/dist/presets/ui/checkbox.d.ts +18 -0
  222. package/dist/presets/ui/checkbox.d.ts.map +1 -0
  223. package/dist/presets/ui/checkbox.js +61 -0
  224. package/dist/presets/ui/checkbox.js.map +1 -0
  225. package/dist/presets/ui/custom.d.ts +1 -0
  226. package/dist/presets/ui/custom.d.ts.map +1 -0
  227. package/dist/presets/ui/custom.js +2 -0
  228. package/dist/presets/ui/custom.js.map +1 -0
  229. package/dist/presets/ui/dialog.d.ts +16 -0
  230. package/dist/presets/ui/dialog.d.ts.map +1 -0
  231. package/dist/presets/ui/dialog.js +36 -0
  232. package/dist/presets/ui/dialog.js.map +1 -0
  233. package/dist/presets/ui/field.d.ts +25 -0
  234. package/dist/presets/ui/field.d.ts.map +1 -0
  235. package/dist/presets/ui/field.js +76 -0
  236. package/dist/presets/ui/field.js.map +1 -0
  237. package/dist/presets/ui/input-mask.d.ts +34 -0
  238. package/dist/presets/ui/input-mask.d.ts.map +1 -0
  239. package/dist/presets/ui/input-mask.js +561 -0
  240. package/dist/presets/ui/input-mask.js.map +1 -0
  241. package/dist/presets/ui/input-otp.d.ts +12 -0
  242. package/dist/presets/ui/input-otp.d.ts.map +1 -0
  243. package/dist/presets/ui/input-otp.js +22 -0
  244. package/dist/presets/ui/input-otp.js.map +1 -0
  245. package/dist/presets/ui/input.d.ts +83 -0
  246. package/dist/presets/ui/input.d.ts.map +1 -0
  247. package/dist/presets/ui/input.js +436 -0
  248. package/dist/presets/ui/input.js.map +1 -0
  249. package/dist/presets/ui/label.d.ts +5 -0
  250. package/dist/presets/ui/label.d.ts.map +1 -0
  251. package/dist/presets/ui/label.js +8 -0
  252. package/dist/presets/ui/label.js.map +1 -0
  253. package/dist/presets/ui/number.d.ts +60 -0
  254. package/dist/presets/ui/number.d.ts.map +1 -0
  255. package/dist/presets/ui/number.js +1078 -0
  256. package/dist/presets/ui/number.js.map +1 -0
  257. package/dist/presets/ui/popover.d.ts +8 -0
  258. package/dist/presets/ui/popover.d.ts.map +1 -0
  259. package/dist/presets/ui/popover.js +17 -0
  260. package/dist/presets/ui/popover.js.map +1 -0
  261. package/dist/presets/ui/radio-group.d.ts +6 -0
  262. package/dist/presets/ui/radio-group.d.ts.map +1 -0
  263. package/dist/presets/ui/radio-group.js +12 -0
  264. package/dist/presets/ui/radio-group.js.map +1 -0
  265. package/dist/presets/ui/scroll-area.d.ts +6 -0
  266. package/dist/presets/ui/scroll-area.d.ts.map +1 -0
  267. package/dist/presets/ui/scroll-area.js +13 -0
  268. package/dist/presets/ui/scroll-area.js.map +1 -0
  269. package/dist/presets/ui/select.d.ts +21 -0
  270. package/dist/presets/ui/select.d.ts.map +1 -0
  271. package/dist/presets/ui/select.js +38 -0
  272. package/dist/presets/ui/select.js.map +1 -0
  273. package/dist/presets/ui/separator.d.ts +5 -0
  274. package/dist/presets/ui/separator.d.ts.map +1 -0
  275. package/dist/presets/ui/separator.js +9 -0
  276. package/dist/presets/ui/separator.js.map +1 -0
  277. package/dist/presets/ui/slider.d.ts +5 -0
  278. package/dist/presets/ui/slider.d.ts.map +1 -0
  279. package/dist/presets/ui/slider.js +14 -0
  280. package/dist/presets/ui/slider.js.map +1 -0
  281. package/dist/presets/ui/switch.d.ts +7 -0
  282. package/dist/presets/ui/switch.d.ts.map +1 -0
  283. package/dist/presets/ui/switch.js +9 -0
  284. package/dist/presets/ui/switch.js.map +1 -0
  285. package/dist/presets/ui/textarea.d.ts +76 -0
  286. package/dist/presets/ui/textarea.d.ts.map +1 -0
  287. package/dist/presets/ui/textarea.js +291 -0
  288. package/dist/presets/ui/textarea.js.map +1 -0
  289. package/dist/presets/ui/time-dropdowns.d.ts +58 -0
  290. package/dist/presets/ui/time-dropdowns.d.ts.map +1 -0
  291. package/dist/presets/ui/time-dropdowns.js +133 -0
  292. package/dist/presets/ui/time-dropdowns.js.map +1 -0
  293. package/{src/schema/adapter.ts → dist/schema/adapter.d.ts} +7 -35
  294. package/dist/schema/adapter.d.ts.map +1 -0
  295. package/dist/schema/adapter.js +3 -0
  296. package/dist/schema/adapter.js.map +1 -0
  297. package/{src/schema/core.ts → dist/schema/core.d.ts} +17 -117
  298. package/dist/schema/core.d.ts.map +1 -0
  299. package/dist/schema/core.js +4 -0
  300. package/dist/schema/core.js.map +1 -0
  301. package/dist/schema/field-map.d.ts +1 -0
  302. package/dist/schema/field-map.d.ts.map +1 -0
  303. package/dist/schema/field-map.js +2 -0
  304. package/dist/schema/field-map.js.map +1 -0
  305. package/{src/schema/field.ts → dist/schema/field.d.ts} +1 -34
  306. package/dist/schema/field.d.ts.map +1 -0
  307. package/dist/schema/field.js +4 -0
  308. package/dist/schema/field.js.map +1 -0
  309. package/dist/schema/index.d.ts +1 -0
  310. package/dist/schema/index.d.ts.map +1 -0
  311. package/dist/schema/index.js +2 -0
  312. package/dist/schema/index.js.map +1 -0
  313. package/{src/schema/input-field.ts → dist/schema/input-field.d.ts} +6 -43
  314. package/dist/schema/input-field.d.ts.map +1 -0
  315. package/dist/schema/input-field.js +3 -0
  316. package/dist/schema/input-field.js.map +1 -0
  317. package/dist/schema/presets.d.ts +1 -0
  318. package/dist/schema/presets.d.ts.map +1 -0
  319. package/dist/schema/presets.js +2 -0
  320. package/dist/schema/presets.js.map +1 -0
  321. package/{src/schema/variant.ts → dist/schema/variant.d.ts} +24 -64
  322. package/dist/schema/variant.d.ts.map +1 -0
  323. package/dist/schema/variant.js +3 -0
  324. package/dist/schema/variant.js.map +1 -0
  325. package/dist/variants/core/checkbox.d.ts +15 -0
  326. package/dist/variants/core/checkbox.d.ts.map +1 -0
  327. package/dist/variants/core/checkbox.js +27 -0
  328. package/dist/variants/core/checkbox.js.map +1 -0
  329. package/dist/variants/core/chips.d.ts +3 -0
  330. package/dist/variants/core/chips.d.ts.map +1 -0
  331. package/dist/variants/core/chips.js +20 -0
  332. package/dist/variants/core/chips.js.map +1 -0
  333. package/dist/variants/core/color.d.ts +3 -0
  334. package/dist/variants/core/color.d.ts.map +1 -0
  335. package/dist/variants/core/color.js +14 -0
  336. package/dist/variants/core/color.js.map +1 -0
  337. package/dist/variants/core/custom.d.ts +11 -0
  338. package/dist/variants/core/custom.d.ts.map +1 -0
  339. package/{src/variants/core/custom.tsx → dist/variants/core/custom.js} +15 -18
  340. package/dist/variants/core/custom.js.map +1 -0
  341. package/dist/variants/core/date.d.ts +3 -0
  342. package/dist/variants/core/date.d.ts.map +1 -0
  343. package/dist/variants/core/date.js +20 -0
  344. package/dist/variants/core/date.js.map +1 -0
  345. package/dist/variants/core/file.d.ts +3 -0
  346. package/dist/variants/core/file.d.ts.map +1 -0
  347. package/dist/variants/core/file.js +6 -0
  348. package/dist/variants/core/file.js.map +1 -0
  349. package/dist/variants/core/keyvalue.d.ts +3 -0
  350. package/dist/variants/core/keyvalue.d.ts.map +1 -0
  351. package/dist/variants/core/keyvalue.js +9 -0
  352. package/dist/variants/core/keyvalue.js.map +1 -0
  353. package/dist/variants/core/multiselect.d.ts +11 -0
  354. package/dist/variants/core/multiselect.d.ts.map +1 -0
  355. package/dist/variants/core/multiselect.js +15 -0
  356. package/dist/variants/core/multiselect.js.map +1 -0
  357. package/dist/variants/core/number.d.ts +38 -0
  358. package/dist/variants/core/number.d.ts.map +1 -0
  359. package/dist/variants/core/number.js +62 -0
  360. package/dist/variants/core/number.js.map +1 -0
  361. package/dist/variants/core/password.d.ts +11 -0
  362. package/dist/variants/core/password.d.ts.map +1 -0
  363. package/dist/variants/core/password.js +29 -0
  364. package/dist/variants/core/password.js.map +1 -0
  365. package/dist/variants/core/phone.d.ts +3 -0
  366. package/dist/variants/core/phone.d.ts.map +1 -0
  367. package/dist/variants/core/phone.js +14 -0
  368. package/dist/variants/core/phone.js.map +1 -0
  369. package/dist/variants/core/radio.d.ts +8 -0
  370. package/dist/variants/core/radio.d.ts.map +1 -0
  371. package/dist/variants/core/radio.js +34 -0
  372. package/dist/variants/core/radio.js.map +1 -0
  373. package/dist/variants/core/select.d.ts +5 -0
  374. package/dist/variants/core/select.d.ts.map +1 -0
  375. package/dist/variants/core/select.js +11 -0
  376. package/dist/variants/core/select.js.map +1 -0
  377. package/dist/variants/core/slider.d.ts +19 -0
  378. package/dist/variants/core/slider.d.ts.map +1 -0
  379. package/dist/variants/core/slider.js +36 -0
  380. package/dist/variants/core/slider.js.map +1 -0
  381. package/dist/variants/core/text.d.ts +38 -0
  382. package/dist/variants/core/text.d.ts.map +1 -0
  383. package/{src/variants/core/text.tsx → dist/variants/core/text.js} +4 -56
  384. package/dist/variants/core/text.js.map +1 -0
  385. package/dist/variants/core/textarea.d.ts +3 -0
  386. package/dist/variants/core/textarea.d.ts.map +1 -0
  387. package/dist/variants/core/textarea.js +20 -0
  388. package/dist/variants/core/textarea.js.map +1 -0
  389. package/dist/variants/core/toggle.d.ts +6 -0
  390. package/dist/variants/core/toggle.d.ts.map +1 -0
  391. package/dist/variants/core/toggle.js +41 -0
  392. package/dist/variants/core/toggle.js.map +1 -0
  393. package/dist/variants/core/treeselect.d.ts +4 -0
  394. package/dist/variants/core/treeselect.d.ts.map +1 -0
  395. package/dist/variants/core/treeselect.js +7 -0
  396. package/dist/variants/core/treeselect.js.map +1 -0
  397. package/dist/variants/helpers/selection-summary.d.ts +24 -0
  398. package/dist/variants/helpers/selection-summary.d.ts.map +1 -0
  399. package/dist/variants/helpers/selection-summary.js +105 -0
  400. package/dist/variants/helpers/selection-summary.js.map +1 -0
  401. package/dist/variants/index.d.ts +16 -0
  402. package/dist/variants/index.d.ts.map +1 -0
  403. package/{src/variants/index.ts → dist/variants/index.js} +7 -27
  404. package/dist/variants/index.js.map +1 -0
  405. package/dist/variants/registry.d.ts +19 -0
  406. package/dist/variants/registry.d.ts.map +1 -0
  407. package/dist/variants/registry.js +29 -0
  408. package/dist/variants/registry.js.map +1 -0
  409. package/dist/variants/select-shared.d.ts +1 -0
  410. package/dist/variants/select-shared.d.ts.map +1 -0
  411. package/dist/variants/select-shared.js +2 -0
  412. package/dist/variants/select-shared.js.map +1 -0
  413. package/{src/variants/shared.ts → dist/variants/shared.d.ts} +3 -22
  414. package/dist/variants/shared.d.ts.map +1 -0
  415. package/dist/variants/shared.js +3 -0
  416. package/dist/variants/shared.js.map +1 -0
  417. package/package.json +5 -5
  418. package/.scaffold-cache.json +0 -537
  419. package/src/.scaffold-cache.json +0 -544
  420. package/src/adapters/axios.ts +0 -117
  421. package/src/adapters/index.ts +0 -91
  422. package/src/adapters/inertia.ts +0 -187
  423. package/src/core/bound/observe-bound-field.ts +0 -172
  424. package/src/core/bound/wait-for-bound-field.ts +0 -57
  425. package/src/core/core-root.tsx +0 -72
  426. package/src/core/core-shell.tsx +0 -44
  427. package/src/core/errors/index.ts +0 -2
  428. package/src/core/hooks/use-button.ts +0 -220
  429. package/src/core/hooks/use-core-utility.ts +0 -0
  430. package/src/core/hooks/use-field.ts +0 -497
  431. package/src/core/hooks/use-optional-field.ts +0 -28
  432. package/src/core/index.ts +0 -0
  433. package/src/core/registry/binder-registry.ts +0 -82
  434. package/src/core/test.tsx +0 -17
  435. package/src/global.d.ts +0 -14
  436. package/src/input/input-field.tsx +0 -854
  437. package/src/input/input-layout-graph.ts +0 -230
  438. package/src/lib/get-global-countries.ts +0 -87
  439. package/src/lib/utils.ts +0 -6
  440. package/src/presets/index.ts +0 -0
  441. package/src/presets/shadcn-preset.ts +0 -0
  442. package/src/presets/shadcn-variants/checkbox.tsx +0 -849
  443. package/src/presets/shadcn-variants/chips.tsx +0 -756
  444. package/src/presets/shadcn-variants/color.tsx +0 -284
  445. package/src/presets/shadcn-variants/custom.tsx +0 -227
  446. package/src/presets/shadcn-variants/date.tsx +0 -796
  447. package/src/presets/shadcn-variants/file.tsx +0 -764
  448. package/src/presets/shadcn-variants/keyvalue.tsx +0 -556
  449. package/src/presets/shadcn-variants/multiselect.tsx +0 -1132
  450. package/src/presets/shadcn-variants/number.tsx +0 -176
  451. package/src/presets/shadcn-variants/password.tsx +0 -737
  452. package/src/presets/shadcn-variants/phone.tsx +0 -628
  453. package/src/presets/shadcn-variants/radio.tsx +0 -578
  454. package/src/presets/shadcn-variants/select.tsx +0 -956
  455. package/src/presets/shadcn-variants/slider.tsx +0 -622
  456. package/src/presets/shadcn-variants/text.tsx +0 -343
  457. package/src/presets/shadcn-variants/textarea.tsx +0 -66
  458. package/src/presets/shadcn-variants/toggle.tsx +0 -218
  459. package/src/presets/shadcn-variants/treeselect.tsx +0 -784
  460. package/src/presets/ui/badge.tsx +0 -46
  461. package/src/presets/ui/button.tsx +0 -60
  462. package/src/presets/ui/calendar.tsx +0 -214
  463. package/src/presets/ui/checkbox.tsx +0 -115
  464. package/src/presets/ui/custom.tsx +0 -0
  465. package/src/presets/ui/dialog.tsx +0 -141
  466. package/src/presets/ui/field.tsx +0 -246
  467. package/src/presets/ui/input-mask.tsx +0 -739
  468. package/src/presets/ui/input-otp.tsx +0 -77
  469. package/src/presets/ui/input.tsx +0 -1011
  470. package/src/presets/ui/label.tsx +0 -22
  471. package/src/presets/ui/number.tsx +0 -1370
  472. package/src/presets/ui/popover.tsx +0 -46
  473. package/src/presets/ui/radio-group.tsx +0 -43
  474. package/src/presets/ui/scroll-area.tsx +0 -56
  475. package/src/presets/ui/select.tsx +0 -190
  476. package/src/presets/ui/separator.tsx +0 -28
  477. package/src/presets/ui/slider.tsx +0 -61
  478. package/src/presets/ui/switch.tsx +0 -32
  479. package/src/presets/ui/textarea.tsx +0 -634
  480. package/src/presets/ui/time-dropdowns.tsx +0 -350
  481. package/src/schema/field-map.ts +0 -0
  482. package/src/schema/index.ts +0 -0
  483. package/src/schema/presets.ts +0 -0
  484. package/src/variants/core/checkbox.tsx +0 -54
  485. package/src/variants/core/chips.tsx +0 -22
  486. package/src/variants/core/color.tsx +0 -16
  487. package/src/variants/core/date.tsx +0 -25
  488. package/src/variants/core/file.tsx +0 -9
  489. package/src/variants/core/keyvalue.tsx +0 -12
  490. package/src/variants/core/multiselect.tsx +0 -28
  491. package/src/variants/core/number.tsx +0 -115
  492. package/src/variants/core/password.tsx +0 -35
  493. package/src/variants/core/phone.tsx +0 -16
  494. package/src/variants/core/radio.tsx +0 -38
  495. package/src/variants/core/select.tsx +0 -15
  496. package/src/variants/core/slider.tsx +0 -55
  497. package/src/variants/core/textarea.tsx +0 -22
  498. package/src/variants/core/toggle.tsx +0 -50
  499. package/src/variants/core/treeselect.tsx +0 -11
  500. package/src/variants/helpers/selection-summary.tsx +0 -236
  501. package/src/variants/registry.ts +0 -38
  502. package/src/variants/select-shared.ts +0 -0
  503. package/tsconfig.json +0 -14
@@ -1,91 +0,0 @@
1
- // src/adapters/index.ts
2
-
3
- import axios from "axios";
4
- import { registerAdapter } from "@/core/adapter-registry";
5
- import type { AdapterKey } from "@/schema/adapter";
6
-
7
- import { createAxiosAdapter } from "./axios";
8
- import { createInertiaAdapter } from "./inertia";
9
-
10
- // Re-export core adapter types + helpers so hosts can import from a single place.
11
- export * from "@/schema/adapter";
12
- export * from "@/core/adapter-registry";
13
-
14
- // Re-export the concrete factories for hosts that want manual wiring.
15
- export { createAxiosAdapter, createInertiaAdapter };
16
-
17
- /**
18
- * Register the Axios adapter under the "axios" key.
19
- *
20
- * This performs a basic runtime check to make sure Axios is present.
21
- * If Axios isn't available or doesn't look like a proper Axios instance,
22
- * an error is thrown.
23
- */
24
- export function registerAxiosAdapter(): void {
25
- // Basic sanity check – if this fails, something is wrong with the axios import.
26
- if (!axios || typeof axios.request !== "function") {
27
- throw new Error(
28
- "[form-palette] Axios does not appear to be available. " +
29
- "Make sure 'axios' is installed and resolvable before calling registerAxiosAdapter()."
30
- );
31
- }
32
-
33
- registerAdapter<"axios">("axios", createAxiosAdapter);
34
- }
35
-
36
- /**
37
- * Register the Inertia adapter under the "inertia" key.
38
- *
39
- * This explicitly tests that '@inertiajs/react' can be imported and that
40
- * it exposes a router with a .visit() method. If not, an error is thrown.
41
- *
42
- * Note:
43
- * - This function is async because it uses dynamic import.
44
- * - Call it at bootstrap time and await it:
45
- *
46
- * await registerInertiaAdapter();
47
- */
48
- export async function registerInertiaAdapter(): Promise<void> {
49
- try {
50
- const mod: any = await import("@inertiajs/react");
51
- const router = mod?.router ?? mod?.Inertia;
52
-
53
- if (!router || typeof router.visit !== "function") {
54
- throw new Error(
55
- "[form-palette] '@inertiajs/react' was imported, " +
56
- "but no router with a .visit() method was found."
57
- );
58
- }
59
- } catch (error) {
60
- throw new Error(
61
- "[form-palette] Failed to import '@inertiajs/react'. " +
62
- "Cannot register the 'inertia' adapter. " +
63
- "Make sure '@inertiajs/react' is installed and resolvable."
64
- );
65
- }
66
-
67
- registerAdapter<"inertia">("inertia", createInertiaAdapter);
68
- }
69
-
70
- /**
71
- * Optional helper: convenience registration for known adapter keys.
72
- *
73
- * This is purely ergonomic; you can also call registerAxiosAdapter /
74
- * registerInertiaAdapter directly.
75
- */
76
- export async function registerKnownAdapter(key: AdapterKey): Promise<void> {
77
- switch (key) {
78
- case "axios":
79
- registerAxiosAdapter();
80
- return;
81
- case "inertia":
82
- await registerInertiaAdapter();
83
- return;
84
- default:
85
- // For now, we only special-case axios/inertia here.
86
- // Other adapters can be registered by calling registerAdapter() directly.
87
- throw new Error(
88
- `[form-palette] registerKnownAdapter: adapter "${key}" is not handled here.`
89
- );
90
- }
91
- }
@@ -1,187 +0,0 @@
1
- import { VisitOptions, Page } from './../../../../node_modules/@inertiajs/core/types/types.d';
2
- // src/adapters/inertia.ts
3
- import type {
4
- NamedAdapterFactory,
5
- NamedAdapterConfig,
6
- AdapterResult,
7
- AdapterOk,
8
- AdapterError,
9
- } from "@/schema/adapter";
10
-
11
- // (Adapters augmentation is above in the same file)
12
-
13
- /**
14
- * Lazy-load the Inertia router from '@inertiajs/react'.
15
- *
16
- * This keeps '@inertiajs/react' out of the main bundle until an
17
- * Inertia adapter is actually used.
18
- */
19
- async function loadInertiaRouter() {
20
- const mod: any = await import("@inertiajs/react");
21
- const router = mod?.router ?? mod?.Inertia;
22
-
23
- if (!router || typeof router.visit !== "function") {
24
- throw new Error(
25
- "[form-palette] Inertia router not found in @inertiajs/react"
26
- );
27
- }
28
-
29
- return router as {
30
- visit: (url: string, options?: VisitOptions) => void;
31
- };
32
- }
33
-
34
- /**
35
- * Shape raw Inertia errors into something with `.errors`
36
- * so Form Palette's autoErr branch can pick them up.
37
- */
38
- function normalizeInertiaError(
39
- raw: unknown
40
- ): { errors: Record<string, string | string[]> } | unknown {
41
- if (
42
- raw &&
43
- typeof raw === "object" &&
44
- "errors" in (raw as any) &&
45
- typeof (raw as any).errors === "object"
46
- ) {
47
- // Already in { errors: {...} } shape
48
- return raw as any;
49
- }
50
-
51
- if (
52
- raw &&
53
- typeof raw === "object" &&
54
- !("errors" in (raw as any))
55
- ) {
56
- // Inertia usually passes the error bag directly to onError.
57
- return { errors: raw as Record<string, string | string[]> };
58
- }
59
-
60
- return raw;
61
- }
62
-
63
- export const createInertiaAdapter: NamedAdapterFactory<"inertia"> = (
64
- config: NamedAdapterConfig<"inertia">
65
- ): AdapterResult<AdapterOk<"inertia">> => {
66
- const { method, url, data, callbacks } = config;
67
-
68
- const upperMethod = method.toUpperCase() as VisitOptions["method"];
69
-
70
- /**
71
- * Build VisitOptions with callbacks wired to AdapterCallbacks
72
- * + optional Promise resolve/reject.
73
- */
74
- function buildOptions(
75
- resolve?: (value: AdapterOk<"inertia">) => void,
76
- reject?: (reason: AdapterError<"inertia">) => void,
77
- extraOptions?: unknown
78
- ): VisitOptions {
79
- const merged: VisitOptions = {
80
- method: upperMethod,
81
- //@ts-ignore
82
- data,
83
- onSuccess: (page: Page) => {
84
- callbacks?.onSuccess?.(page as AdapterOk<"inertia">);
85
- resolve?.(page as AdapterOk<"inertia">);
86
- },
87
- onError: (rawErrors: any) => {
88
- const payload = normalizeInertiaError(rawErrors);
89
- callbacks?.onError?.(payload as AdapterError<"inertia">);
90
- reject?.(payload as AdapterError<"inertia">);
91
- },
92
- onFinish: () => {
93
- callbacks?.onFinish?.();
94
- },
95
- ...(extraOptions as VisitOptions | undefined),
96
- };
97
-
98
- return merged;
99
- }
100
-
101
- function submit(options?: unknown): void {
102
- // Fire-and-forget; we still propagate callbacks and finish.
103
- (async () => {
104
- let finished = false;
105
- const finish = () => {
106
- if (finished) return;
107
- finished = true;
108
- callbacks?.onFinish?.();
109
- };
110
-
111
- try {
112
- const router = await loadInertiaRouter();
113
- const visitOptions = buildOptions(undefined, undefined, options);
114
- // NOTE: buildOptions already wires onFinish, so we
115
- // call finish() only if the lazy import itself fails.
116
- router.visit(url, visitOptions);
117
- } catch (error) {
118
- const payload = normalizeInertiaError(error);
119
- callbacks?.onError?.(payload as AdapterError<"inertia">);
120
- finish();
121
- }
122
- })();
123
- }
124
-
125
- function send(options?: unknown): Promise<AdapterOk<"inertia">> {
126
- return new Promise(async (resolve, reject) => {
127
- let finished = false;
128
- const finish = () => {
129
- if (finished) return;
130
- finished = true;
131
- callbacks?.onFinish?.();
132
- };
133
-
134
- try {
135
- const router = await loadInertiaRouter();
136
- const visitOptions = buildOptions(
137
- (page) => {
138
- // buildOptions' onFinish will call onFinish();
139
- resolve(page);
140
- },
141
- (err) => {
142
- reject(err);
143
- },
144
- options
145
- );
146
- router.visit(url, visitOptions);
147
- } catch (error) {
148
- const payload = normalizeInertiaError(error);
149
- callbacks?.onError?.(payload as AdapterError<"inertia">);
150
- finish();
151
- reject(payload as AdapterError<"inertia">);
152
- }
153
- });
154
- }
155
-
156
- function run(options?: unknown): Promise<AdapterOk<"inertia">> {
157
- // Same as send(), so the core can safely `await adapter.run()`
158
- // if it wants, or ignore the promise if it doesn't care.
159
- return send(options);
160
- }
161
-
162
- return {
163
- submit,
164
- send,
165
- run,
166
- };
167
- };
168
-
169
- declare module "@/schema/adapter" {
170
- interface Adapters {
171
- inertia: {
172
- /**
173
- * What adapter.send() resolves with for Inertia.
174
- * This is the Page object passed to onSuccess.
175
- */
176
- ok: Page<any>;
177
-
178
- /**
179
- * What callbacks.onError receives for Inertia.
180
- *
181
- * We shape this as `{ errors: ErrorBag }` so Form Palette's
182
- * autoErr branch can see `.errors`.
183
- */
184
- err: { errors: Record<string, string | string[]> } | unknown;
185
- };
186
- }
187
- }
@@ -1,172 +0,0 @@
1
- // src/core/bound/observe-bound-field.ts
2
-
3
- import type { Dict } from "@/schema/core";
4
- import type { Field } from "@/schema/field";
5
- import type { BindHost } from "@/core/bound/bind-host";
6
-
7
- /** Get the live bound field (if mounted and present). */
8
- export function getBoundField<V extends Dict>(
9
- host: BindHost<V>,
10
- bindId: string
11
- ): Field | undefined {
12
- return host.getBind(bindId);
13
- }
14
-
15
- export function hasBoundField<V extends Dict>(
16
- host: BindHost<V>,
17
- bindId: string
18
- ): boolean {
19
- return !!getBoundField(host, bindId);
20
- }
21
-
22
- export function readBoundValue<T = unknown, V extends Dict = Dict>(
23
- host: BindHost<V>,
24
- bindId: string
25
- ): T | undefined {
26
- return getBoundField(host, bindId)?.value as T | undefined;
27
- }
28
-
29
- export function setBoundValue<T = unknown, V extends Dict = Dict>(
30
- host: BindHost<V>,
31
- bindId: string,
32
- value: T,
33
- variant: string = "util"
34
- ): boolean {
35
- const f = getBoundField(host, bindId);
36
- if (!f) return false;
37
-
38
- (f as any).value = value as unknown;
39
-
40
- // optional: dirty/enable logic if host supports it
41
- try {
42
- host.controlButton?.();
43
- } catch {
44
- // ignore
45
- }
46
-
47
- (f as any).onChange?.(value, undefined, variant);
48
- return true;
49
- }
50
-
51
- export function setBoundError<V extends Dict>(
52
- _host: BindHost<V>, // host not strictly needed here
53
- bindId: string,
54
- msg: string
55
- ): boolean {
56
- const f = _host.getBind(bindId);
57
- if (!f) return false;
58
- (f as any).error = msg ?? "";
59
- return true;
60
- }
61
-
62
- export function validateBoundField<V extends Dict>(
63
- host: BindHost<V>,
64
- bindId: string,
65
- report = true
66
- ): boolean {
67
- const f = getBoundField(host, bindId);
68
- if (!f) return false;
69
- return !!(f as any).validate?.(report);
70
- }
71
-
72
- /**
73
- * Observe a bound field for value/error + liveness.
74
- */
75
- export function observeBoundField<T = unknown, V extends Dict = Dict>(
76
- host: BindHost<V>,
77
- bindId: string,
78
- handler: (evt: {
79
- exists: boolean;
80
- field?: Field;
81
- value?: T;
82
- error?: string;
83
- }) => void,
84
- pollMs = 300
85
- ): () => void {
86
- let current: Field | undefined = getBoundField(host, bindId);
87
- let restoreOnChange: Field["onChange"] | undefined;
88
-
89
- const fire = () => {
90
- if (!current) {
91
- handler({ exists: false });
92
- return;
93
- }
94
-
95
- handler({
96
- exists: true,
97
- field: current,
98
- value: (current as any).value as T,
99
- error: (current as any).error,
100
- });
101
- };
102
-
103
- const wire = () => {
104
- const f = getBoundField(host, bindId);
105
-
106
- if (f === current) return;
107
-
108
- if (current && restoreOnChange) {
109
- (current as any).onChange = restoreOnChange;
110
- restoreOnChange = undefined;
111
- }
112
-
113
- current = f;
114
-
115
- if (current) {
116
- restoreOnChange = (current as any).onChange;
117
- (current as any).onChange = (
118
- next: unknown,
119
- prev: unknown,
120
- variant: string
121
- ) => {
122
- restoreOnChange?.(next, prev, variant);
123
- handler({
124
- exists: true,
125
- field: current,
126
- value: next as T,
127
- error: (current as any).error,
128
- });
129
- };
130
- }
131
-
132
- fire();
133
- };
134
-
135
- // initial
136
- wire();
137
-
138
- let intervalId: number | undefined;
139
- if (typeof window !== "undefined") {
140
- intervalId = window.setInterval(wire, pollMs);
141
- }
142
-
143
- let mo: MutationObserver | undefined;
144
- if (
145
- typeof MutationObserver !== "undefined" &&
146
- typeof document !== "undefined"
147
- ) {
148
- try {
149
- mo = new MutationObserver(wire);
150
- mo.observe(document.body, {
151
- childList: true,
152
- subtree: true,
153
- });
154
- } catch {
155
- // ignore
156
- }
157
- }
158
-
159
- return () => {
160
- if (typeof window !== "undefined" && typeof intervalId === "number") {
161
- window.clearInterval(intervalId);
162
- }
163
- if (mo) {
164
- mo.disconnect();
165
- mo = undefined;
166
- }
167
- if (current && restoreOnChange) {
168
- (current as any).onChange = restoreOnChange;
169
- restoreOnChange = undefined;
170
- }
171
- };
172
- }
@@ -1,57 +0,0 @@
1
- // src/core/bound/wait-for-bound-field.ts
2
-
3
- import type { Dict } from "@/schema/core";
4
- import type { Field } from "@/schema/field";
5
- import type { BindHost } from "@/core/bound/bind-host";
6
- import {
7
- getBoundField,
8
- observeBoundField,
9
- } from "@/core/bound/observe-bound-field";
10
-
11
- export function waitForBoundField<V extends Dict>(
12
- host: BindHost<V>,
13
- bindId: string,
14
- timeoutMs = 5000
15
- ): Promise<Field> {
16
- const existing = getBoundField(host, bindId);
17
- if (existing) return Promise.resolve(existing);
18
-
19
- return new Promise<Field>((resolve, reject) => {
20
- let settled = false;
21
-
22
- const settleResolve = (field: Field) => {
23
- if (settled) return;
24
- settled = true;
25
- stop();
26
- clearTimeout(to);
27
- resolve(field);
28
- };
29
-
30
- const settleReject = (error: Error) => {
31
- if (settled) return;
32
- settled = true;
33
- stop();
34
- clearTimeout(to);
35
- reject(error);
36
- };
37
-
38
- const stop = observeBoundField(
39
- host,
40
- bindId,
41
- (e) => {
42
- if (e.exists && e.field) {
43
- settleResolve(e.field);
44
- }
45
- },
46
- 150
47
- );
48
-
49
- const to = setTimeout(() => {
50
- settleReject(
51
- new Error(
52
- `waitForBoundField('${bindId}') timed out after ${timeoutMs}ms`
53
- )
54
- );
55
- }, timeoutMs);
56
- });
57
- }
@@ -1,72 +0,0 @@
1
- // src/core/core-root.tsx
2
-
3
- import * as React from "react";
4
-
5
- import { useCore } from "@/core/hooks/use-core";
6
- import { ErrorStrip } from "@/core/errors/error-strip";
7
- import type { CoreContext, Dict } from "@/schema/core";
8
-
9
- export interface CoreRootProps
10
- extends React.FormHTMLAttributes<HTMLFormElement> {
11
- /**
12
- * If true, the global ErrorStrip will not be rendered automatically.
13
- */
14
- noErrorStrip?: boolean;
15
-
16
- /**
17
- * Optional hook invoked after CoreRoot orchestrates the submit.
18
- *
19
- * - The native event is already `preventDefault()`-ed.
20
- * - The adapter flow is triggered via `form.go(...)`.
21
- * - Use this to tap into submit without breaking the core.
22
- */
23
- onSubmitForm?(
24
- event: React.FormEvent<HTMLFormElement>,
25
- form: CoreContext<Dict>
26
- ): void | Promise<void>;
27
- }
28
-
29
- /**
30
- * CoreRoot: actual <form> element wired to the core runtime.
31
- *
32
- * Responsibilities:
33
- * - Own the native submit event and prevent full-page navigation.
34
- * - Delegate submit orchestration to form.go().
35
- * - Optionally render the global ErrorStrip at the top.
36
- */
37
- export function CoreRoot(props: CoreRootProps) {
38
- const { noErrorStrip, onSubmitForm, children, ...rest } = props;
39
-
40
- const form = useCore<Dict>();
41
-
42
- const handleSubmit = React.useCallback(
43
- (event: React.FormEvent<HTMLFormElement>) => {
44
- event.preventDefault();
45
- if (form.props.activateButtonOnChange && !form.isDirty()) return;
46
- // Core submit orchestration (adapter-specific behaviour lives inside).
47
- form.go();
48
-
49
- // Optional host-level hook.
50
- if (onSubmitForm) {
51
- void onSubmitForm(event, form);
52
- }
53
-
54
- // If the host provided a native onSubmit prop, call it too.
55
- if (typeof rest.onSubmit === "function") {
56
- rest.onSubmit(event);
57
- }
58
- },
59
- // eslint-disable-next-line react-hooks/exhaustive-deps
60
- [form, onSubmitForm, rest.onSubmit]
61
- );
62
-
63
- // We intentionally override onSubmit so the core owns submit routing.
64
- const { onSubmit: _ignored, ...passThrough } = rest;
65
-
66
- return (
67
- <form onSubmit={handleSubmit} {...passThrough}>
68
- {!noErrorStrip && <ErrorStrip form={form} />}
69
- {children}
70
- </form>
71
- );
72
- }
@@ -1,44 +0,0 @@
1
- // src/core/core-shell.tsx
2
-
3
- import * as React from "react";
4
-
5
- import { CoreProvider } from "@/core/core-provider";
6
- import { CoreRoot, type CoreRootProps } from "@/core/core-root";
7
-
8
- import type { z } from "zod";
9
- import type { AdapterKey } from "@/schema/adapter";
10
- import type { CoreProps, Dict } from "@/schema/core";
11
-
12
- /**
13
- * Combined provider + form-root wrapper.
14
- *
15
- * Usage:
16
- * <CoreShell adapter="local" schema={schema} formProps={{ className: "space-y-4" }}>
17
- * {...fields + buttons...}
18
- * </CoreShell>
19
- */
20
- export interface CoreShellProps<
21
- V extends Dict = Dict,
22
- S extends z.ZodType | undefined = z.ZodType | undefined,
23
- K extends AdapterKey = "local",
24
- > extends CoreProps<V, S, K> {
25
- /**
26
- * Props passed directly to the underlying <form> element via CoreRoot.
27
- */
28
- formProps?: CoreRootProps;
29
- children?: React.ReactNode;
30
- }
31
-
32
- export function CoreShell<
33
- V extends Dict,
34
- S extends z.ZodType | undefined,
35
- K extends AdapterKey = "local",
36
- >(props: CoreShellProps<V, S, K>) {
37
- const { formProps, children, ...coreProps } = props;
38
-
39
- return (
40
- <CoreProvider<V, S, K> {...(coreProps as CoreProps<V, S, K>)}>
41
- <CoreRoot {...(formProps ?? {})}>{children}</CoreRoot>
42
- </CoreProvider>
43
- );
44
- }
@@ -1,2 +0,0 @@
1
- export * from "./map-error-bag";
2
- export * from "./map-zod";