@customafk/lunas-ui 0.2.4 → 0.2.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 (344) hide show
  1. package/dist/{button-Bo4oQsyD.d.mts → button-B5a1UlC_.d.mts} +4 -4
  2. package/dist/button-Cd7YtPlT.cjs +2 -0
  3. package/dist/button-Cd7YtPlT.cjs.map +1 -0
  4. package/dist/button-D8BUqpI2.mjs +2 -0
  5. package/dist/button-D8BUqpI2.mjs.map +1 -0
  6. package/dist/{button-BX8Kz9y6.d.cts → button-DYZCqN6A.d.cts} +6 -6
  7. package/dist/button.variants-B_dFX3i2.mjs +2 -0
  8. package/dist/button.variants-B_dFX3i2.mjs.map +1 -0
  9. package/dist/button.variants-aqkTmzFu.cjs +2 -0
  10. package/dist/button.variants-aqkTmzFu.cjs.map +1 -0
  11. package/dist/{calendar-CfOkrubO.mjs → calendar-B-PDpHK5.mjs} +2 -2
  12. package/dist/{calendar-CfOkrubO.mjs.map → calendar-B-PDpHK5.mjs.map} +1 -1
  13. package/dist/{calendar-CG-WMM8e.cjs → calendar-Cq3_5u0k.cjs} +2 -2
  14. package/dist/{calendar-CG-WMM8e.cjs.map → calendar-Cq3_5u0k.cjs.map} +1 -1
  15. package/dist/cards/grid-product-card.cjs +1 -1
  16. package/dist/cards/grid-product-card.mjs +1 -1
  17. package/dist/cards/product-card.cjs +1 -1
  18. package/dist/cards/product-card.mjs +1 -1
  19. package/dist/cards/simple-card.cjs +1 -1
  20. package/dist/cards/simple-card.d.mts +2 -2
  21. package/dist/cards/simple-card.mjs +1 -1
  22. package/dist/{command-DhBTNTqz.mjs → command-Bma4ivZz.mjs} +2 -2
  23. package/dist/{command-DhBTNTqz.mjs.map → command-Bma4ivZz.mjs.map} +1 -1
  24. package/dist/{command-_zpTaaIk.cjs → command-IfPmQiyJ.cjs} +2 -2
  25. package/dist/{command-_zpTaaIk.cjs.map → command-IfPmQiyJ.cjs.map} +1 -1
  26. package/dist/data-display/country.cjs +1 -1
  27. package/dist/data-display/country.mjs +1 -1
  28. package/dist/data-display/data-list.cjs +1 -1
  29. package/dist/data-display/data-list.mjs +1 -1
  30. package/dist/data-display/date-tooltip.cjs +1 -1
  31. package/dist/data-display/date-tooltip.mjs +1 -1
  32. package/dist/data-display/date.cjs +1 -1
  33. package/dist/data-display/date.mjs +1 -1
  34. package/dist/data-display/empty.cjs +1 -1
  35. package/dist/data-display/empty.d.mts +2 -2
  36. package/dist/data-display/empty.mjs +1 -1
  37. package/dist/data-display/name.cjs +1 -1
  38. package/dist/data-display/name.mjs +1 -1
  39. package/dist/data-display/role-badge.cjs +1 -1
  40. package/dist/data-display/role-badge.mjs +1 -1
  41. package/dist/data-display/statistic.cjs +1 -1
  42. package/dist/data-display/statistic.d.cts +2 -2
  43. package/dist/data-display/statistic.d.mts +4 -4
  44. package/dist/data-display/statistic.mjs +1 -1
  45. package/dist/data-display/user.cjs +1 -1
  46. package/dist/data-display/user.mjs +1 -1
  47. package/dist/{date-em5f7hCx.cjs → date-WraHGsbb.cjs} +2 -2
  48. package/dist/{date-em5f7hCx.cjs.map → date-WraHGsbb.cjs.map} +1 -1
  49. package/dist/{date-By93kONr.mjs → date-uVTm7J09.mjs} +2 -2
  50. package/dist/{date-By93kONr.mjs.map → date-uVTm7J09.mjs.map} +1 -1
  51. package/dist/{dialog-CxELDK98.mjs → dialog-B50k7HnL.mjs} +2 -2
  52. package/dist/{dialog-CxELDK98.mjs.map → dialog-B50k7HnL.mjs.map} +1 -1
  53. package/dist/{dialog-DjRiV5vR.cjs → dialog-BoNhIQYJ.cjs} +2 -2
  54. package/dist/{dialog-DjRiV5vR.cjs.map → dialog-BoNhIQYJ.cjs.map} +1 -1
  55. package/dist/{dialog-aSu9xFOW.d.cts → dialog-CuZxUWfc.d.cts} +12 -12
  56. package/dist/{dialog-PWeGBpsm.d.mts → dialog-D4LnpcNL.d.mts} +12 -12
  57. package/dist/dialogs/confirm-dialog.cjs +1 -1
  58. package/dist/dialogs/confirm-dialog.mjs +1 -1
  59. package/dist/dialogs/detail-dialog/components/sidebar.cjs +1 -1
  60. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +26 -26
  61. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
  62. package/dist/dialogs/detail-dialog/components/sidebar.mjs +1 -1
  63. package/dist/dialogs/detail-dialog/index.cjs +1 -1
  64. package/dist/dialogs/detail-dialog/index.mjs +1 -1
  65. package/dist/dialogs/error-dialog.cjs +1 -1
  66. package/dist/dialogs/error-dialog.mjs +1 -1
  67. package/dist/dialogs/loading-dialog.cjs +1 -1
  68. package/dist/dialogs/loading-dialog.mjs +1 -1
  69. package/dist/dist-DP1ehOL8.mjs +2 -0
  70. package/dist/{dist-CvmzZ_6C.mjs.map → dist-DP1ehOL8.mjs.map} +1 -1
  71. package/dist/dist-Q1UyT_bc.cjs +2 -0
  72. package/dist/{dist-BudM04oj.cjs.map → dist-Q1UyT_bc.cjs.map} +1 -1
  73. package/dist/features/descriptions/index.cjs +1 -1
  74. package/dist/features/descriptions/index.d.cts +4 -4
  75. package/dist/features/descriptions/index.d.mts +1 -1
  76. package/dist/features/descriptions/index.mjs +1 -1
  77. package/dist/features/search-modal/index.cjs +1 -1
  78. package/dist/features/search-modal/index.d.cts +2 -2
  79. package/dist/features/search-modal/index.d.mts +2 -2
  80. package/dist/features/search-modal/index.mjs +1 -1
  81. package/dist/features/tables/index.cjs +1 -1
  82. package/dist/features/tables/index.d.cts +1 -1
  83. package/dist/features/tables/index.d.mts +23 -23
  84. package/dist/features/tables/index.mjs +1 -1
  85. package/dist/features/tables/index.mjs.map +1 -1
  86. package/dist/features/tanstack-form/index.cjs +1 -1
  87. package/dist/features/tanstack-form/index.d.cts +278 -278
  88. package/dist/features/tanstack-form/index.d.mts +278 -278
  89. package/dist/features/tanstack-form/index.mjs +1 -1
  90. package/dist/features/tanstack-form/index.mjs.map +1 -1
  91. package/dist/{flex-twCgWyx1.cjs → flex-BsoSgWFN.cjs} +2 -2
  92. package/dist/{flex-twCgWyx1.cjs.map → flex-BsoSgWFN.cjs.map} +1 -1
  93. package/dist/{flex-BP8sTi70.mjs → flex-CeizYtXs.mjs} +2 -2
  94. package/dist/{flex-BP8sTi70.mjs.map → flex-CeizYtXs.mjs.map} +1 -1
  95. package/dist/heading-BEbpIiLg.cjs +2 -0
  96. package/dist/heading-BEbpIiLg.cjs.map +1 -0
  97. package/dist/heading-CrF1CFWS.mjs +2 -0
  98. package/dist/heading-CrF1CFWS.mjs.map +1 -0
  99. package/dist/{image-DuFv8sPr.cjs → image-BBZUipoU.cjs} +2 -2
  100. package/dist/{image-DuFv8sPr.cjs.map → image-BBZUipoU.cjs.map} +1 -1
  101. package/dist/image-CZji4Q26.mjs +2 -0
  102. package/dist/{image-CS_Q0WA7.mjs.map → image-CZji4Q26.mjs.map} +1 -1
  103. package/dist/{input-BFWWaN-v.cjs → input-BoMJaF_N.cjs} +2 -2
  104. package/dist/{input-BFWWaN-v.cjs.map → input-BoMJaF_N.cjs.map} +1 -1
  105. package/dist/{input-DBtIgQB6.mjs → input-DMjPBcJO.mjs} +2 -2
  106. package/dist/{input-DBtIgQB6.mjs.map → input-DMjPBcJO.mjs.map} +1 -1
  107. package/dist/{input-DhQmoNrK.d.cts → input-DszdZdbJ.d.cts} +6 -6
  108. package/dist/{input-BgHvD7zf.d.mts → input-Dv7UKl6Z.d.mts} +6 -6
  109. package/dist/layouts/cms-layout/index.cjs +1 -1
  110. package/dist/layouts/cms-layout/index.mjs +1 -1
  111. package/dist/layouts/flex.cjs +1 -1
  112. package/dist/layouts/flex.d.cts +6 -6
  113. package/dist/layouts/flex.d.mts +8 -8
  114. package/dist/layouts/flex.mjs +1 -1
  115. package/dist/layouts/payment-layout/index.cjs +1 -1
  116. package/dist/layouts/payment-layout/index.mjs +1 -1
  117. package/dist/pages/FeatureDeveloping.cjs +1 -1
  118. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  119. package/dist/pages/FeatureDeveloping.mjs +1 -1
  120. package/dist/pages/FeatureFixing.cjs +1 -1
  121. package/dist/pages/FeatureFixing.d.cts +2 -2
  122. package/dist/pages/FeatureFixing.d.mts +2 -2
  123. package/dist/pages/FeatureFixing.mjs +1 -1
  124. package/dist/pages/NotAuthorized.cjs +1 -1
  125. package/dist/pages/NotAuthorized.d.cts +2 -2
  126. package/dist/pages/NotAuthorized.d.mts +2 -2
  127. package/dist/pages/NotAuthorized.mjs +1 -1
  128. package/dist/pages/NotFound.cjs +1 -1
  129. package/dist/pages/NotFound.d.cts +2 -2
  130. package/dist/pages/NotFound.d.mts +2 -2
  131. package/dist/pages/NotFound.mjs +1 -1
  132. package/dist/paragraph-Co2e-y5c.cjs +2 -0
  133. package/dist/paragraph-Co2e-y5c.cjs.map +1 -0
  134. package/dist/paragraph-DmiXlAnE.mjs +2 -0
  135. package/dist/paragraph-DmiXlAnE.mjs.map +1 -0
  136. package/dist/{resizable-mlGS6Zto.cjs → resizable-B8tRShQI.cjs} +2 -2
  137. package/dist/{resizable-mlGS6Zto.cjs.map → resizable-B8tRShQI.cjs.map} +1 -1
  138. package/dist/{resizable-DXHfkbaz.mjs → resizable-RPObV6jc.mjs} +2 -2
  139. package/dist/{resizable-DXHfkbaz.mjs.map → resizable-RPObV6jc.mjs.map} +1 -1
  140. package/dist/systems/google.cjs +1 -1
  141. package/dist/systems/google.mjs +1 -1
  142. package/dist/{textarea-COQoSVSc.cjs → textarea-Dlwbg6TY.cjs} +2 -2
  143. package/dist/{textarea-COQoSVSc.cjs.map → textarea-Dlwbg6TY.cjs.map} +1 -1
  144. package/dist/{textarea-bLtmb71c.mjs → textarea-RjL2DtNf.mjs} +2 -2
  145. package/dist/{textarea-bLtmb71c.mjs.map → textarea-RjL2DtNf.mjs.map} +1 -1
  146. package/dist/typography/paragraph.cjs +1 -1
  147. package/dist/typography/paragraph.d.cts +8 -18
  148. package/dist/typography/paragraph.d.mts +10 -20
  149. package/dist/typography/paragraph.mjs +1 -1
  150. package/dist/typography/title.cjs +1 -1
  151. package/dist/typography/title.cjs.map +1 -1
  152. package/dist/typography/title.d.cts +4 -3
  153. package/dist/typography/title.d.mts +4 -3
  154. package/dist/typography/title.mjs +1 -1
  155. package/dist/typography/title.mjs.map +1 -1
  156. package/dist/ui/alert-dialog.cjs +1 -1
  157. package/dist/ui/alert-dialog.d.cts +12 -12
  158. package/dist/ui/alert-dialog.d.mts +12 -12
  159. package/dist/ui/alert-dialog.mjs +1 -1
  160. package/dist/ui/alert.cjs +1 -1
  161. package/dist/ui/alert.d.cts +6 -6
  162. package/dist/ui/alert.d.mts +4 -4
  163. package/dist/ui/alert.mjs +1 -1
  164. package/dist/ui/aspect-ratio.d.cts +2 -2
  165. package/dist/ui/aspect-ratio.d.mts +2 -2
  166. package/dist/ui/avatar.d.cts +4 -4
  167. package/dist/ui/avatar.d.mts +4 -4
  168. package/dist/ui/badge.d.cts +4 -4
  169. package/dist/ui/badge.d.mts +4 -4
  170. package/dist/ui/breadcrumb.cjs +1 -1
  171. package/dist/ui/breadcrumb.d.cts +8 -8
  172. package/dist/ui/breadcrumb.d.mts +8 -8
  173. package/dist/ui/breadcrumb.mjs +1 -1
  174. package/dist/ui/button-group.cjs +1 -1
  175. package/dist/ui/button-group.d.cts +6 -6
  176. package/dist/ui/button-group.d.mts +6 -6
  177. package/dist/ui/button-group.mjs +1 -1
  178. package/dist/ui/button.cjs +1 -1
  179. package/dist/ui/button.d.cts +1 -1
  180. package/dist/ui/button.d.mts +1 -1
  181. package/dist/ui/button.mjs +1 -1
  182. package/dist/ui/buttons/add-new.cjs +1 -1
  183. package/dist/ui/buttons/add-new.mjs +1 -1
  184. package/dist/ui/buttons/edit.cjs +1 -1
  185. package/dist/ui/buttons/edit.mjs +1 -1
  186. package/dist/ui/buttons/refresh.cjs +1 -1
  187. package/dist/ui/buttons/refresh.mjs +1 -1
  188. package/dist/ui/buttons/trash.cjs +1 -1
  189. package/dist/ui/buttons/trash.mjs +1 -1
  190. package/dist/ui/buttons/upload-image.cjs +1 -1
  191. package/dist/ui/buttons/upload-image.mjs +1 -1
  192. package/dist/ui/calendar.cjs +1 -1
  193. package/dist/ui/calendar.d.cts +4 -4
  194. package/dist/ui/calendar.d.mts +4 -4
  195. package/dist/ui/calendar.mjs +1 -1
  196. package/dist/ui/card.cjs +1 -1
  197. package/dist/ui/card.d.cts +8 -8
  198. package/dist/ui/card.d.mts +8 -8
  199. package/dist/ui/card.mjs +1 -1
  200. package/dist/ui/carousel.cjs +1 -1
  201. package/dist/ui/carousel.d.cts +7 -7
  202. package/dist/ui/carousel.d.mts +7 -7
  203. package/dist/ui/carousel.mjs +1 -1
  204. package/dist/ui/checkbox.d.cts +2 -2
  205. package/dist/ui/checkbox.d.mts +2 -2
  206. package/dist/ui/collapsible.d.cts +4 -4
  207. package/dist/ui/collapsible.d.mts +4 -4
  208. package/dist/ui/command.cjs +1 -1
  209. package/dist/ui/command.d.cts +11 -11
  210. package/dist/ui/command.d.mts +11 -11
  211. package/dist/ui/command.mjs +1 -1
  212. package/dist/ui/context-menu.d.cts +16 -16
  213. package/dist/ui/context-menu.d.mts +16 -16
  214. package/dist/ui/dialog.cjs +1 -1
  215. package/dist/ui/dialog.d.cts +1 -1
  216. package/dist/ui/dialog.d.mts +1 -1
  217. package/dist/ui/dialog.mjs +1 -1
  218. package/dist/ui/drawer.d.cts +11 -11
  219. package/dist/ui/drawer.d.mts +11 -11
  220. package/dist/ui/dropdown-menu.d.cts +16 -16
  221. package/dist/ui/dropdown-menu.d.mts +16 -16
  222. package/dist/ui/empty.d.cts +9 -9
  223. package/dist/ui/empty.d.mts +9 -9
  224. package/dist/ui/field.cjs +1 -1
  225. package/dist/ui/field.d.cts +13 -13
  226. package/dist/ui/field.d.mts +24 -24
  227. package/dist/ui/field.mjs +1 -1
  228. package/dist/ui/file-uploader.cjs +2 -2
  229. package/dist/ui/file-uploader.d.cts +2 -2
  230. package/dist/ui/file-uploader.d.mts +2 -2
  231. package/dist/ui/file-uploader.mjs +2 -2
  232. package/dist/ui/form.cjs +1 -1
  233. package/dist/ui/form.d.cts +7 -7
  234. package/dist/ui/form.d.mts +11 -11
  235. package/dist/ui/form.mjs +1 -1
  236. package/dist/ui/hover-card.d.cts +4 -4
  237. package/dist/ui/hover-card.d.mts +4 -4
  238. package/dist/ui/image.cjs +1 -1
  239. package/dist/ui/image.mjs +1 -1
  240. package/dist/ui/input-otp.cjs +1 -1
  241. package/dist/ui/input-otp.d.cts +5 -5
  242. package/dist/ui/input-otp.d.mts +5 -5
  243. package/dist/ui/input-otp.mjs +1 -1
  244. package/dist/ui/input.cjs +1 -1
  245. package/dist/ui/input.d.cts +1 -1
  246. package/dist/ui/input.d.mts +1 -1
  247. package/dist/ui/input.mjs +1 -1
  248. package/dist/ui/inputs/search-input.cjs +1 -1
  249. package/dist/ui/inputs/search-input.d.cts +3 -3
  250. package/dist/ui/inputs/search-input.d.mts +3 -3
  251. package/dist/ui/inputs/search-input.mjs +1 -1
  252. package/dist/ui/item.cjs +1 -1
  253. package/dist/ui/item.d.cts +16 -16
  254. package/dist/ui/item.d.mts +16 -16
  255. package/dist/ui/item.mjs +1 -1
  256. package/dist/ui/label.d.cts +2 -2
  257. package/dist/ui/label.d.mts +2 -2
  258. package/dist/ui/menubar.d.mts +17 -17
  259. package/dist/ui/multi-select.cjs +1 -1
  260. package/dist/ui/multi-select.d.cts +2 -2
  261. package/dist/ui/multi-select.d.mts +3 -3
  262. package/dist/ui/multi-select.mjs +1 -1
  263. package/dist/ui/multi-select.mjs.map +1 -1
  264. package/dist/ui/navigation-menu.d.cts +11 -11
  265. package/dist/ui/navigation-menu.d.mts +11 -11
  266. package/dist/ui/pagination.cjs +1 -1
  267. package/dist/ui/pagination.d.cts +9 -9
  268. package/dist/ui/pagination.d.mts +9 -9
  269. package/dist/ui/pagination.mjs +1 -1
  270. package/dist/ui/popover.d.cts +6 -6
  271. package/dist/ui/popover.d.mts +6 -6
  272. package/dist/ui/progress.d.cts +2 -2
  273. package/dist/ui/progress.d.mts +2 -2
  274. package/dist/ui/radio-group.d.cts +3 -3
  275. package/dist/ui/radio-group.d.mts +3 -3
  276. package/dist/ui/resizable.cjs +1 -1
  277. package/dist/ui/resizable.d.cts +9 -9
  278. package/dist/ui/resizable.d.mts +9 -9
  279. package/dist/ui/resizable.mjs +1 -1
  280. package/dist/ui/scroll-area.cjs +1 -1
  281. package/dist/ui/scroll-area.d.cts +6 -6
  282. package/dist/ui/scroll-area.d.mts +6 -6
  283. package/dist/ui/scroll-area.mjs +1 -1
  284. package/dist/ui/select.d.cts +9 -9
  285. package/dist/ui/select.d.mts +9 -9
  286. package/dist/ui/separator.d.cts +2 -2
  287. package/dist/ui/separator.d.mts +2 -2
  288. package/dist/ui/sheet.d.cts +9 -9
  289. package/dist/ui/sheet.d.mts +9 -9
  290. package/dist/ui/sidebar.cjs +1 -1
  291. package/dist/ui/sidebar.d.cts +28 -28
  292. package/dist/ui/sidebar.d.mts +28 -28
  293. package/dist/ui/sidebar.mjs +1 -1
  294. package/dist/ui/skeleton.d.cts +2 -2
  295. package/dist/ui/skeleton.d.mts +2 -2
  296. package/dist/ui/slider.cjs +1 -1
  297. package/dist/ui/slider.d.cts +2 -2
  298. package/dist/ui/slider.d.mts +2 -2
  299. package/dist/ui/slider.mjs +1 -1
  300. package/dist/ui/sonner.d.cts +2 -2
  301. package/dist/ui/sonner.d.mts +2 -2
  302. package/dist/ui/spinner.d.cts +2 -2
  303. package/dist/ui/spinner.d.mts +2 -2
  304. package/dist/ui/switch.d.cts +2 -2
  305. package/dist/ui/switch.d.mts +2 -2
  306. package/dist/ui/table.cjs +1 -1
  307. package/dist/ui/table.d.cts +9 -9
  308. package/dist/ui/table.d.mts +18 -18
  309. package/dist/ui/table.mjs +1 -1
  310. package/dist/ui/tabs.d.cts +5 -5
  311. package/dist/ui/tabs.d.mts +5 -5
  312. package/dist/ui/textarea.cjs +1 -1
  313. package/dist/ui/textarea.d.cts +2 -2
  314. package/dist/ui/textarea.d.mts +2 -2
  315. package/dist/ui/textarea.mjs +1 -1
  316. package/dist/ui/toggle-group.cjs +1 -1
  317. package/dist/ui/toggle-group.d.cts +3 -3
  318. package/dist/ui/toggle-group.d.mts +3 -3
  319. package/dist/ui/toggle-group.mjs +1 -1
  320. package/dist/ui/toggle.d.cts +4 -4
  321. package/dist/ui/toggle.d.mts +2 -2
  322. package/dist/ui/tooltip.d.cts +5 -5
  323. package/dist/ui/tooltip.d.mts +5 -5
  324. package/package.json +4 -3
  325. package/styles/theme.css +17 -17
  326. package/dist/button-BFcXpjqF.cjs +0 -2
  327. package/dist/button-BFcXpjqF.cjs.map +0 -1
  328. package/dist/button-BQTNG97Y.mjs +0 -2
  329. package/dist/button-BQTNG97Y.mjs.map +0 -1
  330. package/dist/button.variants-CS-Cmarr.cjs +0 -2
  331. package/dist/button.variants-CS-Cmarr.cjs.map +0 -1
  332. package/dist/button.variants-DRWf66hR.mjs +0 -2
  333. package/dist/button.variants-DRWf66hR.mjs.map +0 -1
  334. package/dist/dist-BudM04oj.cjs +0 -2
  335. package/dist/dist-CvmzZ_6C.mjs +0 -2
  336. package/dist/heading--VmdIi7C.mjs +0 -2
  337. package/dist/heading--VmdIi7C.mjs.map +0 -1
  338. package/dist/heading-BEm5CCSE.cjs +0 -2
  339. package/dist/heading-BEm5CCSE.cjs.map +0 -1
  340. package/dist/image-CS_Q0WA7.mjs +0 -2
  341. package/dist/paragraph-B72bHMf7.cjs +0 -2
  342. package/dist/paragraph-B72bHMf7.cjs.map +0 -1
  343. package/dist/paragraph-moBSTPmT.mjs +0 -2
  344. package/dist/paragraph-moBSTPmT.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import"../../heading--VmdIi7C.mjs";import"../../paragraph-moBSTPmT.mjs";import"../../button.variants-DRWf66hR.mjs";import{t as e}from"../../button-BQTNG97Y.mjs";import{t}from"../../separator-Bf0gymN4.mjs";import{t as n}from"../../close-DfuHB7kq.mjs";import{c as r,l as i,r as a,s as o,t as s}from"../../dialog-CxELDK98.mjs";import{t as c}from"../../checkbox-Bg2FiuQw.mjs";import{t as l}from"../../input-DBtIgQB6.mjs";import{a as u,i as d,t as f}from"../../popover-BckwBuuD.mjs";import{t as p}from"../../calendar-CfOkrubO.mjs";import{n as m,t as h}from"../../radio-group-Cem8O6BK.mjs";import{c as g,i as _,n as v,s as y,t as b}from"../../select-CivtMKTM.mjs";import{t as x}from"../../textarea-bLtmb71c.mjs";import{cn as S}from"@customafk/react-toolkit/utils";import{cva as C}from"class-variance-authority";import{memo as w,useCallback as T,useEffect as E,useId as D,useMemo as O,useRef as k,useState as A}from"react";import{jsx as j,jsxs as M}from"react/jsx-runtime";import{ArrowDownToLine as N,AtSignIcon as P,BanIcon as F,CalendarDaysIcon as I,EyeIcon as ee,EyeOffIcon as te,Loader2 as ne,Loader2Icon as L,PackagePlusIcon as re,PlusIcon as ie,Trash2Icon as ae,XIcon as oe}from"lucide-react";import{endOfToday as R,endOfTomorrow as se,endOfYesterday as ce,format as le,lastDayOfMonth as ue,startOfMonth as de,subDays as z}from"@customafk/react-toolkit/date-fns";import{Dialog as B,Label as fe,Separator as pe,Switch as me}from"radix-ui";import{createFormHook as he,createFormHookContexts as ge,useStore as V}from"@tanstack/react-form";const _e=C([`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`}}),ve=({label:e,color:t,size:n,className:r,children:i})=>j(`div`,{"data-slot":`required-indicator`,className:_e({color:t,size:n,className:r}),children:e||i});function ye({className:e,children:t,...n}){return M(fe.Root,{"data-slot":`label`,className:S(`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:[t,j(ve,{label:`Required`,color:`danger`,size:`sm`,className:`hidden`})]})}const be=C(`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`}}),xe=w(({className:e,...t})=>j(`fieldset`,{"data-slot":`field-set`,className:S(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));xe.displayName=`FieldSet`;const Se=w(({className:e,variant:t=`legend`,...n})=>j(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:S(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));Se.displayName=`FieldLegend`;const H=w(({className:e,...t})=>j(`div`,{"data-slot":`field-group`,className:S(`group/field-group @container/field-group`,`flex flex-col gap-7`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));H.displayName=`FieldGroup`;const U=w(({className:e,orientation:t=`vertical`,...n})=>j(`div`,{"data-slot":`field`,"data-orientation":t,className:S(be({orientation:t}),e),...n}));U.displayName=`Field`;const W=w(({className:e,...t})=>j(`div`,{"data-slot":`field-content`,className:S(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));W.displayName=`FieldContent`;const G=w(({className:e,...t})=>j(`div`,{"data-slot":`field-content-main`,className:S(`relative`,e),...t})),K=w(({className:e,...t})=>j(ye,{"data-slot":`field-label`,className:S(`group/field-label peer/field-label flex 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}));K.displayName=`FieldLabel`;const q=w(({className:e,...t})=>j(`div`,{"data-slot":`field-label`,className:S(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));q.displayName=`FieldTitle`;const J=w(({className:e,...t})=>j(`p`,{"data-slot":`field-description`,className:S(`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}));J.displayName=`FieldDescription`;const Y=w(({isShow:e=!0,className:t,...n})=>e===!1?null:j(`div`,{"data-slot":`field-note`,className:S(`text-wrap rounded border border-primary-muted bg-primary-bg-subtle p-2 text-text-positive-weak text-xs`,t),...n}));Y.displayName=`FieldNote`;const X=w(({children:e,className:n,...r})=>M(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:S(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,n),...r,children:[j(t,{className:`absolute inset-0 top-1/2`}),e&&j(`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=w(({className:e,children:t,errors:n,...r})=>{let i=O(()=>t||(n?n?.length===1&&n[0]?.message?j(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:j(`p`,{children:n[0]?.code===`invalid_type`?`Không đúng định dạng`:n[0].message})}):j(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?j(`li`,{children:e},e):e?.message?j(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?j(`div`,{role:`alert`,"data-slot":`field-error`,className:S(`w-full font-semibold text-danger-strong text-xs`,e),...r,children:i}):null});Z.displayName=`FieldError`;const Ce=({label:e,description:t,options:n,helperText:r,orientation:i})=>{let a=Q(),o=V(a.form.store,({isSubmitting:e})=>e);return M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:i,children:[M(W,{children:[j(K,{children:e}),j(J,{children:t}),j(Y,{isShow:!!r,children:r})]}),j(G,{children:j(H,{className:`flex flex-col gap-y-2`,children:n.map(e=>M(U,{orientation:`horizontal`,children:[j(c,{id:`${a.name}-${e.value}`,name:a.name,checked:a.state.value?.includes(e.value)??!1,disabled:o,onCheckedChange:t=>{if(t&&a.state.value!==null)a.pushValue(e.value);else if(t&&a.state.value===null)a.setValue([e.value]);else if(!t&&a.state.value!==null){let t=a.state.value.indexOf(e.value);t>-1&&a.removeValue(t)}else !t&&a.state.value===null&&a.setValue(null)}}),j(K,{htmlFor:`${a.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),j(X,{})]})},we=({label:t,description:n,placeholder:r,orientation:i=`responsive`,helperText:a,minDate:o,maxDate:s,required:c})=>{let l=Q(),m=O(()=>c?l.state.value===null:!1,[c,l.state.value]),h=O(()=>l.state.meta.isTouched&&!l.state.meta.isValid,[l.state.meta.isTouched,l.state.meta.isValid]);return M(H,{className:`px-4`,children:[M(U,{orientation:i,"data-invalid":h,children:[M(W,{children:[j(K,{htmlFor:l.name,"aria-required":m,children:t}),j(J,{children:n})]}),M(G,{className:`flex flex-col space-y-1`,children:[j(`div`,{className:`flex w-full flex-col`,children:M(f,{children:[j(u,{asChild:!0,children:M(e,{variant:`outline`,color:`muted`,size:`lg`,className:S(`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`,l.state.value===null&&`text-text-positive-muted`),children:[j(`p`,{children:l.state.value===null?r||`Select date`:le(l.state.value,`PPPP`)}),j(I,{strokeWidth:1})]})}),M(d,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:l.handleBlur,children:[M(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(R())},children:`Today`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(se())},children:`Tomorrow`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(ce())},children:`Yesterday`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(z(R(),3))},children:`Last 3 Days`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(z(R(),7))},children:`Last 7 Days`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(z(R(),30))},children:`Last 30 Days`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(de(R()))},children:`This Month`}),j(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(ue(R()))},children:`Last Month`})]}),j(`div`,{className:`flex flex-1 flex-col`,children:j(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:j(p,{mode:`single`,selected:l.state.value??void 0,hidden:{before:o??new Date(1900,0,1),after:s??new Date(2100,11,31)},onSelect:e=>{e&&l.handleChange(e)}})})})]})]})}),j(Y,{isShow:!!a,children:a})]})]}),j(X,{})]})},Te=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,showErrorMessage:a=!0,maxLength:o})=>{let{form:s,name:c,state:u,handleBlur:d,handleChange:f}=Q(),p=V(s.store,({isSubmitting:e})=>e),m=O(()=>u.meta.isDirty&&u.meta.isTouched&&!u.meta.isValid,[u.meta.isDirty,u.meta.isTouched,u.meta.isValid]),h=T(({target:{value:e}})=>{p||o&&e.length>o||f(e||null)},[p,o,f]),g=T(()=>{p||f(null)},[p,f]);return M(H,{className:`gap-y-4 px-4`,children:[M(U,{"data-invalid":m,orientation:i,children:[M(W,{children:[j(K,{htmlFor:c,children:e}),j(J,{children:t})]}),M(G,{children:[j(l,{id:c,name:c,value:u.value===null?``:u.value,"aria-invalid":m,autoComplete:`email`,placeholder:n,className:S(`pl-9`,p&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:d,onChange:h}),j(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:j(P,{size:14})}),j(`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:g,children:j(oe,{size:14,"aria-hidden":`true`})}),j(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&u.meta.isDirty&&j(Z,{errors:u.meta.errors})}),j(Y,{isShow:!!r,children:r})]})]}),j(X,{})]})},Ee=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,De=e=>Number(e).toLocaleString(),Oe=(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}},ke=({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:u,wrapperClassName:d,className:f,onChange:p,onValueChange:m,onFocus:h,onBlur:g,..._})=>{let v=k(null),y=k(null),[b,x]=A(a?.toString()??null),C=O(()=>s?.[1]??r,[s,r]),w=O(()=>s&&s[0]-s[1],[s]),D=O(()=>Ee(n),[n]),N=T(e=>{if(!C||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=C&&r<=(w??1/0)},[C,w]),P=T(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=Oe(parseFloat(e),Math.min(C-1,u||0),i).toString().split(`.`),r=De(t);return n?`${r}.${n}`:r},[C,u,i]),F=T(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){m?.(0),x(e);return}if(n){x(()=>(m?.(0),e));return}},[m]),I=T(e=>{p?.(e);let{value:t}=e.target;if(t===``||t===void 0){m?.(null),x(null);return}F(t),!(!D.test(t)||!N(t))&&(m?.(parseFloat(t)||0),x(t))},[N,p,m,F,D]),ee=T(e=>{t||(h?.(e),x(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,h]),te=T(e=>{t||(g?.(e),x(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?P(e):null))},[t,P,g]);return E(()=>{let e=document.activeElement===y.current;if(a==null||!D.test(a.toString())||!N(a.toString())){x(null);return}x(t=>e?t:P(a.toString()))},[P,a,N,D]),E(()=>{if(!v.current||!y.current||!o)return;let e=v.current.offsetWidth;y.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[o]),M(`div`,{className:S(`relative`,d),children:[j(l,{..._,ref:y,value:b||(t?`0`:``),placeholder:c,disabled:e,readOnly:t,className:S(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,f),onChange:I,onFocus:ee,onBlur:te}),o&&j(`span`,{ref:v,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:o})]})},Ae=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,showErrorMessage:a=!0,rounding:o,decimalPlaces:s,percision:c,unit:l,required:u,allowNegative:d})=>{let f=Q(),p=V(f.form.store,({isSubmitting:e})=>e),m=O(()=>f.state.meta.errors,[f.state.meta.errors]),h=O(()=>u?f.state.value===null:!1,[u,f.state.value]),g=T(e=>{p||f.handleChange(e)},[p,f.handleChange]);return M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:i,"data-invalid":f.state.meta.isTouched&&!f.state.meta.isValid,children:[M(W,{children:[j(K,{htmlFor:f.name,"aria-required":h,children:e}),j(J,{children:t})]}),M(G,{children:[M(`div`,{className:`relative w-full`,children:[j(ke,{id:f.name,value:f.state.value,"aria-invalid":f.state.meta.isTouched&&!f.state.meta.isValid&&f.state.meta.isDirty,placeholder:n,roundingRule:o,numberAfterDecimalPoint:s,precision:c,unitText:l,allowNegative:d,className:S(p&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:f.handleBlur,onValueChange:g}),p&&j(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:j(L,{className:`animate-spin text-primary-strong`})}),f.state.meta.isDirty&&a&&!!m.length&&j(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:j(F,{})}),j(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:f.state.meta.isDirty&&a&&j(Z,{errors:m})})]}),j(Y,{isShow:!!r,children:r})]})]}),j(X,{})]})},je=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0})=>{let{form:o,name:s,state:c,handleBlur:u,handleChange:d}=Q(),f=V(o.store,({isSubmitting:e})=>e),[p,m]=A(!1),h=O(()=>c.meta.isDirty&&c.meta.isTouched&&!c.meta.isValid,[c.meta.isDirty,c.meta.isTouched,c.meta.isValid]),g=T(()=>m(e=>!e),[]),_=T(({target:{value:e}})=>{f||d(e||null)},[f,d]);return j(H,{className:`gap-y-4 px-4`,children:M(U,{"data-invalid":h,orientation:r,children:[M(W,{children:[j(K,{htmlFor:s,children:e}),j(J,{children:t})]}),M(G,{children:[j(l,{id:s,type:p?`text`:`password`,placeholder:n,value:c.value??``,"aria-invalid":h,autoComplete:`new-password`,onBlur:u,onChange:_}),j(`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:g,"aria-label":p?`Hide password`:`Show password`,"aria-pressed":p,"aria-controls":`password`,children:j(p?te:ee,{size:16,"aria-hidden":`true`})}),j(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&c.meta.isDirty&&j(Z,{errors:c.meta.errors})}),j(Y,{isShow:!!i,children:i})]})]})})},Me=({label:e,description:t,orientation:n,options:r,helperText:i})=>{let a=Q(),o=V(a.form.store,({isSubmitting:e})=>e);return M(H,{className:`px-4`,children:[M(U,{orientation:n,className:`flex-col gap-2`,children:[M(W,{children:[j(K,{children:e}),j(J,{children:t}),j(Y,{isShow:!!i,children:i})]}),j(G,{children:j(h,{defaultValue:a.state.value??void 0,className:`w-full`,onValueChange:a.handleChange,children:r.map(e=>j(K,{className:S(`h-fit`,a.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,o&&`pointer-events-none bg-muted-muted opacity-60`,a.state.value===e.value&&o&&`border-border-strong!`),children:M(U,{orientation:`horizontal`,className:`justify-between rounded p-2!`,children:[M(W,{className:`gap-1!`,children:[j(q,{children:e.label}),j(J,{className:`text-xs`,children:e.description})]}),j(m,{value:e.value})]})},e.value))})})]}),j(X,{})]})},Ne=({label:e,description:t,placeholder:n,orientation:r=`responsive`,options:i,helperText:a,required:o=!1})=>{let s=Q(),c=O(()=>s.state.meta.isTouched&&!s.state.meta.isValid,[s.state.meta.isTouched,s.state.meta.isValid]),l=O(()=>o?s.state.value===null:!1,[o,s.state.value]),u=O(()=>s.state.meta.errors,[s.state.meta.errors]);return M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:r,"data-invalid":s.state.meta.isTouched&&!s.state.meta.isValid,children:[M(W,{children:[j(K,{htmlFor:s.name,"aria-required":l,children:e}),j(J,{children:t})]}),M(G,{className:`flex flex-col`,children:[M(b,{defaultValue:s.state.value||void 0,onValueChange:s.handleChange,children:[j(y,{"aria-invalid":c?`true`:void 0,onBlur:s.handleBlur,children:j(g,{placeholder:n})}),M(v,{children:[!!i.length&&i.map(e=>j(_,{value:e.value,children:e.label},e.value)),!i.length&&M(`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:[j(re,{strokeWidth:1}),`No options available`]})]})]}),j(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:j(Z,{errors:u})}),j(Y,{isShow:!!a,children:a})]})]}),j(X,{})]})};function Pe({className:e,...t}){return j(me.Root,{"data-slot":`switch`,className:S(`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:j(me.Thumb,{"data-slot":`switch-thumb`,className:S(`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 Fe=({label:e,description:t,helperText:n})=>{let r=Q();return M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[M(W,{children:[j(q,{className:`cursor-pointer`,children:j(`label`,{htmlFor:r.name,children:e})}),j(J,{children:t}),j(Pe,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),j(Y,{isShow:!!n,children:n})]}),j(X,{})]})},Ie=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showClearButton:o=!1,showErrorMessage:s=!0,required:c=!1,maxLength:u})=>{let d=D(),f=k(null),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=Q(),v=V(p.store,({isSubmitting:e})=>e),y=o&&!v&&!!h.value&&!h.meta.errors.length,b=h.value?h.value.length:0,x=O(()=>{if(!i)return``;let e=`character${[0,1].includes(b)?``:`s`}`;return i&&u?`${b} / ${u} character${b?`s`:``}`:`${b} ${e}`},[b,i,u]),C=h.meta.isDirty&&h.meta.isTouched&&!h.meta.isValid,w=c?h.value===null:!1,E=u&&b>=u*.8,A=u&&b>=u,N=T(({target:{value:e}})=>{v||i&&u&&e.length>u||_(e||null)},[v,i,u,_]),P=T(()=>{v||(_(null),f.current?.focus())},[v,_]);return M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:a,"data-invalid":C,children:[M(W,{children:[j(K,{"aria-required":w,htmlFor:d,children:M(`p`,{children:[e,c&&j(`span`,{className:`text-danger-strong`,children:` *`})]})}),j(J,{children:t})]}),M(G,{children:[j(l,{ref:f,id:d,name:m,value:h.value??``,"aria-invalid":C,autoComplete:`off`,placeholder:n,autoCapitalize:`none`,autoCorrect:`off`,className:S(`pr-6`,v&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:g,onChange:N}),y&&j(`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:P,children:j(oe,{"aria-hidden":`true`})}),v&&j(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:j(L,{size:14,className:`animate-spin text-primary-strong`})}),h.meta.isDirty&&s&&!!h.meta.errors.length&&j(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:j(F,{"aria-hidden":`true`,size:14})}),M(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[h.meta.isDirty&&s?j(Z,{className:`flex-1`,errors:h.meta.errors}):j(`div`,{}),!!i&&j(`p`,{className:S(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,A?`font-medium text-danger-strong`:E?`text-warning-strong`:`text-text-positive-weak`),children:x})]}),j(Y,{isShow:!!r,children:r})]})]}),j(X,{})]})},Le=w(({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showErrorMessage:o=!0,required:s=!1,maxLength:c})=>{let l=D(),{form:u,state:d,name:f,handleBlur:p,handleChange:m}=Q(),h=V(u.store,({isSubmitting:e})=>e),g=d.value?d.value.length:0,_=O(()=>{if(!i)return``;let e=`character${[0,1].includes(g)?``:`s`}`;return i&&c?`${g} / ${c} character${g?`s`:``}`:`${g} ${e}`},[g,i,c]),v=d.meta.isDirty&&d.meta.isTouched&&!d.meta.isValid,y=s?d.value===null:!1,b=d.meta.errors,C=c&&g>=c*.8,w=c&&g>=c,E=T(({target:{value:e}})=>{h||i&&c&&e.length>c||m(e||null)},[h,i,c,m]);return M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:a,"data-invalid":v,children:[M(W,{children:[j(K,{"aria-required":y,htmlFor:l,children:M(`p`,{children:[e,s&&j(`span`,{className:`text-danger-strong`,children:` *`})]})}),j(J,{children:t})]}),M(G,{children:[j(x,{id:l,name:f,value:d.value===null?``:d.value,"aria-invalid":v,autoCapitalize:`none`,autoComplete:`off`,placeholder:n,className:S(h&&`pointer-events-none bg-muted-muted opacity-60`),onChange:E,onBlur:p}),h&&j(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:j(L,{size:14,className:`animate-spin text-primary-strong`})}),d.meta.isDirty&&o&&!!b.length&&j(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:j(F,{size:14})}),M(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[d.meta.isDirty&&o?j(Z,{className:`flex-1`,errors:d.meta.errors}):j(`div`,{}),!!i&&j(`p`,{className:S(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,w?`font-medium text-danger-strong`:C?`text-warning-strong`:`text-text-positive-weak`),children:_})]}),j(Y,{isShow:!!r,children:r})]})]}),j(X,{})]})}),Re=({label:t,className:n})=>{let r=$(),i=T(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return j(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})=>j(e,{type:`button`,size:`md`,disabled:r,isLoading:a,className:S(`min-h-8 min-w-32`,n),onClick:i,children:t??`Submit`})})},ze=({type:t=`create`})=>{let n=$();return M(`div`,{className:`flex h-8 items-center justify-between`,children:[j(n.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:t})=>j(e,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:t,className:`h-full min-w-32`,onClick:()=>n.reset(),children:`Cancel`})}),t===`create`&&j(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})=>M(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:[j(ie,{}),`Add New`]})}),t===`update`&&j(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})=>M(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:[j(N,{}),`Update`]})})]})};function Be({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return j(pe.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:S(`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 Ve=({title:t,description:n,onDelete:r,children:i})=>M(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-4 ring-border-weak`,children:[M(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-1 p-4`,children:[j(`p`,{className:`font-semibold text-lg`,children:t}),!!n&&j(`p`,{className:`text-muted text-sm`,children:n})]}),j(Be,{}),j(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:i}),!!r&&M(e,{color:`danger`,variant:`outline`,size:`sm`,className:`absolute top-2 right-2`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[j(ae,{}),`Remove`]})]}),He=({children:e})=>j(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),Ue=({...e})=>j(`button`,{...e,type:`button`,className:`min-w-40 cursor-pointer rounded-sm border border-border bg-card px-4 py-2 font-semibold text-sm text-text-positive shadow-xs outline-none transition-all hover:opacity-90 focus:border-border focus:ring-3 focus:ring-border/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none`,children:`Hủy`}),We=({isSubmitting:e,submitText:t=`Submit`,...n})=>j(`button`,{...n,type:`button`,"data-loading":e?`true`:void 0,className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-sm border border-primary-strong bg-primary px-4 py-2 font-semibold text-sm text-text-negative shadow-card outline-none transition-all hover:opacity-90 focus:border-transparent focus:ring-3 focus:ring-primary/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none data-[loading=true]:pointer-events-none data-[loading=true]:opacity-80`,children:e?j(ne,{size:16,strokeWidth:3,className:`absolute top-1/2 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 animate-spin`}):t}),Ge=({title:e,submitText:n,open:c,onOpenChange:l,children:u})=>{let d=$(),f=T(e=>{e||d.reset(),l?.(e)},[d.reset,l]);return j(s,{open:c,onOpenChange:f,children:M(r,{"data-slot":`dialog-portal`,children:[j(o,{}),M(a,{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-sm`,children:[j(`div`,{"data-slot":`dialog-header`,className:`flex flex-col items-center justify-center gap-2 px-4 py-6 text-center shadow-sm sm:text-left`,children:j(i,{"data-slot":`dialog-title`,children:e})}),j(t,{}),j(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col space-y-4 overflow-y-auto p-0 pt-6 max-sm:flex-1 sm:p-4`,children:u}),j(t,{}),M(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-between gap-2 px-6 py-4 shadow-sm sm:flex-row sm:justify-end max-sm:[&>button]:w-full`,children:[j(d.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>j(Ue,{disabled:e,onClick:()=>{d.reset(),f(!1)}})}),j(d.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>j(We,{isSubmitting:e,disabled:t,submitText:n,onClick:()=>d.handleSubmit()})})]})]})]})})},Ke=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>M(H,{className:`gap-y-4 px-4`,children:[M(U,{orientation:r,children:[M(W,{children:[j(K,{children:e}),j(J,{children:t})]}),M(G,{children:[i,j(Y,{isShow:!!n,children:n})]})]}),j(X,{})]}),qe=({title:e,open:t,contentClassName:r,onOpenChange:i,children:a})=>{let o=$();return j(B.Root,{"data-slot":`dialog`,open:t,onOpenChange:i,children:M(B.Portal,{"data-slot":`dialog-portal`,children:[j(B.Overlay,{"data-slot":`dialog-overlay`,className:S(`fixed inset-0 z-40 bg-black/50 backdrop-blur-sm`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`)}),j(B.Content,{"data-slot":`dialog-content`,className:S(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background drop-shadow-lg`,`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:M(`section`,{className:`relative flex size-full flex-col`,children:[j(`header`,{className:`flex h-14 items-center border-border border-b px-4`,children:j(`h2`,{className:`font-semibold text-lg text-primary-strong`,children:e})}),j(`div`,{className:S(`flex flex-1 flex-col overflow-y-auto py-4`,r),children:a}),M(`div`,{className:`flex flex-col space-y-4 border-border border-t px-4 py-2`,children:[j(o.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>j(We,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),j(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>j(Ue,{disabled:e,className:`w-full`,onClick:()=>{o.reset(),i?.(!1)}})})]}),j(B.Close,{asChild:!0,children:j(n,{className:`absolute top-2 right-2`})})]})})]})})},Je=({children:e})=>j(`header`,{"data-slot":`section-header`,className:`px-4 pt-2.5 pb-2 font-medium text-base text-text-positive`,children:e}),Ye=({children:e})=>j(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),Xe=({title:e,children:t})=>M(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-4 ring-border-weak`,children:[j(Je,{children:e}),j(Be,{}),j(Ye,{children:t})]}),Ze=({title:e,description:t,helperText:n})=>M(H,{className:`gap-y-4 px-4`,children:[M(U,{className:`gap-0`,children:[M(W,{children:[j(Se,{className:`mb-1`,children:e}),j(J,{children:t})]}),j(Y,{isShow:!!n,children:n})]}),j(X,{})]}),{fieldContext:Qe,formContext:$e,useFieldContext:Q,useFormContext:$}=ge(),{useAppForm:et,withForm:tt,withFieldGroup:nt}=he({fieldContext:Qe,formContext:$e,fieldComponents:{TextField:Ie,TextareaField:Le,NumberField:Ae,EmailField:Te,PasswordField:je,SelectField:Ne,DateField:we,SwitchField:Fe,RadioGroupField:Me,CheckboxField:Ce,FieldGroup:H,Field:U,FieldContent:W,FieldLabel:K,FieldContentMain:G,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:Ge,TanStackPopoverForm:qe,TanStackContainerForm:He,TanStackSectionForm:Xe,TanStackCardForm:Ve,TanStackFieldGroup:Ke,TanStackTitleField:Ze,TanStackActionsForm:ze,TanStackActionSubmit:Re}});export{U as Field,W as FieldContent,G as FieldContentMain,Z as FieldError,H as FieldGroup,K as FieldLabel,X as FieldSeparator,Q as useTanStackFieldContext,et as useTanStackForm,$ as useTanStackFormContext,nt as withTanStackFieldGroup,tt as withTanStackForm};
1
+ import"../../heading-CrF1CFWS.mjs";import"../../paragraph-DmiXlAnE.mjs";import"../../button.variants-B_dFX3i2.mjs";import{t as e}from"../../button-D8BUqpI2.mjs";import{t}from"../../separator-Bf0gymN4.mjs";import{t as n}from"../../close-DfuHB7kq.mjs";import{c as r,l as i,r as a,s as o,t as s}from"../../dialog-B50k7HnL.mjs";import{t as c}from"../../checkbox-Bg2FiuQw.mjs";import{t as l}from"../../input-DMjPBcJO.mjs";import{a as u,i as d,t as f}from"../../popover-BckwBuuD.mjs";import{t as p}from"../../calendar-B-PDpHK5.mjs";import{n as m,t as h}from"../../radio-group-Cem8O6BK.mjs";import{c as g,i as _,n as v,s as y,t as b}from"../../select-CivtMKTM.mjs";import{t as x}from"../../textarea-RjL2DtNf.mjs";import{cn as S}from"@customafk/react-toolkit/utils";import{cva as C}from"class-variance-authority";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{ArrowDownToLine as E,AtSignIcon as D,BanIcon as O,CalendarDaysIcon as k,EyeIcon as A,EyeOffIcon as j,Loader2 as ee,Loader2Icon as M,PackagePlusIcon as te,PlusIcon as ne,Trash2Icon as re,XIcon as ie}from"lucide-react";import{memo as N,useCallback as P,useEffect as F,useId as ae,useMemo as I,useRef as L,useState as oe}from"react";import{endOfToday as R,endOfTomorrow as se,endOfYesterday as ce,format as le,lastDayOfMonth as ue,startOfMonth as de,subDays as z}from"@customafk/react-toolkit/date-fns";import{Dialog as B,Label as fe,Separator as pe,Switch as me}from"radix-ui";import{createFormHook as he,createFormHookContexts as ge,useStore as V}from"@tanstack/react-form";const _e=C([`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`}}),ve=({label:e,color:t,size:n,className:r,children:i})=>w(`div`,{"data-slot":`required-indicator`,className:_e({color:t,size:n,className:r}),children:e||i});function ye({className:e,children:t,...n}){return T(fe.Root,{"data-slot":`label`,className:S(`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:[t,w(ve,{label:`Required`,color:`danger`,size:`sm`,className:`hidden`})]})}const be=C(`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`}}),xe=N(({className:e,...t})=>w(`fieldset`,{"data-slot":`field-set`,className:S(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));xe.displayName=`FieldSet`;const Se=N(({className:e,variant:t=`legend`,...n})=>w(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:S(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));Se.displayName=`FieldLegend`;const H=N(({className:e,...t})=>w(`div`,{"data-slot":`field-group`,className:S(`group/field-group @container/field-group`,`flex flex-col gap-7`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));H.displayName=`FieldGroup`;const U=N(({className:e,orientation:t=`vertical`,...n})=>w(`div`,{"data-slot":`field`,"data-orientation":t,className:S(be({orientation:t}),e),...n}));U.displayName=`Field`;const W=N(({className:e,...t})=>w(`div`,{"data-slot":`field-content`,className:S(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));W.displayName=`FieldContent`;const G=N(({className:e,...t})=>w(`div`,{"data-slot":`field-content-main`,className:S(`relative`,e),...t})),K=N(({className:e,...t})=>w(ye,{"data-slot":`field-label`,className:S(`group/field-label peer/field-label flex 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}));K.displayName=`FieldLabel`;const q=N(({className:e,...t})=>w(`div`,{"data-slot":`field-label`,className:S(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));q.displayName=`FieldTitle`;const J=N(({className:e,...t})=>w(`p`,{"data-slot":`field-description`,className:S(`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}));J.displayName=`FieldDescription`;const Y=N(({isShow:e=!0,className:t,...n})=>e===!1?null:w(`div`,{"data-slot":`field-note`,className:S(`text-wrap rounded border border-primary-muted bg-primary-bg-subtle p-2 text-text-positive-weak text-xs`,t),...n}));Y.displayName=`FieldNote`;const X=N(({children:e,className:n,...r})=>T(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:S(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,n),...r,children:[w(t,{className:`absolute inset-0 top-1/2`}),e&&w(`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=N(({className:e,children:t,errors:n,...r})=>{let i=I(()=>t||(n?n?.length===1&&n[0]?.message?w(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:w(`p`,{children:n[0]?.code===`invalid_type`?`Không đúng định dạng`:n[0].message})}):w(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?w(`li`,{children:e},e):e?.message?w(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?w(`div`,{role:`alert`,"data-slot":`field-error`,className:S(`w-full font-semibold text-danger-strong text-xs`,e),...r,children:i}):null});Z.displayName=`FieldError`;const Ce=({label:e,description:t,options:n,helperText:r,orientation:i})=>{let a=Q(),o=V(a.form.store,({isSubmitting:e})=>e);return T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:i,children:[T(W,{children:[w(K,{children:e}),w(J,{children:t}),w(Y,{isShow:!!r,children:r})]}),w(G,{children:w(H,{className:`flex flex-col gap-y-2`,children:n.map(e=>T(U,{orientation:`horizontal`,children:[w(c,{id:`${a.name}-${e.value}`,name:a.name,checked:a.state.value?.includes(e.value)??!1,disabled:o,onCheckedChange:t=>{if(t&&a.state.value!==null)a.pushValue(e.value);else if(t&&a.state.value===null)a.setValue([e.value]);else if(!t&&a.state.value!==null){let t=a.state.value.indexOf(e.value);t>-1&&a.removeValue(t)}else !t&&a.state.value===null&&a.setValue(null)}}),w(K,{htmlFor:`${a.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),w(X,{})]})},we=({label:t,description:n,placeholder:r,orientation:i=`responsive`,helperText:a,minDate:o,maxDate:s,required:c})=>{let l=Q(),m=I(()=>c?l.state.value===null:!1,[c,l.state.value]),h=I(()=>l.state.meta.isTouched&&!l.state.meta.isValid,[l.state.meta.isTouched,l.state.meta.isValid]);return T(H,{className:`px-4`,children:[T(U,{orientation:i,"data-invalid":h,children:[T(W,{children:[w(K,{htmlFor:l.name,"aria-required":m,children:t}),w(J,{children:n})]}),T(G,{className:`flex flex-col space-y-1`,children:[w(`div`,{className:`flex w-full flex-col`,children:T(f,{children:[w(u,{asChild:!0,children:T(e,{variant:`outline`,color:`muted`,size:`lg`,className:S(`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`,l.state.value===null&&`text-text-positive-muted`),children:[w(`p`,{children:l.state.value===null?r||`Select date`:le(l.state.value,`PPPP`)}),w(k,{strokeWidth:1})]})}),T(d,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:l.handleBlur,children:[T(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(R())},children:`Today`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(se())},children:`Tomorrow`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(ce())},children:`Yesterday`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(z(R(),3))},children:`Last 3 Days`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(z(R(),7))},children:`Last 7 Days`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(z(R(),30))},children:`Last 30 Days`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(de(R()))},children:`This Month`}),w(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{l.handleChange(ue(R()))},children:`Last Month`})]}),w(`div`,{className:`flex flex-1 flex-col`,children:w(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:w(p,{mode:`single`,selected:l.state.value??void 0,hidden:{before:o??new Date(1900,0,1),after:s??new Date(2100,11,31)},onSelect:e=>{e&&l.handleChange(e)}})})})]})]})}),w(Y,{isShow:!!a,children:a})]})]}),w(X,{})]})},Te=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,showErrorMessage:a=!0,maxLength:o})=>{let{form:s,name:c,state:u,handleBlur:d,handleChange:f}=Q(),p=V(s.store,({isSubmitting:e})=>e),m=I(()=>u.meta.isDirty&&u.meta.isTouched&&!u.meta.isValid,[u.meta.isDirty,u.meta.isTouched,u.meta.isValid]),h=P(({target:{value:e}})=>{p||o&&e.length>o||f(e||null)},[p,o,f]),g=P(()=>{p||f(null)},[p,f]);return T(H,{className:`gap-y-4 px-4`,children:[T(U,{"data-invalid":m,orientation:i,children:[T(W,{children:[w(K,{htmlFor:c,children:e}),w(J,{children:t})]}),T(G,{children:[w(l,{id:c,name:c,value:u.value===null?``:u.value,"aria-invalid":m,autoComplete:`email`,placeholder:n,className:S(`pl-9`,p&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:d,onChange:h}),w(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:w(D,{size:14})}),w(`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:g,children:w(ie,{size:14,"aria-hidden":`true`})}),w(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&u.meta.isDirty&&w(Z,{errors:u.meta.errors})}),w(Y,{isShow:!!r,children:r})]})]}),w(X,{})]})},Ee=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,De=e=>Number(e).toLocaleString(),Oe=(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}},ke=({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:u,wrapperClassName:d,className:f,onChange:p,onValueChange:m,onFocus:h,onBlur:g,..._})=>{let v=L(null),y=L(null),[b,x]=oe(a?.toString()??null),C=I(()=>s?.[1]??r,[s,r]),E=I(()=>s&&s[0]-s[1],[s]),D=I(()=>Ee(n),[n]),O=P(e=>{if(!C||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=C&&r<=(E??1/0)},[C,E]),k=P(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=Oe(parseFloat(e),Math.min(C-1,u||0),i).toString().split(`.`),r=De(t);return n?`${r}.${n}`:r},[C,u,i]),A=P(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){m?.(0),x(e);return}if(n){x(()=>(m?.(0),e));return}},[m]),j=P(e=>{p?.(e);let{value:t}=e.target;if(t===``||t===void 0){m?.(null),x(null);return}A(t),!(!D.test(t)||!O(t))&&(m?.(parseFloat(t)||0),x(t))},[O,p,m,A,D]),ee=P(e=>{t||(h?.(e),x(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,h]),M=P(e=>{t||(g?.(e),x(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?k(e):null))},[t,k,g]);return F(()=>{let e=document.activeElement===y.current;if(a==null||!D.test(a.toString())||!O(a.toString())){x(null);return}x(t=>e?t:k(a.toString()))},[k,a,O,D]),F(()=>{if(!v.current||!y.current||!o)return;let e=v.current.offsetWidth;y.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[o]),T(`div`,{className:S(`relative`,d),children:[w(l,{..._,ref:y,value:b||(t?`0`:``),placeholder:c,disabled:e,readOnly:t,className:S(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,f),onChange:j,onFocus:ee,onBlur:M}),o&&w(`span`,{ref:v,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:o})]})},Ae=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,showErrorMessage:a=!0,rounding:o,decimalPlaces:s,percision:c,unit:l,required:u,allowNegative:d})=>{let f=Q(),p=V(f.form.store,({isSubmitting:e})=>e),m=I(()=>f.state.meta.errors,[f.state.meta.errors]),h=I(()=>u?f.state.value===null:!1,[u,f.state.value]),g=P(e=>{p||f.handleChange(e)},[p,f.handleChange]);return T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:i,"data-invalid":f.state.meta.isTouched&&!f.state.meta.isValid,children:[T(W,{children:[w(K,{htmlFor:f.name,"aria-required":h,children:e}),w(J,{children:t})]}),T(G,{children:[T(`div`,{className:`relative w-full`,children:[w(ke,{id:f.name,value:f.state.value,"aria-invalid":f.state.meta.isTouched&&!f.state.meta.isValid&&f.state.meta.isDirty,placeholder:n,roundingRule:o,numberAfterDecimalPoint:s,precision:c,unitText:l,allowNegative:d,className:S(p&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:f.handleBlur,onValueChange:g}),p&&w(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:w(M,{className:`animate-spin text-primary-strong`})}),f.state.meta.isDirty&&a&&!!m.length&&w(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:w(O,{})}),w(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:f.state.meta.isDirty&&a&&w(Z,{errors:m})})]}),w(Y,{isShow:!!r,children:r})]})]}),w(X,{})]})},je=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0})=>{let{form:o,name:s,state:c,handleBlur:u,handleChange:d}=Q(),f=V(o.store,({isSubmitting:e})=>e),[p,m]=oe(!1),h=I(()=>c.meta.isDirty&&c.meta.isTouched&&!c.meta.isValid,[c.meta.isDirty,c.meta.isTouched,c.meta.isValid]),g=P(()=>m(e=>!e),[]),_=P(({target:{value:e}})=>{f||d(e||null)},[f,d]);return w(H,{className:`gap-y-4 px-4`,children:T(U,{"data-invalid":h,orientation:r,children:[T(W,{children:[w(K,{htmlFor:s,children:e}),w(J,{children:t})]}),T(G,{children:[w(l,{id:s,type:p?`text`:`password`,placeholder:n,value:c.value??``,"aria-invalid":h,autoComplete:`new-password`,onBlur:u,onChange:_}),w(`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:g,"aria-label":p?`Hide password`:`Show password`,"aria-pressed":p,"aria-controls":`password`,children:w(p?j:A,{size:16,"aria-hidden":`true`})}),w(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&c.meta.isDirty&&w(Z,{errors:c.meta.errors})}),w(Y,{isShow:!!i,children:i})]})]})})},Me=({label:e,description:t,orientation:n,options:r,helperText:i})=>{let a=Q(),o=V(a.form.store,({isSubmitting:e})=>e);return T(H,{className:`px-4`,children:[T(U,{orientation:n,className:`flex-col gap-2`,children:[T(W,{children:[w(K,{children:e}),w(J,{children:t}),w(Y,{isShow:!!i,children:i})]}),w(G,{children:w(h,{defaultValue:a.state.value??void 0,className:`w-full`,onValueChange:a.handleChange,children:r.map(e=>w(K,{className:S(`h-fit`,a.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,o&&`pointer-events-none bg-muted-muted opacity-60`,a.state.value===e.value&&o&&`border-border-strong!`),children:T(U,{orientation:`horizontal`,className:`justify-between rounded p-2!`,children:[T(W,{className:`gap-1!`,children:[w(q,{children:e.label}),w(J,{className:`text-xs`,children:e.description})]}),w(m,{value:e.value})]})},e.value))})})]}),w(X,{})]})},Ne=({label:e,description:t,placeholder:n,orientation:r=`responsive`,options:i,helperText:a,required:o=!1})=>{let s=Q(),c=I(()=>s.state.meta.isTouched&&!s.state.meta.isValid,[s.state.meta.isTouched,s.state.meta.isValid]),l=I(()=>o?s.state.value===null:!1,[o,s.state.value]),u=I(()=>s.state.meta.errors,[s.state.meta.errors]);return T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:r,"data-invalid":s.state.meta.isTouched&&!s.state.meta.isValid,children:[T(W,{children:[w(K,{htmlFor:s.name,"aria-required":l,children:e}),w(J,{children:t})]}),T(G,{className:`flex flex-col`,children:[T(b,{defaultValue:s.state.value||void 0,onValueChange:s.handleChange,children:[w(y,{"aria-invalid":c?`true`:void 0,onBlur:s.handleBlur,children:w(g,{placeholder:n})}),T(v,{children:[!!i.length&&i.map(e=>w(_,{value:e.value,children:e.label},e.value)),!i.length&&T(`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:[w(te,{strokeWidth:1}),`No options available`]})]})]}),w(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:w(Z,{errors:u})}),w(Y,{isShow:!!a,children:a})]})]}),w(X,{})]})};function Pe({className:e,...t}){return w(me.Root,{"data-slot":`switch`,className:S(`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:w(me.Thumb,{"data-slot":`switch-thumb`,className:S(`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 Fe=({label:e,description:t,helperText:n})=>{let r=Q();return T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[T(W,{children:[w(q,{className:`cursor-pointer`,children:w(`label`,{htmlFor:r.name,children:e})}),w(J,{children:t}),w(Pe,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),w(Y,{isShow:!!n,children:n})]}),w(X,{})]})},Ie=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showClearButton:o=!1,showErrorMessage:s=!0,required:c=!1,maxLength:u})=>{let d=ae(),f=L(null),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=Q(),v=V(p.store,({isSubmitting:e})=>e),y=o&&!v&&!!h.value&&!h.meta.errors.length,b=h.value?h.value.length:0,x=I(()=>{if(!i)return``;let e=`character${[0,1].includes(b)?``:`s`}`;return i&&u?`${b} / ${u} character${b?`s`:``}`:`${b} ${e}`},[b,i,u]),C=h.meta.isDirty&&h.meta.isTouched&&!h.meta.isValid,E=c?h.value===null:!1,D=u&&b>=u*.8,k=u&&b>=u,A=P(({target:{value:e}})=>{v||i&&u&&e.length>u||_(e||null)},[v,i,u,_]),j=P(()=>{v||(_(null),f.current?.focus())},[v,_]);return T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:a,"data-invalid":C,children:[T(W,{children:[w(K,{"aria-required":E,htmlFor:d,children:T(`p`,{children:[e,c&&w(`span`,{className:`text-danger-strong`,children:` *`})]})}),w(J,{children:t})]}),T(G,{children:[w(l,{ref:f,id:d,name:m,value:h.value??``,"aria-invalid":C,autoComplete:`off`,placeholder:n,autoCapitalize:`none`,autoCorrect:`off`,className:S(`pr-6`,v&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:g,onChange:A}),y&&w(`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:j,children:w(ie,{"aria-hidden":`true`})}),v&&w(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:w(M,{size:14,className:`animate-spin text-primary-strong`})}),h.meta.isDirty&&s&&!!h.meta.errors.length&&w(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:w(O,{"aria-hidden":`true`,size:14})}),T(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[h.meta.isDirty&&s?w(Z,{className:`flex-1`,errors:h.meta.errors}):w(`div`,{}),!!i&&w(`p`,{className:S(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,k?`font-medium text-danger-strong`:D?`text-warning-strong`:`text-text-positive-weak`),children:x})]}),w(Y,{isShow:!!r,children:r})]})]}),w(X,{})]})},Le=N(({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showErrorMessage:o=!0,required:s=!1,maxLength:c})=>{let l=ae(),{form:u,state:d,name:f,handleBlur:p,handleChange:m}=Q(),h=V(u.store,({isSubmitting:e})=>e),g=d.value?d.value.length:0,_=I(()=>{if(!i)return``;let e=`character${[0,1].includes(g)?``:`s`}`;return i&&c?`${g} / ${c} character${g?`s`:``}`:`${g} ${e}`},[g,i,c]),v=d.meta.isDirty&&d.meta.isTouched&&!d.meta.isValid,y=s?d.value===null:!1,b=d.meta.errors,C=c&&g>=c*.8,E=c&&g>=c,D=P(({target:{value:e}})=>{h||i&&c&&e.length>c||m(e||null)},[h,i,c,m]);return T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:a,"data-invalid":v,children:[T(W,{children:[w(K,{"aria-required":y,htmlFor:l,children:T(`p`,{children:[e,s&&w(`span`,{className:`text-danger-strong`,children:` *`})]})}),w(J,{children:t})]}),T(G,{children:[w(x,{id:l,name:f,value:d.value===null?``:d.value,"aria-invalid":v,autoCapitalize:`none`,autoComplete:`off`,placeholder:n,className:S(h&&`pointer-events-none bg-muted-muted opacity-60`),onChange:D,onBlur:p}),h&&w(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:w(M,{size:14,className:`animate-spin text-primary-strong`})}),d.meta.isDirty&&o&&!!b.length&&w(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:w(O,{size:14})}),T(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[d.meta.isDirty&&o?w(Z,{className:`flex-1`,errors:d.meta.errors}):w(`div`,{}),!!i&&w(`p`,{className:S(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,E?`font-medium text-danger-strong`:C?`text-warning-strong`:`text-text-positive-weak`),children:_})]}),w(Y,{isShow:!!r,children:r})]})]}),w(X,{})]})}),Re=({label:t,className:n})=>{let r=$(),i=P(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return w(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})=>w(e,{type:`button`,size:`md`,disabled:r,isLoading:a,className:S(`min-h-8 min-w-32`,n),onClick:i,children:t??`Submit`})})},ze=({type:t=`create`})=>{let n=$();return T(`div`,{className:`flex h-8 items-center justify-between`,children:[w(n.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:t})=>w(e,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:t,className:`h-full min-w-32`,onClick:()=>n.reset(),children:`Cancel`})}),t===`create`&&w(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})=>T(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:[w(ne,{}),`Add New`]})}),t===`update`&&w(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})=>T(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:[w(E,{}),`Update`]})})]})};function Be({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return w(pe.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:S(`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 Ve=({title:t,description:n,onDelete:r,children:i})=>T(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-4 ring-border-weak`,children:[T(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-1 p-4`,children:[w(`p`,{className:`font-semibold text-lg`,children:t}),!!n&&w(`p`,{className:`text-muted text-sm`,children:n})]}),w(Be,{}),w(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:i}),!!r&&T(e,{color:`danger`,variant:`outline`,size:`sm`,className:`absolute top-2 right-2`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[w(re,{}),`Remove`]})]}),He=({children:e})=>w(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),Ue=({...e})=>w(`button`,{...e,type:`button`,className:`min-w-40 cursor-pointer rounded-sm border border-border bg-card px-4 py-2 font-semibold text-sm text-text-positive shadow-xs outline-none transition-all hover:opacity-90 focus:border-border focus:ring-3 focus:ring-border/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none`,children:`Hủy`}),We=({isSubmitting:e,submitText:t=`Submit`,...n})=>w(`button`,{...n,type:`button`,"data-loading":e?`true`:void 0,className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-sm border border-primary-strong bg-primary px-4 py-2 font-semibold text-sm text-text-negative shadow-card outline-none transition-all hover:opacity-90 focus:border-transparent focus:ring-3 focus:ring-primary/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none data-[loading=true]:pointer-events-none data-[loading=true]:opacity-80`,children:e?w(ee,{size:16,strokeWidth:3,className:`absolute top-1/2 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 animate-spin`}):t}),Ge=({title:e,submitText:n,open:c,onOpenChange:l,children:u})=>{let d=$(),f=P(e=>{e||d.reset(),l?.(e)},[d.reset,l]);return w(s,{open:c,onOpenChange:f,children:T(r,{"data-slot":`dialog-portal`,children:[w(o,{}),T(a,{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-sm`,children:[w(`div`,{"data-slot":`dialog-header`,className:`flex flex-col items-center justify-center gap-2 px-4 py-6 text-center shadow-sm sm:text-left`,children:w(i,{"data-slot":`dialog-title`,children:e})}),w(t,{}),w(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col space-y-4 overflow-y-auto p-0 pt-6 max-sm:flex-1 sm:p-4`,children:u}),w(t,{}),T(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-between gap-2 px-6 py-4 shadow-sm sm:flex-row sm:justify-end max-sm:[&>button]:w-full`,children:[w(d.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>w(Ue,{disabled:e,onClick:()=>{d.reset(),f(!1)}})}),w(d.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>w(We,{isSubmitting:e,disabled:t,submitText:n,onClick:()=>d.handleSubmit()})})]})]})]})})},Ke=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>T(H,{className:`gap-y-4 px-4`,children:[T(U,{orientation:r,children:[T(W,{children:[w(K,{children:e}),w(J,{children:t})]}),T(G,{children:[i,w(Y,{isShow:!!n,children:n})]})]}),w(X,{})]}),qe=({title:e,open:t,contentClassName:r,onOpenChange:i,children:a})=>{let o=$();return w(B.Root,{"data-slot":`dialog`,open:t,onOpenChange:i,children:T(B.Portal,{"data-slot":`dialog-portal`,children:[w(B.Overlay,{"data-slot":`dialog-overlay`,className:S(`fixed inset-0 z-40 bg-black/50 backdrop-blur-sm`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`)}),w(B.Content,{"data-slot":`dialog-content`,className:S(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background drop-shadow-lg`,`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:T(`section`,{className:`relative flex size-full flex-col`,children:[w(`header`,{className:`flex h-14 items-center border-border border-b px-4`,children:w(`h2`,{className:`font-semibold text-lg text-primary-strong`,children:e})}),w(`div`,{className:S(`flex flex-1 flex-col overflow-y-auto py-4`,r),children:a}),T(`div`,{className:`flex flex-col space-y-4 border-border border-t px-4 py-2`,children:[w(o.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>w(We,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),w(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>w(Ue,{disabled:e,className:`w-full`,onClick:()=>{o.reset(),i?.(!1)}})})]}),w(B.Close,{asChild:!0,children:w(n,{className:`absolute top-2 right-2`})})]})})]})})},Je=({children:e})=>w(`header`,{"data-slot":`section-header`,className:`px-4 pt-2.5 pb-2 font-medium text-base text-text-positive`,children:e}),Ye=({children:e})=>w(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),Xe=({title:e,children:t})=>T(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-4 ring-border-weak`,children:[w(Je,{children:e}),w(Be,{}),w(Ye,{children:t})]}),Ze=({title:e,description:t,helperText:n})=>T(H,{className:`gap-y-4 px-4`,children:[T(U,{className:`gap-0`,children:[T(W,{children:[w(Se,{className:`mb-1`,children:e}),w(J,{children:t})]}),w(Y,{isShow:!!n,children:n})]}),w(X,{})]}),{fieldContext:Qe,formContext:$e,useFieldContext:Q,useFormContext:$}=ge(),{useAppForm:et,withForm:tt,withFieldGroup:nt}=he({fieldContext:Qe,formContext:$e,fieldComponents:{TextField:Ie,TextareaField:Le,NumberField:Ae,EmailField:Te,PasswordField:je,SelectField:Ne,DateField:we,SwitchField:Fe,RadioGroupField:Me,CheckboxField:Ce,FieldGroup:H,Field:U,FieldContent:W,FieldLabel:K,FieldContentMain:G,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:Ge,TanStackPopoverForm:qe,TanStackContainerForm:He,TanStackSectionForm:Xe,TanStackCardForm:Ve,TanStackFieldGroup:Ke,TanStackTitleField:Ze,TanStackActionsForm:ze,TanStackActionSubmit:Re}});export{U as Field,W as FieldContent,G as FieldContentMain,Z as FieldError,H as FieldGroup,K as FieldLabel,X as FieldSeparator,Q as useTanStackFieldContext,et as useTanStackForm,$ as useTanStackFormContext,nt as withTanStackFieldGroup,tt as withTanStackForm};
2
2
  //# sourceMappingURL=index.mjs.map