@customafk/lunas-ui 0.1.94 → 0.1.95

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 (142) hide show
  1. package/dist/{button-CHTjm4n8.d.cts → button-BRHW1rSO.d.cts} +7 -7
  2. package/dist/{button-c61Vw1Ns.d.mts → button-DgVnlWul.d.mts} +7 -7
  3. package/dist/cards/simple-card.d.mts +2 -2
  4. package/dist/data-display/empty.d.cts +2 -2
  5. package/dist/data-display/empty.d.mts +2 -2
  6. package/dist/data-display/statistic.d.cts +2 -2
  7. package/dist/data-display/statistic.d.mts +2 -2
  8. package/dist/{dialog-CyLgmqny.d.cts → dialog-B4h77Z-1.d.mts} +12 -12
  9. package/dist/{dialog-DdkuhWsq.d.mts → dialog-zsQVCZzj.d.cts} +12 -12
  10. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +25 -25
  11. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +27 -27
  12. package/dist/features/descriptions/index.d.cts +4 -4
  13. package/dist/features/search-modal/index.d.cts +2 -2
  14. package/dist/features/search-modal/index.d.mts +2 -2
  15. package/dist/features/tables/index.d.cts +23 -23
  16. package/dist/features/tables/index.d.mts +1 -1
  17. package/dist/features/tanstack-form/index.cjs +1 -1
  18. package/dist/features/tanstack-form/index.cjs.map +1 -1
  19. package/dist/features/tanstack-form/index.d.cts +224 -224
  20. package/dist/features/tanstack-form/index.mjs +1 -1
  21. package/dist/features/tanstack-form/index.mjs.map +1 -1
  22. package/dist/{input-BMz2evzs.d.mts → input-Dv7UKl6Z.d.mts} +4 -4
  23. package/dist/{input-mGRGirZ_.d.cts → input-VtO0d8O-.d.cts} +6 -6
  24. package/dist/layouts/flex.d.cts +5 -5
  25. package/dist/layouts/flex.d.mts +5 -5
  26. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  27. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  28. package/dist/pages/FeatureFixing.d.cts +2 -2
  29. package/dist/pages/FeatureFixing.d.mts +2 -2
  30. package/dist/pages/NotAuthorized.d.cts +2 -2
  31. package/dist/pages/NotAuthorized.d.mts +2 -2
  32. package/dist/pages/NotFound.d.cts +2 -2
  33. package/dist/pages/NotFound.d.mts +2 -2
  34. package/dist/typography/paragraph.d.cts +3 -3
  35. package/dist/typography/paragraph.d.mts +5 -5
  36. package/dist/typography/title.d.cts +2 -2
  37. package/dist/typography/title.d.mts +2 -2
  38. package/dist/ui/alert-dialog.d.cts +12 -12
  39. package/dist/ui/alert-dialog.d.mts +12 -12
  40. package/dist/ui/alert.d.cts +5 -5
  41. package/dist/ui/alert.d.mts +7 -7
  42. package/dist/ui/aspect-ratio.d.cts +2 -2
  43. package/dist/ui/aspect-ratio.d.mts +2 -2
  44. package/dist/ui/avatar.d.cts +4 -4
  45. package/dist/ui/avatar.d.mts +4 -4
  46. package/dist/ui/badge.d.cts +5 -5
  47. package/dist/ui/badge.d.mts +5 -5
  48. package/dist/ui/breadcrumb.d.cts +8 -8
  49. package/dist/ui/breadcrumb.d.mts +8 -8
  50. package/dist/ui/button-group.d.cts +6 -6
  51. package/dist/ui/button-group.d.mts +6 -6
  52. package/dist/ui/button.d.cts +1 -1
  53. package/dist/ui/button.d.mts +1 -1
  54. package/dist/ui/calendar.d.cts +4 -4
  55. package/dist/ui/calendar.d.mts +4 -4
  56. package/dist/ui/card.d.cts +8 -8
  57. package/dist/ui/card.d.mts +8 -8
  58. package/dist/ui/carousel.d.cts +7 -7
  59. package/dist/ui/carousel.d.mts +7 -7
  60. package/dist/ui/checkbox.d.cts +2 -2
  61. package/dist/ui/checkbox.d.mts +2 -2
  62. package/dist/ui/collapsible.d.cts +4 -4
  63. package/dist/ui/collapsible.d.mts +4 -4
  64. package/dist/ui/command.d.cts +11 -11
  65. package/dist/ui/command.d.mts +11 -11
  66. package/dist/ui/context-menu.d.cts +16 -16
  67. package/dist/ui/context-menu.d.mts +16 -16
  68. package/dist/ui/dialog.d.cts +1 -1
  69. package/dist/ui/dialog.d.mts +1 -1
  70. package/dist/ui/drawer.d.cts +11 -11
  71. package/dist/ui/drawer.d.mts +11 -11
  72. package/dist/ui/dropdown-menu.d.cts +16 -16
  73. package/dist/ui/dropdown-menu.d.mts +16 -16
  74. package/dist/ui/empty.d.cts +9 -9
  75. package/dist/ui/empty.d.mts +9 -9
  76. package/dist/ui/field.d.cts +13 -13
  77. package/dist/ui/field.d.mts +24 -24
  78. package/dist/ui/file-uploader.d.cts +2 -2
  79. package/dist/ui/file-uploader.d.mts +2 -2
  80. package/dist/ui/form.d.cts +11 -11
  81. package/dist/ui/form.d.mts +7 -7
  82. package/dist/ui/hover-card.d.cts +4 -4
  83. package/dist/ui/hover-card.d.mts +4 -4
  84. package/dist/ui/input-otp.d.cts +5 -5
  85. package/dist/ui/input-otp.d.mts +5 -5
  86. package/dist/ui/input.d.cts +1 -1
  87. package/dist/ui/input.d.mts +1 -1
  88. package/dist/ui/inputs/search-input.d.cts +3 -3
  89. package/dist/ui/inputs/search-input.d.mts +3 -3
  90. package/dist/ui/item.d.cts +15 -15
  91. package/dist/ui/item.d.mts +15 -15
  92. package/dist/ui/label.d.cts +2 -2
  93. package/dist/ui/label.d.mts +2 -2
  94. package/dist/ui/menubar.d.cts +17 -17
  95. package/dist/ui/menubar.d.mts +17 -17
  96. package/dist/ui/multi-select.d.cts +2 -2
  97. package/dist/ui/multi-select.d.mts +3 -3
  98. package/dist/ui/navigation-menu.d.cts +11 -11
  99. package/dist/ui/navigation-menu.d.mts +11 -11
  100. package/dist/ui/pagination.d.cts +9 -9
  101. package/dist/ui/pagination.d.mts +9 -9
  102. package/dist/ui/popover.d.cts +6 -6
  103. package/dist/ui/popover.d.mts +6 -6
  104. package/dist/ui/progress.d.cts +2 -2
  105. package/dist/ui/progress.d.mts +2 -2
  106. package/dist/ui/radio-group.d.cts +3 -3
  107. package/dist/ui/radio-group.d.mts +3 -3
  108. package/dist/ui/resizable.d.cts +9 -9
  109. package/dist/ui/resizable.d.mts +9 -9
  110. package/dist/ui/scroll-area.d.cts +6 -6
  111. package/dist/ui/scroll-area.d.mts +6 -6
  112. package/dist/ui/select.d.cts +9 -9
  113. package/dist/ui/select.d.mts +9 -9
  114. package/dist/ui/separator.d.cts +2 -2
  115. package/dist/ui/separator.d.mts +2 -2
  116. package/dist/ui/sheet.d.cts +9 -9
  117. package/dist/ui/sheet.d.mts +9 -9
  118. package/dist/ui/sidebar.d.cts +27 -27
  119. package/dist/ui/sidebar.d.mts +29 -29
  120. package/dist/ui/skeleton.d.cts +2 -2
  121. package/dist/ui/skeleton.d.mts +2 -2
  122. package/dist/ui/slider.d.cts +2 -2
  123. package/dist/ui/slider.d.mts +2 -2
  124. package/dist/ui/sonner.d.cts +2 -2
  125. package/dist/ui/sonner.d.mts +2 -2
  126. package/dist/ui/spinner.d.cts +2 -2
  127. package/dist/ui/spinner.d.mts +2 -2
  128. package/dist/ui/switch.d.cts +2 -2
  129. package/dist/ui/switch.d.mts +2 -2
  130. package/dist/ui/table.d.cts +9 -9
  131. package/dist/ui/table.d.mts +9 -9
  132. package/dist/ui/tabs.d.cts +5 -5
  133. package/dist/ui/tabs.d.mts +5 -5
  134. package/dist/ui/textarea.d.cts +2 -2
  135. package/dist/ui/textarea.d.mts +2 -2
  136. package/dist/ui/toggle-group.d.cts +3 -3
  137. package/dist/ui/toggle-group.d.mts +3 -3
  138. package/dist/ui/toggle.d.cts +5 -5
  139. package/dist/ui/toggle.d.mts +5 -5
  140. package/dist/ui/tooltip.d.cts +5 -5
  141. package/dist/ui/tooltip.d.mts +5 -5
  142. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { t as AnyEntity } from "../../types-Bd0JePtp.cjs";
2
- import { t as Input } from "../../input-mGRGirZ_.cjs";
3
- import * as react_jsx_runtime346 from "react/jsx-runtime";
4
- import * as react267 from "react";
2
+ import { t as Input } from "../../input-VtO0d8O-.cjs";
3
+ import * as react_jsx_runtime333 from "react/jsx-runtime";
4
+ import * as react255 from "react";
5
5
  import { AccessorKeyColumnDef, CellContext, Column, ColumnPinningPosition, ColumnPinningState, Header, HeaderGroup, Row, RowSelectionState, Table } from "@tanstack/react-table";
6
6
  import { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
7
7
 
@@ -73,7 +73,7 @@ type Props$1 = {
73
73
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
74
74
  value: number | string | null | undefined;
75
75
  };
76
- declare const UITableStatisticDisplay: react267.MemoExoticComponent<({
76
+ declare const UITableStatisticDisplay: react255.MemoExoticComponent<({
77
77
  decimalSeparator,
78
78
  groupSeparator,
79
79
  prefix: Prefix,
@@ -83,7 +83,7 @@ declare const UITableStatisticDisplay: react267.MemoExoticComponent<({
83
83
  showTrailingZeros,
84
84
  size,
85
85
  value
86
- }: Props$1) => react_jsx_runtime346.JSX.Element>;
86
+ }: Props$1) => react_jsx_runtime333.JSX.Element>;
87
87
  //#endregion
88
88
  //#region packages/components/features/tables/components/atoms/user.d.ts
89
89
  type Props = {
@@ -236,28 +236,28 @@ type TableProviderProps<TData extends RowData<TData>, TKey extends keyof TData =
236
236
  };
237
237
  //#endregion
238
238
  //#region packages/components/features/tables/components/common.d.ts
239
- declare const UITableHeadCellOption: react267.NamedExoticComponent<TUITableHeadCellOption>;
240
- declare const UITableHeadCellSelect: react267.NamedExoticComponent<TUITableHeadCellSelect>;
241
- declare const UITableEmptyDisplay: react267.NamedExoticComponent<TUITableEmptyDisplay>;
242
- declare const UITableWrapper: react267.NamedExoticComponent<TUITableWrapper>;
243
- declare const UITableInnerWrapper: react267.NamedExoticComponent<TUITableInnerWrapper>;
244
- declare const UITableInnerTable: react267.NamedExoticComponent<TUITableInnerTable>;
245
- declare const UITableHead: react267.NamedExoticComponent<TUITableHead>;
246
- declare const UITableHeadRow: react267.NamedExoticComponent<TUITableHeadRow>;
247
- declare const UITableHeadCell: react267.NamedExoticComponent<TUITableHeadCell>;
248
- declare const UITableBody: react267.NamedExoticComponent<TUITableBody>;
249
- declare const UITableRow: react267.NamedExoticComponent<TUITableRow>;
250
- declare const UITableCellSelect: react267.NamedExoticComponent<TUITableCellSelect>;
251
- declare const UITableCellActions: react267.NamedExoticComponent<TUITableCellActions>;
252
- declare const UITableCell: react267.NamedExoticComponent<TUITableCell>;
253
- declare const UITableFooter: react267.NamedExoticComponent<TUITableFooter>;
254
- declare const UITableLoadMore: react267.NamedExoticComponent<TUITableLoadMore>;
239
+ declare const UITableHeadCellOption: react255.NamedExoticComponent<TUITableHeadCellOption>;
240
+ declare const UITableHeadCellSelect: react255.NamedExoticComponent<TUITableHeadCellSelect>;
241
+ declare const UITableEmptyDisplay: react255.NamedExoticComponent<TUITableEmptyDisplay>;
242
+ declare const UITableWrapper: react255.NamedExoticComponent<TUITableWrapper>;
243
+ declare const UITableInnerWrapper: react255.NamedExoticComponent<TUITableInnerWrapper>;
244
+ declare const UITableInnerTable: react255.NamedExoticComponent<TUITableInnerTable>;
245
+ declare const UITableHead: react255.NamedExoticComponent<TUITableHead>;
246
+ declare const UITableHeadRow: react255.NamedExoticComponent<TUITableHeadRow>;
247
+ declare const UITableHeadCell: react255.NamedExoticComponent<TUITableHeadCell>;
248
+ declare const UITableBody: react255.NamedExoticComponent<TUITableBody>;
249
+ declare const UITableRow: react255.NamedExoticComponent<TUITableRow>;
250
+ declare const UITableCellSelect: react255.NamedExoticComponent<TUITableCellSelect>;
251
+ declare const UITableCellActions: react255.NamedExoticComponent<TUITableCellActions>;
252
+ declare const UITableCell: react255.NamedExoticComponent<TUITableCell>;
253
+ declare const UITableFooter: react255.NamedExoticComponent<TUITableFooter>;
254
+ declare const UITableLoadMore: react255.NamedExoticComponent<TUITableLoadMore>;
255
255
  //#endregion
256
256
  //#region packages/components/features/tables/components/table.d.ts
257
257
  declare const UITableContainer: React.FC<React.PropsWithChildren>;
258
258
  //#endregion
259
259
  //#region packages/components/features/tables/components/table/filter.d.ts
260
- declare const UITableFilter: () => react_jsx_runtime346.JSX.Element;
260
+ declare const UITableFilter: () => react_jsx_runtime333.JSX.Element;
261
261
  //#endregion
262
262
  //#region packages/components/features/tables/components/table/provider.d.ts
263
263
  declare const UITableProvider: <TData extends RowData<TData> = RowData<AnyEntity>, TKey extends keyof TData = keyof TData, TColumns extends ReadonlyArray<TUITableColumn<TData>> = TUITableColumn<TData>[]>({
@@ -275,7 +275,7 @@ declare const UITableProvider: <TData extends RowData<TData> = RowData<AnyEntity
275
275
  onColumnPinning,
276
276
  fetchMoreData,
277
277
  children
278
- }: React.PropsWithChildren<TableProviderProps<TData, TKey, TColumns>>) => react_jsx_runtime346.JSX.Element;
278
+ }: React.PropsWithChildren<TableProviderProps<TData, TKey, TColumns>>) => react_jsx_runtime333.JSX.Element;
279
279
  //#endregion
280
280
  //#region packages/components/features/tables/components/table/tooltip.d.ts
281
281
  declare const UITableTooltipFilter: React.FC<Omit<React.ComponentProps<typeof Input>, 'className'> & {
@@ -1,5 +1,5 @@
1
1
  import { t as AnyEntity } from "../../types-BpHcqlOI.mjs";
2
- import { t as Input } from "../../input-BMz2evzs.mjs";
2
+ import { t as Input } from "../../input-Dv7UKl6Z.mjs";
3
3
  import * as react267 from "react";
4
4
  import * as react_jsx_runtime346 from "react/jsx-runtime";
5
5
  import { AccessorKeyColumnDef, CellContext, Column, ColumnPinningPosition, ColumnPinningState, Header, HeaderGroup, Row, RowSelectionState, Table } from "@tanstack/react-table";
@@ -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,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-y-0 inset-s-2 top-2.5 text-muted-weak [&>svg]:size-3.5`,children:(0,h.jsx)(g.Loader2Icon,{className:`animate-spin text-primary-strong`})}),a&&!!v.length&&(0,h.jsx)(`div`,{className:`absolute inset-y-0 inset-s-2 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: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.isTouched&&!_.meta.isValid,[_.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-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-intense [&>svg]:size-3.5`,onClick:L,children:(0,h.jsx)(g.XIcon,{"aria-hidden":`true`})}),x&&(0,h.jsx)(`div`,{className:`absolute inset-y-0 inset-e-2 top-2.5 text-muted-weak`,children:(0,h.jsx)(g.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),c&&!!_.meta.errors.length&&(0,h.jsx)(`div`,{className:`absolute inset-y-0 inset-e-2 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:[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.isTouched&&!u.meta.isValid,[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-y-0 inset-e-2 top-2.5 text-muted-weak`,children:(0,h.jsx)(g.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),o&&!!w.length&&(0,h.jsx)(`div`,{className:`absolute inset-y-0 inset-e-2 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:[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-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=$;
2
2
  //# sourceMappingURL=index.cjs.map