@customafk/lunas-ui 0.2.11 → 0.2.13

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 (225) hide show
  1. package/dist/{alert-CI3ANQHC.d.cts → alert-DUC0U7cI.d.mts} +7 -7
  2. package/dist/{alert-DQHE-pdI.mjs → alert-DjfDTXIK.mjs} +1 -1
  3. package/dist/{alert-DQHE-pdI.mjs.map → alert-DjfDTXIK.mjs.map} +1 -1
  4. package/dist/{alert-C1YY0oUh.d.mts → alert-_grSHXD3.d.cts} +6 -6
  5. package/dist/{alert-BqJVf4wD.cjs → alert-kJbUcjIR.cjs} +1 -1
  6. package/dist/{alert-BqJVf4wD.cjs.map → alert-kJbUcjIR.cjs.map} +1 -1
  7. package/dist/{badge-DXeJVvRU.d.mts → badge-BwjhcVgG.d.cts} +6 -6
  8. package/dist/{badge-PKOZAtox.d.cts → badge-DvElo91N.d.mts} +6 -6
  9. package/dist/{button-BwvdZSJE.d.cts → button-B46oQvo-.d.mts} +6 -6
  10. package/dist/{button-BuQ09ya9.d.mts → button-CRujrbey.d.cts} +5 -5
  11. package/dist/{calendar-B2V4Lv0T.cjs → calendar-BMXIBCsr.cjs} +1 -1
  12. package/dist/{calendar-B2V4Lv0T.cjs.map → calendar-BMXIBCsr.cjs.map} +1 -1
  13. package/dist/{calendar-Cw1G0sVL.mjs → calendar-WMJIKojX.mjs} +1 -1
  14. package/dist/{calendar-Cw1G0sVL.mjs.map → calendar-WMJIKojX.mjs.map} +1 -1
  15. package/dist/{cms-layout-r9TmK6hi.cjs → cms-layout-BLJpfFpE.cjs} +1 -1
  16. package/dist/{cms-layout-r9TmK6hi.cjs.map → cms-layout-BLJpfFpE.cjs.map} +1 -1
  17. package/dist/{cms-layout-Bp6rU_of.mjs → cms-layout-BYzUepEk.mjs} +1 -1
  18. package/dist/{cms-layout-Bp6rU_of.mjs.map → cms-layout-BYzUepEk.mjs.map} +1 -1
  19. package/dist/data-display/statistic.d.cts +2 -2
  20. package/dist/{dialog-CRVNgVZU.d.cts → dialog-BuM8wDKV.d.cts} +12 -12
  21. package/dist/{dialog-CiCeXhAu.d.mts → dialog-HkbI2x97.d.mts} +12 -12
  22. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +26 -26
  23. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
  24. package/dist/features/descriptions/index.d.cts +3 -3
  25. package/dist/features/descriptions/index.d.mts +7 -7
  26. package/dist/features/search-modal/index.d.cts +2 -2
  27. package/dist/features/tables/index.cjs +1 -1
  28. package/dist/features/tables/index.d.cts +2 -1181
  29. package/dist/features/tables/index.d.mts +3 -1181
  30. package/dist/features/tables/index.mjs +1 -1
  31. package/dist/features/tanstack-form/index.cjs +1 -1
  32. package/dist/features/tanstack-form/index.d.cts +1 -1
  33. package/dist/features/tanstack-form/index.d.mts +1 -1
  34. package/dist/features/tanstack-form/index.mjs +1 -1
  35. package/dist/{field-DfsTE4Ie.mjs → field-C5HOxxiX.mjs} +2 -2
  36. package/dist/{field-DfsTE4Ie.mjs.map → field-C5HOxxiX.mjs.map} +1 -1
  37. package/dist/{field-C51eJ6QN.cjs → field-D1wvj5Wj.cjs} +2 -2
  38. package/dist/{field-C51eJ6QN.cjs.map → field-D1wvj5Wj.cjs.map} +1 -1
  39. package/dist/index-B5wgYino.d.cts +1009 -0
  40. package/dist/{index-Dm0lp7bT.d.mts → index-DNOZLwxL.d.cts} +282 -282
  41. package/dist/{index-C3SKVvaI.d.cts → index-DaAbyifH.d.mts} +230 -230
  42. package/dist/index-b6uMbewl.d.mts +1009 -0
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.d.cts +8 -8
  45. package/dist/index.d.mts +8 -8
  46. package/dist/index.mjs +1 -1
  47. package/dist/{input-CoHHwUwI.d.mts → input-BLyJp8UZ.d.cts} +6 -6
  48. package/dist/{input-BpZ_mAuD.d.cts → input-BaQTUEQF.d.mts} +5 -5
  49. package/dist/{label-3vAlNtF9.mjs → label-COqDQDMy.mjs} +1 -1
  50. package/dist/{label-3vAlNtF9.mjs.map → label-COqDQDMy.mjs.map} +1 -1
  51. package/dist/{label-zyBJYydC.cjs → label-DYsRdKMt.cjs} +1 -1
  52. package/dist/{label-zyBJYydC.cjs.map → label-DYsRdKMt.cjs.map} +1 -1
  53. package/dist/layouts/cms-layout/index.cjs +1 -1
  54. package/dist/layouts/cms-layout/index.mjs +1 -1
  55. package/dist/layouts/flex.d.cts +4 -4
  56. package/dist/layouts/flex.d.mts +4 -4
  57. package/dist/layouts/payment-layout/index.cjs +1 -1
  58. package/dist/layouts/payment-layout/index.mjs +1 -1
  59. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  60. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  61. package/dist/pages/FeatureFixing.d.cts +2 -2
  62. package/dist/pages/FeatureFixing.d.mts +2 -2
  63. package/dist/pages/NotAuthorized.d.cts +2 -2
  64. package/dist/pages/NotAuthorized.d.mts +2 -2
  65. package/dist/pages/NotFound.d.cts +2 -2
  66. package/dist/pages/NotFound.d.mts +2 -2
  67. package/dist/{payment-layout-C9pP5HdT.cjs → payment-layout-C8_xrnVn.cjs} +1 -1
  68. package/dist/{payment-layout-C9pP5HdT.cjs.map → payment-layout-C8_xrnVn.cjs.map} +1 -1
  69. package/dist/{payment-layout-D-69gOPJ.mjs → payment-layout-CVBTGjMw.mjs} +1 -1
  70. package/dist/{payment-layout-D-69gOPJ.mjs.map → payment-layout-CVBTGjMw.mjs.map} +1 -1
  71. package/dist/{popover-CmoqhK17.cjs → popover-AEt-aSy3.cjs} +1 -1
  72. package/dist/{popover-CmoqhK17.cjs.map → popover-AEt-aSy3.cjs.map} +1 -1
  73. package/dist/{popover-BFJhuzW3.mjs → popover-OJXFbqJi.mjs} +1 -1
  74. package/dist/{popover-BFJhuzW3.mjs.map → popover-OJXFbqJi.mjs.map} +1 -1
  75. package/dist/{radio-group-D5OurBIG.mjs → radio-group-5ktXGXSv.mjs} +1 -1
  76. package/dist/{radio-group-D5OurBIG.mjs.map → radio-group-5ktXGXSv.mjs.map} +1 -1
  77. package/dist/{radio-group-DAv2EU3F.cjs → radio-group-C7FAAawm.cjs} +1 -1
  78. package/dist/{radio-group-DAv2EU3F.cjs.map → radio-group-C7FAAawm.cjs.map} +1 -1
  79. package/dist/{select-DRCKwnTV.mjs → select-DrHceSnf.mjs} +1 -1
  80. package/dist/{select-DRCKwnTV.mjs.map → select-DrHceSnf.mjs.map} +1 -1
  81. package/dist/{select-DfvSMRUq.cjs → select-DzylYFes.cjs} +1 -1
  82. package/dist/{select-DfvSMRUq.cjs.map → select-DzylYFes.cjs.map} +1 -1
  83. package/dist/tables-BtcCgpJB.mjs +4 -0
  84. package/dist/tables-BtcCgpJB.mjs.map +1 -0
  85. package/dist/tables-DZvtd0HA.cjs +4 -0
  86. package/dist/tables-DZvtd0HA.cjs.map +1 -0
  87. package/dist/{tanstack-form-Bb9JXuEq.cjs → tanstack-form-BUjk7DIz.cjs} +2 -2
  88. package/dist/{tanstack-form-Bb9JXuEq.cjs.map → tanstack-form-BUjk7DIz.cjs.map} +1 -1
  89. package/dist/{tanstack-form-BwyHENeF.mjs → tanstack-form-DtZdrifK.mjs} +2 -2
  90. package/dist/{tanstack-form-BwyHENeF.mjs.map → tanstack-form-DtZdrifK.mjs.map} +1 -1
  91. package/dist/{textarea-CvoBIPlJ.cjs → textarea-DZ86A_cm.cjs} +1 -1
  92. package/dist/{textarea-CvoBIPlJ.cjs.map → textarea-DZ86A_cm.cjs.map} +1 -1
  93. package/dist/{textarea-5RD9ToTV.mjs → textarea-Dd1fBf_4.mjs} +1 -1
  94. package/dist/{textarea-5RD9ToTV.mjs.map → textarea-Dd1fBf_4.mjs.map} +1 -1
  95. package/dist/typography/paragraph.d.cts +2 -2
  96. package/dist/typography/paragraph.d.mts +4 -4
  97. package/dist/typography/title.d.cts +2 -2
  98. package/dist/typography/title.d.mts +2 -2
  99. package/dist/ui/alert-dialog.d.cts +12 -12
  100. package/dist/ui/alert-dialog.d.mts +12 -12
  101. package/dist/ui/alert.cjs +1 -1
  102. package/dist/ui/alert.d.cts +1 -1
  103. package/dist/ui/alert.d.mts +1 -1
  104. package/dist/ui/alert.mjs +1 -1
  105. package/dist/ui/aspect-ratio.d.cts +2 -2
  106. package/dist/ui/aspect-ratio.d.mts +2 -2
  107. package/dist/ui/avatar.d.cts +4 -4
  108. package/dist/ui/avatar.d.mts +4 -4
  109. package/dist/ui/badge.d.cts +1 -1
  110. package/dist/ui/badge.d.mts +1 -1
  111. package/dist/ui/breadcrumb.d.cts +8 -8
  112. package/dist/ui/breadcrumb.d.mts +8 -8
  113. package/dist/ui/button-group.d.cts +6 -6
  114. package/dist/ui/button-group.d.mts +4 -4
  115. package/dist/ui/button.d.cts +1 -1
  116. package/dist/ui/button.d.mts +1 -1
  117. package/dist/ui/calendar.cjs +1 -1
  118. package/dist/ui/calendar.d.cts +4 -4
  119. package/dist/ui/calendar.d.mts +4 -4
  120. package/dist/ui/calendar.mjs +1 -1
  121. package/dist/ui/card.d.cts +8 -8
  122. package/dist/ui/card.d.mts +8 -8
  123. package/dist/ui/carousel.d.cts +7 -7
  124. package/dist/ui/carousel.d.mts +7 -7
  125. package/dist/ui/checkbox.d.cts +2 -2
  126. package/dist/ui/checkbox.d.mts +2 -2
  127. package/dist/ui/collapsible.d.cts +4 -4
  128. package/dist/ui/collapsible.d.mts +4 -4
  129. package/dist/ui/command.d.cts +11 -11
  130. package/dist/ui/command.d.mts +11 -11
  131. package/dist/ui/context-menu.d.cts +16 -16
  132. package/dist/ui/context-menu.d.mts +16 -16
  133. package/dist/ui/dialog.d.cts +1 -1
  134. package/dist/ui/dialog.d.mts +1 -1
  135. package/dist/ui/drawer.d.cts +11 -11
  136. package/dist/ui/drawer.d.mts +11 -11
  137. package/dist/ui/dropdown-menu.d.cts +16 -16
  138. package/dist/ui/dropdown-menu.d.mts +16 -16
  139. package/dist/ui/empty.d.cts +7 -7
  140. package/dist/ui/empty.d.mts +9 -9
  141. package/dist/ui/field.cjs +1 -1
  142. package/dist/ui/field.d.cts +22 -22
  143. package/dist/ui/field.d.mts +24 -24
  144. package/dist/ui/field.mjs +1 -1
  145. package/dist/ui/file-uploader.d.cts +2 -2
  146. package/dist/ui/file-uploader.d.mts +2 -2
  147. package/dist/ui/form.cjs +1 -1
  148. package/dist/ui/form.d.cts +11 -11
  149. package/dist/ui/form.d.mts +11 -11
  150. package/dist/ui/form.mjs +1 -1
  151. package/dist/ui/hover-card.d.cts +4 -4
  152. package/dist/ui/hover-card.d.mts +4 -4
  153. package/dist/ui/input-otp.d.cts +5 -5
  154. package/dist/ui/input-otp.d.mts +5 -5
  155. package/dist/ui/input.d.cts +1 -1
  156. package/dist/ui/input.d.mts +1 -1
  157. package/dist/ui/inputs/search-input.d.cts +3 -3
  158. package/dist/ui/inputs/search-input.d.mts +3 -3
  159. package/dist/ui/item.d.cts +14 -14
  160. package/dist/ui/item.d.mts +14 -14
  161. package/dist/ui/label.cjs +1 -1
  162. package/dist/ui/label.d.cts +2 -2
  163. package/dist/ui/label.d.mts +2 -2
  164. package/dist/ui/label.mjs +1 -1
  165. package/dist/ui/menubar.d.cts +17 -17
  166. package/dist/ui/menubar.d.mts +17 -17
  167. package/dist/ui/multi-select.d.cts +2 -2
  168. package/dist/ui/multi-select.d.mts +3 -3
  169. package/dist/ui/navigation-menu.d.cts +11 -11
  170. package/dist/ui/navigation-menu.d.mts +9 -9
  171. package/dist/ui/pagination.d.cts +9 -9
  172. package/dist/ui/pagination.d.mts +9 -9
  173. package/dist/ui/popover.cjs +1 -1
  174. package/dist/ui/popover.d.cts +6 -6
  175. package/dist/ui/popover.d.mts +6 -6
  176. package/dist/ui/popover.mjs +1 -1
  177. package/dist/ui/progress.d.cts +2 -2
  178. package/dist/ui/progress.d.mts +2 -2
  179. package/dist/ui/radio-group.cjs +1 -1
  180. package/dist/ui/radio-group.d.cts +3 -3
  181. package/dist/ui/radio-group.d.mts +3 -3
  182. package/dist/ui/radio-group.mjs +1 -1
  183. package/dist/ui/resizable.d.cts +9 -9
  184. package/dist/ui/resizable.d.mts +9 -9
  185. package/dist/ui/scroll-area.d.cts +6 -6
  186. package/dist/ui/scroll-area.d.mts +6 -6
  187. package/dist/ui/select.cjs +1 -1
  188. package/dist/ui/select.d.cts +9 -9
  189. package/dist/ui/select.d.mts +9 -9
  190. package/dist/ui/select.mjs +1 -1
  191. package/dist/ui/separator.d.cts +2 -2
  192. package/dist/ui/separator.d.mts +2 -2
  193. package/dist/ui/sheet.d.cts +9 -9
  194. package/dist/ui/sheet.d.mts +9 -9
  195. package/dist/ui/sidebar.d.cts +26 -26
  196. package/dist/ui/sidebar.d.mts +26 -26
  197. package/dist/ui/skeleton.d.cts +2 -2
  198. package/dist/ui/skeleton.d.mts +2 -2
  199. package/dist/ui/slider.d.cts +2 -2
  200. package/dist/ui/slider.d.mts +2 -2
  201. package/dist/ui/sonner.d.cts +2 -2
  202. package/dist/ui/sonner.d.mts +2 -2
  203. package/dist/ui/spinner.d.cts +2 -2
  204. package/dist/ui/spinner.d.mts +2 -2
  205. package/dist/ui/switch.d.cts +2 -2
  206. package/dist/ui/switch.d.mts +2 -2
  207. package/dist/ui/table.d.cts +18 -18
  208. package/dist/ui/table.d.mts +18 -18
  209. package/dist/ui/tabs.d.cts +5 -5
  210. package/dist/ui/tabs.d.mts +5 -5
  211. package/dist/ui/textarea.cjs +1 -1
  212. package/dist/ui/textarea.d.cts +2 -2
  213. package/dist/ui/textarea.d.mts +2 -2
  214. package/dist/ui/textarea.mjs +1 -1
  215. package/dist/ui/toggle-group.d.cts +3 -3
  216. package/dist/ui/toggle-group.d.mts +3 -3
  217. package/dist/ui/toggle.d.cts +4 -4
  218. package/dist/ui/toggle.d.mts +4 -4
  219. package/dist/ui/tooltip.d.cts +5 -5
  220. package/dist/ui/tooltip.d.mts +5 -5
  221. package/package.json +1 -1
  222. package/dist/tables-Chn2pQSc.cjs +0 -4
  223. package/dist/tables-Chn2pQSc.cjs.map +0 -1
  224. package/dist/tables-eLIhswqW.mjs +0 -4
  225. package/dist/tables-eLIhswqW.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-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
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-OJXFbqJi.mjs";import{c as S,i as C,n as w,s as T,t as E}from"./select-DrHceSnf.mjs";import{t as D}from"./calendar-WMJIKojX.mjs";import{n as O,t as ee}from"./radio-group-5ktXGXSv.mjs";import{t as te}from"./textarea-Dd1fBf_4.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(D,{mode:`single`,selected:u.state.value??void 0,hidden:{before:s??new Date(1900,0,1),after:c??new Date(2100,11,31)},onSelect:e=>{e&&u.handleChange(e)}})})})]})]})}),P(J,{isShow:!!o,children:o})]})]}),P(X,{})]})},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(ee,{value:o.state.value??``,className:`w-full`,onValueChange:o.handleChange,children:r.map(e=>P(G,{className:I(`h-fit`,o.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,s&&`pointer-events-none bg-muted-muted opacity-60`,o.state.value===e.value&&s&&`border-border-strong!`),children:F(H,{orientation:`horizontal`,className:`items-start gap-3 rounded p-2!`,children:[P(O,{value:e.value,className:`mt-0.5 shrink-0`}),F(U,{className:`gap-0.5!`,children:[P(K,{children:e.label}),P(q,{className:`text-xs`,children:e.description})]})]})},e.value))})})]}),P(X,{})]})},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(E,{value:c.state.value??``,onValueChange:c.handleChange,children:[P(T,{"aria-invalid":l?`true`:void 0,onBlur:c.handleBlur,children:P(S,{placeholder:n})}),F(w,{children:[!!a.length&&a.map(e=>P(C,{value:e.value,children:e.label},e.value)),!a.length&&F(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[P(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-DtZdrifK.mjs.map