@customafk/lunas-ui 0.1.25 → 0.1.26
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.
- package/dist/{avatar-BaxX-xI9.mjs → avatar-DCbv3HzU.mjs} +1 -1
- package/dist/{avatar-BaxX-xI9.mjs.map → avatar-DCbv3HzU.mjs.map} +1 -1
- package/dist/{avatar-dAu1c0bC.cjs → avatar-aVxo69zP.cjs} +1 -1
- package/dist/{avatar-dAu1c0bC.cjs.map → avatar-aVxo69zP.cjs.map} +1 -1
- package/dist/badge-BncGz_13.mjs +2 -0
- package/dist/badge-BncGz_13.mjs.map +1 -0
- package/dist/badge-xKNC7uv3.cjs +2 -0
- package/dist/badge-xKNC7uv3.cjs.map +1 -0
- package/dist/{button-CPlyY35o.d.cts → button-Bg1fW3Y7.d.mts} +4 -4
- package/dist/{button-CyABYH6s.d.mts → button-C-I1CGSH.d.cts} +5 -5
- package/dist/card-CWAdGhMr.mjs.map +1 -1
- package/dist/card-wGoU4Xiq.cjs.map +1 -1
- package/dist/cards/grid-product-card.cjs +1 -1
- package/dist/cards/grid-product-card.mjs +1 -1
- package/dist/cards/product-card.cjs +1 -1
- package/dist/cards/product-card.mjs +1 -1
- package/dist/{close-CGei_VQ6.mjs → close-BuQ2DHur.mjs} +1 -1
- package/dist/{close-CGei_VQ6.mjs.map → close-BuQ2DHur.mjs.map} +1 -1
- package/dist/{close-CXhpIVAZ.cjs → close-DvsVM8lM.cjs} +1 -1
- package/dist/{close-CXhpIVAZ.cjs.map → close-DvsVM8lM.cjs.map} +1 -1
- package/dist/{command-BLlJzBw9.mjs → command-BKiAU1oU.mjs} +2 -2
- package/dist/{command-BLlJzBw9.mjs.map → command-BKiAU1oU.mjs.map} +1 -1
- package/dist/{command-B8Tbe4oe.cjs → command-BqSzRw6j.cjs} +2 -2
- package/dist/{command-B8Tbe4oe.cjs.map → command-BqSzRw6j.cjs.map} +1 -1
- package/dist/data-display/country.d.mts +1 -1
- package/dist/data-display/date-tooltip.cjs +1 -1
- package/dist/data-display/date-tooltip.cjs.map +1 -1
- package/dist/data-display/date-tooltip.mjs +1 -1
- package/dist/data-display/date-tooltip.mjs.map +1 -1
- package/dist/data-display/empty.d.mts +2 -2
- package/dist/data-display/name.cjs +1 -1
- package/dist/data-display/name.mjs +1 -1
- package/dist/data-display/phone-number.cjs +1 -1
- package/dist/data-display/phone-number.mjs +1 -1
- package/dist/data-display/role-badge.cjs +1 -1
- package/dist/data-display/role-badge.cjs.map +1 -1
- package/dist/data-display/role-badge.d.mts +1 -1
- package/dist/data-display/role-badge.mjs +1 -1
- package/dist/data-display/role-badge.mjs.map +1 -1
- package/dist/data-display/statistic.cjs +1 -1
- package/dist/data-display/statistic.cjs.map +1 -1
- package/dist/data-display/statistic.d.mts +2 -2
- package/dist/data-display/statistic.mjs +1 -1
- package/dist/data-display/statistic.mjs.map +1 -1
- package/dist/data-display/user.cjs +1 -1
- package/dist/data-display/user.mjs +1 -1
- package/dist/{dialog-DZ_gg6Ol.cjs → dialog-DVwvHuQB.cjs} +2 -2
- package/dist/{dialog-DZ_gg6Ol.cjs.map → dialog-DVwvHuQB.cjs.map} +1 -1
- package/dist/{dialog-C1fYq5rO.d.cts → dialog-UKGZcMTI.d.mts} +12 -12
- package/dist/{dialog-DeZVOOmh.mjs → dialog-bd77jxcu.mjs} +2 -2
- package/dist/{dialog-DeZVOOmh.mjs.map → dialog-bd77jxcu.mjs.map} +1 -1
- package/dist/{dialog-eqSp0Cdp.d.mts → dialog-eNVy-E39.d.cts} +12 -12
- package/dist/dialogs/detail-dialog/component/sidebar.cjs +1 -1
- package/dist/dialogs/detail-dialog/component/sidebar.d.cts +28 -28
- package/dist/dialogs/detail-dialog/component/sidebar.d.mts +28 -28
- package/dist/dialogs/detail-dialog/component/sidebar.mjs +1 -1
- package/dist/dialogs/detail-dialog/index.cjs +1 -1
- package/dist/dialogs/detail-dialog/index.mjs +1 -1
- package/dist/dialogs/loading-dialog.cjs +1 -1
- package/dist/dialogs/loading-dialog.mjs +1 -1
- package/dist/{drawer-272Fecsq.mjs → drawer-ClbO_Gt0.mjs} +1 -1
- package/dist/{drawer-272Fecsq.mjs.map → drawer-ClbO_Gt0.mjs.map} +1 -1
- package/dist/{drawer-y-Yrqskp.cjs → drawer-DluJOnDX.cjs} +1 -1
- package/dist/{drawer-y-Yrqskp.cjs.map → drawer-DluJOnDX.cjs.map} +1 -1
- package/dist/{dropdown-menu-CtU6oBI4.mjs → dropdown-menu-DPhbyDEo.mjs} +1 -1
- package/dist/{dropdown-menu-CtU6oBI4.mjs.map → dropdown-menu-DPhbyDEo.mjs.map} +1 -1
- package/dist/{dropdown-menu-C_dw8mro.cjs → dropdown-menu-DQs_Lvq7.cjs} +1 -1
- package/dist/{dropdown-menu-C_dw8mro.cjs.map → dropdown-menu-DQs_Lvq7.cjs.map} +1 -1
- package/dist/features/search-modal/index.cjs +1 -1
- package/dist/features/search-modal/index.d.cts +2 -2
- package/dist/features/search-modal/index.d.mts +2 -2
- package/dist/features/search-modal/index.mjs +1 -1
- package/dist/features/tables/index.cjs +1 -1
- package/dist/features/tables/index.cjs.map +1 -1
- package/dist/features/tables/index.d.cts +36 -5
- package/dist/features/tables/index.d.mts +36 -5
- package/dist/features/tables/index.mjs +1 -1
- package/dist/features/tables/index.mjs.map +1 -1
- package/dist/features/tanstack-form/index.cjs +1 -1
- package/dist/features/tanstack-form/index.mjs +1 -1
- package/dist/{image-BwbAQRxx.mjs → image-CbKDFah7.mjs} +2 -2
- package/dist/{image-BwbAQRxx.mjs.map → image-CbKDFah7.mjs.map} +1 -1
- package/dist/{image-C-XEJWcw.cjs → image-D5vQS72z.cjs} +2 -2
- package/dist/{image-C-XEJWcw.cjs.map → image-D5vQS72z.cjs.map} +1 -1
- package/dist/{input-DhUevNkc.cjs → input-C1BXP8dd.cjs} +1 -1
- package/dist/{input-DhUevNkc.cjs.map → input-C1BXP8dd.cjs.map} +1 -1
- package/dist/{input-CC10BdKh.mjs → input-C1K2wbv1.mjs} +1 -1
- package/dist/{input-CC10BdKh.mjs.map → input-C1K2wbv1.mjs.map} +1 -1
- package/dist/{input-B8fOADyL.d.mts → input-CuvhIW05.d.mts} +4 -4
- package/dist/{input-CsRVSfuH.d.cts → input-tIFltAI8.d.cts} +6 -6
- package/dist/{label-CaBktIhh.cjs → label-CkTb259R.cjs} +1 -1
- package/dist/{label-CaBktIhh.cjs.map → label-CkTb259R.cjs.map} +1 -1
- package/dist/{label-DVfxfyG5.mjs → label-DwmJnk4H.mjs} +1 -1
- package/dist/{label-DVfxfyG5.mjs.map → label-DwmJnk4H.mjs.map} +1 -1
- package/dist/layouts/app-layout/index.cjs +1 -1
- package/dist/layouts/app-layout/index.d.cts +28 -28
- package/dist/layouts/app-layout/index.d.mts +3 -3
- package/dist/layouts/app-layout/index.mjs +1 -1
- package/dist/layouts/cms-layout/index.cjs +1 -1
- package/dist/layouts/cms-layout/index.mjs +1 -1
- package/dist/layouts/flex.d.cts +4 -4
- package/dist/layouts/flex.d.mts +4 -4
- package/dist/layouts/service-layout/index.cjs +1 -1
- package/dist/layouts/service-layout/index.d.cts +1 -1
- package/dist/layouts/service-layout/index.d.mts +3 -3
- package/dist/layouts/service-layout/index.mjs +1 -1
- package/dist/pages/FeatureDeveloping.d.cts +2 -2
- package/dist/pages/FeatureDeveloping.d.mts +2 -2
- package/dist/pages/FeatureFixing.d.mts +2 -2
- package/dist/pages/NotAuthorized.d.cts +2 -2
- package/dist/pages/NotAuthorized.d.mts +2 -2
- package/dist/pages/NotFound.d.cts +2 -2
- package/dist/pages/NotFound.d.mts +2 -2
- package/dist/{resizable-D8XbQdj_.cjs → resizable-C2-dXaDM.cjs} +1 -1
- package/dist/{resizable-D8XbQdj_.cjs.map → resizable-C2-dXaDM.cjs.map} +1 -1
- package/dist/{resizable-B9HHrfKn.mjs → resizable-LConLbS6.mjs} +1 -1
- package/dist/{resizable-B9HHrfKn.mjs.map → resizable-LConLbS6.mjs.map} +1 -1
- package/dist/{scroll-area-CiMS2UY7.mjs → scroll-area-6xusEFm6.mjs} +1 -1
- package/dist/{scroll-area-CiMS2UY7.mjs.map → scroll-area-6xusEFm6.mjs.map} +1 -1
- package/dist/{scroll-area-qE6GqGkn.cjs → scroll-area-D61j6n8I.cjs} +1 -1
- package/dist/{scroll-area-qE6GqGkn.cjs.map → scroll-area-D61j6n8I.cjs.map} +1 -1
- package/dist/{separator-BlXmdu-p.d.cts → separator-B0xZ0amV.d.mts} +3 -3
- package/dist/{separator-DjuElvvp.d.mts → separator-BlCcNC_3.d.cts} +3 -3
- package/dist/{separator-D3CGKwyf.cjs → separator-Crr30ZHa.cjs} +1 -1
- package/dist/{separator-D3CGKwyf.cjs.map → separator-Crr30ZHa.cjs.map} +1 -1
- package/dist/{separator-C2yOD6r_.mjs → separator-yTKDuMWb.mjs} +1 -1
- package/dist/{separator-C2yOD6r_.mjs.map → separator-yTKDuMWb.mjs.map} +1 -1
- package/dist/{sheet-DXLayspn.mjs → sheet-BSeiP8S8.mjs} +1 -1
- package/dist/{sheet-DXLayspn.mjs.map → sheet-BSeiP8S8.mjs.map} +1 -1
- package/dist/{sheet-DtWL6WcJ.cjs → sheet-BYKV6xT_.cjs} +1 -1
- package/dist/{sheet-DtWL6WcJ.cjs.map → sheet-BYKV6xT_.cjs.map} +1 -1
- package/dist/skeleton-C4suljHP.cjs.map +1 -1
- package/dist/skeleton-CvZncisJ.mjs.map +1 -1
- package/dist/{tabs-DSofRReg.cjs → tabs-DldSJjLy.cjs} +1 -1
- package/dist/{tabs-DSofRReg.cjs.map → tabs-DldSJjLy.cjs.map} +1 -1
- package/dist/{tabs-Cjh2jtUZ.mjs → tabs-XrUcxpL1.mjs} +1 -1
- package/dist/{tabs-Cjh2jtUZ.mjs.map → tabs-XrUcxpL1.mjs.map} +1 -1
- package/dist/{title-CMJS7QS7.mjs → title-BK1YcXjX.mjs} +1 -1
- package/dist/{title-CMJS7QS7.mjs.map → title-BK1YcXjX.mjs.map} +1 -1
- package/dist/{title-C4XNLXSe.cjs → title-BNv6aAfA.cjs} +1 -1
- package/dist/{title-C4XNLXSe.cjs.map → title-BNv6aAfA.cjs.map} +1 -1
- package/dist/{tooltip-D0XDvxqi.mjs → tooltip-BDaKTFKI.mjs} +1 -1
- package/dist/{tooltip-D0XDvxqi.mjs.map → tooltip-BDaKTFKI.mjs.map} +1 -1
- package/dist/{tooltip-zYWazsY5.cjs → tooltip-BimfNium.cjs} +1 -1
- package/dist/{tooltip-zYWazsY5.cjs.map → tooltip-BimfNium.cjs.map} +1 -1
- package/dist/{tooltip-BZ-lfeF_.d.mts → tooltip-CCJYVy_H.d.mts} +6 -6
- package/dist/{tooltip-szcBtW8t.d.cts → tooltip-DeAzmFCB.d.cts} +6 -6
- package/dist/{types-D2kMOc_b.d.mts → types-DWnJKJ5r.d.mts} +1 -1
- package/dist/typography/paragraph.d.cts +2 -2
- package/dist/typography/title.cjs +1 -1
- package/dist/typography/title.d.cts +2 -2
- package/dist/typography/title.d.mts +2 -2
- package/dist/typography/title.mjs +1 -1
- package/dist/ui/alert-dialog.d.cts +12 -12
- package/dist/ui/alert-dialog.d.mts +12 -12
- package/dist/ui/alert.d.cts +6 -6
- package/dist/ui/alert.d.mts +4 -4
- package/dist/ui/aspect-ratio.d.cts +2 -2
- package/dist/ui/aspect-ratio.d.mts +2 -2
- package/dist/ui/avatar.cjs +1 -1
- package/dist/ui/avatar.d.cts +4 -4
- package/dist/ui/avatar.d.mts +4 -4
- package/dist/ui/avatar.mjs +1 -1
- package/dist/ui/badge.cjs +1 -2
- package/dist/ui/badge.d.cts +4 -4
- package/dist/ui/badge.d.mts +2 -2
- package/dist/ui/badge.mjs +1 -2
- package/dist/ui/breadcrumb.d.cts +8 -8
- package/dist/ui/breadcrumb.d.mts +8 -8
- package/dist/ui/button-group.cjs +1 -1
- package/dist/ui/button-group.d.cts +7 -7
- package/dist/ui/button-group.d.mts +5 -5
- package/dist/ui/button-group.mjs +1 -1
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.mts +1 -1
- package/dist/ui/calendar.d.cts +4 -4
- package/dist/ui/calendar.d.mts +4 -4
- package/dist/ui/card.d.cts +8 -8
- package/dist/ui/card.d.mts +8 -8
- package/dist/ui/carousel.d.cts +7 -7
- package/dist/ui/carousel.d.mts +7 -7
- package/dist/ui/collapsible.d.cts +4 -4
- package/dist/ui/collapsible.d.mts +4 -4
- package/dist/ui/command.cjs +1 -1
- package/dist/ui/command.d.cts +11 -11
- package/dist/ui/command.d.mts +11 -11
- package/dist/ui/command.mjs +1 -1
- package/dist/ui/context-menu.d.cts +16 -16
- package/dist/ui/context-menu.d.mts +16 -16
- package/dist/ui/dialog.cjs +1 -1
- package/dist/ui/dialog.d.cts +1 -1
- package/dist/ui/dialog.d.mts +1 -1
- package/dist/ui/dialog.mjs +1 -1
- package/dist/ui/drawer.cjs +1 -1
- package/dist/ui/drawer.d.cts +11 -11
- package/dist/ui/drawer.d.mts +11 -11
- package/dist/ui/drawer.mjs +1 -1
- package/dist/ui/dropdown-menu.cjs +1 -1
- package/dist/ui/dropdown-menu.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.mts +16 -16
- package/dist/ui/dropdown-menu.mjs +1 -1
- package/dist/ui/empty.d.cts +9 -9
- package/dist/ui/empty.d.mts +7 -7
- package/dist/ui/field.cjs +1 -1
- package/dist/ui/field.d.cts +22 -22
- package/dist/ui/field.d.mts +24 -24
- package/dist/ui/field.mjs +1 -1
- package/dist/ui/file-uploader.d.cts +2 -2
- package/dist/ui/file-uploader.d.mts +2 -2
- package/dist/ui/form.cjs +1 -1
- package/dist/ui/form.d.cts +11 -11
- package/dist/ui/form.d.mts +11 -11
- package/dist/ui/form.mjs +1 -1
- package/dist/ui/hover-card.d.cts +4 -4
- package/dist/ui/hover-card.d.mts +4 -4
- package/dist/ui/image.cjs +1 -1
- package/dist/ui/image.mjs +1 -1
- package/dist/ui/input-otp.d.cts +5 -5
- package/dist/ui/input-otp.d.mts +5 -5
- package/dist/ui/input.cjs +1 -1
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.mts +1 -1
- package/dist/ui/input.mjs +1 -1
- package/dist/ui/inputs/search-input.cjs +1 -1
- package/dist/ui/inputs/search-input.d.cts +3 -3
- package/dist/ui/inputs/search-input.d.mts +3 -3
- package/dist/ui/inputs/search-input.mjs +1 -1
- package/dist/ui/item.cjs +1 -1
- package/dist/ui/item.d.cts +15 -15
- package/dist/ui/item.d.mts +15 -15
- package/dist/ui/item.mjs +1 -1
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.d.cts +2 -2
- package/dist/ui/label.d.mts +2 -2
- package/dist/ui/label.mjs +1 -1
- package/dist/ui/menubar.d.cts +17 -17
- package/dist/ui/menubar.d.mts +17 -17
- package/dist/ui/multi-select.cjs +1 -1
- package/dist/ui/multi-select.d.mts +3 -3
- package/dist/ui/multi-select.mjs +1 -1
- package/dist/ui/navigation-menu.d.cts +11 -11
- package/dist/ui/navigation-menu.d.mts +9 -9
- package/dist/ui/pagination.d.cts +9 -9
- package/dist/ui/pagination.d.mts +9 -9
- package/dist/ui/popover.d.cts +5 -5
- package/dist/ui/popover.d.mts +5 -5
- package/dist/ui/progress.d.cts +2 -2
- package/dist/ui/progress.d.mts +2 -2
- package/dist/ui/radio-group.d.cts +3 -3
- package/dist/ui/radio-group.d.mts +3 -3
- package/dist/ui/resizable.cjs +1 -1
- package/dist/ui/resizable.d.cts +4 -4
- package/dist/ui/resizable.d.mts +4 -4
- package/dist/ui/resizable.mjs +1 -1
- package/dist/ui/scroll-area.cjs +1 -1
- package/dist/ui/scroll-area.d.cts +3 -3
- package/dist/ui/scroll-area.d.mts +6 -6
- package/dist/ui/scroll-area.mjs +1 -1
- package/dist/ui/select.d.cts +11 -11
- package/dist/ui/select.d.mts +11 -11
- package/dist/ui/separator.cjs +1 -1
- package/dist/ui/separator.d.cts +1 -1
- package/dist/ui/separator.d.mts +1 -1
- package/dist/ui/separator.mjs +1 -1
- package/dist/ui/sheet.cjs +1 -1
- package/dist/ui/sheet.d.cts +9 -9
- package/dist/ui/sheet.d.mts +9 -9
- package/dist/ui/sheet.mjs +1 -1
- package/dist/ui/sidebar.cjs +1 -1
- package/dist/ui/sidebar.d.cts +28 -28
- package/dist/ui/sidebar.d.mts +30 -30
- package/dist/ui/sidebar.mjs +1 -1
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.mts +2 -2
- package/dist/ui/slider.d.mts +2 -2
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.mts +2 -2
- package/dist/ui/spinner.d.cts +2 -2
- package/dist/ui/spinner.d.mts +2 -2
- package/dist/ui/switch.d.cts +2 -2
- package/dist/ui/switch.d.mts +2 -2
- package/dist/ui/table.d.cts +9 -9
- package/dist/ui/table.d.mts +9 -9
- package/dist/ui/tabs.cjs +1 -1
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.mts +5 -5
- package/dist/ui/tabs.mjs +1 -1
- package/dist/ui/textarea.d.cts +2 -2
- package/dist/ui/textarea.d.mts +2 -2
- package/dist/ui/toggle-group.d.cts +3 -3
- package/dist/ui/toggle-group.d.mts +3 -3
- package/dist/ui/toggle.d.cts +2 -2
- package/dist/ui/toggle.d.mts +4 -4
- package/dist/ui/tooltip.cjs +1 -1
- package/dist/ui/tooltip.d.cts +1 -1
- package/dist/ui/tooltip.d.mts +1 -1
- package/dist/ui/tooltip.mjs +1 -1
- package/package.json +1 -1
- package/dist/ui/badge.cjs.map +0 -1
- package/dist/ui/badge.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["UITableNameDisplay: React.FC<NameDisplayProps>","Tooltip","UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{ value: string }>>","Tooltip","UITableUserDataDisplay: React.FC<Props>","Avatar","Checkbox","CheckboxPrimitive","UITableWrapper: React.FC<React.PropsWithChildren<React.ComponentProps<'div'>>>","UITableHeader: React.FC<React.PropsWithChildren>","UITableHeaderRow: React.FC<React.PropsWithChildren>","UITableHeaderCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'th'> & {\n header: Header<unknown, unknown>;\n isPinned: ColumnPinningPosition;\n isResizing: boolean;\n isAllRowsSelected: boolean;\n }\n >\n>","Checkbox","UITableHeaderCellOption: React.FC<{\n isPinned: ColumnPinningPosition;\n className?: string;\n isVisible?: boolean;\n onLeftPin: (pos: 'left' | 'right' | false) => void;\n onRightPin: (pos: 'left' | 'right' | false) => void;\n onUnpin: (pos: 'left' | 'right' | false) => void;\n onToggleVisibilityHandler: (visible: AnyEntity) => void;\n}>","DropdownMenu","UITableBody: React.FC<React.PropsWithChildren<React.ComponentProps<'tbody'> & { height: number }>>","UITableRow: React.FC<\n React.ComponentProps<'tr'> & {\n row: Row<unknown>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n }\n>","UITableCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'td'> & {\n cell: Cell<unknown, unknown>;\n }\n >\n>","EmptyDisplay: React.FC","UITableFooter: React.FC<React.PropsWithChildren>","UITableContainer: React.FC<React.PropsWithChildren>","colSizes: { [key: string]: number | undefined }","ColumnVisibility: React.FC<{\n checked: boolean;\n title: string;\n onCheckedChange?: (checked: boolean) => void;\n}>","Checkbox","Separator","INITIAL_STATE: InitialTableState","UITableTooltipFilter: React.FC<React.ComponentProps<typeof Input>>","ActionButton: React.FC<React.PropsWithChildren>","UITableTooltipActions: React.FC","UITableTooltip: React.FC<React.PropsWithChildren>"],"sources":["../../../packages/components/features/tables/components/atoms/name-display.tsx","../../../packages/components/features/tables/components/atoms/phone-number.tsx","../../../packages/components/features/tables/components/atoms/user.tsx","../../../packages/components/ui/checkbox.tsx","../../../packages/components/features/tables/hooks/use-table-context.ts","../../../packages/components/features/tables/hooks/use-table-rows-context.ts","../../../packages/components/features/tables/components/table.tsx","../../../packages/components/features/tables/components/table/filter.tsx","../../../packages/components/features/tables/components/table/provider.tsx","../../../packages/components/features/tables/components/table/tooltip.tsx"],"sourcesContent":["import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { Paragraph } from '@/components/typography/paragraph';\n\ntype NameDisplayProps = {\n name: string;\n};\n\nexport const UITableNameDisplay: React.FC<NameDisplayProps> = ({ name }) => {\n return (\n <Tooltip>\n <TooltipTrigger>\n <Paragraph variant=\"sm\" className=\"line-clamp-2 w-full truncate text-wrap pb-px text-start\">\n {name}\n </Paragraph>\n </TooltipTrigger>\n <TooltipContent align=\"start\" className=\"max-w-80 whitespace-pre-line text-wrap break-keep\">\n {name}\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nexport const UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{ value: string }>> = ({ value }) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <p className=\"font-number text-secondary-foreground text-sm tabular-nums\">{value.replace(/(\\d{3})(\\d{3})(\\d{4})/, '($1) $2-$3')}</p>\n </TooltipTrigger>\n <TooltipContent align=\"start\">\n <p className=\"tabular-nums\">{value.slice(1).replace(/(\\d{2})(\\d{3})(\\d{4})/, '(00) (+84) ($1) $2-$3')}</p>\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { UserRoundIcon } from 'lucide-react';\n\nimport { colorHashLight } from '@customafk/react-toolkit/color-hash';\n\nimport { Avatar, AvatarFallback } from '@/components/ui/avatar';\n\nimport { Flex } from '@/components/layouts/flex';\nimport { Paragraph } from '@/components/typography/paragraph';\n\ntype Props = {\n uuid: string;\n username: string;\n email: string;\n};\n\nexport const UITableUserDataDisplay: React.FC<Props> = ({ uuid, username, email }) => {\n return (\n <Flex wrap={false} gap=\"sm\" padding=\"none\">\n <Avatar className=\"size-10 shadow-card\">\n <AvatarFallback style={{ backgroundColor: colorHashLight.hex(uuid) }}>\n <UserRoundIcon size={28} className=\"text-white\" />\n </AvatarFallback>\n </Avatar>\n <Flex vertical padding=\"none\" gap=\"none\" align=\"start\">\n <Paragraph className=\"font-medium text-sm text-text-positive\">{username}</Paragraph>\n <Paragraph variant=\"sm\" className=\"mt-0! text-text-positive-weak text-xs\">\n {email}\n </Paragraph>\n </Flex>\n </Flex>\n );\n};\n","'use client';\n\nimport { CheckIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\n\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'peer border-border',\n 'size-4 shrink-0 cursor-pointer rounded border shadow-xs outline-none transition-shadow',\n 'data-[state=checked]:bg-primary',\n 'data-[state=checked]:text-text-negative-strong',\n 'data-[state=checked]:border-primary',\n 'focus-visible:border-primary-strong',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-3',\n 'aria-invalid:ring-danger-weak',\n 'aria-invalid:border-danger',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"flex items-center justify-center text-current transition-none\">\n <CheckIcon size={14} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox };\n","import { createContext, use } from 'react';\n\nimport type { RowData } from '@tanstack/react-table';\n\nimport type { TTableContext } from '../types';\n\nexport const TableContext = createContext<TTableContext<RowData> | null>(null);\n\nexport const useUITableContext = <TData extends RowData>() => {\n const context = use(TableContext) as TTableContext<TData>;\n if (!context) {\n throw new Error('useTableContext must be used within a TableProvider');\n }\n return context;\n};\n","import { createContext, use } from 'react';\n\nimport type { Row, RowData } from '@tanstack/react-table';\n\nexport type TTableRowsContext<TData extends RowData> = {\n rowsLength: number;\n rows: Row<TData>[];\n};\n\nexport const TableRowsContext = createContext<TTableRowsContext<RowData> | null>(null);\nexport const useUITableRowsContext = <TData extends RowData>() => {\n const ctx = use(TableRowsContext) as TTableRowsContext<TData>;\n if (!ctx) {\n throw new Error('useTableRowContext must be used within a TableRowProvider');\n }\n return ctx;\n};\n","'use client';\nimport { Activity, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { type Cell, type Column, type ColumnPinningPosition, flexRender, type Header, type Row } from '@tanstack/react-table';\nimport { useVirtualizer, type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';\n\nimport { BoxIcon, EllipsisVerticalIcon, EyeOffIcon, MoveLeftIcon, MoveRightIcon, PinOffIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Checkbox } from '@/components/ui/checkbox';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n} from '@/components/ui/dropdown-menu';\nimport { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable';\n\nimport type { ImperativePanelGroupHandle } from 'react-resizable-panels';\nimport type { AnyEntity } from '@/types';\nimport { useUITableContext } from '../hooks/use-table-context';\nimport { useUITableRowsContext } from '../hooks/use-table-rows-context';\n\nconst SELECT_WIDTH = 60;\nconst TABLE_HEADER_Z_INDEX = 20;\nconst PINNED_COLUMN_Z_INDEX = 20;\n\n//These are the important styles to make sticky column pinning work!\n//Apply styles like this using your CSS strategy of choice with this kind of logic to head cells, data cells, footer cells, etc.\n//View the index.css file for more needed styles such as border-collapse: separate\nconst getCommonPinningStyles = (column: Column<unknown>): React.CSSProperties => {\n const isPinned = column.getIsPinned();\n return {\n zIndex: isPinned ? PINNED_COLUMN_Z_INDEX : undefined,\n left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,\n right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,\n position: isPinned ? 'sticky' : 'relative',\n };\n};\n\nexport const UITableWrapper: React.FC<React.PropsWithChildren<React.ComponentProps<'div'>>> = ({ className, children, ...props }) => {\n return (\n <div data-slot=\"table-wrapper\" className=\"relative m-0 flex size-full flex-col flex-nowrap items-start justify-start gap-2 py-2.5 text-sm\" {...props}>\n {children}\n </div>\n );\n};\n\nconst UITableHeader: React.FC<React.PropsWithChildren> = memo(({ children }) => {\n return (\n <thead\n data-slot=\"table-header\"\n style={{ zIndex: TABLE_HEADER_Z_INDEX }}\n className={cn(\n 'sticky top-0 grid bg-muted-bg-subtle text-sm text-text-positive',\n '[&_tr:not(:last-child)_td]:border-b',\n '[&_th]:flex',\n '[&_th]:h-10',\n '[&_th]:select-none',\n '[&_th]:items-center',\n '[&_th]:whitespace-nowrap',\n '[&_th]:border-border',\n '[&_th]:font-normal',\n '[&_th]:border-r',\n '[&_th]:border-b-border',\n '[&_th]:text-left',\n '[&_th]:align-middle',\n '[&_th]:last:border-r-0',\n '[&_th]:first:border-l-0',\n '[&_th]:data-[pinned=right]:border-l',\n '[&_th]:data-[pinned=right]:border-r-0',\n '[&_th]:data-[pinned=left]:border-r',\n '[&_tr_th:not([data-pinned=false])]:bg-muted-bg-subtle'\n )}\n >\n {children}\n </thead>\n );\n});\nUITableHeader.displayName = 'TableHeader';\n\nconst UITableHeaderRow: React.FC<React.PropsWithChildren> = memo(({ children }) => {\n return (\n <tr data-slot=\"table-header-row\" className=\"flex w-full border-border border-b shadow\">\n {children}\n </tr>\n );\n});\nUITableHeaderRow.displayName = 'TableHeaderRow';\n\nconst UITableHeaderCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'th'> & {\n header: Header<unknown, unknown>;\n isPinned: ColumnPinningPosition;\n isResizing: boolean;\n isAllRowsSelected: boolean;\n }\n >\n> = ({ header, isPinned, isResizing, isAllRowsSelected, children, ...props }) => {\n const style = getCommonPinningStyles(header.column);\n const width = `calc(var(--header-${header.id}-size) * 1px)`;\n\n if (header.id === 'select') {\n return (\n <th data-slot=\"table-header-cell\" style={{ ...style, width: SELECT_WIDTH }} className=\"relative\" {...props}>\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Checkbox\n aria-label=\"Select All Rows\"\n checked={isAllRowsSelected}\n onCheckedChange={value => {\n header.getContext().table.toggleAllRowsSelected(!!value);\n }}\n />\n </div>\n </th>\n );\n }\n return (\n <th data-slot=\"table-header-cell\" data-pinned={isPinned} style={{ ...style, width }} colSpan={header.colSpan} className={cn('group relative')} {...props}>\n <div className=\"absolute inset-0 gap-1 truncate\">\n <div className=\"flex h-full flex-1 cursor-pointer select-none items-center justify-between\">\n <div className=\"flex size-full flex-1 items-center truncate pl-4\">{flexRender(header.column.columnDef.header, header.getContext())}</div>\n </div>\n </div>\n {!['select', 'actions'].includes(header.id) && (\n <UITableHeaderCellOption\n isPinned={isPinned}\n isVisible={header.column.getIsVisible()}\n className=\"invisible absolute right-2 z-10 group-hover:visible\"\n onLeftPin={header.column.pin}\n onRightPin={header.column.pin}\n onUnpin={header.column.pin}\n onToggleVisibilityHandler={header.column.toggleVisibility}\n />\n )}\n <Activity mode={isPinned ? 'hidden' : 'visible'}>\n <div\n onDoubleClick={header.column.resetSize}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n className={cn('absolute inset-y-0 -right-0.5 w-1 cursor-e-resize bg-transparent hover:bg-border', isResizing && 'bg-border')}\n />\n </Activity>\n </th>\n );\n};\n\nconst UITableHeaderCellOption: React.FC<{\n isPinned: ColumnPinningPosition;\n className?: string;\n isVisible?: boolean;\n onLeftPin: (pos: 'left' | 'right' | false) => void;\n onRightPin: (pos: 'left' | 'right' | false) => void;\n onUnpin: (pos: 'left' | 'right' | false) => void;\n onToggleVisibilityHandler: (visible: AnyEntity) => void;\n}> = ({ isPinned, className, onLeftPin, onRightPin, onUnpin, onToggleVisibilityHandler }) => {\n const handleLeftPin = useCallback(() => {\n onLeftPin('left');\n }, [onLeftPin]);\n\n const handleRightPin = useCallback(() => {\n onRightPin('right');\n }, [onRightPin]);\n\n const handleUnpin = useCallback(() => {\n onUnpin(false);\n }, [onUnpin]);\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n className={cn('cursor-pointer rounded-full p-0.5 text-text-positive-weak hover:bg-muted-muted hover:text-text-positive [&>svg]:size-4', className)}\n >\n <EllipsisVerticalIcon />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-64 p-4\">\n <DropdownMenuGroup className=\"*:data-[slot=dropdown-menu-item]:rounded-xs *:data-[slot=dropdown-menu-item]:p-2\">\n <Activity mode={isPinned ? 'visible' : 'hidden'}>\n <DropdownMenuItem onClick={handleUnpin}>\n {!!isPinned && 'Unpin'}\n <DropdownMenuShortcut>\n <PinOffIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n </Activity>\n <Activity mode={!isPinned ? 'visible' : 'hidden'}>\n <DropdownMenuItem onClick={handleLeftPin}>\n {isPinned ? 'Unpin' : 'Pin to Left'}\n <DropdownMenuShortcut>\n <MoveLeftIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n <DropdownMenuItem onClick={handleRightPin}>\n {isPinned ? 'Unpin' : 'Pin to Right'}\n <DropdownMenuShortcut>\n <MoveRightIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n </Activity>\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n <DropdownMenuGroup className=\"*:data-[slot=dropdown-menu-item]:rounded-xs *:data-[slot=dropdown-menu-item]:p-2\">\n <DropdownMenuItem onClick={() => onToggleVisibilityHandler(false)}>\n Hide Field\n <DropdownMenuShortcut>\n <EyeOffIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\nconst UITableBody: React.FC<React.PropsWithChildren<React.ComponentProps<'tbody'> & { height: number }>> = ({ height, children, ...props }) => {\n return (\n <tbody\n data-slot=\"table-body\"\n style={{ height: `${height}px` }}\n className={cn(\n 'relative grid w-full',\n '[&_tr]:absolute [&_tr]:flex [&_tr]:w-full [&_tr]:cursor-pointer [&_tr]:border-b [&_tr]:border-b-border [&_tr]:focus:outline-none',\n '[&_td]:z-10',\n '[&_td]:flex',\n '[&_td]:overflow-hidden',\n '[&_td]:whitespace-nowrap',\n '[&_td]:px-4',\n '[&_td]:py-2.5',\n '[&_td]:align-middle',\n '[&_td]:border-border',\n '[&_td]:data-[pinned=right]:border-l',\n '[&_td]:data-[pinned=left]:border-r',\n '[&_td:not([data-pinned=false])]:bg-card',\n '[&_td:not([data-pinned=false])]:shadow-xs'\n )}\n {...props}\n >\n {children}\n </tbody>\n );\n};\n\nconst UITableRow: React.FC<\n React.ComponentProps<'tr'> & {\n row: Row<unknown>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n }\n> = memo(({ children, row, virtualRow, rowVirtualizer, className, ...props }) => {\n const { columnPinning: _ } = useUITableContext();\n return (\n <tr\n data-slot=\"table-row\"\n data-index={virtualRow.index}\n ref={node => rowVirtualizer.measureElement(node)}\n style={{\n transform: `translateY(${virtualRow.start}px)`,\n }}\n className={cn('group', className)}\n {...props}\n >\n {row.getVisibleCells().map(cell => {\n return <UITableCell key={cell.id} cell={cell} className=\"group-hover:bg-muted-bg-subtle!\" />;\n })}\n </tr>\n );\n});\nUITableRow.displayName = 'TableRow';\n\nconst UITableCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'td'> & {\n cell: Cell<unknown, unknown>;\n }\n >\n> = memo(({ cell, children, className, ...props }) => {\n const { rowSelection: _ } = useUITableContext();\n const isPinned = cell.column.getIsPinned();\n const style = getCommonPinningStyles(cell.column);\n const width = `calc(var(--col-${cell.column.id}-size) * 1px)`;\n if (isPinned) {\n console.log('Pinned Cell Rendered:', cell.column.getPinnedIndex());\n }\n\n if (cell.column.id === 'select') {\n return (\n <td data-slot=\"table-cell\" style={{ ...style, width: SELECT_WIDTH }} className={cn('border-none! bg-transparent! shadow-none!', className)} {...props}>\n <div className=\"absolute inset-0 flex items-center justify-center bg-transparent\">\n <Checkbox\n aria-label=\"Select Row\"\n checked={cell.row.getIsSelected()}\n onCheckedChange={value => {\n cell.row.toggleSelected(!!value);\n }}\n />\n </div>\n </td>\n );\n }\n\n return (\n <td\n data-slot=\"table-cell\"\n data-pinned={isPinned}\n style={{ ...style, width }}\n className={cn(isPinned && cell.column.getPinnedIndex() === 0 && 'shadow!', className)}\n {...props}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </td>\n );\n});\nUITableCell.displayName = 'TableCell';\n\nconst EmptyDisplay: React.FC = () => {\n return (\n <div className=\"sticky left-0 flex flex-1 items-center justify-center bg-transparent text-text-positive-weak opacity-100\">\n <div className=\"flex flex-col items-center gap-1\">\n <BoxIcon strokeWidth={1} size={48} />\n <p>No data available</p>\n </div>\n </div>\n );\n};\n\nexport const UITableFooter: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <tfoot data-slot=\"table-footer\" className=\"flex w-full justify-center border-border-weak border-t py-2 font-medium [&>tr]:last:border-b-0\">\n {children}\n </tfoot>\n );\n};\n\nexport const UITableContainer: React.FC<React.PropsWithChildren> = ({ children }) => {\n const { table, isEmpty, isFetching, totalRows, fetchMoreData } = useUITableContext();\n const { rows, rowsLength } = useUITableRowsContext();\n\n const tableContainerRef = useRef<ImperativePanelGroupHandle | null>(null);\n const tableRef = useRef<HTMLTableElement | null>(null);\n\n /**\n * Instead of calling `column.getSize()` on every render for every header\n * and especially every data cell (very expensive),\n * we will calculate all column sizes at once at the root table level in a useMemo\n * and pass the column sizes down as CSS variables to the <table> element.\n */\n // biome-ignore lint/correctness/useExhaustiveDependencies: <table> element.\n const columnSizeVars = useMemo(() => {\n const headers = table.getFlatHeaders();\n const colSizes: { [key: string]: number | undefined } = {};\n headers.forEach(header => {\n colSizes[`--header-${header.id}-size`] = header.getSize() || 0;\n colSizes[`--col-${header.column.id}-size`] = header.column.getSize() || 0;\n });\n return colSizes;\n }, [table.getState().columnSizingInfo, table.getState().columnSizing]);\n\n // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.\n const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n count: rowsLength,\n getScrollElement: () => tableRef.current,\n estimateSize: () => 40, // estimated row height\n measureElement: element => element?.getBoundingClientRect().height,\n overscan: 2, // Render additional rows beyond viewport for smoother scrolling\n });\n\n //called on scroll and possibly on mount to fetch more data as the user scrolls and reaches bottom of table\n const fetchMoreOnButtonReached = useCallback(\n async (containerRefEl?: HTMLTableElement | null) => {\n if (!containerRefEl) return null;\n const { scrollHeight, scrollTop, clientHeight } = containerRefEl;\n //once the user has scrolled within 500px of the bottom of the table, fetch more data if we can\n if (scrollHeight - scrollTop - clientHeight < 500 && !isFetching && totalRows && rowsLength < totalRows) {\n await fetchMoreData?.();\n }\n },\n [isFetching, rowsLength, totalRows, fetchMoreData]\n );\n\n //a check on mount and after a fetch to see if the table is already scrolled to the bottom and immediately needs to fetch more data\n useEffect(() => {\n fetchMoreOnButtonReached(tableRef.current);\n }, [fetchMoreOnButtonReached]);\n\n return (\n <ResizablePanelGroup\n ref={tableContainerRef}\n direction=\"horizontal\"\n style={{ direction: table.options.columnResizeDirection }}\n className=\"relative flex w-full max-w-full flex-1 gap-1 overflow-auto border-t border-t-border bg-slate-50 p-0 text-sm\"\n >\n <ResizablePanel className=\"overflow-auto\">\n <table\n ref={tableRef}\n data-slot=\"table\"\n style={{\n ...columnSizeVars,\n width: table.getTotalSize(),\n }}\n className=\"grid size-full max-w-full caption-bottom border-collapse border-spacing-0 flex-col content-start overflow-auto bg-card text-sm tabular-nums [&_tfoot_td]:border-t\"\n >\n <UITableHeader>\n {table.getHeaderGroups().map(headerGroup => (\n <UITableHeaderRow key={headerGroup.id}>\n {headerGroup.headers.map(header => (\n <UITableHeaderCell\n key={header.id}\n header={header}\n isPinned={header.column.getIsPinned()}\n isResizing={header.column.getIsResizing()}\n isAllRowsSelected={table.getIsAllRowsSelected()}\n />\n ))}\n </UITableHeaderRow>\n ))}\n </UITableHeader>\n <UITableBody data-slot=\"table-body\" height={rowVirtualizer.getTotalSize()}>\n {rowVirtualizer.getVirtualItems().map(virtualRow => {\n const row = rows[virtualRow.index] as Row<AnyEntity>;\n return <UITableRow key={row.id} data-index={virtualRow.index} row={row} virtualRow={virtualRow} rowVirtualizer={rowVirtualizer} />;\n })}\n </UITableBody>\n </table>\n {isEmpty && <EmptyDisplay />}\n </ResizablePanel>\n <ResizableHandle />\n {children}\n </ResizablePanelGroup>\n );\n};\n","import { Activity, useState } from 'react';\n\nimport { Columns4Icon, ListFilterIcon, ListFilterPlus } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { ResizablePanel } from '@/components/ui/resizable';\nimport { Separator } from '@/components/ui/separator';\n\nimport { useUITableContext } from '../../hooks/use-table-context';\n\nconst ColumnVisibility: React.FC<{\n checked: boolean;\n title: string;\n onCheckedChange?: (checked: boolean) => void;\n}> = ({ checked, title, onCheckedChange }) => {\n return (\n <div className=\"flex h-fit items-center gap-2\">\n <Checkbox checked={checked} onCheckedChange={onCheckedChange} />\n <p className=\"text-sm\">{title}</p>\n </div>\n );\n};\n\nexport const UITableFilter = () => {\n const { table } = useUITableContext();\n const [tab, setTab] = useState<'columns' | 'filters' | null>(null);\n\n return (\n <ResizablePanel defaultSize={25} className={cn('bg-card', tab === null ? 'max-w-8!' : 'min-w-64')}>\n <div className=\"relative z-20 flex size-full bg-muted-bg-subtle\">\n <div className=\"flex-1\">\n <Activity mode={tab === 'columns' ? 'visible' : 'hidden'}>\n <div className=\"flex size-full flex-col gap-2 p-4\">\n <p className=\"px-2 font-medium\">Columns Visibility</p>\n <Separator />\n <div className=\"flex flex-col gap-4 pt-4\">\n {table.getAllColumns().map(column => {\n if (['select', 'actions'].includes(column.id)) return null;\n return (\n <ColumnVisibility\n key={column.id}\n checked={column.getIsVisible()}\n title={String(column.columnDef.header)}\n onCheckedChange={value => column.toggleVisibility(!!value)}\n />\n );\n })}\n </div>\n </div>\n </Activity>\n <Activity mode={tab === 'filters' ? 'visible' : 'hidden'}>\n <div className=\"flex size-full flex-col p-2\">\n <Button variant=\"outline\" color=\"muted\">\n <ListFilterPlus />\n Add Filter\n </Button>\n </div>\n </Activity>\n </div>\n <div className=\"flex h-full flex-col border-border border-l bg-muted-bg-subtle text-sm\">\n <button\n className={cn('flex h-32 cursor-pointer flex-col items-center gap-y-2 p-2 py-4', tab === 'columns' && 'bg-card')}\n onClick={() => setTab(tab === 'columns' ? null : 'columns')}\n >\n <Columns4Icon size={18} />\n <span className=\"text-nowrap [writing-mode:vertical-lr]\">Columns</span>\n </button>\n <Separator />\n <button\n className={cn('flex h-32 cursor-pointer flex-col items-center gap-y-2 p-2 py-4', tab === 'filters' && 'bg-card')}\n onClick={() => setTab(tab === 'filters' ? null : 'filters')}\n >\n <ListFilterIcon size={18} />\n <span className=\"text-nowrap [writing-mode:vertical-lr]\">Filters</span>\n </button>\n <Separator />\n </div>\n </div>\n </ResizablePanel>\n );\n};\n","import { useMemo, useState } from 'react';\n\nimport type { ColumnPinningState, InitialTableState, RowData, RowSelectionState, VisibilityState } from '@tanstack/react-table';\nimport { getCoreRowModel, useReactTable } from '@tanstack/react-table';\n\nimport { TableContext } from '../../hooks/use-table-context';\nimport { TableRowsContext, type TTableRowsContext } from '../../hooks/use-table-rows-context';\nimport type { TableProviderProps, TTableContext } from '../../types';\n\nconst INITIAL_STATE: InitialTableState = {\n columnPinning: { right: ['actions'] },\n};\n\nexport const UITableProvider = <TData extends RowData>({\n title,\n isFetching = false,\n data,\n columns,\n totalRows,\n\n fetchMoreData,\n children,\n}: React.PropsWithChildren<TableProviderProps<TData>>) => {\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({ right: ['actions'] });\n const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});\n\n const table = useReactTable<TData>({\n initialState: INITIAL_STATE,\n data: data,\n columns,\n state: {\n rowSelection,\n columnPinning,\n columnVisibility,\n },\n defaultColumn: {\n minSize: 40,\n size: 150,\n maxSize: 800,\n },\n columnResizeMode: 'onChange',\n columnResizeDirection: 'ltr',\n\n enableRowSelection: true,\n enableColumnResizing: true,\n enableMultiRowSelection: true,\n\n getCoreRowModel: getCoreRowModel(),\n\n onRowSelectionChange: setRowSelection,\n onColumnPinningChange: setColumnPinning,\n onColumnVisibilityChange: setColumnVisibility,\n });\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: rows\n const rows = useMemo(() => {\n return table.getRowModel().rows;\n }, [data, table.getState().columnPinning]);\n\n const isEmpty = useMemo<boolean>(() => {\n return !isFetching && table.getRowModel().rows.length === 0;\n }, [table, isFetching]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: table get state\n const value = useMemo<TTableContext<TData>>(\n () => ({\n table,\n title,\n isEmpty,\n isFetching,\n\n totalRows,\n\n rowSelection: table.getState().rowSelection,\n\n columnPinning: table.getState().columnPinning,\n\n fetchMoreData,\n }),\n [\n table,\n title,\n\n isEmpty,\n isFetching,\n\n totalRows,\n\n fetchMoreData,\n\n table.getState().columnVisibility,\n\n table.getState().rowSelection,\n table.getState().columnPinning,\n ]\n );\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: rows\n const rowsValue = useMemo<TTableRowsContext<TData>>(\n () => ({\n rowsLength: rows.length,\n rows,\n }),\n [rows, table.getState().rowSelection, table.getState().columnPinning, table.getState().columnSizing]\n );\n\n return (\n <TableContext.Provider value={value as TTableContext<unknown>}>\n <TableRowsContext.Provider value={rowsValue as TTableRowsContext<unknown>}>{children}</TableRowsContext.Provider>\n </TableContext.Provider>\n );\n};\n","import { ArrowRightIcon, CirclePlus, DownloadIcon, RefreshCwIcon, SearchIcon } from 'lucide-react';\n\nimport { Input } from '@/components/ui/input';\n\nimport { useUITableContext } from '../../hooks/use-table-context';\n\nexport const UITableTooltipFilter: React.FC<React.ComponentProps<typeof Input>> = ({ className: _, ...props }) => {\n return (\n <div className=\"relative\">\n <Input {...props} size=\"lg\" type=\"search\" placeholder=\"Search records...\" className=\"ps-9 pe-9\" />\n <div className=\"pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-text-positive-weak peer-disabled:opacity-50\">\n <SearchIcon size={16} />\n </div>\n <button\n className=\"absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:z-10 focus-visible:border focus-visible:border-primary-strong focus-visible:ring-[3px] focus-visible:ring-primary-weak disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Submit search\"\n type=\"submit\"\n >\n <ArrowRightIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n );\n};\n\nconst ActionButton: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <button className=\"flex cursor-pointer items-center gap-x-1 rounded-sm border border-border bg-background p-2.5 text-sm text-text-positive-weak outline-none transition-all hover:shadow-card focus:border-border-emphasis focus:bg-muted-muted active:border-border-emphasis active:bg-muted-muted active:text-text-positive [&_svg]:size-3.5\">\n {children}\n </button>\n );\n};\n\nexport const UITableTooltipActions: React.FC = () => {\n return (\n <div className=\"flex [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none\">\n <ActionButton>\n <CirclePlus />\n </ActionButton>\n <ActionButton>\n <RefreshCwIcon />\n </ActionButton>\n <ActionButton>\n <DownloadIcon />\n </ActionButton>\n </div>\n );\n};\n\nexport const UITableTooltip: React.FC<React.PropsWithChildren> = ({ children }) => {\n const { title } = useUITableContext();\n return (\n <div data-slot=\"table-tooltip\" className=\"relative m-0 flex w-full flex-0 flex-col flex-wrap items-start space-y-2 p-0 px-2 text-sm\">\n <h3 className=\"font-semibold text-base text-text-positive\">{title}</h3>\n <div className=\"flex w-full flex-1 justify-between\">{children}</div>\n </div>\n );\n};\nUITableTooltip.displayName = 'TableTooltip';\n"],"mappings":"k1CAQA,MAAaA,GAAkD,CAAE,UAE7D,EAACC,EAAAA,CAAAA,SAAAA,CACC,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAAU,QAAQ,KAAK,UAAU,mEAC/B,GACS,CAAA,CACG,CACjB,EAAC,EAAA,CAAe,MAAM,QAAQ,UAAU,6DACrC,GACc,CAAA,CAAA,CACT,CCjBDC,IAAmF,CAAE,WAE9F,EAACC,EAAAA,CAAAA,SAAAA,CACC,EAAC,EAAA,CAAe,QAAA,YACd,EAAC,IAAA,CAAE,UAAU,sEAA8D,EAAM,QAAQ,wBAAyB,aAAa,EAAK,EACrH,CACjB,EAAC,EAAA,CAAe,MAAM,iBACpB,EAAC,IAAA,CAAE,UAAU,wBAAgB,EAAM,MAAM,EAAE,CAAC,QAAQ,wBAAyB,wBAAwB,EAAK,EAC3F,CAAA,CAAA,CACT,CCIDC,IAA2C,CAAE,OAAM,WAAU,WAEtE,EAAC,EAAA,CAAK,KAAM,GAAO,IAAI,KAAK,QAAQ,iBAClC,EAACC,EAAAA,CAAO,UAAU,+BAChB,EAAC,EAAA,CAAe,MAAO,CAAE,gBAAiB,EAAe,IAAI,EAAK,CAAE,UAClE,EAAC,GAAA,CAAc,KAAM,GAAI,UAAU,cAAe,EACnC,EACV,CACT,EAAC,EAAA,CAAK,SAAA,GAAS,QAAQ,OAAO,IAAI,OAAO,MAAM,kBAC7C,EAAC,EAAA,CAAU,UAAU,kDAA0C,GAAqB,CACpF,EAAC,EAAA,CAAU,QAAQ,KAAK,UAAU,iDAC/B,GACS,CAAA,EACP,CAAA,EACF,CCrBX,SAASC,EAAS,CAAE,YAAW,GAAG,GAA8D,CAC9F,OACE,EAACC,EAAkB,KAAA,CACjB,YAAU,WACV,UAAW,EACT,qBACA,yFACA,kCACA,iDACA,sCACA,sCACA,kCACA,uBACA,gCACA,6BACA,kDACA,EAC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EAAA,CAAM,GAAI,EAAO,KAAK,KAAK,KAAK,SAAS,YAAY,oBAAoB,UAAU,aAAc,CAClG,EAAC,MAAA,CAAI,UAAU,iJACb,EAAC,GAAA,CAAW,KAAM,GAAA,CAAM,EACpB,CACN,EAAC,SAAA,CACC,UAAU,0XACV,aAAW,gBACX,KAAK,kBAEL,EAAC,GAAA,CAAe,KAAM,GAAI,cAAY,QAAS,EACxC,GACL,CAIJC,GAAmD,CAAE,cAEvD,EAAC,SAAA,CAAO,UAAU,8TACf,YACM,CAIAC,OAET,EAAC,MAAA,CAAI,UAAU,iIACb,EAAC,EAAA,CAAA,SACC,EAAC,GAAA,EAAA,CAAa,CAAA,CACD,CACf,EAAC,EAAA,CAAA,SACC,EAAC,GAAA,EAAA,CAAgB,CAAA,CACJ,CACf,EAAC,EAAA,CAAA,SACC,EAAC,GAAA,EAAA,CAAe,CAAA,CACH,GACX,CAIGC,GAAqD,CAAE,cAAe,CACjF,GAAM,CAAE,SAAU,GAAmB,CACrC,OACE,EAAC,MAAA,CAAI,YAAU,gBAAgB,UAAU,sGACvC,EAAC,KAAA,CAAG,UAAU,sDAA8C,GAAW,CACvE,EAAC,MAAA,CAAI,UAAU,qCAAsC,YAAe,CAAA,EAChE,EAGV,EAAe,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["UITableDateDisplay: React.FC<Props>","Tooltip","UITableNameDisplay: React.FC<NameDisplayProps>","Tooltip","UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{ value: string }>>","Tooltip","options: Intl.NumberFormatOptions","UITableUserDataDisplay: React.FC<Props>","Avatar","Checkbox","CheckboxPrimitive","UITableWrapper: React.FC<React.PropsWithChildren<React.ComponentProps<'div'>>>","UITableHeader: React.FC<React.PropsWithChildren>","UITableHeaderRow: React.FC<React.PropsWithChildren>","UITableHeaderCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'th'> & {\n header: Header<unknown, unknown>;\n isPinned: ColumnPinningPosition;\n isResizing: boolean;\n isAllRowsSelected: boolean;\n }\n >\n>","Checkbox","UITableHeaderCellOption: React.FC<{\n isPinned: ColumnPinningPosition;\n className?: string;\n isVisible?: boolean;\n onLeftPin: (pos: 'left' | 'right' | false) => void;\n onRightPin: (pos: 'left' | 'right' | false) => void;\n onUnpin: (pos: 'left' | 'right' | false) => void;\n onToggleVisibilityHandler: (visible: AnyEntity) => void;\n}>","DropdownMenu","UITableBody: React.FC<React.PropsWithChildren<React.ComponentProps<'tbody'> & { height: number }>>","UITableRow: React.FC<\n React.ComponentProps<'tr'> & {\n row: Row<unknown>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n }\n>","UITableCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'td'> & {\n cell: Cell<unknown, unknown>;\n }\n >\n>","EmptyDisplay: React.FC","UITableFooter: React.FC<React.PropsWithChildren>","UITableContainer: React.FC<React.PropsWithChildren>","colSizes: { [key: string]: number | undefined }","ColumnVisibility: React.FC<{\n checked: boolean;\n title: string;\n onCheckedChange?: (checked: boolean) => void;\n}>","Checkbox","Separator","INITIAL_STATE: InitialTableState","UITableTooltipFilter: React.FC<React.ComponentProps<typeof Input>>","ActionButton: React.FC<React.PropsWithChildren>","UITableTooltipActions: React.FC","UITableTooltip: React.FC<React.PropsWithChildren>"],"sources":["../../../packages/components/features/tables/components/atoms/date-display.tsx","../../../packages/components/features/tables/components/atoms/name-display.tsx","../../../packages/components/features/tables/components/atoms/phone-number.tsx","../../../packages/components/features/tables/components/atoms/statistic.tsx","../../../packages/components/features/tables/components/atoms/user.tsx","../../../packages/components/ui/checkbox.tsx","../../../packages/components/features/tables/hooks/use-table-context.ts","../../../packages/components/features/tables/hooks/use-table-rows-context.ts","../../../packages/components/features/tables/components/table.tsx","../../../packages/components/features/tables/components/table/filter.tsx","../../../packages/components/features/tables/components/table/provider.tsx","../../../packages/components/features/tables/components/table/tooltip.tsx"],"sourcesContent":["import { Badge } from '@/components/ui/badge';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { DateDisplay } from '@/components/data-display/date';\n\ntype Props = {\n date: Date | string | number;\n};\nexport const UITableDateDisplay: React.FC<Props> = ({ date }) => {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Badge className=\"h-fit\">\n <DateDisplay date={date} format=\"medium\" className=\"font-normal text-white\" />\n </Badge>\n </TooltipTrigger>\n <TooltipContent>\n <DateDisplay date={date} format=\"full\" showTime className=\"font-[Inter]! font-medium text-xs\" />\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { Paragraph } from '@/components/typography/paragraph';\n\ntype NameDisplayProps = {\n name: string;\n};\n\nexport const UITableNameDisplay: React.FC<NameDisplayProps> = ({ name }) => {\n return (\n <Tooltip>\n <TooltipTrigger>\n <Paragraph variant=\"sm\" className=\"line-clamp-2 w-full truncate text-wrap pb-px text-start\">\n {name}\n </Paragraph>\n </TooltipTrigger>\n <TooltipContent align=\"start\" className=\"max-w-80 whitespace-pre-line text-wrap break-keep\">\n {name}\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nexport const UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{ value: string }>> = ({ value }) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <p className=\"font-number text-secondary-foreground text-sm tabular-nums\">{value.replace(/(\\d{3})(\\d{3})(\\d{4})/, '($1) $2-$3')}</p>\n </TooltipTrigger>\n <TooltipContent align=\"start\">\n <p className=\"tabular-nums\">{value.slice(1).replace(/(\\d{2})(\\d{3})(\\d{4})/, '(00) (+84) ($1) $2-$3')}</p>\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { memo, useCallback, useMemo } from 'react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Flex } from '@/components/layouts/flex';\n\ntype Props = {\n decimalSeparator?: string;\n groupSeparator?: string;\n prefix?: React.ReactNode;\n suffix?: React.ReactNode;\n precision?: number; // Số chữ số thập phân\n roundingMode?: 'round' | 'floor' | 'ceil'; // Kiểu làm tròn\n showTrailingZeros?: boolean; // Hiển thị số 0 cuối\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; // Kích thước của component\n value: number | string;\n};\nexport const UITableStatisticDisplay = memo(\n ({\n decimalSeparator = '.',\n groupSeparator = ',',\n prefix: Prefix,\n suffix: Suffix,\n precision,\n roundingMode = 'round',\n showTrailingZeros = false,\n size = 'lg',\n value,\n }: Props) => {\n // Memoize rounding function\n const applyRounding = useCallback(\n (num: number, precisionValue: number): number => {\n const multiplier = 10 ** precisionValue;\n\n switch (roundingMode) {\n case 'floor':\n return Math.floor(num * multiplier) / multiplier;\n case 'ceil':\n return Math.ceil(num * multiplier) / multiplier;\n default:\n return Math.round(num * multiplier) / multiplier;\n }\n },\n [roundingMode]\n );\n\n // Memoize number formatting options\n const formatOptions = useMemo((): Intl.NumberFormatOptions => {\n const options: Intl.NumberFormatOptions = {};\n\n if (typeof precision === 'number' && precision >= 0) {\n if (showTrailingZeros) {\n options.minimumFractionDigits = precision;\n options.maximumFractionDigits = precision;\n } else {\n options.maximumFractionDigits = precision;\n }\n }\n\n return options;\n }, [precision, showTrailingZeros]);\n\n const formatNumber = useCallback(\n (num: number): string => {\n let processedNum = num;\n\n // Áp dụng làm tròn nếu có precision\n if (typeof precision === 'number' && precision >= 0) {\n processedNum = applyRounding(num, precision);\n }\n\n return processedNum.toLocaleString('en-US', formatOptions);\n },\n [applyRounding, formatOptions, precision]\n );\n\n // Memoize value processing\n const processedValue = useMemo((): string => {\n // Xử lý giá trị number\n if (typeof value === 'number') {\n if (Number.isNaN(value) || !Number.isFinite(value)) {\n return 'N/A';\n }\n return formatNumber(value);\n }\n\n // Xử lý giá trị string\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n\n // Nếu là chuỗi rỗng\n if (!trimmedValue) {\n return 'N/A';\n }\n\n // Thử convert sang number\n const numValue = Number(trimmedValue);\n\n if (Number.isNaN(numValue) || !Number.isFinite(numValue)) {\n // Nếu không phải số, trả về string gốc\n return 'N/A';\n }\n\n return formatNumber(numValue);\n }\n\n return 'N/A';\n }, [value, formatNumber]);\n\n // Memoize separator replacement\n const finalFormattedValue = useMemo((): string => {\n // Chỉ thay thế separators nếu khác mặc định\n if (decimalSeparator === '.' && groupSeparator === ',') {\n return processedValue;\n }\n return processedValue.replace(/,/g, groupSeparator).replace(/\\./g, decimalSeparator);\n }, [processedValue, decimalSeparator, groupSeparator]);\n\n return (\n <Flex\n padding=\"none\"\n className={cn(\n 'font-number text-lg text-secondary-foreground tabular-nums',\n size === 'xs' && 'text-xs',\n size === 'sm' && 'text-sm',\n size === 'md' && 'text-base',\n size === 'lg' && 'text-lg',\n size === 'xl' && 'text-xl'\n )}\n >\n {Prefix}\n <p>{finalFormattedValue}</p>\n {Suffix}\n </Flex>\n );\n }\n);\nUITableStatisticDisplay.displayName = 'UITableStatisticDisplay';\n","import { UserRoundIcon } from 'lucide-react';\n\nimport { colorHashLight } from '@customafk/react-toolkit/color-hash';\n\nimport { Avatar, AvatarFallback } from '@/components/ui/avatar';\n\nimport { Flex } from '@/components/layouts/flex';\nimport { Paragraph } from '@/components/typography/paragraph';\n\ntype Props = {\n uuid: string;\n username: string;\n email: string;\n};\n\nexport const UITableUserDataDisplay: React.FC<Props> = ({ uuid, username, email }) => {\n return (\n <Flex wrap={false} gap=\"sm\" padding=\"none\">\n <Avatar className=\"size-10 shadow-card\">\n <AvatarFallback style={{ backgroundColor: colorHashLight.hex(uuid) }}>\n <UserRoundIcon size={28} className=\"text-white\" />\n </AvatarFallback>\n </Avatar>\n <Flex vertical padding=\"none\" gap=\"none\" align=\"start\">\n <Paragraph className=\"font-medium text-sm text-text-positive\">{username}</Paragraph>\n <Paragraph variant=\"sm\" className=\"mt-0! text-text-positive-weak text-xs\">\n {email}\n </Paragraph>\n </Flex>\n </Flex>\n );\n};\n","'use client';\n\nimport { CheckIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\n\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n 'peer border-border',\n 'size-4 shrink-0 cursor-pointer rounded border shadow-xs outline-none transition-shadow',\n 'data-[state=checked]:bg-primary',\n 'data-[state=checked]:text-text-negative-strong',\n 'data-[state=checked]:border-primary',\n 'focus-visible:border-primary-strong',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-3',\n 'aria-invalid:ring-danger-weak',\n 'aria-invalid:border-danger',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"flex items-center justify-center text-current transition-none\">\n <CheckIcon size={14} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\nexport { Checkbox };\n","import { createContext, use } from 'react';\n\nimport type { RowData } from '@tanstack/react-table';\n\nimport type { TTableContext } from '../types';\n\nexport const TableContext = createContext<TTableContext<RowData> | null>(null);\n\nexport const useUITableContext = <TData extends RowData>() => {\n const context = use(TableContext) as TTableContext<TData>;\n if (!context) {\n throw new Error('useTableContext must be used within a TableProvider');\n }\n return context;\n};\n","import { createContext, use } from 'react';\n\nimport type { Row, RowData } from '@tanstack/react-table';\n\nexport type TTableRowsContext<TData extends RowData> = {\n rowsLength: number;\n rows: Row<TData>[];\n};\n\nexport const TableRowsContext = createContext<TTableRowsContext<RowData> | null>(null);\nexport const useUITableRowsContext = <TData extends RowData>() => {\n const ctx = use(TableRowsContext) as TTableRowsContext<TData>;\n if (!ctx) {\n throw new Error('useTableRowContext must be used within a TableRowProvider');\n }\n return ctx;\n};\n","'use client';\nimport { Activity, memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { type Cell, type Column, type ColumnPinningPosition, flexRender, type Header, type Row } from '@tanstack/react-table';\nimport { useVirtualizer, type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';\n\nimport { BoxIcon, EllipsisVerticalIcon, EyeOffIcon, MoveLeftIcon, MoveRightIcon, PinOffIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Checkbox } from '@/components/ui/checkbox';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuTrigger,\n} from '@/components/ui/dropdown-menu';\nimport { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable';\n\nimport type { ImperativePanelGroupHandle } from 'react-resizable-panels';\nimport type { AnyEntity } from '@/types';\nimport { useUITableContext } from '../hooks/use-table-context';\nimport { useUITableRowsContext } from '../hooks/use-table-rows-context';\n\nconst SELECT_WIDTH = 60;\nconst TABLE_HEADER_Z_INDEX = 20;\nconst PINNED_COLUMN_Z_INDEX = 20;\n\n//These are the important styles to make sticky column pinning work!\n//Apply styles like this using your CSS strategy of choice with this kind of logic to head cells, data cells, footer cells, etc.\n//View the index.css file for more needed styles such as border-collapse: separate\nconst getCommonPinningStyles = (column: Column<unknown>): React.CSSProperties => {\n const isPinned = column.getIsPinned();\n return {\n zIndex: isPinned ? PINNED_COLUMN_Z_INDEX : undefined,\n left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,\n right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,\n position: isPinned ? 'sticky' : 'relative',\n };\n};\n\nexport const UITableWrapper: React.FC<React.PropsWithChildren<React.ComponentProps<'div'>>> = ({ className, children, ...props }) => {\n return (\n <div data-slot=\"table-wrapper\" className=\"relative m-0 flex size-full flex-col flex-nowrap items-start justify-start gap-2 py-2.5 text-sm\" {...props}>\n {children}\n </div>\n );\n};\n\nconst UITableHeader: React.FC<React.PropsWithChildren> = memo(({ children }) => {\n return (\n <thead\n data-slot=\"table-header\"\n style={{ zIndex: TABLE_HEADER_Z_INDEX }}\n className={cn(\n 'sticky top-0 grid bg-muted-bg-subtle text-sm text-text-positive',\n '[&_tr:not(:last-child)_td]:border-b',\n '[&_th]:flex',\n '[&_th]:h-10',\n '[&_th]:select-none',\n '[&_th]:items-center',\n '[&_th]:whitespace-nowrap',\n '[&_th]:border-border',\n '[&_th]:font-normal',\n '[&_th]:border-r',\n '[&_th]:border-b-border',\n '[&_th]:text-left',\n '[&_th]:align-middle',\n '[&_th]:last:border-r-0',\n '[&_th]:first:border-l-0',\n '[&_th]:data-[pinned=right]:border-l',\n '[&_th]:data-[pinned=right]:border-r-0',\n '[&_th]:data-[pinned=left]:border-r',\n '[&_tr_th:not([data-pinned=false])]:bg-muted-bg-subtle'\n )}\n >\n {children}\n </thead>\n );\n});\nUITableHeader.displayName = 'TableHeader';\n\nconst UITableHeaderRow: React.FC<React.PropsWithChildren> = memo(({ children }) => {\n return (\n <tr data-slot=\"table-header-row\" className=\"flex w-full border-border border-b shadow\">\n {children}\n </tr>\n );\n});\nUITableHeaderRow.displayName = 'TableHeaderRow';\n\nconst UITableHeaderCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'th'> & {\n header: Header<unknown, unknown>;\n isPinned: ColumnPinningPosition;\n isResizing: boolean;\n isAllRowsSelected: boolean;\n }\n >\n> = ({ header, isPinned, isResizing, isAllRowsSelected, children, ...props }) => {\n const style = getCommonPinningStyles(header.column);\n const width = `calc(var(--header-${header.id}-size) * 1px)`;\n\n if (header.id === 'select') {\n return (\n <th data-slot=\"table-header-cell\" style={{ ...style, width: SELECT_WIDTH }} className=\"relative\" {...props}>\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Checkbox\n aria-label=\"Select All Rows\"\n checked={isAllRowsSelected}\n onCheckedChange={value => {\n header.getContext().table.toggleAllRowsSelected(!!value);\n }}\n />\n </div>\n </th>\n );\n }\n return (\n <th data-slot=\"table-header-cell\" data-pinned={isPinned} style={{ ...style, width }} colSpan={header.colSpan} className={cn('group relative')} {...props}>\n <div className=\"absolute inset-0 gap-1 truncate\">\n <div className=\"flex h-full flex-1 cursor-pointer select-none items-center justify-between\">\n <div className=\"flex size-full flex-1 items-center truncate pl-4\">{flexRender(header.column.columnDef.header, header.getContext())}</div>\n </div>\n </div>\n {!['select', 'actions'].includes(header.id) && (\n <UITableHeaderCellOption\n isPinned={isPinned}\n isVisible={header.column.getIsVisible()}\n className=\"invisible absolute right-2 z-10 group-hover:visible\"\n onLeftPin={header.column.pin}\n onRightPin={header.column.pin}\n onUnpin={header.column.pin}\n onToggleVisibilityHandler={header.column.toggleVisibility}\n />\n )}\n <Activity mode={isPinned ? 'hidden' : 'visible'}>\n <div\n onDoubleClick={header.column.resetSize}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n className={cn('absolute inset-y-0 -right-0.5 w-1 cursor-e-resize bg-transparent hover:bg-border', isResizing && 'bg-border')}\n />\n </Activity>\n </th>\n );\n};\n\nconst UITableHeaderCellOption: React.FC<{\n isPinned: ColumnPinningPosition;\n className?: string;\n isVisible?: boolean;\n onLeftPin: (pos: 'left' | 'right' | false) => void;\n onRightPin: (pos: 'left' | 'right' | false) => void;\n onUnpin: (pos: 'left' | 'right' | false) => void;\n onToggleVisibilityHandler: (visible: AnyEntity) => void;\n}> = ({ isPinned, className, onLeftPin, onRightPin, onUnpin, onToggleVisibilityHandler }) => {\n const handleLeftPin = useCallback(() => {\n onLeftPin('left');\n }, [onLeftPin]);\n\n const handleRightPin = useCallback(() => {\n onRightPin('right');\n }, [onRightPin]);\n\n const handleUnpin = useCallback(() => {\n onUnpin(false);\n }, [onUnpin]);\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n className={cn('cursor-pointer rounded-full p-0.5 text-text-positive-weak hover:bg-muted-muted hover:text-text-positive [&>svg]:size-4', className)}\n >\n <EllipsisVerticalIcon />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"w-64 p-4\">\n <DropdownMenuGroup className=\"*:data-[slot=dropdown-menu-item]:rounded-xs *:data-[slot=dropdown-menu-item]:p-2\">\n <Activity mode={isPinned ? 'visible' : 'hidden'}>\n <DropdownMenuItem onClick={handleUnpin}>\n {!!isPinned && 'Unpin'}\n <DropdownMenuShortcut>\n <PinOffIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n </Activity>\n <Activity mode={!isPinned ? 'visible' : 'hidden'}>\n <DropdownMenuItem onClick={handleLeftPin}>\n {isPinned ? 'Unpin' : 'Pin to Left'}\n <DropdownMenuShortcut>\n <MoveLeftIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n <DropdownMenuItem onClick={handleRightPin}>\n {isPinned ? 'Unpin' : 'Pin to Right'}\n <DropdownMenuShortcut>\n <MoveRightIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n </Activity>\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n <DropdownMenuGroup className=\"*:data-[slot=dropdown-menu-item]:rounded-xs *:data-[slot=dropdown-menu-item]:p-2\">\n <DropdownMenuItem onClick={() => onToggleVisibilityHandler(false)}>\n Hide Field\n <DropdownMenuShortcut>\n <EyeOffIcon className=\"size-4\" />\n </DropdownMenuShortcut>\n </DropdownMenuItem>\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\nconst UITableBody: React.FC<React.PropsWithChildren<React.ComponentProps<'tbody'> & { height: number }>> = ({ height, children, ...props }) => {\n return (\n <tbody\n data-slot=\"table-body\"\n style={{ height: `${height}px` }}\n className={cn(\n 'relative grid w-full',\n '[&_tr]:absolute [&_tr]:flex [&_tr]:w-full [&_tr]:cursor-pointer [&_tr]:border-b [&_tr]:border-b-border [&_tr]:focus:outline-none',\n '[&_td]:z-10',\n '[&_td]:flex',\n '[&_td]:overflow-hidden',\n '[&_td]:whitespace-nowrap',\n '[&_td]:px-4',\n '[&_td]:py-2.5',\n '[&_td]:align-middle',\n '[&_td]:border-border',\n '[&_td]:data-[pinned=right]:border-l',\n '[&_td]:data-[pinned=left]:border-r',\n '[&_td:not([data-pinned=false])]:bg-card',\n '[&_td:not([data-pinned=false])]:shadow-xs'\n )}\n {...props}\n >\n {children}\n </tbody>\n );\n};\n\nconst UITableRow: React.FC<\n React.ComponentProps<'tr'> & {\n row: Row<unknown>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n }\n> = memo(({ children, row, virtualRow, rowVirtualizer, className, ...props }) => {\n const { columnPinning: _ } = useUITableContext();\n return (\n <tr\n data-slot=\"table-row\"\n data-index={virtualRow.index}\n ref={node => rowVirtualizer.measureElement(node)}\n style={{\n transform: `translateY(${virtualRow.start}px)`,\n }}\n className={cn('group', className)}\n {...props}\n >\n {row.getVisibleCells().map(cell => {\n return <UITableCell key={cell.id} cell={cell} className=\"group-hover:bg-muted-bg-subtle!\" />;\n })}\n </tr>\n );\n});\nUITableRow.displayName = 'TableRow';\n\nconst UITableCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'td'> & {\n cell: Cell<unknown, unknown>;\n }\n >\n> = memo(({ cell, children, className, ...props }) => {\n const { rowSelection: _ } = useUITableContext();\n const isPinned = cell.column.getIsPinned();\n const style = getCommonPinningStyles(cell.column);\n const width = `calc(var(--col-${cell.column.id}-size) * 1px)`;\n if (isPinned) {\n console.log('Pinned Cell Rendered:', cell.column.getPinnedIndex());\n }\n\n if (cell.column.id === 'select') {\n return (\n <td data-slot=\"table-cell\" style={{ ...style, width: SELECT_WIDTH }} className={cn('border-none! bg-transparent! shadow-none!', className)} {...props}>\n <div className=\"absolute inset-0 flex items-center justify-center bg-transparent\">\n <Checkbox\n aria-label=\"Select Row\"\n checked={cell.row.getIsSelected()}\n onCheckedChange={value => {\n cell.row.toggleSelected(!!value);\n }}\n />\n </div>\n </td>\n );\n }\n\n return (\n <td\n data-slot=\"table-cell\"\n data-pinned={isPinned}\n style={{ ...style, width }}\n className={cn(isPinned && cell.column.getPinnedIndex() === 0 && 'shadow!', className)}\n {...props}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </td>\n );\n});\nUITableCell.displayName = 'TableCell';\n\nconst EmptyDisplay: React.FC = () => {\n return (\n <div className=\"sticky left-0 flex flex-1 items-center justify-center bg-transparent text-text-positive-weak opacity-100\">\n <div className=\"flex flex-col items-center gap-1\">\n <BoxIcon strokeWidth={1} size={48} />\n <p>No data available</p>\n </div>\n </div>\n );\n};\n\nexport const UITableFooter: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <tfoot data-slot=\"table-footer\" className=\"flex w-full justify-center border-border-weak border-t py-2 font-medium [&>tr]:last:border-b-0\">\n {children}\n </tfoot>\n );\n};\n\nexport const UITableContainer: React.FC<React.PropsWithChildren> = ({ children }) => {\n const { table, isEmpty, isFetching, totalRows, fetchMoreData } = useUITableContext();\n const { rows, rowsLength } = useUITableRowsContext();\n\n const tableContainerRef = useRef<ImperativePanelGroupHandle | null>(null);\n const tableRef = useRef<HTMLTableElement | null>(null);\n\n /**\n * Instead of calling `column.getSize()` on every render for every header\n * and especially every data cell (very expensive),\n * we will calculate all column sizes at once at the root table level in a useMemo\n * and pass the column sizes down as CSS variables to the <table> element.\n */\n // biome-ignore lint/correctness/useExhaustiveDependencies: <table> element.\n const columnSizeVars = useMemo(() => {\n const headers = table.getFlatHeaders();\n const colSizes: { [key: string]: number | undefined } = {};\n headers.forEach(header => {\n colSizes[`--header-${header.id}-size`] = header.getSize() || 0;\n colSizes[`--col-${header.column.id}-size`] = header.column.getSize() || 0;\n });\n return colSizes;\n }, [table.getState().columnSizingInfo, table.getState().columnSizing]);\n\n // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.\n const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n count: rowsLength,\n getScrollElement: () => tableRef.current,\n estimateSize: () => 40, // estimated row height\n measureElement: element => element?.getBoundingClientRect().height,\n overscan: 2, // Render additional rows beyond viewport for smoother scrolling\n });\n\n //called on scroll and possibly on mount to fetch more data as the user scrolls and reaches bottom of table\n const fetchMoreOnButtonReached = useCallback(\n async (containerRefEl?: HTMLTableElement | null) => {\n if (!containerRefEl) return null;\n const { scrollHeight, scrollTop, clientHeight } = containerRefEl;\n //once the user has scrolled within 500px of the bottom of the table, fetch more data if we can\n if (scrollHeight - scrollTop - clientHeight < 500 && !isFetching && totalRows && rowsLength < totalRows) {\n await fetchMoreData?.();\n }\n },\n [isFetching, rowsLength, totalRows, fetchMoreData]\n );\n\n //a check on mount and after a fetch to see if the table is already scrolled to the bottom and immediately needs to fetch more data\n useEffect(() => {\n fetchMoreOnButtonReached(tableRef.current);\n }, [fetchMoreOnButtonReached]);\n\n return (\n <ResizablePanelGroup\n ref={tableContainerRef}\n direction=\"horizontal\"\n style={{ direction: table.options.columnResizeDirection }}\n className=\"relative flex w-full max-w-full flex-1 gap-1 overflow-auto border-t border-t-border bg-slate-50 p-0 text-sm\"\n >\n <ResizablePanel className=\"overflow-auto\">\n <table\n ref={tableRef}\n data-slot=\"table\"\n style={{\n ...columnSizeVars,\n width: table.getTotalSize(),\n }}\n className=\"grid size-full max-w-full caption-bottom border-collapse border-spacing-0 flex-col content-start overflow-auto bg-card text-sm tabular-nums [&_tfoot_td]:border-t\"\n >\n <UITableHeader>\n {table.getHeaderGroups().map(headerGroup => (\n <UITableHeaderRow key={headerGroup.id}>\n {headerGroup.headers.map(header => (\n <UITableHeaderCell\n key={header.id}\n header={header}\n isPinned={header.column.getIsPinned()}\n isResizing={header.column.getIsResizing()}\n isAllRowsSelected={table.getIsAllRowsSelected()}\n />\n ))}\n </UITableHeaderRow>\n ))}\n </UITableHeader>\n <UITableBody data-slot=\"table-body\" height={rowVirtualizer.getTotalSize()}>\n {rowVirtualizer.getVirtualItems().map(virtualRow => {\n const row = rows[virtualRow.index] as Row<AnyEntity>;\n return <UITableRow key={row.id} data-index={virtualRow.index} row={row} virtualRow={virtualRow} rowVirtualizer={rowVirtualizer} />;\n })}\n </UITableBody>\n </table>\n {isEmpty && <EmptyDisplay />}\n </ResizablePanel>\n <ResizableHandle />\n {children}\n </ResizablePanelGroup>\n );\n};\n","import { Activity, useState } from 'react';\n\nimport { Columns4Icon, ListFilterIcon, ListFilterPlus } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { ResizablePanel } from '@/components/ui/resizable';\nimport { Separator } from '@/components/ui/separator';\n\nimport { useUITableContext } from '../../hooks/use-table-context';\n\nconst ColumnVisibility: React.FC<{\n checked: boolean;\n title: string;\n onCheckedChange?: (checked: boolean) => void;\n}> = ({ checked, title, onCheckedChange }) => {\n return (\n <div className=\"flex h-fit items-center gap-2\">\n <Checkbox checked={checked} onCheckedChange={onCheckedChange} />\n <p className=\"text-sm\">{title}</p>\n </div>\n );\n};\n\nexport const UITableFilter = () => {\n const { table } = useUITableContext();\n const [tab, setTab] = useState<'columns' | 'filters' | null>(null);\n\n return (\n <ResizablePanel defaultSize={25} className={cn('bg-card', tab === null ? 'max-w-8!' : 'min-w-64')}>\n <div className=\"relative z-20 flex size-full bg-muted-bg-subtle\">\n <div className=\"flex-1\">\n <Activity mode={tab === 'columns' ? 'visible' : 'hidden'}>\n <div className=\"flex size-full flex-col gap-2 p-4\">\n <p className=\"px-2 font-medium\">Columns Visibility</p>\n <Separator />\n <div className=\"flex flex-col gap-4 pt-4\">\n {table.getAllColumns().map(column => {\n if (['select', 'actions'].includes(column.id)) return null;\n return (\n <ColumnVisibility\n key={column.id}\n checked={column.getIsVisible()}\n title={String(column.columnDef.header)}\n onCheckedChange={value => column.toggleVisibility(!!value)}\n />\n );\n })}\n </div>\n </div>\n </Activity>\n <Activity mode={tab === 'filters' ? 'visible' : 'hidden'}>\n <div className=\"flex size-full flex-col p-2\">\n <Button variant=\"outline\" color=\"muted\">\n <ListFilterPlus />\n Add Filter\n </Button>\n </div>\n </Activity>\n </div>\n <div className=\"flex h-full flex-col border-border border-l bg-muted-bg-subtle text-sm\">\n <button\n className={cn('flex h-32 cursor-pointer flex-col items-center gap-y-2 p-2 py-4', tab === 'columns' && 'bg-card')}\n onClick={() => setTab(tab === 'columns' ? null : 'columns')}\n >\n <Columns4Icon size={18} />\n <span className=\"text-nowrap [writing-mode:vertical-lr]\">Columns</span>\n </button>\n <Separator />\n <button\n className={cn('flex h-32 cursor-pointer flex-col items-center gap-y-2 p-2 py-4', tab === 'filters' && 'bg-card')}\n onClick={() => setTab(tab === 'filters' ? null : 'filters')}\n >\n <ListFilterIcon size={18} />\n <span className=\"text-nowrap [writing-mode:vertical-lr]\">Filters</span>\n </button>\n <Separator />\n </div>\n </div>\n </ResizablePanel>\n );\n};\n","import { useMemo, useState } from 'react';\n\nimport type { ColumnPinningState, InitialTableState, RowData, RowSelectionState, VisibilityState } from '@tanstack/react-table';\nimport { getCoreRowModel, useReactTable } from '@tanstack/react-table';\n\nimport { TableContext } from '../../hooks/use-table-context';\nimport { TableRowsContext, type TTableRowsContext } from '../../hooks/use-table-rows-context';\nimport type { TableProviderProps, TTableContext } from '../../types';\n\nconst INITIAL_STATE: InitialTableState = {\n columnPinning: { right: ['actions'] },\n};\n\nexport const UITableProvider = <TData extends RowData>({\n title,\n isFetching = false,\n data,\n columns,\n totalRows,\n\n fetchMoreData,\n children,\n}: React.PropsWithChildren<TableProviderProps<TData>>) => {\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({ right: ['actions'] });\n const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});\n\n const table = useReactTable<TData>({\n initialState: INITIAL_STATE,\n data: data,\n columns,\n state: {\n rowSelection,\n columnPinning,\n columnVisibility,\n },\n defaultColumn: {\n minSize: 40,\n size: 150,\n maxSize: 800,\n },\n columnResizeMode: 'onChange',\n columnResizeDirection: 'ltr',\n\n enableRowSelection: true,\n enableColumnResizing: true,\n enableMultiRowSelection: true,\n\n getCoreRowModel: getCoreRowModel(),\n\n onRowSelectionChange: setRowSelection,\n onColumnPinningChange: setColumnPinning,\n onColumnVisibilityChange: setColumnVisibility,\n });\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: rows\n const rows = useMemo(() => {\n return table.getRowModel().rows;\n }, [data, table.getState().columnPinning]);\n\n const isEmpty = useMemo<boolean>(() => {\n return !isFetching && table.getRowModel().rows.length === 0;\n }, [table, isFetching]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: table get state\n const value = useMemo<TTableContext<TData>>(\n () => ({\n table,\n title,\n isEmpty,\n isFetching,\n\n totalRows,\n\n rowSelection: table.getState().rowSelection,\n\n columnPinning: table.getState().columnPinning,\n\n fetchMoreData,\n }),\n [\n table,\n title,\n\n isEmpty,\n isFetching,\n\n totalRows,\n\n fetchMoreData,\n\n table.getState().columnVisibility,\n\n table.getState().rowSelection,\n table.getState().columnPinning,\n ]\n );\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: rows\n const rowsValue = useMemo<TTableRowsContext<TData>>(\n () => ({\n rowsLength: rows.length,\n rows,\n }),\n [rows, table.getState().rowSelection, table.getState().columnPinning, table.getState().columnSizing]\n );\n\n return (\n <TableContext.Provider value={value as TTableContext<unknown>}>\n <TableRowsContext.Provider value={rowsValue as TTableRowsContext<unknown>}>{children}</TableRowsContext.Provider>\n </TableContext.Provider>\n );\n};\n","import { ArrowRightIcon, CirclePlus, DownloadIcon, RefreshCwIcon, SearchIcon } from 'lucide-react';\n\nimport { Input } from '@/components/ui/input';\n\nimport { useUITableContext } from '../../hooks/use-table-context';\n\nexport const UITableTooltipFilter: React.FC<React.ComponentProps<typeof Input>> = ({ className: _, ...props }) => {\n return (\n <div className=\"relative\">\n <Input {...props} size=\"lg\" type=\"search\" placeholder=\"Search records...\" className=\"ps-9 pe-9\" />\n <div className=\"pointer-events-none absolute inset-y-0 start-0 flex items-center justify-center ps-3 text-text-positive-weak peer-disabled:opacity-50\">\n <SearchIcon size={16} />\n </div>\n <button\n className=\"absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:z-10 focus-visible:border focus-visible:border-primary-strong focus-visible:ring-[3px] focus-visible:ring-primary-weak disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n aria-label=\"Submit search\"\n type=\"submit\"\n >\n <ArrowRightIcon size={16} aria-hidden=\"true\" />\n </button>\n </div>\n );\n};\n\nconst ActionButton: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <button className=\"flex cursor-pointer items-center gap-x-1 rounded-sm border border-border bg-background p-2.5 text-sm text-text-positive-weak outline-none transition-all hover:shadow-card focus:border-border-emphasis focus:bg-muted-muted active:border-border-emphasis active:bg-muted-muted active:text-text-positive [&_svg]:size-3.5\">\n {children}\n </button>\n );\n};\n\nexport const UITableTooltipActions: React.FC = () => {\n return (\n <div className=\"flex [&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none\">\n <ActionButton>\n <CirclePlus />\n </ActionButton>\n <ActionButton>\n <RefreshCwIcon />\n </ActionButton>\n <ActionButton>\n <DownloadIcon />\n </ActionButton>\n </div>\n );\n};\n\nexport const UITableTooltip: React.FC<React.PropsWithChildren> = ({ children }) => {\n const { title } = useUITableContext();\n return (\n <div data-slot=\"table-tooltip\" className=\"relative m-0 flex w-full flex-0 flex-col flex-wrap items-start space-y-2 p-0 px-2 text-sm\">\n <h3 className=\"font-semibold text-base text-text-positive\">{title}</h3>\n <div className=\"flex w-full flex-1 justify-between\">{children}</div>\n </div>\n );\n};\nUITableTooltip.displayName = 'TableTooltip';\n"],"mappings":"s7CAQA,MAAaA,GAAuC,CAAE,UAElD,EAAC,EAAA,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AsC,YAAe,CAAA,EAChE,EAGV,EAAe,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`../../chunk-Bmb41Sf3.cjs`),t=require(`../../button.variants-C--cfyfH.cjs`),n=require(`../../button-DtFiUaY7.cjs`),r=require(`../../close-CXhpIVAZ.cjs`),i=require(`../../separator-D3CGKwyf.cjs`);let a=require(`@customafk/react-toolkit/utils`),o=require(`react/jsx-runtime`),s=require(`lucide-react`),c=require(`react`),l=require(`class-variance-authority`),u=require(`@customafk/react-toolkit/date-fns`),d=require(`radix-ui`),f=require(`@tanstack/react-form`),p=require(`react-day-picker`);function m({className:e,...t}){return(0,o.jsx)(d.Checkbox.Root,{"data-slot":`checkbox`,className:(0,a.cn)(`peer border-border`,`size-4 shrink-0 cursor-pointer rounded border shadow-xs outline-none transition-all`,`disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-primary-strong`,`focus-visible:ring-3`,`focus-visible:ring-primary-weak`,`aria-invalid:border-danger aria-invalid:ring-danger-weak`,`aria-readonly:bg-muted-muted`,`aria-readonly:pointer-events-none`,`data-[state=checked]:aria-readonly:bg-muted-muted`,`data-[state=checked]:aria-readonly:border-border`,`data-[state=checked]:aria-readonly:text-text-positive-strong`,`data-[state=checked]:bg-primary`,`data-[state=checked]:border-primary-strong`,`data-[state=checked]:text-text-negative-strong`,e),...t,children:(0,o.jsx)(d.Checkbox.Indicator,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,o.jsx)(s.CheckIcon,{size:14})})})}const h=(0,l.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`}}),g=({label:e,color:t,size:n,className:r,children:i})=>(0,o.jsx)(`div`,{"data-slot":`required-indicator`,className:h({color:t,size:n,className:r}),children:e||i});function _({className:e,children:t,...n}){return(0,o.jsxs)(d.Label.Root,{"data-slot":`label`,className:(0,a.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,o.jsx)(g,{label:`Required`,color:`danger`,size:`sm`,className:`hidden`})]})}const v=(0,l.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`}}),y=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,a.cn)(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));y.displayName=`FieldSet`;const b=(0,c.memo)(({className:e,variant:t=`legend`,...n})=>(0,o.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,a.cn)(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));b.displayName=`FieldLegend`;const x=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-group`,className:(0,a.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}));x.displayName=`FieldGroup`;const S=(0,c.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,o.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,a.cn)(v({orientation:t}),e),...n}));S.displayName=`Field`;const C=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content`,className:(0,a.cn)(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));C.displayName=`FieldContent`;const w=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content-main`,className:(0,a.cn)(`relative`,e),...t})),T=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(_,{"data-slot":`field-label`,className:(0,a.cn)(`group/field-label peer/field-label flex h-6 gap-1 font-normal 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}));T.displayName=`FieldLabel`;const E=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-label`,className:(0,a.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));E.displayName=`FieldTitle`;const D=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`p`,{"data-slot":`field-description`,className:(0,a.cn)(`nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5 font-normal text-sm text-text-positive-weak leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t}));D.displayName=`FieldDescription`;const O=(0,c.memo)(({isShow:e=!0,className:t,...n})=>e===!1?null:(0,o.jsx)(`div`,{"data-slot":`field-note`,className:(0,a.cn)(`text-wrap rounded border border-primary-muted bg-linear-to-b from-primary-bg-subtle to-primary-bg-subtle/50 p-2 text-text-positive-weak text-xs`,t),...n}));O.displayName=`FieldNote`;const k=(0,c.memo)(({children:e,className:t,...n})=>(0,o.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,a.cn)(`-my-2 group-data-[variant=outline]/field-group:-mb-2 relative h-5 text-sm`,t),...n,children:[(0,o.jsx)(i.t,{className:`absolute inset-0 top-1/2`}),e&&(0,o.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));k.displayName=`FieldSeparator`;const A=(0,c.memo)(({className:e,children:t,errors:n,...r})=>{let i=(0,c.useMemo)(()=>t||(n?n?.length===1&&n[0]?.message?(0,o.jsx)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:(0,o.jsx)(`p`,{children:n[0].message})}):(0,o.jsx)(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?(0,o.jsx)(`li`,{children:e},e):e?.message?(0,o.jsx)(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?(0,o.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,a.cn)(`w-full font-semibold text-danger-strong text-xs`,e),...r,children:i}):null});A.displayName=`FieldError`;const j=({label:e,description:t,options:n,helperText:r,orientation:i})=>{let a=Q(),s=(0,f.useStore)(a.form.store,({isSubmitting:e})=>e);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:i,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{children:e}),(0,o.jsx)(D,{children:t}),(0,o.jsx)(O,{isShow:!!r,children:r})]}),(0,o.jsx)(w,{children:(0,o.jsx)(x,{className:`flex flex-col gap-y-2`,children:n.map(e=>(0,o.jsxs)(S,{orientation:`horizontal`,children:[(0,o.jsx)(m,{id:`${a.name}-${e.value}`,name:a.name,checked:a.state.value?.includes(e.value)??!1,disabled:s,onCheckedChange:t=>{if(t&&a.state.value!==null)a.pushValue(e.value);else if(t&&a.state.value===null)a.setValue([e.value]);else if(!t&&a.state.value!==null){let t=a.state.value.indexOf(e.value);t>-1&&a.removeValue(t)}else !t&&a.state.value===null&&a.setValue(null)}}),(0,o.jsx)(T,{htmlFor:`${a.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),(0,o.jsx)(k,{})]})},M=({rootRef:e,className:t,...n})=>(0,o.jsx)(`div`,{"data-slot":`calendar`,ref:e,className:(0,a.cn)(t),...n}),N=e=>e.orientation===`left`?(0,o.jsx)(s.ChevronLeftIcon,{size:16,className:e.className,...e}):e.orientation===`right`?(0,o.jsx)(s.ChevronRightIcon,{size:16,className:e.className,...e}):(0,o.jsx)(s.ChevronDownIcon,{size:16,className:e.className,...e}),P=({className:e,day:t,modifiers:r,color:i,...s})=>{let l=(0,p.getDefaultClassNames)(),u=(0,c.useRef)(null);return(0,c.useEffect)(()=>{r.focused&&u.current?.focus()},[r.focused]),(0,o.jsx)(n.t,{ref:u,variant:`ghost`,color:`muted`,"data-day":t.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:(0,a.cn)(`flex aspect-square size-9 flex-col rounded font-normal text-sm tabular-nums leading-none`,`data-[selected-single=true]:bg-primary`,`data-[selected-single=true]:text-white`,`data-[range-middle=true]:bg-muted-muted`,`data-[range-middle=true]:text-text-positive`,`data-[range-start=true]:bg-primary-muted`,`data-[range-start=true]:text-text-positive-strong`,`data-[range-end=true]:bg-primary`,`data-[range-end=true]:text-text-positive-strong`,`group-data-[focused=true]/day:border-primary-strong`,`group-data-[focused=true]/day:relative`,`group-data-[focused=true]/day:z-10`,`data-[range-end=true]:rounded`,`data-[range-end=true]:rounded-r`,`data-[range-middle=true]:rounded-none`,`data-[range-start=true]:rounded`,`data-[range-start=true]:rounded-l`,`[&>span]:text-xs [&>span]:opacity-70`,l.day,e),...s})},F=({children:e,...t})=>(0,o.jsx)(`td`,{...t,children:(0,o.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})});function I({className:e,classNames:n,showOutsideDays:r=!0,captionLayout:i=`label`,buttonVariant:s=`ghost`,formatters:c,components:l,...u}){let d=(0,p.getDefaultClassNames)();return(0,o.jsx)(p.DayPicker,{showOutsideDays:r,className:(0,a.cn)(`group/calendar bg-background p-3`,`[--cell-size:--spacing(8)]`,`in-data-[slot=card-content]:bg-transparent`,`in-data-[slot=popover-content]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:i,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...c},classNames:{root:(0,a.cn)(d.root),months:(0,a.cn)(`flex gap-4 flex-col md:flex-row relative`,d.months),month:(0,a.cn)(`flex flex-col w-full gap-4`,d.month),nav:(0,a.cn)(`flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between`,d.nav),button_previous:(0,a.cn)(t.n({variant:`outline`,color:`muted`}),`size-(--cell-size) aria-disabled:opacity-50 p-0 select-none`,d.button_previous),button_next:(0,a.cn)(t.n({variant:`outline`,color:`muted`}),`size-(--cell-size) aria-disabled:opacity-50 p-0 select-none`,d.button_next),month_caption:(0,a.cn)(`flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)`,d.month_caption),dropdowns:(0,a.cn)(`w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5`,d.dropdowns),dropdown_root:(0,a.cn)(`relative has-focus:border-primary-strong border border-border-weak shadow-xs has-focus:ring-primary-weak has-focus:ring-[3px] rounded`,d.dropdown_root),dropdown:(0,a.cn)(`absolute inset-0 opacity-0`,d.dropdown),caption_label:(0,a.cn)(`select-none font-medium`,i===`label`&&`text-sm`,i!==`label`&&`rounded shadow-xs px-2 flex items-center gap-0.5 text-sm h-8 [&>svg]:text-text-positive [&>svg]:size-3.5`,d.caption_label),table:`w-full border-collapse`,weekdays:(0,a.cn)(`flex`,d.weekdays),weekday:(0,a.cn)(`text-text-positive rounded flex-1 font-normal text-[0.8rem] select-none`,d.weekday),week:(0,a.cn)(`flex w-full mt-2`,d.week),week_number_header:(0,a.cn)(`select-none w-(--cell-size)`,d.week_number_header),week_number:(0,a.cn)(`text-[0.8rem] select-none text-text-positive`,d.week_number),day:(0,a.cn)(`relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l [&:last-child[data-selected=true]_button]:rounded-r group/day aspect-square select-none`,d.day),range_start:(0,a.cn)(`rounded-l bg-muted-muted`,d.range_start),range_middle:(0,a.cn)(`rounded-none`,d.range_middle),range_end:(0,a.cn)(`rounded-r bg-muted-muted`,d.range_end),today:(0,a.cn)(`bg-muted-muted text-text-positive rounded data-[selected=true]:rounded-none`,d.today),outside:(0,a.cn)(`[&>button]:text-text-positive-muted aria-selected:text-text-positive`),disabled:(0,a.cn)(`bg-muted-muted text-text-positive opacity-50`,d.disabled),hidden:(0,a.cn)(`invisible`,d.hidden),...n},components:{Root:M,Chevron:N,DayButton:P,WeekNumber:F,...l},...u})}function ee({...e}){return(0,o.jsx)(d.Popover.Root,{"data-slot":`popover`,...e})}function te({...e}){return(0,o.jsx)(d.Popover.Trigger,{"data-slot":`popover-trigger`,...e})}function ne({className:e,align:t=`start`,sideOffset:n=4,children:r,...i}){return(0,o.jsx)(d.Popover.Portal,{children:(0,o.jsxs)(d.Popover.Content,{"data-slot":`popover-content`,align:t,sideOffset:n,className:(0,a.cn)(`relative bg-popover`,`text-text-positive`,`z-50`,`min-w-(--radix-popover-trigger-width)`,`max-h-(--radix-popover-content-available-height)`,`origin-(--radix-popover-content-transform-origin)`,`rounded-md p-4 shadow-dropdown outline-none`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-95`,`data-[side=top]:slide-in-from-bottom-8`,`data-[side=right]:slide-in-from-left-8`,`data-[side=bottom]:slide-in-from-top-8`,`data-[side=left]:slide-in-from-right-8`,e),...i,children:[r,(0,o.jsx)(d.Popover.Arrow,{className:`fill-popover`})]})})}const re=({label:e,description:t,placeholder:r,orientation:i,helperText:l,minDate:d,maxDate:f,required:p})=>{let m=Q(),h=(0,c.useMemo)(()=>p?m.state.value===null:!1,[p,m.state.value]),g=(0,c.useMemo)(()=>m.state.meta.isTouched&&!m.state.meta.isValid,[m.state.meta.isTouched,m.state.meta.isValid]);return(0,o.jsxs)(x,{className:`px-4`,children:[(0,o.jsxs)(S,{orientation:i,"data-invalid":g,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:m.name,"aria-required":h,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{className:`flex flex-col space-y-1`,children:[(0,o.jsx)(`div`,{className:`flex w-full flex-col`,children:(0,o.jsxs)(ee,{children:[(0,o.jsx)(te,{asChild:!0,children:(0,o.jsxs)(n.t,{variant:`outline`,color:`muted`,size:`lg`,className:(0,a.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`,m.state.value===null&&`text-text-positive-muted`),children:[(0,o.jsx)(`p`,{children:m.state.value===null?r||`Select date`:(0,u.format)(m.state.value,`PPPP`)}),(0,o.jsx)(s.CalendarDaysIcon,{strokeWidth:1})]})}),(0,o.jsxs)(ne,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:m.handleBlur,children:[(0,o.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,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.endOfToday)())},children:`Today`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.endOfTomorrow)())},children:`Tomorrow`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.endOfYesterday)())},children:`Yesterday`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.subDays)((0,u.endOfToday)(),3))},children:`Last 3 Days`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.subDays)((0,u.endOfToday)(),7))},children:`Last 7 Days`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.subDays)((0,u.endOfToday)(),30))},children:`Last 30 Days`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.startOfMonth)((0,u.endOfToday)()))},children:`This Month`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.lastDayOfMonth)((0,u.endOfToday)()))},children:`Last Month`})]}),(0,o.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,o.jsx)(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:(0,o.jsx)(I,{mode:`single`,selected:m.state.value??void 0,hidden:{before:d??new Date(1900,0,1),after:f??new Date(2100,11,31)},onSelect:e=>{e&&m.handleChange(e)}})})})]})]})}),(0,o.jsx)(O,{isShow:!!l,children:l})]})]}),(0,o.jsx)(k,{})]})},L=({className:e,onChange:t,onValueChange:n,...r})=>{let i=(0,c.useCallback)(e=>{t?.(e),n?.(e.target.value)},[t,n]);return(0,o.jsx)(`input`,{"data-slot":`input`,className:(0,a.cn)(`w-full min-w-0 bg-transparent px-2.5 py-2 transition-[color,box-shadow]`,`rounded text-sm text-text-positive-weak tabular-nums leading-5 shadow-input placeholder:text-text-positive-muted`,`-outline-offset-1 outline-1 outline-border`,`disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-transparent disabled:opacity-50`,`read-only:pointer-events-none read-only:bg-muted-muted read-only:placeholder:text-text-positive-weak`,`focus:text-text-positive focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`aria-invalid:bg-danger-bg-subtle aria-invalid:outline-danger aria-invalid:ring-danger-weak aria-invalid:focus:outline-danger-strong aria-invalid:focus:ring-4 aria-invalid:placeholder:text-text-positive-weak`,e),...r,onChange:i})},ie=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:l=!0,maxLength:u})=>{let{form:d,name:p,state:m,handleBlur:h,handleChange:g}=Q(),_=(0,f.useStore)(d.store,({isSubmitting:e})=>e),v=(0,c.useMemo)(()=>m.meta.isTouched&&!m.meta.isValid,[m.meta.isTouched,m.meta.isValid]),y=(0,c.useCallback)(({target:{value:e}})=>{_||u&&e.length>u||g(e||null)},[_,u,g]),b=(0,c.useCallback)(()=>{_||g(null)},[_,g]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{"data-invalid":v,orientation:r,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:p,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(L,{id:p,name:p,value:m.value===null?``:m.value,"aria-invalid":v,autoComplete:`email`,placeholder:n,className:(0,a.cn)(`pl-9`,_&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:h,onChange:y}),(0,o.jsx)(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:(0,o.jsx)(s.AtSignIcon,{size:14})}),(0,o.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-y-0 end-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong`,onClick:b,children:(0,o.jsx)(s.XIcon,{size:14,"aria-hidden":`true`})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:l&&(0,o.jsx)(A,{errors:m.meta.errors})}),(0,o.jsx)(O,{isShow:!!i,children:i})]})]}),(0,o.jsx)(k,{})]})},ae=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,oe=e=>Number(e).toLocaleString(),se=(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}},ce=({disabled:e=!1,readOnly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:s=null,unitText:l,decimal:u,placeholder:d,precision:f,wrapperClassName:p,className:m,onChange:h,onValueChange:g,onFocus:_,onBlur:v,...y})=>{let b=(0,c.useRef)(null),x=(0,c.useRef)(null),[S,C]=(0,c.useState)(s?.toString()??null),w=(0,c.useMemo)(()=>u?.[1]??r,[u,r]),T=(0,c.useMemo)(()=>u&&u[0]-u[1],[u]),E=(0,c.useMemo)(()=>ae(n),[n]),D=(0,c.useCallback)(e=>{if(!w||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=w&&r<=(T??1/0)},[w,T]),O=(0,c.useCallback)(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=se(parseFloat(e),Math.min(w-1,f||0),i).toString().split(`.`),r=oe(t);return n?`${r}.${n}`:r},[w,f,i]),k=(0,c.useCallback)(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){g?.(0),C(e);return}if(n){C(()=>(g?.(0),e));return}},[g]),A=(0,c.useCallback)(e=>{h?.(e);let{value:t}=e.target;if(t===``||t===void 0){g?.(null),C(null);return}k(t),!(!E.test(t)||!D(t))&&(g?.(parseFloat(t)||0),C(t))},[D,h,g,k,E]),j=(0,c.useCallback)(e=>{t||(_?.(e),C(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,_]),M=(0,c.useCallback)(e=>{t||(v?.(e),C(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?O(e):null))},[t,O,v]);return(0,c.useEffect)(()=>{let e=document.activeElement===x.current;if(s==null||!E.test(s.toString())||!D(s.toString())){C(null);return}C(t=>e?t:O(s.toString()))},[O,s,D,E]),(0,c.useEffect)(()=>{if(!b.current||!x.current||!l)return;let e=b.current.offsetWidth;x.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[l]),(0,o.jsxs)(`div`,{className:(0,a.cn)(`relative`,p),children:[(0,o.jsx)(L,{...y,ref:x,value:S||(t?`0`:``),placeholder:d,disabled:e,readOnly:t,className:(0,a.cn)(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,m),onChange:A,onFocus:j,onBlur:M}),l&&(0,o.jsx)(`span`,{ref:b,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:l})]})},R=({label:e,description:t,placeholder:n,helperText:r,orientation:i,showErrorMessage:l=!0,rounding:u,decimalPlaces:d,percision:p,unit:m,required:h,allowNegative:g})=>{let _=Q(),v=(0,f.useStore)(_.form.store,({isSubmitting:e})=>e),y=(0,c.useMemo)(()=>_.state.meta.errors,[_.state.meta.errors]),b=(0,c.useMemo)(()=>h?_.state.value===null:!1,[h,_.state.value]),E=(0,c.useCallback)(e=>{v||_.handleChange(e)},[v,_.handleChange]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:i,"data-invalid":_.state.meta.isTouched&&!_.state.meta.isValid,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:_.name,"aria-required":b,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsx)(w,{className:`flex justify-end`,children:(0,o.jsxs)(`div`,{className:`relative flex w-full flex-col items-end`,children:[(0,o.jsxs)(`div`,{className:`relative w-full max-w-120`,children:[(0,o.jsx)(ce,{id:_.name,value:_.state.value,"aria-invalid":_.state.meta.isTouched&&!_.state.meta.isValid,placeholder:n,roundingRule:u,numberAfterDecimalPoint:d,precision:p,unitText:m,allowNegative:g,className:(0,a.cn)(v&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:_.handleBlur,onValueChange:E}),v&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 start-2 top-2.5 text-muted-weak`,children:(0,o.jsx)(s.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),l&&!!y.length&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 start-2 top-2.75 text-danger-strong`,children:(0,o.jsx)(s.BanIcon,{size:14})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:l&&(0,o.jsx)(A,{errors:y})})]}),(0,o.jsx)(O,{isShow:!!r,children:r})]})})]}),(0,o.jsx)(k,{})]})},z=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0})=>{let{form:l,name:u,state:d,handleBlur:p,handleChange:m}=Q(),h=(0,f.useStore)(l.store,({isSubmitting:e})=>e),[g,_]=(0,c.useState)(!1),v=(0,c.useMemo)(()=>d.meta.isTouched&&!d.meta.isValid,[d.meta.isTouched,d.meta.isValid]),y=(0,c.useCallback)(()=>_(e=>!e),[]),b=(0,c.useCallback)(({target:{value:e}})=>{h||m(e||null)},[h,m]);return(0,o.jsx)(x,{className:`gap-y-4 px-4`,children:(0,o.jsxs)(S,{"data-invalid":v,orientation:r,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:u,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(L,{id:u,type:g?`text`:`password`,placeholder:n,value:d.value??``,"aria-invalid":v,autoComplete:`new-password`,onBlur:p,onChange:b}),(0,o.jsx)(`button`,{className:`absolute inset-y-0 end-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:y,"aria-label":g?`Hide password`:`Show password`,"aria-pressed":g,"aria-controls":`password`,children:g?(0,o.jsx)(s.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,o.jsx)(s.EyeIcon,{size:16,"aria-hidden":`true`})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&(0,o.jsx)(A,{errors:d.meta.errors})}),(0,o.jsx)(O,{isShow:!!i,children:i})]})]})})};function B({className:e,...t}){return(0,o.jsx)(d.RadioGroup.Root,{"data-slot":`radio-group`,className:(0,a.cn)(`grid gap-3`,e),...t})}function V({className:e,...t}){return(0,o.jsx)(d.RadioGroup.Item,{"data-slot":`radio-group-item`,className:(0,a.cn)(`aspect-square size-4 shrink-0 rounded-full border border-border shadow-xs outline-none transition-all`,`disabled:cursor-not-allowed disabled:opacity-50`,`focus:border-border focus:ring-4 focus:ring-primary-weak`,`aria-invalid:border-danger-strong aria-invalid:ring-danger-weak`,`aria-readonly:pointer-events-none`,`aria-readonly:[&_div]:bg-muted`,`aria-readonly:[&_svg]:fill-muted-weak`,`aria-readonly:[&_svg]:text-muted-weak`,e),...t,children:(0,o.jsxs)(d.RadioGroup.Indicator,{"data-slot":`radio-group-indicator`,className:`relative flex items-center justify-center bg-primary`,children:[(0,o.jsx)(`div`,{className:`absolute size-4 rounded-full bg-primary`}),(0,o.jsx)(s.CircleIcon,{className:`-translate-1/2 absolute top-1/2 left-1/2 size-2 fill-text-negative-strong text-text-negative`})]})})}const H=({label:e,description:t,orientation:n,options:r,helperText:i})=>{let s=Q(),c=(0,f.useStore)(s.form.store,({isSubmitting:e})=>e);return(0,o.jsxs)(x,{className:`px-4`,children:[(0,o.jsxs)(S,{orientation:n,className:`flex-col gap-2`,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{children:e}),(0,o.jsx)(D,{children:t}),(0,o.jsx)(O,{isShow:!!i,children:i})]}),(0,o.jsx)(w,{children:(0,o.jsx)(B,{defaultValue:s.state.value??void 0,className:`w-full`,onValueChange:s.handleChange,children:r.map(e=>(0,o.jsx)(T,{className:(0,a.cn)(`h-fit`,s.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,c&&`pointer-events-none bg-muted-muted opacity-60`,s.state.value===e.value&&c&&`border-border-strong!`),children:(0,o.jsxs)(S,{orientation:`horizontal`,className:`justify-between rounded p-2!`,children:[(0,o.jsxs)(C,{className:`gap-1!`,children:[(0,o.jsx)(E,{children:e.label}),(0,o.jsx)(D,{className:`text-xs`,children:e.description})]}),(0,o.jsx)(V,{value:e.value})]})},e.value))})})]}),(0,o.jsx)(k,{})]})};function U({...e}){return(0,o.jsx)(d.Select.Root,{"data-slot":`select`,...e})}function W({...e}){return(0,o.jsx)(d.Select.Value,{"data-slot":`select-value`,...e})}function G({className:e,children:t,...n}){return(0,o.jsxs)(d.Select.Trigger,{"data-slot":`select-trigger`,className:(0,a.cn)(`flex w-full items-center justify-between`,`-outline-offset-1 outline-1 outline-border`,`gap-2 rounded bg-transparent px-3 py-2`,`rounded shadow-input transition-all`,`cursor-pointer whitespace-nowrap text-sm`,`focus-visible:text-text-positive-strong`,`focus-visible:outline-primary-strong`,`focus-visible:ring-4`,`focus-visible:ring-primary-weak`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-4`,`data-[state=open]:ring-primary-weak`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`aria-invalid:bg-danger-bg-subtle`,`aria-invalid:outline-danger`,`aria-invalid:ring-danger-weak`,`aria-invalid:focus:outline-danger-strong`,`aria-invalid:focus:ring-4`,`aria-invalid:placeholder:text-text-positive-weak`,`aria-invalid:data-[state=open]:outline-danger-strong`,`aria-invalid:data-[state=open]:ring-danger-weak`,`data-placeholder:text-text-positive-muted`,`*:data-[slot=select-value]:line-clamp-1`,`*:data-[slot=select-value]:flex`,`*:data-[slot=select-value]:items-center`,`*:data-[slot=select-value]:gap-2`,`aria-readonly:bg-muted-muted`,`aria-readonly:cursor-default`,`aria-readonly:focus:outline-none`,`aria-readonly:ring-0`,`aria-readonly:pointer-events-none`,`[&_svg]:shrink-0`,`[&_svg]:pointer-events-none`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...n,children:[t,(0,o.jsx)(d.Select.Icon,{asChild:!0,children:(0,o.jsx)(s.ChevronDownIcon,{size:16,opacity:50})})]})}function le({className:e,children:t,position:n=`popper`,...r}){return(0,o.jsx)(d.Select.Portal,{"data-slot":`select-portal`,children:(0,o.jsxs)(d.Select.Content,{"data-slot":`select-content`,className:(0,a.cn)(`relative z-50 min-w-32 overflow-y-auto overflow-x-hidden rounded shadow-dropdown duration-300`,`bg-white`,`w-(--radix-select-trigger-width)`,`max-h-(--radix-select-content-available-height)`,`origin-(--radix-select-content-transform-origin)`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`,`data-[state=closed]:zoom-out-95`,`data-[side=bottom]:slide-in-from-top-8`,`data-[side=left]:slide-in-from-right-8`,`data-[side=right]:slide-in-from-left-8`,`data-[side=top]:slide-in-from-bottom-8`,n===`popper`&&`data-[side=bottom]:translate-y-1`,n===`popper`&&`data-[side=left]:-translate-x-1`,n===`popper`&&`data-[side=right]:translate-x-1`,n===`popper`&&`data-[side=top]:-translate-y-1`,e),position:n,style:{maxHeight:`var(--radix-select-content-available-height)`},...r,children:[(0,o.jsx)(de,{}),(0,o.jsx)(d.Select.Viewport,{className:(0,a.cn)(`p-1`,n===`popper`&&`h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1`),children:t}),(0,o.jsx)(fe,{})]})})}function ue({className:e,children:t,...n}){return(0,o.jsxs)(d.Select.Item,{"data-slot":`select-item`,className:(0,a.cn)(`relative flex select-none items-center border border-transparent`,`gap-2 rounded py-2.5 pr-8 pl-2`,`w-full`,`cursor-pointer outline-none transition-colors`,`font-medium text-sm text-text-positive-weak`,`focus:border-border-weak`,`focus:bg-linear-to-b`,`focus:from-muted-bg-subtle`,`focus:to-muted-muted`,`data-disabled:opacity-50`,`data-disabled:pointer-events-none`,`[&_svg]:pointer-events-none`,`[&_svg]:shrink-0`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-text-positive-weak`,`*:[span]:last:flex`,`*:[span]:last:items-center`,`*:[span]:last:gap-2`,e),...n,children:[(0,o.jsx)(d.Select.ItemText,{children:t}),(0,o.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,o.jsx)(d.Select.ItemIndicator,{children:(0,o.jsx)(s.CheckIcon,{size:16})})})]})}function de({className:e,...t}){return(0,o.jsx)(d.Select.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:(0,a.cn)(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(s.ChevronUpIcon,{size:16})})}function fe({className:e,...t}){return(0,o.jsx)(d.Select.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:(0,a.cn)(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(s.ChevronDownIcon,{size:16})})}const pe=({label:e,description:t,placeholder:n,orientation:r=`responsive`,options:i,helperText:a,required:l=!1})=>{let u=Q(),d=(0,c.useMemo)(()=>u.state.meta.isTouched&&!u.state.meta.isValid,[u.state.meta.isTouched,u.state.meta.isValid]),f=(0,c.useMemo)(()=>l?u.state.value===null:!1,[l,u.state.value]),p=(0,c.useMemo)(()=>u.state.meta.errors,[u.state.meta.errors]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:r,"data-invalid":u.state.meta.isTouched&&!u.state.meta.isValid,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:u.name,"aria-required":f,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{className:`flex flex-col`,children:[(0,o.jsxs)(U,{defaultValue:u.state.value??void 0,onValueChange:u.handleChange,children:[(0,o.jsx)(G,{"aria-invalid":d?`true`:void 0,onBlur:u.handleBlur,children:(0,o.jsx)(W,{placeholder:n})}),(0,o.jsxs)(le,{children:[!!i.length&&i.map(e=>(0,o.jsx)(ue,{value:e.value,children:e.label},e.value)),!i.length&&(0,o.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,o.jsx)(s.PackagePlusIcon,{strokeWidth:1}),`No options available`]})]})]}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:(0,o.jsx)(A,{errors:p})}),(0,o.jsx)(O,{isShow:!!a,children:a})]})]}),(0,o.jsx)(k,{})]})};function me({className:e,...t}){return(0,o.jsx)(d.Switch.Root,{"data-slot":`switch`,className:(0,a.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,o.jsx)(d.Switch.Thumb,{"data-slot":`switch-thumb`,className:(0,a.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 he=({label:e,description:t,helperText:n})=>{let r=Q();return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(E,{className:`cursor-pointer`,children:(0,o.jsx)(`label`,{htmlFor:r.name,children:e})}),(0,o.jsx)(D,{children:t}),(0,o.jsx)(me,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),(0,o.jsx)(O,{isShow:!!n,children:n})]}),(0,o.jsx)(k,{})]})},ge=({label:e,description:t,placeholder:n,counter:r=!1,helperText:i,orientation:l=`responsive`,showClearButton:u=!1,showErrorMessage:d=!0,required:p=!1,maxLength:m})=>{let{form:h,name:g,state:_,handleBlur:v,handleChange:y}=Q(),b=(0,f.useStore)(h.store,({isSubmitting:e})=>e),E=(0,c.useMemo)(()=>u&&!b,[u,b]),j=(0,c.useMemo)(()=>_.value?_.value.length:0,[_.value]),M=(0,c.useMemo)(()=>{if(!r)return``;let e=`character${[0,1].includes(j)?``:`s`}`;return r&&m?`${j} / ${m} ${e}`:`${j} ${e}`},[j,r,m]),N=(0,c.useMemo)(()=>_.meta.isTouched&&!_.meta.isValid,[_.meta.isTouched,_.meta.isValid]),P=(0,c.useMemo)(()=>p?_.value===null:!1,[p,_.value]),F=(0,c.useCallback)(({target:{value:e}})=>{b||r&&m&&e.length>m||y(e||null)},[b,r,m,y]),I=(0,c.useCallback)(()=>{b||y(``)},[b,y]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:l,"data-invalid":N,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{"aria-required":P,htmlFor:g,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(L,{id:g,name:g,value:_.value===null?``:_.value,"aria-invalid":N,autoComplete:`off`,placeholder:n,className:(0,a.cn)(b&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:v,onChange:F}),E&&!_.meta.errors.length&&(0,o.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-y-0 end-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:I,children:(0,o.jsx)(s.XIcon,{size:14,"aria-hidden":`true`})}),b&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-muted-weak`,children:(0,o.jsx)(s.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),d&&!!_.meta.errors.length&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-danger-strong`,children:(0,o.jsx)(s.BanIcon,{size:14})}),(0,o.jsxs)(`div`,{className:`mt-1 flex w-full items-start justify-end *:basis-1/2`,children:[d&&(0,o.jsx)(A,{errors:_.meta.errors}),!!r&&(0,o.jsx)(`p`,{className:`text-end text-text-positive-weak text-xs tabular-nums leading-3.5`,children:M})]}),(0,o.jsx)(O,{isShow:!!i,children:i})]})]}),(0,o.jsx)(k,{})]})};function _e({className:e,onChange:t,onValueChange:n,...r}){let i=(0,c.useCallback)(e=>{t?.(e),n?.(e.target.value)},[t,n]);return(0,o.jsx)(`textarea`,{"data-slot":`textarea`,className:(0,a.cn)(`flex min-h-24 w-full bg-transparent px-3 py-2`,`rounded shadow-input transition-[color,box-shadow] duration-200`,`resize-y text-sm text-text-positive-weak tabular-nums caret-primary`,`-outline-offset-1 outline-1 outline-border`,`placeholder:text-text-positive-muted`,`focus:text-text-positive focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`read-only:pointer-events-none read-only:bg-muted-muted read-only:placeholder:text-text-positive-weak`,`aria-invalid:bg-danger-bg-subtle`,`aria-invalid:outline-danger`,`aria-invalid:ring-danger-weak`,`aria-invalid:focus:outline-danger-strong`,`aria-invalid:focus:ring-4`,`aria-invalid:placeholder:text-text-positive-weak`,`disabled:cursor-not-allowed disabled:opacity-50`,`disabled:pointer-events-none`,`disabled:border-border-weak/50 disabled:bg-secondary-muted/10`,e),...r,onChange:i})}const ve=({label:e,description:t,placeholder:n,orientation:r=`responsive`,counter:i,helperText:l,showErrorMessage:u=!0,required:d=!1,maxLength:p})=>{let{form:m,state:h,name:g,handleBlur:_,handleChange:v}=Q(),y=(0,f.useStore)(m.store,({isSubmitting:e})=>e),b=(0,c.useMemo)(()=>h.value?h.value.length:0,[h.value]),E=(0,c.useMemo)(()=>{if(!i)return``;let e=`character${[0,1].includes(b)?``:`s`}`;return i&&p?`${b} / ${p} ${e}`:`${b} ${e}`},[b,i,p]),j=(0,c.useMemo)(()=>h.meta.isTouched&&!h.meta.isValid,[h.meta.isTouched,h.meta.isValid]),M=(0,c.useMemo)(()=>h.meta.errors,[h.meta.errors]),N=(0,c.useMemo)(()=>d?h.value===null:!1,[d,h.value]),P=(0,c.useCallback)(({target:{value:e}})=>{y||i&&p&&e.length>p||v(e||null)},[y,i,p,v]);return(0,o.jsxs)(x,{className:`px-4`,children:[(0,o.jsxs)(S,{orientation:r,"data-invalid":j,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{"aria-required":N,htmlFor:g,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(_e,{id:g,name:g,value:h.value===null?``:h.value,"aria-invalid":j,autoComplete:`off`,placeholder:n,className:(0,a.cn)(y&&`pointer-events-none bg-muted-muted opacity-60`),onChange:P,onBlur:_}),y&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-muted-weak`,children:(0,o.jsx)(s.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),u&&!!M.length&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-danger-strong`,children:(0,o.jsx)(s.BanIcon,{size:14})}),(0,o.jsxs)(`div`,{className:`mt-1 flex w-full items-start justify-end *:basis-1/2`,children:[u&&(0,o.jsx)(A,{errors:M}),!!i&&(0,o.jsx)(`p`,{className:`text-end text-text-positive-weak text-xs`,children:E})]}),(0,o.jsx)(O,{isShow:!!l,children:l})]})]}),(0,o.jsx)(k,{})]})},ye=({label:e,className:t})=>{let r=$(),i=(0,c.useCallback)(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return(0,o.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:s})=>(0,o.jsx)(n.t,{type:`button`,size:`md`,disabled:r,isLoading:s,className:(0,a.cn)(`min-w-32`,t),onClick:i,children:e??`Submit`})})},be=({type:e=`create`})=>{let t=$();return(0,o.jsxs)(`div`,{className:`flex h-8 items-center justify-between`,children:[(0,o.jsx)(t.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(n.t,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:e,className:`h-full min-w-32`,onClick:()=>t.reset(),children:`Cancel`})}),e===`create`&&(0,o.jsx)(t.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,o.jsxs)(n.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await t.handleSubmit({submitAction:`create`}),t.state.isSubmitSuccessful&&t.reset()},children:[(0,o.jsx)(s.PlusIcon,{}),`Add New`]})}),e===`update`&&(0,o.jsx)(t.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,o.jsxs)(n.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await t.handleSubmit({submitAction:`update`}),t.state.isSubmitSuccessful&&t.reset()},children:[(0,o.jsx)(s.ArrowDownToLine,{}),`Update`]})})]})};function K({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,o.jsx)(d.Separator.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:(0,a.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 xe=({title:e,description:t,children:n})=>(0,o.jsxs)(`section`,{"data-slot":`card-form`,className:`flex flex-col rounded-md bg-card pb-4 shadow-card ring-3 ring-border-muted`,children:[(0,o.jsxs)(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-1 p-4`,children:[(0,o.jsx)(`p`,{className:`font-semibold text-lg`,children:e}),!!t&&(0,o.jsx)(`p`,{className:`text-muted text-sm`,children:t})]}),(0,o.jsx)(K,{}),(0,o.jsx)(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:n})]}),Se=({children:e})=>(0,o.jsx)(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),q=({...e})=>(0,o.jsx)(`button`,{...e,type:`button`,style:{"corner-shape":`squircle`},className:`min-w-40 cursor-pointer rounded-xl border border-border bg-linear-to-b from-white/80 to-white px-4 py-2 font-semibold text-sm text-text-positive shadow-[0_2px_4px_var(--border)] 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:`Cancel`});function J({...e}){return(0,o.jsx)(d.Dialog.Root,{"data-slot":`dialog`,...e})}function Y({...e}){return(0,o.jsx)(d.Dialog.Portal,{"data-slot":`dialog-portal`,...e})}function Ce({className:e,...t}){return(0,o.jsx)(d.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,a.cn)(`fixed inset-0 z-50 bg-black/50`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,e),...t})}function we({className:e,children:t,showCloseButton:n=!0,...i}){return(0,o.jsxs)(Y,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(Ce,{className:`backdrop-blur-sm`}),(0,o.jsxs)(d.Dialog.Content,{"data-slot":`dialog-content`,className:(0,a.cn)(`relative z-50 grid bg-background`,`gap-4 p-6 shadow-dialog outline-none`,`max-h-[85dvh] w-full max-w-[calc(100%-2rem)] sm:max-w-lg`,`rounded-2xl duration-200`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-80`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-80`,`-translate-x-1/2 -translate-y-1/2 fixed top-1/2 left-1/2`,e),...i,children:[t,n&&(0,o.jsx)(d.Dialog.Close,{"data-slot":`dialog-close`,tabIndex:-1,asChild:!0,className:`absolute top-3 right-3`,children:(0,o.jsx)(r.t,{})})]})]})}function Te({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`dialog-header`,className:(0,a.cn)(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Ee({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`dialog-footer`,className:(0,a.cn)(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function De({className:e,...t}){return(0,o.jsx)(d.Dialog.Title,{"data-slot":`dialog-title`,className:(0,a.cn)(`font-semibold text-lg text-text-positive-strong leading-none`,e),...t})}const X=({isSubmitting:e,...t})=>(0,o.jsx)(`button`,{...t,type:`button`,"data-loading":e?`true`:void 0,style:{"corner-shape":`squircle`},className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-xl border border-primary-strong bg-linear-to-b from-primary/60 to-primary px-4 py-2 font-semibold text-sm text-text-negative outline-none drop-shadow-[0_2px_4px_var(--primary)] 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,o.jsx)(s.Loader2,{size:16,strokeWidth:3,className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 z-10 animate-spin`}):`Submit`}),Oe=({title:e,open:t,onOpenChange:n,children:r})=>{let a=$(),s=(0,c.useCallback)(e=>{e||a.reset(),n?.(e)},[a.reset,n]);return(0,o.jsx)(J,{open:t,onOpenChange:s,children:(0,o.jsxs)(we,{className:`gap-0 rounded-sm p-0 sm:max-w-2xl`,children:[(0,o.jsx)(Te,{className:`flex items-center justify-center px-4 py-6`,children:(0,o.jsx)(De,{className:`font-medium`,children:e})}),(0,o.jsx)(i.t,{}),(0,o.jsx)(`div`,{className:`relative flex flex-col space-y-4 p-4 pt-6`,children:r}),(0,o.jsx)(i.t,{}),(0,o.jsxs)(Ee,{className:`justify-between! flex items-center px-6 py-4`,children:[(0,o.jsx)(a.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(q,{disabled:e,onClick:()=>{a.reset(),s(!1)}})}),(0,o.jsx)(a.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,o.jsx)(X,{isSubmitting:e,disabled:t})})]})]})})},ke=({title:e,open:t,onOpenChange:n,children:i})=>{let s=$();return(0,o.jsx)(J,{open:t,onOpenChange:n,children:(0,o.jsxs)(Y,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(d.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,a.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,o.jsx)(d.Dialog.Content,{"data-slot":`dialog-content`,className:(0,a.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,o.jsxs)(`section`,{className:`relative flex size-full flex-col`,children:[(0,o.jsx)(`header`,{className:`flex h-14 items-center border-border border-b px-4`,children:(0,o.jsx)(`h2`,{className:`font-semibold text-lg text-primary-strong`,children:e})}),(0,o.jsx)(`div`,{className:`flex-1 overflow-y-auto py-4`,children:i}),(0,o.jsxs)(`div`,{className:`flex flex-col space-y-4 border-border border-t px-4 py-2`,children:[(0,o.jsx)(s.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,o.jsx)(X,{isSubmitting:e,disabled:t,className:`w-full`})}),(0,o.jsx)(s.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(q,{disabled:e,className:`w-full`,onClick:()=>{s.reset(),n?.(!1)}})})]}),(0,o.jsx)(d.Dialog.Close,{asChild:!0,children:(0,o.jsx)(r.t,{className:`absolute top-2 right-2`})})]})})]})})},Z=({children:e})=>(0,o.jsx)(`header`,{"data-slot":`section-header`,className:`px-4 pt-2.5 pb-2 font-medium text-base text-primary-strong`,children:e}),Ae=({children:e})=>(0,o.jsx)(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),je=({title:e,children:t})=>(0,o.jsxs)(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-3 ring-border-muted`,children:[(0,o.jsx)(Z,{children:e}),(0,o.jsx)(K,{}),(0,o.jsx)(Ae,{children:t})]}),Me=({title:e,description:t,helperText:n})=>(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{className:`gap-0`,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(b,{className:`mb-1`,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsx)(O,{isShow:!!n,children:n})]}),(0,o.jsx)(k,{})]}),{fieldContext:Ne,formContext:Pe,useFieldContext:Q,useFormContext:$}=(0,f.createFormHookContexts)(),{useAppForm:Fe,withForm:Ie,withFieldGroup:Le}=(0,f.createFormHook)({fieldContext:Ne,formContext:Pe,fieldComponents:{TextField:ge,TextareaField:ve,NumberField:R,EmailField:ie,PasswordField:z,SelectField:pe,DateField:re,SwitchField:he,RadioGroupField:H,CheckboxField:j},formComponents:{TanStackDialogForm:Oe,TanStackPopoverForm:ke,TanStackContainerForm:Se,TanStackSectionForm:je,TanStackCardForm:xe,TanStackTitleField:Me,TanStackActionsForm:be,TanStackActionSubmit:ye}});exports.useTanStackFieldContext=Q,exports.useTanStackForm=Fe,exports.useTanStackFormContext=$,exports.withTanStackFieldGroup=Le,exports.withTanStackForm=Ie;
|
|
1
|
+
const e=require(`../../chunk-Bmb41Sf3.cjs`),t=require(`../../button.variants-C--cfyfH.cjs`),n=require(`../../button-DtFiUaY7.cjs`),r=require(`../../close-DvsVM8lM.cjs`),i=require(`../../separator-Crr30ZHa.cjs`);let a=require(`@customafk/react-toolkit/utils`),o=require(`react/jsx-runtime`),s=require(`lucide-react`),c=require(`react`),l=require(`class-variance-authority`),u=require(`@customafk/react-toolkit/date-fns`),d=require(`radix-ui`),f=require(`@tanstack/react-form`),p=require(`react-day-picker`);function m({className:e,...t}){return(0,o.jsx)(d.Checkbox.Root,{"data-slot":`checkbox`,className:(0,a.cn)(`peer border-border`,`size-4 shrink-0 cursor-pointer rounded border shadow-xs outline-none transition-all`,`disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-primary-strong`,`focus-visible:ring-3`,`focus-visible:ring-primary-weak`,`aria-invalid:border-danger aria-invalid:ring-danger-weak`,`aria-readonly:bg-muted-muted`,`aria-readonly:pointer-events-none`,`data-[state=checked]:aria-readonly:bg-muted-muted`,`data-[state=checked]:aria-readonly:border-border`,`data-[state=checked]:aria-readonly:text-text-positive-strong`,`data-[state=checked]:bg-primary`,`data-[state=checked]:border-primary-strong`,`data-[state=checked]:text-text-negative-strong`,e),...t,children:(0,o.jsx)(d.Checkbox.Indicator,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,o.jsx)(s.CheckIcon,{size:14})})})}const h=(0,l.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`}}),g=({label:e,color:t,size:n,className:r,children:i})=>(0,o.jsx)(`div`,{"data-slot":`required-indicator`,className:h({color:t,size:n,className:r}),children:e||i});function _({className:e,children:t,...n}){return(0,o.jsxs)(d.Label.Root,{"data-slot":`label`,className:(0,a.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,o.jsx)(g,{label:`Required`,color:`danger`,size:`sm`,className:`hidden`})]})}const v=(0,l.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`}}),y=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,a.cn)(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));y.displayName=`FieldSet`;const b=(0,c.memo)(({className:e,variant:t=`legend`,...n})=>(0,o.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,a.cn)(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));b.displayName=`FieldLegend`;const x=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-group`,className:(0,a.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}));x.displayName=`FieldGroup`;const S=(0,c.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,o.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,a.cn)(v({orientation:t}),e),...n}));S.displayName=`Field`;const C=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content`,className:(0,a.cn)(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));C.displayName=`FieldContent`;const w=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content-main`,className:(0,a.cn)(`relative`,e),...t})),T=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(_,{"data-slot":`field-label`,className:(0,a.cn)(`group/field-label peer/field-label flex h-6 gap-1 font-normal 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}));T.displayName=`FieldLabel`;const E=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-label`,className:(0,a.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));E.displayName=`FieldTitle`;const D=(0,c.memo)(({className:e,...t})=>(0,o.jsx)(`p`,{"data-slot":`field-description`,className:(0,a.cn)(`nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5 font-normal text-sm text-text-positive-weak leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t}));D.displayName=`FieldDescription`;const O=(0,c.memo)(({isShow:e=!0,className:t,...n})=>e===!1?null:(0,o.jsx)(`div`,{"data-slot":`field-note`,className:(0,a.cn)(`text-wrap rounded border border-primary-muted bg-linear-to-b from-primary-bg-subtle to-primary-bg-subtle/50 p-2 text-text-positive-weak text-xs`,t),...n}));O.displayName=`FieldNote`;const k=(0,c.memo)(({children:e,className:t,...n})=>(0,o.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,a.cn)(`-my-2 group-data-[variant=outline]/field-group:-mb-2 relative h-5 text-sm`,t),...n,children:[(0,o.jsx)(i.t,{className:`absolute inset-0 top-1/2`}),e&&(0,o.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));k.displayName=`FieldSeparator`;const A=(0,c.memo)(({className:e,children:t,errors:n,...r})=>{let i=(0,c.useMemo)(()=>t||(n?n?.length===1&&n[0]?.message?(0,o.jsx)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:(0,o.jsx)(`p`,{children:n[0].message})}):(0,o.jsx)(`ul`,{className:`flex list-none flex-col`,children:n.map(e=>typeof e==`string`?(0,o.jsx)(`li`,{children:e},e):e?.message?(0,o.jsx)(`li`,{children:e.message},e.message):null)}):null),[t,n]);return i?(0,o.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,a.cn)(`w-full font-semibold text-danger-strong text-xs`,e),...r,children:i}):null});A.displayName=`FieldError`;const j=({label:e,description:t,options:n,helperText:r,orientation:i})=>{let a=Q(),s=(0,f.useStore)(a.form.store,({isSubmitting:e})=>e);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:i,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{children:e}),(0,o.jsx)(D,{children:t}),(0,o.jsx)(O,{isShow:!!r,children:r})]}),(0,o.jsx)(w,{children:(0,o.jsx)(x,{className:`flex flex-col gap-y-2`,children:n.map(e=>(0,o.jsxs)(S,{orientation:`horizontal`,children:[(0,o.jsx)(m,{id:`${a.name}-${e.value}`,name:a.name,checked:a.state.value?.includes(e.value)??!1,disabled:s,onCheckedChange:t=>{if(t&&a.state.value!==null)a.pushValue(e.value);else if(t&&a.state.value===null)a.setValue([e.value]);else if(!t&&a.state.value!==null){let t=a.state.value.indexOf(e.value);t>-1&&a.removeValue(t)}else !t&&a.state.value===null&&a.setValue(null)}}),(0,o.jsx)(T,{htmlFor:`${a.name}-${e.value}`,className:`text-text-positive`,children:e.label})]},e.value))})})]}),(0,o.jsx)(k,{})]})},M=({rootRef:e,className:t,...n})=>(0,o.jsx)(`div`,{"data-slot":`calendar`,ref:e,className:(0,a.cn)(t),...n}),N=e=>e.orientation===`left`?(0,o.jsx)(s.ChevronLeftIcon,{size:16,className:e.className,...e}):e.orientation===`right`?(0,o.jsx)(s.ChevronRightIcon,{size:16,className:e.className,...e}):(0,o.jsx)(s.ChevronDownIcon,{size:16,className:e.className,...e}),P=({className:e,day:t,modifiers:r,color:i,...s})=>{let l=(0,p.getDefaultClassNames)(),u=(0,c.useRef)(null);return(0,c.useEffect)(()=>{r.focused&&u.current?.focus()},[r.focused]),(0,o.jsx)(n.t,{ref:u,variant:`ghost`,color:`muted`,"data-day":t.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:(0,a.cn)(`flex aspect-square size-9 flex-col rounded font-normal text-sm tabular-nums leading-none`,`data-[selected-single=true]:bg-primary`,`data-[selected-single=true]:text-white`,`data-[range-middle=true]:bg-muted-muted`,`data-[range-middle=true]:text-text-positive`,`data-[range-start=true]:bg-primary-muted`,`data-[range-start=true]:text-text-positive-strong`,`data-[range-end=true]:bg-primary`,`data-[range-end=true]:text-text-positive-strong`,`group-data-[focused=true]/day:border-primary-strong`,`group-data-[focused=true]/day:relative`,`group-data-[focused=true]/day:z-10`,`data-[range-end=true]:rounded`,`data-[range-end=true]:rounded-r`,`data-[range-middle=true]:rounded-none`,`data-[range-start=true]:rounded`,`data-[range-start=true]:rounded-l`,`[&>span]:text-xs [&>span]:opacity-70`,l.day,e),...s})},F=({children:e,...t})=>(0,o.jsx)(`td`,{...t,children:(0,o.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})});function I({className:e,classNames:n,showOutsideDays:r=!0,captionLayout:i=`label`,buttonVariant:s=`ghost`,formatters:c,components:l,...u}){let d=(0,p.getDefaultClassNames)();return(0,o.jsx)(p.DayPicker,{showOutsideDays:r,className:(0,a.cn)(`group/calendar bg-background p-3`,`[--cell-size:--spacing(8)]`,`in-data-[slot=card-content]:bg-transparent`,`in-data-[slot=popover-content]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:i,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...c},classNames:{root:(0,a.cn)(d.root),months:(0,a.cn)(`flex gap-4 flex-col md:flex-row relative`,d.months),month:(0,a.cn)(`flex flex-col w-full gap-4`,d.month),nav:(0,a.cn)(`flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between`,d.nav),button_previous:(0,a.cn)(t.n({variant:`outline`,color:`muted`}),`size-(--cell-size) aria-disabled:opacity-50 p-0 select-none`,d.button_previous),button_next:(0,a.cn)(t.n({variant:`outline`,color:`muted`}),`size-(--cell-size) aria-disabled:opacity-50 p-0 select-none`,d.button_next),month_caption:(0,a.cn)(`flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)`,d.month_caption),dropdowns:(0,a.cn)(`w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5`,d.dropdowns),dropdown_root:(0,a.cn)(`relative has-focus:border-primary-strong border border-border-weak shadow-xs has-focus:ring-primary-weak has-focus:ring-[3px] rounded`,d.dropdown_root),dropdown:(0,a.cn)(`absolute inset-0 opacity-0`,d.dropdown),caption_label:(0,a.cn)(`select-none font-medium`,i===`label`&&`text-sm`,i!==`label`&&`rounded shadow-xs px-2 flex items-center gap-0.5 text-sm h-8 [&>svg]:text-text-positive [&>svg]:size-3.5`,d.caption_label),table:`w-full border-collapse`,weekdays:(0,a.cn)(`flex`,d.weekdays),weekday:(0,a.cn)(`text-text-positive rounded flex-1 font-normal text-[0.8rem] select-none`,d.weekday),week:(0,a.cn)(`flex w-full mt-2`,d.week),week_number_header:(0,a.cn)(`select-none w-(--cell-size)`,d.week_number_header),week_number:(0,a.cn)(`text-[0.8rem] select-none text-text-positive`,d.week_number),day:(0,a.cn)(`relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l [&:last-child[data-selected=true]_button]:rounded-r group/day aspect-square select-none`,d.day),range_start:(0,a.cn)(`rounded-l bg-muted-muted`,d.range_start),range_middle:(0,a.cn)(`rounded-none`,d.range_middle),range_end:(0,a.cn)(`rounded-r bg-muted-muted`,d.range_end),today:(0,a.cn)(`bg-muted-muted text-text-positive rounded data-[selected=true]:rounded-none`,d.today),outside:(0,a.cn)(`[&>button]:text-text-positive-muted aria-selected:text-text-positive`),disabled:(0,a.cn)(`bg-muted-muted text-text-positive opacity-50`,d.disabled),hidden:(0,a.cn)(`invisible`,d.hidden),...n},components:{Root:M,Chevron:N,DayButton:P,WeekNumber:F,...l},...u})}function ee({...e}){return(0,o.jsx)(d.Popover.Root,{"data-slot":`popover`,...e})}function te({...e}){return(0,o.jsx)(d.Popover.Trigger,{"data-slot":`popover-trigger`,...e})}function ne({className:e,align:t=`start`,sideOffset:n=4,children:r,...i}){return(0,o.jsx)(d.Popover.Portal,{children:(0,o.jsxs)(d.Popover.Content,{"data-slot":`popover-content`,align:t,sideOffset:n,className:(0,a.cn)(`relative bg-popover`,`text-text-positive`,`z-50`,`min-w-(--radix-popover-trigger-width)`,`max-h-(--radix-popover-content-available-height)`,`origin-(--radix-popover-content-transform-origin)`,`rounded-md p-4 shadow-dropdown outline-none`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-95`,`data-[side=top]:slide-in-from-bottom-8`,`data-[side=right]:slide-in-from-left-8`,`data-[side=bottom]:slide-in-from-top-8`,`data-[side=left]:slide-in-from-right-8`,e),...i,children:[r,(0,o.jsx)(d.Popover.Arrow,{className:`fill-popover`})]})})}const re=({label:e,description:t,placeholder:r,orientation:i,helperText:l,minDate:d,maxDate:f,required:p})=>{let m=Q(),h=(0,c.useMemo)(()=>p?m.state.value===null:!1,[p,m.state.value]),g=(0,c.useMemo)(()=>m.state.meta.isTouched&&!m.state.meta.isValid,[m.state.meta.isTouched,m.state.meta.isValid]);return(0,o.jsxs)(x,{className:`px-4`,children:[(0,o.jsxs)(S,{orientation:i,"data-invalid":g,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:m.name,"aria-required":h,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{className:`flex flex-col space-y-1`,children:[(0,o.jsx)(`div`,{className:`flex w-full flex-col`,children:(0,o.jsxs)(ee,{children:[(0,o.jsx)(te,{asChild:!0,children:(0,o.jsxs)(n.t,{variant:`outline`,color:`muted`,size:`lg`,className:(0,a.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`,m.state.value===null&&`text-text-positive-muted`),children:[(0,o.jsx)(`p`,{children:m.state.value===null?r||`Select date`:(0,u.format)(m.state.value,`PPPP`)}),(0,o.jsx)(s.CalendarDaysIcon,{strokeWidth:1})]})}),(0,o.jsxs)(ne,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,onBlur:m.handleBlur,children:[(0,o.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,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.endOfToday)())},children:`Today`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.endOfTomorrow)())},children:`Tomorrow`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.endOfYesterday)())},children:`Yesterday`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.subDays)((0,u.endOfToday)(),3))},children:`Last 3 Days`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.subDays)((0,u.endOfToday)(),7))},children:`Last 7 Days`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.subDays)((0,u.endOfToday)(),30))},children:`Last 30 Days`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.startOfMonth)((0,u.endOfToday)()))},children:`This Month`}),(0,o.jsx)(n.t,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>{m.handleChange((0,u.lastDayOfMonth)((0,u.endOfToday)()))},children:`Last Month`})]}),(0,o.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,o.jsx)(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:(0,o.jsx)(I,{mode:`single`,selected:m.state.value??void 0,hidden:{before:d??new Date(1900,0,1),after:f??new Date(2100,11,31)},onSelect:e=>{e&&m.handleChange(e)}})})})]})]})}),(0,o.jsx)(O,{isShow:!!l,children:l})]})]}),(0,o.jsx)(k,{})]})},L=({className:e,onChange:t,onValueChange:n,...r})=>{let i=(0,c.useCallback)(e=>{t?.(e),n?.(e.target.value)},[t,n]);return(0,o.jsx)(`input`,{"data-slot":`input`,className:(0,a.cn)(`w-full min-w-0 bg-transparent px-2.5 py-2 transition-[color,box-shadow]`,`rounded text-sm text-text-positive-weak tabular-nums leading-5 shadow-input placeholder:text-text-positive-muted`,`-outline-offset-1 outline-1 outline-border`,`disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-transparent disabled:opacity-50`,`read-only:pointer-events-none read-only:bg-muted-muted read-only:placeholder:text-text-positive-weak`,`focus:text-text-positive focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`aria-invalid:bg-danger-bg-subtle aria-invalid:outline-danger aria-invalid:ring-danger-weak aria-invalid:focus:outline-danger-strong aria-invalid:focus:ring-4 aria-invalid:placeholder:text-text-positive-weak`,e),...r,onChange:i})},ie=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:l=!0,maxLength:u})=>{let{form:d,name:p,state:m,handleBlur:h,handleChange:g}=Q(),_=(0,f.useStore)(d.store,({isSubmitting:e})=>e),v=(0,c.useMemo)(()=>m.meta.isTouched&&!m.meta.isValid,[m.meta.isTouched,m.meta.isValid]),y=(0,c.useCallback)(({target:{value:e}})=>{_||u&&e.length>u||g(e||null)},[_,u,g]),b=(0,c.useCallback)(()=>{_||g(null)},[_,g]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{"data-invalid":v,orientation:r,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:p,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(L,{id:p,name:p,value:m.value===null?``:m.value,"aria-invalid":v,autoComplete:`email`,placeholder:n,className:(0,a.cn)(`pl-9`,_&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:h,onChange:y}),(0,o.jsx)(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:(0,o.jsx)(s.AtSignIcon,{size:14})}),(0,o.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-y-0 end-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong`,onClick:b,children:(0,o.jsx)(s.XIcon,{size:14,"aria-hidden":`true`})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:l&&(0,o.jsx)(A,{errors:m.meta.errors})}),(0,o.jsx)(O,{isShow:!!i,children:i})]})]}),(0,o.jsx)(k,{})]})},ae=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,oe=e=>Number(e).toLocaleString(),se=(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}},ce=({disabled:e=!1,readOnly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:s=null,unitText:l,decimal:u,placeholder:d,precision:f,wrapperClassName:p,className:m,onChange:h,onValueChange:g,onFocus:_,onBlur:v,...y})=>{let b=(0,c.useRef)(null),x=(0,c.useRef)(null),[S,C]=(0,c.useState)(s?.toString()??null),w=(0,c.useMemo)(()=>u?.[1]??r,[u,r]),T=(0,c.useMemo)(()=>u&&u[0]-u[1],[u]),E=(0,c.useMemo)(()=>ae(n),[n]),D=(0,c.useCallback)(e=>{if(!w||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length;return n.length<=w&&r<=(T??1/0)},[w,T]),O=(0,c.useCallback)(e=>{if(e===`0`)return`0`;if(!Number(e))return null;let[t,n=``]=se(parseFloat(e),Math.min(w-1,f||0),i).toString().split(`.`),r=oe(t);return n?`${r}.${n}`:r},[w,f,i]),k=(0,c.useCallback)(e=>{let t=e===`0`,n=e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e);if(t){g?.(0),C(e);return}if(n){C(()=>(g?.(0),e));return}},[g]),A=(0,c.useCallback)(e=>{h?.(e);let{value:t}=e.target;if(t===``||t===void 0){g?.(null),C(null);return}k(t),!(!E.test(t)||!D(t))&&(g?.(parseFloat(t)||0),C(t))},[D,h,g,k,E]),j=(0,c.useCallback)(e=>{t||(_?.(e),C(e=>typeof e==`string`?e.replace(/,/g,``):null))},[t,_]),M=(0,c.useCallback)(e=>{t||(v?.(e),C(e=>e===null?null:e===`0`||e===`-`||/^-0+(\.0+)?$/.test(e)||/^-0*\.$/.test(e)?`0`:typeof e==`string`?O(e):null))},[t,O,v]);return(0,c.useEffect)(()=>{let e=document.activeElement===x.current;if(s==null||!E.test(s.toString())||!D(s.toString())){C(null);return}C(t=>e?t:O(s.toString()))},[O,s,D,E]),(0,c.useEffect)(()=>{if(!b.current||!x.current||!l)return;let e=b.current.offsetWidth;x.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[l]),(0,o.jsxs)(`div`,{className:(0,a.cn)(`relative`,p),children:[(0,o.jsx)(L,{...y,ref:x,value:S||(t?`0`:``),placeholder:d,disabled:e,readOnly:t,className:(0,a.cn)(`text-end font-number text-sm slashed-zero lining-nums tabular-nums`,t&&`bg-muted text-muted-foreground`,m),onChange:A,onFocus:j,onBlur:M}),l&&(0,o.jsx)(`span`,{ref:b,className:`-translate-y-1/2 pointer-events-none absolute top-1/2 right-2 text-muted-foreground text-sm`,children:l})]})},R=({label:e,description:t,placeholder:n,helperText:r,orientation:i,showErrorMessage:l=!0,rounding:u,decimalPlaces:d,percision:p,unit:m,required:h,allowNegative:g})=>{let _=Q(),v=(0,f.useStore)(_.form.store,({isSubmitting:e})=>e),y=(0,c.useMemo)(()=>_.state.meta.errors,[_.state.meta.errors]),b=(0,c.useMemo)(()=>h?_.state.value===null:!1,[h,_.state.value]),E=(0,c.useCallback)(e=>{v||_.handleChange(e)},[v,_.handleChange]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:i,"data-invalid":_.state.meta.isTouched&&!_.state.meta.isValid,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:_.name,"aria-required":b,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsx)(w,{className:`flex justify-end`,children:(0,o.jsxs)(`div`,{className:`relative flex w-full flex-col items-end`,children:[(0,o.jsxs)(`div`,{className:`relative w-full max-w-120`,children:[(0,o.jsx)(ce,{id:_.name,value:_.state.value,"aria-invalid":_.state.meta.isTouched&&!_.state.meta.isValid,placeholder:n,roundingRule:u,numberAfterDecimalPoint:d,precision:p,unitText:m,allowNegative:g,className:(0,a.cn)(v&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:_.handleBlur,onValueChange:E}),v&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 start-2 top-2.5 text-muted-weak`,children:(0,o.jsx)(s.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),l&&!!y.length&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 start-2 top-2.75 text-danger-strong`,children:(0,o.jsx)(s.BanIcon,{size:14})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:l&&(0,o.jsx)(A,{errors:y})})]}),(0,o.jsx)(O,{isShow:!!r,children:r})]})})]}),(0,o.jsx)(k,{})]})},z=({label:e,description:t,placeholder:n,orientation:r=`responsive`,helperText:i,showErrorMessage:a=!0})=>{let{form:l,name:u,state:d,handleBlur:p,handleChange:m}=Q(),h=(0,f.useStore)(l.store,({isSubmitting:e})=>e),[g,_]=(0,c.useState)(!1),v=(0,c.useMemo)(()=>d.meta.isTouched&&!d.meta.isValid,[d.meta.isTouched,d.meta.isValid]),y=(0,c.useCallback)(()=>_(e=>!e),[]),b=(0,c.useCallback)(({target:{value:e}})=>{h||m(e||null)},[h,m]);return(0,o.jsx)(x,{className:`gap-y-4 px-4`,children:(0,o.jsxs)(S,{"data-invalid":v,orientation:r,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:u,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(L,{id:u,type:g?`text`:`password`,placeholder:n,value:d.value??``,"aria-invalid":v,autoComplete:`new-password`,onBlur:p,onChange:b}),(0,o.jsx)(`button`,{className:`absolute inset-y-0 end-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:y,"aria-label":g?`Hide password`:`Show password`,"aria-pressed":g,"aria-controls":`password`,children:g?(0,o.jsx)(s.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,o.jsx)(s.EyeIcon,{size:16,"aria-hidden":`true`})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:a&&(0,o.jsx)(A,{errors:d.meta.errors})}),(0,o.jsx)(O,{isShow:!!i,children:i})]})]})})};function B({className:e,...t}){return(0,o.jsx)(d.RadioGroup.Root,{"data-slot":`radio-group`,className:(0,a.cn)(`grid gap-3`,e),...t})}function V({className:e,...t}){return(0,o.jsx)(d.RadioGroup.Item,{"data-slot":`radio-group-item`,className:(0,a.cn)(`aspect-square size-4 shrink-0 rounded-full border border-border shadow-xs outline-none transition-all`,`disabled:cursor-not-allowed disabled:opacity-50`,`focus:border-border focus:ring-4 focus:ring-primary-weak`,`aria-invalid:border-danger-strong aria-invalid:ring-danger-weak`,`aria-readonly:pointer-events-none`,`aria-readonly:[&_div]:bg-muted`,`aria-readonly:[&_svg]:fill-muted-weak`,`aria-readonly:[&_svg]:text-muted-weak`,e),...t,children:(0,o.jsxs)(d.RadioGroup.Indicator,{"data-slot":`radio-group-indicator`,className:`relative flex items-center justify-center bg-primary`,children:[(0,o.jsx)(`div`,{className:`absolute size-4 rounded-full bg-primary`}),(0,o.jsx)(s.CircleIcon,{className:`-translate-1/2 absolute top-1/2 left-1/2 size-2 fill-text-negative-strong text-text-negative`})]})})}const H=({label:e,description:t,orientation:n,options:r,helperText:i})=>{let s=Q(),c=(0,f.useStore)(s.form.store,({isSubmitting:e})=>e);return(0,o.jsxs)(x,{className:`px-4`,children:[(0,o.jsxs)(S,{orientation:n,className:`flex-col gap-2`,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{children:e}),(0,o.jsx)(D,{children:t}),(0,o.jsx)(O,{isShow:!!i,children:i})]}),(0,o.jsx)(w,{children:(0,o.jsx)(B,{defaultValue:s.state.value??void 0,className:`w-full`,onValueChange:s.handleChange,children:r.map(e=>(0,o.jsx)(T,{className:(0,a.cn)(`h-fit`,s.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,c&&`pointer-events-none bg-muted-muted opacity-60`,s.state.value===e.value&&c&&`border-border-strong!`),children:(0,o.jsxs)(S,{orientation:`horizontal`,className:`justify-between rounded p-2!`,children:[(0,o.jsxs)(C,{className:`gap-1!`,children:[(0,o.jsx)(E,{children:e.label}),(0,o.jsx)(D,{className:`text-xs`,children:e.description})]}),(0,o.jsx)(V,{value:e.value})]})},e.value))})})]}),(0,o.jsx)(k,{})]})};function U({...e}){return(0,o.jsx)(d.Select.Root,{"data-slot":`select`,...e})}function W({...e}){return(0,o.jsx)(d.Select.Value,{"data-slot":`select-value`,...e})}function G({className:e,children:t,...n}){return(0,o.jsxs)(d.Select.Trigger,{"data-slot":`select-trigger`,className:(0,a.cn)(`flex w-full items-center justify-between`,`-outline-offset-1 outline-1 outline-border`,`gap-2 rounded bg-transparent px-3 py-2`,`rounded shadow-input transition-all`,`cursor-pointer whitespace-nowrap text-sm`,`focus-visible:text-text-positive-strong`,`focus-visible:outline-primary-strong`,`focus-visible:ring-4`,`focus-visible:ring-primary-weak`,`data-[state=open]:text-text-positive-muted`,`data-[state=open]:outline-primary-strong`,`data-[state=open]:ring-4`,`data-[state=open]:ring-primary-weak`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`aria-invalid:bg-danger-bg-subtle`,`aria-invalid:outline-danger`,`aria-invalid:ring-danger-weak`,`aria-invalid:focus:outline-danger-strong`,`aria-invalid:focus:ring-4`,`aria-invalid:placeholder:text-text-positive-weak`,`aria-invalid:data-[state=open]:outline-danger-strong`,`aria-invalid:data-[state=open]:ring-danger-weak`,`data-placeholder:text-text-positive-muted`,`*:data-[slot=select-value]:line-clamp-1`,`*:data-[slot=select-value]:flex`,`*:data-[slot=select-value]:items-center`,`*:data-[slot=select-value]:gap-2`,`aria-readonly:bg-muted-muted`,`aria-readonly:cursor-default`,`aria-readonly:focus:outline-none`,`aria-readonly:ring-0`,`aria-readonly:pointer-events-none`,`[&_svg]:shrink-0`,`[&_svg]:pointer-events-none`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-muted-foreground`,e),...n,children:[t,(0,o.jsx)(d.Select.Icon,{asChild:!0,children:(0,o.jsx)(s.ChevronDownIcon,{size:16,opacity:50})})]})}function le({className:e,children:t,position:n=`popper`,...r}){return(0,o.jsx)(d.Select.Portal,{"data-slot":`select-portal`,children:(0,o.jsxs)(d.Select.Content,{"data-slot":`select-content`,className:(0,a.cn)(`relative z-50 min-w-32 overflow-y-auto overflow-x-hidden rounded shadow-dropdown duration-300`,`bg-white`,`w-(--radix-select-trigger-width)`,`max-h-(--radix-select-content-available-height)`,`origin-(--radix-select-content-transform-origin)`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=open]:zoom-in-95`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`,`data-[state=closed]:zoom-out-95`,`data-[side=bottom]:slide-in-from-top-8`,`data-[side=left]:slide-in-from-right-8`,`data-[side=right]:slide-in-from-left-8`,`data-[side=top]:slide-in-from-bottom-8`,n===`popper`&&`data-[side=bottom]:translate-y-1`,n===`popper`&&`data-[side=left]:-translate-x-1`,n===`popper`&&`data-[side=right]:translate-x-1`,n===`popper`&&`data-[side=top]:-translate-y-1`,e),position:n,style:{maxHeight:`var(--radix-select-content-available-height)`},...r,children:[(0,o.jsx)(de,{}),(0,o.jsx)(d.Select.Viewport,{className:(0,a.cn)(`p-1`,n===`popper`&&`h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1`),children:t}),(0,o.jsx)(fe,{})]})})}function ue({className:e,children:t,...n}){return(0,o.jsxs)(d.Select.Item,{"data-slot":`select-item`,className:(0,a.cn)(`relative flex select-none items-center border border-transparent`,`gap-2 rounded py-2.5 pr-8 pl-2`,`w-full`,`cursor-pointer outline-none transition-colors`,`font-medium text-sm text-text-positive-weak`,`focus:border-border-weak`,`focus:bg-linear-to-b`,`focus:from-muted-bg-subtle`,`focus:to-muted-muted`,`data-disabled:opacity-50`,`data-disabled:pointer-events-none`,`[&_svg]:pointer-events-none`,`[&_svg]:shrink-0`,`[&_svg:not([class*='size-'])]:size-4`,`[&_svg:not([class*='text-'])]:text-text-positive-weak`,`*:[span]:last:flex`,`*:[span]:last:items-center`,`*:[span]:last:gap-2`,e),...n,children:[(0,o.jsx)(d.Select.ItemText,{children:t}),(0,o.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,o.jsx)(d.Select.ItemIndicator,{children:(0,o.jsx)(s.CheckIcon,{size:16})})})]})}function de({className:e,...t}){return(0,o.jsx)(d.Select.ScrollUpButton,{"data-slot":`select-scroll-up-button`,className:(0,a.cn)(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(s.ChevronUpIcon,{size:16})})}function fe({className:e,...t}){return(0,o.jsx)(d.Select.ScrollDownButton,{"data-slot":`select-scroll-down-button`,className:(0,a.cn)(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(s.ChevronDownIcon,{size:16})})}const pe=({label:e,description:t,placeholder:n,orientation:r=`responsive`,options:i,helperText:a,required:l=!1})=>{let u=Q(),d=(0,c.useMemo)(()=>u.state.meta.isTouched&&!u.state.meta.isValid,[u.state.meta.isTouched,u.state.meta.isValid]),f=(0,c.useMemo)(()=>l?u.state.value===null:!1,[l,u.state.value]),p=(0,c.useMemo)(()=>u.state.meta.errors,[u.state.meta.errors]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:r,"data-invalid":u.state.meta.isTouched&&!u.state.meta.isValid,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{htmlFor:u.name,"aria-required":f,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{className:`flex flex-col`,children:[(0,o.jsxs)(U,{defaultValue:u.state.value??void 0,onValueChange:u.handleChange,children:[(0,o.jsx)(G,{"aria-invalid":d?`true`:void 0,onBlur:u.handleBlur,children:(0,o.jsx)(W,{placeholder:n})}),(0,o.jsxs)(le,{children:[!!i.length&&i.map(e=>(0,o.jsx)(ue,{value:e.value,children:e.label},e.value)),!i.length&&(0,o.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,o.jsx)(s.PackagePlusIcon,{strokeWidth:1}),`No options available`]})]})]}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full flex-col items-end justify-end`,children:(0,o.jsx)(A,{errors:p})}),(0,o.jsx)(O,{isShow:!!a,children:a})]})]}),(0,o.jsx)(k,{})]})};function me({className:e,...t}){return(0,o.jsx)(d.Switch.Root,{"data-slot":`switch`,className:(0,a.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,o.jsx)(d.Switch.Thumb,{"data-slot":`switch-thumb`,className:(0,a.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 he=({label:e,description:t,helperText:n})=>{let r=Q();return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(E,{className:`cursor-pointer`,children:(0,o.jsx)(`label`,{htmlFor:r.name,children:e})}),(0,o.jsx)(D,{children:t}),(0,o.jsx)(me,{id:r.name,checked:r.state.value??!1,className:`absolute top-1 right-1`,onBlur:r.handleBlur,onCheckedChange:r.handleChange})]}),(0,o.jsx)(O,{isShow:!!n,children:n})]}),(0,o.jsx)(k,{})]})},ge=({label:e,description:t,placeholder:n,counter:r=!1,helperText:i,orientation:l=`responsive`,showClearButton:u=!1,showErrorMessage:d=!0,required:p=!1,maxLength:m})=>{let{form:h,name:g,state:_,handleBlur:v,handleChange:y}=Q(),b=(0,f.useStore)(h.store,({isSubmitting:e})=>e),E=(0,c.useMemo)(()=>u&&!b,[u,b]),j=(0,c.useMemo)(()=>_.value?_.value.length:0,[_.value]),M=(0,c.useMemo)(()=>{if(!r)return``;let e=`character${[0,1].includes(j)?``:`s`}`;return r&&m?`${j} / ${m} ${e}`:`${j} ${e}`},[j,r,m]),N=(0,c.useMemo)(()=>_.meta.isTouched&&!_.meta.isValid,[_.meta.isTouched,_.meta.isValid]),P=(0,c.useMemo)(()=>p?_.value===null:!1,[p,_.value]),F=(0,c.useCallback)(({target:{value:e}})=>{b||r&&m&&e.length>m||y(e||null)},[b,r,m,y]),I=(0,c.useCallback)(()=>{b||y(``)},[b,y]);return(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:l,"data-invalid":N,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{"aria-required":P,htmlFor:g,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(L,{id:g,name:g,value:_.value===null?``:_.value,"aria-invalid":N,autoComplete:`off`,placeholder:n,className:(0,a.cn)(b&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:v,onChange:F}),E&&!_.meta.errors.length&&(0,o.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:`absolute inset-y-0 end-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:I,children:(0,o.jsx)(s.XIcon,{size:14,"aria-hidden":`true`})}),b&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-muted-weak`,children:(0,o.jsx)(s.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),d&&!!_.meta.errors.length&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-danger-strong`,children:(0,o.jsx)(s.BanIcon,{size:14})}),(0,o.jsxs)(`div`,{className:`mt-1 flex w-full items-start justify-end *:basis-1/2`,children:[d&&(0,o.jsx)(A,{errors:_.meta.errors}),!!r&&(0,o.jsx)(`p`,{className:`text-end text-text-positive-weak text-xs tabular-nums leading-3.5`,children:M})]}),(0,o.jsx)(O,{isShow:!!i,children:i})]})]}),(0,o.jsx)(k,{})]})};function _e({className:e,onChange:t,onValueChange:n,...r}){let i=(0,c.useCallback)(e=>{t?.(e),n?.(e.target.value)},[t,n]);return(0,o.jsx)(`textarea`,{"data-slot":`textarea`,className:(0,a.cn)(`flex min-h-24 w-full bg-transparent px-3 py-2`,`rounded shadow-input transition-[color,box-shadow] duration-200`,`resize-y text-sm text-text-positive-weak tabular-nums caret-primary`,`-outline-offset-1 outline-1 outline-border`,`placeholder:text-text-positive-muted`,`focus:text-text-positive focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`read-only:pointer-events-none read-only:bg-muted-muted read-only:placeholder:text-text-positive-weak`,`aria-invalid:bg-danger-bg-subtle`,`aria-invalid:outline-danger`,`aria-invalid:ring-danger-weak`,`aria-invalid:focus:outline-danger-strong`,`aria-invalid:focus:ring-4`,`aria-invalid:placeholder:text-text-positive-weak`,`disabled:cursor-not-allowed disabled:opacity-50`,`disabled:pointer-events-none`,`disabled:border-border-weak/50 disabled:bg-secondary-muted/10`,e),...r,onChange:i})}const ve=({label:e,description:t,placeholder:n,orientation:r=`responsive`,counter:i,helperText:l,showErrorMessage:u=!0,required:d=!1,maxLength:p})=>{let{form:m,state:h,name:g,handleBlur:_,handleChange:v}=Q(),y=(0,f.useStore)(m.store,({isSubmitting:e})=>e),b=(0,c.useMemo)(()=>h.value?h.value.length:0,[h.value]),E=(0,c.useMemo)(()=>{if(!i)return``;let e=`character${[0,1].includes(b)?``:`s`}`;return i&&p?`${b} / ${p} ${e}`:`${b} ${e}`},[b,i,p]),j=(0,c.useMemo)(()=>h.meta.isTouched&&!h.meta.isValid,[h.meta.isTouched,h.meta.isValid]),M=(0,c.useMemo)(()=>h.meta.errors,[h.meta.errors]),N=(0,c.useMemo)(()=>d?h.value===null:!1,[d,h.value]),P=(0,c.useCallback)(({target:{value:e}})=>{y||i&&p&&e.length>p||v(e||null)},[y,i,p,v]);return(0,o.jsxs)(x,{className:`px-4`,children:[(0,o.jsxs)(S,{orientation:r,"data-invalid":j,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{"aria-required":N,htmlFor:g,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[(0,o.jsx)(_e,{id:g,name:g,value:h.value===null?``:h.value,"aria-invalid":j,autoComplete:`off`,placeholder:n,className:(0,a.cn)(y&&`pointer-events-none bg-muted-muted opacity-60`),onChange:P,onBlur:_}),y&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-muted-weak`,children:(0,o.jsx)(s.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),u&&!!M.length&&(0,o.jsx)(`div`,{className:`absolute inset-y-0 end-2 top-2.5 text-danger-strong`,children:(0,o.jsx)(s.BanIcon,{size:14})}),(0,o.jsxs)(`div`,{className:`mt-1 flex w-full items-start justify-end *:basis-1/2`,children:[u&&(0,o.jsx)(A,{errors:M}),!!i&&(0,o.jsx)(`p`,{className:`text-end text-text-positive-weak text-xs`,children:E})]}),(0,o.jsx)(O,{isShow:!!l,children:l})]})]}),(0,o.jsx)(k,{})]})},ye=({label:e,className:t})=>{let r=$(),i=(0,c.useCallback)(async()=>{await r.handleSubmit({submitAction:`submit`}),r.state.isSubmitSuccessful&&r.reset()},[r]);return(0,o.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:s})=>(0,o.jsx)(n.t,{type:`button`,size:`md`,disabled:r,isLoading:s,className:(0,a.cn)(`min-w-32`,t),onClick:i,children:e??`Submit`})})},be=({type:e=`create`})=>{let t=$();return(0,o.jsxs)(`div`,{className:`flex h-8 items-center justify-between`,children:[(0,o.jsx)(t.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(n.t,{color:`muted`,variant:`outline`,type:`button`,size:`md`,disabled:e,className:`h-full min-w-32`,onClick:()=>t.reset(),children:`Cancel`})}),e===`create`&&(0,o.jsx)(t.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,o.jsxs)(n.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await t.handleSubmit({submitAction:`create`}),t.state.isSubmitSuccessful&&t.reset()},children:[(0,o.jsx)(s.PlusIcon,{}),`Add New`]})}),e===`update`&&(0,o.jsx)(t.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,o.jsxs)(n.t,{type:`submit`,size:`md`,disabled:e,isLoading:r,className:`h-full min-w-32`,onClick:async()=>{await t.handleSubmit({submitAction:`update`}),t.state.isSubmitSuccessful&&t.reset()},children:[(0,o.jsx)(s.ArrowDownToLine,{}),`Update`]})})]})};function K({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,o.jsx)(d.Separator.Root,{"data-slot":`separator`,decorative:n,orientation:t,className:(0,a.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 xe=({title:e,description:t,children:n})=>(0,o.jsxs)(`section`,{"data-slot":`card-form`,className:`flex flex-col rounded-md bg-card pb-4 shadow-card ring-3 ring-border-muted`,children:[(0,o.jsxs)(`div`,{"data-slot":`card-form-header`,className:`flex flex-col space-y-1 p-4`,children:[(0,o.jsx)(`p`,{className:`font-semibold text-lg`,children:e}),!!t&&(0,o.jsx)(`p`,{className:`text-muted text-sm`,children:t})]}),(0,o.jsx)(K,{}),(0,o.jsx)(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:n})]}),Se=({children:e})=>(0,o.jsx)(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),q=({...e})=>(0,o.jsx)(`button`,{...e,type:`button`,style:{"corner-shape":`squircle`},className:`min-w-40 cursor-pointer rounded-xl border border-border bg-linear-to-b from-white/80 to-white px-4 py-2 font-semibold text-sm text-text-positive shadow-[0_2px_4px_var(--border)] 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:`Cancel`});function J({...e}){return(0,o.jsx)(d.Dialog.Root,{"data-slot":`dialog`,...e})}function Y({...e}){return(0,o.jsx)(d.Dialog.Portal,{"data-slot":`dialog-portal`,...e})}function Ce({className:e,...t}){return(0,o.jsx)(d.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,a.cn)(`fixed inset-0 z-50 bg-black/50`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,e),...t})}function we({className:e,children:t,showCloseButton:n=!0,...i}){return(0,o.jsxs)(Y,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(Ce,{className:`backdrop-blur-sm`}),(0,o.jsxs)(d.Dialog.Content,{"data-slot":`dialog-content`,className:(0,a.cn)(`relative z-50 grid bg-background`,`gap-4 p-6 shadow-dialog outline-none`,`max-h-[85dvh] w-full max-w-[calc(100%-2rem)] sm:max-w-lg`,`rounded-2xl duration-200`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in-0`,`data-[state=open]:zoom-in-80`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0`,`data-[state=closed]:zoom-out-80`,`-translate-x-1/2 -translate-y-1/2 fixed top-1/2 left-1/2`,e),...i,children:[t,n&&(0,o.jsx)(d.Dialog.Close,{"data-slot":`dialog-close`,tabIndex:-1,asChild:!0,className:`absolute top-3 right-3`,children:(0,o.jsx)(r.t,{})})]})]})}function Te({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`dialog-header`,className:(0,a.cn)(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Ee({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`dialog-footer`,className:(0,a.cn)(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function De({className:e,...t}){return(0,o.jsx)(d.Dialog.Title,{"data-slot":`dialog-title`,className:(0,a.cn)(`font-semibold text-lg text-text-positive-strong leading-none`,e),...t})}const X=({isSubmitting:e,...t})=>(0,o.jsx)(`button`,{...t,type:`button`,"data-loading":e?`true`:void 0,style:{"corner-shape":`squircle`},className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-xl border border-primary-strong bg-linear-to-b from-primary/60 to-primary px-4 py-2 font-semibold text-sm text-text-negative outline-none drop-shadow-[0_2px_4px_var(--primary)] 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,o.jsx)(s.Loader2,{size:16,strokeWidth:3,className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 z-10 animate-spin`}):`Submit`}),Oe=({title:e,open:t,onOpenChange:n,children:r})=>{let a=$(),s=(0,c.useCallback)(e=>{e||a.reset(),n?.(e)},[a.reset,n]);return(0,o.jsx)(J,{open:t,onOpenChange:s,children:(0,o.jsxs)(we,{className:`gap-0 rounded-sm p-0 sm:max-w-2xl`,children:[(0,o.jsx)(Te,{className:`flex items-center justify-center px-4 py-6`,children:(0,o.jsx)(De,{className:`font-medium`,children:e})}),(0,o.jsx)(i.t,{}),(0,o.jsx)(`div`,{className:`relative flex flex-col space-y-4 p-4 pt-6`,children:r}),(0,o.jsx)(i.t,{}),(0,o.jsxs)(Ee,{className:`justify-between! flex items-center px-6 py-4`,children:[(0,o.jsx)(a.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(q,{disabled:e,onClick:()=>{a.reset(),s(!1)}})}),(0,o.jsx)(a.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,o.jsx)(X,{isSubmitting:e,disabled:t})})]})]})})},ke=({title:e,open:t,onOpenChange:n,children:i})=>{let s=$();return(0,o.jsx)(J,{open:t,onOpenChange:n,children:(0,o.jsxs)(Y,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(d.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,a.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,o.jsx)(d.Dialog.Content,{"data-slot":`dialog-content`,className:(0,a.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,o.jsxs)(`section`,{className:`relative flex size-full flex-col`,children:[(0,o.jsx)(`header`,{className:`flex h-14 items-center border-border border-b px-4`,children:(0,o.jsx)(`h2`,{className:`font-semibold text-lg text-primary-strong`,children:e})}),(0,o.jsx)(`div`,{className:`flex-1 overflow-y-auto py-4`,children:i}),(0,o.jsxs)(`div`,{className:`flex flex-col space-y-4 border-border border-t px-4 py-2`,children:[(0,o.jsx)(s.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,o.jsx)(X,{isSubmitting:e,disabled:t,className:`w-full`})}),(0,o.jsx)(s.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(q,{disabled:e,className:`w-full`,onClick:()=>{s.reset(),n?.(!1)}})})]}),(0,o.jsx)(d.Dialog.Close,{asChild:!0,children:(0,o.jsx)(r.t,{className:`absolute top-2 right-2`})})]})})]})})},Z=({children:e})=>(0,o.jsx)(`header`,{"data-slot":`section-header`,className:`px-4 pt-2.5 pb-2 font-medium text-base text-primary-strong`,children:e}),Ae=({children:e})=>(0,o.jsx)(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),je=({title:e,children:t})=>(0,o.jsxs)(`section`,{"data-slot":`section-form`,className:`flex flex-col rounded-md bg-background shadow-card ring-3 ring-border-muted`,children:[(0,o.jsx)(Z,{children:e}),(0,o.jsx)(K,{}),(0,o.jsx)(Ae,{children:t})]}),Me=({title:e,description:t,helperText:n})=>(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{className:`gap-0`,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(b,{className:`mb-1`,children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsx)(O,{isShow:!!n,children:n})]}),(0,o.jsx)(k,{})]}),{fieldContext:Ne,formContext:Pe,useFieldContext:Q,useFormContext:$}=(0,f.createFormHookContexts)(),{useAppForm:Fe,withForm:Ie,withFieldGroup:Le}=(0,f.createFormHook)({fieldContext:Ne,formContext:Pe,fieldComponents:{TextField:ge,TextareaField:ve,NumberField:R,EmailField:ie,PasswordField:z,SelectField:pe,DateField:re,SwitchField:he,RadioGroupField:H,CheckboxField:j},formComponents:{TanStackDialogForm:Oe,TanStackPopoverForm:ke,TanStackContainerForm:Se,TanStackSectionForm:je,TanStackCardForm:xe,TanStackTitleField:Me,TanStackActionsForm:be,TanStackActionSubmit:ye}});exports.useTanStackFieldContext=Q,exports.useTanStackForm=Fe,exports.useTanStackFormContext=$,exports.withTanStackFieldGroup=Le,exports.withTanStackForm=Ie;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|