@startdownnotez404/ui 1.0.0 → 1.3.5

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 (439) hide show
  1. package/README.md +110 -0
  2. package/dist/AutocompleteField-ZKNU2IRR.mjs +181 -0
  3. package/dist/AutocompleteField-ZKNU2IRR.mjs.map +1 -0
  4. package/dist/AvatarField-SAODT3CZ.mjs +275 -0
  5. package/dist/AvatarField-SAODT3CZ.mjs.map +1 -0
  6. package/dist/CodeEditor-JF55ZNVD.mjs +34 -0
  7. package/dist/CodeEditor-JF55ZNVD.mjs.map +1 -0
  8. package/dist/DateField-ZYMZFHL4.mjs +82 -0
  9. package/dist/DateField-ZYMZFHL4.mjs.map +1 -0
  10. package/dist/DateTimeField-TPTJ7YIZ.mjs +65 -0
  11. package/dist/DateTimeField-TPTJ7YIZ.mjs.map +1 -0
  12. package/dist/FileUploadField-NTMWBJER.mjs +78 -0
  13. package/dist/FileUploadField-NTMWBJER.mjs.map +1 -0
  14. package/dist/JSONEditorField-TMRWGXVR.mjs +64 -0
  15. package/dist/JSONEditorField-TMRWGXVR.mjs.map +1 -0
  16. package/dist/PopperMenu-LJ36RPBW.mjs +416 -0
  17. package/dist/PopperMenu-LJ36RPBW.mjs.map +1 -0
  18. package/dist/TelField-LOGRVZ4I.mjs +88 -0
  19. package/dist/TelField-LOGRVZ4I.mjs.map +1 -0
  20. package/dist/alert.d.mts +202 -0
  21. package/dist/alert.d.ts +202 -0
  22. package/dist/alert.js +784 -0
  23. package/dist/alert.js.map +1 -0
  24. package/dist/alert.mjs +47 -0
  25. package/dist/alert.mjs.map +1 -0
  26. package/dist/appBar.d.mts +21 -0
  27. package/dist/appBar.d.ts +21 -0
  28. package/dist/appBar.js +64 -0
  29. package/dist/appBar.js.map +1 -0
  30. package/dist/appBar.mjs +12 -0
  31. package/dist/appBar.mjs.map +1 -0
  32. package/dist/autocomplete.d.mts +121 -0
  33. package/dist/autocomplete.d.ts +121 -0
  34. package/dist/autocomplete.js +2052 -0
  35. package/dist/autocomplete.js.map +1 -0
  36. package/dist/autocomplete.mjs +21 -0
  37. package/dist/autocomplete.mjs.map +1 -0
  38. package/dist/avatar.d.mts +253 -0
  39. package/dist/avatar.d.ts +253 -0
  40. package/dist/avatar.js +992 -0
  41. package/dist/avatar.js.map +1 -0
  42. package/dist/avatar.mjs +41 -0
  43. package/dist/avatar.mjs.map +1 -0
  44. package/dist/badge.d.mts +123 -0
  45. package/dist/badge.d.ts +123 -0
  46. package/dist/badge.js +151 -0
  47. package/dist/badge.js.map +1 -0
  48. package/dist/badge.mjs +10 -0
  49. package/dist/badge.mjs.map +1 -0
  50. package/dist/box.d.mts +36 -0
  51. package/dist/box.d.ts +36 -0
  52. package/dist/box.js +199 -0
  53. package/dist/box.js.map +1 -0
  54. package/dist/box.mjs +14 -0
  55. package/dist/box.mjs.map +1 -0
  56. package/dist/button.d.mts +230 -52
  57. package/dist/button.d.ts +230 -52
  58. package/dist/button.js +392 -60
  59. package/dist/button.js.map +1 -1
  60. package/dist/button.mjs +14 -8
  61. package/dist/card.d.mts +47 -0
  62. package/dist/card.d.ts +47 -0
  63. package/dist/card.js +135 -0
  64. package/dist/card.js.map +1 -0
  65. package/dist/card.mjs +24 -0
  66. package/dist/card.mjs.map +1 -0
  67. package/dist/chart.d.mts +40 -0
  68. package/dist/chart.d.ts +40 -0
  69. package/dist/chart.js +1234 -0
  70. package/dist/chart.js.map +1 -0
  71. package/dist/chart.mjs +10 -0
  72. package/dist/chart.mjs.map +1 -0
  73. package/dist/checkbox.d.mts +62 -0
  74. package/dist/checkbox.d.ts +62 -0
  75. package/dist/checkbox.js +299 -0
  76. package/dist/checkbox.js.map +1 -0
  77. package/dist/checkbox.mjs +14 -0
  78. package/dist/checkbox.mjs.map +1 -0
  79. package/dist/chip.d.mts +96 -0
  80. package/dist/chip.d.ts +96 -0
  81. package/dist/chip.js +112 -0
  82. package/dist/chip.js.map +1 -0
  83. package/dist/chip.mjs +10 -0
  84. package/dist/chip.mjs.map +1 -0
  85. package/dist/chunk-24XDGNJ6.mjs +1450 -0
  86. package/dist/chunk-24XDGNJ6.mjs.map +1 -0
  87. package/dist/chunk-27KYFU7R.mjs +30 -0
  88. package/dist/chunk-27KYFU7R.mjs.map +1 -0
  89. package/dist/chunk-2FFLT5VP.mjs +7 -0
  90. package/dist/chunk-2FFLT5VP.mjs.map +1 -0
  91. package/dist/chunk-2ZZJTBTE.mjs +148 -0
  92. package/dist/chunk-2ZZJTBTE.mjs.map +1 -0
  93. package/dist/chunk-3DQINB57.mjs +15 -0
  94. package/dist/chunk-3DQINB57.mjs.map +1 -0
  95. package/dist/chunk-3VUAM2GY.mjs +52 -0
  96. package/dist/chunk-3VUAM2GY.mjs.map +1 -0
  97. package/dist/chunk-4Q54P737.mjs +19 -0
  98. package/dist/chunk-4Q54P737.mjs.map +1 -0
  99. package/dist/chunk-4RPFRNXG.mjs +62 -0
  100. package/dist/chunk-4RPFRNXG.mjs.map +1 -0
  101. package/dist/chunk-56TI2ZBT.mjs +114 -0
  102. package/dist/chunk-56TI2ZBT.mjs.map +1 -0
  103. package/dist/chunk-6REEQBJI.mjs +62 -0
  104. package/dist/chunk-6REEQBJI.mjs.map +1 -0
  105. package/dist/chunk-AAH2O24U.mjs +325 -0
  106. package/dist/chunk-AAH2O24U.mjs.map +1 -0
  107. package/dist/chunk-B7DAB22K.mjs +16 -0
  108. package/dist/chunk-B7DAB22K.mjs.map +1 -0
  109. package/dist/chunk-BGB7JHIU.mjs +222 -0
  110. package/dist/chunk-BGB7JHIU.mjs.map +1 -0
  111. package/dist/chunk-CRYIEYZZ.mjs +756 -0
  112. package/dist/chunk-CRYIEYZZ.mjs.map +1 -0
  113. package/dist/chunk-CWFWRZWU.mjs +23 -0
  114. package/dist/chunk-CWFWRZWU.mjs.map +1 -0
  115. package/dist/chunk-DELCADNF.mjs +1926 -0
  116. package/dist/chunk-DELCADNF.mjs.map +1 -0
  117. package/dist/chunk-E3I2VDHZ.mjs +292 -0
  118. package/dist/chunk-E3I2VDHZ.mjs.map +1 -0
  119. package/dist/chunk-EEH7HACG.mjs +249 -0
  120. package/dist/chunk-EEH7HACG.mjs.map +1 -0
  121. package/dist/chunk-EKPULYPU.mjs +497 -0
  122. package/dist/chunk-EKPULYPU.mjs.map +1 -0
  123. package/dist/chunk-EW4DTFH3.mjs +69 -0
  124. package/dist/chunk-EW4DTFH3.mjs.map +1 -0
  125. package/dist/chunk-FJ6ZGZIA.mjs +43 -0
  126. package/dist/chunk-FJ6ZGZIA.mjs.map +1 -0
  127. package/dist/chunk-HE7MY3RT.mjs +23 -0
  128. package/dist/chunk-HE7MY3RT.mjs.map +1 -0
  129. package/dist/chunk-HR3A4H4E.mjs +1289 -0
  130. package/dist/chunk-HR3A4H4E.mjs.map +1 -0
  131. package/dist/chunk-I5JWS4Z7.mjs +91 -0
  132. package/dist/chunk-I5JWS4Z7.mjs.map +1 -0
  133. package/dist/chunk-IN3O4R7Q.mjs +932 -0
  134. package/dist/chunk-IN3O4R7Q.mjs.map +1 -0
  135. package/dist/chunk-JIU5GVM7.mjs +414 -0
  136. package/dist/chunk-JIU5GVM7.mjs.map +1 -0
  137. package/dist/chunk-JWANK42G.mjs +170 -0
  138. package/dist/chunk-JWANK42G.mjs.map +1 -0
  139. package/dist/chunk-MDAUF7IL.mjs +9 -0
  140. package/dist/chunk-MDAUF7IL.mjs.map +1 -0
  141. package/dist/chunk-MI64T62E.mjs +26 -0
  142. package/dist/chunk-MI64T62E.mjs.map +1 -0
  143. package/dist/chunk-NJYNJLT7.mjs +172 -0
  144. package/dist/chunk-NJYNJLT7.mjs.map +1 -0
  145. package/dist/chunk-NLBDBJ3R.mjs +97 -0
  146. package/dist/chunk-NLBDBJ3R.mjs.map +1 -0
  147. package/dist/chunk-OGNGPI3M.mjs +333 -0
  148. package/dist/chunk-OGNGPI3M.mjs.map +1 -0
  149. package/dist/chunk-OJV6V7YZ.mjs +552 -0
  150. package/dist/chunk-OJV6V7YZ.mjs.map +1 -0
  151. package/dist/chunk-ONQMRE2G.mjs +26 -0
  152. package/dist/chunk-ONQMRE2G.mjs.map +1 -0
  153. package/dist/chunk-OP6LKXPA.mjs +75 -0
  154. package/dist/chunk-OP6LKXPA.mjs.map +1 -0
  155. package/dist/chunk-QFF3HTHL.mjs +14 -0
  156. package/dist/chunk-QFF3HTHL.mjs.map +1 -0
  157. package/dist/chunk-QKGCW37O.mjs +1175 -0
  158. package/dist/chunk-QKGCW37O.mjs.map +1 -0
  159. package/dist/chunk-R5MKQN6D.mjs +227 -0
  160. package/dist/chunk-R5MKQN6D.mjs.map +1 -0
  161. package/dist/chunk-RXBQ7KXF.mjs +652 -0
  162. package/dist/chunk-RXBQ7KXF.mjs.map +1 -0
  163. package/dist/chunk-S6EZVRZC.mjs +161 -0
  164. package/dist/chunk-S6EZVRZC.mjs.map +1 -0
  165. package/dist/chunk-SGCUDWO3.mjs +396 -0
  166. package/dist/chunk-SGCUDWO3.mjs.map +1 -0
  167. package/dist/chunk-SRWPHN2N.mjs +188 -0
  168. package/dist/chunk-SRWPHN2N.mjs.map +1 -0
  169. package/dist/chunk-T34IULP5.mjs +242 -0
  170. package/dist/chunk-T34IULP5.mjs.map +1 -0
  171. package/dist/chunk-T4X375IG.mjs +100 -0
  172. package/dist/chunk-T4X375IG.mjs.map +1 -0
  173. package/dist/chunk-T6AMRENK.mjs +376 -0
  174. package/dist/chunk-T6AMRENK.mjs.map +1 -0
  175. package/dist/chunk-TDRA5EZI.mjs +325 -0
  176. package/dist/chunk-TDRA5EZI.mjs.map +1 -0
  177. package/dist/chunk-UDREPVEY.mjs +356 -0
  178. package/dist/chunk-UDREPVEY.mjs.map +1 -0
  179. package/dist/chunk-UGMRJMFZ.mjs +172 -0
  180. package/dist/chunk-UGMRJMFZ.mjs.map +1 -0
  181. package/dist/chunk-UMJ5SCIQ.mjs +438 -0
  182. package/dist/chunk-UMJ5SCIQ.mjs.map +1 -0
  183. package/dist/chunk-UTVSYS6S.mjs +270 -0
  184. package/dist/chunk-UTVSYS6S.mjs.map +1 -0
  185. package/dist/chunk-V26V2S3W.mjs +197 -0
  186. package/dist/chunk-V26V2S3W.mjs.map +1 -0
  187. package/dist/chunk-VYD3PDBB.mjs +38 -0
  188. package/dist/chunk-VYD3PDBB.mjs.map +1 -0
  189. package/dist/chunk-WYYP3Y34.mjs +55 -0
  190. package/dist/chunk-WYYP3Y34.mjs.map +1 -0
  191. package/dist/chunk-XIMFP6RB.mjs +161 -0
  192. package/dist/chunk-XIMFP6RB.mjs.map +1 -0
  193. package/dist/chunk-XJ2SXC2Q.mjs +558 -0
  194. package/dist/chunk-XJ2SXC2Q.mjs.map +1 -0
  195. package/dist/chunk-Y74ALKBL.mjs +565 -0
  196. package/dist/chunk-Y74ALKBL.mjs.map +1 -0
  197. package/dist/chunk-ZG3NQI77.mjs +353 -0
  198. package/dist/chunk-ZG3NQI77.mjs.map +1 -0
  199. package/dist/chunk-ZVFYOXDE.mjs +297 -0
  200. package/dist/chunk-ZVFYOXDE.mjs.map +1 -0
  201. package/dist/collapse.d.mts +10 -0
  202. package/dist/collapse.d.ts +10 -0
  203. package/dist/collapse.js +53 -0
  204. package/dist/collapse.js.map +1 -0
  205. package/dist/collapse.mjs +10 -0
  206. package/dist/collapse.mjs.map +1 -0
  207. package/dist/datePicker.d.mts +133 -0
  208. package/dist/datePicker.d.ts +133 -0
  209. package/dist/datePicker.js +482 -0
  210. package/dist/datePicker.js.map +1 -0
  211. package/dist/datePicker.mjs +29 -0
  212. package/dist/datePicker.mjs.map +1 -0
  213. package/dist/displayFile.d.mts +95 -0
  214. package/dist/displayFile.d.ts +95 -0
  215. package/dist/displayFile.js +357 -0
  216. package/dist/displayFile.js.map +1 -0
  217. package/dist/displayFile.mjs +19 -0
  218. package/dist/displayFile.mjs.map +1 -0
  219. package/dist/divider.d.mts +9 -0
  220. package/dist/divider.d.ts +9 -0
  221. package/dist/divider.js +52 -0
  222. package/dist/divider.js.map +1 -0
  223. package/dist/divider.mjs +10 -0
  224. package/dist/divider.mjs.map +1 -0
  225. package/dist/fileUploader.d.mts +86 -0
  226. package/dist/fileUploader.d.ts +86 -0
  227. package/dist/fileUploader.js +722 -0
  228. package/dist/fileUploader.js.map +1 -0
  229. package/dist/fileUploader.mjs +16 -0
  230. package/dist/fileUploader.mjs.map +1 -0
  231. package/dist/flowMap.d.mts +353 -0
  232. package/dist/flowMap.d.ts +353 -0
  233. package/dist/flowMap.js +94806 -0
  234. package/dist/flowMap.js.map +1 -0
  235. package/dist/flowMap.mjs +94585 -0
  236. package/dist/flowMap.mjs.map +1 -0
  237. package/dist/form.d.mts +84 -0
  238. package/dist/form.d.ts +84 -0
  239. package/dist/form.js +144 -0
  240. package/dist/form.js.map +1 -0
  241. package/dist/form.mjs +24 -0
  242. package/dist/form.mjs.map +1 -0
  243. package/dist/icons.d.mts +160 -0
  244. package/dist/icons.d.ts +160 -0
  245. package/dist/icons.js +540 -0
  246. package/dist/icons.js.map +1 -0
  247. package/dist/icons.mjs +306 -0
  248. package/dist/icons.mjs.map +1 -0
  249. package/dist/image.d.mts +49 -0
  250. package/dist/image.d.ts +49 -0
  251. package/dist/image.js +1348 -0
  252. package/dist/image.js.map +1 -0
  253. package/dist/image.mjs +19 -0
  254. package/dist/image.mjs.map +1 -0
  255. package/dist/index.d.ts +46 -0
  256. package/dist/index.js +20198 -0
  257. package/dist/index.js.map +1 -0
  258. package/dist/index.mjs +912 -0
  259. package/dist/index.mjs.map +1 -0
  260. package/dist/input.d.mts +195 -0
  261. package/dist/input.d.ts +195 -0
  262. package/dist/input.js +1101 -0
  263. package/dist/input.js.map +1 -0
  264. package/dist/input.mjs +32 -0
  265. package/dist/input.mjs.map +1 -0
  266. package/dist/jsonEditor.d.mts +13 -0
  267. package/dist/jsonEditor.d.ts +13 -0
  268. package/dist/jsonEditor.js +247 -0
  269. package/dist/jsonEditor.js.map +1 -0
  270. package/dist/jsonEditor.mjs +9 -0
  271. package/dist/jsonEditor.mjs.map +1 -0
  272. package/dist/list.d.mts +83 -0
  273. package/dist/list.d.ts +83 -0
  274. package/dist/list.js +564 -0
  275. package/dist/list.js.map +1 -0
  276. package/dist/list.mjs +39 -0
  277. package/dist/list.mjs.map +1 -0
  278. package/dist/loading.d.mts +48 -0
  279. package/dist/loading.d.ts +48 -0
  280. package/dist/loading.js +383 -0
  281. package/dist/loading.js.map +1 -0
  282. package/dist/loading.mjs +23 -0
  283. package/dist/loading.mjs.map +1 -0
  284. package/dist/markdown.d.mts +14 -0
  285. package/dist/markdown.d.ts +14 -0
  286. package/dist/markdown.js +25927 -0
  287. package/dist/markdown.js.map +1 -0
  288. package/dist/markdown.mjs +25623 -0
  289. package/dist/markdown.mjs.map +1 -0
  290. package/dist/menu.d.mts +368 -0
  291. package/dist/menu.d.ts +368 -0
  292. package/dist/menu.js +1571 -0
  293. package/dist/menu.js.map +1 -0
  294. package/dist/menu.mjs +43 -0
  295. package/dist/menu.mjs.map +1 -0
  296. package/dist/modal.d.mts +90 -0
  297. package/dist/modal.d.ts +90 -0
  298. package/dist/modal.js +883 -0
  299. package/dist/modal.js.map +1 -0
  300. package/dist/modal.mjs +25 -0
  301. package/dist/modal.mjs.map +1 -0
  302. package/dist/overlay.d.mts +2 -0
  303. package/dist/overlay.d.ts +2 -0
  304. package/dist/overlay.js +46 -0
  305. package/dist/overlay.js.map +1 -0
  306. package/dist/overlay.mjs +10 -0
  307. package/dist/overlay.mjs.map +1 -0
  308. package/dist/paper.d.mts +38 -0
  309. package/dist/paper.d.ts +38 -0
  310. package/dist/paper.js +90 -0
  311. package/dist/paper.js.map +1 -0
  312. package/dist/paper.mjs +12 -0
  313. package/dist/paper.mjs.map +1 -0
  314. package/dist/patterns.d.mts +133 -0
  315. package/dist/patterns.d.ts +133 -0
  316. package/dist/patterns.js +483 -0
  317. package/dist/patterns.js.map +1 -0
  318. package/dist/patterns.mjs +46 -0
  319. package/dist/patterns.mjs.map +1 -0
  320. package/dist/process.d.mts +125 -0
  321. package/dist/process.d.ts +125 -0
  322. package/dist/process.js +1471 -0
  323. package/dist/process.js.map +1 -0
  324. package/dist/process.mjs +30 -0
  325. package/dist/process.mjs.map +1 -0
  326. package/dist/progress.d.mts +44 -0
  327. package/dist/progress.d.ts +44 -0
  328. package/dist/progress.js +94 -0
  329. package/dist/progress.js.map +1 -0
  330. package/dist/progress.mjs +14 -0
  331. package/dist/progress.mjs.map +1 -0
  332. package/dist/resizablePanel.d.mts +297 -0
  333. package/dist/resizablePanel.d.ts +297 -0
  334. package/dist/resizablePanel.js +122 -0
  335. package/dist/resizablePanel.js.map +1 -0
  336. package/dist/resizablePanel.mjs +22 -0
  337. package/dist/resizablePanel.mjs.map +1 -0
  338. package/dist/scrollToLoad.d.mts +41 -0
  339. package/dist/scrollToLoad.d.ts +41 -0
  340. package/dist/scrollToLoad.js +256 -0
  341. package/dist/scrollToLoad.js.map +1 -0
  342. package/dist/scrollToLoad.mjs +16 -0
  343. package/dist/scrollToLoad.mjs.map +1 -0
  344. package/dist/select.d.mts +50 -0
  345. package/dist/select.d.ts +50 -0
  346. package/dist/select.js +426 -0
  347. package/dist/select.js.map +1 -0
  348. package/dist/select.mjs +24 -0
  349. package/dist/select.mjs.map +1 -0
  350. package/dist/skeleton.d.mts +13 -0
  351. package/dist/skeleton.d.ts +13 -0
  352. package/dist/skeleton.js +68 -0
  353. package/dist/skeleton.js.map +1 -0
  354. package/dist/skeleton.mjs +11 -0
  355. package/dist/skeleton.mjs.map +1 -0
  356. package/dist/slider.d.mts +65 -0
  357. package/dist/slider.d.ts +65 -0
  358. package/dist/slider.js +106 -0
  359. package/dist/slider.js.map +1 -0
  360. package/dist/slider.mjs +10 -0
  361. package/dist/slider.mjs.map +1 -0
  362. package/dist/stepper.d.mts +98 -0
  363. package/dist/stepper.d.ts +98 -0
  364. package/dist/stepper.js +313 -0
  365. package/dist/stepper.js.map +1 -0
  366. package/dist/stepper.mjs +38 -0
  367. package/dist/stepper.mjs.map +1 -0
  368. package/dist/switch.d.mts +151 -0
  369. package/dist/switch.d.ts +151 -0
  370. package/dist/switch.js +289 -0
  371. package/dist/switch.js.map +1 -0
  372. package/dist/switch.mjs +17 -0
  373. package/dist/switch.mjs.map +1 -0
  374. package/dist/tab.d.mts +182 -0
  375. package/dist/tab.d.ts +182 -0
  376. package/dist/tab.js +1418 -0
  377. package/dist/tab.js.map +1 -0
  378. package/dist/tab.mjs +34 -0
  379. package/dist/tab.mjs.map +1 -0
  380. package/dist/table.d.mts +720 -0
  381. package/dist/table.d.ts +720 -0
  382. package/dist/table.js +10882 -0
  383. package/dist/table.js.map +1 -0
  384. package/dist/table.mjs +63 -0
  385. package/dist/table.mjs.map +1 -0
  386. package/dist/theme.d.mts +30 -4
  387. package/dist/theme.d.ts +30 -4
  388. package/dist/theme.js +3210 -170
  389. package/dist/theme.js.map +1 -1
  390. package/dist/theme.mjs +52 -230
  391. package/dist/theme.mjs.map +1 -1
  392. package/dist/timeline.d.mts +30 -0
  393. package/dist/timeline.d.ts +30 -0
  394. package/dist/timeline.js +273 -0
  395. package/dist/timeline.js.map +1 -0
  396. package/dist/timeline.mjs +14 -0
  397. package/dist/timeline.mjs.map +1 -0
  398. package/dist/toggleButtonGroup.d.mts +125 -0
  399. package/dist/toggleButtonGroup.d.ts +125 -0
  400. package/dist/toggleButtonGroup.js +190 -0
  401. package/dist/toggleButtonGroup.js.map +1 -0
  402. package/dist/toggleButtonGroup.mjs +15 -0
  403. package/dist/toggleButtonGroup.mjs.map +1 -0
  404. package/dist/tooltip.d.mts +13 -0
  405. package/dist/tooltip.d.ts +13 -0
  406. package/dist/tooltip.js +56 -0
  407. package/dist/tooltip.js.map +1 -0
  408. package/dist/tooltip.mjs +10 -0
  409. package/dist/tooltip.mjs.map +1 -0
  410. package/dist/typography.d.mts +21 -23
  411. package/dist/typography.d.ts +21 -23
  412. package/dist/typography.js +37 -63
  413. package/dist/typography.js.map +1 -1
  414. package/dist/typography.mjs +2 -1
  415. package/dist/useForm.d.mts +588 -0
  416. package/dist/useForm.d.ts +588 -0
  417. package/dist/useForm.js +8743 -0
  418. package/dist/useForm.js.map +1 -0
  419. package/dist/useForm.mjs +45 -0
  420. package/dist/useForm.mjs.map +1 -0
  421. package/dist/useSearch.d.mts +126 -0
  422. package/dist/useSearch.d.ts +126 -0
  423. package/dist/useSearch.js +1125 -0
  424. package/dist/useSearch.js.map +1 -0
  425. package/dist/useSearch.mjs +42 -0
  426. package/dist/useSearch.mjs.map +1 -0
  427. package/dist/variablesRenderer.d.mts +45 -0
  428. package/dist/variablesRenderer.d.ts +45 -0
  429. package/dist/variablesRenderer.js +511 -0
  430. package/dist/variablesRenderer.js.map +1 -0
  431. package/dist/variablesRenderer.mjs +21 -0
  432. package/dist/variablesRenderer.mjs.map +1 -0
  433. package/package.json +109 -15
  434. package/dist/chunk-PKADXEAD.mjs +0 -116
  435. package/dist/chunk-PKADXEAD.mjs.map +0 -1
  436. package/dist/chunk-YGBJCPUS.mjs +0 -88
  437. package/dist/chunk-YGBJCPUS.mjs.map +0 -1
  438. package/dist/theme.css +0 -44
  439. package/dist/theme.css.map +0 -1
@@ -0,0 +1,1450 @@
1
+ import {
2
+ FieldHelperText,
3
+ getHelperText
4
+ } from "./chunk-MI64T62E.mjs";
5
+ import {
6
+ Explanation_default,
7
+ FIELD_TYPEs,
8
+ collectFields,
9
+ collectRows,
10
+ getDefaultValues,
11
+ getFieldExplanation,
12
+ getFormFieldsSignature,
13
+ isEmptyFormValue,
14
+ mergeFieldSx,
15
+ validateFormSchema
16
+ } from "./chunk-UTVSYS6S.mjs";
17
+ import {
18
+ StandardStepper_default
19
+ } from "./chunk-V26V2S3W.mjs";
20
+ import {
21
+ MuiSwitch
22
+ } from "./chunk-T34IULP5.mjs";
23
+ import {
24
+ ToggleButtonGroup
25
+ } from "./chunk-2ZZJTBTE.mjs";
26
+ import {
27
+ MuiSelect_default
28
+ } from "./chunk-UGMRJMFZ.mjs";
29
+ import {
30
+ default as default14
31
+ } from "./chunk-EW4DTFH3.mjs";
32
+ import {
33
+ MuiModal
34
+ } from "./chunk-UDREPVEY.mjs";
35
+ import {
36
+ default as default15
37
+ } from "./chunk-VYD3PDBB.mjs";
38
+ import {
39
+ CheckboxGroup
40
+ } from "./chunk-BGB7JHIU.mjs";
41
+ import {
42
+ MuiFormLabel,
43
+ default as default12,
44
+ default3 as default13
45
+ } from "./chunk-T4X375IG.mjs";
46
+ import {
47
+ CircularProgress
48
+ } from "./chunk-WYYP3Y34.mjs";
49
+ import {
50
+ Button,
51
+ IconButton_default
52
+ } from "./chunk-JIU5GVM7.mjs";
53
+ import {
54
+ default125 as default10,
55
+ default126 as default11,
56
+ default13 as default4,
57
+ default53 as default5,
58
+ default54 as default6,
59
+ default67 as default7,
60
+ default69 as default8,
61
+ default82 as default9
62
+ } from "./chunk-ZVFYOXDE.mjs";
63
+ import {
64
+ default as default2,
65
+ default2 as default3,
66
+ mergeSx
67
+ } from "./chunk-S6EZVRZC.mjs";
68
+
69
+ // src/components/compound/UseForm/src/useHooks.ts
70
+ import { useForm } from "react-hook-form";
71
+ import { useEffect, useMemo, useRef } from "react";
72
+
73
+ // src/components/compound/UseForm/src/_utils/resolver.ts
74
+ var toError = (message, type) => ({
75
+ type,
76
+ message
77
+ });
78
+ var runFieldValidate = async (field, value, values) => {
79
+ if (field.type === FIELD_TYPEs.tel && typeof value === "string" && value.trim() !== "") {
80
+ const { isValidPhoneNumber } = await import("react-phone-number-input");
81
+ if (!isValidPhoneNumber(value)) {
82
+ return "Invalid phone number";
83
+ }
84
+ }
85
+ if (field.type === FIELD_TYPEs.fileUpload) {
86
+ const maxFiles = field.slotProps?.maxFiles ?? 1;
87
+ if (Array.isArray(value) && value.length > maxFiles) {
88
+ return `Cannot exceed ${maxFiles} file${maxFiles > 1 ? "s" : ""}`;
89
+ }
90
+ }
91
+ if (!field.validate) return true;
92
+ const result = await field.validate(value, values);
93
+ if (result === true) return true;
94
+ if (typeof result === "string" && result.length > 0) return result;
95
+ return field.errorMsg || "Invalid";
96
+ };
97
+ function createFormResolver(config) {
98
+ const fields = collectFields(config);
99
+ const fieldByName = new Map(fields.map((field) => [String(field.name), field]));
100
+ return async (values, _context, options) => {
101
+ const names = options?.names;
102
+ const nameList = names == null ? null : Array.from(names);
103
+ const fieldsToCheck = nameList && nameList.length > 0 ? nameList.map((name) => fieldByName.get(String(name))).filter((field) => field != null) : fields;
104
+ const errors = {};
105
+ const valuesRecord = values;
106
+ for (const field of fieldsToCheck) {
107
+ const name = String(field.name);
108
+ const value = valuesRecord[name];
109
+ if (field.required && isEmptyFormValue(value)) {
110
+ errors[name] = toError(field.errorMsg || "Required", "required");
111
+ continue;
112
+ }
113
+ if (isEmptyFormValue(value) && !field.validate) {
114
+ continue;
115
+ }
116
+ const result = await runFieldValidate(field, value, values);
117
+ if (result !== true) {
118
+ errors[name] = toError(result, "validate");
119
+ }
120
+ }
121
+ const hasErrors = Object.keys(errors).length > 0;
122
+ return {
123
+ values: hasErrors ? {} : values,
124
+ errors
125
+ };
126
+ };
127
+ }
128
+
129
+ // src/components/compound/UseForm/src/useHooks.ts
130
+ var schemaSignature = (config) => {
131
+ const fields = collectFields(config);
132
+ return JSON.stringify({
133
+ mode: config.mode ?? "onSubmit",
134
+ defaults: config.defaultValues ?? null,
135
+ fields: fields.map((field) => [field.name, field.type, field.defaultValue])
136
+ });
137
+ };
138
+ var useConfiguredForm = ({
139
+ config
140
+ }) => {
141
+ const { resolvedConfig, configError } = useMemo(() => {
142
+ try {
143
+ return {
144
+ resolvedConfig: validateFormSchema(config),
145
+ configError: void 0
146
+ };
147
+ } catch (error) {
148
+ const configError2 = error instanceof Error ? error : new Error(String(error));
149
+ console.error("[useConfiguredForm] invalid form schema", configError2);
150
+ return {
151
+ resolvedConfig: { schema: [] },
152
+ configError: configError2
153
+ };
154
+ }
155
+ }, [config]);
156
+ const defaultValues = useMemo(
157
+ () => getDefaultValues(resolvedConfig, false),
158
+ [resolvedConfig]
159
+ );
160
+ const resolver = useMemo(
161
+ () => createFormResolver(resolvedConfig),
162
+ [resolvedConfig]
163
+ );
164
+ const methods = useForm({
165
+ defaultValues,
166
+ resolver,
167
+ mode: resolvedConfig.mode ?? "onSubmit",
168
+ shouldUnregister: false
169
+ });
170
+ const signature = useMemo(
171
+ () => schemaSignature(resolvedConfig),
172
+ [resolvedConfig]
173
+ );
174
+ const defaultValuesRef = useRef(defaultValues);
175
+ defaultValuesRef.current = defaultValues;
176
+ const isFirstMount = useRef(true);
177
+ useEffect(() => {
178
+ if (isFirstMount.current) {
179
+ isFirstMount.current = false;
180
+ return;
181
+ }
182
+ methods.reset(defaultValuesRef.current);
183
+ }, [signature, methods]);
184
+ return {
185
+ methods,
186
+ config: resolvedConfig,
187
+ configError
188
+ };
189
+ };
190
+ var useForm2 = useConfiguredForm;
191
+
192
+ // src/components/compound/UseForm/src/FormRenderer/Layout.tsx
193
+ import React4 from "react";
194
+ import { FormProvider } from "react-hook-form";
195
+
196
+ // src/components/compound/UseForm/src/FormRenderer/StepperSection.tsx
197
+ import * as React2 from "react";
198
+ import { useFormState } from "react-hook-form";
199
+
200
+ // src/components/compound/UseForm/src/store/FormContext.tsx
201
+ import React from "react";
202
+
203
+ // src/components/compound/UseForm/src/store/methods.ts
204
+ var getNames = (schema) => {
205
+ const names = [];
206
+ schema.forEach((row) => row.fields.forEach((field) => names.push(String(field.name))));
207
+ return names;
208
+ };
209
+ var getFieldNamesInRange = (steps, fromStep, toStep) => {
210
+ const start = Math.min(fromStep, toStep);
211
+ const end = Math.max(fromStep, toStep);
212
+ const names = steps.slice(start, end + 1).flatMap((step) => getNames(step.schema));
213
+ return Array.from(new Set(names));
214
+ };
215
+ var createFormStoreMethods = ({
216
+ methods,
217
+ config,
218
+ steps,
219
+ getCurrentStep,
220
+ setCurrentStep
221
+ }) => {
222
+ const validateNames = async (names) => {
223
+ if (names.length === 0) {
224
+ return methods.trigger();
225
+ }
226
+ return methods.trigger(names);
227
+ };
228
+ const handleStepChange = async (destinationStep) => {
229
+ const currentStep = getCurrentStep();
230
+ if (destinationStep === currentStep) return true;
231
+ if (destinationStep < currentStep) {
232
+ setCurrentStep(destinationStep);
233
+ return true;
234
+ }
235
+ const namesToTrigger = getFieldNamesInRange(steps, 0, currentStep);
236
+ const isValid = await validateNames(namesToTrigger);
237
+ if (!isValid) return false;
238
+ setCurrentStep(destinationStep);
239
+ return true;
240
+ };
241
+ const undo = () => {
242
+ methods.reset();
243
+ };
244
+ const clear = () => {
245
+ const emptyValues = getDefaultValues(config, true);
246
+ methods.reset(emptyValues, { keepDefaultValues: true });
247
+ methods.trigger();
248
+ };
249
+ const submit = async (onSubmit) => {
250
+ const namesToTrigger = getFieldNamesInRange(steps, 0, Math.max(steps.length - 1, 0));
251
+ const isValid = await validateNames(namesToTrigger);
252
+ if (!isValid) return;
253
+ await methods.handleSubmit(onSubmit)();
254
+ };
255
+ return {
256
+ handleStepChange,
257
+ submit,
258
+ undo,
259
+ clear
260
+ };
261
+ };
262
+
263
+ // src/components/compound/UseForm/src/store/FormContext.tsx
264
+ import { jsx } from "react/jsx-runtime";
265
+ var FormStateContext = React.createContext(null);
266
+ var FormActionsContext = React.createContext(null);
267
+ var FormMethodsContext = React.createContext(null);
268
+ var useFormStateContext = () => {
269
+ const ctx = React.useContext(FormStateContext);
270
+ if (!ctx) {
271
+ throw new Error("useFormStateContext must be used within a FormContextProvider");
272
+ }
273
+ return ctx;
274
+ };
275
+ var useFormActionsContext = () => {
276
+ const ctx = React.useContext(FormActionsContext);
277
+ if (!ctx) {
278
+ throw new Error("useFormActionsContext must be used within a FormContextProvider");
279
+ }
280
+ return ctx;
281
+ };
282
+ var useFormMethodsContext = () => {
283
+ const ctx = React.useContext(FormMethodsContext);
284
+ if (!ctx) {
285
+ throw new Error("useFormMethodsContext must be used within a FormContextProvider");
286
+ }
287
+ return ctx;
288
+ };
289
+ var FormContextProvider = ({
290
+ config,
291
+ useFormMethods,
292
+ children
293
+ }) => {
294
+ const steps = React.useMemo(() => {
295
+ if ("steps" in config && config.steps) {
296
+ return config.steps;
297
+ }
298
+ if ("schema" in config && config.schema) {
299
+ return [{ schema: config.schema }];
300
+ }
301
+ return [];
302
+ }, [config]);
303
+ const [currentStep, setCurrentStep] = React.useState(0);
304
+ const currentStepRef = React.useRef(currentStep);
305
+ currentStepRef.current = currentStep;
306
+ React.useEffect(() => {
307
+ setCurrentStep(0);
308
+ }, [steps]);
309
+ const storeMethods = React.useMemo(
310
+ () => createFormStoreMethods({
311
+ methods: useFormMethods,
312
+ config,
313
+ steps,
314
+ getCurrentStep: () => currentStepRef.current,
315
+ setCurrentStep
316
+ }),
317
+ [useFormMethods, config, steps]
318
+ );
319
+ const stateValue = React.useMemo(
320
+ () => ({
321
+ currentStep,
322
+ steps
323
+ }),
324
+ [currentStep, steps]
325
+ );
326
+ const actionsValue = React.useMemo(
327
+ () => ({
328
+ setCurrentStep,
329
+ ...storeMethods
330
+ }),
331
+ [setCurrentStep, storeMethods]
332
+ );
333
+ const methodsValue = React.useMemo(
334
+ () => ({
335
+ useFormMethods
336
+ }),
337
+ [useFormMethods]
338
+ );
339
+ return /* @__PURE__ */ jsx(FormStateContext.Provider, { value: stateValue, children: /* @__PURE__ */ jsx(FormActionsContext.Provider, { value: actionsValue, children: /* @__PURE__ */ jsx(FormMethodsContext.Provider, { value: methodsValue, children }) }) });
340
+ };
341
+
342
+ // src/components/compound/UseForm/src/FormRenderer/StepperSection.tsx
343
+ import { jsx as jsx2 } from "react/jsx-runtime";
344
+ var getNames2 = (schema) => {
345
+ const names = [];
346
+ schema.forEach((r) => r.fields.forEach((f) => names.push(String(f.name))));
347
+ return names;
348
+ };
349
+ var StepperSection = () => {
350
+ const { steps, currentStep } = useFormStateContext();
351
+ const { handleStepChange } = useFormActionsContext();
352
+ const { useFormMethods: methods } = useFormMethodsContext();
353
+ const { errors } = useFormState({ control: methods.control });
354
+ const stepData = React2.useMemo(() => {
355
+ const errorMap = errors;
356
+ return steps.map((step, idx) => {
357
+ const hasError = getNames2(step.schema).some((name) => Boolean(errorMap[name]));
358
+ return {
359
+ title: step.title ?? `Step ${idx + 1}`,
360
+ icon: step.icon ?? idx + 1,
361
+ error: hasError
362
+ };
363
+ });
364
+ }, [steps, errors]);
365
+ return /* @__PURE__ */ jsx2(
366
+ StandardStepper_default,
367
+ {
368
+ activeStep: currentStep,
369
+ onChange: handleStepChange,
370
+ steps: stepData
371
+ }
372
+ );
373
+ };
374
+ var StepperSection_default = StepperSection;
375
+
376
+ // src/components/compound/UseForm/src/FormRenderer/RowRenderer.tsx
377
+ import React3, { Suspense } from "react";
378
+
379
+ // src/components/compound/UseForm/src/Fields/TextField.tsx
380
+ import { Controller, useFormContext } from "react-hook-form";
381
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
382
+ var TextField = ({ field }) => {
383
+ const { control, getValues } = useFormContext();
384
+ const {
385
+ name,
386
+ label,
387
+ required,
388
+ disabled,
389
+ sx,
390
+ size,
391
+ slotProps,
392
+ errorMsg,
393
+ defaultValue
394
+ } = field;
395
+ const textSlotProps = slotProps;
396
+ return /* @__PURE__ */ jsx3(
397
+ Controller,
398
+ {
399
+ control,
400
+ name,
401
+ defaultValue,
402
+ render: ({ field: { onChange, value, ...restField }, fieldState: { error } }) => /* @__PURE__ */ jsxs(default2, { sx: mergeSx({
403
+ display: "flex",
404
+ alignItems: "flex-start",
405
+ gap: 1
406
+ }, mergeFieldSx(size, sx)), children: [
407
+ /* @__PURE__ */ jsx3(
408
+ default15,
409
+ {
410
+ ...restField,
411
+ value: value ?? "",
412
+ onChange: (e) => {
413
+ onChange(e);
414
+ textSlotProps?.onChange?.(e);
415
+ const newValue = e?.target?.value ?? "";
416
+ field.onChange?.(newValue, getValues());
417
+ },
418
+ label,
419
+ required,
420
+ disabled,
421
+ error: !!error,
422
+ helperText: getHelperText(error, errorMsg, field.helperText),
423
+ fullWidth: true,
424
+ size: "small",
425
+ sx: { flex: 1 },
426
+ multiline: textSlotProps?.multiline,
427
+ rows: textSlotProps?.rows,
428
+ placeholder: textSlotProps?.placeholder,
429
+ type: "text",
430
+ slotProps: {
431
+ htmlInput: {
432
+ maxLength: textSlotProps?.maxLength
433
+ }
434
+ }
435
+ }
436
+ ),
437
+ /* @__PURE__ */ jsx3(Explanation_default, { alignToInput: true, explanation: getFieldExplanation(field) })
438
+ ] })
439
+ }
440
+ );
441
+ };
442
+
443
+ // src/components/compound/UseForm/src/Fields/SelectField.tsx
444
+ import { Controller as Controller2, useFormContext as useFormContext2 } from "react-hook-form";
445
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
446
+ var SelectField = ({ field }) => {
447
+ const selectSlotProps = field.slotProps;
448
+ if (selectSlotProps?.useOptions) {
449
+ return /* @__PURE__ */ jsx4(SelectFieldWithOptions, { field, useOptions: selectSlotProps.useOptions });
450
+ }
451
+ return /* @__PURE__ */ jsx4(SelectFieldView, { field, options: selectSlotProps?.options ?? [] });
452
+ };
453
+ var SelectFieldWithOptions = ({
454
+ field,
455
+ useOptions
456
+ }) => {
457
+ const { options = [] } = useOptions();
458
+ return /* @__PURE__ */ jsx4(SelectFieldView, { field, options });
459
+ };
460
+ var SelectFieldView = ({
461
+ field,
462
+ options
463
+ }) => {
464
+ const { control, getValues } = useFormContext2();
465
+ const {
466
+ name,
467
+ label,
468
+ required,
469
+ disabled,
470
+ sx,
471
+ size,
472
+ slotProps,
473
+ errorMsg,
474
+ defaultValue
475
+ } = field;
476
+ return /* @__PURE__ */ jsx4(
477
+ Controller2,
478
+ {
479
+ control,
480
+ name,
481
+ defaultValue,
482
+ render: ({ field: { onChange, value, ...restField }, fieldState: { error } }) => /* @__PURE__ */ jsxs2(default2, { sx: mergeSx({
483
+ display: "flex",
484
+ alignItems: "flex-start",
485
+ gap: 1
486
+ }, mergeFieldSx(size, sx)), children: [
487
+ /* @__PURE__ */ jsx4(
488
+ MuiSelect_default,
489
+ {
490
+ ...restField,
491
+ value: value ?? (slotProps?.multiple ? [] : ""),
492
+ onChange: (e, child) => {
493
+ const newValue = e?.target?.value;
494
+ onChange(newValue);
495
+ slotProps?.onChange?.(e, child);
496
+ field.onChange?.(newValue, getValues());
497
+ },
498
+ label,
499
+ required,
500
+ disabled,
501
+ error: !!error,
502
+ helperText: getHelperText(error, errorMsg, field.helperText),
503
+ options,
504
+ multiple: slotProps?.multiple,
505
+ sx: { flex: 1 },
506
+ slotProps: {
507
+ formControl: {
508
+ size: "small",
509
+ disabled,
510
+ sx: {
511
+ width: "100%"
512
+ }
513
+ }
514
+ }
515
+ }
516
+ ),
517
+ /* @__PURE__ */ jsx4(Explanation_default, { alignToInput: true, explanation: getFieldExplanation(field) })
518
+ ] })
519
+ }
520
+ );
521
+ };
522
+
523
+ // src/components/compound/UseForm/src/Fields/SliderField.tsx
524
+ import { Controller as Controller3, useFormContext as useFormContext3 } from "react-hook-form";
525
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
526
+ var SliderField = ({ field }) => {
527
+ const { control, getValues } = useFormContext3();
528
+ const {
529
+ name,
530
+ label,
531
+ required,
532
+ disabled,
533
+ sx,
534
+ size,
535
+ slotProps,
536
+ errorMsg,
537
+ defaultValue
538
+ } = field;
539
+ const sliderSlotProps = slotProps;
540
+ return /* @__PURE__ */ jsx5(
541
+ Controller3,
542
+ {
543
+ control,
544
+ name,
545
+ defaultValue,
546
+ render: ({ field: { onChange, value, ...restField }, fieldState: { error } }) => /* @__PURE__ */ jsxs3(
547
+ default12,
548
+ {
549
+ disabled,
550
+ required,
551
+ error: !!error,
552
+ fullWidth: true,
553
+ size: "small",
554
+ sx: mergeFieldSx(size, sx),
555
+ children: [
556
+ /* @__PURE__ */ jsxs3(default2, { sx: { display: "flex", alignItems: "center", justifyContent: "flex-start" }, children: [
557
+ /* @__PURE__ */ jsx5(MuiFormLabel, { component: "legend", children: label }),
558
+ /* @__PURE__ */ jsx5(Explanation_default, { explanation: getFieldExplanation(field) })
559
+ ] }),
560
+ /* @__PURE__ */ jsx5(default2, { sx: { px: 4 }, children: /* @__PURE__ */ jsx5(
561
+ default14,
562
+ {
563
+ ...restField,
564
+ value: typeof value === "number" || Array.isArray(value) ? value : sliderSlotProps?.min ?? 0,
565
+ onChange: (event, newValue, activeThumb) => {
566
+ const normalized = Array.isArray(newValue) ? newValue[0] : newValue;
567
+ onChange(normalized);
568
+ sliderSlotProps?.onChange?.(event, newValue, activeThumb);
569
+ field.onChange?.(normalized, getValues());
570
+ },
571
+ min: sliderSlotProps?.min,
572
+ max: sliderSlotProps?.max,
573
+ step: sliderSlotProps?.step,
574
+ marks: sliderSlotProps?.marks,
575
+ valueLabelDisplay: sliderSlotProps?.valueLabelDisplay || "auto",
576
+ orientation: sliderSlotProps?.orientation,
577
+ disableSwap: sliderSlotProps?.disableSwap,
578
+ track: sliderSlotProps?.track
579
+ }
580
+ ) }),
581
+ /* @__PURE__ */ jsx5(FieldHelperText, { error, errorMsg, helpers: [field.helperText] })
582
+ ]
583
+ }
584
+ )
585
+ }
586
+ );
587
+ };
588
+
589
+ // src/components/compound/UseForm/src/Fields/CheckField.tsx
590
+ import { Controller as Controller4, useFormContext as useFormContext4 } from "react-hook-form";
591
+ import { jsx as jsx6 } from "react/jsx-runtime";
592
+ var CheckField = ({ field }) => {
593
+ const checkSlot = field.slotProps;
594
+ if (checkSlot?.useOptions) {
595
+ return /* @__PURE__ */ jsx6(CheckFieldWithOptions, { field, useOptions: checkSlot.useOptions });
596
+ }
597
+ return /* @__PURE__ */ jsx6(CheckFieldView, { field, options: checkSlot?.options ?? [] });
598
+ };
599
+ var CheckFieldWithOptions = ({
600
+ field,
601
+ useOptions
602
+ }) => {
603
+ const { options = [] } = useOptions();
604
+ return /* @__PURE__ */ jsx6(CheckFieldView, { field, options });
605
+ };
606
+ var CheckFieldView = ({
607
+ field,
608
+ options
609
+ }) => {
610
+ const { control, getValues } = useFormContext4();
611
+ const {
612
+ name,
613
+ required,
614
+ slotProps,
615
+ label,
616
+ defaultValue
617
+ } = field;
618
+ const checkSlot = slotProps;
619
+ const helperText = checkSlot?.helperText;
620
+ const explanation = getFieldExplanation(field);
621
+ return /* @__PURE__ */ jsx6(default2, { children: /* @__PURE__ */ jsx6(
622
+ Controller4,
623
+ {
624
+ control,
625
+ name,
626
+ defaultValue,
627
+ render: ({ field: controllerField, fieldState: { error } }) => {
628
+ const { onChange, value } = controllerField;
629
+ const checkedIds = Array.isArray(value) ? value.filter((id) => options.some((o) => o.id === id)) : [];
630
+ return /* @__PURE__ */ jsx6(
631
+ CheckboxGroup,
632
+ {
633
+ ...checkSlot,
634
+ slotProps: {
635
+ ...checkSlot?.slotProps ?? {},
636
+ group: {
637
+ sx: { fontSize: "14px" }
638
+ }
639
+ },
640
+ options,
641
+ title: label,
642
+ titleSuffix: explanation ? /* @__PURE__ */ jsx6(default2, { sx: { display: "inline-flex" }, children: /* @__PURE__ */ jsx6(Explanation_default, { explanation }) }) : void 0,
643
+ checkedIds,
644
+ setCheckedIds: (next) => {
645
+ const currentIds = checkedIds;
646
+ const newIds = typeof next === "function" ? next(currentIds) : next;
647
+ const idsArray = newIds ?? [];
648
+ onChange(idsArray);
649
+ field.onChange?.(idsArray, getValues());
650
+ },
651
+ error: !!error,
652
+ helperText,
653
+ errorText: error ? typeof error.message === "string" ? error.message : void 0 : void 0,
654
+ required
655
+ }
656
+ );
657
+ }
658
+ }
659
+ ) });
660
+ };
661
+
662
+ // src/components/compound/UseForm/src/Fields/ToggleButtonField.tsx
663
+ import { Controller as Controller5, useFormContext as useFormContext5 } from "react-hook-form";
664
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
665
+ var ToggleButtonField = ({ field }) => {
666
+ const { control, getValues } = useFormContext5();
667
+ const {
668
+ name,
669
+ label,
670
+ required,
671
+ disabled,
672
+ sx,
673
+ size,
674
+ slotProps,
675
+ errorMsg,
676
+ defaultValue
677
+ } = field;
678
+ const toggleSlot = slotProps;
679
+ return /* @__PURE__ */ jsx7(
680
+ Controller5,
681
+ {
682
+ control,
683
+ name,
684
+ defaultValue,
685
+ render: ({ field: { onChange, value }, fieldState: { error } }) => {
686
+ const helperTextNode = /* @__PURE__ */ jsx7(FieldHelperText, { error, errorMsg, helpers: [field.helperText] });
687
+ return /* @__PURE__ */ jsxs4(
688
+ default12,
689
+ {
690
+ disabled,
691
+ required,
692
+ error: !!error,
693
+ fullWidth: true,
694
+ size: "small",
695
+ sx: mergeFieldSx(size, sx),
696
+ children: [
697
+ /* @__PURE__ */ jsxs4(default2, { sx: { display: "flex", alignItems: "center", justifyContent: "flex-start", mb: 0.5 }, children: [
698
+ /* @__PURE__ */ jsx7(MuiFormLabel, { component: "legend", sx: { mr: 1 }, children: label }),
699
+ /* @__PURE__ */ jsx7(default2, { sx: { display: "inline-flex" }, children: /* @__PURE__ */ jsx7(Explanation_default, { explanation: getFieldExplanation(field) }) })
700
+ ] }),
701
+ /* @__PURE__ */ jsx7(default2, { sx: { px: 4, py: 1 }, children: /* @__PURE__ */ jsx7(
702
+ ToggleButtonGroup,
703
+ {
704
+ value: typeof value === "string" ? value : toggleSlot?.options?.[0]?.value ?? "",
705
+ onChange: (e, newValue) => {
706
+ onChange(newValue ?? null);
707
+ field.onChange?.(newValue ?? null, getValues());
708
+ },
709
+ options: toggleSlot?.options ?? [],
710
+ color: toggleSlot?.color
711
+ }
712
+ ) }),
713
+ helperTextNode
714
+ ]
715
+ }
716
+ );
717
+ }
718
+ }
719
+ );
720
+ };
721
+
722
+ // src/components/compound/UseForm/src/Fields/SwitchField.tsx
723
+ import { Controller as Controller6, useFormContext as useFormContext6 } from "react-hook-form";
724
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
725
+ var SwitchField = ({ field }) => {
726
+ const { control, getValues } = useFormContext6();
727
+ const {
728
+ name,
729
+ label,
730
+ required,
731
+ disabled,
732
+ sx,
733
+ size,
734
+ slotProps,
735
+ errorMsg,
736
+ defaultValue
737
+ } = field;
738
+ const switchSlot = slotProps;
739
+ return /* @__PURE__ */ jsx8(
740
+ Controller6,
741
+ {
742
+ control,
743
+ name,
744
+ defaultValue: defaultValue ?? false,
745
+ render: ({ field: { onChange, value }, fieldState: { error } }) => /* @__PURE__ */ jsxs5(
746
+ default12,
747
+ {
748
+ disabled,
749
+ required,
750
+ error: !!error,
751
+ fullWidth: true,
752
+ size: "small",
753
+ sx: mergeFieldSx(size, sx),
754
+ children: [
755
+ /* @__PURE__ */ jsxs5(default3, { direction: "row", alignItems: "center", gap: 1, children: [
756
+ /* @__PURE__ */ jsx8(MuiFormLabel, { component: "legend", sx: { fontSize: "12px", userSelect: "none", color: "var(--useform-label-color)" }, children: label }),
757
+ /* @__PURE__ */ jsx8(
758
+ MuiSwitch,
759
+ {
760
+ ...switchSlot,
761
+ helperText: void 0,
762
+ label: void 0,
763
+ checked: !!value,
764
+ onChange: (e, checked) => {
765
+ onChange(checked);
766
+ field.onChange?.(checked, getValues());
767
+ switchSlot?.onChange?.(e, checked);
768
+ }
769
+ }
770
+ ),
771
+ /* @__PURE__ */ jsx8(default2, { sx: { "& > span > button.MuiButtonBase-root.MuiIconButton-root": { m: 0, p: 0 } }, children: /* @__PURE__ */ jsx8(Explanation_default, { explanation: getFieldExplanation(field) }) })
772
+ ] }),
773
+ /* @__PURE__ */ jsx8(FieldHelperText, { error, errorMsg, helpers: [field.helperText] })
774
+ ]
775
+ }
776
+ )
777
+ }
778
+ );
779
+ };
780
+
781
+ // src/components/compound/UseForm/src/Fields/CustomField.tsx
782
+ import { Controller as Controller7, useFormContext as useFormContext7 } from "react-hook-form";
783
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
784
+ var CustomField = ({ field }) => {
785
+ const { control, getValues } = useFormContext7();
786
+ const {
787
+ name,
788
+ label,
789
+ required,
790
+ disabled,
791
+ sx,
792
+ size,
793
+ slotProps,
794
+ errorMsg,
795
+ defaultValue
796
+ } = field;
797
+ const customSlot = slotProps;
798
+ return /* @__PURE__ */ jsx9(
799
+ Controller7,
800
+ {
801
+ control,
802
+ name,
803
+ defaultValue,
804
+ render: ({ field: { onChange, value }, fieldState: { error } }) => {
805
+ const handleChange = (v) => {
806
+ onChange(v);
807
+ field.onChange?.(v, getValues());
808
+ };
809
+ return /* @__PURE__ */ jsxs6(
810
+ default12,
811
+ {
812
+ disabled,
813
+ required,
814
+ error: !!error,
815
+ fullWidth: true,
816
+ size: "small",
817
+ sx: mergeFieldSx(size, sx),
818
+ children: [
819
+ /* @__PURE__ */ jsxs6(default2, { sx: { display: "flex", alignItems: "center", justifyContent: "flex-start" }, children: [
820
+ /* @__PURE__ */ jsx9(MuiFormLabel, { component: "legend", children: label }),
821
+ /* @__PURE__ */ jsx9(Explanation_default, { explanation: getFieldExplanation(field) })
822
+ ] }),
823
+ /* @__PURE__ */ jsx9(default2, { sx: { py: 1 }, children: typeof customSlot?.render === "function" ? customSlot.render({ value, onChange: handleChange, error: !!error, helperText: customSlot?.helperText, getValues: () => getValues() }) : (
824
+ // fallback simple input
825
+ /* @__PURE__ */ jsx9(
826
+ "input",
827
+ {
828
+ value: value ?? "",
829
+ onChange: (e) => handleChange(e.target.value),
830
+ style: { width: "100%", padding: 8, boxSizing: "border-box" }
831
+ }
832
+ )
833
+ ) }),
834
+ /* @__PURE__ */ jsx9(FieldHelperText, { error, errorMsg, helpers: [String(customSlot?.helperText ?? "")] })
835
+ ]
836
+ }
837
+ );
838
+ }
839
+ }
840
+ );
841
+ };
842
+
843
+ // src/components/compound/UseForm/src/Fields/TextArrayField.tsx
844
+ import { Controller as Controller8, useFormContext as useFormContext8 } from "react-hook-form";
845
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
846
+ var TextArrayField = ({ field }) => {
847
+ const { control, getValues } = useFormContext8();
848
+ const {
849
+ name,
850
+ label,
851
+ required,
852
+ disabled,
853
+ slotProps,
854
+ errorMsg,
855
+ defaultValue
856
+ } = field;
857
+ const taSlot = slotProps;
858
+ const minItems = taSlot?.minItems ?? 0;
859
+ const maxItems = taSlot?.maxItems ?? Infinity;
860
+ return /* @__PURE__ */ jsx10(
861
+ Controller8,
862
+ {
863
+ control,
864
+ name,
865
+ defaultValue: defaultValue ?? [],
866
+ render: ({ field: controllerField, fieldState: { error } }) => {
867
+ const { onChange, value } = controllerField;
868
+ const items = Array.isArray(value) ? value : [];
869
+ const setItems = (next) => {
870
+ onChange(next);
871
+ if (field?.onChange) {
872
+ field.onChange(next, getValues());
873
+ }
874
+ };
875
+ const addItem = () => {
876
+ if (items.length >= maxItems) return;
877
+ setItems([...items, ""]);
878
+ };
879
+ const removeItem = (index) => {
880
+ if (items.length <= minItems) return;
881
+ const next = items.slice(0, index).concat(items.slice(index + 1));
882
+ setItems(next);
883
+ };
884
+ const updateItem = (index, v) => {
885
+ const next = items.slice();
886
+ next[index] = v;
887
+ setItems(next);
888
+ };
889
+ return /* @__PURE__ */ jsxs7(
890
+ default12,
891
+ {
892
+ disabled,
893
+ required,
894
+ error: !!error,
895
+ fullWidth: true,
896
+ size: "small",
897
+ sx: mergeFieldSx(field.size, field.sx),
898
+ children: [
899
+ /* @__PURE__ */ jsxs7(default2, { sx: { display: "flex", alignItems: "center", justifyContent: "flex-start" }, children: [
900
+ /* @__PURE__ */ jsx10(MuiFormLabel, { component: "legend", children: label }),
901
+ /* @__PURE__ */ jsx10(Explanation_default, { explanation: getFieldExplanation(field) })
902
+ ] }),
903
+ /* @__PURE__ */ jsxs7(default2, { sx: { py: 1, display: "flex", flexDirection: "column", gap: 1 }, children: [
904
+ items.map((it, idx) => /* @__PURE__ */ jsxs7(default2, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
905
+ /* @__PURE__ */ jsx10(
906
+ default15,
907
+ {
908
+ size: "small",
909
+ value: it,
910
+ onChange: (e) => updateItem(idx, e.target.value),
911
+ placeholder: taSlot?.itemProps?.placeholder,
912
+ sx: { flex: 1 },
913
+ slotProps: {
914
+ htmlInput: {
915
+ maxLength: taSlot?.itemProps?.maxLength
916
+ }
917
+ }
918
+ }
919
+ ),
920
+ /* @__PURE__ */ jsx10(IconButton_default, { size: "small", onClick: () => removeItem(idx), disabled: items.length <= minItems, children: /* @__PURE__ */ jsx10(default7, { fontSize: "small" }) })
921
+ ] }, idx)),
922
+ /* @__PURE__ */ jsx10(default2, { children: /* @__PURE__ */ jsx10(Button, { size: "small", startIcon: /* @__PURE__ */ jsx10(default5, {}), onClick: addItem, disabled: items.length >= maxItems, children: taSlot?.addButtonLabel ?? "Add" }) })
923
+ ] }),
924
+ /* @__PURE__ */ jsx10(FieldHelperText, { error, errorMsg, helpers: [field.helperText] })
925
+ ]
926
+ }
927
+ );
928
+ }
929
+ }
930
+ );
931
+ };
932
+
933
+ // src/components/compound/UseForm/src/Fields/NumberField.tsx
934
+ import { Controller as Controller9, useFormContext as useFormContext9 } from "react-hook-form";
935
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
936
+ var NumberField = ({ field }) => {
937
+ const { control, getValues } = useFormContext9();
938
+ const { name, label, required, disabled, sx, size, slotProps, errorMsg, defaultValue } = field;
939
+ const numSlot = slotProps;
940
+ return /* @__PURE__ */ jsx11(
941
+ Controller9,
942
+ {
943
+ control,
944
+ name,
945
+ defaultValue: defaultValue ?? numSlot?.min ?? 0,
946
+ render: ({ field: controllerField, fieldState: { error } }) => {
947
+ const { onChange, value } = controllerField;
948
+ const update = (next) => {
949
+ onChange(next);
950
+ field.onChange?.(next, getValues());
951
+ };
952
+ const handleMinus = () => {
953
+ const s = numSlot?.step ?? 1;
954
+ const cur = value ?? (numSlot?.min ?? 0);
955
+ let next = cur - s;
956
+ if (typeof numSlot?.min === "number") next = Math.max(next, numSlot.min);
957
+ update(next);
958
+ };
959
+ const handlePlus = () => {
960
+ const s = numSlot?.step ?? 1;
961
+ const cur = value ?? (numSlot?.min ?? 0);
962
+ let next = cur + s;
963
+ if (typeof numSlot?.max === "number") next = Math.min(next, numSlot.max);
964
+ update(next);
965
+ };
966
+ return /* @__PURE__ */ jsx11(
967
+ default12,
968
+ {
969
+ disabled,
970
+ required,
971
+ error: !!error,
972
+ fullWidth: true,
973
+ size: "small",
974
+ sx: mergeSx(mergeFieldSx(size, sx), { maxWidth: "200px" }),
975
+ children: /* @__PURE__ */ jsxs8(default2, { sx: { display: "flex", alignItems: "flex-start", gap: 1 }, children: [
976
+ /* @__PURE__ */ jsx11(
977
+ default15,
978
+ {
979
+ fullWidth: true,
980
+ size: "small",
981
+ type: "number",
982
+ label,
983
+ required,
984
+ error: !!error,
985
+ helperText: getHelperText(error, errorMsg, field.helperText),
986
+ value: value ?? "",
987
+ sx: {
988
+ flex: 1,
989
+ minWidth: 0,
990
+ "& input[type=number]::-webkit-outer-spin-button": {
991
+ WebkitAppearance: "none",
992
+ margin: 0
993
+ },
994
+ "& input[type=number]::-webkit-inner-spin-button": {
995
+ WebkitAppearance: "none",
996
+ margin: 0
997
+ },
998
+ "& input[type=number]": {
999
+ MozAppearance: "textfield",
1000
+ WebkitAppearance: "textfield",
1001
+ appearance: "textfield"
1002
+ }
1003
+ },
1004
+ onChange: (e) => {
1005
+ const s = e.target.value;
1006
+ const parsed = s === "" ? null : Number(s);
1007
+ onChange(parsed);
1008
+ field.onChange?.(parsed, getValues());
1009
+ },
1010
+ slotProps: {
1011
+ ...numSlot?.slotProps,
1012
+ htmlInput: {
1013
+ ...numSlot?.slotProps?.htmlInput ?? {},
1014
+ min: numSlot?.min,
1015
+ max: numSlot?.max,
1016
+ step: numSlot?.step,
1017
+ style: { textAlign: "center" }
1018
+ },
1019
+ input: {
1020
+ ...numSlot?.slotProps?.input ?? {},
1021
+ startAdornment: /* @__PURE__ */ jsx11(default13, { position: "start", children: /* @__PURE__ */ jsx11(IconButton_default, { size: "small", onClick: handleMinus, disabled: typeof value === "number" && typeof numSlot?.min === "number" ? value <= numSlot.min : false, children: /* @__PURE__ */ jsx11(default4, { fontSize: "small" }) }) }),
1022
+ endAdornment: /* @__PURE__ */ jsx11(default13, { position: "end", children: /* @__PURE__ */ jsx11(IconButton_default, { size: "small", onClick: handlePlus, disabled: typeof value === "number" && typeof numSlot?.max === "number" ? value >= numSlot.max : false, children: /* @__PURE__ */ jsx11(default5, { fontSize: "small" }) }) })
1023
+ }
1024
+ },
1025
+ disabled
1026
+ }
1027
+ ),
1028
+ /* @__PURE__ */ jsx11(Explanation_default, { alignToInput: true, explanation: getFieldExplanation(field) })
1029
+ ] })
1030
+ }
1031
+ );
1032
+ }
1033
+ }
1034
+ );
1035
+ };
1036
+
1037
+ // src/components/compound/UseForm/src/FormRenderer/RowRenderer.tsx
1038
+ import { jsx as jsx12 } from "react/jsx-runtime";
1039
+ var DateField = React3.lazy(
1040
+ () => import("./DateField-ZYMZFHL4.mjs").then((m) => ({
1041
+ default: m.DateField
1042
+ }))
1043
+ );
1044
+ var DateTimeField = React3.lazy(
1045
+ () => import("./DateTimeField-TPTJ7YIZ.mjs").then((m) => ({
1046
+ default: m.DateTimeField
1047
+ }))
1048
+ );
1049
+ var TelField = React3.lazy(
1050
+ () => import("./TelField-LOGRVZ4I.mjs").then((m) => ({
1051
+ default: m.TelField
1052
+ }))
1053
+ );
1054
+ var FileUploadField = React3.lazy(
1055
+ () => import("./FileUploadField-NTMWBJER.mjs").then((m) => ({
1056
+ default: m.FileUploadField
1057
+ }))
1058
+ );
1059
+ var AvatarField = React3.lazy(
1060
+ () => import("./AvatarField-SAODT3CZ.mjs").then((m) => ({
1061
+ default: m.AvatarField
1062
+ }))
1063
+ );
1064
+ var JSONEditorField = React3.lazy(
1065
+ () => import("./JSONEditorField-TMRWGXVR.mjs").then((m) => ({
1066
+ default: m.JSONEditorField
1067
+ }))
1068
+ );
1069
+ var AutocompleteField = React3.lazy(
1070
+ () => import("./AutocompleteField-ZKNU2IRR.mjs").then((m) => ({
1071
+ default: m.AutocompleteField
1072
+ }))
1073
+ );
1074
+ var lazyFieldFallback = /* @__PURE__ */ jsx12(default2, { sx: { minHeight: 40 } });
1075
+ var LazyField = ({ children }) => /* @__PURE__ */ jsx12(Suspense, { fallback: lazyFieldFallback, children });
1076
+ var FieldRenderer = ({ field }) => {
1077
+ switch (field.type) {
1078
+ case FIELD_TYPEs.text:
1079
+ return /* @__PURE__ */ jsx12(TextField, { field });
1080
+ case FIELD_TYPEs.select:
1081
+ return /* @__PURE__ */ jsx12(SelectField, { field });
1082
+ case FIELD_TYPEs.slider:
1083
+ return /* @__PURE__ */ jsx12(SliderField, { field });
1084
+ case FIELD_TYPEs.check:
1085
+ return /* @__PURE__ */ jsx12(CheckField, { field });
1086
+ case FIELD_TYPEs.date:
1087
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(DateField, { field }) });
1088
+ case FIELD_TYPEs.dateTime:
1089
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(DateTimeField, { field }) });
1090
+ case FIELD_TYPEs.toggleButton:
1091
+ return /* @__PURE__ */ jsx12(ToggleButtonField, { field });
1092
+ case FIELD_TYPEs.autocomplete:
1093
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(AutocompleteField, { field }) });
1094
+ case FIELD_TYPEs.switch:
1095
+ return /* @__PURE__ */ jsx12(SwitchField, { field });
1096
+ case FIELD_TYPEs.number:
1097
+ return /* @__PURE__ */ jsx12(NumberField, { field });
1098
+ case FIELD_TYPEs.json:
1099
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(JSONEditorField, { field }) });
1100
+ case FIELD_TYPEs.tel:
1101
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(TelField, { field }) });
1102
+ case FIELD_TYPEs.fileUpload:
1103
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(FileUploadField, { field }) });
1104
+ case FIELD_TYPEs.avatar:
1105
+ return /* @__PURE__ */ jsx12(LazyField, { children: /* @__PURE__ */ jsx12(AvatarField, { field }) });
1106
+ case FIELD_TYPEs.textArray:
1107
+ return /* @__PURE__ */ jsx12(TextArrayField, { field });
1108
+ case FIELD_TYPEs.custom:
1109
+ return /* @__PURE__ */ jsx12(CustomField, { field });
1110
+ default:
1111
+ return /* @__PURE__ */ jsx12("div", { children: "Unknown Field Type" });
1112
+ }
1113
+ };
1114
+ var RowFieldFrame = ({
1115
+ field,
1116
+ hidden
1117
+ }) => {
1118
+ return /* @__PURE__ */ jsx12(
1119
+ default2,
1120
+ {
1121
+ sx: {
1122
+ flex: field.size?.width || 1,
1123
+ minWidth: field.size?.width || "auto",
1124
+ ...hidden && { display: "none" },
1125
+ "& > *": {
1126
+ minWidth: 200
1127
+ }
1128
+ },
1129
+ children: /* @__PURE__ */ jsx12(FieldRenderer, { field })
1130
+ }
1131
+ );
1132
+ };
1133
+ var RowFieldWithHide = ({
1134
+ field,
1135
+ useHide
1136
+ }) => {
1137
+ const hidden = useHide();
1138
+ return /* @__PURE__ */ jsx12(RowFieldFrame, { field, hidden });
1139
+ };
1140
+ var RowField = ({ field }) => {
1141
+ if (field.useHide) {
1142
+ return /* @__PURE__ */ jsx12(RowFieldWithHide, { field, useHide: field.useHide });
1143
+ }
1144
+ return /* @__PURE__ */ jsx12(RowFieldFrame, { field, hidden: false });
1145
+ };
1146
+ var RowRenderer = ({ row }) => {
1147
+ return /* @__PURE__ */ jsx12(
1148
+ default2,
1149
+ {
1150
+ sx: {
1151
+ display: "flex",
1152
+ flexDirection: "row",
1153
+ gap: 2,
1154
+ justifyContent: "space-between",
1155
+ flexWrap: "wrap",
1156
+ marginBottom: 1,
1157
+ pt: 1,
1158
+ ...row.sx
1159
+ },
1160
+ children: row.fields.map((field) => /* @__PURE__ */ jsx12(RowField, { field }, String(field.name)))
1161
+ }
1162
+ );
1163
+ };
1164
+ var RowRenderer_default = RowRenderer;
1165
+
1166
+ // src/components/compound/UseForm/src/FormRenderer/Navigation.tsx
1167
+ import { useFormContext as useFormContext10, useFormState as useFormState2 } from "react-hook-form";
1168
+ import { Fragment, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1169
+ var Navigation = ({
1170
+ isMulti,
1171
+ currentStep,
1172
+ isLastStep,
1173
+ handleBack,
1174
+ handleNext,
1175
+ onSubmit,
1176
+ undo,
1177
+ clear,
1178
+ extraButtons
1179
+ }) => {
1180
+ const { control } = useFormContext10();
1181
+ const { isSubmitting } = useFormState2({ control });
1182
+ return /* @__PURE__ */ jsxs9(
1183
+ default2,
1184
+ {
1185
+ sx: {
1186
+ padding: "4px 0",
1187
+ display: "flex",
1188
+ justifyContent: "flex-end",
1189
+ gap: 1
1190
+ },
1191
+ children: [
1192
+ extraButtons,
1193
+ undo && /* @__PURE__ */ jsx13(IconButton_default, { onClick: undo, size: "small", disabled: isSubmitting, "aria-label": "Undo", children: /* @__PURE__ */ jsx13(default9, { fontSize: "small" }) }),
1194
+ clear && /* @__PURE__ */ jsx13(IconButton_default, { onClick: clear, size: "small", disabled: isSubmitting, "aria-label": "Clear", children: /* @__PURE__ */ jsx13(default7, { fontSize: "small" }) }),
1195
+ isMulti ? /* @__PURE__ */ jsxs9(Fragment, { children: [
1196
+ /* @__PURE__ */ jsx13(IconButton_default, { onClick: handleBack, disabled: currentStep === 0 || isSubmitting, size: "small", "aria-label": "Back", children: /* @__PURE__ */ jsx13(default10, { fontSize: "small" }) }),
1197
+ /* @__PURE__ */ jsx13(IconButton_default, { onClick: handleNext, size: "small", color: isLastStep ? "success" : void 0, disabled: isSubmitting, "aria-label": isLastStep ? "Submit" : "Next", children: isLastStep ? isSubmitting ? /* @__PURE__ */ jsx13(CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsx13(default8, { fontSize: "small" }) : /* @__PURE__ */ jsx13(default11, { fontSize: "small" }) })
1198
+ ] }) : /* @__PURE__ */ jsx13(IconButton_default, { onClick: onSubmit, size: "small", color: "success", disabled: isSubmitting, "aria-label": "Submit", children: isSubmitting ? /* @__PURE__ */ jsx13(CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsx13(default8, { fontSize: "small" }) })
1199
+ ]
1200
+ }
1201
+ );
1202
+ };
1203
+ var Navigation_default = Navigation;
1204
+
1205
+ // src/components/compound/UseForm/src/hooks/useRegisterFields.ts
1206
+ import { useEffect as useEffect2, useMemo as useMemo3 } from "react";
1207
+ function useRegisterFields(methods, config) {
1208
+ const signature = useMemo3(() => getFormFieldsSignature(config), [config]);
1209
+ useEffect2(() => {
1210
+ const rows = collectRows(config);
1211
+ rows.forEach((row) => {
1212
+ row.fields.forEach((field) => {
1213
+ const name = field.name;
1214
+ methods.register(name, {
1215
+ shouldUnregister: false
1216
+ });
1217
+ if (field.defaultValue !== void 0) {
1218
+ const alreadyProvided = config.defaultValues && Object.prototype.hasOwnProperty.call(config.defaultValues, name);
1219
+ if (!alreadyProvided) {
1220
+ methods.setValue(name, field.defaultValue, { shouldDirty: false });
1221
+ }
1222
+ } else {
1223
+ const current = methods.getValues(name);
1224
+ if (current === void 0) {
1225
+ methods.setValue(name, null, { shouldDirty: false });
1226
+ }
1227
+ }
1228
+ });
1229
+ });
1230
+ }, [methods, signature]);
1231
+ }
1232
+ var useRegisterFields_default = useRegisterFields;
1233
+
1234
+ // src/components/compound/UseForm/src/theme.ts
1235
+ var useFormRootSx = {
1236
+ "--useform-error": "var(--mui-palette-error-main)",
1237
+ "--useform-error-hover": "var(--mui-palette-error-dark)",
1238
+ "--useform-label-color": "var(--mui-palette-text-grey-1)",
1239
+ "--useform-warning": "var(--mui-palette-warning-main)"
1240
+ };
1241
+
1242
+ // src/components/compound/UseForm/src/FormRenderer/Layout.tsx
1243
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1244
+ var FormRenderer = (props) => {
1245
+ const {
1246
+ methods: propMethods,
1247
+ config,
1248
+ onSubmit,
1249
+ showUndo = true,
1250
+ showClear = true,
1251
+ children,
1252
+ extraButtons
1253
+ } = props;
1254
+ const { steps, currentStep } = useFormStateContext();
1255
+ const { setCurrentStep, handleStepChange, submit, undo, clear } = useFormActionsContext();
1256
+ const { useFormMethods: ctxMethods } = useFormMethodsContext();
1257
+ const methods = propMethods ?? ctxMethods;
1258
+ useRegisterFields_default(methods, config);
1259
+ const isMulti = steps.length > 1;
1260
+ const isLastStep = currentStep === steps.length - 1;
1261
+ const sortedSchema = React4.useMemo(() => {
1262
+ const currentSchema = steps[currentStep]?.schema || [];
1263
+ const compare = (a, b) => {
1264
+ const an = Number(a.row);
1265
+ const bn = Number(b.row);
1266
+ const aIsNum = !Number.isNaN(an);
1267
+ const bIsNum = !Number.isNaN(bn);
1268
+ if (aIsNum && bIsNum) return an - bn;
1269
+ if (aIsNum) return -1;
1270
+ if (bIsNum) return 1;
1271
+ return String(a.row).localeCompare(String(b.row));
1272
+ };
1273
+ return [...currentSchema].slice().sort(compare);
1274
+ }, [steps, currentStep]);
1275
+ const handleNext = async () => {
1276
+ if (isLastStep) {
1277
+ await submit(onSubmit);
1278
+ return;
1279
+ }
1280
+ await handleStepChange(currentStep + 1);
1281
+ };
1282
+ const handleBack = () => {
1283
+ if (currentStep > 0) setCurrentStep((s) => s - 1);
1284
+ };
1285
+ const handleFormSubmit = methods.handleSubmit(async () => {
1286
+ await submit(onSubmit);
1287
+ });
1288
+ return /* @__PURE__ */ jsx14(FormProvider, { ...methods, children: /* @__PURE__ */ jsxs10(default2, { sx: mergeSx(useFormRootSx, {
1289
+ display: "flex",
1290
+ flexDirection: "column",
1291
+ gap: "4px",
1292
+ overflow: "hidden",
1293
+ px: 1.5,
1294
+ py: 1
1295
+ }), children: [
1296
+ isMulti && /* @__PURE__ */ jsx14(StepperSection_default, {}),
1297
+ /* @__PURE__ */ jsx14(default2, { sx: {
1298
+ display: "flex",
1299
+ flexDirection: "column",
1300
+ gap: "8px",
1301
+ flex: 1,
1302
+ overflow: "auto"
1303
+ }, children: /* @__PURE__ */ jsx14(default2, { sx: { flex: 1 }, children: /* @__PURE__ */ jsxs10("form", { onSubmit: handleFormSubmit, children: [
1304
+ sortedSchema.map((row, idx) => /* @__PURE__ */ jsx14(RowRenderer_default, { row }, `${row.row}-${idx}`)),
1305
+ children
1306
+ ] }) }) }),
1307
+ /* @__PURE__ */ jsx14(
1308
+ Navigation_default,
1309
+ {
1310
+ isMulti,
1311
+ currentStep,
1312
+ isLastStep,
1313
+ handleBack,
1314
+ handleNext,
1315
+ onSubmit: handleFormSubmit,
1316
+ undo: showUndo ? undo : void 0,
1317
+ clear: showClear ? clear : void 0,
1318
+ extraButtons
1319
+ }
1320
+ )
1321
+ ] }) });
1322
+ };
1323
+
1324
+ // src/components/compound/UseForm/src/FormModalRenderer.tsx
1325
+ import React6 from "react";
1326
+
1327
+ // src/components/compound/UseForm/src/FormTree.tsx
1328
+ import React5 from "react";
1329
+ import { jsx as jsx15 } from "react/jsx-runtime";
1330
+ function FormTreeInner({
1331
+ methods,
1332
+ config,
1333
+ livePropsRef,
1334
+ showUndo = true,
1335
+ showClear = true
1336
+ }) {
1337
+ const extraButtons = livePropsRef.current.extraButtons;
1338
+ const extraButtonsElement = typeof extraButtons === "function" ? extraButtons(methods) : extraButtons;
1339
+ const onSubmit = React5.useCallback((data) => {
1340
+ livePropsRef.current.onSubmit(data);
1341
+ }, [livePropsRef]);
1342
+ return /* @__PURE__ */ jsx15(FormContextProvider, { config, useFormMethods: methods, children: /* @__PURE__ */ jsx15(
1343
+ FormRenderer,
1344
+ {
1345
+ methods,
1346
+ config,
1347
+ onSubmit,
1348
+ extraButtons: extraButtonsElement,
1349
+ showUndo,
1350
+ showClear,
1351
+ children: livePropsRef.current.children
1352
+ }
1353
+ ) });
1354
+ }
1355
+ function formTreePropsAreEqual(prev, next) {
1356
+ return prev.methods === next.methods && prev.config === next.config && prev.livePropsRef === next.livePropsRef && (prev.showUndo ?? true) === (next.showUndo ?? true) && (prev.showClear ?? true) === (next.showClear ?? true);
1357
+ }
1358
+ var FormTreeMemo = React5.memo(FormTreeInner, formTreePropsAreEqual);
1359
+ var FormTree = FormTreeMemo;
1360
+
1361
+ // src/components/compound/UseForm/src/FormModalRenderer.tsx
1362
+ import { jsx as jsx16 } from "react/jsx-runtime";
1363
+ function FormModalRenderer(p) {
1364
+ const {
1365
+ openProps,
1366
+ title,
1367
+ methods,
1368
+ config,
1369
+ onSubmit,
1370
+ extraButtons,
1371
+ children,
1372
+ maxWidth = "600px",
1373
+ closeOnBackdropClick = true,
1374
+ showCloseButton = true,
1375
+ showUndo = true,
1376
+ showClear = true,
1377
+ slotProps
1378
+ } = p;
1379
+ const [, setOpen] = openProps;
1380
+ const livePropsRef = React6.useRef({ onSubmit, extraButtons, children });
1381
+ livePropsRef.current = { onSubmit, extraButtons, children };
1382
+ const handleClose = (event, reason) => {
1383
+ if (reason === "backdropClick" && !closeOnBackdropClick) return;
1384
+ setOpen(false);
1385
+ };
1386
+ return /* @__PURE__ */ jsx16(
1387
+ MuiModal,
1388
+ {
1389
+ openProps,
1390
+ title,
1391
+ maxWidth,
1392
+ onClose: handleClose,
1393
+ closeButton: showCloseButton ? /* @__PURE__ */ jsx16(default2, { sx: useFormRootSx, children: /* @__PURE__ */ jsx16(IconButton_default, { onClick: () => setOpen(false), sx: {
1394
+ backgroundColor: "transparent",
1395
+ color: "var(--useform-error)",
1396
+ "&:hover": {
1397
+ color: "var(--useform-error-hover)",
1398
+ borderColor: "transparent"
1399
+ }
1400
+ }, children: /* @__PURE__ */ jsx16(default6, { sx: { fontSize: 16 } }) }) }) : null,
1401
+ ...slotProps?.modal,
1402
+ children: /* @__PURE__ */ jsx16(
1403
+ FormTree,
1404
+ {
1405
+ methods,
1406
+ config,
1407
+ livePropsRef,
1408
+ showUndo,
1409
+ showClear
1410
+ }
1411
+ )
1412
+ }
1413
+ );
1414
+ }
1415
+
1416
+ // src/components/compound/UseForm/src/UseForm.tsx
1417
+ import React7 from "react";
1418
+ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
1419
+ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
1420
+ import { jsx as jsx17 } from "react/jsx-runtime";
1421
+ function UseForm({
1422
+ config,
1423
+ onSubmit,
1424
+ showUndo = true,
1425
+ showClear = true,
1426
+ extraButtons
1427
+ }) {
1428
+ const { methods, config: resolvedConfig } = useConfiguredForm({ config });
1429
+ const livePropsRef = React7.useRef({ onSubmit, extraButtons });
1430
+ livePropsRef.current = { onSubmit, extraButtons };
1431
+ return /* @__PURE__ */ jsx17(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsx17(
1432
+ FormTree,
1433
+ {
1434
+ methods,
1435
+ config: resolvedConfig,
1436
+ livePropsRef,
1437
+ showUndo,
1438
+ showClear
1439
+ }
1440
+ ) });
1441
+ }
1442
+
1443
+ export {
1444
+ useConfiguredForm,
1445
+ useForm2,
1446
+ FormRenderer,
1447
+ FormModalRenderer,
1448
+ UseForm
1449
+ };
1450
+ //# sourceMappingURL=chunk-24XDGNJ6.mjs.map