@customafk/lunas-ui 0.1.86 → 0.1.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/{button-D2qx5QHI.d.cts → button-DjqNWeLI.d.cts} +4 -4
  2. package/dist/{button-eheC-7Id.d.mts → button-VdupFKuy.d.mts} +4 -4
  3. package/dist/data-display/empty.d.cts +2 -2
  4. package/dist/data-display/empty.d.mts +2 -2
  5. package/dist/data-display/statistic.d.cts +2 -2
  6. package/dist/data-display/statistic.d.mts +2 -2
  7. package/dist/{dialog-T7CVHrm2.d.mts → dialog-NSWxAcg2.d.cts} +12 -12
  8. package/dist/{dialog-5imw84-8.d.cts → dialog-VmYg9Eq_.d.mts} +12 -12
  9. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +26 -26
  10. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
  11. package/dist/features/descriptions/index.cjs.map +1 -1
  12. package/dist/features/descriptions/index.d.cts +4 -4
  13. package/dist/features/descriptions/index.mjs.map +1 -1
  14. package/dist/features/search-modal/index.d.cts +2 -2
  15. package/dist/features/search-modal/index.d.mts +2 -2
  16. package/dist/features/tables/index.cjs +1 -1
  17. package/dist/features/tables/index.cjs.map +1 -1
  18. package/dist/features/tables/index.d.cts +10 -8
  19. package/dist/features/tables/index.d.mts +4 -2
  20. package/dist/features/tables/index.mjs +1 -1
  21. package/dist/features/tables/index.mjs.map +1 -1
  22. package/dist/features/tanstack-form/index.cjs +1 -1
  23. package/dist/features/tanstack-form/index.cjs.map +1 -1
  24. package/dist/features/tanstack-form/index.d.cts +54 -48
  25. package/dist/features/tanstack-form/index.d.mts +54 -48
  26. package/dist/features/tanstack-form/index.mjs +1 -1
  27. package/dist/features/tanstack-form/index.mjs.map +1 -1
  28. package/dist/{input-DhoSwu7d.mjs → input-CqN74taK.mjs} +2 -2
  29. package/dist/{input-DhoSwu7d.mjs.map → input-CqN74taK.mjs.map} +1 -1
  30. package/dist/{input-CbpWzuai.d.cts → input-DZh516vt.d.mts} +5 -5
  31. package/dist/{input-qnlHzDDm.cjs → input-dAoEznUI.cjs} +2 -2
  32. package/dist/{input-qnlHzDDm.cjs.map → input-dAoEznUI.cjs.map} +1 -1
  33. package/dist/{input-BYz8teIQ.d.mts → input-x9tCltJ_.d.cts} +5 -5
  34. package/dist/layouts/cms-layout/index.cjs +1 -1
  35. package/dist/layouts/cms-layout/index.mjs +1 -1
  36. package/dist/layouts/flex.d.cts +8 -8
  37. package/dist/layouts/flex.d.mts +6 -6
  38. package/dist/layouts/payment-layout/index.cjs +1 -1
  39. package/dist/layouts/payment-layout/index.mjs +1 -1
  40. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  41. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  42. package/dist/pages/FeatureFixing.d.cts +2 -2
  43. package/dist/pages/FeatureFixing.d.mts +2 -2
  44. package/dist/pages/NotAuthorized.d.cts +2 -2
  45. package/dist/pages/NotAuthorized.d.mts +2 -2
  46. package/dist/pages/NotFound.d.cts +2 -2
  47. package/dist/pages/NotFound.d.mts +2 -2
  48. package/dist/typography/paragraph.d.cts +2 -2
  49. package/dist/typography/paragraph.d.mts +2 -2
  50. package/dist/typography/title.d.cts +2 -2
  51. package/dist/typography/title.d.mts +2 -2
  52. package/dist/ui/alert-dialog.d.cts +12 -12
  53. package/dist/ui/alert-dialog.d.mts +12 -12
  54. package/dist/ui/alert.d.cts +6 -6
  55. package/dist/ui/alert.d.mts +6 -6
  56. package/dist/ui/aspect-ratio.d.cts +2 -2
  57. package/dist/ui/aspect-ratio.d.mts +2 -2
  58. package/dist/ui/avatar.d.cts +4 -4
  59. package/dist/ui/avatar.d.mts +4 -4
  60. package/dist/ui/badge.d.cts +4 -4
  61. package/dist/ui/badge.d.mts +4 -4
  62. package/dist/ui/breadcrumb.d.cts +8 -8
  63. package/dist/ui/breadcrumb.d.mts +8 -8
  64. package/dist/ui/button-group.d.cts +6 -6
  65. package/dist/ui/button-group.d.mts +6 -6
  66. package/dist/ui/button.d.cts +1 -1
  67. package/dist/ui/button.d.mts +1 -1
  68. package/dist/ui/calendar.d.cts +4 -4
  69. package/dist/ui/calendar.d.mts +4 -4
  70. package/dist/ui/card.d.cts +8 -8
  71. package/dist/ui/card.d.mts +8 -8
  72. package/dist/ui/carousel.d.cts +7 -7
  73. package/dist/ui/carousel.d.mts +7 -7
  74. package/dist/ui/checkbox.d.cts +2 -2
  75. package/dist/ui/checkbox.d.mts +2 -2
  76. package/dist/ui/collapsible.d.cts +4 -4
  77. package/dist/ui/collapsible.d.mts +4 -4
  78. package/dist/ui/command.d.cts +11 -11
  79. package/dist/ui/command.d.mts +11 -11
  80. package/dist/ui/context-menu.d.cts +16 -16
  81. package/dist/ui/context-menu.d.mts +16 -16
  82. package/dist/ui/dialog.d.cts +1 -1
  83. package/dist/ui/dialog.d.mts +1 -1
  84. package/dist/ui/drawer.d.cts +11 -11
  85. package/dist/ui/drawer.d.mts +11 -11
  86. package/dist/ui/dropdown-menu.d.cts +16 -16
  87. package/dist/ui/dropdown-menu.d.mts +16 -16
  88. package/dist/ui/empty.d.cts +9 -9
  89. package/dist/ui/empty.d.mts +9 -9
  90. package/dist/ui/field.d.cts +24 -24
  91. package/dist/ui/field.d.mts +24 -24
  92. package/dist/ui/file-uploader.d.cts +2 -2
  93. package/dist/ui/file-uploader.d.mts +2 -2
  94. package/dist/ui/form.d.cts +11 -11
  95. package/dist/ui/form.d.mts +11 -11
  96. package/dist/ui/hover-card.d.cts +4 -4
  97. package/dist/ui/hover-card.d.mts +4 -4
  98. package/dist/ui/input-otp.d.cts +5 -5
  99. package/dist/ui/input-otp.d.mts +5 -5
  100. package/dist/ui/input.cjs +1 -1
  101. package/dist/ui/input.d.cts +1 -1
  102. package/dist/ui/input.d.mts +1 -1
  103. package/dist/ui/input.mjs +1 -1
  104. package/dist/ui/inputs/search-input.cjs +1 -1
  105. package/dist/ui/inputs/search-input.d.cts +3 -3
  106. package/dist/ui/inputs/search-input.d.mts +3 -3
  107. package/dist/ui/inputs/search-input.mjs +1 -1
  108. package/dist/ui/item.d.cts +16 -16
  109. package/dist/ui/item.d.mts +16 -16
  110. package/dist/ui/label.d.cts +2 -2
  111. package/dist/ui/label.d.mts +2 -2
  112. package/dist/ui/menubar.d.cts +17 -17
  113. package/dist/ui/menubar.d.mts +17 -17
  114. package/dist/ui/multi-select.d.cts +2 -2
  115. package/dist/ui/multi-select.d.mts +3 -3
  116. package/dist/ui/navigation-menu.d.cts +11 -11
  117. package/dist/ui/navigation-menu.d.mts +11 -11
  118. package/dist/ui/pagination.d.cts +9 -9
  119. package/dist/ui/pagination.d.mts +9 -9
  120. package/dist/ui/popover.d.cts +5 -5
  121. package/dist/ui/popover.d.mts +5 -5
  122. package/dist/ui/progress.d.cts +2 -2
  123. package/dist/ui/progress.d.mts +2 -2
  124. package/dist/ui/radio-group.d.cts +3 -3
  125. package/dist/ui/radio-group.d.mts +3 -3
  126. package/dist/ui/resizable.d.cts +4 -4
  127. package/dist/ui/resizable.d.mts +4 -4
  128. package/dist/ui/scroll-area.d.cts +6 -6
  129. package/dist/ui/scroll-area.d.mts +6 -6
  130. package/dist/ui/select.d.cts +11 -11
  131. package/dist/ui/select.d.mts +11 -11
  132. package/dist/ui/separator.d.cts +2 -2
  133. package/dist/ui/separator.d.mts +2 -2
  134. package/dist/ui/sheet.d.cts +9 -9
  135. package/dist/ui/sheet.d.mts +9 -9
  136. package/dist/ui/sidebar.cjs +1 -1
  137. package/dist/ui/sidebar.d.cts +28 -28
  138. package/dist/ui/sidebar.d.mts +26 -26
  139. package/dist/ui/sidebar.mjs +1 -1
  140. package/dist/ui/skeleton.d.cts +2 -2
  141. package/dist/ui/skeleton.d.mts +2 -2
  142. package/dist/ui/slider.d.cts +2 -2
  143. package/dist/ui/slider.d.mts +2 -2
  144. package/dist/ui/sonner.d.cts +2 -2
  145. package/dist/ui/sonner.d.mts +2 -2
  146. package/dist/ui/spinner.d.cts +2 -2
  147. package/dist/ui/spinner.d.mts +2 -2
  148. package/dist/ui/switch.d.cts +2 -2
  149. package/dist/ui/switch.d.mts +2 -2
  150. package/dist/ui/table.d.cts +18 -18
  151. package/dist/ui/table.d.mts +18 -18
  152. package/dist/ui/tabs.d.cts +5 -5
  153. package/dist/ui/tabs.d.mts +5 -5
  154. package/dist/ui/textarea.d.cts +2 -2
  155. package/dist/ui/textarea.d.mts +2 -2
  156. package/dist/ui/toggle-group.d.cts +3 -3
  157. package/dist/ui/toggle-group.d.mts +3 -3
  158. package/dist/ui/toggle.d.cts +4 -4
  159. package/dist/ui/toggle.d.mts +4 -4
  160. package/dist/ui/tooltip.d.cts +5 -5
  161. package/dist/ui/tooltip.d.mts +5 -5
  162. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["UITableEmpty: React.FC","UITableBadgeDisplay: React.FC<{\n label: string | number | null | undefined;\n onClick?: () => void;\n onRemove?: () => void;\n}>","UITableBooleanDisplay: React.FC<{\n value: boolean | null | undefined;\n}>","UITableDateDisplay: React.FC<Props>","UITableDescriptionDisplay: React.FC<{ content: string | null | undefined | number }>","UITableMoreButton: React.FC<{\n items?: { id: string; label: string; onClick: (id: string) => void }[];\n onClick?: () => void;\n}>","UITableNameDisplay: React.FC<NameDisplayProps>","UITablePermalink: React.FC<{ href: string; label?: string }>","UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{ value: string }>>","UITableRemoveButton: React.FC<{\n title?: string;\n onClick?: () => void | Promise<void>;\n}>","options: Intl.NumberFormatOptions","UITableUserDataDisplay: React.FC<Props>","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>","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}>","UITableBody: React.FC<React.PropsWithChildren<React.ComponentProps<'tbody'> & { height: number }>>","UITableRow: React.FC<\n React.ComponentProps<'tr'> & {\n keyOfClickRow?: string;\n row: Row<any>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n\n onClickRow?: (rowIndex: number, rowId?: AnyEntity) => void;\n }\n>","UITableCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'td'> & {\n cell: Cell<unknown, unknown>;\n }\n >\n>","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}>","rows","UITableTooltipFilter: React.FC<React.ComponentProps<typeof Input>>","ActionButton: React.FC<React.PropsWithChildren<React.ComponentProps<'button'>>>","UITableTooltipActions: React.FC<{\n onCreate?: () => void;\n onRefresh?: () => void;\n onDownload?: () => void;\n}>","UITableTooltip: React.FC<React.PropsWithChildren>"],"sources":["../../../packages/components/features/tables/components/atoms/empty.tsx","../../../packages/components/features/tables/components/atoms/badge-display.tsx","../../../packages/components/features/tables/components/atoms/boolean-display.tsx","../../../packages/components/features/tables/components/atoms/date-display.tsx","../../../packages/components/features/tables/components/atoms/description-display.tsx","../../../packages/components/features/tables/components/atoms/more-button.tsx","../../../packages/components/features/tables/components/atoms/name-display.tsx","../../../packages/components/features/tables/components/atoms/permalink.tsx","../../../packages/components/features/tables/components/atoms/phone-number.tsx","../../../packages/components/features/tables/components/atoms/remove-button.tsx","../../../packages/components/features/tables/components/atoms/statistic.tsx","../../../packages/components/features/tables/components/atoms/user.tsx","../../../packages/components/features/tables/hooks/use-click-row.ts","../../../packages/components/features/tables/hooks/use-table-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 { MinusIcon } from 'lucide-react';\n\nexport const UITableEmpty: React.FC = () => {\n return (\n <div className=\"flex gap-0 text-text-positive-weak\">\n <MinusIcon size={16} />\n <MinusIcon size={16} />\n </div>\n );\n};\n","import { XIcon } from 'lucide-react';\n\nimport { UITableEmpty } from './empty';\n\nexport const UITableBadgeDisplay: React.FC<{\n label: string | number | null | undefined;\n onClick?: () => void;\n onRemove?: () => void;\n}> = ({ label, onClick, onRemove }) => {\n if (!label) return <UITableEmpty />;\n if (onRemove) {\n return (\n <div\n className=\"flex w-fit gap-x-0.5 rounded-full border border-border py-1 pr-2 pl-3 text-text-positive text-xs shadow-xs\"\n onClick={e => {\n onClick?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n {label}\n <button\n className=\"cursor-pointer text-text-positive-weak hover:text-text-positive-strong\"\n onClick={e => {\n onRemove?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <XIcon size={12} />\n </button>\n </div>\n );\n }\n return (\n <button\n className=\"w-fit rounded-full border border-border px-3 py-1 text-text-positive text-xs shadow-xs\"\n onClick={e => {\n onClick?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n {label}\n </button>\n );\n};\n","import { CheckIcon, XIcon } from 'lucide-react';\n\nimport { UITableEmpty } from './empty';\n\nexport const UITableBooleanDisplay: React.FC<{\n value: boolean | null | undefined;\n}> = ({ value }) => {\n if (value === null || value === undefined) return <UITableEmpty />;\n if (value === false) {\n return (\n <div className=\"text-danger-strong\">\n <XIcon />\n </div>\n );\n }\n return (\n <div className=\"text-success-strong\">\n <CheckIcon />\n </div>\n );\n};\n","import { Badge } from '@/components/ui/badge';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { DateDisplay } from '@/components/data-display/date';\nimport { UITableEmpty } from './empty';\n\ntype Props = {\n date: Date | string | number | null | undefined;\n};\nexport const UITableDateDisplay: React.FC<Props> = ({ date }) => {\n if (typeof date === 'undefined' || date === null) return <UITableEmpty />;\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 className='rounded'>\n <DateDisplay date={date} format=\"full\" showTime className=\"font-medium text-text-negative text-xs\" />\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { UITableEmpty } from './empty';\n\nexport const UITableDescriptionDisplay: React.FC<{ content: string | null | undefined | number }> = ({ content }) => {\n if (content === undefined || content === null) {\n return <UITableEmpty />;\n }\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"line-clamp-2 whitespace-pre-line break-all text-start text-[13px] text-text-positive-weak\">{content}</div>\n </TooltipTrigger>\n <TooltipContent align=\"start\" className=\"h-fit min-w-48 max-w-80 pt-4\">\n <div className=\"flex flex-col gap-y-2\">\n <p className=\"whitespace-pre-line text-wrap break-keep\">{content}</p>\n <p className=\"w-full text-end\">{content.toString().length} chars</p>\n </div>\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { MoreVerticalIcon } from 'lucide-react';\n\nimport { Button } from '@/components/ui/button';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';\n\nexport const UITableMoreButton: React.FC<{\n items?: { id: string; label: string; onClick: (id: string) => void }[];\n onClick?: () => void;\n}> = ({ items = [] }) => {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button size=\"sm\" variant=\"ghost\" color=\"secondary\" className=\"size-9 rounded-full\">\n <MoreVerticalIcon />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuGroup>\n {items.map(item => (\n <DropdownMenuItem key={item.id} className=\"px-3\" onSelect={() => item.onClick(item.id)}>\n {item.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { Paragraph } from '@/components/typography/paragraph';\nimport { UITableEmpty } from './empty';\n\ntype NameDisplayProps = {\n name?: string | null | undefined;\n};\n\nexport const UITableNameDisplay: React.FC<NameDisplayProps> = ({ name }) => {\n if (!name) return <UITableEmpty />;\n return (\n <Tooltip>\n <TooltipTrigger>\n <Paragraph variant=\"sm\" className=\"line-clamp-2 w-full truncate text-wrap pb-px text-start text-sm\">\n {name}\n </Paragraph>\n </TooltipTrigger>\n <TooltipContent align=\"start\" className=\"h-fit min-w-48 max-w-80 pt-4\">\n <div className=\"flex flex-col gap-y-2\">\n <p className=\"whitespace-pre-line text-wrap break-keep\">{name}</p>\n <p className=\"w-full text-end\">{name.length} chars</p>\n </div>\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { ExternalLinkIcon } from 'lucide-react';\n\nexport const UITablePermalink: React.FC<{ href: string; label?: string }> = ({ href, label }) => {\n return (\n <a href={href} target=\"_blank\" className=\"inline-flex items-center gap-1 truncate text-primary text-sm underline\" rel=\"noopener noreferrer\">\n <span>{label || href}</span>\n <ExternalLinkIcon size={14} />\n </a>\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 { useCallback } from 'react';\n\nimport { Trash2Icon } from 'lucide-react';\n\nimport { Button } from '@/components/ui/button';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nexport const UITableRemoveButton: React.FC<{\n title?: string;\n onClick?: () => void | Promise<void>;\n}> = ({ title, onClick }) => {\n const handleClick = useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n async e => {\n e.preventDefault();\n e.stopPropagation();\n await onClick?.();\n },\n [onClick]\n );\n return (\n <Tooltip>\n <TooltipTrigger>\n <Button type=\"button\" variant=\"ghost\" color=\"danger\" size=\"icon\" onClick={handleClick}>\n <Trash2Icon />\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n <p>{title || 'Remove item from list table'}</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';\nimport { UITableEmpty } from './empty';\n\nconst applyRounding = (num: number, precisionValue: number, roundingMode?: 'round' | 'floor' | 'ceil') => {\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\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 | null | undefined;\n};\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 = 0,\n }: Props) => {\n // Memoize number formatting options\n const formatOptions = useMemo((): Intl.NumberFormatOptions => {\n const options: Intl.NumberFormatOptions = {};\n\n if (typeof precision === 'number' && precision >= 0 && showTrailingZeros) {\n options.minimumFractionDigits = precision;\n options.maximumFractionDigits = precision;\n } else {\n options.maximumFractionDigits = precision;\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, roundingMode);\n }\n\n return processedNum.toLocaleString('en-US', formatOptions);\n },\n [roundingMode, 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 if (finalFormattedValue === '0' || finalFormattedValue === 'N/A' || !finalFormattedValue) {\n return <UITableEmpty />;\n }\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 | null | undefined;\n username?: string | null | undefined;\n email?: string | null | undefined;\n};\n\nexport const UITableUserDataDisplay: React.FC<Props> = ({ uuid, username, email }) => {\n return (\n <Flex wrap={false} gap=\"sm\" padding=\"none\">\n {!uuid && (\n <Avatar className=\"size-10 shadow-card\">\n <AvatarFallback className=\"bg-muted-weak\">\n <UserRoundIcon size={28} className=\"text-text-negative\" />\n </AvatarFallback>\n </Avatar>\n )}\n {uuid && (\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 )}\n <Flex vertical padding=\"none\" gap=\"none\" align=\"start\">\n <Paragraph className=\"font-medium text-sm text-text-positive-weak\">{username ?? 'Unknown User'}</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","import { createContext, use } from 'react';\n\nimport type { RowData } from '@tanstack/react-table';\n\nimport type { TTableClickRow } from '../types';\n\nexport const TableClickRowContext = createContext<TTableClickRow<RowData> | null>(null);\n\nexport const useUITableClickRowContext = () => {\n const context = use(TableClickRowContext);\n if (!context) {\n throw new Error('useUITableClickRowContext must be used within a TableClickRowProvider');\n }\n return context;\n};\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","'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, LoaderIcon, 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 { AnyEntity } from '@/types';\nimport { useUITableClickRowContext } from '../hooks/use-click-row';\nimport { useUITableContext } from '../hooks/use-table-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-[13px] text-text-positive-weak',\n '[&_tr:not(:last-child)_td]:border-b',\n '[&_th]:flex',\n '[&_th]:h-9',\n '[&_th]:select-none',\n '[&_th]:items-center',\n '[&_th]:whitespace-nowrap',\n '[&_th]:border-border',\n '[&_th]:font-medium',\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={cn(isPinned ? 'sticky' : '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\n data-slot=\"table-header-cell\"\n data-pinned={isPinned}\n style={{ ...style, width }}\n colSpan={header.colSpan}\n className={cn('group relative', isPinned ? 'sticky' : 'relative')}\n {...props}\n >\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 bg-card',\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 keyOfClickRow?: string;\n row: Row<any>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n\n onClickRow?: (rowIndex: number, rowId?: AnyEntity) => void;\n }\n> = memo(({ children, keyOfClickRow, row, virtualRow, rowVirtualizer, onClickRow, className, ...props }) => {\n const { columnPinning: _ } = useUITableContext();\n const handleClick = useCallback<React.MouseEventHandler<HTMLTableRowElement>>(\n e => {\n const value = keyOfClickRow ? row.original?.[keyOfClickRow] : undefined;\n if (typeof value === 'string' || typeof value === 'number') {\n onClickRow?.(virtualRow.index, value);\n } else {\n onClickRow?.(virtualRow.index);\n }\n e.preventDefault();\n e.stopPropagation();\n },\n [keyOfClickRow, onClickRow, row.original, virtualRow.index]\n );\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 onClick={handleClick}\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\n const position = ((cell.column.columnDef.meta as any)?.position ?? 'start') as unknown as 'start' | 'center' | 'end';\n\n if (cell.column.id === 'select') {\n return (\n <td\n data-slot=\"table-cell\"\n style={{ ...style, width: SELECT_WIDTH }}\n className={cn('border-none! bg-transparent! shadow-none!', isPinned ? 'sticky' : 'relative', className)}\n {...props}\n >\n <div data-slot=\"table-cell-inner\" className=\"inline-flex w-full items-center justify-center bg-transparent text-center align-middle\">\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!', isPinned && 'sticky', !isPinned && 'relative', className)}\n {...props}\n >\n <div\n data-slot=\"table-cell-inner\"\n className={cn(\n 'inline-flex w-full items-center bg-transparent text-center align-middle',\n position === 'start' && 'justify-start',\n position === 'center' && 'justify-center',\n position === 'end' && 'justify-end'\n )}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </div>\n </td>\n );\n});\nUITableCell.displayName = 'TableCell';\n\nconst EmptyDisplay = memo(() => {\n return (\n <div className=\"sticky left-0 flex min-h-96 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});\nEmptyDisplay.displayName = 'EmptyDisplay';\n\nconst RefetchingDisplay = memo(() => {\n return (\n <div className=\"absolute top-0 z-30 flex size-full items-center justify-center bg-black/10\">\n <LoaderIcon className=\"animate-spin text-text-positive\" />\n </div>\n );\n});\nRefetchingDisplay.displayName = 'RefetchingDisplay';\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, isRefetching, isFetching, data, totalRows, fetchMoreData } = useUITableContext();\n const { keyOfClickRow, onClickRow } = useUITableClickRowContext();\n\n const tableContainerRef = useRef<HTMLDivElement | 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 //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?: HTMLDivElement | 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 && data.length < totalRows) {\n fetchMoreData?.();\n }\n },\n [isFetching, data.length, 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(tableContainerRef.current);\n }, [fetchMoreOnButtonReached]);\n\n const { rows } = table.getRowModel();\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: rows.length,\n estimateSize: () => 40, // estimated row height\n getScrollElement: () => tableContainerRef.current,\n //measure dynamic row height, except in firefox because it measures table border height incorrectly\n measureElement:\n typeof window !== 'undefined' && navigator.userAgent.indexOf('Firefox') === -1 ? element => element?.getBoundingClientRect().height : undefined,\n overscan: 2, // Render additional rows beyond viewport for smoother scrolling\n });\n\n return (\n <ResizablePanelGroup\n direction=\"horizontal\"\n style={{ direction: table.options.columnResizeDirection }}\n className={cn(\n '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 !children && 'border-r border-r-border'\n )}\n >\n <ResizablePanel className=\"relative overflow-auto\">\n <div\n ref={tableContainerRef}\n className=\"relative size-full overflow-auto border-b border-b-border border-l border-l-border\"\n onScroll={e => fetchMoreOnButtonReached(e.currentTarget)}\n >\n <table\n data-slot=\"table\"\n style={{\n ...columnSizeVars,\n width: table.getTotalSize(),\n }}\n className=\"grid w-full max-w-full caption-bottom border-collapse border-spacing-0 flex-col content-start 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 (\n <UITableRow\n data-index={virtualRow.index}\n key={row.id}\n keyOfClickRow={keyOfClickRow}\n row={row}\n virtualRow={virtualRow}\n rowVirtualizer={rowVirtualizer}\n onClickRow={onClickRow}\n />\n );\n })}\n </UITableBody>\n </table>\n {isEmpty && <EmptyDisplay />}\n </div>\n {isRefetching && <RefetchingDisplay />}\n </ResizablePanel>\n {!!children && (\n <>\n <ResizableHandle />\n {children}\n </>\n )}\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, RowData, RowSelectionState, VisibilityState } from '@tanstack/react-table';\nimport { getCoreRowModel, useReactTable } from '@tanstack/react-table';\n\nimport { TableClickRowContext } from '../../hooks/use-click-row';\nimport { TableContext } from '../../hooks/use-table-context';\nimport type { TableProviderProps, TTableClickRow, TTableContext } from '../../types';\n\nexport const UITableProvider = <TData extends RowData, TKey extends keyof TData>({\n title,\n\n isFetching = false,\n isRefetching = false,\n\n data,\n columns,\n totalRows,\n\n leftPinnedColumns,\n rightPinnedColumns,\n\n keyOfClickRow,\n onClickRow,\n\n fetchMoreData,\n children,\n}: React.PropsWithChildren<TableProviderProps<TData, TKey>>) => {\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({ right: rightPinnedColumns, left: leftPinnedColumns });\n const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});\n\n const table = useReactTable<TData>({\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 enableColumnPinning: true,\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 const { rows } = table.getRowModel();\n return rows;\n }, [table.getRowModel().rows, table.getState().columnPinning]);\n\n const isEmpty = useMemo<boolean>(() => {\n return !isFetching && rows.length === 0;\n }, [rows, isFetching]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: table get state\n const value = useMemo<TTableContext<TData>>(\n () => ({\n title,\n table,\n data,\n\n isEmpty,\n isFetching,\n isRefetching,\n\n totalRows,\n\n fetchMoreData,\n\n rowSelection: table.getState().rowSelection,\n columnPinning: table.getState().columnPinning,\n }),\n [\n title,\n table,\n data,\n\n isEmpty,\n isRefetching,\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 const clickRowValue = useMemo(\n () => ({\n keyOfClickRow,\n onClickRow,\n }),\n [keyOfClickRow, onClickRow]\n );\n\n return (\n <TableContext.Provider value={value as TTableContext<unknown>}>\n <TableClickRowContext.Provider value={clickRowValue as TTableClickRow<unknown>}>{children}</TableClickRowContext.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<React.ComponentProps<'button'>>> = ({ children, onClick }) => {\n return (\n <button\n type=\"button\"\n 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 onClick={onClick}\n >\n {children}\n </button>\n );\n};\n\nexport const UITableTooltipActions: React.FC<{\n onCreate?: () => void;\n onRefresh?: () => void;\n onDownload?: () => void;\n}> = ({ onCreate, onDownload, onRefresh }) => {\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 onClick={e => {\n onCreate?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <CirclePlus />\n </ActionButton>\n <ActionButton\n onClick={e => {\n onRefresh?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <RefreshCwIcon />\n </ActionButton>\n <ActionButton\n onClick={e => {\n onDownload?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\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":"okDAEA,MAAaA,MAET,EAAC,MAAA,CAAI,UAAU,+CACb,EAAC,EAAA,CAAU,KAAM,GAAA,CAAM,CACvB,EAAC,EAAA,CAAU,KAAM,GAAA,CAAM,CAAA,EACnB,CCHGC,IAIP,CAAE,QAAO,UAAS,cACjB,EACD,EAEA,EAAC,MAAA,CACC,UAAU,6GACV,QAAS,GAAK,CACZ,KAAW,CACX,EAAE,iBAAiB,CACnB,EAAE,gBAAgB,YAGnB,EACD,EAAC,SAAA,CACC,UAAU,yEACV,QAAS,GAAK,CACZ,KAAY,CACZ,EAAE,iBAAiB,CACnB,EAAE,gBAAgB,WAGpB,EAAC,EAAA,CAAM,KAAM,GAAA,CAAM,EACZ,CAAA,EACL,CAIR,EAAC,SAAA,CACC,UAAU,yFACV,QAAS,GAAK,CACZ,KAAW,CACX,EAAE,iBAAiB,CACnB,EAAE,gBAAgB,WAGnB,GACM,CAnCQ,EAAC,EAAA,EAAA,CAAe,CCLxBC,IAEP,CAAE,WACF,GAAU,KAAoC,EAAC,EAAA,EAAA,CAAe,CAC9D,IAAU,GAEV,EAAC,MAAA,CAAI,UAAU,8BACb,EAAC,EAAA,EAAA,CAAQ,EACL,CAIR,EAAC,MAAA,CAAI,UAAU,+BACb,EAAC,GAAA,EAAA,CAAY,EACT,CCTGC,IAAuC,CAAE,UACzC,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,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":["UITableEmpty: React.FC","UITableBadgeDisplay: React.FC<{\n label: string | number | null | undefined;\n onClick?: () => void;\n onRemove?: () => void;\n}>","UITableBooleanDisplay: React.FC<{\n value: boolean | null | undefined;\n}>","UITableDateDisplay: React.FC<Props>","UITableDescriptionDisplay: React.FC<{ content: string | null | undefined | number }>","UITableMoreButton: React.FC<{\n items?: { id: string; label: string; onClick: (id: string) => void }[];\n onClick?: () => void;\n}>","UITableNameDisplay: React.FC<NameDisplayProps>","UITablePermalink: React.FC<{ href: string; label?: string }>","UITablePhoneNumberDisplay: React.FC<React.PropsWithChildren<{ value: string }>>","UITableRemoveButton: React.FC<{\n title?: string;\n onClick?: () => void | Promise<void>;\n}>","options: Intl.NumberFormatOptions","UITableUserDataDisplay: React.FC<Props>","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>","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}>","UITableBody: React.FC<React.PropsWithChildren<React.ComponentProps<'tbody'> & { height: number }>>","UITableRow: React.FC<\n React.ComponentProps<'tr'> & {\n keyOfClickRow?: string;\n row: Row<any>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n\n onClickRow?: (rowIndex: number, rowId?: AnyEntity) => void;\n }\n>","UITableCell: React.FC<\n React.PropsWithChildren<\n React.ComponentProps<'td'> & {\n cell: Cell<unknown, unknown>;\n }\n >\n>","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}>","rows","UITableTooltipFilter: React.FC<\n Omit<React.ComponentProps<typeof Input>, 'className'> & {\n onSearch?: (value: string) => void;\n }\n>","ActionButton: React.FC<React.PropsWithChildren<React.ComponentProps<'button'>>>","UITableTooltipActions: React.FC<{\n onCreate?: () => void;\n onRefresh?: () => void;\n onDownload?: () => void;\n}>","UITableTooltip: React.FC<React.PropsWithChildren>"],"sources":["../../../packages/components/features/tables/components/atoms/empty.tsx","../../../packages/components/features/tables/components/atoms/badge-display.tsx","../../../packages/components/features/tables/components/atoms/boolean-display.tsx","../../../packages/components/features/tables/components/atoms/date-display.tsx","../../../packages/components/features/tables/components/atoms/description-display.tsx","../../../packages/components/features/tables/components/atoms/more-button.tsx","../../../packages/components/features/tables/components/atoms/name-display.tsx","../../../packages/components/features/tables/components/atoms/permalink.tsx","../../../packages/components/features/tables/components/atoms/phone-number.tsx","../../../packages/components/features/tables/components/atoms/remove-button.tsx","../../../packages/components/features/tables/components/atoms/statistic.tsx","../../../packages/components/features/tables/components/atoms/user.tsx","../../../packages/components/features/tables/hooks/use-click-row.ts","../../../packages/components/features/tables/hooks/use-table-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 { MinusIcon } from 'lucide-react';\n\nexport const UITableEmpty: React.FC = () => {\n return (\n <div className=\"flex gap-0 text-text-positive-weak\">\n <MinusIcon size={16} />\n <MinusIcon size={16} />\n </div>\n );\n};\n","import { XIcon } from 'lucide-react';\n\nimport { UITableEmpty } from './empty';\n\nexport const UITableBadgeDisplay: React.FC<{\n label: string | number | null | undefined;\n onClick?: () => void;\n onRemove?: () => void;\n}> = ({ label, onClick, onRemove }) => {\n if (!label) return <UITableEmpty />;\n if (onRemove) {\n return (\n <div\n className=\"flex w-fit gap-x-0.5 rounded-full border border-border py-1 pr-2 pl-3 text-text-positive text-xs shadow-xs\"\n onClick={e => {\n onClick?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n {label}\n <button\n className=\"cursor-pointer text-text-positive-weak hover:text-text-positive-strong\"\n onClick={e => {\n onRemove?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <XIcon size={12} />\n </button>\n </div>\n );\n }\n return (\n <button\n className=\"w-fit rounded-full border border-border px-3 py-1 text-text-positive text-xs shadow-xs\"\n onClick={e => {\n onClick?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n {label}\n </button>\n );\n};\n","import { CheckIcon, XIcon } from 'lucide-react';\n\nimport { UITableEmpty } from './empty';\n\nexport const UITableBooleanDisplay: React.FC<{\n value: boolean | null | undefined;\n}> = ({ value }) => {\n if (value === null || value === undefined) return <UITableEmpty />;\n if (value === false) {\n return (\n <div className=\"text-danger-strong\">\n <XIcon />\n </div>\n );\n }\n return (\n <div className=\"text-success-strong\">\n <CheckIcon />\n </div>\n );\n};\n","import { Badge } from '@/components/ui/badge';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { DateDisplay } from '@/components/data-display/date';\nimport { UITableEmpty } from './empty';\n\ntype Props = {\n date: Date | string | number | null | undefined;\n};\nexport const UITableDateDisplay: React.FC<Props> = ({ date }) => {\n if (typeof date === 'undefined' || date === null) return <UITableEmpty />;\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 className=\"rounded\">\n <DateDisplay date={date} format=\"full\" showTime className=\"font-medium text-text-negative text-xs\" />\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { UITableEmpty } from './empty';\n\nexport const UITableDescriptionDisplay: React.FC<{ content: string | null | undefined | number }> = ({ content }) => {\n if (content === undefined || content === null) {\n return <UITableEmpty />;\n }\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"line-clamp-2 whitespace-pre-line break-all text-start text-[13px] text-text-positive-weak\">{content}</div>\n </TooltipTrigger>\n <TooltipContent align=\"start\" className=\"h-fit min-w-48 max-w-80 pt-4\">\n <div className=\"flex flex-col gap-y-2\">\n <p className=\"whitespace-pre-line text-wrap break-keep\">{content}</p>\n <p className=\"w-full text-end\">{content.toString().length} chars</p>\n </div>\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { MoreVerticalIcon } from 'lucide-react';\n\nimport { Button } from '@/components/ui/button';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';\n\nexport const UITableMoreButton: React.FC<{\n items?: { id: string; label: string; onClick: (id: string) => void }[];\n onClick?: () => void;\n}> = ({ items = [] }) => {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button size=\"sm\" variant=\"ghost\" color=\"secondary\" className=\"size-9 rounded-full\">\n <MoreVerticalIcon />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuGroup>\n {items.map(item => (\n <DropdownMenuItem key={item.id} className=\"px-3\" onSelect={() => item.onClick(item.id)}>\n {item.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n","import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { Paragraph } from '@/components/typography/paragraph';\nimport { UITableEmpty } from './empty';\n\ntype NameDisplayProps = {\n name?: string | null | undefined;\n};\n\nexport const UITableNameDisplay: React.FC<NameDisplayProps> = ({ name }) => {\n if (!name) return <UITableEmpty />;\n return (\n <Tooltip>\n <TooltipTrigger>\n <Paragraph variant=\"sm\" className=\"line-clamp-2 w-full truncate text-wrap pb-px text-start text-sm\">\n {name}\n </Paragraph>\n </TooltipTrigger>\n <TooltipContent align=\"start\" className=\"h-fit min-w-48 max-w-80 pt-4\">\n <div className=\"flex flex-col gap-y-2\">\n <p className=\"whitespace-pre-line text-wrap break-keep\">{name}</p>\n <p className=\"w-full text-end\">{name.length} chars</p>\n </div>\n </TooltipContent>\n </Tooltip>\n );\n};\n","import { ExternalLinkIcon } from 'lucide-react';\n\nexport const UITablePermalink: React.FC<{ href: string; label?: string }> = ({ href, label }) => {\n return (\n <a href={href} target=\"_blank\" className=\"inline-flex items-center gap-1 truncate text-primary text-sm underline\" rel=\"noopener noreferrer\">\n <span>{label || href}</span>\n <ExternalLinkIcon size={14} />\n </a>\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 { useCallback } from 'react';\n\nimport { Trash2Icon } from 'lucide-react';\n\nimport { Button } from '@/components/ui/button';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nexport const UITableRemoveButton: React.FC<{\n title?: string;\n onClick?: () => void | Promise<void>;\n}> = ({ title, onClick }) => {\n const handleClick = useCallback<React.MouseEventHandler<HTMLButtonElement>>(\n async e => {\n e.preventDefault();\n e.stopPropagation();\n await onClick?.();\n },\n [onClick]\n );\n return (\n <Tooltip>\n <TooltipTrigger>\n <Button type=\"button\" variant=\"ghost\" color=\"danger\" size=\"icon\" onClick={handleClick}>\n <Trash2Icon />\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n <p>{title || 'Remove item from list table'}</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';\nimport { UITableEmpty } from './empty';\n\nconst applyRounding = (num: number, precisionValue: number, roundingMode?: 'round' | 'floor' | 'ceil') => {\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\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 | null | undefined;\n};\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 = 0,\n }: Props) => {\n // Memoize number formatting options\n const formatOptions = useMemo((): Intl.NumberFormatOptions => {\n const options: Intl.NumberFormatOptions = {};\n\n if (typeof precision === 'number' && precision >= 0 && showTrailingZeros) {\n options.minimumFractionDigits = precision;\n options.maximumFractionDigits = precision;\n } else {\n options.maximumFractionDigits = precision;\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, roundingMode);\n }\n\n return processedNum.toLocaleString('en-US', formatOptions);\n },\n [roundingMode, 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 if (finalFormattedValue === '0' || finalFormattedValue === 'N/A' || !finalFormattedValue) {\n return <UITableEmpty />;\n }\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 | null | undefined;\n username?: string | null | undefined;\n email?: string | null | undefined;\n};\n\nexport const UITableUserDataDisplay: React.FC<Props> = ({ uuid, username, email }) => {\n return (\n <Flex wrap={false} gap=\"sm\" padding=\"none\">\n {!uuid && (\n <Avatar className=\"size-10 shadow-card\">\n <AvatarFallback className=\"bg-muted-weak\">\n <UserRoundIcon size={28} className=\"text-text-negative\" />\n </AvatarFallback>\n </Avatar>\n )}\n {uuid && (\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 )}\n <Flex vertical padding=\"none\" gap=\"none\" align=\"start\">\n <Paragraph className=\"font-medium text-sm text-text-positive-weak\">{username ?? 'Unknown User'}</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","import { createContext, use } from 'react';\n\nimport type { RowData } from '@tanstack/react-table';\n\nimport type { TTableClickRow } from '../types';\n\nexport const TableClickRowContext = createContext<TTableClickRow<RowData> | null>(null);\n\nexport const useUITableClickRowContext = () => {\n const context = use(TableClickRowContext);\n if (!context) {\n throw new Error('useUITableClickRowContext must be used within a TableClickRowProvider');\n }\n return context;\n};\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","'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, LoaderIcon, 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 { AnyEntity } from '@/types';\nimport { useUITableClickRowContext } from '../hooks/use-click-row';\nimport { useUITableContext } from '../hooks/use-table-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-[13px] text-text-positive-weak',\n '[&_tr:not(:last-child)_td]:border-b',\n '[&_th]:flex',\n '[&_th]:h-9',\n '[&_th]:select-none',\n '[&_th]:items-center',\n '[&_th]:whitespace-nowrap',\n '[&_th]:border-border',\n '[&_th]:font-medium',\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=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 leftHeaderGroups = header.getContext().table.getLeftHeaderGroups()[0].headers;\n const rightHeaderGroups = header.getContext().table.getRightHeaderGroups()[0].headers;\n const lastColumnId = leftHeaderGroups[leftHeaderGroups.length - 1]?.id;\n const firstColumnId = rightHeaderGroups[0]?.id;\n\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={cn(isPinned ? 'sticky' : '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\n data-slot=\"table-header-cell\"\n data-pinned={isPinned}\n style={{ ...style, width }}\n colSpan={header.colSpan}\n className={cn(\n 'group relative',\n isPinned ? 'sticky' : 'relative',\n isPinned === 'left' && header.id === lastColumnId && 'border-r border-r-border',\n isPinned === 'right' && header.id === firstColumnId && 'border-l border-l-border'\n )}\n {...props}\n >\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 bg-card',\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 keyOfClickRow?: string;\n row: Row<any>;\n virtualRow: VirtualItem;\n rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n\n onClickRow?: (rowIndex: number, rowId?: AnyEntity) => void;\n }\n> = memo(({ children, keyOfClickRow, row, virtualRow, rowVirtualizer, onClickRow, className, ...props }) => {\n const { columnPinning: _ } = useUITableContext();\n const handleClick = useCallback<React.MouseEventHandler<HTMLTableRowElement>>(\n e => {\n const value = keyOfClickRow ? row.original?.[keyOfClickRow] : undefined;\n if (typeof value === 'string' || typeof value === 'number') {\n onClickRow?.(virtualRow.index, value);\n } else {\n onClickRow?.(virtualRow.index);\n }\n e.preventDefault();\n e.stopPropagation();\n },\n [keyOfClickRow, onClickRow, row.original, virtualRow.index]\n );\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 onClick={handleClick}\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\n const leftHeaderGroups = cell.getContext().table.getLeftHeaderGroups()[0].headers;\n const rightHeaderGroups = cell.getContext().table.getRightHeaderGroups()[0].headers;\n const lastColumnId = leftHeaderGroups[leftHeaderGroups.length - 1]?.id;\n const firstColumnId = rightHeaderGroups[0]?.id;\n\n const style = getCommonPinningStyles(cell.column);\n const width = `calc(var(--col-${cell.column.id}-size) * 1px)`;\n\n const position = ((cell.column.columnDef.meta as any)?.position ?? 'start') as unknown as 'start' | 'center' | 'end';\n\n if (cell.column.id === 'select') {\n return (\n <td\n data-slot=\"table-cell\"\n style={{ ...style, width: SELECT_WIDTH }}\n className={cn('border-none! bg-transparent! shadow-none!', isPinned ? 'sticky' : 'relative', className)}\n {...props}\n >\n <div data-slot=\"table-cell-inner\" className=\"inline-flex w-full items-center justify-center bg-transparent text-center align-middle\">\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(\n isPinned && 'sticky',\n !isPinned && 'relative',\n isPinned === 'left' && cell.column.id === lastColumnId && 'border-r border-r-border',\n isPinned === 'right' && cell.column.id === firstColumnId && 'border-l border-l-border',\n className\n )}\n {...props}\n >\n <div\n data-slot=\"table-cell-inner\"\n className={cn(\n 'inline-flex w-full items-center bg-transparent text-center align-middle',\n position === 'start' && 'justify-start',\n position === 'center' && 'justify-center',\n position === 'end' && 'justify-end'\n )}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </div>\n </td>\n );\n});\nUITableCell.displayName = 'TableCell';\n\nconst EmptyDisplay = memo(() => {\n return (\n <div className=\"sticky left-0 flex min-h-96 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});\nEmptyDisplay.displayName = 'EmptyDisplay';\n\nconst RefetchingDisplay = memo(() => {\n return (\n <div className=\"absolute top-0 z-30 flex size-full items-center justify-center bg-black/10\">\n <LoaderIcon className=\"animate-spin text-text-positive\" />\n </div>\n );\n});\nRefetchingDisplay.displayName = 'RefetchingDisplay';\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, isRefetching, isFetching, data, totalRows, fetchMoreData } = useUITableContext();\n const { keyOfClickRow, onClickRow } = useUITableClickRowContext();\n\n const tableContainerRef = useRef<HTMLDivElement | 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 //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?: HTMLDivElement | 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 && data.length < totalRows) {\n fetchMoreData?.();\n }\n },\n [isFetching, data.length, 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(tableContainerRef.current);\n }, [fetchMoreOnButtonReached]);\n\n const { rows } = table.getRowModel();\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: rows.length,\n estimateSize: () => 40, // estimated row height\n getScrollElement: () => tableContainerRef.current,\n //measure dynamic row height, except in firefox because it measures table border height incorrectly\n measureElement:\n typeof window !== 'undefined' && navigator.userAgent.indexOf('Firefox') === -1 ? element => element?.getBoundingClientRect().height : undefined,\n overscan: 2, // Render additional rows beyond viewport for smoother scrolling\n });\n\n return (\n <ResizablePanelGroup\n direction=\"horizontal\"\n style={{ direction: table.options.columnResizeDirection }}\n className={cn(\n '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 !children && 'border-r border-r-border'\n )}\n >\n <ResizablePanel className=\"relative overflow-auto\">\n <div\n ref={tableContainerRef}\n className=\"relative size-full overflow-auto border-b border-b-border border-l border-l-border\"\n onScroll={e => fetchMoreOnButtonReached(e.currentTarget)}\n >\n <table\n data-slot=\"table\"\n style={{\n ...columnSizeVars,\n width: table.getTotalSize(),\n }}\n className=\"grid w-full max-w-full caption-bottom border-collapse border-spacing-0 flex-col content-start 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 (\n <UITableRow\n data-index={virtualRow.index}\n key={row.id}\n keyOfClickRow={keyOfClickRow}\n row={row}\n virtualRow={virtualRow}\n rowVirtualizer={rowVirtualizer}\n onClickRow={onClickRow}\n />\n );\n })}\n </UITableBody>\n </table>\n {isEmpty && <EmptyDisplay />}\n </div>\n {isRefetching && <RefetchingDisplay />}\n </ResizablePanel>\n {!!children && (\n <>\n <ResizableHandle />\n {children}\n </>\n )}\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, RowData, RowSelectionState, VisibilityState } from '@tanstack/react-table';\nimport { getCoreRowModel, getExpandedRowModel, getGroupedRowModel, useReactTable } from '@tanstack/react-table';\n\nimport { TableClickRowContext } from '../../hooks/use-click-row';\nimport { TableContext } from '../../hooks/use-table-context';\nimport type { TableProviderProps, TTableClickRow, TTableContext } from '../../types';\n\nexport const UITableProvider = <TData extends RowData, TKey extends keyof TData>({\n title,\n\n isFetching = false,\n isRefetching = false,\n\n data,\n columns,\n totalRows,\n\n leftPinnedColumns,\n rightPinnedColumns,\n\n keyOfClickRow,\n onClickRow,\n\n fetchMoreData,\n children,\n}: React.PropsWithChildren<TableProviderProps<TData, TKey>>) => {\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({ right: rightPinnedColumns, left: leftPinnedColumns });\n const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});\n\n const table = useReactTable<TData>({\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 enableColumnPinning: true,\n enableRowSelection: true,\n enableColumnResizing: true,\n enableMultiRowSelection: true,\n\n getCoreRowModel: getCoreRowModel(),\n getGroupedRowModel: getGroupedRowModel(),\n getExpandedRowModel: getExpandedRowModel(),\n\n onRowSelectionChange: setRowSelection,\n onColumnPinningChange: setColumnPinning,\n onColumnVisibilityChange: setColumnVisibility,\n });\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: rows\n const rows = useMemo(() => {\n const { rows } = table.getRowModel();\n return rows;\n }, [table.getRowModel().rows, table.getState().columnPinning]);\n\n const isEmpty = useMemo<boolean>(() => {\n return !isFetching && rows.length === 0;\n }, [rows, isFetching]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: table get state\n const value = useMemo<TTableContext<TData>>(\n () => ({\n title,\n table,\n data,\n\n isEmpty,\n isFetching,\n isRefetching,\n\n totalRows,\n\n fetchMoreData,\n\n rowSelection: table.getState().rowSelection,\n columnPinning: table.getState().columnPinning,\n }),\n [\n title,\n table,\n data,\n\n isEmpty,\n isRefetching,\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 const clickRowValue = useMemo(\n () => ({\n keyOfClickRow,\n onClickRow,\n }),\n [keyOfClickRow, onClickRow]\n );\n\n return (\n <TableContext.Provider value={value as TTableContext<unknown>}>\n <TableClickRowContext.Provider value={clickRowValue as TTableClickRow<unknown>}>{children}</TableClickRowContext.Provider>\n </TableContext.Provider>\n );\n};\n","import { ArrowRightIcon, CirclePlus, DownloadIcon, RefreshCwIcon, SearchIcon } from 'lucide-react';\n\nimport { useDebounceCallback } from '@customafk/react-toolkit/hooks/useDebounceCallback';\n\nimport { Input } from '@/components/ui/input';\n\nimport { useUITableContext } from '../../hooks/use-table-context';\n\nexport const UITableTooltipFilter: React.FC<\n Omit<React.ComponentProps<typeof Input>, 'className'> & {\n onSearch?: (value: string) => void;\n }\n> = ({ onSearch, onChange, ...props }) => {\n const debouncedSearch = useDebounceCallback((value: string) => {\n onSearch?.(value);\n }, 500);\n return (\n <div className=\"relative w-full max-w-80 flex-1\">\n <Input\n {...props}\n size=\"lg\"\n type=\"search\"\n placeholder=\"Search records...\"\n className=\"flex-1 ps-9 pe-9\"\n onChange={e => {\n onChange?.(e);\n debouncedSearch(e.target.value ?? '');\n }}\n />\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<React.ComponentProps<'button'>>> = ({ children, disabled, onClick }) => {\n return (\n <button\n type=\"button\"\n disabled={disabled}\n 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 disabled:pointer-events-none disabled:cursor-default disabled:opacity-60 [&_svg]:size-3.5\"\n onClick={onClick}\n >\n {children}\n </button>\n );\n};\n\nexport const UITableTooltipActions: React.FC<{\n onCreate?: () => void;\n onRefresh?: () => void;\n onDownload?: () => void;\n}> = ({ onCreate, onDownload, onRefresh }) => {\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 disabled={!onCreate}\n onClick={e => {\n onCreate?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <CirclePlus />\n </ActionButton>\n <ActionButton\n disabled={!onRefresh}\n onClick={e => {\n onRefresh?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <RefreshCwIcon />\n </ActionButton>\n <ActionButton\n disabled={!onDownload}\n onClick={e => {\n onDownload?.();\n e.stopPropagation();\n e.preventDefault();\n }}\n >\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 gap-x-2\">{children}</div>\n </div>\n );\n};\nUITableTooltip.displayName = 'TableTooltip';\n"],"mappings":"itDAEA,MAAaA,MAET,EAAC,MAAA,CAAI,UAAU,+CACb,EAAC,EAAA,CAAU,KAAM,GAAA,CAAM,CACvB,EAAC,EAAA,CAAU,KAAM,GAAA,C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A,EAAA,CAAgB,EACJ,CACf,EAAC,EAAA,CACC,SAAU,CAAC,EACX,QAAS,GAAK,CACZ,KAAc,CACd,EAAE,iBAAiB,CACnB,EAAE,gBAAgB,WAGpB,EAAC,GAAA,EAAA,CAAe,EACH,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,6CAA8C,YAAe,CAAA,EACxE,EAGV,EAAe,YAAc"}
@@ -1,2 +1,2 @@
1
- const e=require(`../../chunk-Bmb41Sf3.cjs`),t=require(`../../button.variants-Bo2vzQp5.cjs`),n=require(`../../button-BLYTfCyl.cjs`),r=require(`../../separator-DSZyCT2g.cjs`),i=require(`../../close-rM-Ao1Gf.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-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));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 font-normal text-sm text-text-positive-weak leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));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-primary-bg-subtle 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)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...n,children:[(0,o.jsx)(r.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=`responsive`,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(),R=(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}},z=({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=``]=R(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})]})},B=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,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.jsxs)(w,{children:[(0,o.jsxs)(`div`,{className:`relative w-full`,children:[(0,o.jsx)(z,{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 [&>svg]:size-3.5`,children:(0,o.jsx)(s.Loader2Icon,{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 [&>svg]:size-3.5`,children:(0,o.jsx)(s.BanIcon,{})}),(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,{})]})},V=({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 H({className:e,...t}){return(0,o.jsx)(d.RadioGroup.Root,{"data-slot":`radio-group`,className:(0,a.cn)(`grid gap-3`,e),...t})}function U({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 W=({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)(H,{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)(U,{value:e.value})]})},e.value))})})]}),(0,o.jsx)(k,{})]})};function G({...e}){return(0,o.jsx)(d.Select.Root,{"data-slot":`select`,...e})}function K({...e}){return(0,o.jsx)(d.Select.Value,{"data-slot":`select-value`,...e})}function q({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-1 outline-border -outline-offset-1`,`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 se({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 max-h-80 min-w-32 overflow-y-auto overflow-x-hidden rounded shadow-dropdown duration-300`,`bg-white`,`w-(--radix-select-trigger-width)`,`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,...r,children:[(0,o.jsx)(le,{}),(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)(ue,{})]})})}function ce({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`,`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:shadow-xs`,`focus:bg-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 le({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 ue({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 de=({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)(G,{defaultValue:u.state.value||void 0,onValueChange:u.handleChange,children:[(0,o.jsx)(q,{"aria-invalid":d?`true`:void 0,onBlur:u.handleBlur,children:(0,o.jsx)(K,{placeholder:n})}),(0,o.jsxs)(se,{children:[!!i.length&&i.map(e=>(0,o.jsx)(ce,{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 fe({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 pe=({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)(fe,{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,{})]})},me=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,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(!i)return``;let e=`character${[0,1].includes(j)?``:`s`}`;return i&&m?`${j} / ${m} ${e}`:`${j} ${e}`},[j,i,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||i&&m&&e.length>m||y(e||null)},[b,i,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)(`pr-6`,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-intense [&>svg]:size-3.5`,onClick:I,children:(0,o.jsx)(s.XIcon,{"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 gap-x-2`,children:[d&&(0,o.jsx)(A,{className:`flex-1`,errors:_.meta.errors}),!!i&&(0,o.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:M})]}),(0,o.jsx)(O,{isShow:!!r,children:r})]})]}),(0,o.jsx)(k,{})]})};function he({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 ge=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:l=`responsive`,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:l,"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)(he,{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 gap-x-2`,children:[u&&(0,o.jsx)(A,{className:`flex-1`,errors:M}),!!i&&(0,o.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:E})]}),(0,o.jsx)(O,{isShow:!!r,children:r})]})]}),(0,o.jsx)(k,{})]})},_e=({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-h-8 min-w-32`,t),onClick:i,children:e??`Submit`})})},ve=({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 J({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 ye=({title:e,description:t,onDelete:r,children:i})=>(0,o.jsxs)(`section`,{"data-slot":`card-form`,className:`relative 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)(J,{}),(0,o.jsx)(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:i}),!!r&&(0,o.jsxs)(n.t,{color:`danger`,variant:`outline`,size:`sm`,className:`absolute top-2 right-2`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[(0,o.jsx)(s.Trash2Icon,{}),`Remove`]})]}),be=({children:e})=>(0,o.jsx)(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),Y=({...e})=>(0,o.jsx)(`button`,{...e,type:`button`,className:`min-w-40 cursor-pointer rounded-sm border border-border bg-card px-4 py-2 font-semibold text-sm text-text-positive shadow-xs outline-none transition-all hover:opacity-90 focus:border-border focus:ring-3 focus:ring-border/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none`,children:`Cancel`}),X=({isSubmitting:e,...t})=>(0,o.jsx)(`button`,{...t,type:`button`,"data-loading":e?`true`:void 0,className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-sm border border-primary-strong bg-primary px-4 py-2 font-semibold text-sm text-text-negative shadow-card outline-none transition-all hover:opacity-90 focus:border-transparent focus:ring-3 focus:ring-primary/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none data-[loading=true]:pointer-events-none data-[loading=true]:opacity-80`,children:e?(0,o.jsx)(s.Loader2,{size:16,strokeWidth:3,className:`absolute top-1/2 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 animate-spin`}):`Submit`}),xe=({title:e,open:t,onOpenChange:n,children:i})=>{let a=$(),s=(0,c.useCallback)(e=>{e||a.reset(),n?.(e)},[a.reset,n]);return(0,o.jsx)(d.Dialog.Root,{open:t,onOpenChange:s,children:(0,o.jsxs)(d.Dialog.DialogPortal,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(d.Dialog.DialogOverlay,{"data-slot":`dialog-overlay`,className:`data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in`}),(0,o.jsxs)(d.Dialog.Content,{className:`data-[state=open]:fade-in-0 data-[state=open]:zoom-in-80 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-80 fixed top-1/2 left-1/2 z-50 flex size-full max-h-dvh max-w-dvw -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto bg-background p-0 shadow-dialog outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:h-auto sm:max-h-[85dvh] sm:max-w-2xl sm:rounded-sm`,children:[(0,o.jsx)(`div`,{"data-slot":`dialog-header`,className:`flex flex-col items-center justify-center gap-2 px-4 py-6 text-center shadow-sm sm:text-left`,children:(0,o.jsx)(d.Dialog.Title,{"data-slot":`dialog-title`,className:`font-medium text-lg text-text-positive-strong leading-none`,children:e})}),(0,o.jsx)(r.t,{}),(0,o.jsx)(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col space-y-4 overflow-y-auto p-0 pt-6 max-sm:flex-1 sm:p-4`,children:i}),(0,o.jsx)(r.t,{}),(0,o.jsxs)(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-between gap-2 px-6 py-4 shadow-sm sm:flex-row sm:justify-end max-sm:[&>button]:w-full`,children:[(0,o.jsx)(a.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(Y,{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,onClick:()=>a.handleSubmit()})})]})]})]})})},Se=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:r,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[i,(0,o.jsx)(O,{isShow:!!n,children:n})]})]}),(0,o.jsx)(k,{})]}),Ce=({title:e,open:t,onOpenChange:n,children:r})=>{let s=$();return(0,o.jsx)(d.Dialog.Root,{"data-slot":`dialog`,open:t,onOpenChange:n,children:(0,o.jsxs)(d.Dialog.Portal,{"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:r}),(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)(Y,{disabled:e,className:`w-full`,onClick:()=>{s.reset(),n?.(!1)}})})]}),(0,o.jsx)(d.Dialog.Close,{asChild:!0,children:(0,o.jsx)(i.t,{className:`absolute top-2 right-2`})})]})})]})})},we=({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}),Te=({children:e})=>(0,o.jsx)(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),Z=({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)(we,{children:e}),(0,o.jsx)(J,{}),(0,o.jsx)(Te,{children:t})]}),Ee=({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:De,formContext:Oe,useFieldContext:Q,useFormContext:$}=(0,f.createFormHookContexts)(),{useAppForm:ke,withForm:Ae,withFieldGroup:je}=(0,f.createFormHook)({fieldContext:De,formContext:Oe,fieldComponents:{TextField:me,TextareaField:ge,NumberField:B,EmailField:ie,PasswordField:V,SelectField:de,DateField:re,SwitchField:pe,RadioGroupField:W,CheckboxField:j},formComponents:{TanStackDialogForm:xe,TanStackPopoverForm:Ce,TanStackContainerForm:be,TanStackSectionForm:Z,TanStackCardForm:ye,TanStackFieldGroup:Se,TanStackTitleField:Ee,TanStackActionsForm:ve,TanStackActionSubmit:_e}});exports.useTanStackFieldContext=Q,exports.useTanStackForm=ke,exports.useTanStackFormContext=$,exports.withTanStackFieldGroup=je,exports.withTanStackForm=Ae;
1
+ const e=require(`../../chunk-Bmb41Sf3.cjs`),t=require(`../../button.variants-Bo2vzQp5.cjs`),n=require(`../../button-BLYTfCyl.cjs`),r=require(`../../separator-DSZyCT2g.cjs`),i=require(`../../close-rM-Ao1Gf.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-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));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 font-normal text-sm text-text-positive-weak leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));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-primary-bg-subtle 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)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...n,children:[(0,o.jsx)(r.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=`responsive`,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(),R=(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}},z=({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=``]=R(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})]})},B=({label:e,description:t,placeholder:n,helperText:r,orientation:i=`responsive`,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.jsxs)(w,{children:[(0,o.jsxs)(`div`,{className:`relative w-full`,children:[(0,o.jsx)(z,{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 [&>svg]:size-3.5`,children:(0,o.jsx)(s.Loader2Icon,{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 [&>svg]:size-3.5`,children:(0,o.jsx)(s.BanIcon,{})}),(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,{})]})},V=({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 H({className:e,...t}){return(0,o.jsx)(d.RadioGroup.Root,{"data-slot":`radio-group`,className:(0,a.cn)(`grid gap-3`,e),...t})}function U({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 W=({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)(H,{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)(U,{value:e.value})]})},e.value))})})]}),(0,o.jsx)(k,{})]})};function G({...e}){return(0,o.jsx)(d.Select.Root,{"data-slot":`select`,...e})}function K({...e}){return(0,o.jsx)(d.Select.Value,{"data-slot":`select-value`,...e})}function q({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-1 outline-border -outline-offset-1`,`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 se({className:e,children:t,position:n=`popper`,...r}){return(0,o.jsx)(d.Select.Portal,{"data-slot":`select-portal`,children:(0,o.jsx)(d.Select.Content,{"data-slot":`select-content`,className:(0,a.cn)(`relative z-50 max-h-80 min-w-32 overflow-y-auto overflow-x-hidden rounded shadow-dropdown duration-300`,`bg-white`,`w-(--radix-select-trigger-width)`,`origin-(--radix-select-content-transform-origin)`,`data-[state=open]:animate-in`,`data-[state=open]:fade-in`,`data-[state=closed]:animate-out`,`data-[state=closed]:fade-out`,`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,...r,children:(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})})})}function ce({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`,`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:shadow-xs`,`focus:bg-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})})})]})}const le=({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)(G,{defaultValue:u.state.value||void 0,onValueChange:u.handleChange,children:[(0,o.jsx)(q,{"aria-invalid":d?`true`:void 0,onBlur:u.handleBlur,children:(0,o.jsx)(K,{placeholder:n})}),(0,o.jsxs)(se,{children:[!!i.length&&i.map(e=>(0,o.jsx)(ce,{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 ue({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 de=({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)(ue,{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,{})]})},fe=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,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(!i)return``;let e=`character${[0,1].includes(j)?``:`s`}`;return i&&m?`${j} / ${m} ${e}`:`${j} ${e}`},[j,i,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||i&&m&&e.length>m||y(e||null)},[b,i,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)(`pr-6`,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-intense [&>svg]:size-3.5`,onClick:I,children:(0,o.jsx)(s.XIcon,{"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 gap-x-2`,children:[d&&(0,o.jsx)(A,{className:`flex-1`,errors:_.meta.errors}),!!i&&(0,o.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:M})]}),(0,o.jsx)(O,{isShow:!!r,children:r})]})]}),(0,o.jsx)(k,{})]})};function pe({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 me=({label:e,description:t,placeholder:n,helperText:r,counter:i=!1,orientation:l=`responsive`,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:l,"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)(pe,{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 gap-x-2`,children:[u&&(0,o.jsx)(A,{className:`flex-1`,errors:M}),!!i&&(0,o.jsx)(`p`,{className:`h-4 flex-0 text-nowrap text-end text-text-positive-weak text-xs tabular-nums`,children:E})]}),(0,o.jsx)(O,{isShow:!!r,children:r})]})]}),(0,o.jsx)(k,{})]})},he=({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-h-8 min-w-32`,t),onClick:i,children:e??`Submit`})})},ge=({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 J({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 _e=({title:e,description:t,onDelete:r,children:i})=>(0,o.jsxs)(`section`,{"data-slot":`card-form`,className:`relative flex flex-col rounded-md bg-card pb-4 shadow-card ring-4 ring-border-weak`,children:[(0,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)(J,{}),(0,o.jsx)(`div`,{"data-slot":`card-form-main`,className:`flex flex-col space-y-4 py-4`,children:i}),!!r&&(0,o.jsxs)(n.t,{color:`danger`,variant:`outline`,size:`sm`,className:`absolute top-2 right-2`,onClick:e=>{r?.(),e.preventDefault(),e.stopPropagation()},children:[(0,o.jsx)(s.Trash2Icon,{}),`Remove`]})]}),ve=({children:e})=>(0,o.jsx)(`div`,{"data-slot":`section-form`,className:`flex flex-col space-y-4`,children:e}),Y=({...e})=>(0,o.jsx)(`button`,{...e,type:`button`,className:`min-w-40 cursor-pointer rounded-sm border border-border bg-card px-4 py-2 font-semibold text-sm text-text-positive shadow-xs outline-none transition-all hover:opacity-90 focus:border-border focus:ring-3 focus:ring-border/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none`,children:`Cancel`}),X=({isSubmitting:e,submitText:t=`Submit`,...n})=>(0,o.jsx)(`button`,{...n,type:`button`,"data-loading":e?`true`:void 0,className:`relative min-h-9.5 min-w-40 cursor-pointer rounded-sm border border-primary-strong bg-primary px-4 py-2 font-semibold text-sm text-text-negative shadow-card outline-none transition-all hover:opacity-90 focus:border-transparent focus:ring-3 focus:ring-primary/80 focus:ring-offset-2 focus:drop-shadow-none disabled:pointer-events-none disabled:opacity-60 disabled:drop-shadow-none data-[loading=true]:pointer-events-none data-[loading=true]:opacity-80`,children:e?(0,o.jsx)(s.Loader2,{size:16,strokeWidth:3,className:`absolute top-1/2 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 animate-spin`}):t}),ye=({title:e,submitText:t,open:n,onOpenChange:i,children:a})=>{let s=$(),l=(0,c.useCallback)(e=>{e||s.reset(),i?.(e)},[s.reset,i]);return(0,o.jsx)(d.Dialog.Root,{open:n,onOpenChange:l,children:(0,o.jsxs)(d.Dialog.DialogPortal,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(d.Dialog.DialogOverlay,{"data-slot":`dialog-overlay`,className:`data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in`}),(0,o.jsxs)(d.Dialog.Content,{className:`data-[state=open]:fade-in-0 data-[state=open]:zoom-in-80 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-80 fixed top-1/2 left-1/2 z-50 flex size-full max-h-dvh max-w-dvw -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto bg-background p-0 shadow-dialog outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:h-auto sm:max-h-[85dvh] sm:max-w-2xl sm:rounded-sm`,children:[(0,o.jsx)(`div`,{"data-slot":`dialog-header`,className:`flex flex-col items-center justify-center gap-2 px-4 py-6 text-center shadow-sm sm:text-left`,children:(0,o.jsx)(d.Dialog.Title,{"data-slot":`dialog-title`,className:`font-medium text-lg text-text-positive-strong leading-none`,children:e})}),(0,o.jsx)(r.t,{}),(0,o.jsx)(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col space-y-4 overflow-y-auto p-0 pt-6 max-sm:flex-1 sm:p-4`,children:a}),(0,o.jsx)(r.t,{}),(0,o.jsxs)(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-between gap-2 px-6 py-4 shadow-sm sm:flex-row sm:justify-end max-sm:[&>button]:w-full`,children:[(0,o.jsx)(s.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(Y,{disabled:e,onClick:()=>{s.reset(),l(!1)}})}),(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:n})=>(0,o.jsx)(X,{isSubmitting:e,disabled:n,submitText:t,onClick:()=>s.handleSubmit()})})]})]})]})})},be=({label:e,description:t,helperText:n,orientation:r=`responsive`,children:i})=>(0,o.jsxs)(x,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(S,{orientation:r,children:[(0,o.jsxs)(C,{children:[(0,o.jsx)(T,{children:e}),(0,o.jsx)(D,{children:t})]}),(0,o.jsxs)(w,{children:[i,(0,o.jsx)(O,{isShow:!!n,children:n})]})]}),(0,o.jsx)(k,{})]}),xe=({title:e,open:t,onOpenChange:n,children:r})=>{let s=$();return(0,o.jsx)(d.Dialog.Root,{"data-slot":`dialog`,open:t,onOpenChange:n,children:(0,o.jsxs)(d.Dialog.Portal,{"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:r}),(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)(Y,{disabled:e,className:`w-full`,onClick:()=>{s.reset(),n?.(!1)}})})]}),(0,o.jsx)(d.Dialog.Close,{asChild:!0,children:(0,o.jsx)(i.t,{className:`absolute top-2 right-2`})})]})})]})})},Se=({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}),Z=({children:e})=>(0,o.jsx)(`main`,{"data-slot":`section-main`,className:`relative flex flex-col space-y-4 py-4`,children:e}),Ce=({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)(Se,{children:e}),(0,o.jsx)(J,{}),(0,o.jsx)(Z,{children:t})]}),we=({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:Te,formContext:Ee,useFieldContext:Q,useFormContext:$}=(0,f.createFormHookContexts)(),{useAppForm:De,withForm:Oe,withFieldGroup:ke}=(0,f.createFormHook)({fieldContext:Te,formContext:Ee,fieldComponents:{TextField:fe,TextareaField:me,NumberField:B,EmailField:ie,PasswordField:V,SelectField:le,DateField:re,SwitchField:de,RadioGroupField:W,CheckboxField:j},formComponents:{TanStackDialogForm:ye,TanStackPopoverForm:xe,TanStackContainerForm:ve,TanStackSectionForm:Ce,TanStackCardForm:_e,TanStackFieldGroup:be,TanStackTitleField:we,TanStackActionsForm:ge,TanStackActionSubmit:he}});exports.useTanStackFieldContext=Q,exports.useTanStackForm=De,exports.useTanStackFormContext=$,exports.withTanStackFieldGroup=ke,exports.withTanStackForm=Oe;
2
2
  //# sourceMappingURL=index.cjs.map