@customafk/lunas-ui 0.2.7 → 0.2.9

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 (267) hide show
  1. package/dist/{alert-DIC1_ymv.cjs → alert-BqJVf4wD.cjs} +1 -1
  2. package/dist/{alert-DIC1_ymv.cjs.map → alert-BqJVf4wD.cjs.map} +1 -1
  3. package/dist/{alert-CA1RS1CG.d.cts → alert-D3OOxNtK.d.mts} +6 -6
  4. package/dist/{alert-VP3giy31.mjs → alert-DQHE-pdI.mjs} +1 -1
  5. package/dist/{alert-VP3giy31.mjs.map → alert-DQHE-pdI.mjs.map} +1 -1
  6. package/dist/{alert-DDL82_U3.d.mts → alert-W_Q1Gsld.d.cts} +7 -7
  7. package/dist/{badge-BFTGDsBm.d.cts → badge-Dm1IEgtT.d.cts} +5 -5
  8. package/dist/{badge-Cg0e-djv.d.mts → badge-YFen8D8o.d.mts} +5 -5
  9. package/dist/{button-C76drZpd.d.mts → button-BnbtzQAN.d.mts} +5 -5
  10. package/dist/{button-Bn54lPVz.d.cts → button-Ckjev2AT.d.cts} +3 -3
  11. package/dist/{calendar-CyAPpT2m.cjs → calendar-B2V4Lv0T.cjs} +1 -1
  12. package/dist/{calendar-CyAPpT2m.cjs.map → calendar-B2V4Lv0T.cjs.map} +1 -1
  13. package/dist/{calendar-JKxWM6AF.mjs → calendar-Cw1G0sVL.mjs} +1 -1
  14. package/dist/{calendar-JKxWM6AF.mjs.map → calendar-Cw1G0sVL.mjs.map} +1 -1
  15. package/dist/{checkbox-RZrRNYP2.cjs → checkbox-Di7ACavC.cjs} +1 -1
  16. package/dist/{checkbox-RZrRNYP2.cjs.map → checkbox-Di7ACavC.cjs.map} +1 -1
  17. package/dist/{checkbox-DJEdYOjA.mjs → checkbox-Dzo6oI4y.mjs} +1 -1
  18. package/dist/{checkbox-DJEdYOjA.mjs.map → checkbox-Dzo6oI4y.mjs.map} +1 -1
  19. package/dist/{cms-layout-HfnOQS16.mjs → cms-layout-Bp6rU_of.mjs} +2 -2
  20. package/dist/{cms-layout-HfnOQS16.mjs.map → cms-layout-Bp6rU_of.mjs.map} +1 -1
  21. package/dist/{cms-layout-Dc4moos1.cjs → cms-layout-r9TmK6hi.cjs} +2 -2
  22. package/dist/{cms-layout-Dc4moos1.cjs.map → cms-layout-r9TmK6hi.cjs.map} +1 -1
  23. package/dist/data-display/country.d.mts +1 -1
  24. package/dist/data-display/role-badge.d.mts +1 -1
  25. package/dist/data-display/statistic.d.cts +2 -2
  26. package/dist/data-display/statistic.d.mts +4 -4
  27. package/dist/{dialog-D6ygAOSV.d.mts → dialog-DTtlGouy.d.mts} +12 -12
  28. package/dist/{dialog-CNhwBcEl.d.cts → dialog-DW1Axqio.d.cts} +12 -12
  29. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +1 -1
  30. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
  31. package/dist/features/descriptions/index.d.cts +1 -1
  32. package/dist/features/descriptions/index.d.mts +1 -1
  33. package/dist/features/search-modal/index.d.cts +2 -2
  34. package/dist/features/search-modal/index.d.mts +2 -2
  35. package/dist/features/tables/index.cjs +1 -1
  36. package/dist/features/tables/index.d.cts +156 -6
  37. package/dist/features/tables/index.d.mts +157 -7
  38. package/dist/features/tables/index.mjs +1 -1
  39. package/dist/features/tanstack-form/index.cjs +1 -1
  40. package/dist/features/tanstack-form/index.d.cts +1 -1
  41. package/dist/features/tanstack-form/index.d.mts +1 -1
  42. package/dist/features/tanstack-form/index.mjs +1 -1
  43. package/dist/{field-CppNvoxV.cjs → field-C51eJ6QN.cjs} +2 -2
  44. package/dist/{field-CppNvoxV.cjs.map → field-C51eJ6QN.cjs.map} +1 -1
  45. package/dist/{field-CXVnw75a.mjs → field-DfsTE4Ie.mjs} +2 -2
  46. package/dist/{field-CXVnw75a.mjs.map → field-DfsTE4Ie.mjs.map} +1 -1
  47. package/dist/{index-75nSAiSe.d.mts → index-BIT9bkka.d.mts} +106 -106
  48. package/dist/{index-aTMCQQms.d.cts → index-CO4_ENw7.d.cts} +291 -291
  49. package/dist/index.cjs +1 -1
  50. package/dist/index.d.cts +8 -8
  51. package/dist/index.d.mts +8 -8
  52. package/dist/index.mjs +1 -1
  53. package/dist/{input-Cd0G5y-9.mjs → input-6f9JTc79.mjs} +1 -1
  54. package/dist/{input-Cd0G5y-9.mjs.map → input-6f9JTc79.mjs.map} +1 -1
  55. package/dist/{input-Cl5VkKQh.cjs → input-BMOYFJYM.cjs} +1 -1
  56. package/dist/{input-Cl5VkKQh.cjs.map → input-BMOYFJYM.cjs.map} +1 -1
  57. package/dist/{input-D5dtkW6g.d.mts → input-BrM6EExy.d.mts} +6 -6
  58. package/dist/{input-t2hpPP2K.d.cts → input-CigimPoX.d.cts} +4 -4
  59. package/dist/{label-OmlGaZ5h.mjs → label-3vAlNtF9.mjs} +1 -1
  60. package/dist/{label-OmlGaZ5h.mjs.map → label-3vAlNtF9.mjs.map} +1 -1
  61. package/dist/{label-DkMTQ3Ch.cjs → label-zyBJYydC.cjs} +1 -1
  62. package/dist/{label-DkMTQ3Ch.cjs.map → label-zyBJYydC.cjs.map} +1 -1
  63. package/dist/layouts/cms-layout/index.cjs +1 -1
  64. package/dist/layouts/cms-layout/index.mjs +1 -1
  65. package/dist/layouts/flex.d.cts +4 -4
  66. package/dist/layouts/flex.d.mts +4 -4
  67. package/dist/layouts/payment-layout/index.cjs +1 -1
  68. package/dist/layouts/payment-layout/index.mjs +1 -1
  69. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  70. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  71. package/dist/pages/FeatureFixing.d.cts +2 -2
  72. package/dist/pages/FeatureFixing.d.mts +2 -2
  73. package/dist/pages/NotAuthorized.d.cts +2 -2
  74. package/dist/pages/NotAuthorized.d.mts +2 -2
  75. package/dist/pages/NotFound.d.cts +2 -2
  76. package/dist/pages/NotFound.d.mts +2 -2
  77. package/dist/{payment-layout-Da29dHJe.cjs → payment-layout-C9pP5HdT.cjs} +1 -1
  78. package/dist/{payment-layout-Da29dHJe.cjs.map → payment-layout-C9pP5HdT.cjs.map} +1 -1
  79. package/dist/{payment-layout-wN5c7MCM.mjs → payment-layout-D-69gOPJ.mjs} +1 -1
  80. package/dist/{payment-layout-wN5c7MCM.mjs.map → payment-layout-D-69gOPJ.mjs.map} +1 -1
  81. package/dist/{popover-OJXFbqJi.mjs → popover-BFJhuzW3.mjs} +1 -1
  82. package/dist/{popover-OJXFbqJi.mjs.map → popover-BFJhuzW3.mjs.map} +1 -1
  83. package/dist/{popover-AEt-aSy3.cjs → popover-CmoqhK17.cjs} +1 -1
  84. package/dist/{popover-AEt-aSy3.cjs.map → popover-CmoqhK17.cjs.map} +1 -1
  85. package/dist/progress-0cpDwgAJ.mjs +2 -0
  86. package/dist/progress-0cpDwgAJ.mjs.map +1 -0
  87. package/dist/progress-DE1FdQ1J.cjs +2 -0
  88. package/dist/progress-DE1FdQ1J.cjs.map +1 -0
  89. package/dist/{radio-group-CAgfOr7-.mjs → radio-group-D5OurBIG.mjs} +1 -1
  90. package/dist/{radio-group-CAgfOr7-.mjs.map → radio-group-D5OurBIG.mjs.map} +1 -1
  91. package/dist/{radio-group-BWLdQw7M.cjs → radio-group-DAv2EU3F.cjs} +1 -1
  92. package/dist/{radio-group-BWLdQw7M.cjs.map → radio-group-DAv2EU3F.cjs.map} +1 -1
  93. package/dist/{resizable-DWh_mp5P.mjs → resizable-C2Zl-iLF.mjs} +1 -1
  94. package/dist/{resizable-DWh_mp5P.mjs.map → resizable-C2Zl-iLF.mjs.map} +1 -1
  95. package/dist/{resizable-D6UKwvFa.cjs → resizable-DDPMwd28.cjs} +1 -1
  96. package/dist/{resizable-D6UKwvFa.cjs.map → resizable-DDPMwd28.cjs.map} +1 -1
  97. package/dist/{select-Ze8Fq88G.mjs → select-DRCKwnTV.mjs} +1 -1
  98. package/dist/{select-Ze8Fq88G.mjs.map → select-DRCKwnTV.mjs.map} +1 -1
  99. package/dist/{select-Py_t2nX1.cjs → select-DfvSMRUq.cjs} +1 -1
  100. package/dist/{select-Py_t2nX1.cjs.map → select-DfvSMRUq.cjs.map} +1 -1
  101. package/dist/{spinner-EgMJOaQi.mjs → spinner-B3F9W53l.mjs} +1 -1
  102. package/dist/{spinner-EgMJOaQi.mjs.map → spinner-B3F9W53l.mjs.map} +1 -1
  103. package/dist/{spinner-MKXqwF9G.cjs → spinner-rA8pMY6v.cjs} +1 -1
  104. package/dist/{spinner-MKXqwF9G.cjs.map → spinner-rA8pMY6v.cjs.map} +1 -1
  105. package/dist/tables-D1JyNmcV.cjs +2 -0
  106. package/dist/tables-D1JyNmcV.cjs.map +1 -0
  107. package/dist/tables-DTazQIyy.mjs +2 -0
  108. package/dist/tables-DTazQIyy.mjs.map +1 -0
  109. package/dist/{tanstack-form-BmV2BXDz.cjs → tanstack-form-Bb9JXuEq.cjs} +2 -2
  110. package/dist/{tanstack-form-BmV2BXDz.cjs.map → tanstack-form-Bb9JXuEq.cjs.map} +1 -1
  111. package/dist/{tanstack-form-CJ43hVb_.mjs → tanstack-form-BwyHENeF.mjs} +2 -2
  112. package/dist/{tanstack-form-CJ43hVb_.mjs.map → tanstack-form-BwyHENeF.mjs.map} +1 -1
  113. package/dist/{textarea-CdGSEkZB.mjs → textarea-5RD9ToTV.mjs} +1 -1
  114. package/dist/{textarea-CdGSEkZB.mjs.map → textarea-5RD9ToTV.mjs.map} +1 -1
  115. package/dist/{textarea-BsgmN4jy.cjs → textarea-CvoBIPlJ.cjs} +1 -1
  116. package/dist/{textarea-BsgmN4jy.cjs.map → textarea-CvoBIPlJ.cjs.map} +1 -1
  117. package/dist/{types-B_32Ieia.d.mts → types-CkRjAQZ2.d.mts} +1 -1
  118. package/dist/typography/paragraph.d.cts +4 -4
  119. package/dist/typography/paragraph.d.mts +4 -4
  120. package/dist/typography/title.d.cts +2 -2
  121. package/dist/typography/title.d.mts +2 -2
  122. package/dist/ui/alert-dialog.d.cts +12 -12
  123. package/dist/ui/alert-dialog.d.mts +12 -12
  124. package/dist/ui/alert.cjs +1 -1
  125. package/dist/ui/alert.d.cts +1 -1
  126. package/dist/ui/alert.d.mts +1 -1
  127. package/dist/ui/alert.mjs +1 -1
  128. package/dist/ui/aspect-ratio.d.cts +2 -2
  129. package/dist/ui/aspect-ratio.d.mts +2 -2
  130. package/dist/ui/avatar.d.cts +4 -4
  131. package/dist/ui/avatar.d.mts +4 -4
  132. package/dist/ui/badge.d.cts +1 -1
  133. package/dist/ui/badge.d.mts +1 -1
  134. package/dist/ui/breadcrumb.d.cts +8 -8
  135. package/dist/ui/breadcrumb.d.mts +8 -8
  136. package/dist/ui/button-group.d.cts +6 -6
  137. package/dist/ui/button-group.d.mts +6 -6
  138. package/dist/ui/button.d.cts +1 -1
  139. package/dist/ui/button.d.mts +1 -1
  140. package/dist/ui/calendar.cjs +1 -1
  141. package/dist/ui/calendar.d.cts +4 -4
  142. package/dist/ui/calendar.d.mts +4 -4
  143. package/dist/ui/calendar.mjs +1 -1
  144. package/dist/ui/card.d.cts +8 -8
  145. package/dist/ui/card.d.mts +8 -8
  146. package/dist/ui/carousel.d.cts +7 -7
  147. package/dist/ui/carousel.d.mts +7 -7
  148. package/dist/ui/checkbox.cjs +1 -1
  149. package/dist/ui/checkbox.d.cts +2 -2
  150. package/dist/ui/checkbox.d.mts +2 -2
  151. package/dist/ui/checkbox.mjs +1 -1
  152. package/dist/ui/collapsible.d.cts +4 -4
  153. package/dist/ui/collapsible.d.mts +4 -4
  154. package/dist/ui/command.d.cts +11 -11
  155. package/dist/ui/command.d.mts +11 -11
  156. package/dist/ui/context-menu.d.cts +16 -16
  157. package/dist/ui/context-menu.d.mts +16 -16
  158. package/dist/ui/dialog.d.cts +1 -1
  159. package/dist/ui/dialog.d.mts +1 -1
  160. package/dist/ui/drawer.d.cts +11 -11
  161. package/dist/ui/drawer.d.mts +11 -11
  162. package/dist/ui/dropdown-menu.d.cts +16 -16
  163. package/dist/ui/dropdown-menu.d.mts +16 -16
  164. package/dist/ui/empty.d.cts +7 -7
  165. package/dist/ui/empty.d.mts +9 -9
  166. package/dist/ui/field.cjs +1 -1
  167. package/dist/ui/field.d.cts +24 -24
  168. package/dist/ui/field.d.mts +24 -24
  169. package/dist/ui/field.mjs +1 -1
  170. package/dist/ui/file-uploader.cjs +2 -2
  171. package/dist/ui/file-uploader.cjs.map +1 -1
  172. package/dist/ui/file-uploader.d.cts +2 -2
  173. package/dist/ui/file-uploader.d.mts +2 -2
  174. package/dist/ui/file-uploader.mjs +1 -1
  175. package/dist/ui/file-uploader.mjs.map +1 -1
  176. package/dist/ui/form.cjs +1 -1
  177. package/dist/ui/form.d.cts +11 -11
  178. package/dist/ui/form.d.mts +11 -11
  179. package/dist/ui/form.mjs +1 -1
  180. package/dist/ui/hover-card.d.cts +4 -4
  181. package/dist/ui/hover-card.d.mts +4 -4
  182. package/dist/ui/input-otp.d.cts +5 -5
  183. package/dist/ui/input-otp.d.mts +5 -5
  184. package/dist/ui/input.cjs +1 -1
  185. package/dist/ui/input.d.cts +1 -1
  186. package/dist/ui/input.d.mts +1 -1
  187. package/dist/ui/input.mjs +1 -1
  188. package/dist/ui/inputs/search-input.cjs +1 -1
  189. package/dist/ui/inputs/search-input.d.cts +3 -3
  190. package/dist/ui/inputs/search-input.d.mts +3 -3
  191. package/dist/ui/inputs/search-input.mjs +1 -1
  192. package/dist/ui/item.d.cts +14 -14
  193. package/dist/ui/item.d.mts +11 -11
  194. package/dist/ui/label.cjs +1 -1
  195. package/dist/ui/label.d.cts +2 -2
  196. package/dist/ui/label.d.mts +2 -2
  197. package/dist/ui/label.mjs +1 -1
  198. package/dist/ui/menubar.d.cts +17 -17
  199. package/dist/ui/multi-select.d.cts +2 -2
  200. package/dist/ui/multi-select.d.mts +3 -3
  201. package/dist/ui/navigation-menu.d.cts +11 -11
  202. package/dist/ui/navigation-menu.d.mts +9 -9
  203. package/dist/ui/pagination.d.cts +9 -9
  204. package/dist/ui/pagination.d.mts +9 -9
  205. package/dist/ui/popover.cjs +1 -1
  206. package/dist/ui/popover.d.cts +6 -6
  207. package/dist/ui/popover.d.mts +6 -6
  208. package/dist/ui/popover.mjs +1 -1
  209. package/dist/ui/progress.cjs +1 -2
  210. package/dist/ui/progress.d.cts +2 -2
  211. package/dist/ui/progress.d.mts +2 -2
  212. package/dist/ui/progress.mjs +1 -2
  213. package/dist/ui/radio-group.cjs +1 -1
  214. package/dist/ui/radio-group.d.cts +3 -3
  215. package/dist/ui/radio-group.d.mts +3 -3
  216. package/dist/ui/radio-group.mjs +1 -1
  217. package/dist/ui/resizable.cjs +1 -1
  218. package/dist/ui/resizable.d.cts +9 -9
  219. package/dist/ui/resizable.d.mts +9 -9
  220. package/dist/ui/resizable.mjs +1 -1
  221. package/dist/ui/scroll-area.d.cts +6 -6
  222. package/dist/ui/scroll-area.d.mts +6 -6
  223. package/dist/ui/select.cjs +1 -1
  224. package/dist/ui/select.d.cts +9 -9
  225. package/dist/ui/select.d.mts +9 -9
  226. package/dist/ui/select.mjs +1 -1
  227. package/dist/ui/separator.d.cts +2 -2
  228. package/dist/ui/separator.d.mts +2 -2
  229. package/dist/ui/sheet.d.cts +9 -9
  230. package/dist/ui/sheet.d.mts +9 -9
  231. package/dist/ui/sidebar.cjs +1 -1
  232. package/dist/ui/sidebar.d.cts +28 -28
  233. package/dist/ui/sidebar.d.mts +26 -26
  234. package/dist/ui/sidebar.mjs +1 -1
  235. package/dist/ui/skeleton.d.cts +2 -2
  236. package/dist/ui/skeleton.d.mts +2 -2
  237. package/dist/ui/slider.d.cts +2 -2
  238. package/dist/ui/slider.d.mts +2 -2
  239. package/dist/ui/sonner.d.cts +2 -2
  240. package/dist/ui/sonner.d.mts +2 -2
  241. package/dist/ui/spinner.cjs +1 -1
  242. package/dist/ui/spinner.d.cts +2 -2
  243. package/dist/ui/spinner.d.mts +2 -2
  244. package/dist/ui/spinner.mjs +1 -1
  245. package/dist/ui/switch.d.cts +2 -2
  246. package/dist/ui/switch.d.mts +2 -2
  247. package/dist/ui/table.d.cts +18 -18
  248. package/dist/ui/table.d.mts +9 -9
  249. package/dist/ui/tabs.d.cts +5 -5
  250. package/dist/ui/tabs.d.mts +5 -5
  251. package/dist/ui/textarea.cjs +1 -1
  252. package/dist/ui/textarea.d.cts +2 -2
  253. package/dist/ui/textarea.d.mts +2 -2
  254. package/dist/ui/textarea.mjs +1 -1
  255. package/dist/ui/toggle-group.d.cts +3 -3
  256. package/dist/ui/toggle-group.d.mts +3 -3
  257. package/dist/ui/toggle.d.cts +4 -4
  258. package/dist/ui/toggle.d.mts +2 -2
  259. package/dist/ui/tooltip.d.cts +5 -5
  260. package/dist/ui/tooltip.d.mts +5 -5
  261. package/package.json +1 -1
  262. package/dist/tables-Cc3Wik4i.cjs +0 -2
  263. package/dist/tables-Cc3Wik4i.cjs.map +0 -1
  264. package/dist/tables-DrJKQPsT.mjs +0 -2
  265. package/dist/tables-DrJKQPsT.mjs.map +0 -1
  266. package/dist/ui/progress.cjs.map +0 -1
  267. package/dist/ui/progress.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import{t as e}from"./button-C6ybzxxj.mjs";import{i as t,n,t as r}from"./tooltip-Bj0iOG4s.mjs";import{t as i}from"./separator-BMsbHAVt.mjs";import{t as a}from"./close-BU0kWRVo.mjs";import{c as o,l as s,r as c,s as l,t as u}from"./dialog-BchwY6-N.mjs";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./command-bpcnKEbR.mjs";import{t as _}from"./checkbox-DJEdYOjA.mjs";import{t as v}from"./input-Cd0G5y-9.mjs";import{a as y,i as b,t as x}from"./popover-OJXFbqJi.mjs";import{t as S}from"./calendar-JKxWM6AF.mjs";import{n as C,t as w}from"./radio-group-CAgfOr7-.mjs";import{c as T,i as E,n as D,s as O,t as ee}from"./select-Ze8Fq88G.mjs";import{t as te}from"./textarea-CdGSEkZB.mjs";import{ArrowDownToLine as ne,AtSignIcon as re,BanIcon as ie,CalendarDaysIcon as ae,EyeIcon as oe,EyeOffIcon as se,HelpCircleIcon as ce,InfoIcon as le,Loader2Icon as ue,PackagePlusIcon as de,PlusIcon as fe,Trash2Icon as pe,XIcon as me}from"lucide-react";import{memo as k,useCallback as A,useEffect as he,useId as j,useMemo as M,useRef as N,useState as ge}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 _e}from"class-variance-authority";import{endOfToday as L,endOfTomorrow as ve,endOfYesterday as ye,format as be,lastDayOfMonth as xe,startOfMonth as Se,subDays as R}from"@customafk/react-toolkit/date-fns";import{Dialog as z,Label as Ce,Separator as we,Switch as Te}from"radix-ui";import{createFormHook as Ee,createFormHookContexts as De,useStore as B}from"@tanstack/react-form";const Oe=_e([`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`}}),ke=({label:e,color:t,size:n,className:r,children:i})=>P(`div`,{"data-slot":`required-indicator`,className:Oe({color:t,size:n,className:r}),children:e||i});function Ae({className:e,children:t,...n}){return F(Ce.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(ke,{label:`Required`,color:`danger`,size:`xs`,className:`hidden shrink-0`})]})}const je=_e(`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`}}),Me=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}));Me.displayName=`FieldSet`;const Ne=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}));Ne.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(je({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(Ae,{"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(le,{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(ce,{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 Pe=({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,{})]})},Fe=({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,{})]})},Ie=({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`:be(u.state.value,`PPPP`)}),P(ae,{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(ve())},children:`Tomorrow`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(ye())},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(Se(L()))},children:`This Month`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(xe(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(S,{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,{})]})},Le=({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(re,{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(me,{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,{})]})},Re=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,ze=e=>Number(e).toLocaleString(),Be=(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}},Ve=({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]=ge(a?.toString()??null),S=M(()=>s?.[1]??r,[s,r]),C=M(()=>s&&s[0]-s[1],[s]),w=M(()=>Re(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=``]=Be(parseFloat(e),Math.min(S-1,l||0),i).toString().split(`.`),r=ze(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 he(()=>{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]),he(()=>{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})]})},He=({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(Ve,{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(ue,{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(ie,{})}),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,{})]})},Ue=({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]=ge(!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?se:oe,{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,{})]})},We=({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(w,{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(C,{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,{})]})},Ge=({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(ee,{value:c.state.value??``,onValueChange:c.handleChange,children:[P(O,{"aria-invalid":l?`true`:void 0,onBlur:c.handleBlur,children:P(T,{placeholder:n})}),F(D,{children:[!!a.length&&a.map(e=>P(E,{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(de,{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 Ke({className:e,...t}){return P(Te.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(Te.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 qe=({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(Ke,{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,{})]})},Je=({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(me,{"aria-hidden":`true`})}),y&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:P(ue,{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(ie,{"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,{})]})},Ye=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(ue,{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(ie,{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,{})]})});Ye.displayName=`TextareaField`;const Xe=({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`})})},Ze=({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(fe,{}),`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(ne,{}),`Update`]})})]})};function Qe({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return P(we.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 $e=({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(Qe,{}),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(pe,{}),`Remove`]})]}),et=({children:e})=>P(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),tt=({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`}),nt=({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}),rt=({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(tt,{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(nt,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>d.handleSubmit()})})]})]})]})})},it=({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,{})]}),at=({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(nt,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),P(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>P(tt,{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`})})]})})]})})},ot=({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}),st=({children:e})=>P(`main`,{"data-slot":`section-main`,className:`relative flex flex-col py-4`,children:e}),ct=({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(ot,{children:e}),P(Qe,{}),P(st,{children:t})]}),lt=({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(Ne,{className:`mb-1`,children:e}),P(q,{children:t})]}),P(J,{isShow:!!n,children:n})]}),P(X,{})]}),{fieldContext:ut,formContext:dt,useFieldContext:Q,useFormContext:$}=De(),{useAppForm:ft,withForm:pt,withFieldGroup:mt}=Ee({fieldContext:ut,formContext:dt,fieldComponents:{TextField:Je,TextareaField:Ye,NumberField:He,EmailField:Le,PasswordField:Ue,SelectField:Ge,ComboboxField:Fe,DateField:Ie,SwitchField:qe,RadioGroupField:We,CheckboxField:Pe,FieldGroup:V,Field:H,FieldContent:U,FieldLabel:G,FieldContentMain:W,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:rt,TanStackPopoverForm:at,TanStackContainerForm:et,TanStackSectionForm:ct,TanStackCardForm:$e,TanStackFieldGroup:it,TanStackTitleField:lt,TanStackActionsForm:Ze,TanStackActionSubmit:Xe}});export{pt as a,W as c,G as d,X as f,mt as i,Z as l,ft as n,H as o,$ as r,U as s,Q as t,V as u};
2
- //# sourceMappingURL=tanstack-form-CJ43hVb_.mjs.map
1
+ import{t as e}from"./button-C6ybzxxj.mjs";import{i as t,n,t as r}from"./tooltip-Bj0iOG4s.mjs";import{t as i}from"./separator-BMsbHAVt.mjs";import{t as a}from"./close-BU0kWRVo.mjs";import{c as o,l as s,r as c,s as l,t as u}from"./dialog-BchwY6-N.mjs";import{a as d,i as f,o as p,r as m,s as h,t as g}from"./command-bpcnKEbR.mjs";import{t as _}from"./checkbox-Dzo6oI4y.mjs";import{t as v}from"./input-6f9JTc79.mjs";import{a as y,i as b,t as x}from"./popover-BFJhuzW3.mjs";import{t as S}from"./calendar-Cw1G0sVL.mjs";import{n as C,t as w}from"./radio-group-D5OurBIG.mjs";import{c as T,i as E,n as D,s as O,t as ee}from"./select-DRCKwnTV.mjs";import{t as te}from"./textarea-5RD9ToTV.mjs";import{ArrowDownToLine as ne,AtSignIcon as re,BanIcon as ie,CalendarDaysIcon as ae,EyeIcon as oe,EyeOffIcon as se,HelpCircleIcon as ce,InfoIcon as le,Loader2Icon as ue,PackagePlusIcon as de,PlusIcon as fe,Trash2Icon as pe,XIcon as me}from"lucide-react";import{memo as k,useCallback as A,useEffect as he,useId as j,useMemo as M,useRef as N,useState as ge}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 _e}from"class-variance-authority";import{endOfToday as L,endOfTomorrow as ve,endOfYesterday as ye,format as be,lastDayOfMonth as xe,startOfMonth as Se,subDays as R}from"@customafk/react-toolkit/date-fns";import{Dialog as z,Label as Ce,Separator as we,Switch as Te}from"radix-ui";import{createFormHook as Ee,createFormHookContexts as De,useStore as B}from"@tanstack/react-form";const Oe=_e([`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`}}),ke=({label:e,color:t,size:n,className:r,children:i})=>P(`div`,{"data-slot":`required-indicator`,className:Oe({color:t,size:n,className:r}),children:e||i});function Ae({className:e,children:t,...n}){return F(Ce.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(ke,{label:`Required`,color:`danger`,size:`xs`,className:`hidden shrink-0`})]})}const je=_e(`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`}}),Me=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}));Me.displayName=`FieldSet`;const Ne=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}));Ne.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(je({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(Ae,{"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(le,{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(ce,{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 Pe=({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,{})]})},Fe=({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,{})]})},Ie=({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`:be(u.state.value,`PPPP`)}),P(ae,{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(ve())},children:`Tomorrow`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(ye())},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(Se(L()))},children:`This Month`}),P(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{u.handleChange(xe(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(S,{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,{})]})},Le=({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(re,{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(me,{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,{})]})},Re=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,ze=e=>Number(e).toLocaleString(),Be=(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}},Ve=({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]=ge(a?.toString()??null),S=M(()=>s?.[1]??r,[s,r]),C=M(()=>s&&s[0]-s[1],[s]),w=M(()=>Re(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=``]=Be(parseFloat(e),Math.min(S-1,l||0),i).toString().split(`.`),r=ze(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 he(()=>{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]),he(()=>{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})]})},He=({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(Ve,{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(ue,{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(ie,{})}),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,{})]})},Ue=({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]=ge(!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?se:oe,{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,{})]})},We=({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(w,{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(C,{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,{})]})},Ge=({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(ee,{value:c.state.value??``,onValueChange:c.handleChange,children:[P(O,{"aria-invalid":l?`true`:void 0,onBlur:c.handleBlur,children:P(T,{placeholder:n})}),F(D,{children:[!!a.length&&a.map(e=>P(E,{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(de,{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 Ke({className:e,...t}){return P(Te.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(Te.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 qe=({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(Ke,{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,{})]})},Je=({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(me,{"aria-hidden":`true`})}),y&&P(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:P(ue,{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(ie,{"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,{})]})},Ye=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(ue,{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(ie,{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,{})]})});Ye.displayName=`TextareaField`;const Xe=({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`})})},Ze=({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(fe,{}),`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(ne,{}),`Update`]})})]})};function Qe({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return P(we.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 $e=({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(Qe,{}),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(pe,{}),`Remove`]})]}),et=({children:e})=>P(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),tt=({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`}),nt=({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}),rt=({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(tt,{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(nt,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>d.handleSubmit()})})]})]})]})})},it=({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,{})]}),at=({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(nt,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),P(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>P(tt,{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`})})]})})]})})},ot=({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}),st=({children:e})=>P(`main`,{"data-slot":`section-main`,className:`relative flex flex-col py-4`,children:e}),ct=({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(ot,{children:e}),P(Qe,{}),P(st,{children:t})]}),lt=({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(Ne,{className:`mb-1`,children:e}),P(q,{children:t})]}),P(J,{isShow:!!n,children:n})]}),P(X,{})]}),{fieldContext:ut,formContext:dt,useFieldContext:Q,useFormContext:$}=De(),{useAppForm:ft,withForm:pt,withFieldGroup:mt}=Ee({fieldContext:ut,formContext:dt,fieldComponents:{TextField:Je,TextareaField:Ye,NumberField:He,EmailField:Le,PasswordField:Ue,SelectField:Ge,ComboboxField:Fe,DateField:Ie,SwitchField:qe,RadioGroupField:We,CheckboxField:Pe,FieldGroup:V,Field:H,FieldContent:U,FieldLabel:G,FieldContentMain:W,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:rt,TanStackPopoverForm:at,TanStackContainerForm:et,TanStackSectionForm:ct,TanStackCardForm:$e,TanStackFieldGroup:it,TanStackTitleField:lt,TanStackActionsForm:Ze,TanStackActionSubmit:Xe}});export{pt as a,W as c,G as d,X as f,mt as i,Z as l,ft as n,H as o,$ as r,U as s,Q as t,V as u};
2
+ //# sourceMappingURL=tanstack-form-BwyHENeF.mjs.map