@customafk/lunas-ui 0.2.20 → 0.2.22

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 (341) hide show
  1. package/dist/{alert-Dn5x8pBc.mjs → alert-C-Y4ZWNd.mjs} +1 -1
  2. package/dist/{alert-Dn5x8pBc.mjs.map → alert-C-Y4ZWNd.mjs.map} +1 -1
  3. package/dist/{alert-iwPuxYjG.d.cts → alert-CrrRLYNJ.d.mts} +7 -7
  4. package/dist/{alert-CwIH3Hkd.d.mts → alert-YcsH9M6y.d.cts} +7 -7
  5. package/dist/{avatar-5LzTjIjo.mjs → avatar-SJmvlfqm.mjs} +1 -1
  6. package/dist/{avatar-5LzTjIjo.mjs.map → avatar-SJmvlfqm.mjs.map} +1 -1
  7. package/dist/{badge-DBsYYM8d.d.cts → badge-84HgXhHg.d.cts} +7 -7
  8. package/dist/{badge-CINaZwOW.d.mts → badge-BiFukfpS.d.mts} +5 -5
  9. package/dist/{badge-DYcJtNU0.mjs → badge-DSwkF4C4.mjs} +1 -1
  10. package/dist/{badge-DYcJtNU0.mjs.map → badge-DSwkF4C4.mjs.map} +1 -1
  11. package/dist/{button-DPABon17.mjs → button-Bc8L9sFb.mjs} +2 -2
  12. package/dist/{button-DPABon17.mjs.map → button-Bc8L9sFb.mjs.map} +1 -1
  13. package/dist/{button-DdwLbwWQ.d.mts → button-DXeUzeTa.d.cts} +7 -7
  14. package/dist/{button-UgIAM1cP.d.cts → button-xMJ2hylr.d.mts} +7 -7
  15. package/dist/{button.variants-B8KCLWPT.mjs → button.variants-CwcJHcI5.mjs} +1 -1
  16. package/dist/{button.variants-B8KCLWPT.mjs.map → button.variants-CwcJHcI5.mjs.map} +1 -1
  17. package/dist/{calendar-DJnuujFC.mjs → calendar-C2psGpju.mjs} +2 -2
  18. package/dist/{calendar-DJnuujFC.mjs.map → calendar-C2psGpju.mjs.map} +1 -1
  19. package/dist/cards/grid-product-card.mjs +1 -1
  20. package/dist/cards/product-card.mjs +1 -1
  21. package/dist/cards/simple-card.d.mts +2 -2
  22. package/dist/cards/simple-card.mjs +1 -1
  23. package/dist/{checkbox-dDSDiwLB.mjs → checkbox-Bwy_4QS_.mjs} +1 -1
  24. package/dist/{checkbox-dDSDiwLB.mjs.map → checkbox-Bwy_4QS_.mjs.map} +1 -1
  25. package/dist/{close-BcOkVqd8.mjs → close-BS6EeCrQ.mjs} +1 -1
  26. package/dist/{close-BcOkVqd8.mjs.map → close-BS6EeCrQ.mjs.map} +1 -1
  27. package/dist/{cms-layout-CujBx9FA.mjs → cms-layout-DCODI3eE.mjs} +2 -2
  28. package/dist/{cms-layout-CujBx9FA.mjs.map → cms-layout-DCODI3eE.mjs.map} +1 -1
  29. package/dist/{command-B8y4H5q5.mjs → command-B5DpL6OG.mjs} +2 -2
  30. package/dist/{command-B8y4H5q5.mjs.map → command-B5DpL6OG.mjs.map} +1 -1
  31. package/dist/data-display/country.d.cts +1 -1
  32. package/dist/data-display/country.d.mts +1 -1
  33. package/dist/data-display/country.mjs +1 -1
  34. package/dist/data-display/date-tooltip.mjs +1 -1
  35. package/dist/data-display/date.mjs +1 -1
  36. package/dist/data-display/name.mjs +1 -1
  37. package/dist/data-display/phone-number.mjs +1 -1
  38. package/dist/data-display/role-badge.d.cts +1 -1
  39. package/dist/data-display/role-badge.d.mts +1 -1
  40. package/dist/data-display/role-badge.mjs +1 -1
  41. package/dist/data-display/statistic.d.mts +6 -6
  42. package/dist/data-display/user.mjs +1 -1
  43. package/dist/{date-C76vNHGL.mjs → date-D_nB7Lh1.mjs} +1 -1
  44. package/dist/{date-C76vNHGL.mjs.map → date-D_nB7Lh1.mjs.map} +1 -1
  45. package/dist/{dialog-dqqupmOT.mjs → dialog-DG4vMCr5.mjs} +2 -2
  46. package/dist/{dialog-dqqupmOT.mjs.map → dialog-DG4vMCr5.mjs.map} +1 -1
  47. package/dist/{dialog-CfbtCisP.d.mts → dialog-DeQiptoB.d.cts} +12 -12
  48. package/dist/{dialog-HXH3FYKH.d.cts → dialog-Dsuo8PP7.d.mts} +12 -12
  49. package/dist/dialogs/confirm-dialog.mjs +1 -1
  50. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +2 -2
  51. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +27 -27
  52. package/dist/dialogs/detail-dialog/components/sidebar.mjs +1 -1
  53. package/dist/dialogs/detail-dialog/index.mjs +1 -1
  54. package/dist/dialogs/error-dialog.mjs +1 -1
  55. package/dist/dialogs/loading-dialog.mjs +1 -1
  56. package/dist/{dist-DPEjz4kv.mjs → dist-XxWAVHy8.mjs} +1 -1
  57. package/dist/{dist-DPEjz4kv.mjs.map → dist-XxWAVHy8.mjs.map} +1 -1
  58. package/dist/{dropdown-menu-BocQ2Vev.mjs → dropdown-menu-BlsIwe4B.mjs} +1 -1
  59. package/dist/{dropdown-menu-BocQ2Vev.mjs.map → dropdown-menu-BlsIwe4B.mjs.map} +1 -1
  60. package/dist/features/descriptions/index.d.cts +7 -7
  61. package/dist/features/descriptions/index.d.mts +3 -3
  62. package/dist/features/descriptions/index.mjs +1 -1
  63. package/dist/features/search-modal/index.d.cts +2 -2
  64. package/dist/features/search-modal/index.d.mts +2 -2
  65. package/dist/features/search-modal/index.mjs +1 -1
  66. package/dist/features/tables/index.cjs +1 -1
  67. package/dist/features/tables/index.d.cts +1 -1
  68. package/dist/features/tables/index.d.mts +2 -2
  69. package/dist/features/tables/index.mjs +1 -1
  70. package/dist/features/tanstack-form/index.d.cts +1 -1
  71. package/dist/features/tanstack-form/index.d.mts +1 -1
  72. package/dist/features/tanstack-form/index.mjs +1 -1
  73. package/dist/features/text-editor/index.d.cts +1 -1
  74. package/dist/features/text-editor/index.d.mts +1 -1
  75. package/dist/features/text-editor/index.mjs +1 -1
  76. package/dist/{field-DaZocB_E.mjs → field-Mn2bf2Ns.mjs} +2 -2
  77. package/dist/{field-DaZocB_E.mjs.map → field-Mn2bf2Ns.mjs.map} +1 -1
  78. package/dist/{flex-zl_w1yeZ.mjs → flex-Br7F9Fln.mjs} +1 -1
  79. package/dist/{flex-zl_w1yeZ.mjs.map → flex-Br7F9Fln.mjs.map} +1 -1
  80. package/dist/{heading-D8K7UGv2.mjs → heading-BnaNuvDS.mjs} +1 -1
  81. package/dist/{heading-D8K7UGv2.mjs.map → heading-BnaNuvDS.mjs.map} +1 -1
  82. package/dist/{image-WRAFECmc.mjs → image-C-CdKKP1.mjs} +2 -2
  83. package/dist/{image-WRAFECmc.mjs.map → image-C-CdKKP1.mjs.map} +1 -1
  84. package/dist/{index-D09-9eQ8.d.cts → index-6xsKIhtm.d.mts} +193 -193
  85. package/dist/{index-DXXR4oq-.d.mts → index-BG-MpSBd.d.cts} +340 -340
  86. package/dist/{index-Dn6FVL5X.d.cts → index-BMUK7c5C.d.cts} +4 -4
  87. package/dist/{index-3ZBP9XKI.d.mts → index-Bway3IIA.d.mts} +4 -4
  88. package/dist/{index-DWGlOnex.d.cts → index-CpeGB7w3.d.cts} +9 -9
  89. package/dist/{index-BreahdZP.d.mts → index-DriR2xP5.d.mts} +29 -29
  90. package/dist/index.cjs +1 -1
  91. package/dist/index.d.cts +13 -10
  92. package/dist/index.d.mts +13 -10
  93. package/dist/index.mjs +1 -1
  94. package/dist/{input-DjEul_uK.d.cts → input-BdcIab9N.d.cts} +6 -6
  95. package/dist/{input-BTm2GrZP.mjs → input-DLRypEj3.mjs} +1 -1
  96. package/dist/{input-BTm2GrZP.mjs.map → input-DLRypEj3.mjs.map} +1 -1
  97. package/dist/{input-BpTmuYnJ.d.mts → input-DLztWYaq.d.mts} +6 -6
  98. package/dist/{label-BC2u42kJ.mjs → label-BukQnBn7.mjs} +1 -1
  99. package/dist/{label-BC2u42kJ.mjs.map → label-BukQnBn7.mjs.map} +1 -1
  100. package/dist/layouts/cms-layout/index.mjs +1 -1
  101. package/dist/layouts/flex.d.cts +8 -8
  102. package/dist/layouts/flex.d.mts +12 -12
  103. package/dist/layouts/flex.mjs +1 -1
  104. package/dist/layouts/payment-layout/index.cjs +1 -1
  105. package/dist/layouts/payment-layout/index.d.cts +17 -2
  106. package/dist/layouts/payment-layout/index.d.mts +17 -2
  107. package/dist/layouts/payment-layout/index.mjs +1 -1
  108. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  109. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  110. package/dist/pages/FeatureDeveloping.mjs +1 -1
  111. package/dist/pages/FeatureFixing.d.mts +2 -2
  112. package/dist/pages/FeatureFixing.mjs +1 -1
  113. package/dist/pages/LoginPage.cjs +2 -0
  114. package/dist/pages/LoginPage.cjs.map +1 -0
  115. package/dist/pages/LoginPage.d.cts +55 -0
  116. package/dist/pages/LoginPage.d.mts +55 -0
  117. package/dist/pages/LoginPage.mjs +2 -0
  118. package/dist/pages/LoginPage.mjs.map +1 -0
  119. package/dist/pages/NotAuthorized.d.cts +2 -2
  120. package/dist/pages/NotAuthorized.d.mts +2 -2
  121. package/dist/pages/NotAuthorized.mjs +1 -1
  122. package/dist/pages/NotFound.d.cts +2 -2
  123. package/dist/pages/NotFound.d.mts +2 -2
  124. package/dist/pages/NotFound.mjs +1 -1
  125. package/dist/pages/RegisterPage.cjs +2 -0
  126. package/dist/pages/RegisterPage.cjs.map +1 -0
  127. package/dist/pages/RegisterPage.d.cts +52 -0
  128. package/dist/pages/RegisterPage.d.mts +52 -0
  129. package/dist/pages/RegisterPage.mjs +2 -0
  130. package/dist/pages/RegisterPage.mjs.map +1 -0
  131. package/dist/pages/VerifyEmailPage.cjs +2 -0
  132. package/dist/pages/VerifyEmailPage.cjs.map +1 -0
  133. package/dist/pages/VerifyEmailPage.d.cts +64 -0
  134. package/dist/pages/VerifyEmailPage.d.mts +64 -0
  135. package/dist/pages/VerifyEmailPage.mjs +2 -0
  136. package/dist/pages/VerifyEmailPage.mjs.map +1 -0
  137. package/dist/{paragraph-jzLzzEYZ.mjs → paragraph-CnHNC0rS.mjs} +1 -1
  138. package/dist/{paragraph-jzLzzEYZ.mjs.map → paragraph-CnHNC0rS.mjs.map} +1 -1
  139. package/dist/payment-layout-0mqqno1V.cjs +2 -0
  140. package/dist/payment-layout-0mqqno1V.cjs.map +1 -0
  141. package/dist/payment-layout-ClqGIxV7.mjs +2 -0
  142. package/dist/payment-layout-ClqGIxV7.mjs.map +1 -0
  143. package/dist/{popover-HZvZNeka.mjs → popover-DvGJ23lJ.mjs} +2 -2
  144. package/dist/{popover-HZvZNeka.mjs.map → popover-DvGJ23lJ.mjs.map} +1 -1
  145. package/dist/{progress-CgQ13rSf.mjs → progress-2G9rCupJ.mjs} +1 -1
  146. package/dist/{progress-CgQ13rSf.mjs.map → progress-2G9rCupJ.mjs.map} +1 -1
  147. package/dist/{radio-group-BN5y5gZY.mjs → radio-group-fN6o0QBx.mjs} +1 -1
  148. package/dist/{radio-group-BN5y5gZY.mjs.map → radio-group-fN6o0QBx.mjs.map} +1 -1
  149. package/dist/{resizable-CLUR91Hx.mjs → resizable-BxsL978e.mjs} +1 -1
  150. package/dist/{resizable-CLUR91Hx.mjs.map → resizable-BxsL978e.mjs.map} +1 -1
  151. package/dist/{search-modal-Dz7rfifb.mjs → search-modal-DZI6O6ua.mjs} +2 -2
  152. package/dist/{search-modal-Dz7rfifb.mjs.map → search-modal-DZI6O6ua.mjs.map} +1 -1
  153. package/dist/{select-1Z1p9bmp.mjs → select-Ze8Fq88G.mjs} +1 -1
  154. package/dist/{select-1Z1p9bmp.mjs.map → select-Ze8Fq88G.mjs.map} +1 -1
  155. package/dist/{separator-DVI2h_rd.mjs → separator-DXnFHf3v.mjs} +1 -1
  156. package/dist/{separator-DVI2h_rd.mjs.map → separator-DXnFHf3v.mjs.map} +1 -1
  157. package/dist/{sheet-BRXYSJDv.mjs → sheet-GUUifKAd.mjs} +1 -1
  158. package/dist/{sheet-BRXYSJDv.mjs.map → sheet-GUUifKAd.mjs.map} +1 -1
  159. package/dist/{sidebar-QPaK3ryM.mjs → sidebar-C_jArO1q.mjs} +2 -2
  160. package/dist/{sidebar-QPaK3ryM.mjs.map → sidebar-C_jArO1q.mjs.map} +1 -1
  161. package/dist/{skeleton-CZVkWN4p.mjs → skeleton-BLwzHejl.mjs} +1 -1
  162. package/dist/{skeleton-CZVkWN4p.mjs.map → skeleton-BLwzHejl.mjs.map} +1 -1
  163. package/dist/{spinner-DkmcGiVT.mjs → spinner-BaZ19Lla.mjs} +1 -1
  164. package/dist/{spinner-DkmcGiVT.mjs.map → spinner-BaZ19Lla.mjs.map} +1 -1
  165. package/dist/tables-CI2AZcbt.cjs +4 -0
  166. package/dist/tables-CI2AZcbt.cjs.map +1 -0
  167. package/dist/tables-EnSyNV7J.mjs +4 -0
  168. package/dist/tables-EnSyNV7J.mjs.map +1 -0
  169. package/dist/{tanstack-form-Sqj9ZD9z.mjs → tanstack-form-C1EVQJ-n.mjs} +2 -2
  170. package/dist/{tanstack-form-Sqj9ZD9z.mjs.map → tanstack-form-C1EVQJ-n.mjs.map} +1 -1
  171. package/dist/{text-editor-BLK_EeiU.mjs → text-editor-ae2UTKW8.mjs} +1 -1
  172. package/dist/{text-editor-BLK_EeiU.mjs.map → text-editor-ae2UTKW8.mjs.map} +1 -1
  173. package/dist/{textarea-D2ILgz82.mjs → textarea-CEtUNLwy.mjs} +1 -1
  174. package/dist/{textarea-D2ILgz82.mjs.map → textarea-CEtUNLwy.mjs.map} +1 -1
  175. package/dist/{tooltip-C7UhtrFf.mjs → tooltip-Cy0HbyAx.mjs} +1 -1
  176. package/dist/{tooltip-C7UhtrFf.mjs.map → tooltip-Cy0HbyAx.mjs.map} +1 -1
  177. package/dist/{types-BonWRhox.d.mts → types-CLkAmCre.d.cts} +1 -1
  178. package/dist/{types-COppLTPh.mjs → types-CuAlMviO.mjs} +1 -1
  179. package/dist/{types-COppLTPh.mjs.map → types-CuAlMviO.mjs.map} +1 -1
  180. package/dist/{types-CILbFL3j.d.cts → types-wApFGHmV.d.mts} +1 -1
  181. package/dist/typography/paragraph.d.cts +3 -3
  182. package/dist/typography/paragraph.d.mts +5 -5
  183. package/dist/typography/paragraph.mjs +1 -1
  184. package/dist/typography/title.d.cts +2 -2
  185. package/dist/typography/title.d.mts +2 -2
  186. package/dist/ui/alert-dialog.d.cts +12 -12
  187. package/dist/ui/alert-dialog.d.mts +12 -12
  188. package/dist/ui/alert-dialog.mjs +1 -1
  189. package/dist/ui/alert.d.cts +1 -1
  190. package/dist/ui/alert.d.mts +1 -1
  191. package/dist/ui/alert.mjs +1 -1
  192. package/dist/ui/aspect-ratio.d.cts +2 -2
  193. package/dist/ui/aspect-ratio.d.mts +2 -2
  194. package/dist/ui/avatar.d.cts +4 -4
  195. package/dist/ui/avatar.d.mts +4 -4
  196. package/dist/ui/avatar.mjs +1 -1
  197. package/dist/ui/badge.d.cts +1 -1
  198. package/dist/ui/badge.d.mts +1 -1
  199. package/dist/ui/badge.mjs +1 -1
  200. package/dist/ui/breadcrumb.d.cts +8 -8
  201. package/dist/ui/breadcrumb.d.mts +8 -8
  202. package/dist/ui/breadcrumb.mjs +1 -1
  203. package/dist/ui/button-group.d.cts +7 -7
  204. package/dist/ui/button-group.d.mts +7 -7
  205. package/dist/ui/button-group.mjs +1 -1
  206. package/dist/ui/button.d.cts +1 -1
  207. package/dist/ui/button.d.mts +1 -1
  208. package/dist/ui/button.mjs +1 -1
  209. package/dist/ui/buttons/add-new.mjs +1 -1
  210. package/dist/ui/buttons/edit.mjs +1 -1
  211. package/dist/ui/buttons/refresh.mjs +1 -1
  212. package/dist/ui/buttons/trash.mjs +1 -1
  213. package/dist/ui/buttons/upload-image.mjs +1 -1
  214. package/dist/ui/calendar.d.cts +4 -4
  215. package/dist/ui/calendar.d.mts +4 -4
  216. package/dist/ui/calendar.mjs +1 -1
  217. package/dist/ui/card.d.cts +8 -8
  218. package/dist/ui/card.d.mts +8 -8
  219. package/dist/ui/card.mjs +1 -1
  220. package/dist/ui/carousel.d.cts +7 -7
  221. package/dist/ui/carousel.d.mts +7 -7
  222. package/dist/ui/carousel.mjs +1 -1
  223. package/dist/ui/checkbox.d.cts +2 -2
  224. package/dist/ui/checkbox.d.mts +2 -2
  225. package/dist/ui/checkbox.mjs +1 -1
  226. package/dist/ui/collapsible.d.cts +4 -4
  227. package/dist/ui/collapsible.d.mts +4 -4
  228. package/dist/ui/command.d.cts +11 -11
  229. package/dist/ui/command.d.mts +11 -11
  230. package/dist/ui/command.mjs +1 -1
  231. package/dist/ui/context-menu.d.cts +16 -16
  232. package/dist/ui/context-menu.d.mts +16 -16
  233. package/dist/ui/dialog.d.cts +1 -1
  234. package/dist/ui/dialog.d.mts +1 -1
  235. package/dist/ui/dialog.mjs +1 -1
  236. package/dist/ui/drawer.d.cts +11 -11
  237. package/dist/ui/drawer.d.mts +11 -11
  238. package/dist/ui/dropdown-menu.d.cts +16 -16
  239. package/dist/ui/dropdown-menu.d.mts +16 -16
  240. package/dist/ui/dropdown-menu.mjs +1 -1
  241. package/dist/ui/empty.d.cts +9 -9
  242. package/dist/ui/empty.d.mts +9 -9
  243. package/dist/ui/field.d.cts +25 -25
  244. package/dist/ui/field.d.mts +25 -25
  245. package/dist/ui/field.mjs +1 -1
  246. package/dist/ui/file-uploader.d.cts +2 -2
  247. package/dist/ui/file-uploader.d.mts +2 -2
  248. package/dist/ui/file-uploader.mjs +1 -1
  249. package/dist/ui/form.d.cts +11 -11
  250. package/dist/ui/form.d.mts +11 -11
  251. package/dist/ui/form.mjs +1 -1
  252. package/dist/ui/hover-card.d.cts +4 -4
  253. package/dist/ui/hover-card.d.mts +4 -4
  254. package/dist/ui/image.mjs +1 -1
  255. package/dist/ui/input-otp.d.cts +5 -5
  256. package/dist/ui/input-otp.d.mts +5 -5
  257. package/dist/ui/input.d.cts +1 -1
  258. package/dist/ui/input.d.mts +1 -1
  259. package/dist/ui/input.mjs +1 -1
  260. package/dist/ui/inputs/search-input.d.cts +3 -3
  261. package/dist/ui/inputs/search-input.d.mts +3 -3
  262. package/dist/ui/inputs/search-input.mjs +1 -1
  263. package/dist/ui/item.d.cts +16 -16
  264. package/dist/ui/item.d.mts +16 -16
  265. package/dist/ui/item.mjs +1 -1
  266. package/dist/ui/label.d.cts +2 -2
  267. package/dist/ui/label.d.mts +2 -2
  268. package/dist/ui/label.mjs +1 -1
  269. package/dist/ui/menubar.d.cts +17 -17
  270. package/dist/ui/menubar.d.mts +17 -17
  271. package/dist/ui/multi-select.d.cts +2 -2
  272. package/dist/ui/multi-select.d.mts +3 -3
  273. package/dist/ui/multi-select.mjs +1 -1
  274. package/dist/ui/navigation-menu.d.cts +11 -11
  275. package/dist/ui/navigation-menu.d.mts +11 -11
  276. package/dist/ui/pagination.d.cts +9 -9
  277. package/dist/ui/pagination.d.mts +9 -9
  278. package/dist/ui/pagination.mjs +1 -1
  279. package/dist/ui/popover.d.cts +6 -6
  280. package/dist/ui/popover.d.mts +6 -6
  281. package/dist/ui/popover.mjs +1 -1
  282. package/dist/ui/progress.d.cts +2 -2
  283. package/dist/ui/progress.d.mts +2 -2
  284. package/dist/ui/progress.mjs +1 -1
  285. package/dist/ui/radio-group.d.cts +3 -3
  286. package/dist/ui/radio-group.d.mts +3 -3
  287. package/dist/ui/radio-group.mjs +1 -1
  288. package/dist/ui/resizable.d.cts +9 -9
  289. package/dist/ui/resizable.d.mts +9 -9
  290. package/dist/ui/resizable.mjs +1 -1
  291. package/dist/ui/scroll-area.d.cts +6 -6
  292. package/dist/ui/scroll-area.d.mts +6 -6
  293. package/dist/ui/select.d.cts +9 -9
  294. package/dist/ui/select.d.mts +9 -9
  295. package/dist/ui/select.mjs +1 -1
  296. package/dist/ui/separator.d.cts +2 -2
  297. package/dist/ui/separator.d.mts +2 -2
  298. package/dist/ui/separator.mjs +1 -1
  299. package/dist/ui/sheet.d.cts +9 -9
  300. package/dist/ui/sheet.d.mts +9 -9
  301. package/dist/ui/sheet.mjs +1 -1
  302. package/dist/ui/sidebar.d.cts +29 -29
  303. package/dist/ui/sidebar.d.mts +29 -29
  304. package/dist/ui/sidebar.mjs +1 -1
  305. package/dist/ui/skeleton.d.cts +2 -2
  306. package/dist/ui/skeleton.d.mts +2 -2
  307. package/dist/ui/skeleton.mjs +1 -1
  308. package/dist/ui/slider.d.cts +2 -2
  309. package/dist/ui/slider.d.mts +2 -2
  310. package/dist/ui/sonner.d.cts +2 -2
  311. package/dist/ui/sonner.d.mts +2 -2
  312. package/dist/ui/spinner.d.cts +2 -2
  313. package/dist/ui/spinner.d.mts +2 -2
  314. package/dist/ui/spinner.mjs +1 -1
  315. package/dist/ui/switch.d.cts +2 -2
  316. package/dist/ui/switch.d.mts +2 -2
  317. package/dist/ui/table.d.cts +18 -18
  318. package/dist/ui/table.d.mts +18 -18
  319. package/dist/ui/tabs.d.cts +5 -5
  320. package/dist/ui/tabs.d.mts +5 -5
  321. package/dist/ui/textarea.d.cts +2 -2
  322. package/dist/ui/textarea.d.mts +2 -2
  323. package/dist/ui/textarea.mjs +1 -1
  324. package/dist/ui/toggle-group.d.cts +3 -3
  325. package/dist/ui/toggle-group.d.mts +3 -3
  326. package/dist/ui/toggle.d.cts +5 -5
  327. package/dist/ui/toggle.d.mts +5 -5
  328. package/dist/ui/tooltip.d.cts +5 -5
  329. package/dist/ui/tooltip.d.mts +5 -5
  330. package/dist/ui/tooltip.mjs +1 -1
  331. package/dist/{user-DIEH54XW.mjs → user-DxSilm4V.mjs} +2 -2
  332. package/dist/{user-DIEH54XW.mjs.map → user-DxSilm4V.mjs.map} +1 -1
  333. package/package.json +13 -1
  334. package/dist/payment-layout-BKJ5xJra.mjs +0 -2
  335. package/dist/payment-layout-BKJ5xJra.mjs.map +0 -1
  336. package/dist/payment-layout-CcMvKPaX.cjs +0 -2
  337. package/dist/payment-layout-CcMvKPaX.cjs.map +0 -1
  338. package/dist/tables--hUSBZFP.cjs +0 -4
  339. package/dist/tables--hUSBZFP.cjs.map +0 -1
  340. package/dist/tables-BZ5jLRGG.mjs +0 -4
  341. package/dist/tables-BZ5jLRGG.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import{t as e}from"./button-DPABon17.mjs";import{i as t,n,t as r}from"./tooltip-C7UhtrFf.mjs";import{t as i}from"./separator-DVI2h_rd.mjs";import{t as a}from"./close-BcOkVqd8.mjs";import{c as o,l as s,r as c,s as l,t as u}from"./dialog-dqqupmOT.mjs";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./command-B8y4H5q5.mjs";import{t as _}from"./checkbox-dDSDiwLB.mjs";import{t as v}from"./input-BTm2GrZP.mjs";import{a as y,i as b,t as x}from"./popover-HZvZNeka.mjs";import{c as S,i as C,n as w,s as T,t as E}from"./select-1Z1p9bmp.mjs";import{t as D}from"./calendar-DJnuujFC.mjs";import{n as O,t as ee}from"./radio-group-BN5y5gZY.mjs";import{t as te}from"./textarea-D2ILgz82.mjs";import{t as ne}from"./text-editor-BLK_EeiU.mjs";import{ArrowDownToLine as re,AtSignIcon as ie,BanIcon as ae,CalendarDaysIcon as oe,EyeIcon as se,EyeOffIcon as ce,HelpCircleIcon as le,InfoIcon as ue,Loader2Icon as de,PackagePlusIcon as fe,PlusIcon as pe,Trash2Icon as me,XIcon as he}from"lucide-react";import{memo as k,useCallback as A,useEffect as ge,useId as j,useMemo as M,useRef as N,useState as _e}from"react";import{jsx as P,jsxs as F}from"react/jsx-runtime";import{cn as I}from"@customafk/react-toolkit/utils";import{cva as ve}from"class-variance-authority";import{endOfToday as L,endOfTomorrow as ye,endOfYesterday as be,format as xe,lastDayOfMonth as Se,startOfMonth as Ce,subDays as R}from"@customafk/react-toolkit/date-fns";import{Dialog as z,Label as we,Separator as Te,Switch as Ee}from"radix-ui";import{createFormHook as De,createFormHookContexts as Oe,useStore as B}from"@tanstack/react-form";const ke=ve([`flex w-fit items-center justify-center rounded-full font-bold text-text-negative-strong`],{variants:{color:{default:`bg-primary-strong`,secondary:`bg-secondary-strong`,success:`bg-success-strong`,info:`bg-info-strong`,warning:`bg-warning-strong`,danger:`border border-danger-strong bg-linear-to-b from-danger-strong/90 via-danger-strong to-danger-strong/90`},size:{xs:`px-1.5 py-0.5 text-xs`,sm:`px-2 py-0.75 text-xs`,md:`px-2.5 py-0.75 text-sm`,lg:`px-3 py-1 text-sm`}},defaultVariants:{color:`default`,size:`sm`}}),Ae=({label:e,color:t,size:n,className:r,children:i})=>P(`div`,{"data-slot":`required-indicator`,className:ke({color:t,size:n,className:r}),children:e||i});function je({className:e,children:t,...n}){return F(we.Root,{"data-slot":`label`,className:I(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[P(`span`,{className:`flex items-center gap-1`,children:t}),P(Ae,{label:`Required`,color:`danger`,size:`xs`,className:`hidden shrink-0`})]})}const Me=ve(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:gap-4`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-content]:basis-1/2`,`@md/field-group:*:data-[slot=field-content-main]:basis-1/2`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),Ne=k(({className:e,...t})=>P(`fieldset`,{"data-slot":`field-set`,className:I(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));Ne.displayName=`FieldSet`;const Pe=k(({className:e,variant:t=`legend`,...n})=>P(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:I(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));Pe.displayName=`FieldLegend`;const V=k(({className:e,...t})=>P(`div`,{"data-slot":`field-group`,className:I(`group/field-group @container/field-group`,`flex flex-col gap-7 pt-4`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));V.displayName=`FieldGroup`;const H=k(({className:e,orientation:t=`vertical`,...n})=>P(`div`,{"data-slot":`field`,"data-orientation":t,className:I(Me({orientation:t}),e),...n}));H.displayName=`Field`;const U=k(({className:e,...t})=>P(`div`,{"data-slot":`field-content`,className:I(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));U.displayName=`FieldContent`;const W=k(({className:e,...t})=>P(`div`,{"data-slot":`field-content-main`,className:I(`relative`,e),...t}));W.displayName=`FieldContentMain`;const G=k(({className:e,...t})=>P(je,{"data-slot":`field-label`,className:I(`group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));G.displayName=`FieldLabel`;const K=k(({className:e,...t})=>P(`div`,{"data-slot":`field-label`,className:I(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));K.displayName=`FieldTitle`;const q=k(({className:e,...t})=>P(`p`,{"data-slot":`field-description`,className:I(`nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));q.displayName=`FieldDescription`;const J=k(({isShow:e=!0,className:t,children:n,...r})=>e===!1?null:F(`div`,{"data-slot":`field-note`,className:I(`flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs`,t),...r,children:[P(ue,{size:12,className:`mt-0.5 shrink-0 text-primary/70`}),P(`span`,{children:n})]}));J.displayName=`FieldNote`;const Y=k(({tooltip:e})=>F(r,{children:[P(t,{asChild:!0,children:F(`button`,{type:`button`,tabIndex:-1,className:`inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none`,children:[P(le,{size:13,"aria-hidden":`true`}),P(`span`,{className:`sr-only`,children:`More information`})]})}),P(n,{side:`top`,className:`max-w-xs text-balance`,children:e})]}));Y.displayName=`FieldTooltip`;const X=k(({children:e,className:t,...n})=>F(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:I(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...n,children:[P(i,{className:`absolute inset-0 top-1/2`}),e&&P(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));X.displayName=`FieldSeparator`;const Z=k(({className:e,children:t,errors:n,...r})=>{let i=M(()=>t||(n?n?.length===1&&n[0]?.message?P(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:P(`p`,{children:n[0]?.code===`invalid_type`?`Invalid format`:n[0].message})}):P(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?P(`li`,{children:e},e):e?.message?P(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?P(`div`,{role:`alert`,"data-slot":`field-error`,className:I(`w-full font-medium text-danger-strong text-xs`,e),...r,children:i}):null});Z.displayName=`FieldError`;const Fe=({label:e,description:t,options:n,tooltip:r,helperText:i,orientation:a})=>{let o=Q(),s=B(o.form.store,({isSubmitting:e})=>e);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:a,children:[F(U,{children:[F(G,{children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t}),P(J,{isShow:!!i,children:i})]}),P(W,{children:P(V,{className:`flex flex-col gap-y-2`,children:n.map(e=>F(H,{orientation:`horizontal`,children:[P(_,{id:`${o.name}-${e.value}`,name:o.name,checked:o.state.value?.includes(e.value)??!1,disabled:s,onCheckedChange:t=>{if(t&&o.state.value!==null)o.pushValue(e.value);else if(t&&o.state.value===null)o.setValue([e.value]);else if(!t&&o.state.value!==null){let t=o.state.value.indexOf(e.value);t>-1&&o.removeValue(t)}else o.setValue(null)}}),P(G,{htmlFor:`${o.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),P(X,{})]})},Ie=({label:t,description:n,placeholder:r,tooltip:i,orientation:a=`responsive`,options:o})=>{let s=Q(),c=M(()=>s.state.meta.isTouched&&!s.state.meta.isValid,[s.state.meta.isTouched,s.state.meta.isValid]),l=M(()=>s.state.meta.errors,[s.state.meta.errors]),u=o.find(({value:e})=>e===s.state.value)?.label;return F(V,{className:`px-4`,children:[F(H,{orientation:a,"data-invalid":c,children:[F(U,{children:[F(G,{htmlFor:s.name,children:[t,i&&P(Y,{tooltip:i})]}),P(q,{children:n})]}),P(W,{className:`flex justify-end`,children:F(`div`,{className:`flex w-full max-w-60 flex-col`,children:[F(x,{children:[P(y,{asChild:!0,children:P(e,{variant:`outline`,color:`muted`,size:`lg`,className:I(`flex items-center justify-start rounded outline-border`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:text-text-positive-muted data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,!s.state.value&&`text-text-positive-muted`),children:u?P(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-start`,children:u}):P(`p`,{className:`flex-1 text-start text-text-positive-muted`,children:r})})}),P(b,{align:`end`,side:`bottom`,className:`flex w-fit rounded p-0`,onBlur:s.handleBlur,children:F(g,{className:`border-none`,children:[P(d,{placeholder:r??`Search…`}),P(h,{children:P(f,{className:`max-h-40 overflow-y-auto`,children:o.map(({value:e,label:t})=>P(p,{value:t,onSelect:()=>s.handleChange(e),children:t},e))})}),P(m,{children:`No results found.`})]})})]}),P(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:P(Z,{errors:l})})]})})]}),P(X,{})]})},Le=({label:t,description:n,placeholder:r,orientation:i=`responsive`,tooltip:a,helperText:o,minDate:s,maxDate:c,required:l})=>{let u=Q(),d=M(()=>l?u.state.value===null:!1,[l,u.state.value]),f=M(()=>u.state.meta.isTouched&&!u.state.meta.isValid,[u.state.meta.isTouched,u.state.meta.isValid]);return F(V,{className:`px-4`,children:[F(H,{orientation:i,"data-invalid":f,children:[F(U,{children:[F(G,{htmlFor:u.name,"aria-required":d,children:[t,a&&P(Y,{tooltip:a})]}),P(q,{children:n})]}),F(W,{className:`flex flex-col space-y-1`,children:[P(`div`,{className:`flex w-full flex-col`,children:F(x,{children:[P(y,{asChild:!0,children:F(e,{variant:`outline`,color:`muted`,size:`lg`,className:I(`flex items-center justify-between rounded font-normal outline-border`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-1`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-4`,`data-[state=open]:ring-primary-weak`,u.state.value===null&&`text-text-positive-muted`),children:[P(`p`,{children:u.state.value===null?r||`Select date`:xe(u.state.value,`PPPP`)}),P(oe,{strokeWidth:1})]})}),F(b,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:u.handleBlur,children:[F(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(L())},children:`Today`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(ye())},children:`Tomorrow`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(be())},children:`Yesterday`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(R(L(),3))},children:`Last 3 Days`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(R(L(),7))},children:`Last 7 Days`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(R(L(),30))},children:`Last 30 Days`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(Ce(L()))},children:`This Month`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(Se(L()))},children:`Last Month`})]}),P(`div`,{className:`flex flex-1 flex-col`,children:P(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:P(D,{mode:`single`,selected:u.state.value??void 0,hidden:{before:s??new Date(1900,0,1),after:c??new Date(2100,11,31)},onSelect:e=>{e&&u.handleChange(e)}})})})]})]})}),P(J,{isShow:!!o,children:o})]})]}),P(X,{})]})},Re=({label:e,description:t,placeholder:n,tooltip:r,helperText:i,orientation:a=`responsive`,showErrorMessage:o=!0,required:s=!1,maxLength:c})=>{let{form:l,name:u,state:d,handleBlur:f,handleChange:p}=Q(),m=B(l.store,({isSubmitting:e})=>e),h=d.meta.isDirty&&d.meta.isTouched&&!d.meta.isValid,g=s&&d.value===null,_=!m&&!!d.value,y=A(({target:{value:e}})=>{m||c&&e.length>c||p(e||null)},[m,c,p]),b=A(()=>{m||p(null)},[m,p]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{"data-invalid":h,orientation:a,children:[F(U,{children:[F(G,{htmlFor:u,"aria-required":g,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[P(v,{id:u,name:u,value:d.value===null?``:d.value,"aria-invalid":h,autoComplete:`email`,placeholder:n,className:I(`pl-9`,_&&`pr-9`,m&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:f,onChange:y}),P(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:P(ie,{size:14})}),_&&P(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong`,onClick:b,children:P(he,{size:14,"aria-hidden":`true`})}),P(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:o&&d.meta.isDirty&&P(Z,{errors:d.meta.errors})}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})},ze=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,Be=e=>Number(e).toLocaleString(),Ve=(e,t,n)=>{if(n===`none`)return e;let r=10**t,i=e*r;switch(n){case`up`:return Math.ceil(i)/r;case`down`:return Math.floor(i)/r;case`nearest`:return i%1<.1?Math.floor(i)/r:i%1>=.59?Math.ceil(i)/r:(Math.floor(i)+.5)/r;default:return e}},He=({disabled:e=!1,readOnly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:a=null,unitText:o,decimal:s,placeholder:c,precision:l,wrapperClassName:u,className:d,onChange:f,onValueChange:p,onFocus:m,onBlur:h,...g})=>{let _=N(null),y=N(null),[b,x]=_e(a?.toString()??null),S=M(()=>s?.[1]??r,[s,r]),C=M(()=>s&&s[0]-s[1],[s]),w=M(()=>ze(n),[n]),T=A(e=>{if(!S||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=S&&r<=(C??1/0)},[S,C]),E=A(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=Ve(parseFloat(e),Math.min(S-1,l||0),i).toString().split(`.`),r=Be(t);return n?`${r}.${n}`:r},[S,l,i]),D=A(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){p?.(0),x(e);return}if(n){x(()=>(p?.(0),e));return}},[p]),O=A(e=>{f?.(e);let{value:t}=e.target;if(t===``||t===void 0){p?.(null),x(null);return}D(t),!(!w.test(t)||!T(t))&&(p?.(parseFloat(t)||0),x(t))},[T,f,p,D,w]),ee=A(e=>{t||(m?.(e),x(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,m]),te=A(e=>{t||(h?.(e),x(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?E(e):null))},[t,E,h]);return ge(()=>{let e=document.activeElement===y.current;if(a==null||!w.test(a.toString())||!T(a.toString())){x(null);return}x(t=>e?t:E(a.toString()))},[E,a,T,w]),ge(()=>{if(!_.current||!y.current||!o)return;let e=_.current.offsetWidth;y.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[o]),F(`div`,{className:I(`relative`,u),children:[P(v,{...g,ref:y,value:b||(t?`0`:``),placeholder:c,disabled:e,readOnly:t,className:I(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,d),onChange:O,onFocus:ee,onBlur:te}),o&&P(`span`,{ref:_,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:o})]})},Ue=({label:e,description:t,placeholder:n,tooltip:r,helperText:i,orientation:a=`responsive`,showErrorMessage:o=!0,rounding:s,decimalPlaces:c,percision:l,unit:u,required:d,allowNegative:f})=>{let p=Q(),m=B(p.form.store,({isSubmitting:e})=>e),h=p.state.meta.errors,g=d?p.state.value===null:!1,_=A(e=>{m||p.handleChange(e)},[m,p.handleChange]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:a,"data-invalid":p.state.meta.isTouched&&!p.state.meta.isValid,children:[F(U,{children:[F(G,{htmlFor:p.name,"aria-required":g,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[F(`div`,{className:`relative w-full`,children:[P(He,{id:p.name,value:p.state.value,"aria-invalid":p.state.meta.isTouched&&!p.state.meta.isValid&&p.state.meta.isDirty,placeholder:n,roundingRule:s,numberAfterDecimalPoint:c,precision:l,unitText:u,allowNegative:f,className:I(m&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:p.handleBlur,onValueChange:_}),m&&P(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:P(de,{className:`animate-spin text-primary-strong`})}),p.state.meta.isDirty&&o&&!!h.length&&P(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:P(ae,{})}),P(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:p.state.meta.isDirty&&o&&P(Z,{errors:h})})]}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})},We=({label:e,description:t,placeholder:n,orientation:r=`responsive`,tooltip:i,helperText:a,showErrorMessage:o=!0})=>{let s=j(),{form:c,name:l,state:u,handleBlur:d,handleChange:f}=Q(),p=B(c.store,({isSubmitting:e})=>e),[m,h]=_e(!1),g=u.meta.isDirty&&u.meta.isTouched&&!u.meta.isValid,_=A(()=>h(e=>!e),[]),y=A(({target:{value:e}})=>{p||f(e||null)},[p,f]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{"data-invalid":g,orientation:r,children:[F(U,{children:[F(G,{htmlFor:s,children:[e,i&&P(Y,{tooltip:i})]}),P(q,{children:t})]}),F(W,{children:[P(v,{id:s,name:l,type:m?`text`:`password`,placeholder:n,value:u.value??``,"aria-invalid":g,autoComplete:`new-password`,onBlur:d,onChange:y}),P(`button`,{className:`absolute inset-e-0 inset-y-0 flex size-9 items-center justify-center rounded-e-md text-muted outline-none transition-[color,box-shadow] focus:z-10 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,onClick:_,"aria-label":m?`Hide password`:`Show password`,"aria-pressed":m,"aria-controls":s,children:P(m?ce:se,{size:16,"aria-hidden":`true`})}),P(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:o&&u.meta.isDirty&&P(Z,{errors:u.meta.errors})}),P(J,{isShow:!!a,children:a})]})]}),P(X,{})]})},Ge=({label:e,description:t,orientation:n,options:r,tooltip:i,helperText:a})=>{let o=Q(),s=B(o.form.store,({isSubmitting:e})=>e);return F(V,{className:`px-4`,children:[F(H,{orientation:n,className:`flex-col gap-2`,children:[F(U,{children:[F(G,{children:[e,i&&P(Y,{tooltip:i})]}),P(q,{children:t}),P(J,{isShow:!!a,children:a})]}),P(W,{children:P(ee,{value:o.state.value??``,className:`w-full`,onValueChange:o.handleChange,children:r.map(e=>P(G,{className:I(`h-fit`,o.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,s&&`pointer-events-none bg-muted-muted opacity-60`,o.state.value===e.value&&s&&`border-border-strong!`),children:F(H,{orientation:`horizontal`,className:`items-start gap-3 rounded p-2!`,children:[P(O,{value:e.value,className:`mt-0.5 shrink-0`}),F(U,{className:`gap-0.5!`,children:[P(K,{children:e.label}),P(q,{className:`text-xs`,children:e.description})]})]})},e.value))})})]}),P(X,{})]})},Ke=({label:e,description:t,placeholder:n,orientation:r=`responsive`,tooltip:i,options:a,helperText:o,required:s=!1})=>{let c=Q(),l=c.state.meta.isTouched&&!c.state.meta.isValid,u=s&&c.state.value===null,d=c.state.meta.errors;return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:r,"data-invalid":l,children:[F(U,{children:[F(G,{htmlFor:c.name,"aria-required":u,children:[e,i&&P(Y,{tooltip:i})]}),P(q,{children:t})]}),F(W,{className:`flex flex-col`,children:[F(E,{value:c.state.value??``,onValueChange:c.handleChange,children:[P(T,{"aria-invalid":l?`true`:void 0,onBlur:c.handleBlur,children:P(S,{placeholder:n})}),F(w,{children:[!!a.length&&a.map(e=>P(C,{value:e.value,children:e.label},e.value)),!a.length&&F(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[P(fe,{strokeWidth:1}),`No options available`]})]})]}),P(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:P(Z,{errors:d})}),P(J,{isShow:!!o,children:o})]})]}),P(X,{})]})};function qe({className:e,...t}){return P(Ee.Root,{"data-slot":`switch`,className:I(`peer`,`w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all`,`inline-flex h-5`,`focus-visible:border-primary-strong`,`focus-visible:ring-primary-weak`,`focus-visible:ring-4`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`-outline-offset-1 inset-shadow-2xs outline-1`,`data-[state=checked]:bg-primary`,`data-[state=checked]:outline-primary-strong`,`data-[state=unchecked]:bg-muted-weak`,`data-[state=unchecked]:outline-border`,`data-[state=unchecked]:[&_span]:size-4`,`data-[state=unchecked]:[&_span]:translate-x-0.5`,`data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5`,e),...t,children:P(Ee.Thumb,{"data-slot":`switch-thumb`,className:I(`block size-4 bg-card shadow-xs`,`pointer-events-none rounded-full ring-0 transition-transform`,`data-[state=checked]:translate-x-[calc(100%-3px)]`,`data-[state=unchecked]:translate-x-0`)})})}const Je=({label:e,description:t,helperText:n})=>{let r=Q();return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[F(U,{children:[P(K,{className:`cursor-pointer`,children:P(`label`,{htmlFor:r.name,children:e})}),P(q,{children:t}),P(qe,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),P(J,{isShow:!!n,children:n})]}),P(X,{})]})},Ye=({label:e,description:t,placeholder:n,tooltip:r,helperText:i,counter:a=!1,orientation:o=`responsive`,showClearButton:s=!1,showErrorMessage:c=!0,required:l=!1,maxLength:u})=>{let d=j(),f=N(null),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=Q(),y=B(p.store,({isSubmitting:e})=>e),b=s&&!y&&!!h.value,x=h.value?h.value.length:0,S=M(()=>{if(!a)return``;let e=`character${[0,1].includes(x)?``:`s`}`;return a&&u?`${x} / ${u} character${x?`s`:``}`:`${x} ${e}`},[x,a,u]),C=h.meta.isDirty&&h.meta.isTouched&&!h.meta.isValid,w=l&&h.value===null,T=u&&x>=u*.8,E=u&&x>=u,D=A(({target:{value:e}})=>{y||a&&u&&e.length>u||_(e||null)},[y,a,u,_]),O=A(()=>{y||(_(null),f.current?.focus())},[y,_]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:o,"data-invalid":C,children:[F(U,{children:[F(G,{"aria-required":w,htmlFor:d,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[P(v,{ref:f,id:d,name:m,value:h.value??``,"aria-invalid":C,autoComplete:`off`,placeholder:n,autoCapitalize:`none`,autoCorrect:`off`,className:I(`pr-6`,y&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:g,onChange:D}),b&&P(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-intense [&>svg]:size-3.5`,onClick:O,children:P(he,{"aria-hidden":`true`})}),y&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:P(de,{size:14,className:`animate-spin text-primary-strong`})}),!b&&h.meta.isDirty&&c&&!!h.meta.errors.length&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:P(ae,{"aria-hidden":`true`,size:14})}),F(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[h.meta.isDirty&&c?P(Z,{className:`flex-1`,errors:h.meta.errors}):P(`div`,{}),!!a&&P(`p`,{className:I(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,E?`font-medium text-danger-strong`:T?`text-warning-strong`:`text-text-positive-weak`),children:S})]}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})},Xe=k(({label:e,description:t,placeholder:n,tooltip:r,helperText:i,counter:a=!1,orientation:o=`responsive`,showErrorMessage:s=!0,required:c=!1,maxLength:l})=>{let u=j(),{form:d,state:f,name:p,handleBlur:m,handleChange:h}=Q(),g=B(d.store,({isSubmitting:e})=>e),_=f.value?f.value.length:0,v=M(()=>{if(!a)return``;let e=`character${[0,1].includes(_)?``:`s`}`;return a&&l?`${_} / ${l} character${_?`s`:``}`:`${_} ${e}`},[_,a,l]),y=f.meta.isDirty&&f.meta.isTouched&&!f.meta.isValid,b=c&&f.value===null,x=f.meta.errors,S=l&&_>=l*.8,C=l&&_>=l,w=A(({target:{value:e}})=>{g||a&&l&&e.length>l||h(e||null)},[g,a,l,h]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:o,"data-invalid":y,children:[F(U,{children:[F(G,{"aria-required":b,htmlFor:u,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[P(te,{id:u,name:p,value:f.value===null?``:f.value,"aria-invalid":y,autoCapitalize:`none`,autoComplete:`off`,placeholder:n,className:I(g&&`pointer-events-none bg-muted-muted opacity-60`),onChange:w,onBlur:m}),g&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:P(de,{size:14,className:`animate-spin text-primary-strong`})}),f.meta.isDirty&&s&&!!x.length&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:P(ae,{size:14})}),F(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[f.meta.isDirty&&s?P(Z,{className:`flex-1`,errors:f.meta.errors}):P(`div`,{}),!!a&&P(`p`,{className:I(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,C?`font-medium text-danger-strong`:S?`text-warning-strong`:`text-text-positive-weak`),children:v})]}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})});Xe.displayName=`TextareaField`;const Ze=k(({label:e,description:t,placeholder:n,tooltip:r,helperText:i,showErrorMessage:a=!0,required:o=!1})=>{let{form:s,state:c,handleChange:l}=Q(),u=B(s.store,({isSubmitting:e})=>e),d=c.meta.isDirty&&c.meta.isTouched&&!c.meta.isValid,f=o&&c.value===null,p=A(e=>{u||l(e||null)},[u,l]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:`vertical`,"data-invalid":d,children:[F(U,{children:[F(G,{"aria-required":f,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),P(ne,{value:c.value??``,placeholder:n,readOnly:u,onChange:p}),c.meta.isDirty&&a&&!!c.meta.errors.length&&P(Z,{errors:c.meta.errors}),P(J,{isShow:!!i,children:i})]}),P(X,{})]})});Ze.displayName=`TextEditorField`;const Qe=({label:t,className:n})=>{let r=$(),i=A(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return P(r.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:r,isSubmitting:a})=>P(e,{type:`button`,size:`md`,disabled:r,isLoading:a,className:I(`min-h-8 min-w-32`,n),onClick:i,children:t??`Submit`})})},$e=({type:t=`create`})=>{let n=$();return F(`div`,{className:`flex h-8 items-center justify-between`,children:[P(n.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:t})=>P(e,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:t,className:`h-full min-w-32`,onClick:()=>n.reset(),children:`Cancel`})}),t===`create`&&P(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:t,isSubmitting:r})=>F(e,{type:`submit`,size:`md`,disabled:t,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`create`}),n.state.isSubmitSuccessful&&n.reset()},children:[P(pe,{}),`Add New`]})}),t===`update`&&P(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:t,isSubmitting:r})=>F(e,{type:`submit`,size:`md`,disabled:t,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`update`}),n.state.isSubmitSuccessful&&n.reset()},children:[P(re,{}),`Update`]})})]})};function et({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return P(Te.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:I(`shrink-0 bg-border-weak`,`data-[orientation=horizontal]:h-px`,`data-[orientation=horizontal]:w-full`,`data-[orientation=vertical]:h-full`,`data-[orientation=vertical]:w-px`,e),...r})}const tt=({title:t,description:n,onDelete:r,children:i})=>F(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-1 ring-border`,children:[F(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-0.5 px-4 py-3`,children:[P(`p`,{className:`font-semibold text-base tracking-tight`,children:t}),!!n&&P(`p`,{className:`text-text-positive-weak text-sm`,children:n})]}),P(et,{}),P(`div`,{"data-slot":`card-form-main`,className:`flex flex-col py-4`,children:i}),!!r&&F(e,{color:`danger`,variant:`ghost`,size:`sm`,className:`absolute top-2.5 right-3`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[P(me,{}),`Remove`]})]}),nt=({children:e})=>P(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),rt=({disabled:t,className:n,onClick:r,children:i})=>P(e,{type:`button`,variant:`outline`,color:`muted`,disabled:t,className:I(`min-w-40`,n),onClick:r,children:i??`Cancel`}),it=({isSubmitting:t,submitText:n=`Submit`,disabled:r,className:i,onClick:a})=>P(e,{type:`button`,isLoading:t,disabled:r||t,className:I(`min-w-40`,i),onClick:a,children:n}),at=({title:e,submitText:t,open:n,onOpenChange:r,children:a})=>{let d=$(),f=A(e=>{e||d.reset(),r?.(e)},[d.reset,r]);return P(u,{open:n,onOpenChange:f,children:F(o,{"data-slot":`dialog-portal`,children:[P(l,{}),F(c,{className:`flex size-full max-h-dvh max-w-dvw flex-col gap-0 overflow-y-auto p-0 shadow-dialog sm:h-auto sm:max-h-[85dvh] sm:max-w-2xl sm:rounded-md`,children:[P(`div`,{"data-slot":`dialog-header`,className:`flex items-center justify-center gap-2 px-6 py-5 text-center sm:text-left`,children:P(s,{"data-slot":`dialog-title`,className:`text-lg font-semibold tracking-tight`,children:e})}),P(i,{}),P(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col overflow-y-auto p-0 pt-4 max-sm:flex-1 sm:p-4`,children:a}),P(i,{}),F(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-end gap-2 px-6 py-4 sm:flex-row max-sm:[&>button]:w-full`,children:[P(d.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>P(rt,{disabled:e,onClick:()=>{d.reset(),f(!1)}})}),P(d.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:n})=>P(it,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>d.handleSubmit()})})]})]})]})})},ot=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:r,children:[F(U,{children:[P(G,{children:e}),P(q,{children:t})]}),F(W,{children:[i,P(J,{isShow:!!n,children:n})]})]}),P(X,{})]}),st=({title:e,open:t,contentClassName:n,onOpenChange:r,children:i})=>{let o=$();return P(z.Root,{"data-slot":`dialog`,open:t,onOpenChange:r,children:F(z.Portal,{"data-slot":`dialog-portal`,children:[P(z.Overlay,{"data-slot":`dialog-overlay`,className:I(`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm`,`data-[state=open]:animate-in data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:fade-out`)}),P(z.Content,{"data-slot":`dialog-content`,className:I(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background shadow-lg ring-1 ring-border`,`duration-300`,`data-[state=open]:animate-in data-[state=open]:slide-in-from-right data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=closed]:fade-out`),children:F(`section`,{className:`relative flex size-full flex-col`,children:[P(`header`,{className:`flex h-14 shrink-0 items-center border-b border-border px-5`,children:P(`h2`,{className:`font-semibold text-base tracking-tight text-text-positive`,children:e})}),P(`div`,{className:I(`flex flex-1 flex-col overflow-y-auto py-4`,n),children:i}),F(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border px-4 py-3`,children:[P(o.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>P(it,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),P(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>P(rt,{disabled:e,className:`w-full`,onClick:()=>{o.reset(),r?.(!1)}})})]}),P(z.Close,{asChild:!0,children:P(a,{className:`absolute top-2.5 right-3`})})]})})]})})},ct=({children:e})=>P(`header`,{"data-slot":`section-header`,className:`flex items-center px-4 py-3 font-semibold text-base text-text-positive tracking-tight`,children:e}),lt=({children:e})=>P(`main`,{"data-slot":`section-main`,className:`relative flex flex-col py-4`,children:e}),ut=({title:e,children:t})=>F(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-1 ring-border`,children:[P(ct,{children:e}),P(et,{}),P(lt,{children:t})]}),dt=({title:e,description:t,helperText:n})=>F(V,{className:`gap-y-4 px-4`,children:[F(H,{className:`gap-0`,children:[F(U,{children:[P(Pe,{className:`mb-1`,children:e}),P(q,{children:t})]}),P(J,{isShow:!!n,children:n})]}),P(X,{})]}),{fieldContext:ft,formContext:pt,useFieldContext:Q,useFormContext:$}=Oe(),{useAppForm:mt,withForm:ht,withFieldGroup:gt}=De({fieldContext:ft,formContext:pt,fieldComponents:{TextField:Ye,TextareaField:Xe,TextEditorField:Ze,NumberField:Ue,EmailField:Re,PasswordField:We,SelectField:Ke,ComboboxField:Ie,DateField:Le,SwitchField:Je,RadioGroupField:Ge,CheckboxField:Fe,FieldGroup:V,Field:H,FieldContent:U,FieldLabel:G,FieldContentMain:W,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:at,TanStackPopoverForm:st,TanStackContainerForm:nt,TanStackSectionForm:ut,TanStackCardForm:tt,TanStackFieldGroup:ot,TanStackTitleField:dt,TanStackActionsForm:$e,TanStackActionSubmit:Qe}});export{ht as a,W as c,G as d,X as f,gt as i,Z as l,mt as n,H as o,$ as r,U as s,Q as t,V as u};
2
- //# sourceMappingURL=tanstack-form-Sqj9ZD9z.mjs.map
1
+ import{t as e}from"./button-Bc8L9sFb.mjs";import{i as t,n,t as r}from"./tooltip-Cy0HbyAx.mjs";import{t as i}from"./separator-DXnFHf3v.mjs";import{t as a}from"./close-BS6EeCrQ.mjs";import{c as o,l as s,r as c,s as l,t as u}from"./dialog-DG4vMCr5.mjs";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./command-B5DpL6OG.mjs";import{t as _}from"./checkbox-Bwy_4QS_.mjs";import{t as v}from"./input-DLRypEj3.mjs";import{a as y,i as b,t as x}from"./popover-DvGJ23lJ.mjs";import{c as S,i as C,n as w,s as T,t as E}from"./select-Ze8Fq88G.mjs";import{t as D}from"./calendar-C2psGpju.mjs";import{n as O,t as ee}from"./radio-group-fN6o0QBx.mjs";import{t as te}from"./textarea-CEtUNLwy.mjs";import{t as ne}from"./text-editor-ae2UTKW8.mjs";import{ArrowDownToLine as re,AtSignIcon as ie,BanIcon as ae,CalendarDaysIcon as oe,EyeIcon as se,EyeOffIcon as ce,HelpCircleIcon as le,InfoIcon as ue,Loader2Icon as de,PackagePlusIcon as fe,PlusIcon as pe,Trash2Icon as me,XIcon as he}from"lucide-react";import{memo as k,useCallback as A,useEffect as ge,useId as j,useMemo as M,useRef as N,useState as _e}from"react";import{jsx as P,jsxs as F}from"react/jsx-runtime";import{cn as I}from"@customafk/react-toolkit/utils";import{cva as ve}from"class-variance-authority";import{endOfToday as L,endOfTomorrow as ye,endOfYesterday as be,format as xe,lastDayOfMonth as Se,startOfMonth as Ce,subDays as R}from"@customafk/react-toolkit/date-fns";import{Dialog as z,Label as we,Separator as Te,Switch as Ee}from"radix-ui";import{createFormHook as De,createFormHookContexts as Oe,useStore as B}from"@tanstack/react-form";const ke=ve([`flex w-fit items-center justify-center rounded-full font-bold text-text-negative-strong`],{variants:{color:{default:`bg-primary-strong`,secondary:`bg-secondary-strong`,success:`bg-success-strong`,info:`bg-info-strong`,warning:`bg-warning-strong`,danger:`border border-danger-strong bg-linear-to-b from-danger-strong/90 via-danger-strong to-danger-strong/90`},size:{xs:`px-1.5 py-0.5 text-xs`,sm:`px-2 py-0.75 text-xs`,md:`px-2.5 py-0.75 text-sm`,lg:`px-3 py-1 text-sm`}},defaultVariants:{color:`default`,size:`sm`}}),Ae=({label:e,color:t,size:n,className:r,children:i})=>P(`div`,{"data-slot":`required-indicator`,className:ke({color:t,size:n,className:r}),children:e||i});function je({className:e,children:t,...n}){return F(we.Root,{"data-slot":`label`,className:I(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[P(`span`,{className:`flex items-center gap-1`,children:t}),P(Ae,{label:`Required`,color:`danger`,size:`xs`,className:`hidden shrink-0`})]})}const Me=ve(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:gap-4`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-content]:basis-1/2`,`@md/field-group:*:data-[slot=field-content-main]:basis-1/2`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),Ne=k(({className:e,...t})=>P(`fieldset`,{"data-slot":`field-set`,className:I(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));Ne.displayName=`FieldSet`;const Pe=k(({className:e,variant:t=`legend`,...n})=>P(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:I(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));Pe.displayName=`FieldLegend`;const V=k(({className:e,...t})=>P(`div`,{"data-slot":`field-group`,className:I(`group/field-group @container/field-group`,`flex flex-col gap-7 pt-4`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));V.displayName=`FieldGroup`;const H=k(({className:e,orientation:t=`vertical`,...n})=>P(`div`,{"data-slot":`field`,"data-orientation":t,className:I(Me({orientation:t}),e),...n}));H.displayName=`Field`;const U=k(({className:e,...t})=>P(`div`,{"data-slot":`field-content`,className:I(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));U.displayName=`FieldContent`;const W=k(({className:e,...t})=>P(`div`,{"data-slot":`field-content-main`,className:I(`relative`,e),...t}));W.displayName=`FieldContentMain`;const G=k(({className:e,...t})=>P(je,{"data-slot":`field-label`,className:I(`group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));G.displayName=`FieldLabel`;const K=k(({className:e,...t})=>P(`div`,{"data-slot":`field-label`,className:I(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));K.displayName=`FieldTitle`;const q=k(({className:e,...t})=>P(`p`,{"data-slot":`field-description`,className:I(`nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));q.displayName=`FieldDescription`;const J=k(({isShow:e=!0,className:t,children:n,...r})=>e===!1?null:F(`div`,{"data-slot":`field-note`,className:I(`flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs`,t),...r,children:[P(ue,{size:12,className:`mt-0.5 shrink-0 text-primary/70`}),P(`span`,{children:n})]}));J.displayName=`FieldNote`;const Y=k(({tooltip:e})=>F(r,{children:[P(t,{asChild:!0,children:F(`button`,{type:`button`,tabIndex:-1,className:`inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none`,children:[P(le,{size:13,"aria-hidden":`true`}),P(`span`,{className:`sr-only`,children:`More information`})]})}),P(n,{side:`top`,className:`max-w-xs text-balance`,children:e})]}));Y.displayName=`FieldTooltip`;const X=k(({children:e,className:t,...n})=>F(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:I(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...n,children:[P(i,{className:`absolute inset-0 top-1/2`}),e&&P(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));X.displayName=`FieldSeparator`;const Z=k(({className:e,children:t,errors:n,...r})=>{let i=M(()=>t||(n?n?.length===1&&n[0]?.message?P(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:P(`p`,{children:n[0]?.code===`invalid_type`?`Invalid format`:n[0].message})}):P(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?P(`li`,{children:e},e):e?.message?P(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?P(`div`,{role:`alert`,"data-slot":`field-error`,className:I(`w-full font-medium text-danger-strong text-xs`,e),...r,children:i}):null});Z.displayName=`FieldError`;const Fe=({label:e,description:t,options:n,tooltip:r,helperText:i,orientation:a})=>{let o=Q(),s=B(o.form.store,({isSubmitting:e})=>e);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:a,children:[F(U,{children:[F(G,{children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t}),P(J,{isShow:!!i,children:i})]}),P(W,{children:P(V,{className:`flex flex-col gap-y-2`,children:n.map(e=>F(H,{orientation:`horizontal`,children:[P(_,{id:`${o.name}-${e.value}`,name:o.name,checked:o.state.value?.includes(e.value)??!1,disabled:s,onCheckedChange:t=>{if(t&&o.state.value!==null)o.pushValue(e.value);else if(t&&o.state.value===null)o.setValue([e.value]);else if(!t&&o.state.value!==null){let t=o.state.value.indexOf(e.value);t>-1&&o.removeValue(t)}else o.setValue(null)}}),P(G,{htmlFor:`${o.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),P(X,{})]})},Ie=({label:t,description:n,placeholder:r,tooltip:i,orientation:a=`responsive`,options:o})=>{let s=Q(),c=M(()=>s.state.meta.isTouched&&!s.state.meta.isValid,[s.state.meta.isTouched,s.state.meta.isValid]),l=M(()=>s.state.meta.errors,[s.state.meta.errors]),u=o.find(({value:e})=>e===s.state.value)?.label;return F(V,{className:`px-4`,children:[F(H,{orientation:a,"data-invalid":c,children:[F(U,{children:[F(G,{htmlFor:s.name,children:[t,i&&P(Y,{tooltip:i})]}),P(q,{children:n})]}),P(W,{className:`flex justify-end`,children:F(`div`,{className:`flex w-full max-w-60 flex-col`,children:[F(x,{children:[P(y,{asChild:!0,children:P(e,{variant:`outline`,color:`muted`,size:`lg`,className:I(`flex items-center justify-start rounded outline-border`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:text-text-positive-muted data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,!s.state.value&&`text-text-positive-muted`),children:u?P(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-start`,children:u}):P(`p`,{className:`flex-1 text-start text-text-positive-muted`,children:r})})}),P(b,{align:`end`,side:`bottom`,className:`flex w-fit rounded p-0`,onBlur:s.handleBlur,children:F(g,{className:`border-none`,children:[P(d,{placeholder:r??`Search…`}),P(h,{children:P(f,{className:`max-h-40 overflow-y-auto`,children:o.map(({value:e,label:t})=>P(p,{value:t,onSelect:()=>s.handleChange(e),children:t},e))})}),P(m,{children:`No results found.`})]})})]}),P(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:P(Z,{errors:l})})]})})]}),P(X,{})]})},Le=({label:t,description:n,placeholder:r,orientation:i=`responsive`,tooltip:a,helperText:o,minDate:s,maxDate:c,required:l})=>{let u=Q(),d=M(()=>l?u.state.value===null:!1,[l,u.state.value]),f=M(()=>u.state.meta.isTouched&&!u.state.meta.isValid,[u.state.meta.isTouched,u.state.meta.isValid]);return F(V,{className:`px-4`,children:[F(H,{orientation:i,"data-invalid":f,children:[F(U,{children:[F(G,{htmlFor:u.name,"aria-required":d,children:[t,a&&P(Y,{tooltip:a})]}),P(q,{children:n})]}),F(W,{className:`flex flex-col space-y-1`,children:[P(`div`,{className:`flex w-full flex-col`,children:F(x,{children:[P(y,{asChild:!0,children:F(e,{variant:`outline`,color:`muted`,size:`lg`,className:I(`flex items-center justify-between rounded font-normal outline-border`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-1`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-4`,`data-[state=open]:ring-primary-weak`,u.state.value===null&&`text-text-positive-muted`),children:[P(`p`,{children:u.state.value===null?r||`Select date`:xe(u.state.value,`PPPP`)}),P(oe,{strokeWidth:1})]})}),F(b,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:u.handleBlur,children:[F(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(L())},children:`Today`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(ye())},children:`Tomorrow`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(be())},children:`Yesterday`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(R(L(),3))},children:`Last 3 Days`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(R(L(),7))},children:`Last 7 Days`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(R(L(),30))},children:`Last 30 Days`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(Ce(L()))},children:`This Month`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(Se(L()))},children:`Last Month`})]}),P(`div`,{className:`flex flex-1 flex-col`,children:P(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:P(D,{mode:`single`,selected:u.state.value??void 0,hidden:{before:s??new Date(1900,0,1),after:c??new Date(2100,11,31)},onSelect:e=>{e&&u.handleChange(e)}})})})]})]})}),P(J,{isShow:!!o,children:o})]})]}),P(X,{})]})},Re=({label:e,description:t,placeholder:n,tooltip:r,helperText:i,orientation:a=`responsive`,showErrorMessage:o=!0,required:s=!1,maxLength:c})=>{let{form:l,name:u,state:d,handleBlur:f,handleChange:p}=Q(),m=B(l.store,({isSubmitting:e})=>e),h=d.meta.isDirty&&d.meta.isTouched&&!d.meta.isValid,g=s&&d.value===null,_=!m&&!!d.value,y=A(({target:{value:e}})=>{m||c&&e.length>c||p(e||null)},[m,c,p]),b=A(()=>{m||p(null)},[m,p]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{"data-invalid":h,orientation:a,children:[F(U,{children:[F(G,{htmlFor:u,"aria-required":g,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[P(v,{id:u,name:u,value:d.value===null?``:d.value,"aria-invalid":h,autoComplete:`email`,placeholder:n,className:I(`pl-9`,_&&`pr-9`,m&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:f,onChange:y}),P(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:P(ie,{size:14})}),_&&P(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong`,onClick:b,children:P(he,{size:14,"aria-hidden":`true`})}),P(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:o&&d.meta.isDirty&&P(Z,{errors:d.meta.errors})}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})},ze=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,Be=e=>Number(e).toLocaleString(),Ve=(e,t,n)=>{if(n===`none`)return e;let r=10**t,i=e*r;switch(n){case`up`:return Math.ceil(i)/r;case`down`:return Math.floor(i)/r;case`nearest`:return i%1<.1?Math.floor(i)/r:i%1>=.59?Math.ceil(i)/r:(Math.floor(i)+.5)/r;default:return e}},He=({disabled:e=!1,readOnly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:a=null,unitText:o,decimal:s,placeholder:c,precision:l,wrapperClassName:u,className:d,onChange:f,onValueChange:p,onFocus:m,onBlur:h,...g})=>{let _=N(null),y=N(null),[b,x]=_e(a?.toString()??null),S=M(()=>s?.[1]??r,[s,r]),C=M(()=>s&&s[0]-s[1],[s]),w=M(()=>ze(n),[n]),T=A(e=>{if(!S||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=S&&r<=(C??1/0)},[S,C]),E=A(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=Ve(parseFloat(e),Math.min(S-1,l||0),i).toString().split(`.`),r=Be(t);return n?`${r}.${n}`:r},[S,l,i]),D=A(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){p?.(0),x(e);return}if(n){x(()=>(p?.(0),e));return}},[p]),O=A(e=>{f?.(e);let{value:t}=e.target;if(t===``||t===void 0){p?.(null),x(null);return}D(t),!(!w.test(t)||!T(t))&&(p?.(parseFloat(t)||0),x(t))},[T,f,p,D,w]),ee=A(e=>{t||(m?.(e),x(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,m]),te=A(e=>{t||(h?.(e),x(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?E(e):null))},[t,E,h]);return ge(()=>{let e=document.activeElement===y.current;if(a==null||!w.test(a.toString())||!T(a.toString())){x(null);return}x(t=>e?t:E(a.toString()))},[E,a,T,w]),ge(()=>{if(!_.current||!y.current||!o)return;let e=_.current.offsetWidth;y.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[o]),F(`div`,{className:I(`relative`,u),children:[P(v,{...g,ref:y,value:b||(t?`0`:``),placeholder:c,disabled:e,readOnly:t,className:I(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,d),onChange:O,onFocus:ee,onBlur:te}),o&&P(`span`,{ref:_,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:o})]})},Ue=({label:e,description:t,placeholder:n,tooltip:r,helperText:i,orientation:a=`responsive`,showErrorMessage:o=!0,rounding:s,decimalPlaces:c,percision:l,unit:u,required:d,allowNegative:f})=>{let p=Q(),m=B(p.form.store,({isSubmitting:e})=>e),h=p.state.meta.errors,g=d?p.state.value===null:!1,_=A(e=>{m||p.handleChange(e)},[m,p.handleChange]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:a,"data-invalid":p.state.meta.isTouched&&!p.state.meta.isValid,children:[F(U,{children:[F(G,{htmlFor:p.name,"aria-required":g,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[F(`div`,{className:`relative w-full`,children:[P(He,{id:p.name,value:p.state.value,"aria-invalid":p.state.meta.isTouched&&!p.state.meta.isValid&&p.state.meta.isDirty,placeholder:n,roundingRule:s,numberAfterDecimalPoint:c,precision:l,unitText:u,allowNegative:f,className:I(m&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:p.handleBlur,onValueChange:_}),m&&P(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:P(de,{className:`animate-spin text-primary-strong`})}),p.state.meta.isDirty&&o&&!!h.length&&P(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:P(ae,{})}),P(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:p.state.meta.isDirty&&o&&P(Z,{errors:h})})]}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})},We=({label:e,description:t,placeholder:n,orientation:r=`responsive`,tooltip:i,helperText:a,showErrorMessage:o=!0})=>{let s=j(),{form:c,name:l,state:u,handleBlur:d,handleChange:f}=Q(),p=B(c.store,({isSubmitting:e})=>e),[m,h]=_e(!1),g=u.meta.isDirty&&u.meta.isTouched&&!u.meta.isValid,_=A(()=>h(e=>!e),[]),y=A(({target:{value:e}})=>{p||f(e||null)},[p,f]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{"data-invalid":g,orientation:r,children:[F(U,{children:[F(G,{htmlFor:s,children:[e,i&&P(Y,{tooltip:i})]}),P(q,{children:t})]}),F(W,{children:[P(v,{id:s,name:l,type:m?`text`:`password`,placeholder:n,value:u.value??``,"aria-invalid":g,autoComplete:`new-password`,onBlur:d,onChange:y}),P(`button`,{className:`absolute inset-e-0 inset-y-0 flex size-9 items-center justify-center rounded-e-md text-muted outline-none transition-[color,box-shadow] focus:z-10 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,onClick:_,"aria-label":m?`Hide password`:`Show password`,"aria-pressed":m,"aria-controls":s,children:P(m?ce:se,{size:16,"aria-hidden":`true`})}),P(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:o&&u.meta.isDirty&&P(Z,{errors:u.meta.errors})}),P(J,{isShow:!!a,children:a})]})]}),P(X,{})]})},Ge=({label:e,description:t,orientation:n,options:r,tooltip:i,helperText:a})=>{let o=Q(),s=B(o.form.store,({isSubmitting:e})=>e);return F(V,{className:`px-4`,children:[F(H,{orientation:n,className:`flex-col gap-2`,children:[F(U,{children:[F(G,{children:[e,i&&P(Y,{tooltip:i})]}),P(q,{children:t}),P(J,{isShow:!!a,children:a})]}),P(W,{children:P(ee,{value:o.state.value??``,className:`w-full`,onValueChange:o.handleChange,children:r.map(e=>P(G,{className:I(`h-fit`,o.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,s&&`pointer-events-none bg-muted-muted opacity-60`,o.state.value===e.value&&s&&`border-border-strong!`),children:F(H,{orientation:`horizontal`,className:`items-start gap-3 rounded p-2!`,children:[P(O,{value:e.value,className:`mt-0.5 shrink-0`}),F(U,{className:`gap-0.5!`,children:[P(K,{children:e.label}),P(q,{className:`text-xs`,children:e.description})]})]})},e.value))})})]}),P(X,{})]})},Ke=({label:e,description:t,placeholder:n,orientation:r=`responsive`,tooltip:i,options:a,helperText:o,required:s=!1})=>{let c=Q(),l=c.state.meta.isTouched&&!c.state.meta.isValid,u=s&&c.state.value===null,d=c.state.meta.errors;return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:r,"data-invalid":l,children:[F(U,{children:[F(G,{htmlFor:c.name,"aria-required":u,children:[e,i&&P(Y,{tooltip:i})]}),P(q,{children:t})]}),F(W,{className:`flex flex-col`,children:[F(E,{value:c.state.value??``,onValueChange:c.handleChange,children:[P(T,{"aria-invalid":l?`true`:void 0,onBlur:c.handleBlur,children:P(S,{placeholder:n})}),F(w,{children:[!!a.length&&a.map(e=>P(C,{value:e.value,children:e.label},e.value)),!a.length&&F(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[P(fe,{strokeWidth:1}),`No options available`]})]})]}),P(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:P(Z,{errors:d})}),P(J,{isShow:!!o,children:o})]})]}),P(X,{})]})};function qe({className:e,...t}){return P(Ee.Root,{"data-slot":`switch`,className:I(`peer`,`w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all`,`inline-flex h-5`,`focus-visible:border-primary-strong`,`focus-visible:ring-primary-weak`,`focus-visible:ring-4`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`-outline-offset-1 inset-shadow-2xs outline-1`,`data-[state=checked]:bg-primary`,`data-[state=checked]:outline-primary-strong`,`data-[state=unchecked]:bg-muted-weak`,`data-[state=unchecked]:outline-border`,`data-[state=unchecked]:[&_span]:size-4`,`data-[state=unchecked]:[&_span]:translate-x-0.5`,`data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5`,e),...t,children:P(Ee.Thumb,{"data-slot":`switch-thumb`,className:I(`block size-4 bg-card shadow-xs`,`pointer-events-none rounded-full ring-0 transition-transform`,`data-[state=checked]:translate-x-[calc(100%-3px)]`,`data-[state=unchecked]:translate-x-0`)})})}const Je=({label:e,description:t,helperText:n})=>{let r=Q();return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[F(U,{children:[P(K,{className:`cursor-pointer`,children:P(`label`,{htmlFor:r.name,children:e})}),P(q,{children:t}),P(qe,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),P(J,{isShow:!!n,children:n})]}),P(X,{})]})},Ye=({label:e,description:t,placeholder:n,tooltip:r,helperText:i,counter:a=!1,orientation:o=`responsive`,showClearButton:s=!1,showErrorMessage:c=!0,required:l=!1,maxLength:u})=>{let d=j(),f=N(null),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=Q(),y=B(p.store,({isSubmitting:e})=>e),b=s&&!y&&!!h.value,x=h.value?h.value.length:0,S=M(()=>{if(!a)return``;let e=`character${[0,1].includes(x)?``:`s`}`;return a&&u?`${x} / ${u} character${x?`s`:``}`:`${x} ${e}`},[x,a,u]),C=h.meta.isDirty&&h.meta.isTouched&&!h.meta.isValid,w=l&&h.value===null,T=u&&x>=u*.8,E=u&&x>=u,D=A(({target:{value:e}})=>{y||a&&u&&e.length>u||_(e||null)},[y,a,u,_]),O=A(()=>{y||(_(null),f.current?.focus())},[y,_]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:o,"data-invalid":C,children:[F(U,{children:[F(G,{"aria-required":w,htmlFor:d,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[P(v,{ref:f,id:d,name:m,value:h.value??``,"aria-invalid":C,autoComplete:`off`,placeholder:n,autoCapitalize:`none`,autoCorrect:`off`,className:I(`pr-6`,y&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:g,onChange:D}),b&&P(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-intense [&>svg]:size-3.5`,onClick:O,children:P(he,{"aria-hidden":`true`})}),y&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:P(de,{size:14,className:`animate-spin text-primary-strong`})}),!b&&h.meta.isDirty&&c&&!!h.meta.errors.length&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:P(ae,{"aria-hidden":`true`,size:14})}),F(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[h.meta.isDirty&&c?P(Z,{className:`flex-1`,errors:h.meta.errors}):P(`div`,{}),!!a&&P(`p`,{className:I(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,E?`font-medium text-danger-strong`:T?`text-warning-strong`:`text-text-positive-weak`),children:S})]}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})},Xe=k(({label:e,description:t,placeholder:n,tooltip:r,helperText:i,counter:a=!1,orientation:o=`responsive`,showErrorMessage:s=!0,required:c=!1,maxLength:l})=>{let u=j(),{form:d,state:f,name:p,handleBlur:m,handleChange:h}=Q(),g=B(d.store,({isSubmitting:e})=>e),_=f.value?f.value.length:0,v=M(()=>{if(!a)return``;let e=`character${[0,1].includes(_)?``:`s`}`;return a&&l?`${_} / ${l} character${_?`s`:``}`:`${_} ${e}`},[_,a,l]),y=f.meta.isDirty&&f.meta.isTouched&&!f.meta.isValid,b=c&&f.value===null,x=f.meta.errors,S=l&&_>=l*.8,C=l&&_>=l,w=A(({target:{value:e}})=>{g||a&&l&&e.length>l||h(e||null)},[g,a,l,h]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:o,"data-invalid":y,children:[F(U,{children:[F(G,{"aria-required":b,htmlFor:u,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),F(W,{children:[P(te,{id:u,name:p,value:f.value===null?``:f.value,"aria-invalid":y,autoCapitalize:`none`,autoComplete:`off`,placeholder:n,className:I(g&&`pointer-events-none bg-muted-muted opacity-60`),onChange:w,onBlur:m}),g&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:P(de,{size:14,className:`animate-spin text-primary-strong`})}),f.meta.isDirty&&s&&!!x.length&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:P(ae,{size:14})}),F(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[f.meta.isDirty&&s?P(Z,{className:`flex-1`,errors:f.meta.errors}):P(`div`,{}),!!a&&P(`p`,{className:I(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,C?`font-medium text-danger-strong`:S?`text-warning-strong`:`text-text-positive-weak`),children:v})]}),P(J,{isShow:!!i,children:i})]})]}),P(X,{})]})});Xe.displayName=`TextareaField`;const Ze=k(({label:e,description:t,placeholder:n,tooltip:r,helperText:i,showErrorMessage:a=!0,required:o=!1})=>{let{form:s,state:c,handleChange:l}=Q(),u=B(s.store,({isSubmitting:e})=>e),d=c.meta.isDirty&&c.meta.isTouched&&!c.meta.isValid,f=o&&c.value===null,p=A(e=>{u||l(e||null)},[u,l]);return F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:`vertical`,"data-invalid":d,children:[F(U,{children:[F(G,{"aria-required":f,children:[e,r&&P(Y,{tooltip:r})]}),P(q,{children:t})]}),P(ne,{value:c.value??``,placeholder:n,readOnly:u,onChange:p}),c.meta.isDirty&&a&&!!c.meta.errors.length&&P(Z,{errors:c.meta.errors}),P(J,{isShow:!!i,children:i})]}),P(X,{})]})});Ze.displayName=`TextEditorField`;const Qe=({label:t,className:n})=>{let r=$(),i=A(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return P(r.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:r,isSubmitting:a})=>P(e,{type:`button`,size:`md`,disabled:r,isLoading:a,className:I(`min-h-8 min-w-32`,n),onClick:i,children:t??`Submit`})})},$e=({type:t=`create`})=>{let n=$();return F(`div`,{className:`flex h-8 items-center justify-between`,children:[P(n.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:t})=>P(e,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:t,className:`h-full min-w-32`,onClick:()=>n.reset(),children:`Cancel`})}),t===`create`&&P(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:t,isSubmitting:r})=>F(e,{type:`submit`,size:`md`,disabled:t,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`create`}),n.state.isSubmitSuccessful&&n.reset()},children:[P(pe,{}),`Add New`]})}),t===`update`&&P(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:t,isSubmitting:r})=>F(e,{type:`submit`,size:`md`,disabled:t,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`update`}),n.state.isSubmitSuccessful&&n.reset()},children:[P(re,{}),`Update`]})})]})};function et({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return P(Te.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:I(`shrink-0 bg-border-weak`,`data-[orientation=horizontal]:h-px`,`data-[orientation=horizontal]:w-full`,`data-[orientation=vertical]:h-full`,`data-[orientation=vertical]:w-px`,e),...r})}const tt=({title:t,description:n,onDelete:r,children:i})=>F(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-1 ring-border`,children:[F(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-0.5 px-4 py-3`,children:[P(`p`,{className:`font-semibold text-base tracking-tight`,children:t}),!!n&&P(`p`,{className:`text-text-positive-weak text-sm`,children:n})]}),P(et,{}),P(`div`,{"data-slot":`card-form-main`,className:`flex flex-col py-4`,children:i}),!!r&&F(e,{color:`danger`,variant:`ghost`,size:`sm`,className:`absolute top-2.5 right-3`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[P(me,{}),`Remove`]})]}),nt=({children:e})=>P(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),rt=({disabled:t,className:n,onClick:r,children:i})=>P(e,{type:`button`,variant:`outline`,color:`muted`,disabled:t,className:I(`min-w-40`,n),onClick:r,children:i??`Cancel`}),it=({isSubmitting:t,submitText:n=`Submit`,disabled:r,className:i,onClick:a})=>P(e,{type:`button`,isLoading:t,disabled:r||t,className:I(`min-w-40`,i),onClick:a,children:n}),at=({title:e,submitText:t,open:n,onOpenChange:r,children:a})=>{let d=$(),f=A(e=>{e||d.reset(),r?.(e)},[d.reset,r]);return P(u,{open:n,onOpenChange:f,children:F(o,{"data-slot":`dialog-portal`,children:[P(l,{}),F(c,{className:`flex size-full max-h-dvh max-w-dvw flex-col gap-0 overflow-y-auto p-0 shadow-dialog sm:h-auto sm:max-h-[85dvh] sm:max-w-2xl sm:rounded-md`,children:[P(`div`,{"data-slot":`dialog-header`,className:`flex items-center justify-center gap-2 px-6 py-5 text-center sm:text-left`,children:P(s,{"data-slot":`dialog-title`,className:`text-lg font-semibold tracking-tight`,children:e})}),P(i,{}),P(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col overflow-y-auto p-0 pt-4 max-sm:flex-1 sm:p-4`,children:a}),P(i,{}),F(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-end gap-2 px-6 py-4 sm:flex-row max-sm:[&>button]:w-full`,children:[P(d.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>P(rt,{disabled:e,onClick:()=>{d.reset(),f(!1)}})}),P(d.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:n})=>P(it,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>d.handleSubmit()})})]})]})]})})},ot=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>F(V,{className:`gap-y-4 px-4`,children:[F(H,{orientation:r,children:[F(U,{children:[P(G,{children:e}),P(q,{children:t})]}),F(W,{children:[i,P(J,{isShow:!!n,children:n})]})]}),P(X,{})]}),st=({title:e,open:t,contentClassName:n,onOpenChange:r,children:i})=>{let o=$();return P(z.Root,{"data-slot":`dialog`,open:t,onOpenChange:r,children:F(z.Portal,{"data-slot":`dialog-portal`,children:[P(z.Overlay,{"data-slot":`dialog-overlay`,className:I(`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm`,`data-[state=open]:animate-in data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:fade-out`)}),P(z.Content,{"data-slot":`dialog-content`,className:I(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background shadow-lg ring-1 ring-border`,`duration-300`,`data-[state=open]:animate-in data-[state=open]:slide-in-from-right data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=closed]:fade-out`),children:F(`section`,{className:`relative flex size-full flex-col`,children:[P(`header`,{className:`flex h-14 shrink-0 items-center border-b border-border px-5`,children:P(`h2`,{className:`font-semibold text-base tracking-tight text-text-positive`,children:e})}),P(`div`,{className:I(`flex flex-1 flex-col overflow-y-auto py-4`,n),children:i}),F(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border px-4 py-3`,children:[P(o.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>P(it,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),P(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>P(rt,{disabled:e,className:`w-full`,onClick:()=>{o.reset(),r?.(!1)}})})]}),P(z.Close,{asChild:!0,children:P(a,{className:`absolute top-2.5 right-3`})})]})})]})})},ct=({children:e})=>P(`header`,{"data-slot":`section-header`,className:`flex items-center px-4 py-3 font-semibold text-base text-text-positive tracking-tight`,children:e}),lt=({children:e})=>P(`main`,{"data-slot":`section-main`,className:`relative flex flex-col py-4`,children:e}),ut=({title:e,children:t})=>F(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-1 ring-border`,children:[P(ct,{children:e}),P(et,{}),P(lt,{children:t})]}),dt=({title:e,description:t,helperText:n})=>F(V,{className:`gap-y-4 px-4`,children:[F(H,{className:`gap-0`,children:[F(U,{children:[P(Pe,{className:`mb-1`,children:e}),P(q,{children:t})]}),P(J,{isShow:!!n,children:n})]}),P(X,{})]}),{fieldContext:ft,formContext:pt,useFieldContext:Q,useFormContext:$}=Oe(),{useAppForm:mt,withForm:ht,withFieldGroup:gt}=De({fieldContext:ft,formContext:pt,fieldComponents:{TextField:Ye,TextareaField:Xe,TextEditorField:Ze,NumberField:Ue,EmailField:Re,PasswordField:We,SelectField:Ke,ComboboxField:Ie,DateField:Le,SwitchField:Je,RadioGroupField:Ge,CheckboxField:Fe,FieldGroup:V,Field:H,FieldContent:U,FieldLabel:G,FieldContentMain:W,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:at,TanStackPopoverForm:st,TanStackContainerForm:nt,TanStackSectionForm:ut,TanStackCardForm:tt,TanStackFieldGroup:ot,TanStackTitleField:dt,TanStackActionsForm:$e,TanStackActionSubmit:Qe}});export{ht as a,W as c,G as d,X as f,gt as i,Z as l,mt as n,H as o,$ as r,U as s,Q as t,V as u};
2
+ //# sourceMappingURL=tanstack-form-C1EVQJ-n.mjs.map