@customafk/lunas-ui 0.1.95 → 0.1.96

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 (204) hide show
  1. package/dist/{button-DgVnlWul.d.mts → button-Bjf5wK56.d.mts} +3 -3
  2. package/dist/{button-BRHW1rSO.d.cts → button-DS0K3vIB.d.cts} +5 -5
  3. package/dist/cards/grid-product-card.cjs +1 -1
  4. package/dist/cards/grid-product-card.mjs +1 -1
  5. package/dist/cards/product-card.cjs +1 -1
  6. package/dist/cards/product-card.mjs +1 -1
  7. package/dist/cards/simple-card.cjs +1 -1
  8. package/dist/cards/simple-card.d.mts +2 -2
  9. package/dist/cards/simple-card.mjs +1 -1
  10. package/dist/{command-BciJADha.cjs → command-Dd4OnuB0.cjs} +2 -2
  11. package/dist/{command-BciJADha.cjs.map → command-Dd4OnuB0.cjs.map} +1 -1
  12. package/dist/{command-DSvEsWG8.mjs → command-Uq5FAdtW.mjs} +2 -2
  13. package/dist/{command-DSvEsWG8.mjs.map → command-Uq5FAdtW.mjs.map} +1 -1
  14. package/dist/data-display/country.cjs +1 -1
  15. package/dist/data-display/country.mjs +1 -1
  16. package/dist/data-display/empty.d.mts +2 -2
  17. package/dist/data-display/name.cjs +1 -1
  18. package/dist/data-display/name.mjs +1 -1
  19. package/dist/data-display/statistic.d.cts +2 -2
  20. package/dist/data-display/statistic.d.mts +2 -2
  21. package/dist/data-display/user.cjs +1 -1
  22. package/dist/data-display/user.mjs +1 -1
  23. package/dist/{dialog-D5TBBX99.cjs → dialog-2N-D9B9o.cjs} +2 -2
  24. package/dist/{dialog-D5TBBX99.cjs.map → dialog-2N-D9B9o.cjs.map} +1 -1
  25. package/dist/{dialog-DSvmcuYl.mjs → dialog-DTz8ngeU.mjs} +2 -2
  26. package/dist/{dialog-DSvmcuYl.mjs.map → dialog-DTz8ngeU.mjs.map} +1 -1
  27. package/dist/{dialog-B4h77Z-1.d.mts → dialog-DezpAaP9.d.mts} +12 -12
  28. package/dist/{dialog-zsQVCZzj.d.cts → dialog-yMVgXLsZ.d.cts} +12 -12
  29. package/dist/dialogs/confirm-dialog.cjs +1 -1
  30. package/dist/dialogs/confirm-dialog.cjs.map +1 -1
  31. package/dist/dialogs/confirm-dialog.d.cts +3 -0
  32. package/dist/dialogs/confirm-dialog.d.mts +3 -0
  33. package/dist/dialogs/confirm-dialog.mjs +1 -1
  34. package/dist/dialogs/confirm-dialog.mjs.map +1 -1
  35. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +24 -24
  36. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
  37. package/dist/dialogs/error-dialog.cjs +1 -1
  38. package/dist/dialogs/error-dialog.mjs +1 -1
  39. package/dist/dialogs/loading-dialog.cjs +1 -1
  40. package/dist/dialogs/loading-dialog.mjs +1 -1
  41. package/dist/features/descriptions/index.cjs +1 -1
  42. package/dist/features/descriptions/index.mjs +1 -1
  43. package/dist/features/search-modal/index.cjs +1 -1
  44. package/dist/features/search-modal/index.d.cts +2 -2
  45. package/dist/features/search-modal/index.d.mts +2 -2
  46. package/dist/features/search-modal/index.mjs +1 -1
  47. package/dist/features/tables/index.cjs +1 -1
  48. package/dist/features/tables/index.cjs.map +1 -1
  49. package/dist/features/tables/index.d.cts +1 -1
  50. package/dist/features/tables/index.d.mts +1 -1
  51. package/dist/features/tables/index.mjs +1 -1
  52. package/dist/features/tables/index.mjs.map +1 -1
  53. package/dist/features/tanstack-form/index.cjs +1 -1
  54. package/dist/features/tanstack-form/index.d.cts +103 -103
  55. package/dist/features/tanstack-form/index.d.mts +103 -103
  56. package/dist/features/tanstack-form/index.mjs +1 -1
  57. package/dist/{input-Dv7UKl6Z.d.mts → input-DcxbhzQO.d.mts} +6 -6
  58. package/dist/{input-VtO0d8O-.d.cts → input-Dg5VFdk2.d.cts} +4 -4
  59. package/dist/layouts/flex.d.cts +2 -2
  60. package/dist/layouts/flex.d.mts +6 -6
  61. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  62. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  63. package/dist/pages/FeatureFixing.d.cts +2 -2
  64. package/dist/pages/FeatureFixing.d.mts +2 -2
  65. package/dist/pages/NotAuthorized.d.cts +2 -2
  66. package/dist/pages/NotAuthorized.d.mts +2 -2
  67. package/dist/pages/NotFound.d.cts +2 -2
  68. package/dist/pages/NotFound.d.mts +2 -2
  69. package/dist/paragraph-BBye8n4M.cjs +2 -0
  70. package/dist/paragraph-BBye8n4M.cjs.map +1 -0
  71. package/dist/paragraph-BS88Xdo7.mjs +2 -0
  72. package/dist/paragraph-BS88Xdo7.mjs.map +1 -0
  73. package/dist/typography/paragraph.cjs +1 -1
  74. package/dist/typography/paragraph.d.cts +1 -1
  75. package/dist/typography/paragraph.d.mts +5 -5
  76. package/dist/typography/paragraph.mjs +1 -1
  77. package/dist/typography/title.d.cts +2 -2
  78. package/dist/typography/title.d.mts +2 -2
  79. package/dist/ui/alert-dialog.cjs +1 -1
  80. package/dist/ui/alert-dialog.cjs.map +1 -1
  81. package/dist/ui/alert-dialog.d.cts +12 -12
  82. package/dist/ui/alert-dialog.d.mts +12 -12
  83. package/dist/ui/alert-dialog.mjs +1 -1
  84. package/dist/ui/alert-dialog.mjs.map +1 -1
  85. package/dist/ui/alert.d.cts +6 -6
  86. package/dist/ui/alert.d.mts +4 -4
  87. package/dist/ui/aspect-ratio.d.cts +2 -2
  88. package/dist/ui/aspect-ratio.d.mts +2 -2
  89. package/dist/ui/avatar.d.cts +4 -4
  90. package/dist/ui/avatar.d.mts +4 -4
  91. package/dist/ui/badge.d.cts +2 -2
  92. package/dist/ui/badge.d.mts +4 -4
  93. package/dist/ui/breadcrumb.d.cts +8 -8
  94. package/dist/ui/breadcrumb.d.mts +8 -8
  95. package/dist/ui/button-group.d.cts +5 -5
  96. package/dist/ui/button-group.d.mts +7 -7
  97. package/dist/ui/button.d.cts +1 -1
  98. package/dist/ui/button.d.mts +1 -1
  99. package/dist/ui/buttons/add-new.cjs +1 -1
  100. package/dist/ui/buttons/add-new.mjs +1 -1
  101. package/dist/ui/buttons/refresh.cjs +1 -1
  102. package/dist/ui/buttons/refresh.mjs +1 -1
  103. package/dist/ui/calendar.d.cts +1 -1
  104. package/dist/ui/calendar.d.mts +4 -4
  105. package/dist/ui/card.cjs +1 -1
  106. package/dist/ui/card.d.cts +8 -8
  107. package/dist/ui/card.d.mts +8 -8
  108. package/dist/ui/card.mjs +1 -1
  109. package/dist/ui/carousel.d.cts +7 -7
  110. package/dist/ui/carousel.d.mts +7 -7
  111. package/dist/ui/checkbox.d.cts +2 -2
  112. package/dist/ui/checkbox.d.mts +2 -2
  113. package/dist/ui/collapsible.d.cts +4 -4
  114. package/dist/ui/collapsible.d.mts +4 -4
  115. package/dist/ui/command.cjs +1 -1
  116. package/dist/ui/command.d.cts +11 -11
  117. package/dist/ui/command.d.mts +11 -11
  118. package/dist/ui/command.mjs +1 -1
  119. package/dist/ui/context-menu.d.cts +16 -16
  120. package/dist/ui/context-menu.d.mts +16 -16
  121. package/dist/ui/dialog.cjs +1 -1
  122. package/dist/ui/dialog.d.cts +1 -1
  123. package/dist/ui/dialog.d.mts +1 -1
  124. package/dist/ui/dialog.mjs +1 -1
  125. package/dist/ui/drawer.d.cts +11 -11
  126. package/dist/ui/drawer.d.mts +11 -11
  127. package/dist/ui/dropdown-menu.d.cts +16 -16
  128. package/dist/ui/dropdown-menu.d.mts +16 -16
  129. package/dist/ui/empty.d.cts +7 -7
  130. package/dist/ui/empty.d.mts +9 -9
  131. package/dist/ui/field.d.cts +12 -12
  132. package/dist/ui/field.d.mts +23 -23
  133. package/dist/ui/file-uploader.d.cts +2 -2
  134. package/dist/ui/file-uploader.d.mts +2 -2
  135. package/dist/ui/form.d.cts +7 -7
  136. package/dist/ui/form.d.mts +11 -11
  137. package/dist/ui/hover-card.d.cts +4 -4
  138. package/dist/ui/hover-card.d.mts +4 -4
  139. package/dist/ui/input-otp.d.cts +5 -5
  140. package/dist/ui/input-otp.d.mts +5 -5
  141. package/dist/ui/input.d.cts +1 -1
  142. package/dist/ui/input.d.mts +1 -1
  143. package/dist/ui/inputs/search-input.d.cts +3 -3
  144. package/dist/ui/inputs/search-input.d.mts +3 -3
  145. package/dist/ui/item.d.cts +12 -12
  146. package/dist/ui/item.d.mts +15 -15
  147. package/dist/ui/label.d.cts +2 -2
  148. package/dist/ui/label.d.mts +2 -2
  149. package/dist/ui/menubar.d.cts +17 -17
  150. package/dist/ui/menubar.d.mts +17 -17
  151. package/dist/ui/multi-select.cjs +1 -1
  152. package/dist/ui/multi-select.d.cts +2 -2
  153. package/dist/ui/multi-select.d.mts +3 -3
  154. package/dist/ui/multi-select.mjs +1 -1
  155. package/dist/ui/navigation-menu.d.cts +9 -9
  156. package/dist/ui/navigation-menu.d.mts +11 -11
  157. package/dist/ui/pagination.d.cts +9 -9
  158. package/dist/ui/pagination.d.mts +9 -9
  159. package/dist/ui/popover.d.cts +6 -6
  160. package/dist/ui/popover.d.mts +6 -6
  161. package/dist/ui/progress.d.cts +2 -2
  162. package/dist/ui/progress.d.mts +2 -2
  163. package/dist/ui/radio-group.d.cts +3 -3
  164. package/dist/ui/radio-group.d.mts +3 -3
  165. package/dist/ui/resizable.d.cts +9 -9
  166. package/dist/ui/resizable.d.mts +9 -9
  167. package/dist/ui/scroll-area.d.cts +6 -6
  168. package/dist/ui/scroll-area.d.mts +6 -6
  169. package/dist/ui/select.d.cts +9 -9
  170. package/dist/ui/select.d.mts +9 -9
  171. package/dist/ui/separator.d.cts +2 -2
  172. package/dist/ui/separator.d.mts +2 -2
  173. package/dist/ui/sheet.d.cts +9 -9
  174. package/dist/ui/sheet.d.mts +9 -9
  175. package/dist/ui/sidebar.d.cts +26 -26
  176. package/dist/ui/sidebar.d.mts +28 -28
  177. package/dist/ui/skeleton.d.cts +2 -2
  178. package/dist/ui/skeleton.d.mts +2 -2
  179. package/dist/ui/slider.d.cts +2 -2
  180. package/dist/ui/slider.d.mts +2 -2
  181. package/dist/ui/sonner.d.cts +2 -2
  182. package/dist/ui/sonner.d.mts +2 -2
  183. package/dist/ui/spinner.d.cts +2 -2
  184. package/dist/ui/spinner.d.mts +2 -2
  185. package/dist/ui/switch.d.cts +2 -2
  186. package/dist/ui/switch.d.mts +2 -2
  187. package/dist/ui/table.d.cts +18 -18
  188. package/dist/ui/table.d.mts +18 -18
  189. package/dist/ui/tabs.d.cts +5 -5
  190. package/dist/ui/tabs.d.mts +5 -5
  191. package/dist/ui/textarea.d.cts +2 -2
  192. package/dist/ui/textarea.d.mts +2 -2
  193. package/dist/ui/toggle-group.d.cts +3 -3
  194. package/dist/ui/toggle-group.d.mts +3 -3
  195. package/dist/ui/toggle.d.cts +2 -2
  196. package/dist/ui/toggle.d.mts +4 -4
  197. package/dist/ui/tooltip.d.cts +5 -5
  198. package/dist/ui/tooltip.d.mts +5 -5
  199. package/package.json +1 -1
  200. package/styles/typography.css +2 -0
  201. package/dist/paragraph-4z_6Z5aj.cjs +0 -2
  202. package/dist/paragraph-4z_6Z5aj.cjs.map +0 -1
  203. package/dist/paragraph-BTJV4aeF.mjs +0 -2
  204. package/dist/paragraph-BTJV4aeF.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- const e=require(`../../chunk-Bmb41Sf3.cjs`);require(`../../heading-BEm5CCSE.cjs`),require(`../../paragraph-4z_6Z5aj.cjs`),require(`../../button.variants-8QOIR433.cjs`);const t=require(`../../button-8Snjc8iT.cjs`),n=require(`../../separator-C3ip6sbh.cjs`),r=require(`../../close-D_Ge7gnP.cjs`),i=require(`../../dialog-D5TBBX99.cjs`),a=require(`../../checkbox-C0fSWwmD.cjs`),o=require(`../../input-BFWWaN-v.cjs`),s=require(`../../popover-DzDrgttC.cjs`),c=require(`../../calendar-DgLMLD8R.cjs`),l=require(`../../radio-group-CBhRsUjN.cjs`),u=require(`../../select-2CgwiefV.cjs`),d=require(`../../textarea-COQoSVSc.cjs`);let f=require(`@customafk/react-toolkit/utils`),p=require(`class-variance-authority`),m=require(`react`),h=require(`react/jsx-runtime`),g=require(`lucide-react`),_=require(`@customafk/react-toolkit/date-fns`),v=require(`radix-ui`),y=require(`@tanstack/react-form`);const b=(0,p.cva)([`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`}}),x=({label:e,color:t,size:n,className:r,children:i})=>(0,h.jsx)(`div`,{"data-slot":`required-indicator`,className:b({color:t,size:n,className:r}),children:e||i});function S({className:e,children:t,...n}){return(0,h.jsxs)(v.Label.Root,{"data-slot":`label`,className:(0,f.cn)(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[t,(0,h.jsx)(x,{label:`Required`,color:`danger`,size:`sm`,className:`hidden`})]})}const C=(0,p.cva)(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0 @md/field-group:*:data-[slot=field-content]:gap-2`,{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`}}),w=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,f.cn)(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));w.displayName=`FieldSet`;const T=(0,m.memo)(({className:e,variant:t=`legend`,...n})=>(0,h.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,f.cn)(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));T.displayName=`FieldLegend`;const E=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-group`,className:(0,f.cn)(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));E.displayName=`FieldGroup`;const D=(0,m.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,h.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,f.cn)(C({orientation:t}),e),...n}));D.displayName=`Field`;const O=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-content`,className:(0,f.cn)(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));O.displayName=`FieldContent`;const k=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-content-main`,className:(0,f.cn)(`relative`,e),...t})),A=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(S,{"data-slot":`field-label`,className:(0,f.cn)(`group/field-label peer/field-label flex h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));A.displayName=`FieldLabel`;const j=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-label`,className:(0,f.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));j.displayName=`FieldTitle`;const M=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`p`,{"data-slot":`field-description`,className:(0,f.cn)(`nth-last-2:-mt-1 font-normal text-sm text-text-positive-weak leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));M.displayName=`FieldDescription`;const N=(0,m.memo)(({isShow:e=!0,className:t,...n})=>e===!1?null:(0,h.jsx)(`div`,{"data-slot":`field-note`,className:(0,f.cn)(`text-wrap rounded border border-primary-muted bg-primary-bg-subtle p-2 text-text-positive-weak text-xs`,t),...n}));N.displayName=`FieldNote`;const P=(0,m.memo)(({children:e,className:t,...r})=>(0,h.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,f.cn)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...r,children:[(0,h.jsx)(n.t,{className:`absolute inset-0 top-1/2`}),e&&(0,h.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));P.displayName=`FieldSeparator`;const F=(0,m.memo)(({className:e,children:t,errors:n,...r})=>{let i=(0,m.useMemo)(()=>t||(n?n?.length===1&&n[0]?.message?(0,h.jsx)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:(0,h.jsx)(`p`,{children:n[0].message})}):(0,h.jsx)(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?(0,h.jsx)(`li`,{children:e},e):e?.message?(0,h.jsx)(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?(0,h.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,f.cn)(`w-full font-semibold text-danger-strong text-xs`,e),...r,children:i}):null});F.displayName=`FieldError`;const I=({label:e,description:t,options:n,helperText:r,orientation:i})=>{let o=Z(),s=(0,y.useStore)(o.form.store,({isSubmitting:e})=>e);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:i,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{children:e}),(0,h.jsx)(M,{children:t}),(0,h.jsx)(N,{isShow:!!r,children:r})]}),(0,h.jsx)(k,{children:(0,h.jsx)(E,{className:`flex flex-col gap-y-2`,children:n.map(e=>(0,h.jsxs)(D,{orientation:`horizontal`,children:[(0,h.jsx)(a.t,{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 !t&&o.state.value===null&&o.setValue(null)}}),(0,h.jsx)(A,{htmlFor:`${o.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),(0,h.jsx)(P,{})]})},L=({label:e,description:n,placeholder:r,orientation:i=`responsive`,helperText:a,minDate:o,maxDate:l,required:u})=>{let d=Z(),p=(0,m.useMemo)(()=>u?d.state.value===null:!1,[u,d.state.value]),v=(0,m.useMemo)(()=>d.state.meta.isTouched&&!d.state.meta.isValid,[d.state.meta.isTouched,d.state.meta.isValid]);return(0,h.jsxs)(E,{className:`px-4`,children:[(0,h.jsxs)(D,{orientation:i,"data-invalid":v,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:d.name,"aria-required":p,children:e}),(0,h.jsx)(M,{children:n})]}),(0,h.jsxs)(k,{className:`flex flex-col space-y-1`,children:[(0,h.jsx)(`div`,{className:`flex w-full flex-col`,children:(0,h.jsxs)(s.t,{children:[(0,h.jsx)(s.a,{asChild:!0,children:(0,h.jsxs)(t.t,{variant:`outline`,color:`muted`,size:`lg`,className:(0,f.cn)(`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`,d.state.value===null&&`text-text-positive-muted`),children:[(0,h.jsx)(`p`,{children:d.state.value===null?r||`Select date`:(0,_.format)(d.state.value,`PPPP`)}),(0,h.jsx)(g.CalendarDaysIcon,{strokeWidth:1})]})}),(0,h.jsxs)(s.i,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:d.handleBlur,children:[(0,h.jsxs)(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.endOfToday)())},children:`Today`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.endOfTomorrow)())},children:`Tomorrow`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.endOfYesterday)())},children:`Yesterday`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.subDays)((0,_.endOfToday)(),3))},children:`Last 3 Days`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.subDays)((0,_.endOfToday)(),7))},children:`Last 7 Days`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.subDays)((0,_.endOfToday)(),30))},children:`Last 30 Days`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.startOfMonth)((0,_.endOfToday)()))},children:`This Month`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.lastDayOfMonth)((0,_.endOfToday)()))},children:`Last Month`})]}),(0,h.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,h.jsx)(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:(0,h.jsx)(c.t,{mode:`single`,selected:d.state.value??void 0,hidden:{before:o??new Date(1900,0,1),after:l??new Date(2100,11,31)},onSelect:e=>{e&&d.handleChange(e)}})})})]})]})}),(0,h.jsx)(N,{isShow:!!a,children:a})]})]}),(0,h.jsx)(P,{})]})},R=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0,maxLength:s})=>{let{form:c,name:l,state:u,handleBlur:d,handleChange:p}=Z(),_=(0,y.useStore)(c.store,({isSubmitting:e})=>e),v=(0,m.useMemo)(()=>u.meta.isTouched&&!u.meta.isValid,[u.meta.isTouched,u.meta.isValid]),b=(0,m.useCallback)(({target:{value:e}})=>{_||s&&e.length>s||p(e||null)},[_,s,p]),x=(0,m.useCallback)(()=>{_||p(null)},[_,p]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{"data-invalid":v,orientation:r,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:l,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(o.t,{id:l,name:l,value:u.value===null?``:u.value,"aria-invalid":v,autoComplete:`email`,placeholder:n,className:(0,f.cn)(`pl-9`,_&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:d,onChange:b}),(0,h.jsx)(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:(0,h.jsx)(g.AtSignIcon,{size:14})}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-y-0 inset-e-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:x,children:(0,h.jsx)(g.XIcon,{size:14,"aria-hidden":`true`})}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&(0,h.jsx)(F,{errors:u.meta.errors})}),(0,h.jsx)(N,{isShow:!!i,children:i})]})]}),(0,h.jsx)(P,{})]})},ee=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,te=e=>Number(e).toLocaleString(),ne=(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}},re=({disabled:e=!1,readOnly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:a=null,unitText:s,decimal:c,placeholder:l,precision:u,wrapperClassName:d,className:p,onChange:g,onValueChange:_,onFocus:v,onBlur:y,...b})=>{let x=(0,m.useRef)(null),S=(0,m.useRef)(null),[C,w]=(0,m.useState)(a?.toString()??null),T=(0,m.useMemo)(()=>c?.[1]??r,[c,r]),E=(0,m.useMemo)(()=>c&&c[0]-c[1],[c]),D=(0,m.useMemo)(()=>ee(n),[n]),O=(0,m.useCallback)(e=>{if(!T||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=T&&r<=(E??1/0)},[T,E]),k=(0,m.useCallback)(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=ne(parseFloat(e),Math.min(T-1,u||0),i).toString().split(`.`),r=te(t);return n?`${r}.${n}`:r},[T,u,i]),A=(0,m.useCallback)(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){_?.(0),w(e);return}if(n){w(()=>(_?.(0),e));return}},[_]),j=(0,m.useCallback)(e=>{g?.(e);let{value:t}=e.target;if(t===``||t===void 0){_?.(null),w(null);return}A(t),!(!D.test(t)||!O(t))&&(_?.(parseFloat(t)||0),w(t))},[O,g,_,A,D]),M=(0,m.useCallback)(e=>{t||(v?.(e),w(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,v]),N=(0,m.useCallback)(e=>{t||(y?.(e),w(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?k(e):null))},[t,k,y]);return(0,m.useEffect)(()=>{let e=document.activeElement===S.current;if(a==null||!D.test(a.toString())||!O(a.toString())){w(null);return}w(t=>e?t:k(a.toString()))},[k,a,O,D]),(0,m.useEffect)(()=>{if(!x.current||!S.current||!s)return;let e=x.current.offsetWidth;S.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[s]),(0,h.jsxs)(`div`,{className:(0,f.cn)(`relative`,d),children:[(0,h.jsx)(o.t,{...b,ref:S,value:C||(t?`0`:``),placeholder:l,disabled:e,readOnly:t,className:(0,f.cn)(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,p),onChange:j,onFocus:M,onBlur:N}),s&&(0,h.jsx)(`span`,{ref:x,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:s})]})},ie=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,showErrorMessage:a=!0,rounding:o,decimalPlaces:s,percision:c,unit:l,required:u,allowNegative:d})=>{let p=Z(),_=(0,y.useStore)(p.form.store,({isSubmitting:e})=>e),v=(0,m.useMemo)(()=>p.state.meta.errors,[p.state.meta.errors]),b=(0,m.useMemo)(()=>u?p.state.value===null:!1,[u,p.state.value]),x=(0,m.useCallback)(e=>{_||p.handleChange(e)},[_,p.handleChange]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:i,"data-invalid":p.state.meta.isTouched&&!p.state.meta.isValid,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:p.name,"aria-required":b,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsxs)(`div`,{className:`relative w-full`,children:[(0,h.jsx)(re,{id:p.name,value:p.state.value,"aria-invalid":p.state.meta.isTouched&&!p.state.meta.isValid&&p.state.meta.isDirty,placeholder:n,roundingRule:o,numberAfterDecimalPoint:s,precision:c,unitText:l,allowNegative:d,className:(0,f.cn)(_&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:p.handleBlur,onValueChange:x}),_&&(0,h.jsx)(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:(0,h.jsx)(g.Loader2Icon,{className:`animate-spin text-primary-strong`})}),p.state.meta.isDirty&&a&&!!v.length&&(0,h.jsx)(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:(0,h.jsx)(g.BanIcon,{})}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:p.state.meta.isDirty&&a&&(0,h.jsx)(F,{errors:v})})]}),(0,h.jsx)(N,{isShow:!!r,children:r})]})]}),(0,h.jsx)(P,{})]})},z=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0})=>{let{form:s,name:c,state:l,handleBlur:u,handleChange:d}=Z(),f=(0,y.useStore)(s.store,({isSubmitting:e})=>e),[p,_]=(0,m.useState)(!1),v=(0,m.useMemo)(()=>l.meta.isTouched&&!l.meta.isValid,[l.meta.isTouched,l.meta.isValid]),b=(0,m.useCallback)(()=>_(e=>!e),[]),x=(0,m.useCallback)(({target:{value:e}})=>{f||d(e||null)},[f,d]);return(0,h.jsx)(E,{className:`gap-y-4 px-4`,children:(0,h.jsxs)(D,{"data-invalid":v,orientation:r,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:c,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(o.t,{id:c,type:p?`text`:`password`,placeholder:n,value:l.value??``,"aria-invalid":v,autoComplete:`new-password`,onBlur:u,onChange:x}),(0,h.jsx)(`button`,{className:`absolute inset-y-0 inset-e-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:b,"aria-label":p?`Hide password`:`Show password`,"aria-pressed":p,"aria-controls":`password`,children:p?(0,h.jsx)(g.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,h.jsx)(g.EyeIcon,{size:16,"aria-hidden":`true`})}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&(0,h.jsx)(F,{errors:l.meta.errors})}),(0,h.jsx)(N,{isShow:!!i,children:i})]})]})})},B=({label:e,description:t,orientation:n,options:r,helperText:i})=>{let a=Z(),o=(0,y.useStore)(a.form.store,({isSubmitting:e})=>e);return(0,h.jsxs)(E,{className:`px-4`,children:[(0,h.jsxs)(D,{orientation:n,className:`flex-col gap-2`,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{children:e}),(0,h.jsx)(M,{children:t}),(0,h.jsx)(N,{isShow:!!i,children:i})]}),(0,h.jsx)(k,{children:(0,h.jsx)(l.t,{defaultValue:a.state.value??void 0,className:`w-full`,onValueChange:a.handleChange,children:r.map(e=>(0,h.jsx)(A,{className:(0,f.cn)(`h-fit`,a.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,o&&`pointer-events-none bg-muted-muted opacity-60`,a.state.value===e.value&&o&&`border-border-strong!`),children:(0,h.jsxs)(D,{orientation:`horizontal`,className:`justify-between rounded p-2!`,children:[(0,h.jsxs)(O,{className:`gap-1!`,children:[(0,h.jsx)(j,{children:e.label}),(0,h.jsx)(M,{className:`text-xs`,children:e.description})]}),(0,h.jsx)(l.n,{value:e.value})]})},e.value))})})]}),(0,h.jsx)(P,{})]})},V=({label:e,description:t,placeholder:n,orientation:r=`responsive`,options:i,helperText:a,required:o=!1})=>{let s=Z(),c=(0,m.useMemo)(()=>s.state.meta.isTouched&&!s.state.meta.isValid,[s.state.meta.isTouched,s.state.meta.isValid]),l=(0,m.useMemo)(()=>o?s.state.value===null:!1,[o,s.state.value]),d=(0,m.useMemo)(()=>s.state.meta.errors,[s.state.meta.errors]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:r,"data-invalid":s.state.meta.isTouched&&!s.state.meta.isValid,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:s.name,"aria-required":l,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{className:`flex flex-col`,children:[(0,h.jsxs)(u.t,{defaultValue:s.state.value||void 0,onValueChange:s.handleChange,children:[(0,h.jsx)(u.s,{"aria-invalid":c?`true`:void 0,onBlur:s.handleBlur,children:(0,h.jsx)(u.c,{placeholder:n})}),(0,h.jsxs)(u.n,{children:[!!i.length&&i.map(e=>(0,h.jsx)(u.i,{value:e.value,children:e.label},e.value)),!i.length&&(0,h.jsxs)(`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:[(0,h.jsx)(g.PackagePlusIcon,{strokeWidth:1}),`No options available`]})]})]}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:(0,h.jsx)(F,{errors:d})}),(0,h.jsx)(N,{isShow:!!a,children:a})]})]}),(0,h.jsx)(P,{})]})};function H({className:e,...t}){return(0,h.jsx)(v.Switch.Root,{"data-slot":`switch`,className:(0,f.cn)(`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:(0,h.jsx)(v.Switch.Thumb,{"data-slot":`switch-thumb`,className:(0,f.cn)(`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 U=({label:e,description:t,helperText:n})=>{let r=Z();return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(j,{className:`cursor-pointer`,children:(0,h.jsx)(`label`,{htmlFor:r.name,children:e})}),(0,h.jsx)(M,{children:t}),(0,h.jsx)(H,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),(0,h.jsx)(N,{isShow:!!n,children:n})]}),(0,h.jsx)(P,{})]})},W=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showClearButton:s=!1,showErrorMessage:c=!0,required:l=!1,maxLength:u})=>{let{form:d,name:p,state:_,handleBlur:v,handleChange:b}=Z(),x=(0,y.useStore)(d.store,({isSubmitting:e})=>e),S=(0,m.useMemo)(()=>s&&!x,[s,x]),C=(0,m.useMemo)(()=>_.value?_.value.length:0,[_.value]),w=(0,m.useMemo)(()=>{if(!i)return``;let e=`character${[0,1].includes(C)?``:`s`}`;return i&&u?`${C} / ${u} ${e}`:`${C} ${e}`},[C,i,u]),T=(0,m.useMemo)(()=>_.meta.isDirty&&_.meta.isTouched&&!_.meta.isValid,[_.meta.isDirty,_.meta.isTouched,_.meta.isValid]),j=(0,m.useMemo)(()=>l?_.value===null:!1,[l,_.value]),I=(0,m.useCallback)(({target:{value:e}})=>{x||i&&u&&e.length>u||b(e||null)},[x,i,u,b]),L=(0,m.useCallback)(()=>{x||b(``)},[x,b]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:a,"data-invalid":T,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{"aria-required":j,htmlFor:p,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(o.t,{id:p,name:p,value:_.value===null?``:_.value,"aria-invalid":T,autoComplete:`off`,placeholder:n,className:(0,f.cn)(`pr-6`,x&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:v,onChange:I}),S&&!_.meta.errors.length&&(0,h.jsx)(`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:L,children:(0,h.jsx)(g.XIcon,{"aria-hidden":`true`})}),x&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:(0,h.jsx)(g.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),_.meta.isDirty&&c&&!!_.meta.errors.length&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:(0,h.jsx)(g.BanIcon,{size:14})}),(0,h.jsxs)(`div`,{className:`mt-1 flex w-full items-start gap-x-2`,children:[_.meta.isDirty&&c&&(0,h.jsx)(F,{className:`flex-1`,errors:_.meta.errors}),!!i&&(0,h.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:w})]}),(0,h.jsx)(N,{isShow:!!r,children:r})]})]}),(0,h.jsx)(P,{})]})},G=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showErrorMessage:o=!0,required:s=!1,maxLength:c})=>{let{form:l,state:u,name:p,handleBlur:_,handleChange:v}=Z(),b=(0,y.useStore)(l.store,({isSubmitting:e})=>e),x=(0,m.useMemo)(()=>u.value?u.value.length:0,[u.value]),S=(0,m.useMemo)(()=>{if(!i)return``;let e=`character${[0,1].includes(x)?``:`s`}`;return i&&c?`${x} / ${c} ${e}`:`${x} ${e}`},[x,i,c]),C=(0,m.useMemo)(()=>u.meta.isDirty&&u.meta.isTouched&&!u.meta.isValid,[u.meta.isDirty,u.meta.isTouched,u.meta.isValid]),w=(0,m.useMemo)(()=>u.meta.errors,[u.meta.errors]),T=(0,m.useMemo)(()=>s?u.value===null:!1,[s,u.value]),j=(0,m.useCallback)(({target:{value:e}})=>{b||i&&c&&e.length>c||v(e||null)},[b,i,c,v]);return(0,h.jsxs)(E,{className:`px-4`,children:[(0,h.jsxs)(D,{orientation:a,"data-invalid":C,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{"aria-required":T,htmlFor:p,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(d.t,{id:p,name:p,value:u.value===null?``:u.value,"aria-invalid":C,autoComplete:`off`,placeholder:n,className:(0,f.cn)(b&&`pointer-events-none bg-muted-muted opacity-60`),onChange:j,onBlur:_}),b&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:(0,h.jsx)(g.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),u.meta.isDirty&&o&&!!w.length&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:(0,h.jsx)(g.BanIcon,{size:14})}),(0,h.jsxs)(`div`,{className:`mt-1 flex w-full items-start gap-x-2`,children:[u.meta.isDirty&&o&&(0,h.jsx)(F,{className:`flex-1`,errors:w}),!!i&&(0,h.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:S})]}),(0,h.jsx)(N,{isShow:!!r,children:r})]})]}),(0,h.jsx)(P,{})]})},K=({label:e,className:n})=>{let r=Q(),i=(0,m.useCallback)(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return(0,h.jsx)(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})=>(0,h.jsx)(t.t,{type:`button`,size:`md`,disabled:r,isLoading:a,className:(0,f.cn)(`min-h-8 min-w-32`,n),onClick:i,children:e??`Submit`})})},q=({type:e=`create`})=>{let n=Q();return(0,h.jsxs)(`div`,{className:`flex h-8 items-center justify-between`,children:[(0,h.jsx)(n.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,h.jsx)(t.t,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:e,className:`h-full min-w-32`,onClick:()=>n.reset(),children:`Cancel`})}),e===`create`&&(0,h.jsx)(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:e,isSubmitting:r})=>(0,h.jsxs)(t.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`create`}),n.state.isSubmitSuccessful&&n.reset()},children:[(0,h.jsx)(g.PlusIcon,{}),`Add New`]})}),e===`update`&&(0,h.jsx)(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:e,isSubmitting:r})=>(0,h.jsxs)(t.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`update`}),n.state.isSubmitSuccessful&&n.reset()},children:[(0,h.jsx)(g.ArrowDownToLine,{}),`Update`]})})]})};function J({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,h.jsx)(v.Separator.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:(0,f.cn)(`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 ae=({title:e,description:n,onDelete:r,children:i})=>(0,h.jsxs)(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-4 ring-border-weak`,children:[(0,h.jsxs)(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-1 p-4`,children:[(0,h.jsx)(`p`,{className:`font-semibold text-lg`,children:e}),!!n&&(0,h.jsx)(`p`,{className:`text-muted text-sm`,children:n})]}),(0,h.jsx)(J,{}),(0,h.jsx)(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:i}),!!r&&(0,h.jsxs)(t.t,{color:`danger`,variant:`outline`,size:`sm`,className:`absolute top-2 right-2`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[(0,h.jsx)(g.Trash2Icon,{}),`Remove`]})]}),oe=({children:e})=>(0,h.jsx)(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),Y=({...e})=>(0,h.jsx)(`button`,{...e,type:`button`,className:`min-w-40 cursor-pointer rounded-sm border border-border bg-card px-4 py-2 font-semibold text-sm text-text-positive shadow-xs outline-none transition-all hover:opacity-90 focus:border-border focus:ring-3 focus:ring-border/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none`,children:`Hủy`}),X=({isSubmitting:e,submitText:t=`Submit`,...n})=>(0,h.jsx)(`button`,{...n,type:`button`,"data-loading":e?`true`:void 0,className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-sm border border-primary-strong bg-primary px-4 py-2 font-semibold text-sm text-text-negative shadow-card outline-none transition-all hover:opacity-90 focus:border-transparent focus:ring-3 focus:ring-primary/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none data-[loading=true]:pointer-events-none data-[loading=true]:opacity-80`,children:e?(0,h.jsx)(g.Loader2,{size:16,strokeWidth:3,className:`absolute top-1/2 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 animate-spin`}):t}),se=({title:e,submitText:t,open:r,onOpenChange:a,children:o})=>{let s=Q(),c=(0,m.useCallback)(e=>{e||s.reset(),a?.(e)},[s.reset,a]);return(0,h.jsx)(i.t,{open:r,onOpenChange:c,children:(0,h.jsxs)(i.c,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(i.s,{}),(0,h.jsxs)(i.r,{className:`flex size-full max-h-dvh max-w-dvw flex-col gap-0 overflow-y-auto p-0 shadow-dialog sm:h-auto sm:max-h-[85dvh] sm:max-w-2xl sm:rounded-sm`,children:[(0,h.jsx)(`div`,{"data-slot":`dialog-header`,className:`flex flex-col items-center justify-center gap-2 px-4 py-6 text-center shadow-sm sm:text-left`,children:(0,h.jsx)(i.l,{"data-slot":`dialog-title`,children:e})}),(0,h.jsx)(n.t,{}),(0,h.jsx)(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col space-y-4 overflow-y-auto p-0 pt-6 max-sm:flex-1 sm:p-4`,children:o}),(0,h.jsx)(n.t,{}),(0,h.jsxs)(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-between gap-2 px-6 py-4 shadow-sm sm:flex-row sm:justify-end max-sm:[&>button]:w-full`,children:[(0,h.jsx)(s.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>(0,h.jsx)(Y,{disabled:e,onClick:()=>{s.reset(),c(!1)}})}),(0,h.jsx)(s.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:n})=>(0,h.jsx)(X,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>s.handleSubmit()})})]})]})]})})},ce=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:r,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[i,(0,h.jsx)(N,{isShow:!!n,children:n})]})]}),(0,h.jsx)(P,{})]}),le=({title:e,open:t,contentClassName:n,onOpenChange:i,children:a})=>{let o=Q();return(0,h.jsx)(v.Dialog.Root,{"data-slot":`dialog`,open:t,onOpenChange:i,children:(0,h.jsxs)(v.Dialog.Portal,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(v.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,f.cn)(`fixed inset-0 z-40 bg-black/50 backdrop-blur-sm`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`)}),(0,h.jsx)(v.Dialog.Content,{"data-slot":`dialog-content`,className:(0,f.cn)(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background drop-shadow-lg`,`duration-300`,`data-[state=open]:animate-in`,`data-[state=open]:slide-in-from-right`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:slide-out-to-right`,`data-[state=closed]:fade-out`),children:(0,h.jsxs)(`section`,{className:`relative flex size-full flex-col`,children:[(0,h.jsx)(`header`,{className:`flex h-14 items-center border-border border-b px-4`,children:(0,h.jsx)(`h2`,{className:`font-semibold text-lg text-primary-strong`,children:e})}),(0,h.jsx)(`div`,{className:(0,f.cn)(`flex flex-1 flex-col overflow-y-auto py-4`,n),children:a}),(0,h.jsxs)(`div`,{className:`flex flex-col space-y-4 border-border border-t px-4 py-2`,children:[(0,h.jsx)(o.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,h.jsx)(X,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),(0,h.jsx)(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,h.jsx)(Y,{disabled:e,className:`w-full`,onClick:()=>{o.reset(),i?.(!1)}})})]}),(0,h.jsx)(v.Dialog.Close,{asChild:!0,children:(0,h.jsx)(r.t,{className:`absolute top-2 right-2`})})]})})]})})},ue=({children:e})=>(0,h.jsx)(`header`,{"data-slot":`section-header`,className:`px-4 pt-2.5 pb-2 font-medium text-base text-primary-strong`,children:e}),de=({children:e})=>(0,h.jsx)(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),fe=({title:e,children:t})=>(0,h.jsxs)(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-4 ring-border-weak`,children:[(0,h.jsx)(ue,{children:e}),(0,h.jsx)(J,{}),(0,h.jsx)(de,{children:t})]}),pe=({title:e,description:t,helperText:n})=>(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{className:`gap-0`,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(T,{className:`mb-1`,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsx)(N,{isShow:!!n,children:n})]}),(0,h.jsx)(P,{})]}),{fieldContext:me,formContext:he,useFieldContext:Z,useFormContext:Q}=(0,y.createFormHookContexts)(),{useAppForm:ge,withForm:$,withFieldGroup:_e}=(0,y.createFormHook)({fieldContext:me,formContext:he,fieldComponents:{TextField:W,TextareaField:G,NumberField:ie,EmailField:R,PasswordField:z,SelectField:V,DateField:L,SwitchField:U,RadioGroupField:B,CheckboxField:I,FieldGroup:E,Field:D,FieldContent:O,FieldLabel:A,FieldContentMain:k,FieldSeparator:P,FieldError:F},formComponents:{TanStackDialogForm:se,TanStackPopoverForm:le,TanStackContainerForm:oe,TanStackSectionForm:fe,TanStackCardForm:ae,TanStackFieldGroup:ce,TanStackTitleField:pe,TanStackActionsForm:q,TanStackActionSubmit:K}});exports.Field=D,exports.FieldContent=O,exports.FieldContentMain=k,exports.FieldError=F,exports.FieldGroup=E,exports.FieldLabel=A,exports.FieldSeparator=P,exports.useTanStackFieldContext=Z,exports.useTanStackForm=ge,exports.useTanStackFormContext=Q,exports.withTanStackFieldGroup=_e,exports.withTanStackForm=$;
1
+ const e=require(`../../chunk-Bmb41Sf3.cjs`);require(`../../heading-BEm5CCSE.cjs`),require(`../../paragraph-BBye8n4M.cjs`),require(`../../button.variants-8QOIR433.cjs`);const t=require(`../../button-8Snjc8iT.cjs`),n=require(`../../separator-C3ip6sbh.cjs`),r=require(`../../close-D_Ge7gnP.cjs`),i=require(`../../dialog-2N-D9B9o.cjs`),a=require(`../../checkbox-C0fSWwmD.cjs`),o=require(`../../input-BFWWaN-v.cjs`),s=require(`../../popover-DzDrgttC.cjs`),c=require(`../../calendar-DgLMLD8R.cjs`),l=require(`../../radio-group-CBhRsUjN.cjs`),u=require(`../../select-2CgwiefV.cjs`),d=require(`../../textarea-COQoSVSc.cjs`);let f=require(`@customafk/react-toolkit/utils`),p=require(`class-variance-authority`),m=require(`react`),h=require(`react/jsx-runtime`),g=require(`lucide-react`),_=require(`@customafk/react-toolkit/date-fns`),v=require(`radix-ui`),y=require(`@tanstack/react-form`);const b=(0,p.cva)([`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`}}),x=({label:e,color:t,size:n,className:r,children:i})=>(0,h.jsx)(`div`,{"data-slot":`required-indicator`,className:b({color:t,size:n,className:r}),children:e||i});function S({className:e,children:t,...n}){return(0,h.jsxs)(v.Label.Root,{"data-slot":`label`,className:(0,f.cn)(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[t,(0,h.jsx)(x,{label:`Required`,color:`danger`,size:`sm`,className:`hidden`})]})}const C=(0,p.cva)(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0 @md/field-group:*:data-[slot=field-content]:gap-2`,{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`}}),w=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,f.cn)(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));w.displayName=`FieldSet`;const T=(0,m.memo)(({className:e,variant:t=`legend`,...n})=>(0,h.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,f.cn)(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));T.displayName=`FieldLegend`;const E=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-group`,className:(0,f.cn)(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));E.displayName=`FieldGroup`;const D=(0,m.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,h.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,f.cn)(C({orientation:t}),e),...n}));D.displayName=`Field`;const O=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-content`,className:(0,f.cn)(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));O.displayName=`FieldContent`;const k=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-content-main`,className:(0,f.cn)(`relative`,e),...t})),A=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(S,{"data-slot":`field-label`,className:(0,f.cn)(`group/field-label peer/field-label flex h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));A.displayName=`FieldLabel`;const j=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`div`,{"data-slot":`field-label`,className:(0,f.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));j.displayName=`FieldTitle`;const M=(0,m.memo)(({className:e,...t})=>(0,h.jsx)(`p`,{"data-slot":`field-description`,className:(0,f.cn)(`nth-last-2:-mt-1 font-normal text-sm text-text-positive-weak leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));M.displayName=`FieldDescription`;const N=(0,m.memo)(({isShow:e=!0,className:t,...n})=>e===!1?null:(0,h.jsx)(`div`,{"data-slot":`field-note`,className:(0,f.cn)(`text-wrap rounded border border-primary-muted bg-primary-bg-subtle p-2 text-text-positive-weak text-xs`,t),...n}));N.displayName=`FieldNote`;const P=(0,m.memo)(({children:e,className:t,...r})=>(0,h.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,f.cn)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...r,children:[(0,h.jsx)(n.t,{className:`absolute inset-0 top-1/2`}),e&&(0,h.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));P.displayName=`FieldSeparator`;const F=(0,m.memo)(({className:e,children:t,errors:n,...r})=>{let i=(0,m.useMemo)(()=>t||(n?n?.length===1&&n[0]?.message?(0,h.jsx)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:(0,h.jsx)(`p`,{children:n[0].message})}):(0,h.jsx)(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?(0,h.jsx)(`li`,{children:e},e):e?.message?(0,h.jsx)(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?(0,h.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,f.cn)(`w-full font-semibold text-danger-strong text-xs`,e),...r,children:i}):null});F.displayName=`FieldError`;const I=({label:e,description:t,options:n,helperText:r,orientation:i})=>{let o=Z(),s=(0,y.useStore)(o.form.store,({isSubmitting:e})=>e);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:i,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{children:e}),(0,h.jsx)(M,{children:t}),(0,h.jsx)(N,{isShow:!!r,children:r})]}),(0,h.jsx)(k,{children:(0,h.jsx)(E,{className:`flex flex-col gap-y-2`,children:n.map(e=>(0,h.jsxs)(D,{orientation:`horizontal`,children:[(0,h.jsx)(a.t,{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 !t&&o.state.value===null&&o.setValue(null)}}),(0,h.jsx)(A,{htmlFor:`${o.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),(0,h.jsx)(P,{})]})},L=({label:e,description:n,placeholder:r,orientation:i=`responsive`,helperText:a,minDate:o,maxDate:l,required:u})=>{let d=Z(),p=(0,m.useMemo)(()=>u?d.state.value===null:!1,[u,d.state.value]),v=(0,m.useMemo)(()=>d.state.meta.isTouched&&!d.state.meta.isValid,[d.state.meta.isTouched,d.state.meta.isValid]);return(0,h.jsxs)(E,{className:`px-4`,children:[(0,h.jsxs)(D,{orientation:i,"data-invalid":v,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:d.name,"aria-required":p,children:e}),(0,h.jsx)(M,{children:n})]}),(0,h.jsxs)(k,{className:`flex flex-col space-y-1`,children:[(0,h.jsx)(`div`,{className:`flex w-full flex-col`,children:(0,h.jsxs)(s.t,{children:[(0,h.jsx)(s.a,{asChild:!0,children:(0,h.jsxs)(t.t,{variant:`outline`,color:`muted`,size:`lg`,className:(0,f.cn)(`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`,d.state.value===null&&`text-text-positive-muted`),children:[(0,h.jsx)(`p`,{children:d.state.value===null?r||`Select date`:(0,_.format)(d.state.value,`PPPP`)}),(0,h.jsx)(g.CalendarDaysIcon,{strokeWidth:1})]})}),(0,h.jsxs)(s.i,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:d.handleBlur,children:[(0,h.jsxs)(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.endOfToday)())},children:`Today`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.endOfTomorrow)())},children:`Tomorrow`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.endOfYesterday)())},children:`Yesterday`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.subDays)((0,_.endOfToday)(),3))},children:`Last 3 Days`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.subDays)((0,_.endOfToday)(),7))},children:`Last 7 Days`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.subDays)((0,_.endOfToday)(),30))},children:`Last 30 Days`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.startOfMonth)((0,_.endOfToday)()))},children:`This Month`}),(0,h.jsx)(t.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{d.handleChange((0,_.lastDayOfMonth)((0,_.endOfToday)()))},children:`Last Month`})]}),(0,h.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,h.jsx)(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:(0,h.jsx)(c.t,{mode:`single`,selected:d.state.value??void 0,hidden:{before:o??new Date(1900,0,1),after:l??new Date(2100,11,31)},onSelect:e=>{e&&d.handleChange(e)}})})})]})]})}),(0,h.jsx)(N,{isShow:!!a,children:a})]})]}),(0,h.jsx)(P,{})]})},R=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0,maxLength:s})=>{let{form:c,name:l,state:u,handleBlur:d,handleChange:p}=Z(),_=(0,y.useStore)(c.store,({isSubmitting:e})=>e),v=(0,m.useMemo)(()=>u.meta.isTouched&&!u.meta.isValid,[u.meta.isTouched,u.meta.isValid]),b=(0,m.useCallback)(({target:{value:e}})=>{_||s&&e.length>s||p(e||null)},[_,s,p]),x=(0,m.useCallback)(()=>{_||p(null)},[_,p]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{"data-invalid":v,orientation:r,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:l,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(o.t,{id:l,name:l,value:u.value===null?``:u.value,"aria-invalid":v,autoComplete:`email`,placeholder:n,className:(0,f.cn)(`pl-9`,_&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:d,onChange:b}),(0,h.jsx)(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:(0,h.jsx)(g.AtSignIcon,{size:14})}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-y-0 inset-e-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:x,children:(0,h.jsx)(g.XIcon,{size:14,"aria-hidden":`true`})}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&(0,h.jsx)(F,{errors:u.meta.errors})}),(0,h.jsx)(N,{isShow:!!i,children:i})]})]}),(0,h.jsx)(P,{})]})},ee=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,te=e=>Number(e).toLocaleString(),ne=(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}},re=({disabled:e=!1,readOnly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:a=null,unitText:s,decimal:c,placeholder:l,precision:u,wrapperClassName:d,className:p,onChange:g,onValueChange:_,onFocus:v,onBlur:y,...b})=>{let x=(0,m.useRef)(null),S=(0,m.useRef)(null),[C,w]=(0,m.useState)(a?.toString()??null),T=(0,m.useMemo)(()=>c?.[1]??r,[c,r]),E=(0,m.useMemo)(()=>c&&c[0]-c[1],[c]),D=(0,m.useMemo)(()=>ee(n),[n]),O=(0,m.useCallback)(e=>{if(!T||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=T&&r<=(E??1/0)},[T,E]),k=(0,m.useCallback)(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=ne(parseFloat(e),Math.min(T-1,u||0),i).toString().split(`.`),r=te(t);return n?`${r}.${n}`:r},[T,u,i]),A=(0,m.useCallback)(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){_?.(0),w(e);return}if(n){w(()=>(_?.(0),e));return}},[_]),j=(0,m.useCallback)(e=>{g?.(e);let{value:t}=e.target;if(t===``||t===void 0){_?.(null),w(null);return}A(t),!(!D.test(t)||!O(t))&&(_?.(parseFloat(t)||0),w(t))},[O,g,_,A,D]),M=(0,m.useCallback)(e=>{t||(v?.(e),w(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,v]),N=(0,m.useCallback)(e=>{t||(y?.(e),w(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?k(e):null))},[t,k,y]);return(0,m.useEffect)(()=>{let e=document.activeElement===S.current;if(a==null||!D.test(a.toString())||!O(a.toString())){w(null);return}w(t=>e?t:k(a.toString()))},[k,a,O,D]),(0,m.useEffect)(()=>{if(!x.current||!S.current||!s)return;let e=x.current.offsetWidth;S.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[s]),(0,h.jsxs)(`div`,{className:(0,f.cn)(`relative`,d),children:[(0,h.jsx)(o.t,{...b,ref:S,value:C||(t?`0`:``),placeholder:l,disabled:e,readOnly:t,className:(0,f.cn)(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,p),onChange:j,onFocus:M,onBlur:N}),s&&(0,h.jsx)(`span`,{ref:x,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:s})]})},ie=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,showErrorMessage:a=!0,rounding:o,decimalPlaces:s,percision:c,unit:l,required:u,allowNegative:d})=>{let p=Z(),_=(0,y.useStore)(p.form.store,({isSubmitting:e})=>e),v=(0,m.useMemo)(()=>p.state.meta.errors,[p.state.meta.errors]),b=(0,m.useMemo)(()=>u?p.state.value===null:!1,[u,p.state.value]),x=(0,m.useCallback)(e=>{_||p.handleChange(e)},[_,p.handleChange]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:i,"data-invalid":p.state.meta.isTouched&&!p.state.meta.isValid,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:p.name,"aria-required":b,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsxs)(`div`,{className:`relative w-full`,children:[(0,h.jsx)(re,{id:p.name,value:p.state.value,"aria-invalid":p.state.meta.isTouched&&!p.state.meta.isValid&&p.state.meta.isDirty,placeholder:n,roundingRule:o,numberAfterDecimalPoint:s,precision:c,unitText:l,allowNegative:d,className:(0,f.cn)(_&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:p.handleBlur,onValueChange:x}),_&&(0,h.jsx)(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:(0,h.jsx)(g.Loader2Icon,{className:`animate-spin text-primary-strong`})}),p.state.meta.isDirty&&a&&!!v.length&&(0,h.jsx)(`div`,{className:`absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:(0,h.jsx)(g.BanIcon,{})}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:p.state.meta.isDirty&&a&&(0,h.jsx)(F,{errors:v})})]}),(0,h.jsx)(N,{isShow:!!r,children:r})]})]}),(0,h.jsx)(P,{})]})},z=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0})=>{let{form:s,name:c,state:l,handleBlur:u,handleChange:d}=Z(),f=(0,y.useStore)(s.store,({isSubmitting:e})=>e),[p,_]=(0,m.useState)(!1),v=(0,m.useMemo)(()=>l.meta.isTouched&&!l.meta.isValid,[l.meta.isTouched,l.meta.isValid]),b=(0,m.useCallback)(()=>_(e=>!e),[]),x=(0,m.useCallback)(({target:{value:e}})=>{f||d(e||null)},[f,d]);return(0,h.jsx)(E,{className:`gap-y-4 px-4`,children:(0,h.jsxs)(D,{"data-invalid":v,orientation:r,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:c,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(o.t,{id:c,type:p?`text`:`password`,placeholder:n,value:l.value??``,"aria-invalid":v,autoComplete:`new-password`,onBlur:u,onChange:x}),(0,h.jsx)(`button`,{className:`absolute inset-y-0 inset-e-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:b,"aria-label":p?`Hide password`:`Show password`,"aria-pressed":p,"aria-controls":`password`,children:p?(0,h.jsx)(g.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,h.jsx)(g.EyeIcon,{size:16,"aria-hidden":`true`})}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&(0,h.jsx)(F,{errors:l.meta.errors})}),(0,h.jsx)(N,{isShow:!!i,children:i})]})]})})},B=({label:e,description:t,orientation:n,options:r,helperText:i})=>{let a=Z(),o=(0,y.useStore)(a.form.store,({isSubmitting:e})=>e);return(0,h.jsxs)(E,{className:`px-4`,children:[(0,h.jsxs)(D,{orientation:n,className:`flex-col gap-2`,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{children:e}),(0,h.jsx)(M,{children:t}),(0,h.jsx)(N,{isShow:!!i,children:i})]}),(0,h.jsx)(k,{children:(0,h.jsx)(l.t,{defaultValue:a.state.value??void 0,className:`w-full`,onValueChange:a.handleChange,children:r.map(e=>(0,h.jsx)(A,{className:(0,f.cn)(`h-fit`,a.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,o&&`pointer-events-none bg-muted-muted opacity-60`,a.state.value===e.value&&o&&`border-border-strong!`),children:(0,h.jsxs)(D,{orientation:`horizontal`,className:`justify-between rounded p-2!`,children:[(0,h.jsxs)(O,{className:`gap-1!`,children:[(0,h.jsx)(j,{children:e.label}),(0,h.jsx)(M,{className:`text-xs`,children:e.description})]}),(0,h.jsx)(l.n,{value:e.value})]})},e.value))})})]}),(0,h.jsx)(P,{})]})},V=({label:e,description:t,placeholder:n,orientation:r=`responsive`,options:i,helperText:a,required:o=!1})=>{let s=Z(),c=(0,m.useMemo)(()=>s.state.meta.isTouched&&!s.state.meta.isValid,[s.state.meta.isTouched,s.state.meta.isValid]),l=(0,m.useMemo)(()=>o?s.state.value===null:!1,[o,s.state.value]),d=(0,m.useMemo)(()=>s.state.meta.errors,[s.state.meta.errors]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:r,"data-invalid":s.state.meta.isTouched&&!s.state.meta.isValid,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{htmlFor:s.name,"aria-required":l,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{className:`flex flex-col`,children:[(0,h.jsxs)(u.t,{defaultValue:s.state.value||void 0,onValueChange:s.handleChange,children:[(0,h.jsx)(u.s,{"aria-invalid":c?`true`:void 0,onBlur:s.handleBlur,children:(0,h.jsx)(u.c,{placeholder:n})}),(0,h.jsxs)(u.n,{children:[!!i.length&&i.map(e=>(0,h.jsx)(u.i,{value:e.value,children:e.label},e.value)),!i.length&&(0,h.jsxs)(`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:[(0,h.jsx)(g.PackagePlusIcon,{strokeWidth:1}),`No options available`]})]})]}),(0,h.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:(0,h.jsx)(F,{errors:d})}),(0,h.jsx)(N,{isShow:!!a,children:a})]})]}),(0,h.jsx)(P,{})]})};function H({className:e,...t}){return(0,h.jsx)(v.Switch.Root,{"data-slot":`switch`,className:(0,f.cn)(`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:(0,h.jsx)(v.Switch.Thumb,{"data-slot":`switch-thumb`,className:(0,f.cn)(`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 U=({label:e,description:t,helperText:n})=>{let r=Z();return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(j,{className:`cursor-pointer`,children:(0,h.jsx)(`label`,{htmlFor:r.name,children:e})}),(0,h.jsx)(M,{children:t}),(0,h.jsx)(H,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),(0,h.jsx)(N,{isShow:!!n,children:n})]}),(0,h.jsx)(P,{})]})},W=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showClearButton:s=!1,showErrorMessage:c=!0,required:l=!1,maxLength:u})=>{let{form:d,name:p,state:_,handleBlur:v,handleChange:b}=Z(),x=(0,y.useStore)(d.store,({isSubmitting:e})=>e),S=(0,m.useMemo)(()=>s&&!x,[s,x]),C=(0,m.useMemo)(()=>_.value?_.value.length:0,[_.value]),w=(0,m.useMemo)(()=>{if(!i)return``;let e=`character${[0,1].includes(C)?``:`s`}`;return i&&u?`${C} / ${u} ${e}`:`${C} ${e}`},[C,i,u]),T=(0,m.useMemo)(()=>_.meta.isDirty&&_.meta.isTouched&&!_.meta.isValid,[_.meta.isDirty,_.meta.isTouched,_.meta.isValid]),j=(0,m.useMemo)(()=>l?_.value===null:!1,[l,_.value]),I=(0,m.useCallback)(({target:{value:e}})=>{x||i&&u&&e.length>u||b(e||null)},[x,i,u,b]),L=(0,m.useCallback)(()=>{x||b(``)},[x,b]);return(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:a,"data-invalid":T,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{"aria-required":j,htmlFor:p,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(o.t,{id:p,name:p,value:_.value===null?``:_.value,"aria-invalid":T,autoComplete:`off`,placeholder:n,className:(0,f.cn)(`pr-6`,x&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:v,onChange:I}),S&&!_.meta.errors.length&&(0,h.jsx)(`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:L,children:(0,h.jsx)(g.XIcon,{"aria-hidden":`true`})}),x&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:(0,h.jsx)(g.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),_.meta.isDirty&&c&&!!_.meta.errors.length&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:(0,h.jsx)(g.BanIcon,{size:14})}),(0,h.jsxs)(`div`,{className:`mt-1 flex w-full items-start gap-x-2`,children:[_.meta.isDirty&&c&&(0,h.jsx)(F,{className:`flex-1`,errors:_.meta.errors}),!!i&&(0,h.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:w})]}),(0,h.jsx)(N,{isShow:!!r,children:r})]})]}),(0,h.jsx)(P,{})]})},G=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:a=`responsive`,showErrorMessage:o=!0,required:s=!1,maxLength:c})=>{let{form:l,state:u,name:p,handleBlur:_,handleChange:v}=Z(),b=(0,y.useStore)(l.store,({isSubmitting:e})=>e),x=(0,m.useMemo)(()=>u.value?u.value.length:0,[u.value]),S=(0,m.useMemo)(()=>{if(!i)return``;let e=`character${[0,1].includes(x)?``:`s`}`;return i&&c?`${x} / ${c} ${e}`:`${x} ${e}`},[x,i,c]),C=(0,m.useMemo)(()=>u.meta.isDirty&&u.meta.isTouched&&!u.meta.isValid,[u.meta.isDirty,u.meta.isTouched,u.meta.isValid]),w=(0,m.useMemo)(()=>u.meta.errors,[u.meta.errors]),T=(0,m.useMemo)(()=>s?u.value===null:!1,[s,u.value]),j=(0,m.useCallback)(({target:{value:e}})=>{b||i&&c&&e.length>c||v(e||null)},[b,i,c,v]);return(0,h.jsxs)(E,{className:`px-4`,children:[(0,h.jsxs)(D,{orientation:a,"data-invalid":C,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{"aria-required":T,htmlFor:p,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[(0,h.jsx)(d.t,{id:p,name:p,value:u.value===null?``:u.value,"aria-invalid":C,autoComplete:`off`,placeholder:n,className:(0,f.cn)(b&&`pointer-events-none bg-muted-muted opacity-60`),onChange:j,onBlur:_}),b&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:(0,h.jsx)(g.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),u.meta.isDirty&&o&&!!w.length&&(0,h.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:(0,h.jsx)(g.BanIcon,{size:14})}),(0,h.jsxs)(`div`,{className:`mt-1 flex w-full items-start gap-x-2`,children:[u.meta.isDirty&&o&&(0,h.jsx)(F,{className:`flex-1`,errors:w}),!!i&&(0,h.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:S})]}),(0,h.jsx)(N,{isShow:!!r,children:r})]})]}),(0,h.jsx)(P,{})]})},K=({label:e,className:n})=>{let r=Q(),i=(0,m.useCallback)(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return(0,h.jsx)(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})=>(0,h.jsx)(t.t,{type:`button`,size:`md`,disabled:r,isLoading:a,className:(0,f.cn)(`min-h-8 min-w-32`,n),onClick:i,children:e??`Submit`})})},q=({type:e=`create`})=>{let n=Q();return(0,h.jsxs)(`div`,{className:`flex h-8 items-center justify-between`,children:[(0,h.jsx)(n.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,h.jsx)(t.t,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:e,className:`h-full min-w-32`,onClick:()=>n.reset(),children:`Cancel`})}),e===`create`&&(0,h.jsx)(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:e,isSubmitting:r})=>(0,h.jsxs)(t.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`create`}),n.state.isSubmitSuccessful&&n.reset()},children:[(0,h.jsx)(g.PlusIcon,{}),`Add New`]})}),e===`update`&&(0,h.jsx)(n.Subscribe,{selector:e=>({disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit||e.isDefaultValue,isSubmitting:e.isSubmitting}),children:({disabled:e,isSubmitting:r})=>(0,h.jsxs)(t.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await n.handleSubmit({submitAction:`update`}),n.state.isSubmitSuccessful&&n.reset()},children:[(0,h.jsx)(g.ArrowDownToLine,{}),`Update`]})})]})};function J({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,h.jsx)(v.Separator.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:(0,f.cn)(`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 ae=({title:e,description:n,onDelete:r,children:i})=>(0,h.jsxs)(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-4 ring-border-weak`,children:[(0,h.jsxs)(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-1 p-4`,children:[(0,h.jsx)(`p`,{className:`font-semibold text-lg`,children:e}),!!n&&(0,h.jsx)(`p`,{className:`text-muted text-sm`,children:n})]}),(0,h.jsx)(J,{}),(0,h.jsx)(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:i}),!!r&&(0,h.jsxs)(t.t,{color:`danger`,variant:`outline`,size:`sm`,className:`absolute top-2 right-2`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[(0,h.jsx)(g.Trash2Icon,{}),`Remove`]})]}),oe=({children:e})=>(0,h.jsx)(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),Y=({...e})=>(0,h.jsx)(`button`,{...e,type:`button`,className:`min-w-40 cursor-pointer rounded-sm border border-border bg-card px-4 py-2 font-semibold text-sm text-text-positive shadow-xs outline-none transition-all hover:opacity-90 focus:border-border focus:ring-3 focus:ring-border/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none`,children:`Hủy`}),X=({isSubmitting:e,submitText:t=`Submit`,...n})=>(0,h.jsx)(`button`,{...n,type:`button`,"data-loading":e?`true`:void 0,className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-sm border border-primary-strong bg-primary px-4 py-2 font-semibold text-sm text-text-negative shadow-card outline-none transition-all hover:opacity-90 focus:border-transparent focus:ring-3 focus:ring-primary/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none data-[loading=true]:pointer-events-none data-[loading=true]:opacity-80`,children:e?(0,h.jsx)(g.Loader2,{size:16,strokeWidth:3,className:`absolute top-1/2 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 animate-spin`}):t}),se=({title:e,submitText:t,open:r,onOpenChange:a,children:o})=>{let s=Q(),c=(0,m.useCallback)(e=>{e||s.reset(),a?.(e)},[s.reset,a]);return(0,h.jsx)(i.t,{open:r,onOpenChange:c,children:(0,h.jsxs)(i.c,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(i.s,{}),(0,h.jsxs)(i.r,{className:`flex size-full max-h-dvh max-w-dvw flex-col gap-0 overflow-y-auto p-0 shadow-dialog sm:h-auto sm:max-h-[85dvh] sm:max-w-2xl sm:rounded-sm`,children:[(0,h.jsx)(`div`,{"data-slot":`dialog-header`,className:`flex flex-col items-center justify-center gap-2 px-4 py-6 text-center shadow-sm sm:text-left`,children:(0,h.jsx)(i.l,{"data-slot":`dialog-title`,children:e})}),(0,h.jsx)(n.t,{}),(0,h.jsx)(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col space-y-4 overflow-y-auto p-0 pt-6 max-sm:flex-1 sm:p-4`,children:o}),(0,h.jsx)(n.t,{}),(0,h.jsxs)(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-between gap-2 px-6 py-4 shadow-sm sm:flex-row sm:justify-end max-sm:[&>button]:w-full`,children:[(0,h.jsx)(s.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>(0,h.jsx)(Y,{disabled:e,onClick:()=>{s.reset(),c(!1)}})}),(0,h.jsx)(s.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:n})=>(0,h.jsx)(X,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>s.handleSubmit()})})]})]})]})})},ce=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{orientation:r,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(A,{children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsxs)(k,{children:[i,(0,h.jsx)(N,{isShow:!!n,children:n})]})]}),(0,h.jsx)(P,{})]}),le=({title:e,open:t,contentClassName:n,onOpenChange:i,children:a})=>{let o=Q();return(0,h.jsx)(v.Dialog.Root,{"data-slot":`dialog`,open:t,onOpenChange:i,children:(0,h.jsxs)(v.Dialog.Portal,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(v.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,f.cn)(`fixed inset-0 z-40 bg-black/50 backdrop-blur-sm`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`)}),(0,h.jsx)(v.Dialog.Content,{"data-slot":`dialog-content`,className:(0,f.cn)(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background drop-shadow-lg`,`duration-300`,`data-[state=open]:animate-in`,`data-[state=open]:slide-in-from-right`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:slide-out-to-right`,`data-[state=closed]:fade-out`),children:(0,h.jsxs)(`section`,{className:`relative flex size-full flex-col`,children:[(0,h.jsx)(`header`,{className:`flex h-14 items-center border-border border-b px-4`,children:(0,h.jsx)(`h2`,{className:`font-semibold text-lg text-primary-strong`,children:e})}),(0,h.jsx)(`div`,{className:(0,f.cn)(`flex flex-1 flex-col overflow-y-auto py-4`,n),children:a}),(0,h.jsxs)(`div`,{className:`flex flex-col space-y-4 border-border border-t px-4 py-2`,children:[(0,h.jsx)(o.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,h.jsx)(X,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>o.handleSubmit()})}),(0,h.jsx)(o.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,h.jsx)(Y,{disabled:e,className:`w-full`,onClick:()=>{o.reset(),i?.(!1)}})})]}),(0,h.jsx)(v.Dialog.Close,{asChild:!0,children:(0,h.jsx)(r.t,{className:`absolute top-2 right-2`})})]})})]})})},ue=({children:e})=>(0,h.jsx)(`header`,{"data-slot":`section-header`,className:`px-4 pt-2.5 pb-2 font-medium text-base text-primary-strong`,children:e}),de=({children:e})=>(0,h.jsx)(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),fe=({title:e,children:t})=>(0,h.jsxs)(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-4 ring-border-weak`,children:[(0,h.jsx)(ue,{children:e}),(0,h.jsx)(J,{}),(0,h.jsx)(de,{children:t})]}),pe=({title:e,description:t,helperText:n})=>(0,h.jsxs)(E,{className:`gap-y-4 px-4`,children:[(0,h.jsxs)(D,{className:`gap-0`,children:[(0,h.jsxs)(O,{children:[(0,h.jsx)(T,{className:`mb-1`,children:e}),(0,h.jsx)(M,{children:t})]}),(0,h.jsx)(N,{isShow:!!n,children:n})]}),(0,h.jsx)(P,{})]}),{fieldContext:me,formContext:he,useFieldContext:Z,useFormContext:Q}=(0,y.createFormHookContexts)(),{useAppForm:ge,withForm:$,withFieldGroup:_e}=(0,y.createFormHook)({fieldContext:me,formContext:he,fieldComponents:{TextField:W,TextareaField:G,NumberField:ie,EmailField:R,PasswordField:z,SelectField:V,DateField:L,SwitchField:U,RadioGroupField:B,CheckboxField:I,FieldGroup:E,Field:D,FieldContent:O,FieldLabel:A,FieldContentMain:k,FieldSeparator:P,FieldError:F},formComponents:{TanStackDialogForm:se,TanStackPopoverForm:le,TanStackContainerForm:oe,TanStackSectionForm:fe,TanStackCardForm:ae,TanStackFieldGroup:ce,TanStackTitleField:pe,TanStackActionsForm:q,TanStackActionSubmit:K}});exports.Field=D,exports.FieldContent=O,exports.FieldContentMain=k,exports.FieldError=F,exports.FieldGroup=E,exports.FieldLabel=A,exports.FieldSeparator=P,exports.useTanStackFieldContext=Z,exports.useTanStackForm=ge,exports.useTanStackFormContext=Q,exports.withTanStackFieldGroup=_e,exports.withTanStackForm=$;
2
2
  //# sourceMappingURL=index.cjs.map