@payglocal_ui/flux-ui 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +172 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -1
- package/dist/index.d.ts +53 -1
- package/dist/index.js +171 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/alert.tsx +2 -1
- package/src/button-group.tsx +7 -5
- package/src/button.tsx +5 -4
- package/src/calendar.tsx +5 -2
- package/src/card.tsx +4 -1
- package/src/chart-templates.tsx +9 -7
- package/src/checkbox-select.tsx +9 -4
- package/src/checkbox.tsx +3 -1
- package/src/command.tsx +2 -1
- package/src/country-select.tsx +5 -2
- package/src/data-table.tsx +4 -2
- package/src/date-picker.tsx +9 -4
- package/src/dialog.tsx +3 -1
- package/src/drawer.tsx +2 -1
- package/src/dropdown-menu.tsx +5 -2
- package/src/elevation.ts +54 -0
- package/src/flag.tsx +3 -1
- package/src/icon-button.tsx +5 -4
- package/src/index.ts +1 -0
- package/src/inline-dialog.tsx +3 -1
- package/src/inline-edit.tsx +3 -1
- package/src/input-group.tsx +3 -1
- package/src/input.tsx +3 -1
- package/src/otp-input.tsx +3 -1
- package/src/pagination.tsx +2 -1
- package/src/popover.tsx +3 -1
- package/src/radio-group.tsx +3 -1
- package/src/section-message.tsx +3 -1
- package/src/select.tsx +5 -2
- package/src/single-select.tsx +7 -3
- package/src/skeleton.tsx +7 -1
- package/src/slider.tsx +5 -1
- package/src/sonner.tsx +2 -1
- package/src/spotlight.tsx +2 -1
- package/src/switch.tsx +3 -1
- package/src/textarea.tsx +3 -1
- package/src/time-picker.tsx +5 -2
- package/src/tooltip.tsx +3 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/layout.tsx","../src/grid-flex.tsx","../src/button.tsx","../src/button-group.tsx","../src/input.tsx","../src/password-input.tsx","../src/otp-input.tsx","../src/checkbox-select.tsx","../src/option-filter.ts","../src/scroll-lock.tsx","../src/single-select.tsx","../src/textarea.tsx","../src/label.tsx","../src/checkbox.tsx","../src/radio-group.tsx","../src/switch.tsx","../src/slider.tsx","../src/form.tsx","../src/field.tsx","../src/separator.tsx","../src/input-group.tsx","../src/currency-amount-input.tsx","../src/card.tsx","../src/scroll-area.tsx","../src/side-nav.tsx","../src/breadcrumb.tsx","../src/pagination.tsx","../src/link.tsx","../../../node_modules/@radix-ui/react-slot/src/slot.tsx","../../../node_modules/@radix-ui/react-compose-refs/src/compose-refs.tsx","../src/badge.tsx","../src/lozenge.tsx","../src/tag.tsx","../src/status-badge.tsx","../src/blanket.tsx","../src/spotlight.tsx","../src/dialog.tsx","../src/drawer.tsx","../src/popover.tsx","../src/tooltip.tsx","../src/menu.tsx","../src/dropdown-menu.tsx","../src/select.tsx","../src/command.tsx","../src/tabs.tsx","../src/tab-presets.tsx","../src/accordion.tsx","../src/alert.tsx","../src/callout.tsx","../src/section-message.tsx","../src/spinner.tsx","../src/progress.tsx","../src/skeleton.tsx","../src/empty-state.tsx","../src/data-table.tsx","../src/data-table-card.tsx","../src/data-card-list.tsx","../src/copyable-cell.tsx","../src/rotating-search-input.tsx","../src/column-manager.tsx","../src/page-header.tsx","../src/code.tsx","../src/avatar.tsx","../src/avatar-group.tsx","../src/avatar-tag.tsx","../src/calendar.tsx","../src/date-picker.tsx","../src/chart.tsx","../src/chart-templates.tsx","../src/sonner.tsx","../src/inline-edit.tsx","../src/inline-dialog.tsx","../src/flag.tsx","../src/responsive.tsx","../src/country-select.tsx","../src/icon-button.tsx","../src/time-picker.tsx","../src/heading.tsx","../src/progress-indicator.tsx","../src/visually-hidden.tsx","../src/filter-chips.tsx","../src/format-datetime.ts","../src/calendar-date-chip.tsx"],"sourcesContent":["export { cn } from \"./utils\";\n\n// Layout\nexport { Box, Stack, Inline } from \"./layout\";\nexport type { BoxProps, StackProps, InlineProps, LayoutSpacing } from \"./layout\";\nexport { Grid, Flex } from \"./grid-flex\";\nexport type { GridProps, GridCols, GridFlow, ResponsiveCols, FlexProps, FlexDirection, FlexAlign, FlexJustify, FlexWrap } from \"./grid-flex\";\n\n// Button\nexport { Button } from \"./button\";\nexport type { ButtonProps } from \"./button\";\nexport { ButtonGroup, SplitButton, SplitButtonItem } from \"./button-group\";\nexport type { ButtonGroupProps, SplitButtonProps, SplitButtonItemProps } from \"./button-group\";\n\n// Inputs\nexport { Input } from \"./input\";\nexport { PasswordInput } from \"./password-input\";\nexport type { PasswordInputProps } from \"./password-input\";\nexport { OtpInput } from \"./otp-input\";\nexport type { OtpInputProps } from \"./otp-input\";\nexport { CheckboxSelect } from \"./checkbox-select\";\nexport type { CheckboxSelectProps, CheckboxSelectOption } from \"./checkbox-select\";\nexport { SingleSelect } from \"./single-select\";\nexport type { SingleSelectProps, SingleSelectOption } from \"./single-select\";\nexport { defaultOptionFilter } from \"./option-filter\";\nexport { isScrollLocked, ScrollLockTakeover } from \"./scroll-lock\";\nexport type { OptionFilter, FilterableOption } from \"./option-filter\";\nexport { Textarea } from \"./textarea\";\nexport { Label } from \"./label\";\nexport { Checkbox } from \"./checkbox\";\nexport type { CheckboxProps } from \"./checkbox\";\nexport { RadioGroup, RadioGroupItem } from \"./radio-group\";\nexport type { RadioGroupItemProps } from \"./radio-group\";\nexport { Switch } from \"./switch\";\nexport type { SwitchProps } from \"./switch\";\nexport { Slider } from \"./slider\";\nexport type { SliderProps } from \"./slider\";\n\n// Form (validation wrapper)\nexport {\n Form,\n FormField,\n FormLabel,\n FormControl,\n FormDescription,\n FormError,\n FormItem,\n useForm,\n} from \"./form\";\nexport type {\n FormProps,\n FormFieldProps,\n FormValues,\n FormErrors,\n FieldConfig,\n FieldsConfig,\n RegisterResult,\n UseFormReturn,\n ValidatorRule,\n} from \"./form\";\n\n// Form fields\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n} from \"./field\";\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n InputGroupTextarea,\n} from \"./input-group\";\nexport { CurrencyAmountInput } from \"./currency-amount-input\";\n\n// Surfaces\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from \"./card\";\nexport { Separator } from \"./separator\";\nexport { ScrollArea, ScrollBar } from \"./scroll-area\";\n\n// SideNav\nexport {\n SideNav,\n SideNavHeader,\n SideNavSection,\n SideNavItem,\n SideNavFooter,\n} from \"./side-nav\";\nexport type { SideNavProps, SideNavItemProps } from \"./side-nav\";\n\n// Navigation\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n} from \"./breadcrumb\";\nexport {\n Pagination,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./pagination\";\nexport type {\n PaginationProps,\n PaginationContentProps,\n PaginationItemProps,\n PaginationLinkProps,\n PaginationPreviousProps,\n PaginationNextProps,\n PaginationEllipsisProps,\n} from \"./pagination\";\nexport { Link } from \"./link\";\nexport type { LinkProps } from \"./link\";\n\n// Labels & Badges\nexport { Badge } from \"./badge\";\nexport type { BadgeProps } from \"./badge\";\nexport { Lozenge } from \"./lozenge\";\nexport type { LozengeProps } from \"./lozenge\";\nexport { Tag, TagGroup } from \"./tag\";\nexport type { TagProps, TagGroupProps } from \"./tag\";\nexport { StatusBadge } from \"./status-badge\";\nexport type { StatusBadgeProps, BadgeVariant, BadgeTrailIcon } from \"./status-badge\";\n\n// Overlays\nexport { Blanket } from \"./blanket\";\nexport type { BlanketProps } from \"./blanket\";\nexport { Spotlight, SpotlightCard, useSpotlight } from \"./spotlight\";\nexport type { SpotlightProps, SpotlightCardProps, SpotlightStep, UseSpotlightReturn } from \"./spotlight\";\nexport {\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogClose,\n DialogContent,\n DialogTitle,\n DialogDescription,\n} from \"./dialog\";\nexport {\n Drawer,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from \"./drawer\";\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from \"./popover\";\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from \"./tooltip\";\n\n// Menu (standalone vertical)\nexport { Menu, MenuSection, MenuItem, MenuDivider } from \"./menu\";\nexport type { MenuProps, MenuSectionProps, MenuItemProps } from \"./menu\";\n\n// Menus & Select\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n} from \"./dropdown-menu\";\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n} from \"./select\";\nexport type { SelectTriggerSize } from \"./select\";\nexport { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator, CommandShortcut } from \"./command\";\nexport type {\n CommandProps,\n CommandInputProps,\n CommandListProps,\n CommandEmptyProps,\n CommandGroupProps,\n CommandItemProps,\n CommandSeparatorProps,\n CommandShortcutProps,\n} from \"./command\";\n\n// Tabs & Accordion\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from \"./tabs\";\nexport { UnderlineTabs, SegmentedTabs } from \"./tab-presets\";\nexport type { UnderlineTab, SegmentedTabOption } from \"./tab-presets\";\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from \"./accordion\";\n\n// Messaging & Feedback\nexport { Alert, AlertTitle, AlertDescription, Banner } from \"./alert\";\nexport type { AlertProps, BannerProps } from \"./alert\";\nexport { Callout, CalloutIcon, CalloutTitle, CalloutText } from \"./callout\";\nexport type { CalloutProps, CalloutVariant } from \"./callout\";\nexport {\n SectionMessage,\n SectionMessageTitle,\n SectionMessageContent,\n SectionMessageActions,\n} from \"./section-message\";\nexport type { SectionMessageProps, SectionMessageVariant } from \"./section-message\";\nexport { Spinner } from \"./spinner\";\nexport type { SpinnerProps } from \"./spinner\";\nexport { Progress, ProgressTracker } from \"./progress\";\nexport type { ProgressProps, ProgressTrackerStep, ProgressTrackerProps } from \"./progress\";\n\n// Loading & Skeleton\nexport { Shimmer, StatCardSkeleton, TableRowSkeleton, ChartSkeleton } from \"./skeleton\";\n\n// Data display\nexport { DataTable, frozenColumn } from \"./data-table\";\nexport type {\n Column,\n DataTableDensity,\n DataTableExpandable,\n DataTableFooterSummary,\n DataTableHeaderStyle,\n DataTablePagination,\n DataTableSorting,\n DataTableSortState,\n SortOrder,\n} from \"./data-table\";\nexport { DataTableCard, TableToolbarActions } from \"./data-table-card\";\nexport { DataCardList } from \"./data-card-list\";\nexport type { DataCardListProps } from \"./data-card-list\";\nexport { CopyableCell } from \"./copyable-cell\";\nexport type { CopyableCellProps } from \"./copyable-cell\";\nexport { RotatingSearchInput } from \"./rotating-search-input\";\nexport type { RotatingSearchInputProps } from \"./rotating-search-input\";\nexport type { DataTableCardProps } from \"./data-table-card\";\nexport { ColumnManager, useColumnPreferences, applyColumnPreferences } from \"./column-manager\";\nexport type {\n ColumnManagerProps,\n ColumnPreferences,\n ManagedColumn,\n UseColumnPreferencesOptions,\n UseColumnPreferencesResult,\n} from \"./column-manager\";\nexport { EmptyState } from \"./empty-state\";\nexport { PageHeader } from \"./page-header\";\nexport { Code, CodeBlock } from \"./code\";\nexport type { CodeProps, CodeBlockProps } from \"./code\";\n\n// Avatar\nexport { Avatar, AvatarImage, AvatarFallback } from \"./avatar\";\nexport { AvatarGroup } from \"./avatar-group\";\nexport type { AvatarGroupProps, AvatarGroupItem } from \"./avatar-group\";\nexport { AvatarTag } from \"./avatar-tag\";\nexport type { AvatarTagProps, AvatarTagSize } from \"./avatar-tag\";\n\n// Date & Calendar\nexport { Calendar, CalendarDayButton } from \"./calendar\";\nexport type { CalendarProps } from \"./calendar\";\nexport type { DateRange } from \"react-day-picker\";\nexport { DatePicker, type DatePickerTimeOptions } from \"./date-picker\";\n\n// Charts\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n} from \"./chart\";\nexport type { ChartConfig } from \"./chart\";\nexport {\n MetricSparklineCard,\n DashboardAreaChartTemplate,\n GroupedBarChartTemplate,\n RankedBarListTemplate,\n CategoryBarChartTemplate,\n MiniSparklineChartCard,\n AttentionListTemplate,\n} from \"./chart-templates\";\nexport type {\n MetricSparklinePoint,\n MetricSparklineCardProps,\n DashboardAreaChartPoint,\n DashboardAreaChartTemplateProps,\n GroupedBarSeries,\n GroupedBarChartTemplateProps,\n RankedBarItem,\n RankedBarListTemplateProps,\n CategoryBarPoint,\n CategoryBarChartTemplateProps,\n MiniSparklinePoint,\n MiniSparklineStat,\n MiniSparklineChartCardProps,\n AttentionListItem,\n AttentionListTemplateProps,\n} from \"./chart-templates\";\n\n// Toast\nexport { Toaster, toast } from \"./sonner\";\n\n// Inline Edit\nexport { InlineEdit } from \"./inline-edit\";\nexport type { InlineEditProps } from \"./inline-edit\";\n\n// Inline Dialog\nexport { InlineDialog, InlineDialogTrigger, InlineDialogContent } from \"./inline-dialog\";\nexport type { InlineDialogProps, InlineDialogContentProps } from \"./inline-dialog\";\n\n// Flag notifications\nexport { Flag, FlagGroup, useFlagGroup } from \"./flag\";\nexport type { FlagProps, FlagGroupProps, FlagVariant, FlagAction, FlagGroupPosition, UseFlagGroupReturn } from \"./flag\";\n\n// Responsive Show/Hide\nexport { Show, Hide, useBreakpoint } from \"./responsive\";\nexport type { ShowProps, HideProps, Breakpoint, UseBreakpointReturn } from \"./responsive\";\n\n// Country Select\nexport { CountrySelect, COUNTRIES } from \"./country-select\";\nexport type { CountrySelectProps, Country } from \"./country-select\";\n\n// Button variants\nexport { IconButton } from \"./icon-button\";\nexport type { IconButtonProps } from \"./icon-button\";\n\n// Inputs\nexport { TimePicker } from \"./time-picker\";\nexport type { TimePickerProps } from \"./time-picker\";\n\n// Typography\nexport { Heading, Text, MetricText } from \"./heading\";\nexport type { HeadingProps, TextProps, MetricTextProps } from \"./heading\";\n\n// Status\nexport { ProgressIndicator } from \"./progress-indicator\";\nexport type { ProgressIndicatorProps } from \"./progress-indicator\";\n\n// Utility\nexport { VisuallyHidden } from \"./visually-hidden\";\nexport type { VisuallyHiddenProps } from \"./visually-hidden\";\n\n// Filters\nexport {\n FilterChipGroup,\n useFilterChipState,\n FilterChipShell,\n FilterChipClearButton,\n FilterChipLabelTrigger,\n FilterChipActions,\n FilterChip,\n SelectFilterChip,\n SingleSelectFilterChip,\n DateRangeFilterChip,\n NumberRangeFilterChip,\n TextFilterChip,\n MonthRangeFilterChip,\n EMPTY_RELATIVE_RANGE,\n hasRelativeRange,\n relativeRangeToMillis,\n AddFilterMenu,\n FilterToolbar,\n ToolbarButton,\n} from \"./filter-chips\";\n\n// The calendar-based date chip, for a filter people reach for by looking\n// rather than by typing two dates.\nexport { CalendarDateFilterChip } from \"./calendar-date-chip\";\nexport type {\n CalendarDateValue,\n CalendarDatePreset,\n CalendarDateFilterChipProps,\n CalendarRange,\n DatePickMode,\n} from \"./calendar-date-chip\";\nexport type {\n FilterChipOption,\n FilterChipControl,\n SelectFilterChipProps,\n SingleSelectFilterChipProps,\n DateRangeValue,\n DateRangeFilterChipProps,\n NumberRangeValue,\n NumberRangeFilterChipProps,\n TextFilterChipProps,\n RelativeRangeValue,\n MonthRange,\n AddFilterDefinition,\n AddFilterMenuProps,\n} from \"./filter-chips\";\n\n// Date & time formatting (the app-wide \"27 Jul '26, 09:49 AM\" form)\nexport {\n parseApiDate,\n formatTime,\n formatDateOnly,\n formatDateTime,\n formatTimestamp,\n formatDateStamp,\n formatMonthLabel,\n formatTimeStamp,\n formatWeekdayDate,\n EMPTY_DATE,\n MONTHS_SHORT,\n DAYS_SHORT,\n} from \"./format-datetime\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\n\n/** Maps to Tailwind spacing steps used across PayGlocal dashboard surfaces */\nexport type LayoutSpacing = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst gapClass: Record<LayoutSpacing, string> = {\n none: \"gap-0\",\n xs: \"gap-1\",\n sm: \"gap-2\",\n md: \"gap-3\",\n lg: \"gap-4\",\n xl: \"gap-6\",\n};\n\nconst padClass: Record<LayoutSpacing, string> = {\n none: \"p-0\",\n xs: \"p-1\",\n sm: \"p-2\",\n md: \"p-4\",\n lg: \"p-6\",\n xl: \"p-8\",\n};\n\nconst padXClass: Record<LayoutSpacing, string> = {\n none: \"px-0\",\n xs: \"px-1\",\n sm: \"px-2\",\n md: \"px-4\",\n lg: \"px-6\",\n xl: \"px-8\",\n};\n\nconst padYClass: Record<LayoutSpacing, string> = {\n none: \"py-0\",\n xs: \"py-1\",\n sm: \"py-2\",\n md: \"py-4\",\n lg: \"py-6\",\n xl: \"py-8\",\n};\n\nexport type BoxProps = React.HTMLAttributes<HTMLDivElement> & {\n as?: React.ElementType;\n p?: LayoutSpacing;\n px?: LayoutSpacing;\n py?: LayoutSpacing;\n};\n\n/** Neutral block with token-aligned padding; extend with `className` for radius, borders, flex, etc. */\nexport function Box({ as: Comp = \"div\", className, p = \"none\", px, py, ...props }: BoxProps) {\n const axis = px !== undefined || py !== undefined;\n return (\n <Comp\n className={cn(\n !axis && padClass[p],\n px !== undefined && padXClass[px],\n py !== undefined && padYClass[py],\n className\n )}\n {...props}\n />\n );\n}\n\nexport type StackProps = React.HTMLAttributes<HTMLDivElement> & {\n as?: React.ElementType;\n gap?: LayoutSpacing;\n align?: \"start\" | \"center\" | \"stretch\" | \"end\";\n};\n\n/** Vertical flex stack; default gap matches common section rhythm (`gap-4`). */\nexport function Stack({\n as: Comp = \"div\",\n className,\n gap = \"lg\",\n align = \"stretch\",\n ...props\n}: StackProps) {\n const alignCls =\n align === \"start\"\n ? \"items-start\"\n : align === \"center\"\n ? \"items-center\"\n : align === \"end\"\n ? \"items-end\"\n : \"items-stretch\";\n return <Comp className={cn(\"flex flex-col\", gapClass[gap], alignCls, className)} {...props} />;\n}\n\nexport type InlineProps = React.HTMLAttributes<HTMLDivElement> & {\n gap?: LayoutSpacing;\n wrap?: boolean;\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n};\n\n/** Horizontal flex row for toolbars and inline field groups */\nexport function Inline({\n className,\n gap = \"md\",\n wrap = false,\n justify = \"start\",\n ...props\n}: InlineProps) {\n const justifyCls =\n justify === \"center\"\n ? \"justify-center\"\n : justify === \"end\"\n ? \"justify-end\"\n : justify === \"between\"\n ? \"justify-between\"\n : \"justify-start\";\n return (\n <div\n className={cn(\"flex flex-row items-center\", gapClass[gap], justifyCls, wrap && \"flex-wrap\", className)}\n {...props}\n />\n );\n}\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\nimport type { LayoutSpacing } from \"./layout\";\n\n// ---------------------------------------------------------------------------\n// Shared gap map (mirrors layout.tsx)\n// ---------------------------------------------------------------------------\n\nconst gapClass: Record<LayoutSpacing, string> = {\n none: \"gap-0\",\n xs: \"gap-1\",\n sm: \"gap-2\",\n md: \"gap-3\",\n lg: \"gap-4\",\n xl: \"gap-6\",\n};\n\n// ---------------------------------------------------------------------------\n// Grid\n// ---------------------------------------------------------------------------\n\nexport type GridCols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | \"auto\";\n\nexport type ResponsiveCols = {\n base?: GridCols;\n sm?: GridCols;\n md?: GridCols;\n lg?: GridCols;\n};\n\nexport type GridFlow = \"row\" | \"col\" | \"dense\";\n\nexport type GridProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Number of columns (1–12 or \"auto\"), or a responsive object */\n cols?: GridCols | ResponsiveCols;\n /** Number of explicit rows */\n rows?: 1 | 2 | 3 | 4 | 5 | 6 | \"auto\";\n /** Gap between cells */\n gap?: LayoutSpacing;\n /** Grid auto-flow direction */\n flow?: GridFlow;\n};\n\nconst colClass: Record<string, string> = {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-2\",\n 3: \"grid-cols-3\",\n 4: \"grid-cols-4\",\n 5: \"grid-cols-5\",\n 6: \"grid-cols-6\",\n 7: \"grid-cols-7\",\n 8: \"grid-cols-8\",\n 9: \"grid-cols-9\",\n 10: \"grid-cols-10\",\n 11: \"grid-cols-11\",\n 12: \"grid-cols-12\",\n auto: \"grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst smColClass: Record<string, string> = {\n 1: \"sm:grid-cols-1\",\n 2: \"sm:grid-cols-2\",\n 3: \"sm:grid-cols-3\",\n 4: \"sm:grid-cols-4\",\n 5: \"sm:grid-cols-5\",\n 6: \"sm:grid-cols-6\",\n 7: \"sm:grid-cols-7\",\n 8: \"sm:grid-cols-8\",\n 9: \"sm:grid-cols-9\",\n 10: \"sm:grid-cols-10\",\n 11: \"sm:grid-cols-11\",\n 12: \"sm:grid-cols-12\",\n auto: \"sm:grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst mdColClass: Record<string, string> = {\n 1: \"md:grid-cols-1\",\n 2: \"md:grid-cols-2\",\n 3: \"md:grid-cols-3\",\n 4: \"md:grid-cols-4\",\n 5: \"md:grid-cols-5\",\n 6: \"md:grid-cols-6\",\n 7: \"md:grid-cols-7\",\n 8: \"md:grid-cols-8\",\n 9: \"md:grid-cols-9\",\n 10: \"md:grid-cols-10\",\n 11: \"md:grid-cols-11\",\n 12: \"md:grid-cols-12\",\n auto: \"md:grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst lgColClass: Record<string, string> = {\n 1: \"lg:grid-cols-1\",\n 2: \"lg:grid-cols-2\",\n 3: \"lg:grid-cols-3\",\n 4: \"lg:grid-cols-4\",\n 5: \"lg:grid-cols-5\",\n 6: \"lg:grid-cols-6\",\n 7: \"lg:grid-cols-7\",\n 8: \"lg:grid-cols-8\",\n 9: \"lg:grid-cols-9\",\n 10: \"lg:grid-cols-10\",\n 11: \"lg:grid-cols-11\",\n 12: \"lg:grid-cols-12\",\n auto: \"lg:grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst rowClass: Record<string, string> = {\n 1: \"grid-rows-1\",\n 2: \"grid-rows-2\",\n 3: \"grid-rows-3\",\n 4: \"grid-rows-4\",\n 5: \"grid-rows-5\",\n 6: \"grid-rows-6\",\n auto: \"grid-rows-none\",\n};\n\nconst flowClass: Record<GridFlow, string> = {\n row: \"grid-flow-row\",\n col: \"grid-flow-col\",\n dense: \"grid-flow-dense\",\n};\n\nfunction resolveColClasses(cols: GridCols | ResponsiveCols | undefined): string {\n if (cols === undefined) return \"\";\n if (typeof cols === \"number\" || cols === \"auto\") {\n return colClass[String(cols)] ?? \"\";\n }\n // Responsive object\n const { base, sm, md, lg } = cols as ResponsiveCols;\n return cn(\n base !== undefined && colClass[String(base)],\n sm !== undefined && smColClass[String(sm)],\n md !== undefined && mdColClass[String(md)],\n lg !== undefined && lgColClass[String(lg)],\n );\n}\n\nexport const Grid = React.forwardRef<HTMLDivElement, GridProps>(\n ({ className, cols, rows, gap = \"md\", flow, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"grid\",\n resolveColClasses(cols),\n rows !== undefined && rowClass[String(rows)],\n gapClass[gap],\n flow !== undefined && flowClass[flow],\n className,\n )}\n {...props}\n />\n );\n },\n);\nGrid.displayName = \"Grid\";\n\n// ---------------------------------------------------------------------------\n// Flex\n// ---------------------------------------------------------------------------\n\nexport type FlexDirection = \"row\" | \"col\" | \"row-reverse\" | \"col-reverse\";\nexport type FlexWrap = boolean | \"reverse\";\nexport type FlexAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type FlexJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\";\n\nexport type FlexProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Flex direction */\n direction?: FlexDirection;\n /** Whether children wrap */\n wrap?: FlexWrap;\n /** Align items (cross axis) */\n align?: FlexAlign;\n /** Justify content (main axis) */\n justify?: FlexJustify;\n /** Gap between children */\n gap?: LayoutSpacing;\n /** Render as inline-flex */\n inline?: boolean;\n};\n\nconst directionClass: Record<FlexDirection, string> = {\n row: \"flex-row\",\n col: \"flex-col\",\n \"row-reverse\": \"flex-row-reverse\",\n \"col-reverse\": \"flex-col-reverse\",\n};\n\nconst alignClass: Record<FlexAlign, string> = {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n baseline: \"items-baseline\",\n};\n\nconst justifyClass: Record<FlexJustify, string> = {\n start: \"justify-start\",\n center: \"justify-center\",\n end: \"justify-end\",\n between: \"justify-between\",\n around: \"justify-around\",\n evenly: \"justify-evenly\",\n};\n\nexport const Flex = React.forwardRef<HTMLDivElement, FlexProps>(\n (\n {\n className,\n direction = \"row\",\n wrap = false,\n align = \"start\",\n justify = \"start\",\n gap = \"md\",\n inline = false,\n ...props\n },\n ref,\n ) => {\n const wrapCls =\n wrap === true ? \"flex-wrap\" : wrap === \"reverse\" ? \"flex-wrap-reverse\" : \"flex-nowrap\";\n\n return (\n <div\n ref={ref}\n className={cn(\n inline ? \"inline-flex\" : \"flex\",\n directionClass[direction],\n wrapCls,\n alignClass[align],\n justifyClass[justify],\n gapClass[gap],\n className,\n )}\n {...props}\n />\n );\n },\n);\nFlex.displayName = \"Flex\";\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { Loader2 } from \"lucide-react\";\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\" | \"ghost\" | \"danger\" | \"outline\" | \"link\";\n size?: \"sm\" | \"md\" | \"lg\";\n isLoading?: boolean;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n}\n\nconst variantClasses: Record<NonNullable<ButtonProps[\"variant\"]>, string> = {\n primary:\n \"bg-primary text-primary-foreground border border-primary shadow-sm hover:bg-[var(--primary-hover)]\",\n secondary:\n \"bg-muted text-foreground border border-border shadow-sm hover:bg-muted/85 dark:bg-muted/35 dark:text-foreground dark:border-border dark:hover:bg-muted/55\",\n ghost:\n \"bg-transparent text-foreground border border-transparent hover:bg-muted focus-visible:bg-muted/80 active:bg-muted/90\",\n danger:\n \"bg-red-600 text-white border border-red-600 shadow-sm hover:bg-red-700\",\n outline:\n \"bg-card text-foreground border border-border shadow-sm hover:bg-muted\",\n link:\n \"h-auto min-h-0 rounded-md border border-transparent bg-transparent px-2 py-2 text-[15px] font-medium text-primary shadow-none underline-offset-4 hover:bg-primary/5 hover:underline focus-visible:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 disabled:pointer-events-none disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:no-underline\",\n};\n\n/** Heights and padding match dashboard primary actions (~44–48px) and comfortable tap targets. */\nconst sizes = {\n sm: \"h-9 min-h-9 px-3.5 text-xs gap-1.5 rounded-lg\",\n md: \"h-10 min-h-10 px-5 text-sm gap-2 rounded-lg\",\n lg: \"h-[3.25rem] min-h-[3.25rem] px-10 text-[15px] gap-2.5 rounded-xl\",\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"primary\",\n size = \"md\",\n isLoading = false,\n leftIcon,\n rightIcon,\n children,\n className,\n disabled,\n ...props\n },\n ref\n ) => {\n return (\n <button\n ref={ref}\n disabled={disabled || isLoading}\n className={cn(\n \"inline-flex items-center justify-center font-medium transition-colors duration-pg-fast ease-pg-standard\",\n // A button's label never wraps. Without this, a narrow button breaks\n // the line between an icon and its text — and an icon passed as a\n // child rather than through `leftIcon` sits inside the same span, so\n // it wraps with the words. Pass `whitespace-normal` in `className`\n // for the rare button that really should wrap.\n \"whitespace-nowrap\",\n variant !== \"link\" && \"disabled:cursor-not-allowed disabled:opacity-50\",\n variant === \"link\" && \"justify-center\",\n variant !== \"link\" && \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n variantClasses[variant],\n variant !== \"link\" && sizes[size],\n className\n )}\n {...props}\n >\n {isLoading ? (\n <Loader2\n className={cn(\n \"animate-spin\",\n size === \"sm\" ? \"size-3.5\" : size === \"lg\" ? \"size-[1.125rem]\" : \"size-3.5\"\n )}\n />\n ) : (\n leftIcon\n )}\n <span className={cn(isLoading && \"opacity-70\")}>{children}</span>\n {!isLoading && rightIcon}\n </button>\n );\n }\n);\nButton.displayName = \"Button\";\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { ChevronDown } from \"lucide-react\";\nimport {\n forwardRef,\n useState,\n useRef,\n useEffect,\n type HTMLAttributes,\n type ButtonHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"./button\";\nimport type { ButtonProps } from \"./button\";\n\n// ---------------------------------------------------------------------------\n// ButtonGroup\n// ---------------------------------------------------------------------------\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n variant?: ButtonProps[\"variant\"];\n}\n\nexport const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(\n ({ orientation = \"horizontal\", variant, className, children, ...props }, ref) => {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-variant={variant}\n className={cn(\n \"inline-flex\",\n orientation === \"vertical\" ? \"flex-col\" : \"flex-row\",\n // Horizontal connected borders\n orientation === \"horizontal\" && [\n \"[&>*:not(:first-child)]:rounded-l-none\",\n \"[&>*:not(:last-child)]:rounded-r-none\",\n \"[&>*:not(:first-child)]:-ml-px\",\n ],\n // Vertical connected borders\n orientation === \"vertical\" && [\n \"[&>*:not(:first-child)]:rounded-t-none\",\n \"[&>*:not(:last-child)]:rounded-b-none\",\n \"[&>*:not(:first-child)]:-mt-px\",\n ],\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nButtonGroup.displayName = \"ButtonGroup\";\n\n// ---------------------------------------------------------------------------\n// SplitButton\n// ---------------------------------------------------------------------------\n\nexport interface SplitButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onClick\"> {\n label: ReactNode;\n onClick?: ButtonHTMLAttributes<HTMLButtonElement>[\"onClick\"];\n children?: ReactNode;\n variant?: ButtonProps[\"variant\"];\n size?: ButtonProps[\"size\"];\n isLoading?: boolean;\n}\n\nexport const SplitButton = forwardRef<HTMLDivElement, SplitButtonProps>(\n (\n {\n label,\n onClick,\n children,\n variant = \"primary\",\n size = \"md\",\n isLoading = false,\n className,\n disabled,\n ...props\n },\n ref\n ) => {\n const [open, setOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Merge forwarded ref with internal ref\n function setRefs(el: HTMLDivElement | null) {\n (containerRef as React.MutableRefObject<HTMLDivElement | null>).current = el;\n if (typeof ref === \"function\") {\n ref(el);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = el;\n }\n }\n\n // Close dropdown when clicking outside\n useEffect(() => {\n if (!open) return;\n function handleOutside(e: MouseEvent) {\n if (\n containerRef.current &&\n !containerRef.current.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n }\n document.addEventListener(\"mousedown\", handleOutside);\n return () => document.removeEventListener(\"mousedown\", handleOutside);\n }, [open]);\n\n return (\n <div\n ref={setRefs}\n className={cn(\"relative inline-flex\", className)}\n {...(props as HTMLAttributes<HTMLDivElement>)}\n >\n {/* Primary action button */}\n <Button\n variant={variant}\n size={size}\n isLoading={isLoading}\n disabled={disabled}\n onClick={onClick}\n className=\"rounded-r-none\"\n >\n {label}\n </Button>\n\n {/* Dropdown trigger */}\n <button\n type=\"button\"\n disabled={disabled || isLoading}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n onClick={() => setOpen((v) => !v)}\n className={cn(\n \"inline-flex items-center justify-center px-2 rounded-l-none -ml-px\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n // Match variant styling\n variant === \"primary\" &&\n \"bg-primary text-primary-foreground border border-primary shadow-sm hover:bg-[var(--primary-hover)] border-l border-l-primary-foreground/20\",\n variant === \"secondary\" &&\n \"bg-muted text-foreground border border-border shadow-sm hover:bg-muted/85 dark:bg-muted/35 dark:hover:bg-muted/55 border-l-0\",\n variant === \"outline\" &&\n \"bg-card text-foreground border border-border shadow-sm hover:bg-muted border-l-0\",\n variant === \"ghost\" &&\n \"bg-transparent text-foreground border border-transparent hover:bg-muted border-l-0\",\n variant === \"danger\" &&\n \"bg-red-600 text-white border border-red-600 shadow-sm hover:bg-red-700 border-l border-l-white/20\",\n // Size heights to match Button\n size === \"sm\" && \"h-9 min-h-9 rounded-lg\",\n size === \"md\" && \"h-10 min-h-10 rounded-lg\",\n size === \"lg\" && \"h-[3.25rem] min-h-[3.25rem] rounded-xl\"\n )}\n >\n <ChevronDown\n className={cn(\n \"transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\",\n size === \"sm\" ? \"size-3.5\" : size === \"lg\" ? \"size-[1.125rem]\" : \"size-4\"\n )}\n />\n </button>\n\n {/* Dropdown menu */}\n {open && children && (\n <div\n role=\"menu\"\n className={cn(\n \"absolute right-0 top-full mt-1 z-50\",\n \"bg-card border border-border rounded-lg shadow-lg py-1 min-w-32\"\n )}\n >\n {children}\n </div>\n )}\n </div>\n );\n }\n);\nSplitButton.displayName = \"SplitButton\";\n\n// ---------------------------------------------------------------------------\n// SplitButtonItem — convenience wrapper for dropdown items\n// ---------------------------------------------------------------------------\n\nexport interface SplitButtonItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const SplitButtonItem = forwardRef<HTMLButtonElement, SplitButtonItemProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <button\n ref={ref}\n role=\"menuitem\"\n type=\"button\"\n className={cn(\n \"block w-full text-left px-3 py-2 text-sm text-foreground\",\n \"hover:bg-muted transition-colors duration-pg-fast ease-pg-standard\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"focus-visible:outline-none focus-visible:bg-muted\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n );\n }\n);\nSplitButtonItem.displayName = \"SplitButtonItem\";\n","import * as React from \"react\";\n\nimport { cn } from \"./utils\";\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-11 min-h-11 w-full rounded-lg border border-border bg-card px-4 py-2 text-[15px] leading-tight shadow-sm transition-colors\",\n \"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground\",\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:bg-muted/40 disabled:opacity-60\",\n \"read-only:bg-muted/25 read-only:text-muted-foreground\",\n \"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/25 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n }\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Eye, EyeOff } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { Input } from \"./input\";\n\nexport type PasswordInputProps = Omit<React.ComponentProps<typeof Input>, \"type\">;\n\nexport const PasswordInput = React.forwardRef<HTMLInputElement, PasswordInputProps>(\n ({ className, ...props }, ref) => {\n const [visible, setVisible] = React.useState(false);\n return (\n <div className=\"relative\">\n <Input\n ref={ref}\n type={visible ? \"text\" : \"password\"}\n className={cn(\"pr-10\", className)}\n {...props}\n />\n <button\n type=\"button\"\n onClick={() => setVisible((v) => !v)}\n aria-label={visible ? \"Hide password\" : \"Show password\"}\n tabIndex={-1}\n className=\"absolute inset-y-0 right-0 flex w-10 items-center justify-center text-muted-foreground transition-colors hover:text-foreground\"\n >\n {visible ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n </div>\n );\n }\n);\nPasswordInput.displayName = \"PasswordInput\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface OtpInputProps {\n /** Current OTP value (controlled). */\n value: string;\n /** Fires with the full joined string on every change. */\n onChange: (value: string) => void;\n /** Number of digit boxes. */\n length?: number;\n /** Fired when all boxes are filled. */\n onComplete?: (value: string) => void;\n disabled?: boolean;\n invalid?: boolean;\n autoFocus?: boolean;\n \"aria-label\"?: string;\n}\n\nexport function OtpInput({\n value,\n onChange,\n length = 6,\n onComplete,\n disabled,\n invalid,\n autoFocus,\n \"aria-label\": ariaLabel = \"One-time passcode\",\n}: OtpInputProps) {\n const refs = React.useRef<Array<HTMLInputElement | null>>([]);\n const digits = React.useMemo(() => {\n const arr = value.split(\"\").slice(0, length);\n return Array.from({ length }, (_, i) => arr[i] ?? \"\");\n }, [value, length]);\n\n const emit = (next: string) => {\n onChange(next);\n if (next.length === length && !next.includes(\" \")) onComplete?.(next);\n };\n\n const setAt = (index: number, char: string) => {\n const arr = digits.slice();\n arr[index] = char;\n emit(arr.join(\"\").replace(/\\s+$/g, \"\"));\n };\n\n const handleChange = (index: number, raw: string) => {\n const onlyDigits = raw.replace(/\\D/g, \"\");\n if (!onlyDigits) {\n setAt(index, \"\");\n return;\n }\n const chars = onlyDigits.split(\"\");\n const arr = digits.slice();\n let cursor = index;\n for (const c of chars) {\n if (cursor >= length) break;\n arr[cursor] = c;\n cursor += 1;\n }\n emit(arr.join(\"\"));\n refs.current[Math.min(cursor, length - 1)]?.focus();\n };\n\n const handleKeyDown = (index: number, e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Backspace\") {\n e.preventDefault();\n if (digits[index]) {\n setAt(index, \"\");\n } else if (index > 0) {\n refs.current[index - 1]?.focus();\n setAt(index - 1, \"\");\n }\n } else if (e.key === \"ArrowLeft\" && index > 0) {\n refs.current[index - 1]?.focus();\n } else if (e.key === \"ArrowRight\" && index < length - 1) {\n refs.current[index + 1]?.focus();\n }\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n const pasted = e.clipboardData.getData(\"text\").replace(/\\D/g, \"\").slice(0, length);\n if (!pasted) return;\n emit(pasted);\n refs.current[Math.min(pasted.length, length - 1)]?.focus();\n };\n\n return (\n <div className=\"flex gap-2\" role=\"group\" aria-label={ariaLabel}>\n {digits.map((digit, i) => (\n <input\n key={i}\n ref={(el) => { refs.current[i] = el; }}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete={i === 0 ? \"one-time-code\" : \"off\"}\n maxLength={length}\n value={digit}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n autoFocus={autoFocus && i === 0}\n onChange={(e) => handleChange(i, e.target.value)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={handlePaste}\n className={cn(\n \"h-12 w-11 rounded-lg border bg-card text-center text-lg font-semibold text-foreground shadow-sm transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:border-primary\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n invalid ? \"border-destructive ring-destructive/20\" : \"border-input\"\n )}\n />\n ))}\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, ChevronDown, Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { filterOptions, type OptionFilter } from \"./option-filter\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nexport interface CheckboxSelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface CheckboxSelectProps {\n options: CheckboxSelectOption[];\n value: string[];\n onChange: (values: string[]) => void;\n placeholder?: string;\n showSearch?: boolean;\n /** Placeholder inside the search box. Default \"Search...\". */\n searchPlaceholder?: string;\n /**\n * Replaces the default match (label or value, case-insensitive) — for a list\n * that has to be findable by something the row does not display.\n */\n filterOption?: OptionFilter<CheckboxSelectOption>;\n disabled?: boolean;\n maxDisplay?: number;\n className?: string;\n}\n\nfunction getTriggerLabel(\n value: string[],\n options: CheckboxSelectOption[],\n placeholder: string,\n maxDisplay: number\n): string {\n if (value.length === 0) return placeholder;\n if (value.length === options.length) return \"All\";\n if (value.length <= maxDisplay) {\n const labels = value\n .map((v) => options.find((o) => o.value === v)?.label ?? v)\n .filter(Boolean);\n return labels.join(\", \");\n }\n return `${value.length} selected`;\n}\n\nconst CheckboxSelect = React.forwardRef<HTMLButtonElement, CheckboxSelectProps>(\n (\n {\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n showSearch = false,\n searchPlaceholder = \"Search...\",\n filterOption,\n disabled = false,\n maxDisplay = 2,\n className,\n },\n ref\n ) => {\n const [open, setOpen] = React.useState(false);\n const [search, setSearch] = React.useState(\"\");\n\n // Shared with SingleSelect and SelectFilterChip: the value matches as well\n // as the label, so a raw code finds its prettified row.\n const filtered = React.useMemo(\n () => filterOptions(options, search, filterOption),\n [options, search, filterOption]\n );\n\n const allFilteredValues = filtered.filter((o) => !o.disabled).map((o) => o.value);\n const allFilteredSelected =\n allFilteredValues.length > 0 && allFilteredValues.every((v) => value.includes(v));\n const someFilteredSelected = allFilteredValues.some((v) => value.includes(v));\n\n function handleSelectAll() {\n if (allFilteredSelected) {\n onChange(value.filter((v) => !allFilteredValues.includes(v)));\n } else {\n const merged = Array.from(new Set([...value, ...allFilteredValues]));\n onChange(merged);\n }\n }\n\n function handleClearAll() {\n onChange(value.filter((v) => !allFilteredValues.includes(v)));\n }\n\n function handleToggle(optValue: string) {\n if (value.includes(optValue)) {\n onChange(value.filter((v) => v !== optValue));\n } else {\n onChange([...value, optValue]);\n }\n }\n\n const triggerLabel = getTriggerLabel(value, options, placeholder, maxDisplay);\n const hasSelection = value.length > 0;\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n className={cn(\n \"flex h-11 w-full items-center justify-between gap-2.5 rounded-lg border border-border bg-card px-4 py-2 text-[15px] shadow-sm outline-none\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n hasSelection ? \"text-foreground\" : \"text-muted-foreground\",\n className\n )}\n >\n <span className=\"truncate\">{triggerLabel}</span>\n <ChevronDown\n className={cn(\n \"h-4 w-4 shrink-0 text-muted-foreground opacity-70 transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\"\n )}\n />\n </button>\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal>\n {/* Takes over the scroll lock when this opens inside a Dialog or\n Drawer, so the list can be scrolled. See `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={6}\n collisionPadding={8}\n className={cn(\n \"z-[120] min-w-[var(--radix-popover-trigger-width)] w-full rounded-xl border border-border bg-popover text-popover-foreground shadow-lg outline-none p-1\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\"\n )}\n >\n {showSearch && (\n <div className=\"relative mb-1 px-1 pt-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n className={cn(\n \"flex h-9 w-full rounded-md border border-border bg-card pl-8 pr-3 text-sm shadow-sm placeholder:text-muted-foreground\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n />\n </div>\n )}\n\n <div className=\"flex items-center justify-between px-2 py-1.5\">\n <button\n type=\"button\"\n onClick={handleSelectAll}\n className={cn(\n \"text-xs font-medium transition-colors duration-pg-fast ease-pg-standard\",\n allFilteredSelected\n ? \"text-primary hover:text-primary/80\"\n : someFilteredSelected\n ? \"text-primary hover:text-primary/80\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {allFilteredSelected ? \"Deselect all\" : \"Select all\"}\n </button>\n {value.length > 0 && (\n <button\n type=\"button\"\n onClick={handleClearAll}\n className=\"text-xs font-medium text-muted-foreground transition-colors duration-pg-fast ease-pg-standard hover:text-foreground\"\n >\n Clear\n </button>\n )}\n </div>\n\n <div className=\"my-0.5 h-px bg-border mx-1\" />\n\n {/* Capped by the room the popover has, so a long list near the\n bottom of a dialog scrolls rather than running off-screen. */}\n <div className=\"overflow-y-auto overscroll-contain py-0.5 max-h-[min(15rem,var(--radix-popover-content-available-height,15rem))]\">\n {filtered.length === 0 ? (\n <div className=\"px-3 py-6 text-center text-sm text-muted-foreground\">\n No options found.\n </div>\n ) : (\n filtered.map((option) => {\n const checked = value.includes(option.value);\n return (\n <div\n key={option.value}\n role=\"option\"\n aria-selected={checked}\n aria-disabled={option.disabled}\n onClick={() => !option.disabled && handleToggle(option.value)}\n className={cn(\n \"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm select-none\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n option.disabled\n ? \"cursor-not-allowed opacity-50\"\n : \"cursor-pointer hover:bg-muted\"\n )}\n >\n <CheckboxPrimitive.Root\n checked={checked}\n disabled={option.disabled}\n onCheckedChange={() => !option.disabled && handleToggle(option.value)}\n onClick={(e) => e.stopPropagation()}\n className={cn(\n \"peer h-4 w-4 shrink-0 rounded-md border border-border bg-card shadow-sm\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary data-[state=checked]:border-primary\"\n )}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-primary-foreground\">\n <Check className=\"size-3\" strokeWidth={3} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n <span\n className={cn(\n \"leading-none\",\n checked ? \"text-foreground\" : \"text-foreground\"\n )}\n >\n {option.label}\n </span>\n </div>\n );\n })\n )}\n </div>\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n }\n);\n\nCheckboxSelect.displayName = \"CheckboxSelect\";\n\nexport { CheckboxSelect };\n","/**\n * Shared option-search behaviour for the select family.\n *\n * Every picker that can be searched matches the same way, so a user who learns\n * that typing a raw code works in one dropdown can rely on it in the next.\n */\n\nexport interface FilterableOption {\n value: string;\n label: string;\n}\n\n/**\n * A custom match. Return true to keep the option in the list.\n *\n * The `query` arrives trimmed but otherwise untouched, so a predicate that\n * cares about case can have it.\n */\nexport type OptionFilter<T extends FilterableOption = FilterableOption> = (\n option: T,\n query: string\n) => boolean;\n\n/**\n * The default: case-insensitive against the label **and** the value, so \"nz\"\n * finds New Zealand and a raw status code finds its prettified row. Someone who\n * thinks in codes should not have to know the display name.\n *\n * This is the rule `SelectFilterChip` already applied to its list; the form\n * fields now share it rather than each picker inventing its own.\n */\nexport function defaultOptionFilter<T extends FilterableOption>(option: T, query: string): boolean {\n const q = query.toLowerCase();\n return option.label.toLowerCase().includes(q) || option.value.toLowerCase().includes(q);\n}\n\n/** Applies `filter` (or the default) to `options`, with an empty query passing everything. */\nexport function filterOptions<T extends FilterableOption>(\n options: T[],\n query: string,\n filter?: OptionFilter<T>\n): T[] {\n const q = query.trim();\n if (!q) return options;\n const match = filter ?? defaultOptionFilter;\n return options.filter((o) => match(o, q));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { RemoveScroll } from \"react-remove-scroll\";\n\n/**\n * Scrolling inside an overlay that sits on top of another overlay.\n *\n * ## The defect this exists to prevent\n *\n * A modal `Dialog` or `Drawer` installs a `react-remove-scroll` lock. That lock\n * listens for `wheel` and `touchmove` on `document` and, for any event whose\n * target is **outside** the locked subtree, calls `preventDefault()` — the\n * \"outside or shard event\" branch of its `SideEffect`. Radix passes only the\n * dialog's own content as a shard.\n *\n * Every panel a picker opens is portalled to `document.body`, which puts it\n * outside that subtree. So the panel renders, its list has `overflow-y-auto`,\n * and the wheel does nothing. It is invisible in code review, because the\n * component is correct on its own; it only misbehaves under an overlay.\n *\n * ## Why a lock, not an exception\n *\n * The same `SideEffect` returns early unless its own lock is the last one\n * pushed. So the fix is not to poke a hole in the dialog's lock — it is for the\n * panel to push a lock of its own while it is open, which suspends the one\n * underneath and makes the panel's subtree the locked one. When it closes, its\n * lock pops and the dialog's resumes.\n *\n * ## Why not just make the popover `modal`\n *\n * Radix installs a lock of its own for a `modal` popover, which would also fix\n * the wheel — but it comes with a focus trap and with outside clicks being\n * swallowed by the dismiss layer. Every popover already living inside a dialog\n * would start behaving differently for the sake of a scrolling fix. So the lock\n * is pushed directly, by {@link ScrollLockTakeover}, and modality is left\n * alone. `PopoverContent` wraps every panel in it, which covers the pickers and\n * anything an app composes; the hand-rolled `createPortal` panels\n * (`DatePicker`, `TimePicker`) wrap theirs the same way.\n */\n\n/**\n * Whether a `react-remove-scroll` lock is currently held — by a modal Dialog,\n * Drawer, AlertDialog, or another picker.\n *\n * `data-scroll-locked` is set on `<body>` by `react-remove-scroll-bar`, which\n * every such lock goes through, so this is the library's own signal rather\n * than a guess about which overlay is open.\n */\nexport function isScrollLocked(): boolean {\n return typeof document !== \"undefined\" && document.body.hasAttribute(\"data-scroll-locked\");\n}\n\n/**\n * The same takeover for a panel that portals itself instead of going through\n * Radix. Renders children untouched when no lock is held, so a picker on a\n * plain page behaves exactly as before.\n *\n * `removeScrollBar` is off: the page's scrollbar is already gone, and a second\n * `RemoveScrollBar` re-measures a gap that is now zero and writes it back over\n * the dialog's, shifting the layout while the panel is open. The consequence is\n * that this takeover does **not** bump `data-scroll-locked`; the wrapper's\n * `data-scroll-lock-takeover` is the marker instead, in the DOM for debugging\n * and for tests.\n */\nexport function ScrollLockTakeover({ children }: { children: React.ReactNode }) {\n // Read once, when the panel mounts — that is the moment it opens.\n const [active] = React.useState(isScrollLocked);\n if (!active) return <>{children}</>;\n return (\n <RemoveScroll removeScrollBar={false} allowPinchZoom data-scroll-lock-takeover=\"\">\n {children}\n </RemoveScroll>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { Check, ChevronDown, Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { filterOptions, type OptionFilter } from \"./option-filter\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nexport interface SingleSelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n /** Optional leading glyph — a flag, a brand mark, a status dot. */\n icon?: React.ReactNode;\n}\n\nexport interface SingleSelectProps {\n /** Put on the trigger, so a `FieldLabel`'s `htmlFor` can point at it. */\n id?: string;\n options: SingleSelectOption[];\n /** The chosen value, or \"\" for none. */\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /**\n * Show a search box above the list. Left unset it appears once there are\n * `searchThreshold` options — a search field over three items is noise, and\n * remembering to pass the flag is how two lists of the same length end up\n * behaving differently.\n */\n showSearch?: boolean;\n /** How many options before the search box appears on its own. Default 8. */\n searchThreshold?: number;\n /** Placeholder inside that search box. Default \"Search...\". */\n searchPlaceholder?: string;\n /**\n * Replaces the default match (label or value, case-insensitive) — for a list\n * that has to be findable by something the row does not display, such as a\n * currency's full name behind a symbol.\n */\n filterOption?: OptionFilter<SingleSelectOption>;\n /** Adds a \"Clear\" row so a chosen value can be taken back to \"\". */\n clearable?: boolean;\n /** Line shown when the list is empty. Default \"No options found.\". */\n emptyText?: string;\n disabled?: boolean;\n /** Marks the field as failing validation, matching `Input`'s aria-invalid styling. */\n invalid?: boolean;\n className?: string;\n}\n\n/**\n * One-of-many as a **form field** — the single-value counterpart to\n * {@link CheckboxSelect}, with the same trigger, popover and search.\n *\n * Radix `Select` cannot host a text input (its own typeahead owns the\n * keystrokes), so a searchable single select has to be a popover over a\n * listbox. Before this existed, every screen needing one built that popover\n * itself, which is how a design system ends up with four dropdowns that filter\n * differently. `SingleSelectFilterChip` remains the toolbar form of the same\n * idea; this is the one that sits in a form, under a `FieldLabel`.\n */\nconst SingleSelect = React.forwardRef<HTMLButtonElement, SingleSelectProps>(\n (\n {\n id,\n options,\n value,\n onChange,\n placeholder = \"Select an option\",\n showSearch,\n searchThreshold = 8,\n searchPlaceholder = \"Search...\",\n filterOption,\n clearable = false,\n emptyText = \"No options found.\",\n disabled = false,\n invalid = false,\n className,\n },\n ref\n ) => {\n const [open, setOpen] = React.useState(false);\n const [search, setSearch] = React.useState(\"\");\n const searchRef = React.useRef<HTMLInputElement>(null);\n\n const searchable = showSearch ?? options.length >= searchThreshold;\n\n const filtered = React.useMemo(\n () => (searchable ? filterOptions(options, search, filterOption) : options),\n [options, search, filterOption, searchable]\n );\n\n const selected = options.find((o) => o.value === value);\n\n function close() {\n setOpen(false);\n // Dropped on close so the next open starts from the whole list rather\n // than yesterday's query.\n setSearch(\"\");\n }\n\n function pick(next: string) {\n onChange(next);\n close();\n }\n\n return (\n <PopoverPrimitive.Root\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n >\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={ref}\n id={id}\n type=\"button\"\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-invalid={invalid || undefined}\n className={cn(\n \"flex h-11 w-full items-center justify-between gap-2.5 rounded-lg border border-border bg-card px-4 py-2 text-[15px] shadow-sm outline-none\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/25 dark:aria-invalid:ring-destructive/40\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n selected ? \"text-foreground\" : \"text-muted-foreground\",\n className\n )}\n >\n <span className=\"flex min-w-0 items-center gap-2 truncate\">\n {selected?.icon}\n <span className=\"truncate\">{selected?.label ?? placeholder}</span>\n </span>\n <ChevronDown\n className={cn(\n \"h-4 w-4 shrink-0 text-muted-foreground opacity-70 transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\"\n )}\n />\n </button>\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal>\n {/* Takes over the scroll lock when this opens inside a Dialog or\n Drawer, so the list can be scrolled. See `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={6}\n collisionPadding={8}\n className={cn(\n \"z-[120] min-w-[var(--radix-popover-trigger-width)] w-full rounded-xl border border-border bg-popover text-popover-foreground shadow-lg outline-none p-1\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\"\n )}\n >\n {searchable && (\n <div className=\"relative mb-1 px-1 pt-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n className={cn(\n \"flex h-9 w-full rounded-md border border-border bg-card pl-8 pr-3 text-sm shadow-sm placeholder:text-muted-foreground\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n />\n </div>\n )}\n\n {clearable && value !== \"\" && (\n <>\n <button\n type=\"button\"\n onClick={() => pick(\"\")}\n className=\"w-full rounded-md px-3 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors duration-pg-fast ease-pg-standard hover:bg-muted hover:text-foreground\"\n >\n Clear\n </button>\n <div className=\"my-0.5 h-px bg-border mx-1\" />\n </>\n )}\n\n {/* Capped by the room the popover has, so a long list near the\n bottom of a dialog scrolls rather than running off-screen. */}\n <div\n role=\"listbox\"\n className=\"overflow-y-auto overscroll-contain py-0.5 max-h-[min(15rem,var(--radix-popover-content-available-height,15rem))]\"\n >\n {filtered.length === 0 ? (\n <div className=\"px-3 py-6 text-center text-sm text-muted-foreground\">\n {emptyText}\n </div>\n ) : (\n filtered.map((option) => {\n const isSelected = option.value === value;\n return (\n <div\n key={option.value}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled}\n onClick={() => !option.disabled && pick(option.value)}\n className={cn(\n \"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm select-none\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n option.disabled\n ? \"cursor-not-allowed opacity-50\"\n : \"cursor-pointer hover:bg-muted\",\n isSelected && \"bg-muted\"\n )}\n >\n {option.icon}\n <span className=\"min-w-0 flex-1 truncate leading-none\">{option.label}</span>\n {isSelected && <Check className=\"size-3.5 shrink-0 text-primary\" strokeWidth={3} />}\n </div>\n );\n })\n )}\n </div>\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n }\n);\n\nSingleSelect.displayName = \"SingleSelect\";\n\nexport { SingleSelect };\n","import * as React from \"react\";\n\nimport { cn } from \"./utils\";\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<\"textarea\">>(\n ({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n \"flex min-h-[5.5rem] w-full rounded-lg border border-border bg-card px-4 py-3 text-[15px] leading-relaxed shadow-sm transition-colors\",\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n }\n);\nTextarea.displayName = \"Textarea\";\n\nexport { Textarea };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type CheckboxSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {\n size?: CheckboxSize;\n}\n\nconst sizeClasses: Record<CheckboxSize, string> = {\n sm: \"h-3.5 w-3.5 rounded\",\n md: \"h-4 w-4 rounded-md\",\n lg: \"h-[1.125rem] w-[1.125rem] rounded-md\",\n};\n\nconst iconSizes: Record<CheckboxSize, string> = {\n sm: \"size-2.5\",\n md: \"size-3\",\n lg: \"size-3.5\",\n};\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"peer shrink-0 border border-border bg-card shadow-sm transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary data-[state=checked]:border-primary\",\n \"data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary\",\n sizeClasses[size],\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-primary-foreground\">\n {props.checked === \"indeterminate\" ? (\n <Minus className={iconSizes[size]} strokeWidth={3} />\n ) : (\n <Check className={iconSizes[size]} strokeWidth={3} />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport { cn } from \"./utils\";\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <RadioGroupPrimitive.Root\n ref={ref}\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n));\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\n\nexport type RadioGroupItemProps = React.ComponentPropsWithoutRef<\n typeof RadioGroupPrimitive.Item\n>;\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, ...props }, ref) => (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"size-4 shrink-0 rounded-full border border-border bg-card shadow-sm\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"data-[state=checked]:border-primary\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <span className=\"block size-2 rounded-full bg-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n));\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\n\nexport { RadioGroup, RadioGroupItem };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\n\nconst switchRootVariants = cva(\n [\n \"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=unchecked]:bg-muted data-[state=unchecked]:border-border\",\n \"data-[state=checked]:bg-primary data-[state=checked]:border-transparent\",\n ],\n {\n variants: {\n size: {\n sm: \"h-5 w-9\",\n md: \"h-6 w-11\",\n lg: \"h-7 w-[3.25rem]\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n }\n);\n\nconst switchThumbVariants = cva(\n [\n \"pointer-events-none block rounded-full bg-white shadow-sm\",\n \"transition-transform duration-pg-fast ease-pg-standard\",\n \"ring-0\",\n ],\n {\n variants: {\n size: {\n sm: \"size-3.5 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5\",\n md: \"size-4.5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0.5\",\n lg: \"size-5.5 data-[state=checked]:translate-x-6 data-[state=unchecked]:translate-x-0.5\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n }\n);\n\nexport interface SwitchProps\n extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>,\n VariantProps<typeof switchRootVariants> {}\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, size, ...props }, ref) => (\n <SwitchPrimitive.Root\n ref={ref}\n className={cn(switchRootVariants({ size }), className)}\n {...props}\n >\n <SwitchPrimitive.Thumb className={cn(switchThumbVariants({ size }))} />\n </SwitchPrimitive.Root>\n));\nSwitch.displayName = SwitchPrimitive.Root.displayName;\n\nexport { Switch };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport { cn } from \"./utils\";\n\nexport interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {}\n\nconst Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, SliderProps>(\n ({ className, ...props }, ref) => (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\"relative flex w-full touch-none select-none items-center\", className)}\n {...props}\n >\n <SliderPrimitive.Track className=\"relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted\">\n <SliderPrimitive.Range className=\"absolute h-full bg-primary\" />\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb className=\"block h-[18px] w-[18px] rounded-full border-2 border-primary bg-card shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 disabled:pointer-events-none disabled:opacity-50\" />\n </SliderPrimitive.Root>\n )\n);\nSlider.displayName = SliderPrimitive.Root.displayName;\n\nexport { Slider };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { AlertCircle } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type FormValues = Record<string, string>;\nexport type FormErrors = Record<string, string>;\n\nexport interface ValidatorRule {\n required?: boolean | string;\n minLength?: { value: number; message: string };\n maxLength?: { value: number; message: string };\n pattern?: { value: RegExp; message: string };\n validate?: (value: string) => string | undefined;\n}\n\nexport interface FieldConfig {\n defaultValue?: string;\n rules?: ValidatorRule;\n}\n\nexport type FieldsConfig = Record<string, FieldConfig>;\n\nexport interface RegisterResult {\n name: string;\n id: string;\n value: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;\n onBlur: () => void;\n}\n\nexport interface UseFormReturn {\n values: FormValues;\n errors: FormErrors;\n register: (name: string) => RegisterResult;\n handleSubmit: (onValid: (values: FormValues) => void, onInvalid?: (errors: FormErrors) => void) => (e: React.FormEvent) => void;\n setError: (name: string, message: string) => void;\n clearError: (name: string) => void;\n reset: () => void;\n setValue: (name: string, value: string) => void;\n}\n\nexport function useForm(fields: FieldsConfig = {}): UseFormReturn {\n const initial = Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, v.defaultValue ?? \"\"]));\n const [values, setValues] = React.useState<FormValues>(initial);\n const [errors, setErrors] = React.useState<FormErrors>({});\n\n function validate(name: string, value: string): string | undefined {\n const rules = fields[name]?.rules;\n if (!rules) return undefined;\n if (rules.required && !value.trim()) return typeof rules.required === \"string\" ? rules.required : \"This field is required\";\n if (rules.minLength && value.length < rules.minLength.value) return rules.minLength.message;\n if (rules.maxLength && value.length > rules.maxLength.value) return rules.maxLength.message;\n if (rules.pattern && !rules.pattern.value.test(value)) return rules.pattern.message;\n if (rules.validate) return rules.validate(value);\n }\n\n const register = (name: string): RegisterResult => ({\n name,\n id: name,\n value: values[name] ?? \"\",\n onChange: (e) => setValues(v => ({ ...v, [name]: e.target.value })),\n onBlur: () => {\n const err = validate(name, values[name] ?? \"\");\n setErrors(e => err ? { ...e, [name]: err } : (({ [name]: _, ...rest }) => rest)(e));\n },\n });\n\n const handleSubmit = (onValid: (v: FormValues) => void, onInvalid?: (e: FormErrors) => void) => (e: React.FormEvent) => {\n e.preventDefault();\n const newErrors: FormErrors = {};\n for (const [name] of Object.entries(fields)) {\n const err = validate(name, values[name] ?? \"\");\n if (err) newErrors[name] = err;\n }\n if (Object.keys(newErrors).length > 0) {\n setErrors(newErrors);\n onInvalid?.(newErrors);\n } else {\n setErrors({});\n onValid(values);\n }\n };\n\n return {\n values,\n errors,\n register,\n handleSubmit,\n setError: (name, msg) => setErrors(e => ({ ...e, [name]: msg })),\n clearError: (name) => setErrors(e => (({ [name]: _, ...rest }) => rest)(e)),\n reset: () => { setValues(initial); setErrors({}); },\n setValue: (name, value) => setValues(v => ({ ...v, [name]: value })),\n };\n}\n\nexport interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {}\n\nconst Form = React.forwardRef<HTMLFormElement, FormProps>(\n ({ className, ...props }, ref) => (\n <form ref={ref} className={cn(\"space-y-4\", className)} {...props} />\n )\n);\nForm.displayName = \"Form\";\n\nexport interface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col gap-1.5\", className)} {...props} />\n )\n);\nFormItem.displayName = \"FormItem\";\n\nexport interface FormLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n required?: boolean;\n}\n\nconst FormLabel = React.forwardRef<HTMLLabelElement, FormLabelProps>(\n ({ className, required, children, ...props }, ref) => (\n <label ref={ref} className={cn(\"text-sm font-medium text-foreground\", className)} {...props}>\n {children}\n {required && <span className=\"ml-1 text-destructive\">*</span>}\n </label>\n )\n);\nFormLabel.displayName = \"FormLabel\";\n\nexport interface FormControlProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormControl = React.forwardRef<HTMLDivElement, FormControlProps>(\n ({ ...props }, ref) => <div ref={ref} {...props} />\n);\nFormControl.displayName = \"FormControl\";\n\nexport interface FormDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-xs text-muted-foreground\", className)} {...props} />\n )\n);\nFormDescription.displayName = \"FormDescription\";\n\nexport interface FormErrorProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormError = React.forwardRef<HTMLParagraphElement, FormErrorProps>(\n ({ className, children, ...props }, ref) =>\n children ? (\n <p ref={ref} className={cn(\"flex items-center gap-1 text-xs text-destructive\", className)} {...props}>\n <AlertCircle className=\"size-3 shrink-0\" />\n {children}\n </p>\n ) : null\n);\nFormError.displayName = \"FormError\";\n\nexport interface FormFieldProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormField = React.forwardRef<HTMLDivElement, FormFieldProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col gap-1.5\", className)} {...props} />\n )\n);\nFormField.displayName = \"FormField\";\n\nexport { Form, FormItem, FormLabel, FormControl, FormDescription, FormError, FormField };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\nimport { Label } from \"./label\";\nimport { Separator } from \"./separator\";\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-6\",\n \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-3 font-medium\",\n \"data-[variant=legend]:text-base\",\n \"data-[variant=label]:text-sm\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva(\"group/field flex w-full gap-3 data-[invalid=true]:text-destructive\", {\n variants: {\n orientation: {\n vertical: [\"flex-col [&>*]:w-full [&>.sr-only]:w-auto\"],\n horizontal: [\n \"flex-row items-center\",\n \"[&>[data-slot=field-label]]:flex-auto\",\n \"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start\",\n ],\n responsive: [\n \"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto\",\n \"@md/field-group:[&>[data-slot=field-label]]:flex-auto\",\n \"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n ],\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nfunction Field({\n className,\n orientation = \"vertical\",\n invalid,\n disabled,\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof fieldVariants> & {\n invalid?: boolean;\n disabled?: boolean;\n }) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n data-invalid={invalid ? true : undefined}\n data-disabled={disabled ? true : undefined}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\", className)}\n {...props}\n />\n );\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50\",\n \"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 [&>[data-slot=field]]:p-4\",\n \"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-sm font-normal leading-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance\",\n \"nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5\",\n \"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n className\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children ? (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n ) : null}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return errors[0].message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {errors.map(\n (error, index) => error?.message && <li key={index}>{error.message}</li>\n )}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-sm font-normal text-destructive\", className)}\n {...props}\n >\n {content}\n </div>\n );\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\n\nimport { cn } from \"./utils\";\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\nimport { Input } from \"./input\";\nimport { Textarea } from \"./textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"group/input-group relative flex w-full items-stretch rounded-xl border border-border bg-card shadow-sm outline-none transition-[color,box-shadow] dark:bg-card/50\",\n \"min-h-11 h-11 has-[>textarea]:h-auto\",\n \"has-[>[data-align=inline-start]]:[&>input]:pl-2\",\n \"has-[>[data-align=inline-end]]:[&>input]:pr-2\",\n \"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3\",\n \"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3\",\n \"has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring\",\n \"has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40\",\n className\n )}\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"text-muted-foreground flex h-auto min-h-11 cursor-text select-none items-center justify-center gap-2 px-0 text-[15px] font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\":\n \"order-first pl-3.5 has-[>button]:-ml-[0.45rem] has-[>kbd]:-ml-[0.35rem]\",\n \"inline-end\":\n \"order-last pr-3.5 has-[>button]:-mr-[0.4rem] has-[>kbd]:-mr-[0.35rem]\",\n \"block-start\":\n \"order-first w-full justify-start border-b px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3\",\n \"block-end\":\n \"order-last w-full justify-start border-t px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n }\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return;\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus();\n }}\n {...props}\n />\n );\n}\n\nconst inputGroupButtonVariants = cva(\n \"inline-flex items-center justify-center gap-2 border border-transparent bg-transparent text-sm font-medium text-foreground shadow-none transition-colors hover:bg-muted\",\n {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5\",\n \"icon-xs\": \"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n }\n);\n\nfunction InputGroupButton({\n className,\n type = \"button\",\n size = \"xs\",\n ...props\n}: React.ComponentProps<\"button\"> & VariantProps<typeof inputGroupButtonVariants>) {\n return (\n <button\n type={type}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n );\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"text-muted-foreground flex items-center gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction InputGroupInput({ className, ...props }: React.ComponentProps<\"input\">) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n","\"use client\";\n\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst CURRENCIES = [\"USD\", \"INR\", \"EUR\", \"GBP\", \"SGD\", \"AED\", \"JPY\"];\n\ninterface CurrencyAmountInputProps {\n currency: string;\n amount: string;\n onCurrencyChange: (currency: string) => void;\n onAmountChange: (amount: string) => void;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n currencies?: string[];\n id?: string;\n}\n\nexport function CurrencyAmountInput({\n currency,\n amount,\n onCurrencyChange,\n onAmountChange,\n placeholder = \"0.00\",\n disabled = false,\n required = false,\n currencies = CURRENCIES,\n id,\n}: CurrencyAmountInputProps) {\n return (\n <div className=\"flex h-12 min-h-12 items-stretch overflow-hidden rounded-xl border border-border bg-card text-[15px] transition-all focus-within:border-muted-foreground/50 focus-within:ring-2 focus-within:ring-ring/20\">\n <div className=\"relative flex min-w-[5.25rem] shrink-0 items-center border-r border-border bg-muted/25 px-3\">\n <select\n value={currency}\n onChange={(e) => onCurrencyChange(e.target.value)}\n disabled={disabled}\n aria-label=\"Currency\"\n className={cn(\n \"h-full min-h-0 w-full min-w-0 cursor-pointer bg-transparent py-2 pl-1 pr-9 text-[15px] font-semibold text-foreground\",\n \"focus:outline-none disabled:opacity-50\",\n \"appearance-none [-webkit-appearance:none] [-moz-appearance:none]\",\n \"[&::-ms-expand]:hidden\"\n )}\n >\n {currencies.map((c) => (\n <option key={c} value={c}>\n {c}\n </option>\n ))}\n </select>\n <ChevronDown\n className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground opacity-80\"\n aria-hidden\n />\n </div>\n\n <input\n id={id}\n type=\"number\"\n value={amount}\n onChange={(e) => onAmountChange(e.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n min=\"0\"\n step=\"0.01\"\n className=\"min-h-0 min-w-0 flex-1 bg-transparent px-4 py-3 text-[15px] tabular-nums text-foreground placeholder:text-muted-foreground focus:outline-none disabled:opacity-50\"\n />\n </div>\n );\n}\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\n\nconst cardVariants = cva(\"flex flex-col rounded-xl border border-border bg-card text-card-foreground shadow-sm\", {\n variants: {\n size: {\n default: \"gap-10 px-10 py-10\",\n sm: \"gap-6 px-7 py-7\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n});\n\nfunction Card({\n className,\n size,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof cardVariants>) {\n return (\n <div\n data-slot=\"card\"\n className={cn(cardVariants({ size }), className)}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-4 px-0 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\"text-lg font-semibold leading-snug tracking-tight\", className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm leading-relaxed text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div data-slot=\"card-content\" className={cn(\"px-0\", className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex flex-wrap items-center gap-3 border-t border-border px-0 pt-8 pb-0 sm:gap-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"./utils\";\n\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n <ScrollAreaPrimitive.Root ref={ref} className={cn(\"relative overflow-hidden\", className)} {...props}>\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full rounded-[inherit]\">{children}</ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n));\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" && \"h-full w-2.5 border-l border-l-transparent p-px\",\n orientation === \"horizontal\" && \"h-2.5 flex-col border-t border-t-transparent p-px\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border hover:bg-muted-foreground/30\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;\n\nexport { ScrollArea, ScrollBar };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface SideNavProps extends React.ComponentPropsWithoutRef<\"aside\"> {\n /** \"collapsed\" renders icon-only at 60px; \"expanded\" renders full at 240px (default) */\n width?: \"collapsed\" | \"expanded\";\n /** Controlled collapsed state */\n isCollapsed?: boolean;\n /** Called when the sidebar requests a collapse/expand */\n onCollapse?: (collapsed: boolean) => void;\n}\n\nexport interface SideNavItemProps extends React.ComponentPropsWithoutRef<\"a\"> {\n /** Icon element — required, rendered at size-4 shrink-0 */\n icon: React.ReactNode;\n /** Visible label — hidden when sidebar is collapsed */\n label: string;\n /** Highlights the item as the current route */\n isActive?: boolean;\n /** Navigable href — renders an <a> when provided */\n href?: string;\n /** Click handler */\n onClick?: React.MouseEventHandler<HTMLElement>;\n /** Optional badge slot rendered after the label */\n badge?: React.ReactNode;\n /** Injected by SideNavSection — consumers should not pass this */\n _collapsed?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface SideNavContextValue {\n isCollapsed: boolean;\n}\n\nconst SideNavContext = React.createContext<SideNavContextValue>({\n isCollapsed: false,\n});\n\nfunction useSideNavContext() {\n return React.useContext(SideNavContext);\n}\n\n// ---------------------------------------------------------------------------\n// SideNav\n// ---------------------------------------------------------------------------\n\nconst SideNav = React.forwardRef<HTMLElement, SideNavProps>(\n (\n {\n className,\n width = \"expanded\",\n isCollapsed: isCollapsedProp,\n onCollapse,\n children,\n ...props\n },\n ref\n ) => {\n const collapsed =\n isCollapsedProp !== undefined ? isCollapsedProp : width === \"collapsed\";\n\n return (\n <SideNavContext.Provider value={{ isCollapsed: collapsed }}>\n <aside\n ref={ref}\n data-slot=\"side-nav\"\n data-collapsed={collapsed}\n className={cn(\n \"flex flex-col bg-sidebar border-r border-sidebar-border\",\n \"transition-all duration-pg-normal ease-pg-standard\",\n collapsed ? \"w-[60px]\" : \"w-[240px]\",\n className\n )}\n {...props}\n >\n {children}\n </aside>\n </SideNavContext.Provider>\n );\n }\n);\nSideNav.displayName = \"SideNav\";\n\n// ---------------------------------------------------------------------------\n// SideNavHeader\n// ---------------------------------------------------------------------------\n\nconst SideNavHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"side-nav-header\"\n className={cn(\n \"px-4 py-4 border-b border-sidebar-border shrink-0\",\n className\n )}\n {...props}\n />\n));\nSideNavHeader.displayName = \"SideNavHeader\";\n\n// ---------------------------------------------------------------------------\n// SideNavSection\n// ---------------------------------------------------------------------------\n\ninterface SideNavSectionProps extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Optional section label — hidden when sidebar is collapsed */\n label?: string;\n}\n\nconst SideNavSection = React.forwardRef<HTMLDivElement, SideNavSectionProps>(\n ({ className, label, children, ...props }, ref) => {\n const { isCollapsed } = useSideNavContext();\n\n return (\n <div\n ref={ref}\n data-slot=\"side-nav-section\"\n className={cn(\"px-3 py-2\", className)}\n {...props}\n >\n {label && !isCollapsed && (\n <p className=\"mb-1 px-3 text-xs font-medium text-muted-foreground uppercase tracking-wider select-none\">\n {label}\n </p>\n )}\n {children}\n </div>\n );\n }\n);\nSideNavSection.displayName = \"SideNavSection\";\n\n// ---------------------------------------------------------------------------\n// SideNavItem\n// ---------------------------------------------------------------------------\n\nconst SideNavItem = React.forwardRef<HTMLAnchorElement, SideNavItemProps>(\n (\n {\n className,\n icon,\n label,\n isActive = false,\n href,\n onClick,\n badge,\n _collapsed,\n children,\n ...props\n },\n ref\n ) => {\n const { isCollapsed } = useSideNavContext();\n const collapsed = _collapsed !== undefined ? _collapsed : isCollapsed;\n\n const baseClassName = cn(\n \"flex items-center gap-3 px-3 py-2 rounded-lg text-sm cursor-pointer\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n isActive\n ? \"bg-primary/10 text-primary font-medium\"\n : \"text-sidebar-foreground hover:bg-muted/50\",\n collapsed && \"justify-center px-0\",\n className\n );\n\n const content = (\n <>\n <span className=\"size-4 shrink-0 flex items-center justify-center\">\n {icon}\n </span>\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate\">{label}</span>\n {badge && <span className=\"shrink-0\">{badge}</span>}\n </>\n )}\n </>\n );\n\n if (href) {\n return (\n <a\n ref={ref}\n href={href}\n title={collapsed ? label : undefined}\n aria-current={isActive ? \"page\" : undefined}\n className={baseClassName}\n onClick={onClick as React.MouseEventHandler<HTMLAnchorElement>}\n {...props}\n >\n {content}\n </a>\n );\n }\n\n return (\n <a\n ref={ref}\n role=\"button\"\n tabIndex={0}\n title={collapsed ? label : undefined}\n aria-current={isActive ? \"page\" : undefined}\n className={baseClassName}\n onClick={onClick as React.MouseEventHandler<HTMLAnchorElement>}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onClick?.(e as unknown as React.MouseEvent<HTMLElement>);\n }\n }}\n {...props}\n >\n {content}\n </a>\n );\n }\n);\nSideNavItem.displayName = \"SideNavItem\";\n\n// ---------------------------------------------------------------------------\n// SideNavFooter\n// ---------------------------------------------------------------------------\n\nconst SideNavFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"side-nav-footer\"\n className={cn(\n \"mt-auto border-t border-sidebar-border px-3 py-3 shrink-0\",\n className\n )}\n {...props}\n />\n));\nSideNavFooter.displayName = \"SideNavFooter\";\n\n// ---------------------------------------------------------------------------\n// Exports\n// ---------------------------------------------------------------------------\n\nexport {\n SideNav,\n SideNavHeader,\n SideNavSection,\n SideNavItem,\n SideNavFooter,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst Breadcrumb = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<\"nav\"> & {\n separator?: React.ReactNode;\n }\n>(({ className, ...props }, ref) => (\n <nav\n ref={ref}\n aria-label=\"breadcrumb\"\n className={cn(\"\", className)}\n {...props}\n />\n));\nBreadcrumb.displayName = \"Breadcrumb\";\n\nconst BreadcrumbList = React.forwardRef<\n HTMLOListElement,\n React.ComponentPropsWithoutRef<\"ol\">\n>(({ className, ...props }, ref) => (\n <ol\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2\",\n className\n )}\n {...props}\n />\n));\nBreadcrumbList.displayName = \"BreadcrumbList\";\n\nconst BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<\"li\">\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\"inline-flex items-center gap-1.5\", className)}\n {...props}\n />\n));\nBreadcrumbItem.displayName = \"BreadcrumbItem\";\n\nconst BreadcrumbLink = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentPropsWithoutRef<\"a\">\n>(({ className, ...props }, ref) => (\n <a\n ref={ref}\n className={cn(\n \"text-sm text-muted-foreground transition-colors duration-pg-fast ease-pg-standard hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 rounded-sm\",\n className\n )}\n {...props}\n />\n));\nBreadcrumbLink.displayName = \"BreadcrumbLink\";\n\nconst BreadcrumbPage = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\">\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n role=\"link\"\n aria-current=\"page\"\n aria-disabled=\"true\"\n className={cn(\"text-sm font-medium text-foreground\", className)}\n {...props}\n />\n));\nBreadcrumbPage.displayName = \"BreadcrumbPage\";\n\nconst BreadcrumbSeparator = ({\n children,\n className,\n ...props\n}: React.ComponentProps<\"li\">) => (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"[&>svg]:size-3.5\", className)}\n {...props}\n >\n {children ?? <ChevronRight className=\"text-muted-foreground\" />}\n </li>\n);\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\";\n\nconst BreadcrumbEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"flex size-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"size-4 text-muted-foreground\" />\n <span className=\"sr-only\">More</span>\n </span>\n);\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\";\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n};\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Pagination (nav wrapper)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationProps extends React.ComponentPropsWithoutRef<\"nav\"> {}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n ({ className, ...props }, ref) => (\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n )\n);\nPagination.displayName = \"Pagination\";\n\n// ---------------------------------------------------------------------------\n// PaginationContent (ul)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationContentProps\n extends React.ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const PaginationContent = forwardRef<\n HTMLUListElement,\n PaginationContentProps\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n));\nPaginationContent.displayName = \"PaginationContent\";\n\n// ---------------------------------------------------------------------------\n// PaginationItem (li)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationItemProps\n extends React.ComponentPropsWithoutRef<\"li\"> {}\n\nexport const PaginationItem = forwardRef<HTMLLIElement, PaginationItemProps>(\n ({ className, ...props }, ref) => (\n <li ref={ref} className={cn(\"list-none\", className)} {...props} />\n )\n);\nPaginationItem.displayName = \"PaginationItem\";\n\n// ---------------------------------------------------------------------------\n// PaginationLink (anchor / button-like)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationLinkProps\n extends React.ComponentPropsWithoutRef<\"a\"> {\n isActive?: boolean;\n}\n\nexport const PaginationLink = forwardRef<HTMLAnchorElement, PaginationLinkProps>(\n ({ className, isActive = false, ...props }, ref) => (\n <a\n ref={ref}\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n // base\n \"h-9 w-9 inline-flex items-center justify-center rounded-lg text-sm font-medium border\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"cursor-pointer select-none\",\n // active\n isActive\n ? \"bg-primary text-primary-foreground border-primary shadow-sm\"\n : \"text-muted-foreground border-border hover:bg-muted hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n);\nPaginationLink.displayName = \"PaginationLink\";\n\n// ---------------------------------------------------------------------------\n// PaginationPrevious\n// ---------------------------------------------------------------------------\n\nexport interface PaginationPreviousProps\n extends React.ComponentPropsWithoutRef<\"a\"> {\n disabled?: boolean;\n}\n\nexport const PaginationPrevious = forwardRef<\n HTMLAnchorElement,\n PaginationPreviousProps\n>(({ className, disabled, ...props }, ref) => (\n <a\n ref={ref}\n aria-label=\"Go to previous page\"\n aria-disabled={disabled}\n className={cn(\n \"h-9 px-3 inline-flex items-center justify-center gap-1.5 rounded-lg text-sm font-medium border border-border\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"cursor-pointer select-none\",\n disabled\n ? \"cursor-not-allowed opacity-50 pointer-events-none text-muted-foreground border-border\"\n : \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n className\n )}\n {...props}\n >\n <ChevronLeft className=\"size-4\" />\n <span>Previous</span>\n </a>\n));\nPaginationPrevious.displayName = \"PaginationPrevious\";\n\n// ---------------------------------------------------------------------------\n// PaginationNext\n// ---------------------------------------------------------------------------\n\nexport interface PaginationNextProps\n extends React.ComponentPropsWithoutRef<\"a\"> {\n disabled?: boolean;\n}\n\nexport const PaginationNext = forwardRef<\n HTMLAnchorElement,\n PaginationNextProps\n>(({ className, disabled, ...props }, ref) => (\n <a\n ref={ref}\n aria-label=\"Go to next page\"\n aria-disabled={disabled}\n className={cn(\n \"h-9 px-3 inline-flex items-center justify-center gap-1.5 rounded-lg text-sm font-medium border border-border\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"cursor-pointer select-none\",\n disabled\n ? \"cursor-not-allowed opacity-50 pointer-events-none text-muted-foreground border-border\"\n : \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n className\n )}\n {...props}\n >\n <span>Next</span>\n <ChevronRight className=\"size-4\" />\n </a>\n));\nPaginationNext.displayName = \"PaginationNext\";\n\n// ---------------------------------------------------------------------------\n// PaginationEllipsis\n// ---------------------------------------------------------------------------\n\nexport interface PaginationEllipsisProps\n extends React.ComponentPropsWithoutRef<\"span\"> {}\n\nexport const PaginationEllipsis = forwardRef<\n HTMLSpanElement,\n PaginationEllipsisProps\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n aria-hidden\n className={cn(\n \"h-9 w-9 inline-flex items-center justify-center text-muted-foreground\",\n className\n )}\n {...props}\n >\n <MoreHorizontal className=\"size-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n));\nPaginationEllipsis.displayName = \"PaginationEllipsis\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"./utils\";\n\nconst linkVariants = cva(\n [\n \"inline-flex items-center gap-1 transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 rounded-sm\",\n \"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none\",\n ],\n {\n variants: {\n variant: {\n default: \"text-primary underline-offset-4 hover:underline\",\n subtle: \"text-muted-foreground hover:text-foreground\",\n nav: \"text-foreground hover:text-primary\",\n },\n size: {\n sm: \"text-xs\",\n md: \"text-sm\",\n lg: \"text-base\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n }\n);\n\nexport interface LinkProps\n extends React.AnchorHTMLAttributes<HTMLAnchorElement>,\n VariantProps<typeof linkVariants> {\n asChild?: boolean;\n}\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n href,\n target,\n rel,\n children,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"a\";\n\n const isExternal =\n typeof href === \"string\" && href.startsWith(\"http\");\n\n const externalProps = isExternal\n ? {\n target: target ?? \"_blank\",\n rel: rel ?? \"noreferrer\",\n }\n : { target, rel };\n\n return (\n <Comp\n ref={ref}\n href={href}\n className={cn(linkVariants({ variant, size }), className)}\n {...externalProps}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n);\nLink.displayName = \"Link\";\n","import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\n\ndeclare module 'react' {\n interface ReactElement {\n $$typeof?: symbol | string;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type Usable<T> = PromiseLike<T> | React.Context<T>;\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n let slottableElement: React.ReactElement | null = null;\n let hasSlottable = false;\n const newChildren: React.ReactNode[] = [];\n\n if (isLazyComponent(children) && typeof use === 'function') {\n children = use(children._payload);\n }\n\n React.Children.forEach(children, (maybeSlottable) => {\n if (isSlottable(maybeSlottable)) {\n hasSlottable = true;\n const slottable = maybeSlottable;\n let child = 'child' in slottable.props ? slottable.props.child : slottable.props.children;\n\n if (isLazyComponent(child) && typeof use === 'function') {\n child = use(child._payload);\n }\n\n slottableElement = getSlottableElementFromSlottable(slottable, child);\n newChildren.push((slottableElement?.props as any)?.children);\n } else {\n newChildren.push(maybeSlottable);\n }\n });\n\n if (slottableElement) {\n slottableElement = React.cloneElement(slottableElement, undefined, newChildren);\n } else if (\n // A `Slottable` was found but it didn't resolve to a single element (e.g.\n // it wrapped multiple elements, text, or a render-prop `child` that\n // wasn't an element). Don't fall back to treating the `Slottable` wrapper\n // itself as the slot target — throw a descriptive error below instead.\n !hasSlottable &&\n React.Children.count(children) === 1 &&\n React.isValidElement(children)\n ) {\n slottableElement = children;\n }\n\n const slottableElementRef = slottableElement ? getElementRef(slottableElement) : undefined;\n const composedRef = useComposedRefs(forwardedRef, slottableElementRef);\n\n if (!slottableElement) {\n // Empty/falsy children (`null`, `undefined`, `false`, no children, etc.) are valid and\n // render nothing. Anything else is content we couldn't slot onto a single element, which\n // is a usage error, so we fail loudly with a clear message.\n if (children || children === 0) {\n throw new Error(\n hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName),\n );\n }\n return children;\n }\n\n const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});\n\n // do not pass ref to React.Fragment for React 19 compatibility\n if (slottableElement.type !== React.Fragment) {\n mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;\n }\n\n return React.cloneElement(slottableElement, mergedProps);\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol.for('radix.slottable');\n\ntype SlottableChildrenProps = { children: React.ReactNode };\ntype SlottableRenderFnProps = {\n child: React.ReactNode;\n children: (slottable: React.ReactNode) => React.ReactNode;\n};\n\ntype SlottableProps = SlottableRenderFnProps | SlottableChildrenProps;\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = (props) =>\n 'child' in props ? props.children(props.child) : props.children;\n\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* -------------------------------------------------------------------------------------------------\n * getSlottableElementFromSlottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst getSlottableElementFromSlottable = (slottable: SlottableElement, child: React.ReactNode) => {\n if ('child' in slottable.props) {\n const child = slottable.props.child;\n if (!React.isValidElement<React.PropsWithChildren>(child)) return null;\n return React.cloneElement(child, undefined, slottable.props.children(child.props.children));\n }\n\n return React.isValidElement(child) ? child : null;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * mergeProps\n * -----------------------------------------------------------------------------------------------*/\n\ntype AnyProps = Record<string, any>;\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getElementRef\n * -----------------------------------------------------------------------------------------------*/\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype SlottableElement = React.ReactElement<SlottableProps, SlottableComponent>;\n\nfunction isSlottable(\n child: React.ReactNode,\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\n\ninterface LazyReactElement extends React.ReactElement {\n $$typeof: typeof REACT_LAZY_TYPE;\n _payload: PromiseLike<Exclude<React.ReactNode, PromiseLike<any>>>;\n}\n\nfunction isLazyComponent(element: React.ReactNode): element is LazyReactElement {\n return (\n element != null &&\n typeof element === 'object' &&\n '$$typeof' in element &&\n element.$$typeof === REACT_LAZY_TYPE &&\n '_payload' in element &&\n isPromiseLike(element._payload)\n );\n}\n\nfunction isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return typeof value === 'object' && value !== null && 'then' in value;\n}\n\nconst createSlotError = (ownerName: string) => {\n return `${ownerName} failed to slot onto its children. Expected a single React element child or \\`Slottable\\`.`;\n};\n\nconst createSlottableError = (ownerName: string) => {\n return `${ownerName} failed to slot onto its \\`Slottable\\`. Expected \\`Slottable\\` to receive a single React element child.`;\n};\n\nconst use: typeof React.use | undefined = (React as any)[' use '.trim().toString()];\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n variant?: \"default\" | \"secondary\" | \"success\" | \"warning\" | \"error\" | \"outline\";\n size?: \"sm\" | \"md\" | \"lg\";\n square?: boolean;\n dot?: boolean;\n leftIcon?: ReactNode;\n rightIcon?: ReactNode;\n}\n\nconst variantClasses: Record<NonNullable<BadgeProps[\"variant\"]>, string> = {\n default:\n \"bg-primary/10 text-primary border border-primary/20\",\n secondary:\n \"bg-muted text-muted-foreground border border-border\",\n success:\n \"bg-green-500/10 text-green-700 border border-green-500/20 dark:text-green-400\",\n warning:\n \"bg-amber-500/10 text-amber-700 border border-amber-500/20 dark:text-amber-400\",\n error:\n \"bg-red-500/10 text-red-700 border border-red-500/20 dark:text-red-400\",\n outline:\n \"bg-transparent text-foreground border border-border\",\n};\n\nconst sizeClasses: Record<NonNullable<BadgeProps[\"size\"]>, string> = {\n sm: \"text-[10px] px-1.5 py-0.5 gap-1\",\n md: \"text-xs px-2 py-0.5 gap-1\",\n lg: \"text-sm px-2.5 py-1 gap-1.5\",\n};\n\nconst dotColorClasses: Record<NonNullable<BadgeProps[\"variant\"]>, string> = {\n default: \"bg-primary\",\n secondary: \"bg-muted-foreground\",\n success: \"bg-green-500\",\n warning: \"bg-amber-500\",\n error: \"bg-red-500\",\n outline: \"bg-foreground\",\n};\n\nconst dotSizeClasses: Record<NonNullable<BadgeProps[\"size\"]>, string> = {\n sm: \"size-1.5\",\n md: \"size-1.5\",\n lg: \"size-2\",\n};\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(\n (\n {\n variant = \"default\",\n size = \"md\",\n square = false,\n dot = false,\n leftIcon,\n rightIcon,\n children,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center font-medium whitespace-nowrap transition-colors duration-pg-fast ease-pg-standard\",\n square ? \"rounded-md\" : \"rounded-full\",\n variantClasses[variant],\n sizeClasses[size],\n className\n )}\n {...props}\n >\n {dot && (\n <span\n className={cn(\n \"rounded-full flex-shrink-0\",\n dotSizeClasses[size],\n dotColorClasses[variant]\n )}\n />\n )}\n {!dot && leftIcon && (\n <span className=\"inline-flex items-center flex-shrink-0\">{leftIcon}</span>\n )}\n {children}\n {rightIcon && (\n <span className=\"inline-flex items-center flex-shrink-0\">{rightIcon}</span>\n )}\n </span>\n );\n }\n);\nBadge.displayName = \"Badge\";\n","\"use client\";\n\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface LozengeProps extends HTMLAttributes<HTMLSpanElement> {\n variant?: \"default\" | \"inprogress\" | \"success\" | \"moved\" | \"new\" | \"removed\";\n isBold?: boolean;\n maxWidth?: number | string;\n}\n\nconst variantClasses: Record<NonNullable<LozengeProps[\"variant\"]>, string> = {\n default: \"bg-muted text-muted-foreground\",\n inprogress: \"bg-blue-500/15 text-blue-700 dark:text-blue-300\",\n success: \"bg-green-500/15 text-green-700 dark:text-green-300\",\n moved: \"bg-purple-500/15 text-purple-700 dark:text-purple-300\",\n new: \"bg-teal-500/15 text-teal-700 dark:text-teal-300\",\n removed: \"bg-red-500/15 text-red-700 dark:text-red-300\",\n};\n\nexport const Lozenge = forwardRef<HTMLSpanElement, LozengeProps>(\n (\n {\n variant = \"default\",\n isBold = false,\n maxWidth,\n children,\n className,\n style,\n ...props\n },\n ref\n ) => {\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center rounded-sm px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide whitespace-nowrap transition-colors duration-pg-fast ease-pg-standard\",\n variantClasses[variant],\n isBold && \"ring-1 ring-current/30\",\n className\n )}\n style={\n maxWidth !== undefined\n ? { maxWidth, overflow: \"hidden\", textOverflow: \"ellipsis\", ...style }\n : style\n }\n {...props}\n >\n <span\n className={cn(\n maxWidth !== undefined ? \"truncate\" : undefined\n )}\n >\n {children}\n </span>\n </span>\n );\n }\n);\nLozenge.displayName = \"Lozenge\";\n","import * as React from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type TagColorScheme = \"neutral\" | \"blue\" | \"green\" | \"amber\" | \"red\" | \"purple\";\n\nexport interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {\n colorScheme?: TagColorScheme;\n onRemove?: () => void;\n disabled?: boolean;\n}\n\nconst colorClasses: Record<TagColorScheme, string> = {\n neutral: \"bg-card border-border text-foreground\",\n blue: \"bg-blue-500/10 border-blue-500/20 text-blue-700 dark:text-blue-300\",\n green: \"bg-green-500/10 border-green-500/20 text-green-700 dark:text-green-300\",\n amber: \"bg-amber-500/10 border-amber-500/20 text-amber-700 dark:text-amber-300\",\n red: \"bg-red-500/10 border-red-500/20 text-red-700 dark:text-red-300\",\n purple: \"bg-purple-500/10 border-purple-500/20 text-purple-700 dark:text-purple-300\",\n};\n\nconst Tag = React.forwardRef<HTMLSpanElement, TagProps>(\n ({ className, colorScheme = \"neutral\", onRemove, disabled, children, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium transition-colors\", colorClasses[colorScheme], disabled && \"opacity-50 cursor-not-allowed\", className)}\n {...props}\n >\n {children}\n {onRemove && !disabled && (\n <button\n type=\"button\"\n onClick={(e) => { e.stopPropagation(); onRemove(); }}\n className=\"ml-0.5 rounded-sm opacity-60 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n aria-label=\"Remove\"\n >\n <X className=\"size-3\" />\n </button>\n )}\n </span>\n )\n);\nTag.displayName = \"Tag\";\n\nexport interface TagGroupProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst TagGroup = React.forwardRef<HTMLDivElement, TagGroupProps>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn(\"flex flex-wrap gap-1.5\", className)} {...props} />\n);\nTagGroup.displayName = \"TagGroup\";\n\nexport { Tag, TagGroup };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Check, X, RefreshCw, Clock, AlertCircle, ArrowRight, Info } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type BadgeVariant =\n | \"success\"\n | \"info\"\n | \"warning\"\n | \"refund\"\n | \"danger\"\n | \"orange\"\n | \"muted\";\n\nexport type BadgeTrailIcon =\n | \"check\"\n | \"x\"\n | \"refresh\"\n | \"clock\"\n | \"alert\"\n | \"arrow-right\"\n | \"info\";\n\n/* Light: low-opacity hue-matched borders. Dark: stronger borders for contrast on dark surfaces. */\nconst VARIANT_CLASS: Record<BadgeVariant, string> = {\n success:\n \"bg-emerald-500/10 text-emerald-800 border-emerald-600/10 dark:bg-emerald-500/35 dark:text-emerald-50 dark:border-emerald-400/70\",\n info: \"bg-blue-500/10 text-blue-800 border-blue-600/10 dark:bg-sky-500/30 dark:text-sky-50 dark:border-sky-400/65\",\n warning:\n \"bg-amber-500/10 text-amber-900 border-amber-600/10 dark:bg-amber-500/35 dark:text-amber-50 dark:border-amber-400/70\",\n refund:\n \"bg-yellow-500/10 text-yellow-900 border-yellow-600/10 dark:bg-violet-500/30 dark:text-violet-100 dark:border-violet-400/60\",\n danger:\n \"bg-red-500/10 text-red-800 border-red-600/10 dark:bg-red-500/35 dark:text-red-50 dark:border-red-400/70\",\n orange:\n \"bg-orange-500/10 text-orange-900 border-orange-600/10 dark:bg-orange-500/35 dark:text-orange-50 dark:border-orange-400/65\",\n muted:\n \"bg-muted text-muted-foreground border-border/40 dark:bg-zinc-800/90 dark:text-zinc-200 dark:border-zinc-500/45\",\n};\n\nexport interface StatusBadgeProps {\n variant: BadgeVariant;\n label: string;\n trailIcon?: BadgeTrailIcon;\n size?: \"sm\" | \"md\";\n className?: string;\n}\n\nexport const StatusBadge = React.forwardRef<HTMLSpanElement, StatusBadgeProps>(\n ({ variant, label, trailIcon, size = \"md\", className }, ref) => {\n const iSize = size === \"sm\" ? 11 : 12;\n const iProps = {\n width: iSize,\n height: iSize,\n strokeWidth: 2.5,\n style: { flexShrink: 0 },\n } as const;\n\n const icon =\n trailIcon === \"check\" ? <Check {...iProps} /> :\n trailIcon === \"x\" ? <X {...iProps} strokeWidth={3} /> :\n trailIcon === \"refresh\" ? <RefreshCw {...{ ...iProps, strokeWidth: 2 }} /> :\n trailIcon === \"clock\" ? <Clock {...iProps} strokeWidth={2} /> :\n trailIcon === \"alert\" ? <AlertCircle {...iProps} strokeWidth={2} /> :\n trailIcon === \"arrow-right\" ? <ArrowRight {...iProps} strokeWidth={2.5} /> :\n trailIcon === \"info\" ? <Info {...iProps} strokeWidth={2.5} /> :\n null;\n\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-1.5 font-medium border whitespace-nowrap rounded-md\",\n VARIANT_CLASS[variant],\n size === \"sm\" ? \"text-[11px] px-2 py-[2px]\" : \"text-[13px] px-3 py-[5px]\",\n className\n )}\n >\n {label}\n {icon}\n </span>\n );\n }\n);\nStatusBadge.displayName = \"StatusBadge\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface BlanketProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controls visibility of the blanket */\n open?: boolean;\n /** Adds semi-transparent black background (default: true) */\n isTinted?: boolean;\n /** Makes blanket completely transparent — only blocks pointer events */\n isTransparent?: boolean;\n /** Called when the blanket is clicked */\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n /** When true, pointer events pass through the blanket */\n shouldAllowClickThrough?: boolean;\n}\n\nconst Blanket = React.forwardRef<HTMLDivElement, BlanketProps>(\n (\n {\n open = true,\n isTinted = true,\n isTransparent = false,\n onClick,\n shouldAllowClickThrough = false,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n data-open={open}\n aria-hidden=\"true\"\n onClick={onClick}\n className={cn(\n \"fixed inset-0 z-40\",\n // Animate in/out\n \"data-[open=true]:animate-in data-[open=false]:animate-out\",\n \"data-[open=true]:fade-in-0 data-[open=false]:fade-out-0\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n // Visibility\n !open && \"pointer-events-none\",\n // Background\n !isTransparent && isTinted && \"bg-black/50 backdrop-blur-sm\",\n isTransparent && \"bg-transparent\",\n // Click-through\n shouldAllowClickThrough && \"pointer-events-none\",\n className\n )}\n {...props}\n />\n );\n }\n);\n\nBlanket.displayName = \"Blanket\";\n\nexport { Blanket };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { X, ChevronLeft, ChevronRight, Check } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport interface SpotlightStep {\n title: string;\n body: string;\n image?: React.ReactNode;\n}\n\nexport interface SpotlightCardProps {\n title: string;\n body: string;\n image?: React.ReactNode;\n currentStep?: number;\n totalSteps?: number;\n onNext?: () => void;\n onBack?: () => void;\n onDismiss?: () => void;\n nextLabel?: string;\n className?: string;\n}\n\nconst SpotlightCard = React.forwardRef<HTMLDivElement, SpotlightCardProps>(\n ({ title, body, image, currentStep, totalSteps, onNext, onBack, onDismiss, nextLabel, className }, ref) => {\n const isLast = currentStep !== undefined && totalSteps !== undefined && currentStep >= totalSteps - 1;\n return (\n <div ref={ref} className={cn(\"bg-card border border-border rounded-xl shadow-xl p-5 w-72\", className)}>\n {onDismiss && (\n <button\n onClick={onDismiss}\n className=\"absolute top-3 right-3 rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n aria-label=\"Dismiss\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n {image && <div className=\"mb-4\">{image}</div>}\n <h3 className=\"font-semibold text-base text-foreground pr-6\">{title}</h3>\n <p className=\"mt-1 text-sm text-muted-foreground leading-relaxed\">{body}</p>\n <div className=\"flex items-center justify-between mt-4\">\n <div className=\"flex items-center gap-2\">\n {totalSteps && totalSteps > 1 && (\n <>\n <span className=\"text-xs text-muted-foreground\">{(currentStep ?? 0) + 1} of {totalSteps}</span>\n <div className=\"flex gap-1\">\n {Array.from({ length: totalSteps }).map((_, i) => (\n <span\n key={i}\n className={cn(\n \"rounded-full transition-all duration-pg-fast\",\n i === (currentStep ?? 0)\n ? \"w-4 h-1.5 bg-primary\"\n : \"w-1.5 h-1.5 bg-muted-foreground/30\"\n )}\n />\n ))}\n </div>\n </>\n )}\n </div>\n <div className=\"flex gap-2\">\n {onBack && (currentStep ?? 0) > 0 && (\n <button\n onClick={onBack}\n className=\"inline-flex items-center gap-1 h-8 px-3 rounded-lg text-xs font-medium text-muted-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n >\n <ChevronLeft className=\"size-3\" /> Back\n </button>\n )}\n {onNext && (\n <button\n onClick={onNext}\n className=\"inline-flex items-center gap-1 h-8 px-3 rounded-lg text-xs font-medium bg-primary text-primary-foreground hover:bg-[var(--primary-hover)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n >\n {isLast ? (\n <><Check className=\"size-3\" /> {nextLabel ?? \"Done\"}</>\n ) : (\n <>{nextLabel ?? \"Next\"} <ChevronRight className=\"size-3\" /></>\n )}\n </button>\n )}\n </div>\n </div>\n </div>\n );\n }\n);\nSpotlightCard.displayName = \"SpotlightCard\";\n\nexport interface SpotlightProps {\n isOpen: boolean;\n onClose: () => void;\n children: React.ReactNode;\n className?: string;\n}\n\nconst Spotlight = ({ isOpen, onClose, children, className }: SpotlightProps) => {\n if (!isOpen) return null;\n return (\n <div className=\"fixed inset-0 z-50\">\n <div className=\"absolute inset-0 bg-black/50 backdrop-blur-sm\" onClick={onClose} />\n <div className={cn(\"relative z-10 flex items-center justify-center min-h-full p-4\", className)}>\n {children}\n </div>\n </div>\n );\n};\nSpotlight.displayName = \"Spotlight\";\n\nexport interface UseSpotlightReturn {\n isOpen: boolean;\n currentStep: number;\n open: () => void;\n close: () => void;\n goNext: () => void;\n goBack: () => void;\n goTo: (step: number) => void;\n}\n\nexport function useSpotlight(steps: SpotlightStep[], initialStep = 0): UseSpotlightReturn {\n const [isOpen, setIsOpen] = React.useState(false);\n const [currentStep, setCurrentStep] = React.useState(initialStep);\n\n return {\n isOpen,\n currentStep,\n open: () => { setCurrentStep(initialStep); setIsOpen(true); },\n close: () => setIsOpen(false),\n goNext: () => {\n if (currentStep >= steps.length - 1) setIsOpen(false);\n else setCurrentStep(s => s + 1);\n },\n goBack: () => setCurrentStep(s => Math.max(0, s - 1)),\n goTo: (step) => setCurrentStep(Math.max(0, Math.min(step, steps.length - 1))),\n };\n}\n\nexport { Spotlight, SpotlightCard };\n","\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nfunction DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-[100] min-h-[100dvh] w-full bg-black/50 backdrop-blur-[2px]\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-200\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showClose = true,\n overlayClassName,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Content> & {\n showClose?: boolean;\n overlayClassName?: string;\n}) {\n return (\n <DialogPortal>\n <DialogOverlay className={overlayClassName} />\n <DialogPrimitive.Content\n className={cn(\n \"fixed left-1/2 top-1/2 z-[101] w-[calc(100%-1.5rem)] max-w-[min(100%,26rem)] -translate-x-1/2 -translate-y-1/2\",\n // Default padding reserves space for the close button.\n // Pass p-0 in className to opt out (manage padding per section).\n \"rounded-2xl border border-border bg-card p-6 pt-10 text-card-foreground shadow-2xl outline-none\",\n \"max-h-[min(90vh,720px)] overflow-y-auto\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 data-[state=open]:scale-100 data-[state=closed]:scale-[0.98]\",\n \"transition-[opacity,transform] duration-200 ease-out\",\n className\n )}\n {...props}\n >\n {children}\n {showClose && (\n <DialogPrimitive.Close\n className=\"absolute right-3 top-3 inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground transition-colors\"\n aria-label=\"Close\"\n >\n <X className=\"h-4 w-4\" />\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n className={cn(\"text-lg font-semibold text-foreground tracking-tight pr-10\", className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description className={cn(\"text-[13px] text-muted-foreground mt-1\", className)} {...props} />\n );\n}\n\nexport { Dialog, DialogTrigger, DialogPortal, DialogClose, DialogContent, DialogTitle, DialogDescription };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\ntype DrawerSide = \"right\" | \"left\" | \"top\" | \"bottom\";\nconst DrawerContext = React.createContext<{ side: DrawerSide }>({ side: \"right\" });\n\ninterface DrawerProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> { side?: DrawerSide; }\n\nconst Drawer = ({ side = \"right\", children, ...props }: DrawerProps) => (\n <DrawerContext.Provider value={{ side }}>\n <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>\n </DrawerContext.Provider>\n);\nDrawer.displayName = \"Drawer\";\n\nconst DrawerTrigger = DialogPrimitive.Trigger;\nconst DrawerClose = DialogPrimitive.Close;\n\nconst DrawerOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\", className)}\n {...props}\n />\n));\nDrawerOverlay.displayName = \"DrawerOverlay\";\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: \"inset-y-0 right-0 h-full w-80 sm:w-96 border-l data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right\",\n left: \"inset-y-0 left-0 h-full w-80 sm:w-96 border-r data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left\",\n top: \"inset-x-0 top-0 w-full border-b rounded-b-2xl data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top\",\n bottom: \"inset-x-0 bottom-0 w-full border-t rounded-t-2xl max-h-[85vh] data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom\",\n};\n\nconst DrawerContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => {\n const { side } = React.useContext(DrawerContext);\n return (\n <DialogPrimitive.Portal>\n <DrawerOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\"fixed z-50 flex flex-col bg-card border-border shadow-xl transition-all duration-pg-normal ease-pg-standard data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200\", sideClasses[side], className)}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-md p-1 text-muted-foreground opacity-70 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\">\n <X className=\"size-4\" /><span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n});\nDrawerContent.displayName = \"DrawerContent\";\n\nconst DrawerHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn(\"px-6 pt-6 pb-4 border-b border-border\", className)} {...props} />\n);\nDrawerHeader.displayName = \"DrawerHeader\";\n\nconst DrawerFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn(\"px-6 py-4 border-t border-border flex gap-2 justify-end mt-auto\", className)} {...props} />\n);\nDrawerFooter.displayName = \"DrawerFooter\";\n\nconst DrawerTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title ref={ref} className={cn(\"text-base font-semibold text-foreground pr-6\", className)} {...props} />\n));\nDrawerTitle.displayName = \"DrawerTitle\";\n\nconst DrawerDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description ref={ref} className={cn(\"mt-1 text-sm text-muted-foreground\", className)} {...props} />\n));\nDrawerDescription.displayName = \"DrawerDescription\";\n\nexport { Drawer, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cn } from \"./utils\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nconst Popover = PopoverPrimitive.Root;\nconst PopoverTrigger = PopoverPrimitive.Trigger;\nconst PopoverAnchor = PopoverPrimitive.Anchor;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 6, collisionPadding = 12, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n {/* Every popover panel is portalled to `document.body`, which puts it\n outside a Dialog's or Drawer's scroll lock — and that lock cancels the\n wheel for everything outside itself, so a scrollable panel silently\n refuses to scroll. The takeover is a no-op when no lock is held, so a\n popover on a plain page behaves exactly as before, and unlike making the\n popover `modal` it changes nothing about focus or outside clicks. See\n `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n // Keep a gutter between the popover and the viewport edge, so a\n // content-bounded panel (see `--radix-popover-content-available-height`\n // below) stops short of the fold rather than sitting flush against it.\n collisionPadding={collisionPadding}\n className={cn(\n \"z-[120] w-72 rounded-xl border border-border bg-popover p-4 text-popover-foreground shadow-lg outline-none\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n className\n )}\n {...props}\n />\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"./utils\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 6, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-[130] max-w-xs overflow-hidden rounded-lg border border-border bg-popover px-3 py-2 text-sm leading-snug text-popover-foreground shadow-md\",\n className\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { forwardRef, type AnchorHTMLAttributes, type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from \"react\";\n\n// ─── MenuDivider ─────────────────────────────────────────────────────────────\n\nexport const MenuDivider = forwardRef<HTMLHRElement, HTMLAttributes<HTMLHRElement>>(\n ({ className, ...props }, ref) => (\n <hr\n ref={ref}\n className={cn(\"h-px bg-border border-none my-1\", className)}\n {...props}\n />\n )\n);\nMenuDivider.displayName = \"MenuDivider\";\n\n// ─── MenuSection ─────────────────────────────────────────────────────────────\n\nexport interface MenuSectionProps extends HTMLAttributes<HTMLDivElement> {\n label?: string;\n children: ReactNode;\n}\n\nexport const MenuSection = forwardRef<HTMLDivElement, MenuSectionProps>(\n ({ label, children, className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col\", className)} {...props}>\n {label && (\n <span className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground px-2 py-1.5 mt-2 first:mt-0 select-none\">\n {label}\n </span>\n )}\n {children}\n </div>\n )\n);\nMenuSection.displayName = \"MenuSection\";\n\n// ─── MenuItem ────────────────────────────────────────────────────────────────\n\ntype MenuItemBaseProps = {\n icon?: ReactNode;\n rightContent?: ReactNode;\n isSelected?: boolean;\n isDanger?: boolean;\n};\n\ntype MenuItemButtonProps = MenuItemBaseProps &\n ButtonHTMLAttributes<HTMLButtonElement> & {\n href?: undefined;\n };\n\ntype MenuItemAnchorProps = MenuItemBaseProps &\n AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n };\n\nexport type MenuItemProps = MenuItemButtonProps | MenuItemAnchorProps;\n\nconst menuItemBaseClasses =\n \"flex items-center gap-2.5 px-2 py-2 rounded-lg text-sm transition-colors duration-pg-fast ease-pg-standard w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\";\n\nexport const MenuItem = forwardRef<HTMLButtonElement | HTMLAnchorElement, MenuItemProps>(\n (props, ref) => {\n const {\n icon,\n rightContent,\n isSelected,\n isDanger,\n children,\n className,\n ...rest\n } = props;\n\n const resolvedClasses = cn(\n menuItemBaseClasses,\n !isDanger && !isSelected && \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n isSelected && !isDanger && \"bg-muted text-foreground font-medium\",\n isDanger && \"text-destructive hover:bg-destructive/10\",\n (rest as { disabled?: boolean }).disabled && \"opacity-50 cursor-not-allowed pointer-events-none\",\n className\n );\n\n const content = (\n <>\n {icon && (\n <span className=\"size-4 shrink-0 flex items-center justify-center [&>svg]:size-4\">\n {icon}\n </span>\n )}\n <span className=\"flex-1 text-left truncate\">{children}</span>\n {rightContent && (\n <span className=\"ml-auto shrink-0\">{rightContent}</span>\n )}\n </>\n );\n\n if (\"href\" in props && props.href !== undefined) {\n const { href, ...anchorRest } = rest as AnchorHTMLAttributes<HTMLAnchorElement> & { href: string };\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n className={resolvedClasses}\n {...anchorRest}\n >\n {content}\n </a>\n );\n }\n\n const { disabled, ...buttonRest } = rest as ButtonHTMLAttributes<HTMLButtonElement>;\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n disabled={disabled}\n className={resolvedClasses}\n {...buttonRest}\n >\n {content}\n </button>\n );\n }\n);\nMenuItem.displayName = \"MenuItem\";\n\n// ─── Menu ────────────────────────────────────────────────────────────────────\n\nexport interface MenuProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n}\n\nexport const Menu = forwardRef<HTMLElement, MenuProps>(\n ({ children, className, ...props }, ref) => (\n <nav\n ref={ref as React.Ref<HTMLElement>}\n className={cn(\"flex flex-col\", className)}\n {...props}\n >\n {children}\n </nav>\n )\n);\nMenu.displayName = \"Menu\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n // Matches DropdownMenuItem: a submenu row sits in the same list as the\n // plain rows, so it cannot be a different size from them.\n \"flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] outline-none\",\n \"focus:bg-muted data-[state=open]:bg-muted\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4 text-muted-foreground\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-[130] min-w-[8rem] overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-lg\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 8, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-[130] min-w-[11rem] overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-lg\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n // 13px / tighter padding: a menu drops out of a toolbar button or a\n // compact table control, and at 15px with 10px vertical padding it read\n // as a larger, separate UI than the control that opened it.\n \"relative flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] outline-none transition-colors\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n // Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /\n // dot indicator's, not padding.\n \"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4 text-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n // Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /\n // dot indicator's, not padding.\n \"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current text-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-xs font-semibold text-muted-foreground\", inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nfunction DropdownMenuShortcut({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) {\n return <span className={cn(\"ml-auto text-[10px] tracking-wide text-muted-foreground\", className)} {...props} />;\n}\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst Select = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\n/**\n * `md` (default) is the form-field trigger. `sm` is for dense furniture — a\n * rows-per-page picker in a table footer, a control inside a toolbar — where\n * the full-height field towers over everything beside it.\n *\n * This is a size prop rather than a job for `className` because the base sets\n * `min-h-11`, which beats an `h-8` utility: every caller wanting a short\n * trigger had to override min-height, padding, gap and text size together.\n */\nexport type SelectTriggerSize = \"sm\" | \"md\";\n\nconst selectTriggerSizes: Record<SelectTriggerSize, string> = {\n md: \"h-11 min-h-11 gap-2.5 px-4 py-2 text-[15px]\",\n sm: \"h-7 min-h-7 w-auto gap-1 px-2 py-0 text-[12px]\",\n};\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & { size?: SelectTriggerSize }\n>(({ className, children, size = \"md\", ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex w-full items-center justify-between rounded-lg border border-border bg-card text-foreground shadow-sm outline-none\",\n selectTriggerSizes[size],\n \"ring-ring/50 focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50\",\n \"[&>span]:line-clamp-1\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 shrink-0 text-muted-foreground opacity-70\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1 text-muted-foreground\", className)}\n {...props}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1 text-muted-foreground\", className)}\n {...props}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-[120] max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-lg\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1 max-h-72 overflow-y-auto\",\n position === \"popper\" && \"w-full min-w-[var(--radix-select-trigger-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label ref={ref} className={cn(\"px-2 py-1.5 text-xs font-medium text-muted-foreground\", className)} {...props} />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-lg py-2 pl-2 pr-8 text-sm outline-none\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4 text-primary\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport interface CommandProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandInputProps extends React.InputHTMLAttributes<HTMLInputElement> {}\nexport interface CommandListProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandGroupProps extends React.HTMLAttributes<HTMLDivElement> { heading?: string; }\nexport interface CommandItemProps extends React.HTMLAttributes<HTMLDivElement> { selected?: boolean; disabled?: boolean; onSelect?: () => void; }\nexport interface CommandSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {}\n\nconst Command = React.forwardRef<HTMLDivElement, CommandProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"bg-card rounded-xl border border-border shadow-lg overflow-hidden\", className)} {...props} />\n));\nCommand.displayName = \"Command\";\n\nconst CommandInput = React.forwardRef<HTMLInputElement, CommandInputProps>(({ className, ...props }, ref) => (\n <div className=\"flex items-center gap-2 border-b border-border px-3 h-11\">\n <Search className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden />\n <input ref={ref} className={cn(\"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\", className)} {...props} />\n </div>\n));\nCommandInput.displayName = \"CommandInput\";\n\nconst CommandList = React.forwardRef<HTMLDivElement, CommandListProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"max-h-72 overflow-y-auto py-1\", className)} role=\"listbox\" {...props} />\n));\nCommandList.displayName = \"CommandList\";\n\nconst CommandEmpty = React.forwardRef<HTMLDivElement, CommandEmptyProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"text-sm text-muted-foreground text-center py-6\", className)} {...props} />\n));\nCommandEmpty.displayName = \"CommandEmpty\";\n\nconst CommandGroup = React.forwardRef<HTMLDivElement, CommandGroupProps>(({ className, heading, children, ...props }, ref) => (\n <div ref={ref} className={cn(\"px-1 py-1\", className)} role=\"group\" {...props}>\n {heading && <div className=\"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider\">{heading}</div>}\n {children}\n </div>\n));\nCommandGroup.displayName = \"CommandGroup\";\n\nconst CommandItem = React.forwardRef<HTMLDivElement, CommandItemProps>(({ className, selected, disabled, onSelect, children, ...props }, ref) => (\n <div\n ref={ref}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled}\n onClick={disabled ? undefined : onSelect}\n className={cn(\n \"flex items-center gap-2 px-2 py-1.5 rounded-md text-sm cursor-pointer transition-colors duration-pg-fast ease-pg-standard select-none\",\n selected ? \"bg-muted text-foreground\" : \"text-foreground hover:bg-muted\",\n disabled && \"pointer-events-none opacity-50\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n));\nCommandItem.displayName = \"CommandItem\";\n\nconst CommandSeparator = React.forwardRef<HTMLDivElement, CommandSeparatorProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"h-px bg-border my-1 -mx-1\", className)} {...props} />\n));\nCommandSeparator.displayName = \"CommandSeparator\";\n\nconst CommandShortcut = React.forwardRef<HTMLSpanElement, CommandShortcutProps>(({ className, ...props }, ref) => (\n <span ref={ref} className={cn(\"ml-auto text-xs text-muted-foreground tracking-widest\", className)} {...props} />\n));\nCommandShortcut.displayName = \"CommandShortcut\";\n\nexport { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator, CommandShortcut };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport { cn } from \"./utils\";\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5 text-muted-foreground\",\n className\n )}\n {...props}\n />\n));\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"ring-ring/50 focus-visible:outline-none focus-visible:ring-2\",\n \"data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className\n )}\n {...props}\n />\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-3 outline-none ring-ring/50 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-lg\",\n className\n )}\n {...props}\n />\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent };\n","\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"./select\";\nimport { Tabs, TabsList, TabsTrigger } from \"./tabs\";\nimport { cn } from \"./utils\";\n\n/**\n * Two presets over the `Tabs` primitives, for the two jobs a tab row actually\n * does. They are separate components on purpose, so a page can show both\n * without the reader having to work out which row governs what:\n *\n * - {@link UnderlineTabs} is the **page-level** bar that segments a view into\n * sections — full-width, one sliding indicator, the thing a URL usually\n * follows.\n * - {@link SegmentedTabs} is the **compact scoping strip** for a required\n * single choice that qualifies the content beside it: which status a list is\n * filtered by, which period a summary describes.\n *\n * Neither is a filter chip. A chip is for an *optional* filter that can be\n * cleared; both of these always have exactly one option selected, so neither\n * ever renders a clear affordance.\n */\n\nexport interface UnderlineTab {\n value: string;\n /**\n * A plain string for an ordinary tab; a node when the tab carries an\n * annotation beside its name, such as a status badge showing the state of\n * the section behind it.\n */\n label: ReactNode;\n}\n\n/**\n * Page-level tab bar with a single shared indicator that slides between tabs,\n * rather than each tab drawing its own underline.\n *\n * The indicator's position and width are measured from the DOM: text tabs have\n * different widths, so this cannot be derived from props or state. It sits\n * flush on the row's own bottom border instead of floating below the label.\n *\n * `actions` renders flush right on the same row, tabs staying left-aligned,\n * which is where a page puts its primary CTA.\n */\nexport function UnderlineTabs({\n tabs,\n value,\n onValueChange,\n actions,\n className,\n}: {\n tabs: readonly UnderlineTab[];\n value: string;\n onValueChange: (value: string) => void;\n actions?: ReactNode;\n className?: string;\n}) {\n const tabRefs = useRef<Record<string, HTMLButtonElement | null>>({});\n const [indicator, setIndicator] = useState<{ left: number; width: number } | null>(null);\n\n useEffect(() => {\n const measure = () => {\n const el = tabRefs.current[value];\n if (el) setIndicator({ left: el.offsetLeft, width: el.offsetWidth });\n };\n // Deferred into a rAF / resize callback rather than called in the effect\n // body: it reads post-layout geometry, which is not derivable from render.\n const raf = requestAnimationFrame(measure);\n window.addEventListener(\"resize\", measure);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener(\"resize\", measure);\n };\n }, [value]);\n\n return (\n <Tabs value={value} onValueChange={onValueChange} className={className}>\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n {/* `relative` here rather than on the row, so the indicator measures\n against the tab strip itself and is unaffected by `actions`. */}\n <TabsList className=\"relative h-auto justify-start gap-5 rounded-none border-0 bg-transparent p-0\">\n {tabs.map((tab) => (\n <TabsTrigger\n key={tab.value}\n ref={(el) => {\n tabRefs.current[tab.value] = el;\n }}\n value={tab.value}\n className=\"h-auto rounded-none px-0 py-2.5 text-[13px] font-medium text-muted-foreground shadow-none data-[state=active]:bg-transparent data-[state=active]:text-primary data-[state=active]:shadow-none\"\n >\n {tab.label}\n </TabsTrigger>\n ))}\n <span\n aria-hidden\n className=\"absolute bottom-0 h-0.5 bg-primary transition-all duration-200 ease-out\"\n style={{\n left: indicator?.left ?? 0,\n width: indicator?.width ?? 0,\n opacity: indicator ? 1 : 0,\n }}\n />\n </TabsList>\n\n {actions ? <div className=\"flex shrink-0 items-center gap-2\">{actions}</div> : null}\n </div>\n </Tabs>\n );\n}\n\nexport interface SegmentedTabOption<T extends string = string> {\n value: T;\n label: string;\n}\n\n/**\n * The compact strip that scopes the content beside it.\n *\n * Plain underlined triggers, not the `Tabs` pill look: no container\n * background, border or padding — a gap row of triggers, each just an\n * underline and a colour change when active. Still Radix `Tabs` underneath, so\n * keyboard navigation and `aria-selected` come free; only the classes differ.\n *\n * With `collapseToSelect`, the strip becomes a `Select` below `md`. Both\n * controls drive the same state, so resizing mid-session can never leave the\n * two disagreeing about which option is chosen.\n */\nexport function SegmentedTabs<T extends string>({\n options,\n value,\n onValueChange,\n label = \"Options\",\n collapseToSelect = true,\n className,\n}: {\n options: readonly SegmentedTabOption<T>[];\n value: T;\n onValueChange: (value: T) => void;\n /** Accessible name for both controls. */\n label?: string;\n /**\n * Swap to a `Select` below `md`. Leave on for a strip that would otherwise\n * crowd a narrow screen; turn it off where the row already has the room and\n * a dropdown would read as a different control appearing.\n */\n collapseToSelect?: boolean;\n className?: string;\n}) {\n return (\n <>\n <Tabs\n value={value}\n onValueChange={(next) => onValueChange(next as T)}\n className={cn(collapseToSelect && \"hidden md:block\", className)}\n >\n <TabsList\n aria-label={label}\n className=\"h-auto gap-4 rounded-none border-0 bg-transparent p-0\"\n >\n {options.map((option) => (\n <TabsTrigger\n key={option.value}\n value={option.value}\n className=\"h-auto rounded-none border-b-2 border-transparent px-0 py-1 text-[13px] font-medium text-muted-foreground shadow-none data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-primary data-[state=active]:shadow-none\"\n >\n {option.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n\n {collapseToSelect ? (\n <Select value={value} onValueChange={(next) => onValueChange(next as T)}>\n <SelectTrigger className=\"h-8 w-[9.5rem] md:hidden\" aria-label={label}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n ) : null}\n </>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst Accordion = AccordionPrimitive.Root;\n\nconst AccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn(\"border-b border-border last:border-b-0\", className)}\n {...props}\n />\n));\nAccordionItem.displayName = \"AccordionItem\";\n\nconst AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex w-full items-center justify-between py-4 text-sm font-medium text-foreground\",\n \"hover:text-primary transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"[&[data-state=open]>svg]:rotate-180\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDown className=\"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-pg-fast ease-pg-standard\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n));\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\nconst AccordionContent = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Content\n ref={ref}\n className={cn(\n \"overflow-hidden text-sm text-muted-foreground\",\n \"data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up\",\n className\n )}\n style={\n {\n \"--accordion-content-height\": \"var(--radix-accordion-content-height)\",\n } as React.CSSProperties\n }\n {...props}\n >\n <div className={cn(\"pb-4 pt-0\", className)}>{children}</div>\n </AccordionPrimitive.Content>\n));\nAccordionContent.displayName = \"AccordionContent\";\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { X, Info, CheckCircle2, AlertTriangle, XCircle } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant;\n dismissible?: boolean;\n onDismiss?: () => void;\n}\n\nconst variantStyles: Record<AlertVariant, string> = {\n info: \"bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200\",\n success: \"bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200\",\n warning: \"bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200\",\n error: \"bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200\",\n neutral: \"bg-muted border-border text-foreground\",\n};\n\nconst variantIcons: Record<AlertVariant, React.ElementType> = {\n info: Info,\n success: CheckCircle2,\n warning: AlertTriangle,\n error: XCircle,\n neutral: Info,\n};\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant = \"info\", dismissible, onDismiss, children, ...props }, ref) => {\n const Icon = variantIcons[variant];\n return (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(\"relative flex gap-3 rounded-xl border p-4 shadow-sm\", variantStyles[variant], className)}\n {...props}\n >\n <Icon className=\"mt-0.5 size-4 shrink-0\" aria-hidden />\n <div className=\"flex-1 min-w-0\">{children}</div>\n {dismissible && (\n <button\n type=\"button\"\n onClick={onDismiss}\n className=\"shrink-0 rounded-md p-0.5 opacity-60 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n aria-label=\"Dismiss\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n );\n }\n);\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(\n ({ className, ...props }, ref) => (\n <h5 ref={ref} className={cn(\"mb-1 text-sm font-semibold leading-none\", className)} {...props} />\n )\n);\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-sm opacity-90 leading-relaxed\", className)} {...props} />\n )\n);\nAlertDescription.displayName = \"AlertDescription\";\n\nexport interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant;\n dismissible?: boolean;\n onDismiss?: () => void;\n}\n\nconst Banner = React.forwardRef<HTMLDivElement, BannerProps>(\n ({ className, variant = \"info\", dismissible, onDismiss, children, ...props }, ref) => {\n const Icon = variantIcons[variant];\n return (\n <div\n ref={ref}\n role=\"banner\"\n className={cn(\"flex items-center gap-3 border-b px-4 py-3\", variantStyles[variant], className)}\n {...props}\n >\n <Icon className=\"size-4 shrink-0\" aria-hidden />\n <div className=\"flex-1 min-w-0 text-sm\">{children}</div>\n {dismissible && (\n <button\n type=\"button\"\n onClick={onDismiss}\n className=\"shrink-0 rounded-md p-0.5 opacity-60 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n aria-label=\"Dismiss\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n );\n }\n);\nBanner.displayName = \"Banner\";\n\nexport { Alert, AlertTitle, AlertDescription, Banner };\n","import * as React from \"react\";\nimport { Info, CheckCircle2, AlertTriangle, XCircle, Sparkles } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type CalloutVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\" | \"discovery\";\n\nexport interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: CalloutVariant;\n}\n\nconst variantStyles: Record<CalloutVariant, string> = {\n info: \"bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200\",\n success: \"bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200\",\n warning: \"bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200\",\n error: \"bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200\",\n neutral: \"bg-muted border-border text-foreground\",\n discovery: \"bg-purple-50 border-purple-200 text-purple-900 dark:bg-purple-950/30 dark:border-purple-800 dark:text-purple-200\",\n};\n\nconst variantIcons: Record<CalloutVariant, React.ElementType> = {\n info: Info,\n success: CheckCircle2,\n warning: AlertTriangle,\n error: XCircle,\n neutral: Info,\n discovery: Sparkles,\n};\n\nconst Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n ({ className, variant = \"info\", children, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex gap-3 rounded-xl border p-4\", variantStyles[variant], className)} {...props}>\n {children}\n </div>\n )\n);\nCallout.displayName = \"Callout\";\n\ninterface CalloutIconProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: CalloutVariant;\n}\n\nconst CalloutIcon = React.forwardRef<HTMLDivElement, CalloutIconProps>(\n ({ className, variant = \"info\", ...props }, ref) => {\n const Icon = variantIcons[variant];\n return (\n <div ref={ref} className={cn(\"mt-0.5 shrink-0\", className)} {...props}>\n <Icon className=\"size-4\" aria-hidden />\n </div>\n );\n }\n);\nCalloutIcon.displayName = \"CalloutIcon\";\n\nconst CalloutTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-sm font-semibold\", className)} {...props} />\n )\n);\nCalloutTitle.displayName = \"CalloutTitle\";\n\nconst CalloutText = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"mt-1 text-sm opacity-90 leading-relaxed\", className)} {...props} />\n )\n);\nCalloutText.displayName = \"CalloutText\";\n\nexport { Callout, CalloutIcon, CalloutTitle, CalloutText };\n","import * as React from \"react\";\nimport { Info, CheckCircle2, AlertTriangle, XCircle, Sparkles } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type SectionMessageVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"discovery\";\n\nexport interface SectionMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: SectionMessageVariant;\n}\n\nconst variantConfig: Record<\n SectionMessageVariant,\n { border: string; bg: string; icon: React.ElementType; iconColor: string }\n> = {\n info: {\n border: \"border-l-blue-500\",\n bg: \"bg-blue-50/60 dark:bg-blue-950/20\",\n icon: Info,\n iconColor: \"text-blue-500 dark:text-blue-400\",\n },\n success: {\n border: \"border-l-green-500\",\n bg: \"bg-green-50/60 dark:bg-green-950/20\",\n icon: CheckCircle2,\n iconColor: \"text-green-500 dark:text-green-400\",\n },\n warning: {\n border: \"border-l-amber-500\",\n bg: \"bg-amber-50/60 dark:bg-amber-950/20\",\n icon: AlertTriangle,\n iconColor: \"text-amber-500 dark:text-amber-400\",\n },\n error: {\n border: \"border-l-red-500\",\n bg: \"bg-red-50/60 dark:bg-red-950/20\",\n icon: XCircle,\n iconColor: \"text-red-500 dark:text-red-400\",\n },\n discovery: {\n border: \"border-l-purple-500\",\n bg: \"bg-purple-50/60 dark:bg-purple-950/20\",\n icon: Sparkles,\n iconColor: \"text-purple-500 dark:text-purple-400\",\n },\n};\n\nconst SectionMessageVariantContext = React.createContext<SectionMessageVariant>(\"info\");\n\nconst SectionMessage = React.forwardRef<HTMLDivElement, SectionMessageProps>(\n ({ className, variant = \"info\", children, ...props }, ref) => {\n const config = variantConfig[variant];\n const Icon = config.icon;\n return (\n <SectionMessageVariantContext.Provider value={variant}>\n <div\n ref={ref}\n role=\"region\"\n className={cn(\n \"flex w-full gap-4 rounded-xl border border-l-4 border-border p-5 shadow-sm transition-colors duration-pg-fast ease-pg-standard\",\n config.border,\n config.bg,\n className\n )}\n {...props}\n >\n <Icon\n className={cn(\"mt-0.5 size-5 shrink-0\", config.iconColor)}\n aria-hidden\n />\n <div className=\"flex-1 min-w-0\">{children}</div>\n </div>\n </SectionMessageVariantContext.Provider>\n );\n }\n);\nSectionMessage.displayName = \"SectionMessage\";\n\nconst SectionMessageTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h4\n ref={ref}\n className={cn(\"text-sm font-semibold text-foreground mb-1\", className)}\n {...props}\n />\n));\nSectionMessageTitle.displayName = \"SectionMessageTitle\";\n\nconst SectionMessageContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm text-muted-foreground leading-relaxed\", className)}\n {...props}\n />\n));\nSectionMessageContent.displayName = \"SectionMessageContent\";\n\nconst SectionMessageActions = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap gap-2 mt-3\", className)}\n {...props}\n />\n));\nSectionMessageActions.displayName = \"SectionMessageActions\";\n\nexport {\n SectionMessage,\n SectionMessageTitle,\n SectionMessageContent,\n SectionMessageActions,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nimport { cn } from \"./utils\";\n\nconst sizeMap = {\n xs: 12,\n sm: 16,\n md: 20,\n lg: 28,\n xl: 36,\n} as const;\n\nconst colorMap = {\n primary: \"text-primary\",\n muted: \"text-muted-foreground\",\n white: \"text-white\",\n inherit: \"\",\n} as const;\n\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {\n size?: keyof typeof sizeMap;\n color?: keyof typeof colorMap;\n}\n\nconst Spinner = React.forwardRef<HTMLSpanElement, SpinnerProps>(\n ({ className, size = \"md\", color = \"primary\", ...props }, ref) => {\n const px = sizeMap[size];\n\n return (\n <span\n ref={ref}\n data-slot=\"spinner\"\n role=\"status\"\n aria-label=\"Loading\"\n className={cn(\"inline-flex items-center justify-center\", colorMap[color], className)}\n {...props}\n >\n <Loader2\n width={px}\n height={px}\n className=\"animate-spin\"\n aria-hidden=\"true\"\n />\n <span className=\"sr-only\">Loading...</span>\n </span>\n );\n }\n);\nSpinner.displayName = \"Spinner\";\n\nexport { Spinner };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type ProgressVariant = \"default\" | \"success\" | \"warning\" | \"error\";\nexport type ProgressSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ProgressProps extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {\n variant?: ProgressVariant;\n size?: ProgressSize;\n label?: boolean;\n}\n\nconst variantTrack: Record<ProgressVariant, string> = {\n default: \"bg-primary\",\n success: \"bg-green-500\",\n warning: \"bg-amber-500\",\n error: \"bg-red-500\",\n};\n\nconst sizeClasses: Record<ProgressSize, string> = {\n xs: \"h-1\",\n sm: \"h-1.5\",\n md: \"h-2\",\n lg: \"h-3\",\n};\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(({ className, value, variant = \"default\", size = \"md\", label, ...props }, ref) => (\n <div className=\"w-full\">\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\"relative w-full overflow-hidden rounded-full bg-muted\", sizeClasses[size], className)}\n {...props}\n value={value}\n >\n <ProgressPrimitive.Indicator\n className={cn(\"h-full w-full flex-1 transition-all duration-pg-slow ease-pg-standard\", variantTrack[variant])}\n style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n {label && <p className=\"mt-1 text-xs text-muted-foreground text-right\">{value ?? 0}%</p>}\n </div>\n));\nProgress.displayName = \"Progress\";\n\nexport type ProgressStepStatus = \"complete\" | \"current\" | \"upcoming\";\n\nexport interface ProgressTrackerStep {\n label: string;\n description?: string;\n status: ProgressStepStatus;\n}\n\nexport interface ProgressTrackerProps extends React.HTMLAttributes<HTMLDivElement> {\n steps: ProgressTrackerStep[];\n}\n\nconst ProgressTracker = React.forwardRef<HTMLDivElement, ProgressTrackerProps>(\n ({ className, steps, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex items-start\", className)} {...props}>\n {steps.map((step, i) => (\n <React.Fragment key={i}>\n <div className=\"flex flex-col items-center gap-1.5 min-w-0\">\n <div className={cn(\n \"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors\",\n step.status === \"complete\" && \"bg-primary border-primary text-primary-foreground\",\n step.status === \"current\" && \"bg-primary/10 border-primary text-primary\",\n step.status === \"upcoming\" && \"bg-card border-border text-muted-foreground\"\n )}>\n {step.status === \"complete\" ? <Check className=\"size-4\" strokeWidth={2.5} /> : i + 1}\n </div>\n <div className=\"text-center px-1\">\n <p className={cn(\"text-xs font-medium\", step.status === \"upcoming\" ? \"text-muted-foreground\" : \"text-foreground\")}>{step.label}</p>\n {step.description && <p className=\"text-[11px] text-muted-foreground mt-0.5\">{step.description}</p>}\n </div>\n </div>\n {i < steps.length - 1 && (\n <div className=\"flex-1 mt-4 mx-1\">\n <div className={cn(\"h-0.5 w-full rounded-full transition-colors\", step.status === \"complete\" ? \"bg-primary\" : \"bg-border\")} />\n </div>\n )}\n </React.Fragment>\n ))}\n </div>\n )\n);\nProgressTracker.displayName = \"ProgressTracker\";\n\nexport { Progress, ProgressTracker };\n","import { cn } from \"./utils\";\n\ninterface ShimmerProps {\n className?: string;\n rounded?: \"sm\" | \"md\" | \"lg\" | \"full\";\n}\n\nexport function Shimmer({ className, rounded = \"md\" }: ShimmerProps) {\n const r = { sm: \"rounded\", md: \"rounded-lg\", lg: \"rounded-xl\", full: \"rounded-full\" }[rounded];\n return <div className={cn(\"shimmer\", r, className)} />;\n}\n\nexport function StatCardSkeleton() {\n return (\n <div className=\"bg-card text-card-foreground rounded-xl p-5 flex flex-col gap-3 border border-border shadow-sm\">\n <div className=\"flex items-center justify-between\">\n <Shimmer className=\"h-3 w-28\" />\n <Shimmer className=\"h-10 w-10\" rounded=\"full\" />\n </div>\n <Shimmer className=\"h-9 w-44 mt-1\" />\n <Shimmer className=\"h-3 w-32\" />\n </div>\n );\n}\n\nexport function TableRowSkeleton({\n cols = 6,\n comfortable = false,\n density: densityProp,\n snug = false,\n}: {\n cols?: number;\n /** @deprecated prefer `density` */\n comfortable?: boolean;\n density?: \"default\" | \"comfortable\" | \"compact\";\n snug?: boolean;\n}) {\n const density =\n densityProp ??\n (comfortable ? \"comfortable\" : \"default\");\n const cellPad =\n density === \"comfortable\"\n ? \"px-5 py-4\"\n : density === \"compact\"\n ? snug\n ? \"pl-1.5 pr-2.5 py-2.5\"\n : \"px-3 py-2.5\"\n : \"px-4 py-3.5\";\n return (\n <tr\n className={cn(\n \"border-b border-border/60\",\n density === \"comfortable\" && \"min-h-[56px]\",\n density === \"compact\" && \"min-h-[44px]\"\n )}\n >\n {Array.from({ length: cols }).map((_, i) => (\n <td key={i} className={cellPad}>\n <Shimmer className={cn(\"h-3.5\", i === 0 ? \"w-20\" : i === cols - 1 ? \"w-14\" : \"w-28\")} />\n </td>\n ))}\n </tr>\n );\n}\n\nexport function ChartSkeleton({ height = \"h-48\" }: { height?: string }) {\n return (\n <div className={cn(\"flex items-end gap-2 px-2\", height)}>\n {[55, 72, 40, 88, 65, 82, 48, 95, 60, 70].map((h, i) => (\n <div key={i} className=\"flex-1 shimmer rounded-t-md\" style={{ height: `${h}%` }} />\n ))}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { cn } from \"./utils\";\nimport { type LucideIcon, Inbox } from \"lucide-react\";\n\ninterface EmptyStateProps {\n icon?: LucideIcon;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}\n\nexport function EmptyState({\n icon: Icon = Inbox,\n title,\n description,\n action,\n className,\n}: EmptyStateProps) {\n return (\n <div className={cn(\"flex flex-col items-center justify-center py-16 px-4 text-center\", className)}>\n <div className=\"w-14 h-14 rounded-2xl bg-slate-100 flex items-center justify-center mb-4\">\n <Icon className=\"w-6 h-6 text-slate-400\" />\n </div>\n <h3 className=\"text-sm font-semibold text-slate-700 mb-1\">{title}</h3>\n {description && (\n <p className=\"text-xs text-slate-500 max-w-xs leading-relaxed\">{description}</p>\n )}\n {action && <div className=\"mt-4\">{action}</div>}\n </div>\n );\n}\n","\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"./utils\";\nimport { Shimmer } from \"./skeleton\";\nimport { EmptyState } from \"./empty-state\";\nimport {\n ArrowDown,\n ArrowUp,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronsUpDown,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"./select\";\n\nexport type DataTableDensity = \"default\" | \"comfortable\" | \"compact\";\nexport type DataTableHeaderStyle = \"surface\" | \"minimal\";\n\n/**\n * Footer summary text.\n * - `range` — \"Showing 1–15 of 141 results\" (or \"Showing 1–15\" when no total\n * is knowable, i.e. cursor pagination).\n * - `count` — \"141 items\".\n * - `none` — no summary, just the pager.\n */\nexport type DataTableFooterSummary = \"range\" | \"count\" | \"none\";\n\nexport type SortOrder = \"ascend\" | \"descend\";\n/** `null` means unsorted — the table is in the order the data arrived in. */\nexport type DataTableSortState = { columnKey: string; order: SortOrder } | null;\n\n/** Builds the visible page numbers including ellipsis markers */\nfunction getPageRange(current: number, total: number): (number | \"…\")[] {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const pages: (number | \"…\")[] = [1];\n if (current > 3) pages.push(\"…\");\n const lo = Math.max(2, current - 1);\n const hi = Math.min(total - 1, current + 1);\n for (let p = lo; p <= hi; p++) pages.push(p);\n if (current < total - 2) pages.push(\"…\");\n pages.push(total);\n return pages;\n}\n\n// ── Pagination ───────────────────────────────────────────────────────────────\n\n/** Controls shared by every paginated mode. */\ntype PagerCommon = {\n /**\n * Summary text at the left of the footer. Defaults to `range`.\n */\n summary?: DataTableFooterSummary;\n /** Noun after the number when `summary=\"count\"`. Default `item` / `items`. */\n countLabels?: { singular: string; plural: string };\n /**\n * Page-size choices. Pass these — with `onPageSizeChange` — and the footer\n * grows a \"Rows per page\" picker at its far left. Omit and there is none.\n *\n * This lives here rather than being hand-passed as a footer slot because a\n * grid that had to hand-roll its own page-size control is how two different\n * pagers end up in the same app.\n */\n pageSizeOptions?: readonly number[];\n onPageSizeChange?: (size: number) => void;\n /** Escape hatch: an extra control at the far left, before the summary. */\n leading?: ReactNode;\n};\n\n/**\n * How the table pages. Which member you use is decided by the endpoint, not by\n * taste:\n *\n * - `client` — every row is already in `data`; the table slices it. The\n * default when `pagination` is omitted.\n * - `page` — the response carries a row **total**, so the footer can show\n * \"Showing 1–15 of 141 results\" and a full numbered strip with ellipses.\n * - `cursor` — the response carries no total (a `nextCursor` /\n * `exclusiveStartKey` API). The footer shows \"Showing 1–15\" with **no**\n * total and no page count, and the numbered strip is only ever the page\n * before, the current page, and — when `hasNext` says so — the page after.\n * Those are the only pages a cursor can actually reach in one step, so they\n * are the only ones offered.\n * - `none` — no footer at all.\n */\nexport type DataTablePagination =\n | ({\n mode: \"client\";\n /** Rows per page. Default 10. */\n pageSize?: number;\n } & PagerCommon)\n | ({\n mode: \"page\";\n /** 1-indexed. */\n page: number;\n pageSize: number;\n /** Total rows across all pages, from the response. */\n total: number;\n onPageChange: (page: number) => void;\n } & PagerCommon)\n | ({\n mode: \"cursor\";\n /** 1-indexed, for the \"Showing x–y\" range and the page marker. */\n page: number;\n pageSize: number;\n /** Whether a page exists after this one. Drives the next control. */\n hasNext: boolean;\n /** Defaults to `page > 1`. */\n hasPrev?: boolean;\n onNext: () => void;\n onPrev: () => void;\n } & PagerCommon)\n | { mode: \"none\" };\n\n// ── Sorting ──────────────────────────────────────────────────────────────────\n\n/**\n * Sorting, modelled on antd's `Table`: a column opts in with `sorter`, and the\n * table reports state as `{ columnKey, order }` with antd's `\"ascend\"` /\n * `\"descend\"` vocabulary.\n *\n * The one deliberate difference is that client and server sorting are told\n * apart by the **column**, not by a table-level flag: `sorter: true` means \"the\n * caller orders this\", a comparator means \"the table orders this\". A grid can\n * therefore mix the two, which matters when one column is a derived value the\n * server does not know about.\n */\nexport type DataTableSorting = {\n /**\n * Controlled sort state. Omit for uncontrolled — the table remembers, which\n * is all a client-sorted grid needs.\n */\n value?: DataTableSortState;\n /** Fires on every header activation, with the state being moved to. */\n onChange?: (next: DataTableSortState) => void;\n};\n\n/**\n * Row expansion: a disclosure column plus a full-width panel rendered directly\n * beneath the expanded row. Use it when the detail belongs *with* the row in\n * the flow of the table (a request's headers, a payload, a breakdown) rather\n * than in a drawer that covers it.\n *\n * Leave `expandedKeys` unset for uncontrolled behaviour (the table remembers\n * which rows are open). Pass `expandedKeys` + `onExpandedChange` to drive it\n * from outside — needed when opening a row triggers a fetch.\n */\nexport type DataTableExpandable<T> = {\n /** The panel shown under an expanded row. */\n render: (row: T, index: number) => ReactNode;\n /**\n * Which rows can open at all. Rows that cannot get no toggle and no chevron,\n * keeping the column's width without implying an affordance that isn't there.\n * Defaults to every row.\n */\n isExpandable?: (row: T, index: number) => boolean;\n /** Controlled open rows, as `rowKey` values. Omit for uncontrolled. */\n expandedKeys?: string[];\n /** Fires on every open/close in controlled mode. */\n onExpandedChange?: (keys: string[]) => void;\n /**\n * Fires only when a row opens, in both modes — the hook for lazily fetching\n * that row's detail. Not called on close.\n */\n onExpand?: (row: T, index: number) => void;\n /** Accessible name for the toggle. Default \"Toggle row details\". */\n toggleLabel?: string;\n};\n\nexport type Column<T> = {\n key: string;\n header: ReactNode;\n /**\n * Table column width: `48px`, `18%`, or `minmax(12rem, 1fr)` for a floor\n * that can still grow into whatever the other columns leave over.\n *\n * `minmax(min, max)` is translated rather than passed straight through: this\n * is a real `<table>`/`<colgroup>`, and `minmax()` is a CSS Grid function\n * that is not a legal `width` value outside a grid — the browser drops the\n * whole declaration and the column gets no floor at all. `min` becomes the\n * `<col>`'s `min-width`, and `max` becomes its `width` unless `max` is `1fr`\n * (or any other flex unit), in which case no `width` is set and the column\n * takes its share of whatever `table-layout: fixed` has left over, the same\n * way a grid track's `1fr` would.\n *\n * `overflow-x-auto` on the table's own scroll container is what makes the\n * floor mean something: once every column's minimum no longer fits, the\n * table grows past its container and scrolls instead of every column\n * shrinking under its `min-width` and the header text — deliberately not\n * truncated, see the `<th>` render below — overlapping the column beside it.\n */\n width?: string;\n minWidth?: number;\n maxWidth?: number;\n align?: \"left\" | \"right\" | \"center\";\n /** Allow cell text to wrap instead of truncating. */\n wrap?: boolean;\n /** Extra classes on `<th>` / `<td>` (e.g. wider horizontal padding per column) */\n cellClassName?: string;\n /**\n * Inline styles on `<th>` / `<td>`.\n *\n * For a value Tailwind cannot generate a class for because it is computed —\n * a sticky column's `left`, which is the running total of the widths before\n * it. Expressing that as a class means keeping a hand-written lookup table of\n * every offset the layout can produce, and silently getting the wrong one the\n * moment a column width changes. See `frozenColumn`.\n */\n cellStyle?: CSSProperties;\n /**\n * Makes this header a sort control.\n *\n * - `true` — the **caller** orders the rows (a server-side `sortBy` query).\n * The table reports the change through `sorting.onChange` and leaves `data`\n * exactly as given.\n * - a comparator — the **table** orders the rows with it, before paging.\n * Same contract as `Array.prototype.sort`'s argument, and the same as\n * antd's `sorter`.\n */\n sorter?: boolean | ((a: T, b: T) => number);\n /**\n * The orders this header cycles through before returning to unsorted.\n * Default `[\"ascend\", \"descend\"]`. Pass `[\"descend\", \"ascend\"]` for a column\n * where \"most recent\" or \"largest\" is the obvious first click.\n */\n sortDirections?: SortOrder[];\n render: (row: T, index: number) => ReactNode;\n};\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n data: T[];\n isLoading?: boolean;\n skeletonRows?: number;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * Pagination and the footer that carries it. Omit for client-side paging at\n * 10 rows a page. See {@link DataTablePagination}.\n */\n pagination?: DataTablePagination;\n /** Column sorting. See {@link DataTableSorting}. */\n sorting?: DataTableSorting;\n className?: string;\n rowKey: (row: T) => string;\n /** Optional hover CTA shown on the right of every row */\n rowCta?: {\n label: string;\n onClick?: (row: T) => void;\n };\n /**\n * Custom action revealed on row hover — typically a `<Button>` or\n * `<ButtonGroup>`, but any `ReactNode` is accepted. Pass a **function** to\n * render per-row: it receives `(row, index)`, so the action always has the\n * record for its row (e.g. to navigate or open a drawer for that row).\n *\n * It is not a real column: it floats as an overlay **pinned to the right edge\n * of the viewport**, so it stays in view as the table scrolls horizontally\n * (no scrolling to the end to reach it) while the last data column stays\n * flush with nothing trailing it. Takes precedence over `rowCta`.\n */\n rowAction?: ReactNode | ((row: T, index: number) => ReactNode);\n /**\n * Makes the whole row a click target — the row itself opens a drawer, a\n * detail page, whatever the table drills into — instead of that living in a\n * per-cell wrapper or a hover-revealed button.\n *\n * The handler sits on the `<tr>`, so the entire row including cell padding\n * and the empty space between columns is clickable, and the row gets\n * `cursor-pointer` plus keyboard access (focusable, Enter / Space).\n *\n * Clicks that originate inside something interactive — a `<button>`, `<a>`,\n * a form control, a Radix trigger, or anything marked\n * `data-row-click-ignore` — do NOT fire this. Copy buttons, per-row menus\n * and the `rowAction` overlay therefore keep doing only their own job\n * without each having to stop propagation.\n */\n onRowClick?: (row: T, index: number) => void;\n /** Row / cell vertical rhythm and horizontal gutters */\n density?: DataTableDensity;\n /**\n * Column-sizing strategy:\n * - `fixed` — widths come only from `colgroup` hints (`width`/`minWidth`/\n * `maxWidth`); content is ignored and overflow is clipped. Table fills 100%.\n * - `auto` — columns size to content but the table still fills 100%, so any\n * leftover space is distributed into the columns (they stretch).\n * - `content` — columns size to their content's intrinsic width and the table\n * shrinks to fit. Leftover space stays empty to the right of the last\n * column; it scrolls horizontally only once content exceeds the container.\n */\n tableLayout?: \"auto\" | \"fixed\" | \"content\";\n theadClassName?: string;\n headerStyle?: DataTableHeaderStyle;\n /** With `density=\"compact\"`, use tighter cell gutters (`pl-1.5 pr-2.5` vs `px-3`). Footer keeps normal horizontal padding. */\n snug?: boolean;\n /** Per-row disclosure panel rendered beneath the row. See `DataTableExpandable`. */\n expandable?: DataTableExpandable<T>;\n}\n\n/**\n * The pagination union flattened into one shape the render can read without\n * re-narrowing at every use.\n *\n * `total` and `totalPages` stay optional on purpose: `undefined` is the honest\n * answer for a cursor API, and keeping it optional here is what stops the\n * footer from quietly falling back to a made-up count.\n */\nexport type NormalizedPager = {\n showFooter: boolean;\n /** Whether the table slices `data` itself (client mode only). */\n sliceLocally: boolean;\n page: number;\n pageSize: number;\n total?: number;\n totalPages?: number;\n hasNext?: boolean;\n hasPrev?: boolean;\n onNext?: () => void;\n onPrev?: () => void;\n summary: DataTableFooterSummary;\n countLabels: { singular: string; plural: string };\n leading?: ReactNode;\n pageSizeOptions?: readonly number[];\n onPageSizeChange?: (size: number) => void;\n};\n\nconst DEFAULT_COUNT_LABELS = { singular: \"item\", plural: \"items\" };\n\nexport function normalizePagination(\n pagination: DataTablePagination,\n rowsHeld: number,\n internalPage: number\n): NormalizedPager {\n if (pagination.mode === \"none\") {\n return {\n showFooter: false,\n sliceLocally: false,\n page: 1,\n // A footerless table shows every row it was given; guard against a\n // zero divisor for the range arithmetic that never renders.\n pageSize: rowsHeld || 1,\n summary: \"none\",\n countLabels: DEFAULT_COUNT_LABELS,\n };\n }\n\n const shared = {\n showFooter: true,\n summary: pagination.summary ?? \"range\",\n countLabels: pagination.countLabels ?? DEFAULT_COUNT_LABELS,\n leading: pagination.leading,\n pageSizeOptions: pagination.pageSizeOptions,\n onPageSizeChange: pagination.onPageSizeChange,\n };\n\n if (pagination.mode === \"client\") {\n const pageSize = pagination.pageSize ?? 10;\n return {\n ...shared,\n sliceLocally: true,\n page: internalPage,\n pageSize,\n total: rowsHeld,\n totalPages: Math.max(1, Math.ceil(rowsHeld / pageSize)),\n };\n }\n\n if (pagination.mode === \"page\") {\n return {\n ...shared,\n sliceLocally: false,\n page: pagination.page,\n pageSize: pagination.pageSize,\n total: pagination.total,\n totalPages: Math.max(1, Math.ceil(pagination.total / pagination.pageSize)),\n };\n }\n\n // Cursor: no total, therefore no `totalPages`. That absence is what the\n // footer keys off to switch to prev/current/next numbering.\n return {\n ...shared,\n sliceLocally: false,\n page: pagination.page,\n pageSize: pagination.pageSize,\n hasNext: pagination.hasNext,\n hasPrev: pagination.hasPrev ?? pagination.page > 1,\n onNext: pagination.onNext,\n onPrev: pagination.onPrev,\n };\n}\n\n/** The order a header moves to on its next activation. */\nfunction nextSortOrder(\n current: DataTableSortState,\n columnKey: string,\n directions: SortOrder[]\n): DataTableSortState {\n if (!current || current.columnKey !== columnKey) {\n return { columnKey, order: directions[0] };\n }\n const at = directions.indexOf(current.order);\n const next = directions[at + 1];\n // Past the end of the cycle is \"unsorted\" — a third click always gets the\n // user back to the order the data arrived in, which is otherwise unreachable.\n return next ? { columnKey, order: next } : null;\n}\n\n/**\n * The sort glyph.\n *\n * Unsorted is one `ChevronsUpDown` rather than two chevrons stacked by hand:\n * the pair had to be pulled together with a negative margin, which left them\n * mis-kerned and heavier than the header text beside them. A single glyph is\n * drawn as one shape on lucide's own grid, so it sits on the baseline properly\n * at any size.\n *\n * Sorted is an arrow, not a highlighted half of a pair. An arrow says which way\n * the rows are ordered on its own; a chevron pair with one half tinted asks the\n * reader to compare two shapes to find out.\n *\n * The unsorted glyph stays visible rather than appearing on hover, so a column\n * that *can* sort says so before it is pointed at — but at 40% it reads as an\n * affordance rather than as state.\n */\nfunction SortIndicator({ order }: { order: SortOrder | null }) {\n const Glyph = order === \"ascend\" ? ArrowUp : order === \"descend\" ? ArrowDown : ChevronsUpDown;\n return (\n <Glyph\n aria-hidden\n className={cn(\n \"ml-1.5 h-3 w-3 shrink-0\",\n order ? \"text-primary\" : \"text-muted-foreground/40\"\n )}\n />\n );\n}\n\n/**\n * `minmax(A, B)` → its two halves, tolerant of whichever whitespace someone\n * wrote it with. `null` for anything else, including a plain length like\n * `\"180px\"` — that already IS a valid `width` and passes through untouched.\n */\nfunction parseMinMaxWidth(width: string | undefined): { min: string; max: string } | null {\n if (!width) return null;\n const match = /^minmax\\(\\s*([^,]+?)\\s*,\\s*([^)]+?)\\s*\\)$/.exec(width.trim());\n return match ? { min: match[1], max: match[2] } : null;\n}\n\n/** `1fr`, `2fr`, … — a Grid flex unit, meaningless as a table `width`. */\nfunction isFlexUnit(value: string): boolean {\n return /^[\\d.]*fr$/.test(value.trim());\n}\n\n/**\n * A column's `width` as the three real CSS properties a `<col>` understands.\n *\n * Anything that is not a `minmax(...)` string passes through exactly as it did\n * before this existed, so a plain `\"48px\"` or `\"18%\"` column is untouched.\n */\nfunction colWidthStyle(col: Pick<Column<unknown>, \"width\" | \"minWidth\" | \"maxWidth\">): {\n width: string | number | undefined;\n minWidth: string | number | undefined;\n maxWidth: string | number | undefined;\n} {\n const parsed = parseMinMaxWidth(col.width);\n if (!parsed) {\n return {\n width: col.width ?? (col.minWidth != null ? `${col.minWidth}px` : undefined),\n minWidth: col.minWidth,\n maxWidth: col.maxWidth,\n };\n }\n return {\n width: isFlexUnit(parsed.max) ? undefined : parsed.max,\n // An explicit numeric `minWidth`/`maxWidth` alongside a `minmax()` string\n // is not a combination any caller uses today; the string wins because it\n // is the more specific of the two.\n minWidth: parsed.min,\n maxWidth: isFlexUnit(parsed.max) ? col.maxWidth : undefined,\n };\n}\n\nexport function DataTable<T>({\n columns,\n data,\n isLoading = false,\n skeletonRows = 6,\n emptyTitle = \"No data yet\",\n emptyDescription,\n pagination = { mode: \"client\" },\n sorting,\n className,\n rowKey,\n rowCta,\n rowAction,\n onRowClick,\n density = \"default\",\n tableLayout = \"fixed\",\n theadClassName,\n headerStyle = \"surface\",\n snug = false,\n expandable,\n}: DataTableProps<T>) {\n // ── Sorting ───────────────────────────────────────────────────────────────\n const [internalSort, setInternalSort] = useState<DataTableSortState>(null);\n const isSortControlled = sorting?.value !== undefined;\n const sortState = isSortControlled ? sorting!.value! : internalSort;\n\n const columnByKey = useMemo(() => new Map(columns.map((c) => [c.key, c])), [columns]);\n\n /**\n * Rows in sorted order. Only a **comparator** sorts here: `sorter: true`\n * means the caller has already ordered the rows (or asked the server to), so\n * re-sorting them locally would fight the response.\n */\n const sortedData = useMemo(() => {\n if (!sortState) return data;\n const sorter = columnByKey.get(sortState.columnKey)?.sorter;\n if (typeof sorter !== \"function\") return data;\n // Copy first: sorting the caller's array in place mutates their state.\n const out = data.slice().sort(sorter);\n return sortState.order === \"descend\" ? out.reverse() : out;\n }, [data, sortState, columnByKey]);\n\n // ── Pagination ────────────────────────────────────────────────────────────\n const [internalPage, setInternalPage] = useState(1);\n\n /**\n * The discriminated union collapsed into one flat shape, so the render below\n * reads the same regardless of mode and every `undefined` is a deliberate\n * \"nobody knows\" rather than a missing prop.\n */\n const pager = normalizePagination(pagination, sortedData.length, internalPage);\n\n /** Only client mode holds every row, so only client mode slices. */\n const paginated = pager.sliceLocally\n ? sortedData.slice((pager.page - 1) * pager.pageSize, pager.page * pager.pageSize)\n : sortedData;\n\n /** Zero-based offset of this page's first row, for the \"Showing x–y\" range. */\n const from = (pager.page - 1) * pager.pageSize;\n\n const setSort = (next: DataTableSortState) => {\n if (isSortControlled) sorting!.onChange?.(next);\n else {\n setInternalSort(next);\n sorting?.onChange?.(next);\n }\n // A re-sort makes the current page number meaningless — the rows under it\n // have all changed. Only client mode can act on that; controlled callers\n // decide for themselves, since they may be paging by cursor.\n if (pagination.mode === \"client\") setInternalPage(1);\n };\n\n const goToPage = (p: number) => {\n if (pagination.mode === \"page\") pagination.onPageChange(p);\n else if (pagination.mode === \"client\") setInternalPage(p);\n };\n\n // The right-pinned row action. `rowAction` takes precedence over `rowCta`.\n // It is NOT a real column: it renders as a per-row overlay floating at the\n // right edge of the viewport (sticky), so the last data column stays flush\n // and there's no reserved/empty trailing column when scrolled to the end.\n const hasAction = rowAction != null || rowCta != null;\n\n // `content` layout: a greedy, empty trailing column that absorbs leftover\n // horizontal space so the data columns stay at their content (minimum)\n // width while the table still spans the full container width.\n const hasSpacer = tableLayout === \"content\";\n\n // Row expansion. Uncontrolled by default; `expandedKeys` hands control to the\n // caller, which is what a row whose panel fetches its own data needs.\n // `onExpand` fires only on open, in both modes.\n const [internalExpanded, setInternalExpanded] = useState<string[]>([]);\n const isExpandControlled = expandable?.expandedKeys !== undefined;\n const expandedKeys = isExpandControlled ? expandable!.expandedKeys! : internalExpanded;\n const hasExpand = expandable != null;\n /** Every column the expansion panel has to span. */\n const totalColSpan =\n columns.length + (hasExpand ? 1 : 0) + (hasSpacer ? 1 : 0) + (hasAction ? 1 : 0);\n\n /** Whether this row is open — drives both its own styling and the panel. */\n const rowExpanded = (row: T, index: number) =>\n hasExpand &&\n (expandable!.isExpandable?.(row, index) ?? true) &&\n expandedKeys.includes(rowKeys[index]);\n\n const toggleExpanded = (key: string, row: T, index: number) => {\n const isOpen = expandedKeys.includes(key);\n const next = isOpen ? expandedKeys.filter((k) => k !== key) : [...expandedKeys, key];\n if (isExpandControlled) expandable!.onExpandedChange?.(next);\n else setInternalExpanded(next);\n if (!isOpen) expandable!.onExpand?.(row, index);\n };\n\n // Guard against duplicate / non-unique rowKey() results. React silently fails\n // to unmount old <tr> nodes when sibling keys collide, leaving stale rows\n // rendered on top of new data (or the empty state). De-dupe by suffixing\n // repeats so every rendered row gets a unique, stable key.\n const seenKeys = new Map<string, number>();\n const rowKeys = paginated.map((row) => {\n const base = rowKey(row);\n const seen = seenKeys.get(base) ?? 0;\n seenKeys.set(base, seen + 1);\n return seen === 0 ? base : `${base}__${seen}`;\n });\n\n /**\n * No rows to show. The width hints are dropped in this state: a grid whose\n * columns carry minimums (via `colgroup` in fixed layout, or `cellClassName`\n * in the others) would otherwise have its HEADER row alone force the table\n * past the container and raise a horizontal scrollbar — over an empty region\n * with nothing to scroll to. Headers still render, at their natural width, so\n * the shape of the missing data is still legible.\n */\n const isEmpty = !isLoading && paginated.length === 0;\n\n const comfortable = density === \"comfortable\";\n const compact = density === \"compact\";\n const compactCellPad = compact\n ? snug\n ? \"pl-1.5 pr-2.5 py-2.5\"\n : \"px-3 py-2.5\"\n : \"px-4 py-3.5\";\n const cellPad = comfortable ? \"px-5 py-4\" : compactCellPad;\n const headPad = comfortable ? \"px-5 py-4\" : compactCellPad;\n /** Footer is outside the grid; do not reuse snug cell `pl-0`-style gutters here. */\n const footerPad = comfortable\n ? \"px-5 py-4\"\n : compact\n ? \"px-4 py-2.5\"\n : \"px-4 py-3.5\";\n const headText = comfortable\n ? \"text-[12px] font-medium text-muted-foreground tracking-normal\"\n : compact\n ? \"text-[11px] font-semibold text-muted-foreground\"\n : \"text-[11px] font-semibold text-foreground/75 dark:text-foreground/85\";\n /**\n * Expansion geometry, in px, derived from the same padding the cells use:\n *\n * - `expandIndent` lines the panel's content up with the first DATA column\n * (past the 40px disclosure column), so the detail reads as hanging off the\n * row rather than starting outside it.\n * - `expandGuideLeft` is the centre of the chevron, where the vertical\n * connector runs — the cue that the panel belongs to the row above.\n *\n * Both live here rather than in each consumer's panel: a hardcoded indent in\n * a feature silently drifts the moment this padding or the column width\n * changes.\n */\n const cellPadLeft = comfortable ? 20 : compact ? (snug ? 6 : 12) : 16;\n const expandIndent = 40 + cellPadLeft;\n const expandGuideLeft = cellPadLeft + 10;\n\n // Action overlay geometry: the action floats this many px in from the right\n // edge of the viewport (it has no reserved column — it overlays the row).\n const actionGutter = comfortable ? 20 : compact ? 12 : 16;\n\n /**\n * Selector for everything a row-level click must keep its hands off. A click\n * landing inside one of these belongs to that control alone — a copy button,\n * a per-row menu, a link, a checkbox, the `rowAction` overlay — so the row\n * handler ignores it rather than firing as well.\n *\n * `data-row-click-ignore` is the escape hatch for anything not covered here\n * (a custom widget in a cell, a drag handle) without it needing to stop\n * propagation itself.\n */\n const ROW_CLICK_IGNORE =\n 'button, a, input, select, textarea, label, [role=\"button\"], [role=\"link\"], ' +\n '[role=\"checkbox\"], [role=\"menuitem\"], [role=\"menu\"], [role=\"dialog\"], ' +\n \"[data-row-click-ignore]\";\n\n /**\n * Horizontal scroll position, so a frozen column can show a shadow only when\n * there is actually something scrolled underneath it.\n *\n * A shadow that is always on is just a heavier border: it says \"pinned\" when\n * nothing is hidden, and then says nothing new at the moment it matters. The\n * point of the shadow is to mark the edge that content is passing beneath.\n */\n const scrollRef = useRef<HTMLDivElement | null>(null);\n const [edge, setEdge] = useState({ start: false, end: false });\n\n const syncEdges = useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n const max = el.scrollWidth - el.clientWidth;\n setEdge({\n start: el.scrollLeft > 1,\n // 1px of slack: sub-pixel widths mean scrollLeft rarely reaches `max`\n // exactly, which would leave the end shadow stuck on at full scroll.\n end: max > 1 && el.scrollLeft < max - 1,\n });\n }, []);\n\n /**\n * Measured after layout rather than during render — it reads `scrollWidth`,\n * which render cannot know. Re-run when the column or row count changes,\n * since either changes whether the table overflows at all.\n */\n useEffect(() => {\n const raf = requestAnimationFrame(syncEdges);\n window.addEventListener(\"resize\", syncEdges);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener(\"resize\", syncEdges);\n };\n }, [syncEdges, columns.length, paginated.length]);\n\n /** Whether a click/keypress inside a row should reach `onRowClick`. */\n const isRowClickTarget = (target: EventTarget | null, rowEl: HTMLElement) => {\n if (!(target instanceof Element)) return false;\n // A React portal re-dispatches its clicks through the React tree, not the\n // DOM tree, so a row's overflow menu — rendered into document.body — still\n // arrives at this row's onClick. The target is not a DOM descendant of the\n // row, and that is exactly what says the click belonged to the menu rather\n // than to the row. Without this, choosing \"Edit\" from a row menu also fired\n // the row's own action, opening the edit dialog and the preview at once.\n if (!rowEl.contains(target)) return false;\n\n // Within the row, a click on a control belongs to that control. `closest`\n // can still walk above the row, so the match has to be inside it.\n const interactive = target.closest(ROW_CLICK_IGNORE);\n return !(interactive && rowEl.contains(interactive));\n };\n\n return (\n <div\n className={cn(\n \"bg-card text-card-foreground rounded-xl overflow-hidden border border-border\",\n className\n )}\n >\n {/* scrollbar space always reserved; thumb subtle on hover */}\n <div\n ref={scrollRef}\n onScroll={syncEdges}\n // Read by `frozenColumn`'s shadow through `group-data-[…]/table-scroll`.\n data-scrolled-start={edge.start ? \"true\" : \"false\"}\n data-scrolled-end={edge.end ? \"true\" : \"false\"}\n className={cn(\n \"group/table-scroll overflow-x-auto\",\n \"[&::-webkit-scrollbar]:h-[4px] [&::-webkit-scrollbar-track]:bg-transparent\",\n \"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent\",\n \"hover:[&::-webkit-scrollbar-thumb]:bg-border dark:hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/35\"\n )}\n style={{ scrollbarWidth: \"thin\", scrollbarColor: \"var(--border) transparent\" }}\n >\n <table\n className={cn(tableLayout === \"auto\" && \"min-w-[920px]\")}\n style={{\n // `content` uses the automatic algorithm but stays 100% wide; a\n // greedy spacer column (below) soaks up the slack so the data\n // columns collapse to their content width while the table fills.\n tableLayout: tableLayout === \"fixed\" ? \"fixed\" : \"auto\",\n width: \"100%\",\n }}\n >\n {tableLayout === \"fixed\" && !isEmpty && (\n <colgroup>\n {hasExpand ? <col style={{ width: 40 }} /> : null}\n {columns.map((col) => (\n <col key={col.key} style={colWidthStyle(col)} />\n ))}\n {/* Zero-width column: the action floats out of it as an overlay,\n so the last data column stays flush and nothing trails it. */}\n {hasAction ? <col style={{ width: 0 }} /> : null}\n </colgroup>\n )}\n\n <thead\n className={cn(\n headerStyle === \"surface\" && \"bg-muted/35\",\n headerStyle === \"minimal\" && \"bg-transparent\",\n theadClassName\n )}\n >\n <tr\n className={cn(\n \"border-b\",\n headerStyle === \"surface\" ? \"border-border\" : \"border-border/70\"\n )}\n >\n {hasExpand ? <th className={cn(headPad, \"w-10 p-0\")} aria-hidden /> : null}\n {columns.map((col) => {\n const sortable = col.sorter != null && col.sorter !== false;\n const activeOrder =\n sortState?.columnKey === col.key ? sortState.order : null;\n const align =\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\";\n return (\n <th\n key={col.key}\n style={col.cellStyle}\n // Announced to assistive tech as the sort state of the\n // column, which the caret pair alone does not convey.\n aria-sort={\n !sortable\n ? undefined\n : activeOrder === \"ascend\"\n ? \"ascending\"\n : activeOrder === \"descend\"\n ? \"descending\"\n : \"none\"\n }\n className={cn(\n headPad,\n headText,\n \"whitespace-nowrap align-middle\",\n align,\n // Width hints live in `cellClassName`; see `isEmpty`.\n !isEmpty && col.cellClassName\n )}\n >\n {sortable ? (\n <button\n type=\"button\"\n onClick={() =>\n setSort(\n nextSortOrder(\n sortState,\n col.key,\n col.sortDirections ?? [\"ascend\", \"descend\"]\n )\n )\n }\n className={cn(\n // Inherits the header's own type styling rather than\n // restating it, so a sortable header is visually\n // identical to a plain one apart from the glyph.\n //\n // Deliberately NOT truncating: a plain header does\n // not, so a sortable one that did would ellipsise\n // names the column beside it shows in full.\n // A bare <button>, so Preflight's `font: inherit`\n // already hands it the header's own type. The\n // `text-[inherit]` that used to be here did nothing\n // for size — Tailwind reads `text-[<non-length>]` as\n // a colour — and only looked like it worked because\n // nothing here sets a competing font-size.\n \"-mx-1 inline-flex items-center whitespace-nowrap rounded px-1 py-0.5 transition-colors\",\n \"hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n activeOrder && \"text-foreground\",\n // The glyph follows the text, so on a right-aligned\n // column it has to lead instead — otherwise it sits\n // between the label and the numbers it describes.\n col.align === \"right\" && \"flex-row-reverse [&>svg]:ml-0 [&>svg]:mr-1.5\"\n )}\n >\n {col.header}\n <SortIndicator order={activeOrder} />\n </button>\n ) : (\n col.header\n )}\n </th>\n );\n })}\n {hasSpacer ? <th className=\"w-full p-0\" aria-hidden /> : null}\n {hasAction ? (\n <th className=\"sticky right-0 z-[1] w-0 p-0\" aria-hidden />\n ) : null}\n </tr>\n </thead>\n\n <tbody>\n {isLoading ? (\n // The placeholder row mirrors the real row's cells exactly: one\n // per column, carrying that column's own width, alignment and\n // sticky classes, plus the same expand / spacer / action cells.\n //\n // It used to be a generic `TableRowSkeleton` with a cell count\n // and nothing else. With `tableLayout=\"content\"` the real row\n // also carries a greedy spacer cell, so the skeleton was one cell\n // short: the last shimmer stretched across the spacer's slot and\n // the placeholder columns stopped lining up with the headers\n // above them — which reads as a column missing while loading.\n Array.from({ length: skeletonRows }).map((_, r) => (\n <tr\n key={r}\n className={cn(\n \"border-b border-border/60\",\n comfortable && \"min-h-[56px]\",\n compact && \"min-h-[44px]\"\n )}\n >\n {hasExpand ? <td className={cn(cellPad, \"w-10\")} /> : null}\n {columns.map((col, c) => (\n <td\n key={col.key}\n style={col.cellStyle}\n className={cn(\n cellPad,\n \"align-middle overflow-hidden\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n col.cellClassName\n )}\n >\n {/* Varied widths so the block reads as rows of data\n rather than a striped grid. Inline-block so the\n column's own alignment still places it. */}\n <Shimmer\n className={cn(\n \"inline-block h-3.5 max-w-full\",\n c === 0 ? \"w-20\" : c === columns.length - 1 ? \"w-14\" : \"w-28\"\n )}\n />\n </td>\n ))}\n {hasSpacer ? <td className=\"p-0\" aria-hidden /> : null}\n {hasAction ? (\n <td className=\"sticky right-0 z-[1] w-0 p-0\" aria-hidden />\n ) : null}\n </tr>\n ))\n ) : paginated.length === 0 ? (\n <tr>\n <td colSpan={totalColSpan}>\n <EmptyState title={emptyTitle} description={emptyDescription} />\n </td>\n </tr>\n ) : (\n paginated.flatMap((row, i) => [\n <tr\n key={rowKeys[i]}\n className={cn(\n \"group transition-colors duration-150 border-b border-border/60 last:border-b-0\",\n comfortable && \"min-h-[56px]\",\n compact && \"min-h-[44px]\",\n \"hover:bg-muted/40 dark:hover:bg-muted/25\",\n hasAction &&\n \"hover:shadow-[0_1px_0_rgba(0,0,0,0.04)] dark:hover:shadow-none\",\n // Clickable rows read as clickable, and show a focus ring\n // when reached by keyboard. `focus-visible` only, so a\n // mouse click does not leave a ring behind on the row.\n onRowClick &&\n \"cursor-pointer focus-visible:outline-none focus-visible:bg-muted/40 dark:focus-visible:bg-muted/25\",\n // An open row takes its panel's background and drops the\n // divider beneath it, so the row and its detail read as one\n // block. Hover is pinned to the same value, or moving the\n // mouse over an open row would make it flicker away from\n // the panel it belongs to.\n rowExpanded(row, i) &&\n \"border-b-0 bg-muted/40 hover:bg-muted/40 dark:bg-muted/25 dark:hover:bg-muted/25\"\n )}\n // Keyboard parity with the mouse: the row is reachable by\n // Tab and activated by Enter / Space, which a bare <tr> with\n // an onClick would not be. No role override — the row stays a\n // row for assistive tech rather than claiming to be a button.\n tabIndex={onRowClick ? 0 : undefined}\n onClick={\n onRowClick\n ? (e) => {\n if (!isRowClickTarget(e.target, e.currentTarget)) return;\n onRowClick(row, i);\n }\n : undefined\n }\n onKeyDown={\n onRowClick\n ? (e) => {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n // Only the row's own focus activates it; a keypress\n // inside a control in the row belongs to that control.\n if (e.target !== e.currentTarget) return;\n // Space scrolls the page by default.\n e.preventDefault();\n onRowClick(row, i);\n }\n : undefined\n }\n >\n {hasExpand ? (\n <td className={cn(cellPad, \"w-10 align-middle\")}>\n {(expandable!.isExpandable?.(row, i) ?? true) ? (\n <button\n type=\"button\"\n aria-expanded={rowExpanded(row, i)}\n aria-label={expandable!.toggleLabel ?? \"Toggle row details\"}\n onClick={() => toggleExpanded(rowKeys[i], row, i)}\n className=\"inline-flex h-5 w-5 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronDown\n className={cn(\n \"h-3.5 w-3.5 transition-transform duration-150\",\n rowExpanded(row, i) && \"rotate-180\"\n )}\n />\n </button>\n ) : null}\n </td>\n ) : null}\n {columns.map((col) => (\n <td\n key={col.key}\n style={col.cellStyle}\n className={cn(\n cellPad,\n \"align-middle\",\n comfortable\n ? cn(\n \"text-[13px] leading-snug\",\n !col.wrap && \"whitespace-nowrap\"\n )\n : compact\n ? cn(\n \"text-[13px] leading-tight\",\n !col.wrap && \"whitespace-nowrap\",\n \"overflow-hidden\"\n )\n : \"whitespace-nowrap overflow-hidden\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n col.cellClassName\n )}\n >\n {col.render(row, i)}\n </td>\n ))}\n\n {hasSpacer ? <td className=\"p-0\" aria-hidden /> : null}\n\n {hasAction ? (\n // Zero-width sticky cell pinned to the right edge of the\n // viewport. Its children are positioned absolutely so they\n // float over the row (out of the 0-width cell) — the action\n // stays in view while scrolling and nothing trails the last\n // data column. Everything is revealed on hover only.\n <td className=\"sticky right-0 z-[1] w-0 p-0 align-middle\">\n {/* The action itself — `rowAction(row, i)` so it always\n receives this row's record. Vertically centered in the\n row and anchored `actionGutter`px from the right edge,\n overflowing left over the row content. Revealed on hover. */}\n <span\n className=\"absolute top-1/2 -translate-y-1/2 z-[1] inline-flex items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100\"\n style={{ right: actionGutter }}\n >\n {rowAction != null ? (\n typeof rowAction === \"function\" ? (\n rowAction(row, i)\n ) : (\n rowAction\n )\n ) : (\n <button\n type=\"button\"\n onClick={() => rowCta?.onClick?.(row)}\n className={cn(\n \"inline-flex items-center font-medium text-foreground bg-card rounded-lg border border-border hover:border-muted-foreground/50 whitespace-nowrap shadow-sm\",\n compact\n ? \"px-2.5 py-1 text-[11px]\"\n : \"px-3 py-1.5 text-[12px]\"\n )}\n >\n {rowCta?.label}\n </button>\n )}\n </span>\n </td>\n ) : null}\n </tr>,\n\n // The panel spans every column, including the toggle, spacer and\n // action cells, so it reads as one band under its row rather\n // than as a cell inside the grid.\n rowExpanded(row, i) ? (\n <tr\n key={`${rowKeys[i]}__panel`}\n className=\"border-b border-border/60 bg-muted/40 last:border-b-0 dark:bg-muted/25\"\n >\n <td colSpan={totalColSpan} className=\"p-0 align-top\">\n <div\n className=\"relative\"\n style={{ paddingLeft: expandIndent, paddingRight: cellPadLeft }}\n >\n {/* Connector: a hairline dropping from the chevron down\n the panel. The row and its detail share a background\n so they read as one block, which on its own leaves\n nothing to say the lower half is derived rather than\n more row content — this is that cue. Stops short of\n the bottom so it reads as hanging, not as a border. */}\n <span\n aria-hidden\n className=\"absolute top-0 bottom-4 w-px bg-border\"\n style={{ left: expandGuideLeft }}\n />\n {expandable!.render(row, i)}\n </div>\n </td>\n </tr>\n ) : null,\n ])\n )}\n </tbody>\n </table>\n </div>\n\n {pager.showFooter && !isLoading && paginated.length > 0 && (\n <DataTableFooter\n pad={footerPad}\n summary={pager.summary}\n countLabels={pager.countLabels}\n leading={pager.leading}\n pageSizeOptions={pager.pageSizeOptions}\n pageSize={pager.pageSize}\n onPageSizeChange={pager.onPageSizeChange}\n from={from}\n rowCount={paginated.length}\n total={pager.total}\n page={pager.page}\n totalPages={pager.totalPages}\n hasNext={pager.hasNext}\n hasPrev={pager.hasPrev}\n onNext={pager.onNext}\n onPrev={pager.onPrev}\n onPageChange={goToPage}\n />\n )}\n </div>\n );\n}\n\n// ── Footer ───────────────────────────────────────────────────────────────────\n\nconst PAGE_BUTTON =\n \"w-7 h-7 rounded-md flex items-center justify-center text-[12px] font-medium tabular-nums transition-colors\";\nconst PAGE_BUTTON_IDLE =\n \"text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed\";\nconst PAGE_BUTTON_ACTIVE = \"bg-primary text-primary-foreground shadow-sm\";\n\n/**\n * One footer for every pagination mode, so a cursor-paged grid and a\n * page-paged one are indistinguishable apart from the two things that\n * genuinely differ: the total, and how many page numbers can honestly be\n * offered.\n *\n * `totalPages` being `undefined` is what marks cursor mode — it means \"nobody\n * knows\", and the footer answers by numbering only the pages a cursor can\n * actually reach in one step (previous, current, next).\n */\nfunction DataTableFooter({\n pad,\n summary,\n countLabels,\n leading,\n pageSizeOptions,\n pageSize,\n onPageSizeChange,\n from,\n rowCount,\n total,\n page,\n totalPages,\n hasNext,\n hasPrev,\n onNext,\n onPrev,\n onPageChange,\n}: {\n pad: string;\n summary: DataTableFooterSummary;\n countLabels: { singular: string; plural: string };\n leading?: ReactNode;\n pageSizeOptions?: readonly number[];\n pageSize: number;\n onPageSizeChange?: (size: number) => void;\n from: number;\n rowCount: number;\n total?: number;\n page: number;\n totalPages?: number;\n hasNext?: boolean;\n hasPrev?: boolean;\n onNext?: () => void;\n onPrev?: () => void;\n onPageChange: (page: number) => void;\n}) {\n const isCursor = totalPages === undefined;\n /** 0 in cursor mode, where it is never read. */\n const pageCount = totalPages ?? 0;\n /**\n * A pager with nowhere to go is noise. In `page` mode that is a single page;\n * in `cursor` mode it is a page with nothing before or after it, which is the\n * closest thing to a page count a cursor response gives us.\n */\n const showPager = isCursor ? !!hasPrev || !!hasNext : pageCount > 1;\n const showRowsPerPage = !!pageSizeOptions?.length && !!onPageSizeChange;\n\n const start = from + 1;\n const end = total !== undefined ? Math.min(from + pageSize, total) : from + rowCount;\n\n /**\n * Which page numbers to draw.\n *\n * With a total, the full strip with ellipses — any page is one click away.\n * Without one, only `page - 1`, `page`, and `page + 1`: those are the pages\n * a cursor can step to, and a number the user cannot actually reach is worse\n * than no number at all. `page + 1` appears only when `hasNext` says there is\n * something there, so the strip itself is the signal that more data exists.\n */\n const pages: (number | \"…\")[] = isCursor\n ? [...(hasPrev ? [page - 1] : []), page, ...(hasNext ? [page + 1] : [])]\n : getPageRange(page, pageCount);\n\n const goPrev = () => (isCursor ? onPrev?.() : onPageChange(Math.max(1, page - 1)));\n const goNext = () => (isCursor ? onNext?.() : onPageChange(Math.min(pageCount, page + 1)));\n\n /**\n * With a total, the arrows are always drawn and go disabled at the ends — the\n * strip has a known width, so nothing moves. Without one, they are drawn only\n * when the page they point at is known to exist: a cursor response says\n * whether there is a next page, and an arrow that is permanently disabled\n * says less than no arrow at all.\n */\n const showPrev = isCursor ? !!hasPrev : true;\n const showNext = isCursor ? !!hasNext : true;\n const prevDisabled = isCursor ? false : page === 1;\n const nextDisabled = isCursor ? false : page === pageCount;\n\n /** In cursor mode a number is only ever one step away, so it maps to a step. */\n const goToNumber = (p: number) => {\n if (!isCursor) return onPageChange(p);\n if (p === page - 1) onPrev?.();\n else if (p === page + 1) onNext?.();\n };\n\n return (\n <div\n className={cn(\n \"flex items-center gap-4 flex-wrap border-t border-border\",\n pad,\n summary === \"none\" && !showRowsPerPage && !leading ? \"justify-end\" : \"justify-between\"\n )}\n >\n {/* The rows-per-page picker and the summary group together on the left\n rather than becoming a third item that justify-between flings to its\n own corner. */}\n <div className=\"flex items-center gap-3\">\n {leading}\n\n {showRowsPerPage ? (\n <div className=\"flex items-center gap-2 text-[12px] text-muted-foreground\">\n <span>Rows per page</span>\n <Select\n value={String(pageSize)}\n onValueChange={(v) => onPageSizeChange!(Number(v))}\n >\n <SelectTrigger size=\"sm\" aria-label=\"Rows per page\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizeOptions!.map((n) => (\n <SelectItem key={n} value={String(n)}>\n {n}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n ) : null}\n\n {summary === \"count\" && total !== undefined ? (\n <span className=\"text-[12px] text-muted-foreground tabular-nums\">\n <span className=\"font-medium text-foreground\">{total.toLocaleString()}</span>{\" \"}\n {total === 1 ? countLabels.singular : countLabels.plural}\n </span>\n ) : summary === \"range\" ? (\n <span className=\"text-[12px] text-muted-foreground tabular-nums\">\n Showing{\" \"}\n <span className=\"text-foreground font-medium\">\n {Math.min(start, total ?? start)}–{end}\n </span>\n {/* No total, no \"of N\" and no results noun — cursor responses do not\n carry a count, and inventing one would be a lie the user would\n page against. */}\n {total !== undefined ? (\n <>\n {\" \"}\n of{\" \"}\n <span className=\"text-foreground font-medium\">{total.toLocaleString()}</span>{\" \"}\n {total !== 1 ? \"results\" : \"result\"}\n </>\n ) : null}\n </span>\n ) : null}\n </div>\n\n {showPager && (\n <div className=\"flex items-center gap-1\">\n {showPrev ? (\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n onClick={goPrev}\n disabled={prevDisabled}\n className={cn(PAGE_BUTTON, PAGE_BUTTON_IDLE)}\n >\n <ChevronLeft className=\"w-3.5 h-3.5\" />\n </button>\n ) : null}\n\n {pages.map((p, idx) =>\n p === \"…\" ? (\n <span\n key={`ellipsis-${idx}`}\n className=\"w-7 h-7 flex items-center justify-center text-[12px] text-muted-foreground select-none\"\n >\n …\n </span>\n ) : (\n <button\n key={p}\n type=\"button\"\n aria-current={p === page ? \"page\" : undefined}\n onClick={() => goToNumber(p)}\n className={cn(PAGE_BUTTON, p === page ? PAGE_BUTTON_ACTIVE : PAGE_BUTTON_IDLE)}\n >\n {p}\n </button>\n )\n )}\n\n {showNext ? (\n <button\n type=\"button\"\n aria-label=\"Next page\"\n onClick={goNext}\n disabled={nextDisabled}\n className={cn(PAGE_BUTTON, PAGE_BUTTON_IDLE)}\n >\n <ChevronRight className=\"w-3.5 h-3.5\" />\n </button>\n ) : null}\n </div>\n )}\n </div>\n );\n}\n\n// ── Frozen columns ───────────────────────────────────────────────────────────\n\n/**\n * The classes and offset for a column frozen to the left edge, so a grid that\n * pins its identifier columns does not have to reinvent the recipe. Five\n * feature files in the internal console had five copies of it, all carrying the\n * same two faults below.\n *\n * Spread the result onto the column:\n *\n * ```tsx\n * let left = 0;\n * columns.map((col) => {\n * if (!FROZEN.includes(col.key)) return col;\n * const frozen = { ...col, ...frozenColumn({ left, isLast: col.key === lastFrozen }) };\n * left += widthOf(col);\n * return frozen;\n * });\n * ```\n *\n * Two things it gets right that a hand-rolled version tends not to:\n *\n * **The background is opaque and is the table's own.** It has to be opaque or\n * the rows scrolling underneath show through the pinned block. It should not be\n * a tint, because a tint at full strength next to a row that highlights at 40%\n * makes the frozen block the heaviest thing on screen — the divider and the\n * shadow are what say \"pinned\", and the shadow is the honest signal anyway,\n * since it is what reads as content passing underneath.\n *\n * **It follows the row's hover.** The frozen cells are part of the row; pinning\n * them to a fixed colour makes a hovered row highlight in two different shades\n * and read as two rows. The hover colour is mixed rather than given an alpha,\n * for the same opacity reason.\n */\nexport function frozenColumn({\n left,\n right,\n isLast = false,\n}: {\n /** Offset from the left edge in px — the widths of the frozen columns before this one. */\n left?: number;\n /** Offset from the right edge in px, for a column pinned to that side instead. */\n right?: number;\n /** The column at the boundary, which carries the divider and the shadow. */\n isLast?: boolean;\n}): Pick<Column<unknown>, \"cellClassName\" | \"cellStyle\"> {\n // Pinned right is the trailing actions column; pinned left is the identifier\n // block. The divider and shadow face the scrolling content either way.\n const toRight = right !== undefined;\n\n /**\n * The divider and the shadow are pseudo-elements, NOT `border-r` and\n * `box-shadow`.\n *\n * That is not a style preference. Tailwind's Preflight sets\n * `border-collapse: collapse` on every table, and in the collapsed model a\n * cell's border belongs to the **table**, not the cell — so it is painted in\n * the table's layer and does not travel with a sticky cell. The border sits\n * still while the frozen column slides over the scrolling content, which\n * looks exactly like the divider vanishing the moment you scroll. A\n * `box-shadow` on the cell fails the same way.\n *\n * A pseudo-element paints inside the cell's own box, so it moves with it.\n * Both are anchored *inside* the cell's edge rather than hanging off it,\n * because the cell carries `overflow-hidden` at compact density and anything\n * outside would be clipped.\n *\n * That placement is why the gradient is kept deliberately slight — 4px at 7%,\n * barely a hairline of depth beside the divider. Sitting inside the cell, it\n * tints the pinned column itself rather than falling on the content passing\n * beneath, so anything heavier stops reading as a shadow and starts reading\n * as a smudge down the edge of the column. Dark mode carries more (35%)\n * because the same tint over a dark surface is close to invisible.\n */\n /**\n * Both branches are written out as complete literal class strings. Tailwind\n * scans source text for class names, so a name assembled at runtime —\n * `` `after:${edge}` `` — generates no CSS whatsoever. The duplication is the\n * price of the utilities existing at all.\n */\n const boundary = toRight\n ? [\n \"after:pointer-events-none after:absolute after:inset-y-0 after:left-0 after:w-px after:bg-border\",\n \"before:pointer-events-none before:absolute before:inset-y-0 before:left-0 before:w-1\",\n \"before:opacity-0 before:transition-opacity before:duration-200\",\n \"before:bg-[linear-gradient(to_right,rgb(0_0_0/0.07),transparent)]\",\n \"dark:before:bg-[linear-gradient(to_right,rgb(0_0_0/0.35),transparent)]\",\n \"group-data-[scrolled-end=true]/table-scroll:before:opacity-100\",\n ]\n : [\n \"after:pointer-events-none after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-border\",\n \"before:pointer-events-none before:absolute before:inset-y-0 before:right-0 before:w-1\",\n \"before:opacity-0 before:transition-opacity before:duration-200\",\n \"before:bg-[linear-gradient(to_left,rgb(0_0_0/0.07),transparent)]\",\n \"dark:before:bg-[linear-gradient(to_left,rgb(0_0_0/0.35),transparent)]\",\n \"group-data-[scrolled-start=true]/table-scroll:before:opacity-100\",\n ];\n\n return {\n cellStyle: toRight ? { right } : { left: left ?? 0 },\n cellClassName: cn(\n \"sticky z-10 bg-card\",\n // Follow the row's own hover rather than sitting at a fixed tint: the\n // frozen cells are part of the row, and a row that highlights in two\n // shades reads as two rows. Mixed to an opaque colour, never an alpha —\n // a translucent pinned cell lets the rows scrolling beneath show through.\n \"group-hover:bg-[color-mix(in_oklab,var(--muted)_40%,var(--card))]\",\n \"dark:group-hover:bg-[color-mix(in_oklab,var(--muted)_25%,var(--card))]\",\n isLast && boundary\n ),\n };\n}\n","\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { DataTable } from \"./data-table\";\nimport type {\n Column,\n DataTableDensity,\n DataTableExpandable,\n DataTablePagination,\n DataTableSorting,\n} from \"./data-table\";\nimport { cn } from \"./utils\";\n\n/**\n * The canonical table surface: one bordered card holding a title, tabs, a\n * filter toolbar, the grid, and a footer — in that order, with the same\n * dividers and gutters every time.\n *\n * `DataTable` on its own is the grid. This is everything around it, and it\n * exists because that surrounding chrome is where tables actually drift: one\n * feature puts its filters above the card, another inside it; one draws a\n * divider under the tabs, another does not; one pads the toolbar `py-3` and the\n * next `py-2.5`. None of that is a decision a feature should be making.\n *\n * Pagination goes through `pagination`, in every mode — including cursor APIs\n * that carry no row total. The `footer` slot is for a footer that is genuinely\n * not a pager; passing one hides the table's own.\n */\nexport interface DataTableCardProps<T> {\n columns: Column<T>[];\n data: T[];\n rowKey: (row: T) => string;\n isLoading?: boolean;\n /**\n * Section title. For a grid that names itself — an analytics section like\n * \"Top 10 Merchants by Volume\" — rather than a page-level grid, whose name is\n * the page header. Renders above `tabs`.\n */\n title?: string;\n /** One line under the title. Only meaningful with `title`. */\n description?: string;\n /** Controls on the title row, flush right (a period toggle, Refresh, …). */\n actions?: ReactNode;\n /** Tab bar near the top of the card, above the toolbar. */\n tabs?: ReactNode;\n /** Filters / search / action buttons, as a row inside the card top. */\n toolbar?: ReactNode;\n /**\n * A non-pager footer inside the card bottom. Hides the table's own footer, so\n * do NOT use it for pagination — that is what `pagination` is for, in every\n * mode. Hand-rolling a pager here is how two different pagers end up in one\n * app.\n */\n footer?: ReactNode;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * Replaces the grid when there are no rows — an illustrated placeholder,\n * typically.\n *\n * `emptyTitle` / `emptyDescription` give the table's own text-only empty\n * state, which keeps the column headers and is right for \"nothing matched\n * your filters\". This is for the first-run case, where there is no data yet\n * because none has ever existed, and a drawn state says that better than a\n * header row over nothing.\n */\n emptyState?: ReactNode;\n /**\n * Replaces the rows entirely when the request failed.\n *\n * Distinct from an empty result with error-worded copy: that keeps the\n * column headers, which is right for \"nothing matched\" and wrong for \"we\n * could not load this\" — headers imply data was fetched and found empty.\n */\n errorState?: ReactNode;\n /** See {@link DataTablePagination}. Omit for client-side paging at 10/page. */\n pagination?: DataTablePagination;\n /** See {@link DataTableSorting}. */\n sorting?: DataTableSorting;\n rowAction?: ReactNode | ((row: T, index: number) => ReactNode);\n /**\n * Makes the whole row a click target, for a grid that drills into a detail\n * view. Passed straight through, so it brings the keyboard affordances with\n * it and does not fire for clicks landing on a button, link or form control\n * inside a cell.\n */\n onRowClick?: (row: T, index: number) => void;\n /** Defaults to \"content\"; pass \"fixed\" for grids with frozen sticky columns. */\n tableLayout?: \"auto\" | \"fixed\" | \"content\";\n /** Per-row disclosure panel rendered beneath the row. */\n expandable?: DataTableExpandable<T>;\n /** Row rhythm. Defaults to `compact`, which is what a data-dense grid wants. */\n density?: DataTableDensity;\n skeletonRows?: number;\n /**\n * CSS max-height for the internally scrolling body, so the toolbar and footer\n * stay put while the rows scroll and the page itself does not grow.\n *\n * The default assumes a page header plus this card's toolbar; a card that\n * also carries a `tabs` row needs a smaller cap, or the page starts scrolling\n * as well. Pass `\"none\"` to let the card grow with its content instead.\n */\n maxBodyHeight?: string;\n className?: string;\n}\n\nexport function DataTableCard<T>({\n columns,\n data,\n rowKey,\n isLoading,\n title,\n description,\n actions,\n tabs,\n toolbar,\n footer,\n emptyTitle,\n emptyDescription,\n emptyState,\n errorState,\n pagination,\n sorting,\n rowAction,\n onRowClick,\n tableLayout = \"content\",\n expandable,\n density = \"compact\",\n skeletonRows = 8,\n maxBodyHeight = \"calc(100vh - 260px)\",\n className,\n}: DataTableCardProps<T>) {\n const capped = maxBodyHeight !== \"none\";\n /** The illustrated stand-in only applies once loading has settled. */\n const showEmptyState = !!emptyState && !isLoading && data.length === 0;\n\n return (\n <div\n className={cn(\"overflow-hidden rounded-xl border border-border bg-card\", className)}\n style={\n capped ? ({ [\"--dtc-max-body\" as string]: maxBodyHeight } as CSSProperties) : undefined\n }\n >\n {title && (\n <div className=\"flex flex-wrap items-start justify-between gap-3 border-b border-border px-4 py-3.5\">\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-foreground\">{title}</h2>\n {description && <p className=\"mt-0.5 text-xs text-muted-foreground\">{description}</p>}\n </div>\n {actions && <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>}\n </div>\n )}\n\n {tabs && <div className=\"border-b border-border px-4 pt-3\">{tabs}</div>}\n {toolbar && <div className=\"border-b border-border px-4 py-3\">{toolbar}</div>}\n\n {errorState}\n {!errorState && showEmptyState && emptyState}\n\n <DataTable<T>\n className={cn(\n (showEmptyState || errorState) && \"hidden\",\n // The card already draws the border and radius; a second set inside\n // it would read as a table nested in a card.\n \"rounded-none border-0\",\n footer && \"[&>.border-t]:hidden\",\n // Cap the scroll container so the body scrolls internally while the\n // toolbar and footer stay fixed. The cap comes from an inline custom\n // property rather than a class, so a caller's `className` override\n // cannot depend on class-merge order.\n capped &&\n \"[&>div:first-child]:max-h-[var(--dtc-max-body)] [&>div:first-child]:overflow-y-auto\"\n )}\n // The header sticks to the top of that scroll area, which is only\n // meaningful while the body actually scrolls.\n theadClassName={capped ? \"sticky top-0 z-20 [&_th]:bg-card\" : undefined}\n tableLayout={tableLayout}\n columns={columns}\n data={data}\n isLoading={isLoading}\n rowKey={rowKey}\n skeletonRows={skeletonRows}\n density={density}\n pagination={pagination}\n sorting={sorting}\n rowAction={rowAction}\n onRowClick={onRowClick}\n emptyTitle={emptyTitle}\n emptyDescription={emptyDescription}\n expandable={expandable}\n />\n\n {footer && (\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t border-border px-4 py-3\">\n {footer}\n </div>\n )}\n </div>\n );\n}\n\n/** Right-aligned group for toolbar action buttons. */\nexport function TableToolbarActions({ children }: { children: ReactNode }) {\n return <div className=\"ml-auto flex items-center gap-2\">{children}</div>;\n}\n","\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { normalizePagination, type DataTablePagination } from \"./data-table\";\nimport { EmptyState } from \"./empty-state\";\nimport { Shimmer } from \"./skeleton\";\nimport { cn } from \"./utils\";\n\n/**\n * The narrow-viewport counterpart to {@link DataTableCard}: the same records as\n * a stack of cards.\n *\n * It is a separate component rather than a mode of the table on purpose. A\n * card list is not a table with its columns hidden — it chooses a handful of\n * fields, gives them a hierarchy, and drops the rest. Folding that into\n * `DataTableCard` would mean one component carrying two layouts and a\n * breakpoint, and every table paying for props it does not use.\n *\n * Pair the two with CSS, not a media-query hook:\n *\n * ```tsx\n * <DataTableCard className=\"hidden lg:block\" … />\n * <DataCardList className=\"lg:hidden\" … />\n * ```\n *\n * Both render; CSS shows one. A JS breakpoint would have to start with a guess\n * on the server, so one cohort sees the wrong layout on first paint, and a\n * resize across the breakpoint unmounts the visible half — taking scroll\n * position and any open row with it.\n *\n * What it owns is the surface, not the card: the bordered container, the\n * loading skeletons, the empty state and the pager. Those are the four things\n * every hand-rolled card list in the apps reimplemented, and the four that had\n * drifted. The card itself stays with the feature, via `renderCard` — that is\n * the part that genuinely differs per record.\n */\nexport interface DataCardListProps<T> {\n rows: T[];\n rowKey: (row: T) => string;\n /** One record as a card. The only part a feature has to write. */\n renderCard: (row: T, index: number) => ReactNode;\n isLoading?: boolean;\n /**\n * The loading placeholder for one card. Omit for a generic card-shaped\n * shimmer — good enough for most lists, and worth replacing only where the\n * real card has a distinctive shape worth pre-announcing.\n */\n renderSkeleton?: (index: number) => ReactNode;\n skeletonCount?: number;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * Replaces the list when there are no rows — an illustrated placeholder,\n * typically. Same split as `DataTableCard`: the title/description pair is the\n * plain \"nothing matched\" state, this is the drawn first-run one.\n */\n emptyState?: ReactNode;\n /**\n * Replaces the rows entirely when the request failed.\n *\n * Distinct from an empty result with error-worded copy: that keeps the\n * column headers, which is right for \"nothing matched\" and wrong for \"we\n * could not load this\" — headers imply data was fetched and found empty.\n */\n errorState?: ReactNode;\n /**\n * The same {@link DataTablePagination} the table takes, so a list and the\n * table beside it cannot disagree about which page they are on. Rendered as\n * a compact Prev / Next pager rather than a numbered strip: a row of page\n * numbers is the first thing to go wrong on a phone.\n */\n pagination?: DataTablePagination;\n /** Wraps the list in the same bordered card the table uses. Default true. */\n bordered?: boolean;\n className?: string;\n}\n\n/** A generic card-shaped placeholder: a title line, two details, a value. */\nfunction DefaultCardSkeleton() {\n return (\n <div className=\"rounded-xl border border-border bg-card p-3.5\">\n <div className=\"flex items-center gap-2\">\n <Shimmer className=\"h-4 w-40\" />\n <Shimmer className=\"ml-auto h-3.5 w-5\" rounded=\"sm\" />\n </div>\n <Shimmer className=\"mt-2 h-3 w-28\" />\n <Shimmer className=\"mt-1.5 h-3 w-44\" />\n <Shimmer className=\"mt-2.5 h-3.5 w-32\" />\n </div>\n );\n}\n\nexport function DataCardList<T>({\n rows,\n rowKey,\n renderCard,\n isLoading = false,\n renderSkeleton,\n skeletonCount = 6,\n emptyTitle = \"Nothing to show\",\n emptyDescription,\n emptyState,\n errorState,\n pagination = { mode: \"client\" },\n bordered = true,\n className,\n}: DataCardListProps<T>) {\n const pager = normalizePagination(pagination, rows.length, 1);\n\n // Only `client` mode holds every row, so only `client` mode slices; the\n // others were handed exactly this page. Same rule as the table.\n const page = pager.sliceLocally\n ? rows.slice((pager.page - 1) * pager.pageSize, pager.page * pager.pageSize)\n : rows;\n\n const isCursor = pager.totalPages === undefined;\n const hasPrev = isCursor ? !!pager.hasPrev : pager.page > 1;\n const hasNext = isCursor ? !!pager.hasNext : pager.page < (pager.totalPages ?? 1);\n\n const goPrev = () =>\n isCursor ? pager.onPrev?.() : pagination.mode === \"page\" && pagination.onPageChange(pager.page - 1);\n const goNext = () =>\n isCursor ? pager.onNext?.() : pagination.mode === \"page\" && pagination.onPageChange(pager.page + 1);\n\n const showPager =\n !errorState && pager.showFooter && !isLoading && page.length > 0 && (hasPrev || hasNext);\n\n return (\n <div\n className={cn(\n \"flex flex-col gap-3 p-4\",\n bordered && \"rounded-xl border border-border bg-card\",\n className\n )}\n >\n {errorState ? (\n errorState\n ) : isLoading ? (\n Array.from({ length: skeletonCount }).map((_, i) =>\n renderSkeleton ? (\n <div key={i}>{renderSkeleton(i)}</div>\n ) : (\n <DefaultCardSkeleton key={i} />\n )\n )\n ) : page.length === 0 ? (\n (emptyState ?? <EmptyState title={emptyTitle} description={emptyDescription} />)\n ) : (\n page.map((row, i) => <div key={rowKey(row)}>{renderCard(row, i)}</div>)\n )}\n\n {showPager && (\n <div className=\"flex items-center justify-between gap-2 pt-1\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={!hasPrev}\n onClick={goPrev}\n leftIcon={<ChevronLeft className=\"h-3.5 w-3.5\" />}\n >\n Prev\n </Button>\n\n {/* No total in cursor mode, so no \"of N\" — the same honesty the\n table's own footer keeps. */}\n <span className=\"text-[12px] tabular-nums text-muted-foreground\">\n Page {pager.page}\n {pager.totalPages !== undefined ? ` of ${pager.totalPages}` : \"\"}\n </span>\n\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={!hasNext}\n onClick={goNext}\n rightIcon={<ChevronRight className=\"h-3.5 w-3.5\" />}\n >\n Next\n </Button>\n </div>\n )}\n </div>\n );\n}\n","\"use client\";\n\nimport { useEffect, useRef, useState, type MouseEvent } from \"react\";\nimport { Check, Copy } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { Button } from \"./button\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./tooltip\";\nimport { cn } from \"./utils\";\n\nexport interface CopyableCellProps {\n /**\n * The full value. This is what reaches the clipboard, the tooltip and the\n * accessible name — always, even when `display` shortens what is on screen.\n * Shortening what is shown must never shorten what the user walks away with.\n */\n value?: string | null;\n /** What to render instead of `value` — an elided form, typically. */\n display?: string;\n /** The noun in the tooltip and the toast: \"Transaction ID copied\". */\n label?: string;\n /**\n * Makes the value the handle that opens the row, rendered as a link. Without\n * it the value is plain text that can still be copied.\n *\n * The copy button stops propagation, so an id that opens a row does not also\n * open it when copied.\n */\n onClick?: () => void;\n /** Render the value in the primary colour. */\n accent?: boolean;\n monospace?: boolean;\n /** What an absent value renders as. Default the em dash every grid uses. */\n fallback?: string;\n /**\n * - `inline` (default) — the value, with its own copy button beside it.\n * - `cell` — the **whole** element is the copy target and the value\n * underlines on hover. For a fixed-width column where a separate button\n * would cost more room than the value it copies.\n *\n * `cell` ignores `onClick`: a cell cannot both copy and open the row on the\n * same click.\n */\n variant?: \"inline\" | \"cell\";\n /**\n * Keep the copy button invisible until the row (or any `group` ancestor) is\n * hovered, or the button itself is focused. Opacity only — it keeps its\n * space, so revealing it never shifts the row.\n *\n * Defaults to `true`, which is what a table wants: twelve permanent copy\n * buttons are twelve pieces of chrome competing with the data. Pass `false`\n * for a detail field, where there is no row to hover and the control would\n * simply never appear. Pointer-coarse devices have no hover to give, so it\n * stays visible there regardless.\n */\n revealOnHover?: boolean;\n /**\n * Announce the copy with a toast. Off for a field whose tick and tooltip are\n * feedback enough, and where a toast per copy would be noise.\n */\n showToast?: boolean;\n /** Extra classes on the value itself, e.g. a muted secondary placement. */\n valueClassName?: string;\n className?: string;\n}\n\n/**\n * The canonical identifier cell: a value plus a copy button that fades in on\n * the row's hover.\n *\n * Reveal-on-hover is the point. A table of twelve ids with twelve permanent\n * copy buttons is twelve pieces of chrome competing with the data; the row the\n * pointer is on is the only one whose button is useful.\n *\n * It relies on the row's own `group` class, which every `DataTable` `<tr>`\n * already carries. Outside a DataTable row, pass `className=\"group\"` on an\n * ancestor or the button stays hidden.\n */\nexport function CopyableCell({\n value,\n display,\n label = \"Value\",\n onClick,\n accent = false,\n monospace = false,\n fallback = \"—\",\n variant = \"inline\",\n revealOnHover = true,\n showToast = true,\n valueClassName,\n className,\n}: CopyableCellProps) {\n const [copied, setCopied] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // The tick reverts on a timer, so an unmount mid-flight must not leave it\n // running against a gone component.\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n []\n );\n\n if (!value) return <span className=\"text-muted-foreground\">{fallback}</span>;\n\n const copyValue = async () => {\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n if (showToast) toast.success(`${label} copied`);\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), 1500);\n } catch {\n // Clipboard blocked — an insecure context, or permission denied. Copying\n // an id is not worth an error toast over; the value is still on screen.\n }\n };\n\n /**\n * Copying is never also a request to open the record the value belongs to,\n * so the event stops here. DataTable's own `onRowClick` already skips a\n * click on a button; this also covers rows made clickable some other way.\n */\n const copy = (e: MouseEvent) => {\n e.stopPropagation();\n void copyValue();\n };\n\n const text = cn(\n \"min-w-0 truncate font-medium\",\n accent ? \"text-primary\" : \"text-foreground\",\n monospace && \"font-mono\",\n valueClassName\n );\n\n /** True when the screen is only showing part of the value. */\n const elided = display !== undefined && display !== value;\n const copyHint = copied ? \"Copied\" : `Copy ${label}`;\n\n if (variant === \"cell\") {\n // The whole box copies, so there is no separate button to reach for — in a\n // narrow column that button costs more width than the value it copies. The\n // value underlines on hover to say the box is the target; the icon is a\n // marker, not a second control, which is why it is not focusable.\n return (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <div\n role=\"button\"\n tabIndex={0}\n onClick={copy}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n e.stopPropagation();\n void copyValue();\n }}\n aria-label={copied ? \"Copied to clipboard\" : `Copy ${value}`}\n className={cn(\n \"group/copy flex min-w-0 cursor-pointer items-center gap-1 rounded-md\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n className\n )}\n >\n <span className={cn(text, \"flex-1 group-hover/copy:underline\")}>\n {display ?? value}\n </span>\n {copied ? (\n <Check className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n ) : (\n <Copy\n className={cn(\n \"h-3 w-3 shrink-0 text-muted-foreground\",\n revealOnHover &&\n \"opacity-0 transition-opacity group-hover/copy:opacity-100 group-focus-visible/copy:opacity-100 [@media(hover:none)]:opacity-100\"\n )}\n />\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"text-xs\">\n {copied ? \"Copied\" : \"Copy\"}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n }\n\n /**\n * The value as drawn. An elided value carries the whole thing in the tooltip\n * below; `title` is only for the other case — a value `display` did not\n * shorten can still be cut by the column's own `truncate`, and there is no\n * React-side way to know that it was.\n */\n const valueNode = onClick ? (\n // A bare <button>, deliberately, where the rest of flux would reach for\n // `Button variant=\"link\"`. That variant hard-codes `text-[15px]`, and\n // the obvious override — `text-[inherit]` — does not beat it: Tailwind\n // and tailwind-merge read `text-[<non-length>]` as a COLOUR, so the\n // size class survives and the cell renders 2px larger than every other\n // cell in the row. Preflight already gives a bare button `font: inherit`,\n // so this simply inherits the cell's size at whatever density the table\n // is using, which is what a cell should do.\n <button\n type=\"button\"\n onClick={onClick}\n title={elided ? undefined : value}\n // The elided text is not the name of this control — the value is.\n aria-label={elided ? value : undefined}\n className={cn(\n \"cursor-pointer bg-transparent p-0 text-left underline-offset-4\",\n \"hover:underline focus-visible:underline focus-visible:outline-none\",\n text\n )}\n >\n {display ?? value}\n </button>\n ) : (\n <span\n className={text}\n title={elided ? undefined : value}\n // Hidden from assistive tech only when there is an sr-only twin below\n // carrying the whole value — otherwise the elided form would be read out\n // as well as it, twice for one id.\n aria-hidden={elided || undefined}\n >\n {display ?? value}\n </span>\n );\n\n return (\n <div className={cn(\"group/copy flex min-w-0 items-center gap-1\", className)}>\n {/* The full value hangs off the **text**, which is the part that was\n shortened and so the part a reader reaches for. It used to hang off\n the copy button instead, which meant the way to read an id was to\n hover the control that copies it. Only mounted when something was\n actually elided: a tooltip repeating text already fully on screen is\n noise. */}\n {elided ? (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>{valueNode}</TooltipTrigger>\n <TooltipContent side=\"top\" className=\"text-xs\">\n {value}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n valueNode\n )}\n\n {/* Elided text reads as noise aloud, so the full value is what goes to a\n screen reader. The interactive case names itself with `aria-label`\n above and needs none of this. */}\n {elided && !onClick && <span className=\"sr-only\">{value}</span>}\n\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={copy}\n aria-label={`Copy ${label}`}\n // `group-hover` is the DataTable row; `group-hover/copy` covers a\n // cell used outside one, where hovering the value itself should\n // still reveal the button.\n className={cn(\n \"h-5 w-5 min-h-0 min-w-0 shrink-0 rounded-md p-0 text-muted-foreground\",\n revealOnHover && [\n \"opacity-0 transition-opacity\",\n // `group-hover` is the DataTable row; `group-hover/copy`\n // covers a cell used outside one, where hovering the value\n // itself should still reveal the button.\n \"focus-visible:opacity-100 group-hover:opacity-100 group-hover/copy:opacity-100\",\n // No hover to wait for on a touch device, so it simply shows.\n \"[@media(hover:none)]:opacity-100\",\n ]\n )}\n >\n {copied ? <Check className=\"h-3 w-3\" /> : <Copy className=\"h-3 w-3\" />}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"text-xs\">\n {copyHint}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n </div>\n );\n}\n","\"use client\";\n\nimport { useEffect, useMemo, useRef, useState, type ChangeEvent } from \"react\";\nimport { Search } from \"lucide-react\";\nimport { Input } from \"./input\";\nimport { cn } from \"./utils\";\n\n/** Height of one word slot, in px. The carousel translates by multiples of it. */\nconst WORD_HEIGHT = 20;\n\nexport interface RotatingSearchInputProps {\n /** Controlled value. Omit to let the field own it. */\n value?: string;\n /** Fires on the debounced value, not on every keystroke. */\n onSearch: (value: string) => void;\n /** The hints to cycle through: \"Amount\", \"Transaction ID\", \"Email\". */\n words: string[];\n /** Debounce before `onSearch` fires. Default 300ms. */\n debounceDelay?: number;\n className?: string;\n /** Screen-reader name for the field. */\n ariaLabel?: string;\n}\n\n/**\n * The table search box: one field whose placeholder cycles through what it can\n * actually match — \"Search by Amount\", then \"Transaction ID\", then \"Email\".\n *\n * That rotation is the whole point. A single grid search usually spans half a\n * dozen fields, and a static \"Search\" placeholder tells the user none of them,\n * so they guess at what is searchable and conclude the box is broken when their\n * guess misses. Naming the fields in turn costs no space and answers it.\n *\n * `onSearch` is debounced, so a search that hits the network fires once the\n * user pauses rather than once per keystroke.\n */\nexport function RotatingSearchInput({\n value,\n onSearch,\n words,\n debounceDelay = 300,\n className,\n ariaLabel = \"Search\",\n}: RotatingSearchInputProps) {\n const [internalValue, setInternalValue] = useState(value ?? \"\");\n const [index, setIndex] = useState(0);\n const [withTransition, setWithTransition] = useState(true);\n\n /**\n * The latest handler, read at fire time. Without this the debounce closes\n * over the handler it was created with, so a search firing after a re-render\n * would call a stale one — and these handlers close over filter state.\n */\n const latestOnSearch = useRef(onSearch);\n useEffect(() => {\n latestOnSearch.current = onSearch;\n }, [onSearch]);\n\n const debouncedRef = useRef<{ (val: string): void; cancel(): void } | null>(null);\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout> | null = null;\n const debounced = (val: string) => {\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(() => latestOnSearch.current(val), debounceDelay);\n };\n debounced.cancel = () => {\n if (timeout) clearTimeout(timeout);\n };\n debouncedRef.current = debounced;\n // Cancel on unmount, or a search fires into a component that is gone.\n return () => debounced.cancel();\n }, [debounceDelay]);\n\n // Mirror a controlled value. Deferred a tick so a parent that resets the\n // query while a debounce is in flight does not fight the field mid-keystroke.\n useEffect(() => {\n if (value === undefined) return;\n const timer = setTimeout(() => setInternalValue(value), 0);\n return () => clearTimeout(timer);\n }, [value]);\n\n /**\n * The first word again at the end, so the last-to-first step slides forward\n * like every other one instead of rewinding the whole list. The jump back to\n * the real first word then happens with the transition off, where it cannot\n * be seen.\n */\n const extendedWords = useMemo(\n () => (words.length === 0 ? [] : [...words, words[0]]),\n [words]\n );\n\n // A new word list restarts the carousel rather than leaving the index\n // pointing into a list that no longer has that many entries.\n useEffect(() => {\n const timer = setTimeout(() => {\n setWithTransition(false);\n setIndex(0);\n }, 0);\n return () => clearTimeout(timer);\n }, [words.length]);\n\n useEffect(() => {\n if (words.length === 0) return;\n const id = setInterval(() => {\n setWithTransition(true);\n setIndex((prev) => prev + 1);\n }, 2500);\n return () => clearInterval(id);\n }, [words.length]);\n\n // Landed on the duplicated first word: let it rest, then snap back to the\n // real one with the transition off.\n useEffect(() => {\n if (index !== words.length) return;\n const timer = setTimeout(() => {\n setWithTransition(false);\n setIndex(0);\n }, 2000);\n return () => clearTimeout(timer);\n }, [index, words.length]);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n setInternalValue(e.target.value);\n debouncedRef.current?.(e.target.value);\n };\n\n return (\n <div className={cn(\"relative\", className)}>\n {/* The rotating hint is an overlay, not the input's own `placeholder`,\n because a placeholder cannot animate. It is pointer-events-none so it\n never eats a click meant for the field, and it is dropped entirely\n once there is a value to avoid sitting behind the user's text. */}\n {!internalValue && words.length > 0 && (\n <div className=\"pointer-events-none absolute left-8 top-1/2 z-10 flex h-5 -translate-y-1/2 items-start gap-1 overflow-hidden text-xs text-muted-foreground\">\n <span className=\"h-5 shrink-0 leading-5\">Search by</span>\n <div\n style={{\n transform: `translateY(-${index * WORD_HEIGHT}px)`,\n transition: withTransition ? \"transform 2s cubic-bezier(0.4, 0, 0.2, 1)\" : \"none\",\n }}\n >\n {extendedWords.map((word, i) => (\n <div key={`${word}-${i}`} className=\"h-5 leading-5\">\n {word}\n </div>\n ))}\n </div>\n </div>\n )}\n\n <Search className=\"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n\n <Input\n type=\"text\"\n aria-label={ariaLabel}\n value={internalValue}\n placeholder=\"\"\n onChange={handleChange}\n className=\"!h-8 min-h-0 bg-muted/50 pl-8 text-xs\"\n />\n </div>\n );\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { GripVertical, RotateCcw } from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Separator } from \"./separator\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./tooltip\";\nimport { cn } from \"./utils\";\n\n/**\n * A column as the manager sees it: a key and something to call it in the list.\n * `label` is separate from the table's `header` because a header can be a node\n * (an icon, a tooltip, a two-line stack) and this list needs plain text.\n */\nexport interface ManagedColumn {\n key: string;\n label: string;\n}\n\nexport interface ColumnManagerProps {\n /** Every manageable column, in the table's *declared* order. */\n columns: ManagedColumn[];\n /** Current arrangement, as column keys. */\n order: string[];\n onOrderChange: (order: string[]) => void;\n /**\n * Column keys currently hidden. Omit — along with `onHiddenKeysChange` — to\n * drop the tick boxes entirely and keep this a reorder-only popover.\n */\n hiddenKeys?: string[];\n onHiddenKeysChange?: (hidden: string[]) => void;\n /**\n * Columns that cannot be **hidden**. Says nothing about where they sit — a\n * column the table cannot do without is still one the user may want to move.\n *\n * They keep a tick box rather than losing it, so the list reads as one set of\n * columns with some locked rather than as two lists — but the box is grey,\n * not primary, because nobody chose it.\n */\n fixedKeys?: string[];\n /**\n * Columns that cannot be **reordered**. Says nothing about whether they can\n * be hidden.\n *\n * The usual case is a frozen (sticky) column: its left offset is the running\n * total of the widths of the frozen columns before it, so the block only\n * works while they stay first and contiguous — drag one into the middle and\n * it keeps `left-0`, leaving a pinned column floating over the scrolling\n * ones. Hiding it is fine; that just shortens the block.\n *\n * A key can appear in both lists, and then neither control is offered.\n */\n pinnedKeys?: string[];\n /**\n * Why a fixed column cannot be hidden, shown on hover and focus. A disabled\n * control that stays silent leaves the user to guess whether they are doing\n * something wrong, so every caller should say something; the default is\n * deliberately generic so a missing one is still an answer.\n */\n fixedReason?: string;\n /**\n * Why a pinned column cannot be moved, shown on hover. Same reasoning as\n * `fixedReason`: a dead affordance should say why it is dead.\n */\n pinnedReason?: string;\n /**\n * Discards the saved arrangement so the table falls back to `columns`' own\n * order with nothing hidden. Separate from `onOrderChange` rather than\n * passing the default order through it, since \"no saved preference\" is its\n * own state in the caller, not just another arrangement.\n */\n onReset: () => void;\n /** Trigger label. Default \"Columns\". */\n label?: string;\n /** Render the trigger as an icon-only button — for a crowded toolbar. */\n iconOnly?: boolean;\n /** Extra classes on the trigger button. */\n className?: string;\n /** Popover alignment against the trigger. Default \"end\". */\n align?: \"start\" | \"center\" | \"end\";\n}\n\ninterface ColumnVisibility {\n checked: boolean;\n /** Locked on, with a reason. Renders grey rather than as an active choice. */\n lockedReason?: string;\n onToggle: () => void;\n}\n\n/**\n * One row of the list.\n *\n * `useSortable` hands back a transform for *every* row, not just the one under\n * the pointer — which is what makes the others slide out of the way as the\n * dragged row passes them, instead of the list snapping to a new order. The\n * transition it supplies drives that animation, so both go straight onto the\n * element's style.\n */\nfunction SortableColumnRow({\n id,\n label,\n visibility,\n pinned,\n pinnedReason,\n}: {\n id: string;\n label: string;\n visibility?: ColumnVisibility;\n /** A fixed column: it cannot be dragged, and nothing can be dropped on it. */\n pinned?: boolean;\n /** Why, for the cursor's tooltip and the accessible name. */\n pinnedReason?: string;\n}) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id,\n // Both halves matter. `draggable` is the request — a fixed column cannot be\n // picked up. `droppable` is what makes it actually stay put: without it the\n // row is still a valid drop target, so dragging any other row onto it\n // pushes it down and the \"fixed\" column has moved after all.\n disabled: pinned ? { draggable: true, droppable: true } : undefined,\n });\n\n const style = {\n // A pinned row takes no transform at all, so it holds its place while the\n // movable rows animate around it.\n transform: pinned ? undefined : CSS.Transform.toString(transform),\n transition: pinned ? undefined : transition,\n // Above its neighbours while moving, so it slides over them rather than\n // disappearing behind the next row's background.\n zIndex: isDragging ? 10 : undefined,\n };\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cn(\n \"flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] text-foreground\",\n isDragging && \"bg-muted opacity-90\",\n // No hover affordance on a pinned row: there is nothing to pick up.\n !isDragging && !pinned && \"hover:bg-muted/50\"\n )}\n >\n {/* The drag listeners live on the grip and the label, not the row, so the\n tick box stays clickable instead of being swallowed by a drag.\n\n A pinned row gets neither listeners nor the grab cursor. The grip\n still renders, dimmed: dropping it would reflow the labels out of\n line with every other row, and a row with no grip at all reads as a\n different kind of thing rather than as this one, locked. */}\n {pinned ? (\n <span\n title={pinnedReason}\n aria-label={`${label} column is fixed in place`}\n className=\"flex min-w-0 flex-1 cursor-not-allowed items-center gap-2\"\n >\n <GripVertical className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground/30\" />\n {/* The label keeps its normal colour even here. Only the grip dims:\n greying the text would read as \"this row is disabled\", which is\n wrong when its tick box is live. */}\n <span className=\"truncate\">{label}</span>\n </span>\n ) : (\n <span\n className=\"flex min-w-0 flex-1 cursor-grab items-center gap-2 active:cursor-grabbing\"\n {...attributes}\n {...listeners}\n >\n <GripVertical className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate\">{label}</span>\n </span>\n )}\n\n {visibility &&\n (visibility.lockedReason ? (\n /**\n * A locked column renders grey, not the primary blue a live tick\n * uses: blue says \"you chose this\", and nobody chose this. The\n * tooltip hangs off a wrapping span rather than the Checkbox, because\n * a disabled control receives no pointer events and a trigger on the\n * box itself would never fire. The span also carries the not-allowed\n * cursor and is focusable, so the reason is reachable by keyboard as\n * well as hover.\n */\n <TooltipProvider delayDuration={150}>\n <Tooltip>\n <TooltipTrigger asChild>\n <span tabIndex={0} className=\"shrink-0 cursor-not-allowed rounded-sm\">\n <Checkbox\n checked\n disabled\n aria-label={`${label} column is always shown`}\n className=\"pointer-events-none border-border opacity-100 data-[state=checked]:border-border data-[state=checked]:bg-muted-foreground/40 data-[state=checked]:text-foreground/70\"\n />\n </span>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-[15rem]\">{visibility.lockedReason}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n <Checkbox\n checked={visibility.checked}\n onCheckedChange={visibility.onToggle}\n aria-label={`Show ${label} column`}\n className=\"shrink-0\"\n />\n ))}\n </div>\n );\n}\n\n/**\n * Column manager: drag to reorder, tick to show or hide, with locked columns\n * and a reset. One implementation for every grid in every app, so a merchant\n * and an internal operator arrange their columns the same way.\n *\n * Reordering is @dnd-kit, the same stack the dashboard's widget grid uses, so\n * the rows animate out of each other's way as one is dragged past them. A\n * hand-rolled pointer drag can reorder the list correctly and still feel wrong:\n * without a per-row transform the rows simply teleport into their new slots,\n * and there is nothing to follow.\n *\n * dnd-kit is `external` in the build rather than bundled, because both\n * consuming apps already depend on it — two copies of `DndContext` in one app\n * is the kind of thing that breaks only in the app, never in the library.\n *\n * Keyboard users reorder without a mouse at all: Space picks a row up, the\n * arrows move it, Space drops it, Escape abandons it, and dnd-kit announces\n * each step as it goes.\n */\nexport function ColumnManager({\n columns,\n order,\n onOrderChange,\n hiddenKeys,\n onHiddenKeysChange,\n fixedKeys = [],\n pinnedKeys = [],\n fixedReason = \"Always shown. The table needs this column to make sense.\",\n pinnedReason = \"Fixed in place. This column stays frozen at the left of the table.\",\n onReset,\n label = \"Columns\",\n iconOnly = false,\n className,\n align = \"end\",\n}: ColumnManagerProps) {\n const canToggleVisibility = !!hiddenKeys && !!onHiddenKeysChange;\n const hidden = useMemo(() => hiddenKeys ?? [], [hiddenKeys]);\n\n /**\n * Every key that cannot move — `pinnedKeys` and nothing else.\n *\n * Visibility and position are independent, and deliberately not inferred from\n * one another: a column the table cannot do without is very often one the\n * user is still free to put wherever they like (a transaction id), and a\n * column frozen to the left edge is very often one they are free to hide\n * (a merchant id on a single-merchant view). Folding either into the other\n * takes away a control for no reason the user can see.\n */\n const immovable = pinnedKeys;\n\n const byKey = useMemo(() => new Map(columns.map((c) => [c.key, c])), [columns]);\n /** The arrangement to draw: saved order, minus keys the table no longer has. */\n const ordered = useMemo(\n () => order.map((k) => byKey.get(k)).filter((c): c is ManagedColumn => !!c),\n [order, byKey]\n );\n\n /**\n * `columns` arrives in the caller's declared order with nothing hidden, which\n * is exactly what resetting falls back to — so comparing against it tells us\n * whether there is a custom arrangement to reset at all.\n */\n const isCustomised =\n order.join(\"|\") !== columns.map((c) => c.key).join(\"|\") || hidden.length > 0;\n\n const toggleVisibility = (key: string) => {\n if (!onHiddenKeysChange || fixedKeys.includes(key)) return;\n onHiddenKeysChange(\n hidden.includes(key) ? hidden.filter((k) => k !== key) : [...hidden, key]\n );\n };\n\n /**\n * Drag sensors. The 4px activation distance is what keeps a *click* on the\n * grip from registering as a drag, so tapping a row does nothing rather than\n * nudging the order by a pixel.\n *\n * The keyboard sensor is the reason reordering is reachable without a mouse\n * at all: Space picks a row up, the arrows move it, Space drops it, Escape\n * abandons it — and dnd-kit announces each step to screen readers as it goes.\n */\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })\n );\n\n /** The keys that can actually move, in their current order. */\n const movableKeys = useMemo(\n () => order.filter((k) => !immovable.includes(k)),\n [order, immovable]\n );\n\n /**\n * Reorders within the movable keys only, then puts them back around the fixed\n * ones, which keep their exact indices.\n *\n * A plain `arrayMove` over the whole list would not do: moving the last row to\n * the top shifts every key below it by one, fixed keys included — so a column\n * nobody is allowed to drag ends up somewhere new anyway. This moves the\n * dragged key through the movable slots and leaves the fixed slots alone.\n */\n const onDragEnd = (e: DragEndEvent) => {\n const { active, over } = e;\n if (!over || active.id === over.id) return;\n\n const from = movableKeys.indexOf(active.id as string);\n const to = movableKeys.indexOf(over.id as string);\n if (from === -1 || to === -1) return;\n\n const moved = arrayMove(movableKeys, from, to);\n let next = 0;\n onOrderChange(order.map((key) => (immovable.includes(key) ? key : moved[next++])));\n };\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label={iconOnly ? label : undefined}\n // The same grip glyph the draggable rows inside use, so the button\n // names the gesture it opens.\n leftIcon={<GripVertical className=\"h-3.5 w-3.5\" />}\n className={cn(\n // Compact by default so it sits level with filter chips rather than\n // towering over them at Button's own `sm` height.\n \"h-auto min-h-0 shrink-0 py-1 text-muted-foreground hover:text-foreground\",\n className\n )}\n >\n {iconOnly ? null : label}\n </Button>\n </PopoverTrigger>\n\n {/* Bounded by the room Radix measures between the trigger and the\n viewport edge, not by a pixel cap: a grid with thirty columns used to\n render thirty rows in one tall popover, and the last of them — along\n with Reset — fell below the fold with no way to reach them. The hint\n line and the Reset footer stay put; only the list scrolls. */}\n <PopoverContent\n align={align}\n className=\"flex max-h-[var(--radix-popover-content-available-height)] w-56 flex-col overflow-hidden p-2\"\n >\n <p className=\"shrink-0 px-2 pb-1.5 text-[11px] font-medium text-muted-foreground\">\n {canToggleVisibility ? \"Drag to reorder · tick to show\" : \"Drag to reorder\"}\n </p>\n\n <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={onDragEnd}>\n {/* Only the movable keys are sortable; a fixed one is neither a\n drag source nor a drop target. */}\n <SortableContext items={movableKeys} strategy={verticalListSortingStrategy}>\n <div className=\"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto\">\n {ordered.map((col) => (\n <SortableColumnRow\n key={col.key}\n id={col.key}\n label={col.label}\n pinned={immovable.includes(col.key)}\n pinnedReason={pinnedReason}\n visibility={\n canToggleVisibility\n ? {\n checked: !hidden.includes(col.key),\n // A fixed column keeps a box rather than having none,\n // so the list reads as one set of columns with some\n // locked, not two lists.\n lockedReason: fixedKeys.includes(col.key) ? fixedReason : undefined,\n onToggle: () => toggleVisibility(col.key),\n }\n : undefined\n }\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n\n {/* Secondary action, divided off from the list so it reads as an escape\n hatch rather than another draggable row. */}\n <Separator className=\"my-2 shrink-0\" />\n {isCustomised ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n leftIcon={<RotateCcw className=\"h-3 w-3\" />}\n onClick={onReset}\n className=\"w-full justify-start text-muted-foreground hover:text-foreground\"\n >\n Reset to defaults\n </Button>\n ) : (\n /* Nothing to undo. A disabled button here would offer an action and\n then refuse it; saying the columns already are the default answers\n the question the button was raising. */\n <p className=\"px-2 py-1.5 text-[12px] text-muted-foreground\">\n Columns are in their default order.\n </p>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Preferences ─────────────────────────────────────────────────────────────\n\nexport interface ColumnPreferences {\n order: string[];\n hidden: string[];\n}\n\nexport interface UseColumnPreferencesOptions {\n /**\n * `localStorage` key. Omit and the arrangement lives only for the session —\n * which is what a grid whose columns depend on the signed-in user's role\n * wants, since a saved order from another role would resurrect columns that\n * no longer exist.\n */\n storageKey?: string;\n}\n\nexport interface UseColumnPreferencesResult extends ColumnPreferences {\n setOrder: (order: string[]) => void;\n setHidden: (hidden: string[]) => void;\n reset: () => void;\n /** Spread straight onto `<ColumnManager>`. */\n managerProps: Pick<\n ColumnManagerProps,\n \"order\" | \"onOrderChange\" | \"hiddenKeys\" | \"onHiddenKeysChange\" | \"onReset\"\n >;\n}\n\n/**\n * Owns a grid's column arrangement, optionally persisted.\n *\n * `defaultOrder` is the source of truth for which columns exist: a stored order\n * is reconciled against it on every read, so a column added in a release shows\n * up for someone who saved an arrangement before it existed, and a removed one\n * disappears instead of leaving a hole.\n */\nexport function useColumnPreferences(\n defaultOrder: string[],\n { storageKey }: UseColumnPreferencesOptions = {}\n): UseColumnPreferencesResult {\n const defaultKey = defaultOrder.join(\"|\");\n\n const [prefs, setPrefs] = useState<ColumnPreferences>({ order: defaultOrder, hidden: [] });\n\n /**\n * Read in an effect rather than a lazy initialiser: this package renders on\n * the server too, and reading `localStorage` during the first render would\n * make the server and client trees disagree.\n */\n useEffect(() => {\n if (!storageKey || typeof window === \"undefined\") return;\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (!raw) return;\n const saved = JSON.parse(raw) as Partial<ColumnPreferences>;\n const savedOrder = Array.isArray(saved.order) ? saved.order : [];\n const savedHidden = Array.isArray(saved.hidden) ? saved.hidden : [];\n const known = new Set(defaultOrder);\n setPrefs({\n // Keep the saved arrangement for columns that still exist, then append\n // anything new in its declared position at the end.\n order: [\n ...savedOrder.filter((k) => known.has(k)),\n ...defaultOrder.filter((k) => !savedOrder.includes(k)),\n ],\n hidden: savedHidden.filter((k) => known.has(k)),\n });\n } catch {\n // Corrupt or unreadable storage (private mode, a bad hand-edit) is not\n // worth breaking a table over — the default arrangement is a fine answer.\n }\n // `defaultKey` rather than `defaultOrder`: a column list rebuilt on every\n // render is a new array each time, which would re-read storage forever.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [storageKey, defaultKey]);\n\n const persist = useCallback(\n (next: ColumnPreferences) => {\n setPrefs(next);\n if (!storageKey || typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(next));\n } catch {\n // Storage full or blocked. The arrangement still applies this session.\n }\n },\n [storageKey]\n );\n\n const setOrder = useCallback(\n (order: string[]) => persist({ order, hidden: prefs.hidden }),\n [persist, prefs.hidden]\n );\n const setHidden = useCallback(\n (hidden: string[]) => persist({ order: prefs.order, hidden }),\n [persist, prefs.order]\n );\n const reset = useCallback(() => {\n setPrefs({ order: defaultOrder, hidden: [] });\n if (!storageKey || typeof window === \"undefined\") return;\n try {\n window.localStorage.removeItem(storageKey);\n } catch {\n // See persist().\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [storageKey, defaultKey]);\n\n return {\n order: prefs.order,\n hidden: prefs.hidden,\n setOrder,\n setHidden,\n reset,\n managerProps: {\n order: prefs.order,\n onOrderChange: setOrder,\n hiddenKeys: prefs.hidden,\n onHiddenKeysChange: setHidden,\n onReset: reset,\n },\n };\n}\n\n/**\n * Applies a saved arrangement to a built column list.\n *\n * `pinnedKeys` stay where they are declared regardless of the saved order —\n * for the trailing \"action\" column, which is a utility, not a data field\n * anybody wants to move. Columns missing from `order` (a field that only\n * exists for some roles, say) are appended before them rather than dropped.\n */\nexport function applyColumnPreferences<T extends { key: string }>(\n columns: T[],\n { order, hidden }: Partial<ColumnPreferences> = {},\n pinnedKeys: string[] = [\"action\"]\n): T[] {\n const pinned = columns.filter((c) => pinnedKeys.includes(c.key));\n const movable = columns.filter((c) => !pinnedKeys.includes(c.key));\n\n const arranged = order?.length\n ? (() => {\n const byKey = new Map(movable.map((c) => [c.key, c]));\n const seen = order.map((k) => byKey.get(k)).filter((c): c is T => !!c);\n const missing = movable.filter((c) => !order.includes(c.key));\n return [...seen, ...missing];\n })()\n : movable;\n\n const visible = hidden?.length\n ? arranged.filter((c) => !hidden.includes(c.key))\n : arranged;\n\n return [...visible, ...pinned];\n}\n","import type { ReactNode } from \"react\";\nimport { cn } from \"./utils\";\n\ninterface PageHeaderProps {\n title: ReactNode;\n /** When title is non-plain text (e.g. includes a flag), set for screen readers. */\n titleAriaLabel?: string;\n subtitle?: string;\n actions?: ReactNode;\n className?: string;\n}\n\nexport function PageHeader({ title, titleAriaLabel, subtitle, actions, className }: PageHeaderProps) {\n return (\n <div className={cn(\"flex items-start justify-between mb-6\", className)}>\n <div>\n <h1\n className=\"text-xl font-semibold text-foreground tracking-tight flex items-center gap-2.5 flex-wrap\"\n {...(titleAriaLabel ? { \"aria-label\": titleAriaLabel } : {})}\n >\n {title}\n </h1>\n {subtitle && <p className=\"text-sm text-muted-foreground mt-0.5\">{subtitle}</p>}\n </div>\n {actions && <div className=\"flex items-center gap-2\">{actions}</div>}\n </div>\n );\n}\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { forwardRef, type HTMLAttributes, useState, useCallback } from \"react\";\nimport { Check, Copy } from \"lucide-react\";\n\n// ---------------------------------------------------------------------------\n// Code – inline\n// ---------------------------------------------------------------------------\n\nexport type CodeProps = HTMLAttributes<HTMLElement>;\n\nexport const Code = forwardRef<HTMLElement, CodeProps>(\n ({ className, children, ...props }, ref) => {\n return (\n <code\n ref={ref}\n className={cn(\n \"rounded-md bg-muted px-1.5 py-0.5 font-mono text-[13px] text-foreground ring-1 ring-border\",\n className\n )}\n {...props}\n >\n {children}\n </code>\n );\n }\n);\nCode.displayName = \"Code\";\n\n// ---------------------------------------------------------------------------\n// CodeBlock – multi-line\n// ---------------------------------------------------------------------------\n\nexport interface CodeBlockProps extends HTMLAttributes<HTMLDivElement> {\n /** The raw code string to display and optionally copy. */\n code: string;\n /** Optional filename shown in the header. */\n filename?: string;\n /** Optional language label shown as a badge in the header. */\n language?: string;\n /** Hide the copy button. Defaults to false. */\n hideCopy?: boolean;\n /**\n * Wrap long lines instead of scrolling them sideways.\n *\n * Worth turning on wherever the code is something to read and copy rather\n * than to study — a snippet in a dialog, say, where a horizontal scrollbar\n * hides the end of the only line that matters and no one thinks to drag it.\n * Leave it off for real source, where wrapping would break the indentation\n * that carries the structure.\n */\n wrap?: boolean;\n}\n\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(\n (\n {\n code,\n filename,\n language,\n hideCopy = false,\n wrap = false,\n className,\n ...props\n },\n ref\n ) => {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n const timer = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timer);\n } catch {\n // Clipboard access denied — fail silently.\n }\n }, [code]);\n\n const hasHeader = Boolean(filename || language);\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative overflow-hidden bg-[#0f1117] text-[#e5e7eb]\",\n hasHeader ? \"rounded-xl\" : \"rounded-xl\",\n className\n )}\n {...props}\n >\n {/* Header */}\n {hasHeader && (\n <div className=\"flex items-center justify-between bg-[#1a1f2e] px-4 py-2 border-b border-[#2a3441]\">\n <div className=\"flex items-center gap-2.5\">\n {filename && (\n <span className=\"text-[#9ca3af] text-xs font-mono\">\n {filename}\n </span>\n )}\n {language && (\n <span className=\"rounded-md bg-[#2a3441] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[#6b7280]\">\n {language}\n </span>\n )}\n </div>\n {!hideCopy && (\n <CopyButton copied={copied} onClick={handleCopy} inHeader />\n )}\n </div>\n )}\n\n {/* Code area */}\n <div className=\"relative\">\n <pre\n className={cn(\n \"p-4 font-mono text-[13px] leading-relaxed\",\n wrap ? \"whitespace-pre-wrap break-words\" : \"overflow-x-auto\",\n // Room for the floating copy button, which a wrapped line would\n // otherwise run underneath. Only when wrapping: a scrolling block\n // is unchanged from before this prop existed.\n wrap && !hasHeader && !hideCopy && \"pr-12\"\n )}\n >\n <code>{code}</code>\n </pre>\n\n {/* Copy button (no header case) */}\n {!hasHeader && !hideCopy && (\n <div className=\"absolute top-3 right-3\">\n <CopyButton copied={copied} onClick={handleCopy} />\n </div>\n )}\n </div>\n </div>\n );\n }\n);\nCodeBlock.displayName = \"CodeBlock\";\n\n// ---------------------------------------------------------------------------\n// Internal: CopyButton\n// ---------------------------------------------------------------------------\n\ninterface CopyButtonProps {\n copied: boolean;\n onClick: () => void;\n inHeader?: boolean;\n}\n\nfunction CopyButton({ copied, onClick, inHeader = false }: CopyButtonProps) {\n return (\n <button\n type=\"button\"\n aria-label={copied ? \"Copied\" : \"Copy code\"}\n onClick={onClick}\n className={cn(\n \"inline-flex items-center justify-center rounded-md transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n inHeader\n ? \"size-6 text-[#6b7280] hover:bg-[#2a3441] hover:text-[#9ca3af]\"\n : \"size-7 bg-[#1a1f2e]/80 text-[#6b7280] hover:bg-[#1a1f2e] hover:text-[#9ca3af]\"\n )}\n >\n {copied ? (\n <Check className=\"size-3.5 text-green-400\" />\n ) : (\n <Copy className=\"size-3.5\" />\n )}\n </button>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cn } from \"./utils\";\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(\"relative flex h-9 w-9 shrink-0 overflow-hidden rounded-full border border-border bg-muted\", className)}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image ref={ref} className={cn(\"aspect-square h-full w-full object-cover\", className)} {...props} />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\"flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground\", className)}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\nimport { Avatar, AvatarImage, AvatarFallback } from \"./avatar\";\n\nexport interface AvatarGroupItem {\n src?: string;\n fallback: string;\n alt?: string;\n}\n\nexport interface AvatarGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n avatars: AvatarGroupItem[];\n max?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nconst sizeClasses: Record<NonNullable<AvatarGroupProps[\"size\"]>, string> = {\n sm: \"h-6 w-6\",\n md: \"h-8 w-8\",\n lg: \"h-10 w-10\",\n};\n\nconst fontSizeClasses: Record<NonNullable<AvatarGroupProps[\"size\"]>, string> = {\n sm: \"text-[10px]\",\n md: \"text-xs\",\n lg: \"text-xs\",\n};\n\nconst overlapClasses: Record<NonNullable<AvatarGroupProps[\"size\"]>, string> = {\n sm: \"-ml-2\",\n md: \"-ml-2\",\n lg: \"-ml-2\",\n};\n\nconst AvatarGroup = React.forwardRef<HTMLDivElement, AvatarGroupProps>(\n ({ avatars, max = 4, size = \"md\", className, ...props }, ref) => {\n const visible = avatars.slice(0, max);\n const overflowCount = avatars.length - max;\n const totalSlots = visible.length + (overflowCount > 0 ? 1 : 0);\n\n return (\n <div\n ref={ref}\n className={cn(\"flex items-center\", className)}\n {...props}\n >\n {visible.map((avatar, index) => {\n const zIndex = totalSlots - index;\n return (\n <Avatar\n key={index}\n className={cn(\n sizeClasses[size],\n overlapClasses[size],\n \"ring-2 ring-background border border-border shrink-0 transition-[margin] duration-[var(--duration-pg-fast,150ms)] ease-[var(--ease-pg-standard,cubic-bezier(0.4,0,0.2,1))] first:ml-0\",\n )}\n style={{ zIndex }}\n >\n {avatar.src && (\n <AvatarImage src={avatar.src} alt={avatar.alt ?? avatar.fallback} />\n )}\n <AvatarFallback\n className={cn(\n fontSizeClasses[size],\n \"font-medium\",\n )}\n >\n {avatar.fallback}\n </AvatarFallback>\n </Avatar>\n );\n })}\n\n {overflowCount > 0 && (\n <div\n className={cn(\n sizeClasses[size],\n overlapClasses[size],\n fontSizeClasses[size],\n \"relative shrink-0 flex items-center justify-center rounded-full border border-border bg-muted text-muted-foreground font-medium ring-2 ring-background transition-[margin] duration-[var(--duration-pg-fast,150ms)] ease-[var(--ease-pg-standard,cubic-bezier(0.4,0,0.2,1))]\",\n )}\n style={{ zIndex: 0 }}\n >\n +{overflowCount}\n </div>\n )}\n </div>\n );\n }\n);\n\nAvatarGroup.displayName = \"AvatarGroup\";\n\nexport { AvatarGroup };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type AvatarTagSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface AvatarTagProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Display label for the tag */\n label: string;\n /** Optional image src for the avatar */\n src?: string;\n /** Alt text for the avatar image */\n alt?: string;\n /** Size variant */\n size?: AvatarTagSize;\n /** Called when the remove button is clicked */\n onRemove?: () => void;\n /** Disables interaction */\n disabled?: boolean;\n}\n\nfunction getInitials(label: string): string {\n const words = label.trim().split(/\\s+/);\n if (words.length === 1) {\n return words[0].slice(0, 2).toUpperCase();\n }\n return (words[0][0] + words[words.length - 1][0]).toUpperCase();\n}\n\nconst sizeConfig: Record<\n AvatarTagSize,\n { avatar: string; text: string; icon: string; padding: string }\n> = {\n sm: {\n avatar: \"h-[18px] w-[18px]\",\n text: \"text-[10px]\",\n icon: \"size-2.5\",\n padding: \"px-1.5 py-0.5 gap-1\",\n },\n md: {\n avatar: \"h-5 w-5\",\n text: \"text-xs\",\n icon: \"size-3\",\n padding: \"px-2 py-0.5 gap-1\",\n },\n lg: {\n avatar: \"h-6 w-6\",\n text: \"text-sm\",\n icon: \"size-3.5\",\n padding: \"px-2.5 py-1 gap-1.5\",\n },\n};\n\nconst AvatarTag = React.forwardRef<HTMLSpanElement, AvatarTagProps>(\n (\n {\n label,\n src,\n alt,\n size = \"md\",\n onRemove,\n disabled = false,\n className,\n ...props\n },\n ref\n ) => {\n const cfg = sizeConfig[size];\n const initials = getInitials(label);\n\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center rounded-full border border-border bg-card font-medium transition-colors duration-[var(--duration-pg-fast,150ms)] ease-[var(--ease-pg-standard,cubic-bezier(0.4,0,0.2,1))]\",\n cfg.padding,\n cfg.text,\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {/* Avatar */}\n <AvatarPrimitive.Root\n className={cn(\n \"relative shrink-0 overflow-hidden rounded-full\",\n cfg.avatar\n )}\n >\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? label}\n className=\"aspect-square h-full w-full object-cover\"\n />\n <AvatarPrimitive.Fallback\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-primary/10 text-primary font-semibold leading-none\",\n cfg.text\n )}\n >\n {initials}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n\n {/* Label */}\n <span className=\"leading-none select-none\">{label}</span>\n\n {/* Remove button */}\n {onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n if (!disabled) onRemove();\n }}\n disabled={disabled}\n className={cn(\n \"flex items-center justify-center rounded-full opacity-60 transition-opacity duration-[var(--duration-pg-fast,150ms)] hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n disabled && \"pointer-events-none\"\n )}\n aria-label={`Remove ${label}`}\n >\n <X className={cfg.icon} />\n </button>\n )}\n </span>\n );\n }\n);\n\nAvatarTag.displayName = \"AvatarTag\";\n\nexport { AvatarTag };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButtonProps,\n type DayPickerProps,\n} from \"react-day-picker\";\n\nimport { Button } from \"./button\";\nimport type { ButtonProps } from \"./button\";\nimport { cn } from \"./utils\";\n\nconst cellSize = \"[--cell-size:2rem]\";\n\nfunction navButtonClasses(variant: NonNullable<ButtonProps[\"variant\"]>): string {\n const base =\n \"inline-flex items-center justify-center rounded-lg border font-medium transition-colors duration-pg-fast ease-pg-standard focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 disabled:pointer-events-none disabled:opacity-50\";\n switch (variant) {\n case \"outline\":\n return cn(\n base,\n \"border-border bg-card text-foreground shadow-sm hover:bg-muted\"\n );\n case \"ghost\":\n default:\n return cn(\n base,\n \"border-transparent bg-transparent text-foreground hover:bg-muted focus-visible:bg-muted/80 active:bg-muted/90\"\n );\n }\n}\n\nexport type CalendarProps = DayPickerProps & {\n buttonVariant?: ButtonProps[\"variant\"];\n};\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale,\n formatters,\n components,\n showWeekNumber,\n ...props\n}: CalendarProps) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n showWeekNumber={showWeekNumber}\n locale={locale}\n className={cn(\n \"group/calendar bg-background p-3\",\n cellSize,\n \"[[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent\",\n String.raw`rtl:**:[.rdp-button_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button_previous>svg]:rotate-180`,\n className\n )}\n captionLayout={captionLayout}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(locale?.code ?? \"default\", { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n nav: cn(\n \"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n navButtonClasses(buttonVariant),\n \"h-[var(--cell-size)] w-[var(--cell-size)] min-h-0 min-w-0 shrink-0 p-0 select-none\",\n defaultClassNames.button_previous\n ),\n button_next: cn(\n navButtonClasses(buttonVariant),\n \"h-[var(--cell-size)] w-[var(--cell-size)] min-h-0 min-w-0 shrink-0 p-0 select-none\",\n defaultClassNames.button_next\n ),\n month_caption: cn(\n \"flex h-[var(--cell-size)] w-full items-center justify-center px-[var(--cell-size)]\",\n defaultClassNames.month_caption\n ),\n dropdowns: cn(\n \"flex h-[var(--cell-size)] w-full items-center justify-center gap-1.5 text-sm font-medium\",\n defaultClassNames.dropdowns\n ),\n dropdown_root: cn(\n \"relative rounded-md border border-border bg-card shadow-sm focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/35\",\n defaultClassNames.dropdown_root\n ),\n dropdown: cn(\"absolute inset-0 cursor-pointer opacity-0\", defaultClassNames.dropdown),\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n month_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n \"flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none\",\n defaultClassNames.weekday\n ),\n week: cn(\"mt-2 flex w-full\", defaultClassNames.week),\n week_number_header: cn(\n \"w-[var(--cell-size)] select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\n day: cn(\n \"group/day relative aspect-square h-full w-full p-0 text-center select-none\",\n \"[&:last-child[data-selected=true]_button]:rounded-r-md\",\n showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-md\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"rounded-l-md bg-accent\",\n defaultClassNames.range_start\n ),\n range_middle: cn(\"rounded-none bg-accent/60\", defaultClassNames.range_middle),\n range_end: cn(\"rounded-r-md bg-accent\", defaultClassNames.range_end),\n today: cn(\n \"rounded-md bg-muted text-foreground data-[selected=true]:rounded-none\",\n defaultClassNames.today\n ),\n outside: cn(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\"text-muted-foreground opacity-50\", defaultClassNames.disabled),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className: rootClass, rootRef, ...rootProps }) => (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(rootClass)}\n {...rootProps}\n />\n ),\n Chevron: ({ className: chClass, orientation, ...chProps }) => {\n if (orientation === \"left\") {\n return <ChevronLeft className={cn(\"size-4\", chClass)} {...chProps} />;\n }\n if (orientation === \"right\") {\n return <ChevronRight className={cn(\"size-4\", chClass)} {...chProps} />;\n }\n return <ChevronDown className={cn(\"size-4\", chClass)} {...chProps} />;\n },\n DayButton: CalendarDayButton,\n WeekNumber: ({ children, ...weekProps }) => (\n <th {...weekProps}>\n <div className=\"flex h-[var(--cell-size)] w-[var(--cell-size)] min-h-[var(--cell-size)] min-w-[var(--cell-size)] items-center justify-center text-center text-xs tabular-nums\">\n {children}\n </div>\n </th>\n ),\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n ...props\n}: DayButtonProps) {\n const defaultClassNames = getDefaultClassNames();\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n type=\"button\"\n variant=\"ghost\"\n {...props}\n disabled={Boolean(modifiers.disabled) || props.disabled}\n data-day={day.date.toLocaleDateString()}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n \"flex aspect-square h-auto min-h-[var(--cell-size)] w-full min-w-[var(--cell-size)] flex-col gap-1 rounded-md p-0 font-normal leading-none data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground hover:bg-muted/80 dark:hover:bg-muted/50 [&>span]:text-xs [&>span]:opacity-70\",\n \"group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/35\",\n defaultClassNames.day,\n className\n )}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n","\"use client\";\n\nimport { useState, useRef, useEffect, useMemo, useCallback } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { ChevronLeft, ChevronRight, ChevronDown, CalendarDays } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { cn } from \"./utils\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\n/* ─── Constants ─────────────────────────────────────────────────────────── */\nconst MONTHS = [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\"];\nconst DAYS = [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"];\nconst PRIMARY = \"#0061E3\";\n\n/** Width of the calendar half. The time columns are added to it. */\nconst CALENDAR_W = 296;\nconst TIME_COL_W = 58;\n/** One row in a time column. */\nconst TIME_ITEM_H = 28;\n/** Visible height of a time column, sized to sit flush with the day grid. */\nconst TIME_COL_H = 232;\n\n/* ─── Helpers ────────────────────────────────────────────────────────────── */\nfunction daysInMonth(y: number, m: number) { return new Date(y, m + 1, 0).getDate(); }\nfunction firstDayOf(y: number, m: number) { return new Date(y, m, 1).getDay(); }\nfunction pad(n: number) { return String(n).padStart(2, \"0\"); }\n\n/**\n * A parsed picker value. `hh`/`mm`/`ss` are the 24-hour clock, and are 0 for a\n * date-only value — a value carrying no time is \"midnight\", the same reading\n * antd gives it.\n */\ninterface Parts { y: number; m: number; d: number; hh: number; mm: number; ss: number }\n\n/**\n * Accepts `YYYY-MM-DD`, `YYYY-MM-DD HH:mm` and `YYYY-MM-DD HH:mm:ss`, so a\n * picker switched to `showTime` still reads back a value written before it was,\n * and `min`/`max` can be given as plain dates whatever the value carries.\n */\nfunction parseValue(s: string): Parts | null {\n if (!s) return null;\n const [datePart, timePart = \"\"] = s.trim().split(/[ T]/);\n const [y, m, d] = datePart.split(\"-\").map(Number);\n if (!y || !m || !d) return null;\n const [hh = 0, mm = 0, ss = 0] = timePart ? timePart.split(\":\").map(Number) : [];\n return {\n y,\n m: m - 1,\n d,\n hh: Number.isFinite(hh) ? hh : 0,\n mm: Number.isFinite(mm) ? mm : 0,\n ss: Number.isFinite(ss) ? ss : 0,\n };\n}\n\n/** Kept as the old name so nothing that imported it has to change. */\nfunction parseYMD(s: string) {\n const p = parseValue(s);\n return p ? { y: p.y, m: p.m, d: p.d } : null;\n}\n\nfunction toYMD(y: number, m: number, d: number) {\n return `${y}-${pad(m + 1)}-${pad(d)}`;\n}\n\n/**\n * The string this picker emits. Date-only unless a time is being shown, so a\n * picker without `showTime` keeps emitting exactly what it always did.\n */\nfunction formatValue(p: Parts, showTime: boolean, showSecond: boolean) {\n const date = toYMD(p.y, p.m, p.d);\n if (!showTime) return date;\n return showSecond\n ? `${date} ${pad(p.hh)}:${pad(p.mm)}:${pad(p.ss)}`\n : `${date} ${pad(p.hh)}:${pad(p.mm)}`;\n}\n\n/** 12-hour, to match every other timestamp flux renders. */\nfunction displayTime(p: Parts, showSecond: boolean) {\n const period = p.hh < 12 ? \"AM\" : \"PM\";\n const h12 = p.hh % 12 === 0 ? 12 : p.hh % 12;\n const base = showSecond\n ? `${pad(h12)}:${pad(p.mm)}:${pad(p.ss)}`\n : `${pad(h12)}:${pad(p.mm)}`;\n return `${base} ${period}`;\n}\n\nfunction displayValue(value: string, showTime: boolean, showSecond: boolean) {\n const p = parseValue(value);\n if (!p) return \"\";\n const date = `${pad(p.d)} ${MONTHS[p.m].slice(0, 3)} ${p.y}`;\n return showTime ? `${date}, ${displayTime(p, showSecond)}` : date;\n}\n\n/** `1`, or a step floored to at least 1 — a step of 0 would loop forever. */\nfunction step(n: number | undefined) {\n return Math.max(1, Math.floor(n ?? 1));\n}\n\n/* ─── Props ─────────────────────────────────────────────────────────────── */\n\n/**\n * `showTime`'s options, following antd's prop of the same name.\n *\n * Two defaults differ from antd's, both because of what flux renders elsewhere:\n * `use12Hours` is **on** (antd defaults it off) because `formatDateTime` prints\n * every timestamp in this library with `hour12`, and entering \"23:55\" to read it\n * back as \"11:55 PM\" is the mismatch that makes a reviewer check a row twice;\n * and `showSecond` is **off** (antd defaults it on) because nothing in flux\n * records a second.\n */\nexport interface DatePickerTimeOptions {\n /** Hour column is 12-hour with an AM/PM column beside it. Default `true`. */\n use12Hours?: boolean;\n /** Add a seconds column, and put seconds in the emitted value. Default `false`. */\n showSecond?: boolean;\n hourStep?: number;\n minuteStep?: number;\n secondStep?: number;\n /** `HH:mm[:ss]` used when a day is picked before any time. Default `\"00:00\"`. */\n defaultValue?: string;\n}\n\ninterface DatePickerProps {\n /**\n * `YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` (`HH:mm:ss` with `showSecond`) when\n * `showTime` is set — the same widening antd does to its value when a time is\n * shown.\n */\n value: string;\n onChange: (v: string) => void;\n placeholder?: string;\n className?: string;\n /** Earliest selectable date, `YYYY-MM-DD`. Days before it are struck out. */\n min?: string;\n /**\n * Latest selectable date, `YYYY-MM-DD`.\n *\n * Its absence is why a feature ended up hand-rolling a whole date chip to\n * enforce an upper bound on Apply instead — an error after the fact, where\n * the calendar could have said so before the click.\n */\n max?: string;\n label?: string;\n /**\n * Put time columns beside the calendar, so a day and the time on it are one\n * control rather than two fields that can disagree.\n *\n * Follows antd: the panel gains Hr / Min (/ Sec) (/ AM-PM) columns and a\n * footer, picking a day no longer closes the panel, and **OK** is what\n * commits. `onChange` still fires on every edit — OK closes, it does not\n * gate the value — so a controlled caller sees each change as it happens.\n */\n showTime?: boolean | DatePickerTimeOptions;\n /**\n * antd's `showNow`: the \"Now\" shortcut in the footer. Default `true` when a\n * time is shown, and ignored otherwise.\n */\n showNow?: boolean;\n}\n\n/* ─── Time column ────────────────────────────────────────────────────────── */\n\n/**\n * One scrollable unit column.\n *\n * The selected row is scrolled to the **top** rather than centred, which is\n * antd's behaviour and the reason each column is padded underneath: without the\n * padding the last few values can never reach the top and look unreachable.\n */\nfunction TimeColumn<T extends string | number>({\n label,\n items,\n selected,\n onSelect,\n render,\n}: {\n label: string;\n items: T[];\n selected: T;\n onSelect: (item: T) => void;\n render?: (item: T) => string;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const index = items.indexOf(selected);\n\n // Scrolled with the panel's own layout effect timing rather than on every\n // render: a click that lands mid-scroll would otherwise fight the animation.\n useEffect(() => {\n const el = ref.current;\n if (!el || index < 0) return;\n el.scrollTo({ top: index * TIME_ITEM_H, behavior: \"smooth\" });\n }, [index]);\n\n return (\n <div className=\"flex flex-col border-l border-border\" style={{ width: TIME_COL_W }}>\n <div className=\"py-1 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n {label}\n </div>\n <div\n ref={ref}\n className=\"overflow-y-auto\"\n style={{ height: TIME_COL_H, scrollbarWidth: \"none\", msOverflowStyle: \"none\" }}\n >\n {items.map((item) => {\n const active = item === selected;\n return (\n <button\n key={String(item)}\n type=\"button\"\n onClick={() => onSelect(item)}\n className={cn(\n \"flex w-full items-center justify-center rounded-md text-[13px] font-medium transition-colors\",\n active\n ? \"font-semibold text-white\"\n : \"text-foreground hover:bg-muted\",\n )}\n style={{ height: TIME_ITEM_H, background: active ? PRIMARY : undefined }}\n >\n {render ? render(item) : String(item)}\n </button>\n );\n })}\n {/* Lets the final value reach the top of the column. */}\n <div style={{ height: TIME_COL_H - TIME_ITEM_H }} />\n </div>\n </div>\n );\n}\n\n/* ─── DatePicker ─────────────────────────────────────────────────────────── */\nexport function DatePicker({ value, onChange, placeholder = \"Select date\", className, min, max, label, showTime = false, showNow = true }: DatePickerProps) {\n const today = new Date();\n const parsed = parseValue(value);\n\n const timeOptions: DatePickerTimeOptions = useMemo(\n () => (typeof showTime === \"object\" ? showTime : {}),\n [showTime]\n );\n const withTime = showTime !== false && showTime !== undefined;\n const use12Hours = timeOptions.use12Hours ?? true;\n const showSecond = timeOptions.showSecond ?? false;\n\n const [open, setOpen] = useState(false);\n const [panelPos, setPanelPos] = useState({ top: 0, left: 0 });\n const [viewYear, setViewYear] = useState(parsed?.y ?? today.getFullYear());\n const [viewMonth, setViewMonth] = useState(parsed?.m ?? today.getMonth());\n const [yearMenu, setYearMenu] = useState(false);\n const [monthMenu, setMonthMenu] = useState(false);\n const [mounted, setMounted] = useState(false);\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => { setMounted(true); }, []);\n\n /* Sync view when value changes */\n useEffect(() => {\n if (parsed) { setViewYear(parsed.y); setViewMonth(parsed.m); }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n /* ── Panel size, which the time columns widen ── */\n const columnCount = withTime ? (showSecond ? 3 : 2) + (use12Hours ? 1 : 0) : 0;\n const PANEL_W = CALENDAR_W + columnCount * TIME_COL_W;\n // Calendar body, plus the footer that only exists when a time is shown.\n const PANEL_H = withTime ? 392 : 340;\n\n /* Compute fixed position from trigger rect */\n function openPanel() {\n if (!triggerRef.current) return;\n const trigger = triggerRef.current;\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n\n // Scroll trigger into view so panel can appear next to it (avoids panel far from input in scrollable forms)\n trigger.scrollIntoView({ block: \"center\", behavior: \"auto\" });\n\n requestAnimationFrame(() => {\n if (!triggerRef.current) return;\n const rect = triggerRef.current.getBoundingClientRect();\n\n // Horizontal: align left edge, clamp so it doesn't go off screen\n let left = rect.left;\n if (left + PANEL_W > vw - 8) left = vw - PANEL_W - 8;\n if (left < 8) left = 8;\n\n // Vertical: prefer below trigger; if not enough room open above\n let top = rect.bottom + 6;\n if (top + PANEL_H > vh - 8) top = rect.top - PANEL_H - 6;\n if (top < 8) top = 8;\n\n setPanelPos({ top, left });\n setOpen(true);\n });\n }\n\n function closePanel() {\n setOpen(false); setYearMenu(false); setMonthMenu(false);\n }\n\n /* Close on outside click */\n useEffect(() => {\n if (!open) return;\n function handler(e: MouseEvent) {\n const inTrigger = triggerRef.current?.contains(e.target as Node);\n const inPanel = panelRef.current?.contains(e.target as Node);\n if (!inTrigger && !inPanel) closePanel();\n }\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n /* Navigation */\n function prevMonth() {\n if (viewMonth === 0) { setViewMonth(11); setViewYear(y => y - 1); }\n else setViewMonth(m => m - 1);\n }\n function nextMonth() {\n if (viewMonth === 11) { setViewMonth(0); setViewYear(y => y + 1); }\n else setViewMonth(m => m + 1);\n }\n\n /* Day grid */\n const totalDays = daysInMonth(viewYear, viewMonth);\n const firstDay = firstDayOf(viewYear, viewMonth);\n const prevTotal = daysInMonth(viewYear, viewMonth === 0 ? 11 : viewMonth - 1);\n const minParsed = parseYMD(min ?? \"\");\n const maxParsed = parseYMD(max ?? \"\");\n\n function isDisabled(y: number, m: number, d: number) {\n const day = new Date(y, m, d);\n if (minParsed && day < new Date(minParsed.y, minParsed.m, minParsed.d)) return true;\n if (maxParsed && day > new Date(maxParsed.y, maxParsed.m, maxParsed.d)) return true;\n return false;\n }\n\n type Cell = { d: number; m: number; y: number; current: boolean };\n const cells: Cell[] = [];\n for (let i = 0; i < firstDay; i++) {\n const d = prevTotal - firstDay + 1 + i;\n const m = viewMonth === 0 ? 11 : viewMonth - 1;\n const y = viewMonth === 0 ? viewYear - 1 : viewYear;\n cells.push({ d, m, y, current: false });\n }\n for (let d = 1; d <= totalDays; d++) cells.push({ d, m: viewMonth, y: viewYear, current: true });\n const remaining = 42 - cells.length;\n for (let d = 1; d <= remaining; d++) {\n const m = viewMonth === 11 ? 0 : viewMonth + 1;\n const y = viewMonth === 11 ? viewYear + 1 : viewYear;\n cells.push({ d, m, y, current: false });\n }\n\n const years = Array.from({ length: 15 }, (_, i) => today.getFullYear() - 2 + i);\n\n /* ── The time half ── */\n\n /**\n * The time the columns show. A value with no time yet reads as `defaultValue`\n * (midnight unless the caller says otherwise) so the columns always have a\n * row highlighted rather than starting blank.\n */\n const fallback = parseValue(`2000-01-01 ${timeOptions.defaultValue ?? \"00:00\"}`)!;\n const current: Parts = parsed ?? {\n y: today.getFullYear(), m: today.getMonth(), d: today.getDate(),\n hh: fallback.hh, mm: fallback.mm, ss: fallback.ss,\n };\n\n const emit = useCallback(\n (next: Parts) => onChange(formatValue(next, withTime, showSecond)),\n [onChange, withTime, showSecond]\n );\n\n /**\n * Editing a time before a day has been picked commits today's date along with\n * it — antd does the same, and the alternative is a time that silently goes\n * nowhere until a day is clicked.\n */\n function patchTime(patch: Partial<Pick<Parts, \"hh\" | \"mm\" | \"ss\">>) {\n emit({ ...current, ...patch });\n }\n\n const hourStep = step(timeOptions.hourStep);\n const minuteStep = step(timeOptions.minuteStep);\n const secondStep = step(timeOptions.secondStep);\n\n // 12-hour runs 12, 01 … 11 rather than 01 … 12, because 12 AM is midnight and\n // so is the first hour of the block — the order antd uses, and ascending by\n // the underlying 24-hour value.\n const hourItems = use12Hours\n ? Array.from({ length: Math.ceil(12 / hourStep) }, (_, i) => (i * hourStep) % 12)\n : Array.from({ length: Math.ceil(24 / hourStep) }, (_, i) => i * hourStep);\n const minuteItems = Array.from({ length: Math.ceil(60 / minuteStep) }, (_, i) => i * minuteStep);\n const secondItems = Array.from({ length: Math.ceil(60 / secondStep) }, (_, i) => i * secondStep);\n\n const selectedHour = use12Hours ? current.hh % 12 : current.hh;\n const selectedMeridiem: \"AM\" | \"PM\" = current.hh < 12 ? \"AM\" : \"PM\";\n\n function selectHour(h: number) {\n if (!use12Hours) return patchTime({ hh: h });\n patchTime({ hh: selectedMeridiem === \"AM\" ? h : h + 12 });\n }\n function selectMeridiem(p: string) {\n const base = current.hh % 12;\n patchTime({ hh: p === \"AM\" ? base : base + 12 });\n }\n\n function selectDay(cell: Cell) {\n if (!cell.current) { setViewYear(cell.y); setViewMonth(cell.m); }\n if (cell.current && isDisabled(cell.y, cell.m, cell.d)) return;\n emit({ y: cell.y, m: cell.m, d: cell.d, hh: current.hh, mm: current.mm, ss: current.ss });\n // With a time panel open the day is only half the answer, so the panel\n // stays up and OK is what closes it. This is antd's behaviour, and without\n // it the panel would shut before a time could be picked.\n if (!withTime) setOpen(false);\n }\n\n function selectNow() {\n const n = new Date();\n if (isDisabled(n.getFullYear(), n.getMonth(), n.getDate())) return;\n emit({\n y: n.getFullYear(), m: n.getMonth(), d: n.getDate(),\n hh: n.getHours(), mm: n.getMinutes(), ss: n.getSeconds(),\n });\n closePanel();\n }\n\n const isToday = (c: Cell) => c.d === today.getDate() && c.m === today.getMonth() && c.y === today.getFullYear();\n const isSelected = (c: Cell) => !!parsed && c.d === parsed.d && c.m === parsed.m && c.y === parsed.y;\n\n /* ── Calendar half ── */\n const calendar = (\n <div style={{ width: CALENDAR_W }} className=\"flex flex-col\">\n {/* Header */}\n <div className=\"flex items-center justify-between px-4 pt-4 pb-3\">\n <button type=\"button\" onClick={prevMonth}\n className=\"w-8 h-8 rounded-full flex items-center justify-center text-muted-foreground hover:bg-muted transition-colors\">\n <ChevronLeft className=\"w-4 h-4\" />\n </button>\n\n <div className=\"flex items-center gap-1\">\n {/* Month */}\n <div className=\"relative\">\n <button type=\"button\" onClick={() => { setMonthMenu(o => !o); setYearMenu(false); }}\n className=\"flex items-center gap-1 px-2 py-1 rounded-lg text-[14px] font-semibold text-foreground hover:bg-muted transition-colors\">\n {MONTHS[viewMonth].slice(0, 3)}\n <ChevronDown className=\"w-3 h-3 text-muted-foreground\" />\n </button>\n <AnimatePresence>\n {monthMenu && (\n <motion.div\n initial={{ opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }}\n transition={{ duration: 0.12 }}\n className=\"absolute top-full left-0 z-[10000] mt-1 max-h-[220px] min-w-[130px] overflow-y-auto rounded-xl border border-border bg-popover py-1 shadow-lg\"\n >\n {MONTHS.map((mn, mi) => (\n <button type=\"button\" key={mn} onClick={() => { setViewMonth(mi); setMonthMenu(false); }}\n className=\"w-full px-3 py-2 text-left text-[13px] text-foreground transition-colors hover:bg-muted\"\n style={{ fontWeight: mi === viewMonth ? 600 : 400, color: mi === viewMonth ? PRIMARY : undefined }}\n >\n {mn}\n </button>\n ))}\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n\n {/* Year */}\n <div className=\"relative\">\n <button type=\"button\" onClick={() => { setYearMenu(o => !o); setMonthMenu(false); }}\n className=\"flex items-center gap-1 px-2 py-1 rounded-lg text-[14px] font-semibold text-foreground hover:bg-muted transition-colors\">\n {viewYear}\n <ChevronDown className=\"w-3 h-3 text-muted-foreground\" />\n </button>\n <AnimatePresence>\n {yearMenu && (\n <motion.div\n initial={{ opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }}\n transition={{ duration: 0.12 }}\n className=\"absolute top-full left-0 z-[10000] mt-1 max-h-[200px] min-w-[90px] overflow-y-auto rounded-xl border border-border bg-popover py-1 shadow-lg\"\n >\n {years.map(yr => (\n <button type=\"button\" key={yr} onClick={() => { setViewYear(yr); setYearMenu(false); }}\n className=\"w-full px-3 py-2 text-left text-[13px] text-foreground transition-colors hover:bg-muted\"\n style={{ fontWeight: yr === viewYear ? 600 : 400, color: yr === viewYear ? PRIMARY : undefined }}\n >\n {yr}\n </button>\n ))}\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n </div>\n\n <button type=\"button\" onClick={nextMonth}\n className=\"w-8 h-8 rounded-full flex items-center justify-center text-muted-foreground hover:bg-muted transition-colors\">\n <ChevronRight className=\"w-4 h-4\" />\n </button>\n </div>\n\n {/* Day headers — explicit grid: Tailwind grid-cols-7 can be dropped from CSS output for portalled nodes */}\n <div\n className=\"px-3 pb-1\"\n style={{ display: \"grid\", gridTemplateColumns: \"repeat(7, minmax(0, 1fr))\" }}\n >\n {DAYS.map((d) => (\n <div key={d} className=\"py-1 text-center text-[11.5px] font-semibold text-muted-foreground\">\n {d}\n </div>\n ))}\n </div>\n\n {/* Day grid */}\n <div\n className=\"gap-y-0.5 px-3 pb-4\"\n style={{ display: \"grid\", gridTemplateColumns: \"repeat(7, minmax(0, 1fr))\" }}\n >\n {cells.map((cell, i) => {\n const selected = isSelected(cell);\n const tod = isToday(cell);\n const disabled = cell.current && isDisabled(cell.y, cell.m, cell.d);\n return (\n <button type=\"button\" key={i} onClick={() => selectDay(cell)} disabled={disabled}\n className={cn(\n \"h-9 w-9 mx-auto rounded-full text-[13px] font-medium flex items-center justify-center transition-all\",\n selected && \"text-white font-semibold\",\n !selected && tod && \"font-semibold\",\n !selected && !tod && cell.current && !disabled && \"text-gray-800 hover:bg-gray-100\",\n !selected && !cell.current && \"text-gray-300 hover:bg-gray-50\",\n disabled && \"opacity-30 cursor-not-allowed\",\n )}\n style={selected ? { background: PRIMARY } : tod ? { background: `${PRIMARY}18`, color: PRIMARY } : {}}>\n {cell.d}\n </button>\n );\n })}\n </div>\n </div>\n );\n\n /* ── Time half ── */\n const timeColumns = withTime && (\n <div className=\"flex pt-3\">\n <TimeColumn\n label=\"Hr\"\n items={hourItems}\n selected={selectedHour}\n onSelect={selectHour}\n render={(h) => pad(use12Hours && h === 0 ? 12 : h)}\n />\n <TimeColumn label=\"Min\" items={minuteItems} selected={current.mm} onSelect={(m) => patchTime({ mm: m })} render={pad} />\n {showSecond && (\n <TimeColumn label=\"Sec\" items={secondItems} selected={current.ss} onSelect={(s) => patchTime({ ss: s })} render={pad} />\n )}\n {use12Hours && (\n <TimeColumn label=\"AM/PM\" items={[\"AM\", \"PM\"]} selected={selectedMeridiem} onSelect={selectMeridiem} />\n )}\n </div>\n );\n\n const body = (\n <>\n <div className=\"flex\">\n {calendar}\n {timeColumns}\n </div>\n\n {/* Footer only exists alongside a time panel: with no time to pick, a day\n click is the whole answer and an OK button would be a second click for\n nothing. Same rule antd applies. */}\n {withTime && (\n <div className=\"flex items-center justify-between border-t border-border px-4 py-2.5\">\n {showNow ? (\n <button type=\"button\" onClick={selectNow}\n className=\"rounded-md px-1 text-[13px] font-medium transition-colors hover:underline\"\n style={{ color: PRIMARY }}>\n Now\n </button>\n ) : <span />}\n <button type=\"button\" onClick={closePanel}\n className=\"rounded-lg px-3 py-1.5 text-[13px] font-semibold text-white transition-opacity hover:opacity-90\"\n style={{ background: PRIMARY }}>\n OK\n </button>\n </div>\n )}\n </>\n );\n\n /* ── Calendar panel (portalled) ── */\n const panel = (\n <AnimatePresence>\n {open && (\n <motion.div\n ref={panelRef}\n initial={{ opacity: 0, scale: 0.97, y: -6 }}\n animate={{ opacity: 1, scale: 1, y: 0 }}\n exit={{ opacity: 0, scale: 0.97, y: -6 }}\n transition={{ duration: 0.16, ease: [0.16, 1, 0.3, 1] }}\n className=\"isolate rounded-2xl border border-border bg-popover text-popover-foreground shadow-lg select-none dark:shadow-black/40\"\n style={{\n position: \"fixed\",\n top: panelPos.top,\n left: panelPos.left,\n width: PANEL_W,\n zIndex: 20000,\n // A modal Radix Dialog sets `pointer-events: none` on <body> while\n // it is open, and this panel is portaled to <body> — so without\n // this every click on a day landed on nothing and the calendar\n // looked frozen inside a Dialog or Drawer. Hit-testing is\n // per-element, so re-enabling it here is enough; the page behind\n // the dialog stays inert. The click still reaches the dialog's\n // DismissableLayer through React's portal event propagation, so it\n // is treated as inside and does not dismiss the dialog.\n pointerEvents: \"auto\",\n backgroundColor: \"var(--popover)\",\n boxShadow: \"0 16px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07)\",\n }}\n >\n {/* The time columns are the only scrollable region this panel has, and\n a portalled node is neither the lock container nor a shard of a\n modal Dialog's `RemoveScroll` — so react-remove-scroll would\n `preventDefault()` every wheel event over them and leave only the\n rows already on screen reachable. Taking the top of the lock stack\n hands scrolling back, the same way TimePicker and Radix `Select`\n do. Mounted only with a time panel: the date-only panel has\n nothing to scroll and should not lock the page. */}\n {withTime ? <RemoveScroll allowPinchZoom>{body}</RemoveScroll> : body}\n </motion.div>\n )}\n </AnimatePresence>\n );\n\n return (\n <div className={cn(\"relative\", className)}>\n {label && <p className=\"mb-2 text-sm font-medium text-foreground\">{label}</p>}\n\n {/* Trigger */}\n <button\n ref={triggerRef}\n type=\"button\"\n onClick={() => open ? closePanel() : openPanel()}\n className={cn(\n \"flex h-12 min-h-12 w-full items-center gap-3 rounded-xl border border-border bg-card px-5 text-left text-[15px] shadow-sm transition-colors\",\n open ? \"border-ring ring-2 ring-ring/20\" : \"hover:border-muted-foreground/45\",\n )}\n >\n <CalendarDays className=\"size-[1.125rem] shrink-0 text-muted-foreground\" />\n <span className={cn(\"flex-1\", value ? \"text-foreground\" : \"text-muted-foreground\")}>\n {value ? displayValue(value, withTime, showSecond) : placeholder}\n </span>\n <ChevronDown className={cn(\"size-[1.125rem] shrink-0 text-muted-foreground transition-transform\", open && \"rotate-180\")} />\n </button>\n\n {/* Portal. Wrapped so the panel takes over the scroll lock when it opens\n inside a Dialog or Drawer — without it the year/month lists and the\n time columns cannot be scrolled with the wheel. See `scroll-lock.tsx`. */}\n {mounted &&\n createPortal(<ScrollLockTakeover>{panel}</ScrollLockTakeover>, document.body)}\n </div>\n );\n}\n","\"use client\"\n\n/**\n * Chart primitives from shadcn/ui (Recharts composition layer).\n * @see https://ui.shadcn.com/docs/components/radix/chart\n */\n\nimport * as React from \"react\"\nimport * as RechartsPrimitive from \"recharts\"\nimport type { TooltipValueType } from \"recharts\"\n\nimport { cn } from \"./utils\"\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const\ntype TooltipNameType = number | string\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n )\n>\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error(\"useChart must be used within a <ChartContainer />\")\n }\n\n return context\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: React.ComponentProps<\"div\"> & {\n config: ChartConfig\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >[\"children\"]\n initialDimension?: {\n width: number\n height: number\n }\n}) {\n const uniqueId = React.useId()\n const chartId = `chart-${id ?? uniqueId.replace(/:/g, \"\")}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer\n initialDimension={initialDimension}\n >\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme ?? config.color\n )\n\n if (!colorConfig.length) {\n return null\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??\n itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join(\"\\n\")}\n}\n`\n )\n .join(\"\\n\"),\n }}\n />\n )\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = \"dot\",\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<\"div\"> & {\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n nameKey?: string\n labelKey?: string\n } & Omit<\n RechartsPrimitive.DefaultTooltipContentProps<\n TooltipValueType,\n TooltipNameType\n >,\n \"accessibilityLayer\"\n >) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === \"string\"\n ? (config[label]?.label ?? label)\n : itemConfig?.label\n\n if (labelFormatter) {\n return (\n <div className={cn(\"font-medium\", labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n )\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n <div\n className={cn(\n \"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl\",\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color ?? item.payload?.fill ?? item.color\n\n return (\n <div\n key={index}\n className={cn(\n \"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\n \"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)\",\n {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"w-1\": indicator === \"line\",\n \"w-0 border-[1.5px] border-dashed bg-transparent\":\n indicator === \"dashed\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n }\n )}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n \"flex flex-1 justify-between leading-none\",\n nestLabel ? \"items-end\" : \"items-center\"\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">\n {itemConfig?.label ?? item.name}\n </span>\n </div>\n {item.value != null && (\n <span className=\"font-mono font-medium text-foreground tabular-nums\">\n {typeof item.value === \"number\"\n ? item.value.toLocaleString()\n : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = \"bottom\",\n nameKey,\n}: React.ComponentProps<\"div\"> & {\n hideIcon?: boolean\n nameKey?: string\n} & RechartsPrimitive.DefaultLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n \"flex items-center justify-center gap-4\",\n verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n className\n )}\n >\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={index}\n className={cn(\n \"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground\"\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== \"object\" || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n \"payload\" in payload &&\n typeof payload.payload === \"object\" &&\n payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === \"string\"\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key]\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Line,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport {\n ArrowDownRight,\n ArrowUpRight,\n ExternalLink,\n Info,\n Minus,\n} from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { Button } from \"./button\";\nimport { Separator } from \"./separator\";\n\nconst gridStroke = \"color-mix(in srgb, var(--border) 65%, transparent)\";\nconst tickFill = \"var(--muted-foreground)\";\n\n/** ─── KPI + sparkline (dashboard stat tiles) ─────────────────────────── */\n\nexport type MetricSparklinePoint = { x: string | number; y: number };\n\nexport type MetricSparklineCardProps = {\n title: string;\n icon?: React.ReactNode;\n value: React.ReactNode;\n /** e.g. \"+8.4% vs last month\" */\n trend?: { direction: \"up\" | \"down\" | \"flat\"; label: string };\n data: MetricSparklinePoint[];\n /** Stroke / gradient accent (CSS color) */\n accentColor?: string;\n className?: string;\n onInfoClick?: () => void;\n};\n\nexport function MetricSparklineCard({\n title,\n icon,\n value,\n trend,\n data,\n accentColor = \"var(--chart-1)\",\n className,\n onInfoClick,\n}: MetricSparklineCardProps) {\n const gid = React.useId().replace(/:/g, \"\");\n const chartData = data.map((d) => ({ ...d, y: d.y }));\n\n const trendCls =\n trend?.direction === \"up\"\n ? \"text-emerald-600 dark:text-emerald-400\"\n : trend?.direction === \"down\"\n ? \"text-red-600 dark:text-red-400\"\n : \"text-muted-foreground\";\n\n const TrendIcon =\n trend?.direction === \"up\" ? ArrowUpRight : trend?.direction === \"down\" ? ArrowDownRight : Minus;\n\n return (\n <div\n className={cn(\n \"relative overflow-hidden rounded-xl border border-border bg-card p-5 text-card-foreground shadow-sm\",\n className\n )}\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {icon ? <span className=\"flex shrink-0 text-muted-foreground [&_svg]:size-4\">{icon}</span> : null}\n <span className=\"truncate text-sm font-semibold text-foreground\">{title}</span>\n </div>\n {onInfoClick ? (\n <button\n type=\"button\"\n onClick={onInfoClick}\n className=\"shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n aria-label=\"More info\"\n >\n <Info className=\"size-3.5\" />\n </button>\n ) : null}\n </div>\n\n <div className=\"mt-3 text-2xl font-semibold tabular-nums tracking-tight text-foreground\">{value}</div>\n\n <div className=\"pointer-events-none absolute bottom-3 right-3 h-14 w-[46%] max-w-[9rem] opacity-95\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={chartData} margin={{ top: 4, right: 0, left: 0, bottom: 0 }}>\n <defs>\n <linearGradient id={gid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={accentColor} stopOpacity={0.35} />\n <stop offset=\"100%\" stopColor={accentColor} stopOpacity={0} />\n </linearGradient>\n </defs>\n <Area\n type=\"monotone\"\n dataKey=\"y\"\n stroke={accentColor}\n strokeWidth={2}\n fill={`url(#${gid})`}\n isAnimationActive={false}\n />\n </AreaChart>\n </ResponsiveContainer>\n </div>\n\n {trend ? (\n <div className={cn(\"mt-10 flex items-center gap-1 text-xs font-medium\", trendCls)}>\n <TrendIcon className=\"size-3.5 shrink-0\" aria-hidden />\n <span>{trend.label}</span>\n </div>\n ) : (\n <div className=\"mt-10\" />\n )}\n </div>\n );\n}\n\n/** ─── Hero area + optional compare line + tabs + footer ──────────────── */\n\nexport type DashboardAreaChartPoint = Record<string, string | number>;\n\nexport type DashboardAreaChartTemplateProps = {\n title: string;\n tabs: { id: string; label: string }[];\n activeTabId: string;\n onTabChange: (id: string) => void;\n headline: React.ReactNode;\n delta?: React.ReactNode;\n data: DashboardAreaChartPoint[];\n xKey: string;\n areaKey: string;\n compareLineKey?: string;\n height?: number;\n formatYAxis?: (v: number) => string;\n footer?: React.ReactNode;\n className?: string;\n};\n\nexport function DashboardAreaChartTemplate({\n title,\n tabs,\n activeTabId,\n onTabChange,\n headline,\n delta,\n data,\n xKey,\n areaKey,\n compareLineKey,\n height = 220,\n formatYAxis = (v) =>\n v >= 1_000_000 ? `${(v / 1_000_000).toFixed(1)}L` : v >= 1_000 ? `${(v / 1_000).toFixed(0)}K` : `${v}`,\n footer,\n className,\n}: DashboardAreaChartTemplateProps) {\n const areaGid = React.useId().replace(/:/g, \"\");\n\n return (\n <div className={cn(\"rounded-xl border border-border bg-card text-card-foreground shadow-sm\", className)}>\n <div className=\"flex flex-col gap-4 border-b border-border px-5 pt-4 pb-3 sm:flex-row sm:items-start sm:justify-between\">\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n <div className=\"flex flex-wrap gap-1 rounded-lg border border-border bg-muted/30 p-0.5\">\n {tabs.map((t) => (\n <button\n key={t.id}\n type=\"button\"\n onClick={() => onTabChange(t.id)}\n className={cn(\n \"rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors\",\n activeTabId === t.id\n ? \"bg-card text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {t.label}\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"px-5 pt-4\">\n <div className=\"text-2xl font-semibold tabular-nums tracking-tight text-foreground\">{headline}</div>\n {delta ? <div className=\"mt-1 text-sm\">{delta}</div> : null}\n </div>\n\n <div className=\"px-3 pb-2 pt-2\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={data} margin={{ top: 8, right: 12, left: 0, bottom: 0 }}>\n <defs>\n <linearGradient id={areaGid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"var(--chart-1)\" stopOpacity={0.35} />\n <stop offset=\"100%\" stopColor=\"var(--chart-1)\" stopOpacity={0.02} />\n </linearGradient>\n </defs>\n <CartesianGrid strokeDasharray=\"3 3\" stroke={gridStroke} vertical={false} />\n <XAxis\n dataKey={xKey}\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 10, fill: tickFill }}\n interval=\"preserveStartEnd\"\n />\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 10, fill: tickFill }}\n tickFormatter={formatYAxis}\n width={44}\n />\n <Tooltip\n contentStyle={{\n borderRadius: 10,\n border: \"1px solid var(--border)\",\n fontSize: 12,\n background: \"var(--popover)\",\n color: \"var(--popover-foreground)\",\n }}\n />\n <Area\n type=\"monotone\"\n dataKey={areaKey}\n stroke=\"var(--chart-1)\"\n strokeWidth={2}\n fill={`url(#${areaGid})`}\n />\n {compareLineKey ? (\n <Line\n type=\"monotone\"\n dataKey={compareLineKey}\n stroke=\"var(--muted-foreground)\"\n strokeWidth={1.5}\n strokeDasharray=\"4 4\"\n dot={false}\n />\n ) : null}\n </AreaChart>\n </ResponsiveContainer>\n </div>\n\n {footer ? (\n <>\n <Separator />\n <div className=\"px-5 py-3\">{footer}</div>\n </>\n ) : null}\n </div>\n );\n}\n\n/** ─── Grouped vertical bars + legend (e.g. volume vs settled) ───────── */\n\nexport type GroupedBarSeries = { key: string; label: string; color: string };\n\nexport type GroupedBarChartTemplateProps = {\n title: string;\n subtitle?: string;\n data: DashboardAreaChartPoint[];\n xKey: string;\n series: GroupedBarSeries[];\n height?: number;\n formatYAxis?: (v: number) => string;\n className?: string;\n};\n\nexport function GroupedBarChartTemplate({\n title,\n subtitle,\n data,\n xKey,\n series,\n height = 200,\n formatYAxis = (v) =>\n v >= 1_000_000 ? `${(v / 1_000_000).toFixed(1)}M` : v >= 1_000 ? `${(v / 1_000).toFixed(0)}K` : `${v}`,\n className,\n}: GroupedBarChartTemplateProps) {\n return (\n <div className={cn(\"rounded-xl border border-border bg-card px-5 pt-4 pb-3 text-card-foreground shadow-sm\", className)}>\n <div className=\"mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n {subtitle ? <p className=\"mt-0.5 text-xs text-muted-foreground\">{subtitle}</p> : null}\n </div>\n <div className=\"flex flex-wrap items-center gap-4\">\n {series.map((s) => (\n <div key={s.key} className=\"flex items-center gap-1.5\">\n <div className=\"size-2.5 rounded-sm\" style={{ background: s.color }} />\n <span className=\"text-[11px] font-medium text-muted-foreground\">{s.label}</span>\n </div>\n ))}\n </div>\n </div>\n <div style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={data} barCategoryGap=\"22%\" barGap={4}>\n <CartesianGrid strokeDasharray=\"3 3\" stroke={gridStroke} vertical={false} />\n <XAxis dataKey={xKey} axisLine={false} tickLine={false} tick={{ fontSize: 11, fill: tickFill }} />\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 11, fill: tickFill }}\n tickFormatter={formatYAxis}\n width={40}\n />\n <Tooltip\n contentStyle={{\n borderRadius: 10,\n border: \"1px solid var(--border)\",\n fontSize: 12,\n background: \"var(--popover)\",\n }}\n />\n {series.map((s) => (\n <Bar key={s.key} dataKey={s.key} name={s.label} fill={s.color} radius={[5, 5, 0, 0]} maxBarSize={36} />\n ))}\n </BarChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n\n/** ─── Ranked rows with horizontal bar (country / state insights) ────── */\n\nexport type RankedBarItem = {\n id: string;\n leading?: React.ReactNode;\n label: string;\n value: string;\n /** 0–100 width of the filled bar */\n percent: number;\n};\n\nexport type RankedBarListTemplateProps = {\n title: string;\n subtitle?: string;\n headerRight?: React.ReactNode;\n items: RankedBarItem[];\n /** CSS colors for bar gradient */\n barFrom?: string;\n barTo?: string;\n className?: string;\n};\n\nexport function RankedBarListTemplate({\n title,\n subtitle,\n headerRight,\n items,\n barFrom = \"var(--chart-1)\",\n barTo = \"var(--chart-3)\",\n className,\n}: RankedBarListTemplateProps) {\n return (\n <div className={cn(\"rounded-xl border border-border bg-card p-5 text-card-foreground shadow-sm\", className)}>\n <div className=\"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n {subtitle ? <p className=\"mt-0.5 text-xs text-muted-foreground\">{subtitle}</p> : null}\n </div>\n {headerRight ? <div className=\"shrink-0\">{headerRight}</div> : null}\n </div>\n <ul className=\"space-y-3\">\n {items.map((row) => (\n <li key={row.id} className=\"flex items-center gap-3 text-sm\">\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n {row.leading ? <span className=\"shrink-0 text-muted-foreground\">{row.leading}</span> : null}\n <span className=\"truncate font-medium text-foreground\">{row.label}</span>\n </div>\n <div className=\"relative hidden h-2 w-[min(40%,9rem)] overflow-hidden rounded-full bg-muted sm:block\">\n <div\n className=\"absolute inset-y-0 left-0 rounded-full\"\n style={{\n width: `${Math.min(100, Math.max(0, row.percent))}%`,\n background: `linear-gradient(90deg, ${barFrom}, ${barTo})`,\n }}\n />\n </div>\n <span className=\"w-14 shrink-0 text-right text-xs font-semibold tabular-nums text-foreground\">\n {row.value}\n </span>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/** ─── Vertical category bars (e.g. T+N settlement mix) ──────────────── */\n\nexport type CategoryBarPoint = { category: string; value: number };\n\nexport type CategoryBarChartTemplateProps = {\n title: string;\n subtitle?: string;\n data: CategoryBarPoint[];\n valueLabel?: string;\n barColor?: string;\n height?: number;\n className?: string;\n};\n\nexport function CategoryBarChartTemplate({\n title,\n subtitle,\n data,\n valueLabel = \"Share\",\n barColor = \"var(--chart-1)\",\n height = 200,\n className,\n}: CategoryBarChartTemplateProps) {\n const chartData = data.map((d) => ({ name: d.category, v: d.value }));\n\n return (\n <div className={cn(\"rounded-xl border border-border bg-card px-5 pt-4 pb-3 text-card-foreground shadow-sm\", className)}>\n <div className=\"mb-3\">\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n {subtitle ? <p className=\"mt-0.5 text-xs text-muted-foreground\">{subtitle}</p> : null}\n </div>\n <div style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={chartData} barCategoryGap=\"28%\">\n <CartesianGrid strokeDasharray=\"3 3\" stroke={gridStroke} vertical={false} />\n <XAxis dataKey=\"name\" axisLine={false} tickLine={false} tick={{ fontSize: 11, fill: tickFill }} />\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 11, fill: tickFill }}\n tickFormatter={(v) => `${v}%`}\n domain={[0, \"dataMax + 5\"]}\n width={36}\n />\n <Tooltip\n formatter={(value) => [`${value ?? 0}%`, valueLabel]}\n contentStyle={{\n borderRadius: 10,\n border: \"1px solid var(--border)\",\n fontSize: 12,\n background: \"var(--popover)\",\n }}\n />\n <Bar dataKey=\"v\" fill={barColor} radius={[6, 6, 0, 0]} maxBarSize={48} />\n </BarChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n\n/** ─── Mini sparkline + stat row (success / failed / avg) ────────────── */\n\nexport type MiniSparklinePoint = { x: string | number; y: number; compare?: number };\n\nexport type MiniSparklineStat = { label: string; value: string; dotClassName?: string };\n\nexport type MiniSparklineChartCardProps = {\n title: string;\n value: React.ReactNode;\n data: MiniSparklinePoint[];\n accentColor?: string;\n stats: MiniSparklineStat[];\n height?: number;\n className?: string;\n};\n\nexport function MiniSparklineChartCard({\n title,\n value,\n data,\n accentColor = \"var(--chart-4)\",\n height = 100,\n stats,\n className,\n}: MiniSparklineChartCardProps) {\n const gid = React.useId().replace(/:/g, \"\");\n const hasCompare = data.some((d) => d.compare != null);\n\n return (\n <div className={cn(\"rounded-xl border border-border bg-card p-5 text-card-foreground shadow-sm\", className)}>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n <div className=\"mt-2 text-2xl font-semibold tabular-nums\">{value}</div>\n <div className=\"mt-2\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={data} margin={{ top: 4, right: 8, left: 0, bottom: 0 }}>\n <defs>\n <linearGradient id={gid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={accentColor} stopOpacity={0.3} />\n <stop offset=\"100%\" stopColor={accentColor} stopOpacity={0} />\n </linearGradient>\n </defs>\n <XAxis dataKey=\"x\" hide />\n <YAxis hide domain={[\"dataMin - 1\", \"dataMax + 1\"]} />\n <Area type=\"monotone\" dataKey=\"y\" stroke={accentColor} strokeWidth={2} fill={`url(#${gid})`} />\n {hasCompare ? (\n <Line\n type=\"monotone\"\n dataKey=\"compare\"\n stroke=\"var(--muted-foreground)\"\n strokeWidth={1.5}\n strokeDasharray=\"4 4\"\n dot={false}\n connectNulls\n />\n ) : null}\n </AreaChart>\n </ResponsiveContainer>\n </div>\n <div className=\"mt-3 flex flex-wrap gap-x-4 gap-y-2 border-t border-border pt-3 text-[11px]\">\n {stats.map((s) => (\n <div key={s.label} className=\"flex items-center gap-1.5\">\n {s.dotClassName ? <span className={cn(\"size-1.5 rounded-full\", s.dotClassName)} /> : null}\n <span className=\"text-muted-foreground\">{s.label}</span>\n <span className=\"font-semibold tabular-nums text-foreground\">{s.value}</span>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/** ─── “Needs attention” list with actions ───────────────────────────── */\n\nexport type AttentionListItem = {\n id: string;\n title: string;\n value: string;\n valueTone?: \"default\" | \"warning\" | \"danger\";\n meta?: string;\n actionLabel: string;\n onAction?: () => void;\n};\n\nexport type AttentionListTemplateProps = {\n title: string;\n items: AttentionListItem[];\n className?: string;\n};\n\nconst toneCls = {\n default: \"text-foreground\",\n warning: \"text-amber-600 dark:text-amber-400\",\n danger: \"text-red-600 dark:text-red-400\",\n} as const;\n\nexport function AttentionListTemplate({ title, items, className }: AttentionListTemplateProps) {\n return (\n <div className={cn(\"rounded-xl border border-border bg-card p-5 text-card-foreground shadow-sm\", className)}>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n <ul className=\"mt-4 space-y-4\">\n {items.map((item) => (\n <li\n key={item.id}\n className=\"flex flex-col gap-3 border-b border-border/60 pb-4 last:border-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between\"\n >\n <div className=\"min-w-0 space-y-0.5\">\n <p className=\"text-sm font-semibold text-foreground\">{item.title}</p>\n <p className={cn(\"text-lg font-semibold tabular-nums\", toneCls[item.valueTone ?? \"default\"])}>\n {item.value}\n </p>\n {item.meta ? <p className=\"text-xs text-muted-foreground\">{item.meta}</p> : null}\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"md\"\n className=\"shrink-0 gap-1.5\"\n onClick={item.onAction}\n >\n {item.actionLabel}\n <ExternalLink className=\"size-3.5 opacity-70\" aria-hidden />\n </Button>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","\"use client\";\n\nimport { useTheme } from \"next-themes\";\nimport { Toaster as Sonner, type ToasterProps } from \"sonner\";\nimport { useEffect, useState } from \"react\";\n\n/** Drop-in toast host; pair with `toast` from `sonner`. Resolves theme via next-themes when mounted. */\nexport function Toaster({ theme, ...props }: ToasterProps) {\n const { resolvedTheme } = useTheme();\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n\n const resolved =\n theme ?? (mounted && resolvedTheme === \"dark\" ? \"dark\" : \"light\");\n\n return (\n <Sonner\n theme={resolved}\n position=\"bottom-right\"\n toastOptions={{\n classNames: {\n toast:\n \"bg-[var(--popover)] text-[var(--popover-foreground)] border-[var(--border)] shadow-lg rounded-[10px] text-[13px]\",\n description: \"text-[var(--muted-foreground)]\",\n },\n }}\n {...props}\n />\n );\n}\n\nexport { toast } from \"sonner\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Check, Pencil, X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport interface InlineEditProps {\n value: string;\n onConfirm: (val: string) => void;\n placeholder?: string;\n multiline?: boolean;\n disabled?: boolean;\n showButtons?: boolean;\n readClassName?: string;\n inputClassName?: string;\n}\n\nconst InlineEdit = React.forwardRef<HTMLDivElement, InlineEditProps>(\n (\n {\n value,\n onConfirm,\n placeholder = \"Click to edit…\",\n multiline = false,\n disabled = false,\n showButtons = false,\n readClassName,\n inputClassName,\n },\n ref\n ) => {\n const [editing, setEditing] = React.useState(false);\n const [draft, setDraft] = React.useState(value);\n const [hovered, setHovered] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement & HTMLTextAreaElement>(null);\n\n React.useEffect(() => {\n if (!editing) setDraft(value);\n }, [value, editing]);\n\n React.useEffect(() => {\n if (editing) {\n inputRef.current?.focus();\n if (inputRef.current) {\n const el = inputRef.current;\n const len = el.value.length;\n el.setSelectionRange(len, len);\n }\n }\n }, [editing]);\n\n const confirm = React.useCallback(() => {\n setEditing(false);\n if (draft !== value) onConfirm(draft);\n }, [draft, value, onConfirm]);\n\n const cancel = React.useCallback(() => {\n setEditing(false);\n setDraft(value);\n }, [value]);\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\" && !multiline) {\n e.preventDefault();\n confirm();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n cancel();\n }\n },\n [confirm, cancel, multiline]\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent) => {\n // If showButtons, don't auto-confirm on blur unless focus leaves the whole group\n if (showButtons) {\n const related = e.relatedTarget as Node | null;\n const container = (e.currentTarget as HTMLElement).closest(\n \"[data-inline-edit]\"\n );\n if (container && related && container.contains(related)) return;\n }\n confirm();\n },\n [confirm, showButtons]\n );\n\n const startEditing = () => {\n if (disabled) return;\n setEditing(true);\n };\n\n const sharedInputClass = cn(\n \"w-full rounded-md border border-border bg-card px-2 py-1 text-[15px] leading-tight text-foreground shadow-sm\",\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n inputClassName\n );\n\n return (\n <div ref={ref} data-inline-edit=\"\" className=\"relative inline-flex flex-col gap-1 max-w-full\">\n {editing ? (\n <>\n {multiline ? (\n <textarea\n ref={inputRef as React.Ref<HTMLTextAreaElement>}\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n placeholder={placeholder}\n rows={3}\n className={cn(sharedInputClass, \"resize-none leading-relaxed py-1.5\")}\n />\n ) : (\n <input\n ref={inputRef as React.Ref<HTMLInputElement>}\n type=\"text\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n placeholder={placeholder}\n className={sharedInputClass}\n />\n )}\n\n {showButtons && (\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onMouseDown={(e) => {\n e.preventDefault();\n confirm();\n }}\n className={cn(\n \"inline-flex items-center justify-center rounded-md p-1\",\n \"text-emerald-600 hover:bg-emerald-50 dark:hover:bg-emerald-950/40\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n aria-label=\"Confirm\"\n >\n <Check className=\"size-3.5\" />\n </button>\n <button\n type=\"button\"\n onMouseDown={(e) => {\n e.preventDefault();\n cancel();\n }}\n className={cn(\n \"inline-flex items-center justify-center rounded-md p-1\",\n \"text-destructive hover:bg-destructive/10\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n aria-label=\"Cancel\"\n >\n <X className=\"size-3.5\" />\n </button>\n </div>\n )}\n </>\n ) : (\n <span\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-label={value || placeholder}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={startEditing}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n startEditing();\n }\n }}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[15px] leading-tight\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n !disabled && \"hover:bg-muted cursor-text\",\n disabled && \"cursor-not-allowed opacity-50\",\n readClassName\n )}\n >\n <span className={cn(!value && \"text-muted-foreground\")}>\n {value || placeholder}\n </span>\n {!disabled && (\n <Pencil\n className={cn(\n \"size-3.5 shrink-0 text-muted-foreground transition-opacity duration-pg-fast ease-pg-standard\",\n hovered ? \"opacity-100\" : \"opacity-0\"\n )}\n aria-hidden\n />\n )}\n </span>\n )}\n </div>\n );\n }\n);\n\nInlineEdit.displayName = \"InlineEdit\";\n\nexport { InlineEdit };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface InlineDialogProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n\nexport interface InlineDialogContentProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n \"side\" | \"sideOffset\"\n > {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n sideOffset?: number;\n /** Hide the built-in close button */\n hideClose?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// InlineDialog (Popover root)\n// ---------------------------------------------------------------------------\n\nconst InlineDialog = PopoverPrimitive.Root;\nInlineDialog.displayName = \"InlineDialog\";\n\n// ---------------------------------------------------------------------------\n// InlineDialogTrigger\n// ---------------------------------------------------------------------------\n\nconst InlineDialogTrigger = PopoverPrimitive.Trigger;\nInlineDialogTrigger.displayName = \"InlineDialogTrigger\";\n\n// ---------------------------------------------------------------------------\n// Arrow positioning helpers\n// ---------------------------------------------------------------------------\n\ntype ArrowSide = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/**\n * Returns Tailwind classes that position the 8×8 arrow square on the correct\n * edge of the floating card and rotate it so the corner points at the trigger.\n */\nfunction getArrowClasses(side: ArrowSide): string {\n const base =\n \"absolute size-2 bg-card border border-border pointer-events-none\";\n\n switch (side) {\n case \"top\":\n // Arrow appears on the bottom edge of the card (card is above trigger)\n return cn(\n base,\n \"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 rotate-45\",\n \"border-t-0 border-l-0\"\n );\n case \"bottom\":\n // Arrow appears on the top edge of the card (card is below trigger)\n return cn(\n base,\n \"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 rotate-45\",\n \"border-b-0 border-r-0\"\n );\n case \"left\":\n // Arrow appears on the right edge of the card (card is left of trigger)\n return cn(\n base,\n \"right-0 top-1/2 -translate-y-1/2 translate-x-1/2 rotate-45\",\n \"border-t-0 border-l-0\"\n );\n case \"right\":\n // Arrow appears on the left edge of the card (card is right of trigger)\n return cn(\n base,\n \"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 rotate-45\",\n \"border-b-0 border-r-0\"\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// InlineDialogContent\n// ---------------------------------------------------------------------------\n\nconst InlineDialogContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n InlineDialogContentProps\n>(\n (\n {\n className,\n side = \"bottom\",\n sideOffset = 8,\n hideClose = false,\n children,\n ...props\n },\n ref\n ) => (\n <PopoverPrimitive.Portal>\n {/* Scrollable when opened from inside a Dialog or Drawer. See\n `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n sideOffset={sideOffset}\n className={cn(\n // Base card\n \"relative z-[120] max-w-xs overflow-visible\",\n \"rounded-xl border border-border bg-card p-4 text-foreground shadow-lg\",\n // Animation\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0\",\n \"transition-opacity duration-pg-fast ease-pg-standard\",\n \"outline-none\",\n className\n )}\n {...props}\n >\n {/* Arrow pointer */}\n <span className={getArrowClasses(side)} aria-hidden=\"true\" />\n\n {/* Close button */}\n {!hideClose && (\n <PopoverPrimitive.Close\n className={cn(\n \"absolute right-2 top-2 z-10\",\n \"inline-flex size-6 items-center justify-center rounded-md\",\n \"text-muted-foreground hover:text-foreground\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\"\n )}\n aria-label=\"Close\"\n >\n <X className=\"size-3.5\" />\n </PopoverPrimitive.Close>\n )}\n\n {children}\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n )\n);\nInlineDialogContent.displayName = \"InlineDialogContent\";\n\n// ---------------------------------------------------------------------------\n// Exports\n// ---------------------------------------------------------------------------\n\nexport { InlineDialog, InlineDialogTrigger, InlineDialogContent };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Info, CheckCircle2, AlertTriangle, XCircle, X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport type FlagVariant = \"info\" | \"success\" | \"warning\" | \"error\";\nexport type FlagGroupPosition = \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\nexport interface FlagAction {\n label: string;\n onClick: () => void;\n}\n\nexport interface FlagProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Heading text shown in bold */\n title: string;\n /** Optional body copy shown below the title */\n description?: string;\n /** Visual severity / colour */\n variant?: FlagVariant;\n /** Override the default lucide icon */\n icon?: React.ReactNode;\n /** Called when the close button is pressed */\n onDismiss?: () => void;\n /** Action buttons rendered below the content. Pass `false` to disable. */\n autoDismiss?: number | false;\n /** Optional CTA buttons */\n actions?: FlagAction[];\n}\n\nexport interface FlagGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Corner to anchor the stack */\n position?: FlagGroupPosition;\n}\n\nexport interface UseFlagGroupReturn {\n flags: Array<FlagProps & { id: string }>;\n addFlag: (flag: Omit<FlagProps, \"onDismiss\"> & { id?: string }) => string;\n removeFlag: (id: string) => void;\n clearAll: () => void;\n}\n\n// ─── Constants ────────────────────────────────────────────────────────────────\n\nconst DEFAULT_AUTO_DISMISS = 8000;\n\nconst variantBorder: Record<FlagVariant, string> = {\n info: \"border-l-blue-500\",\n success: \"border-l-green-500\",\n warning: \"border-l-amber-500\",\n error: \"border-l-red-500\",\n};\n\nconst variantProgressBar: Record<FlagVariant, string> = {\n info: \"bg-blue-500\",\n success: \"bg-green-500\",\n warning: \"bg-amber-500\",\n error: \"bg-red-500\",\n};\n\nconst variantIconColor: Record<FlagVariant, string> = {\n info: \"text-blue-500\",\n success: \"text-green-500\",\n warning: \"text-amber-500\",\n error: \"text-red-500\",\n};\n\nconst defaultIcons: Record<FlagVariant, React.ElementType> = {\n info: Info,\n success: CheckCircle2,\n warning: AlertTriangle,\n error: XCircle,\n};\n\n// ─── Flag ─────────────────────────────────────────────────────────────────────\n\nconst Flag = React.forwardRef<HTMLDivElement, FlagProps>(\n (\n {\n className,\n title,\n description,\n variant = \"info\",\n icon,\n onDismiss,\n autoDismiss = DEFAULT_AUTO_DISMISS,\n actions,\n ...props\n },\n ref\n ) => {\n const [progress, setProgress] = React.useState(100);\n const pausedRef = React.useRef(false);\n const startTimeRef = React.useRef<number | null>(null);\n const elapsedRef = React.useRef(0);\n const rafRef = React.useRef<number | null>(null);\n const duration = autoDismiss === false ? null : autoDismiss;\n\n React.useEffect(() => {\n if (duration === null) return;\n\n const tick = (now: number) => {\n if (pausedRef.current) {\n startTimeRef.current = now;\n rafRef.current = requestAnimationFrame(tick);\n return;\n }\n if (startTimeRef.current === null) startTimeRef.current = now;\n elapsedRef.current += now - startTimeRef.current;\n startTimeRef.current = now;\n\n const remaining = Math.max(0, duration - elapsedRef.current);\n const pct = (remaining / duration) * 100;\n setProgress(pct);\n\n if (remaining <= 0) {\n onDismiss?.();\n return;\n }\n rafRef.current = requestAnimationFrame(tick);\n };\n\n rafRef.current = requestAnimationFrame(tick);\n return () => {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [duration]);\n\n const handleMouseEnter = () => {\n pausedRef.current = true;\n };\n const handleMouseLeave = () => {\n pausedRef.current = false;\n startTimeRef.current = null;\n };\n\n const DefaultIcon = defaultIcons[variant];\n const renderedIcon = icon ?? <DefaultIcon className={cn(\"size-4 shrink-0 mt-0.5\", variantIconColor[variant])} aria-hidden />;\n\n return (\n <div\n ref={ref}\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n className={cn(\n \"relative w-80 overflow-hidden rounded-xl border border-border bg-card shadow-lg\",\n \"border-l-4\",\n variantBorder[variant],\n className\n )}\n {...props}\n >\n {/* Body */}\n <div className=\"flex gap-3 p-4 pr-10\">\n {renderedIcon}\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-semibold text-card-foreground leading-snug\">{title}</p>\n {description && (\n <p className=\"mt-1 text-sm text-muted-foreground leading-relaxed\">{description}</p>\n )}\n {actions && actions.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {actions.map((action) => (\n <button\n key={action.label}\n type=\"button\"\n onClick={action.onClick}\n className=\"text-xs font-medium text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded\"\n >\n {action.label}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Close button */}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label=\"Dismiss notification\"\n onClick={onDismiss}\n className=\"absolute top-3 right-3 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-3.5\" aria-hidden />\n </button>\n )}\n\n {/* Auto-dismiss progress bar */}\n {duration !== null && (\n <div className=\"absolute bottom-0 left-0 right-0 h-0.5 bg-muted\">\n <div\n className={cn(\"h-full transition-none\", variantProgressBar[variant])}\n style={{ width: `${progress}%` }}\n />\n </div>\n )}\n </div>\n );\n }\n);\nFlag.displayName = \"Flag\";\n\n// ─── FlagGroup ────────────────────────────────────────────────────────────────\n\nconst positionClasses: Record<FlagGroupPosition, string> = {\n \"bottom-right\": \"bottom-4 right-4 flex-col-reverse\",\n \"bottom-left\": \"bottom-4 left-4 flex-col-reverse\",\n \"top-right\": \"top-4 right-4 flex-col\",\n \"top-left\": \"top-4 left-4 flex-col\",\n};\n\nconst FlagGroup = React.forwardRef<HTMLDivElement, FlagGroupProps>(\n ({ className, position = \"bottom-right\", children, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"fixed z-50 flex gap-2\",\n positionClasses[position],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n);\nFlagGroup.displayName = \"FlagGroup\";\n\n// ─── useFlagGroup ─────────────────────────────────────────────────────────────\n\nfunction useFlagGroup(): UseFlagGroupReturn {\n const [flags, setFlags] = React.useState<Array<FlagProps & { id: string }>>([]);\n\n const removeFlag = React.useCallback((id: string) => {\n setFlags((prev) => prev.filter((f) => f.id !== id));\n }, []);\n\n const addFlag = React.useCallback(\n (flag: Omit<FlagProps, \"onDismiss\"> & { id?: string }): string => {\n const id = flag.id ?? `flag-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;\n setFlags((prev) => [...prev, { ...flag, id, onDismiss: () => removeFlag(id) }]);\n return id;\n },\n [removeFlag]\n );\n\n const clearAll = React.useCallback(() => {\n setFlags([]);\n }, []);\n\n return { flags, addFlag, removeFlag, clearAll };\n}\n\n// ─── Exports ──────────────────────────────────────────────────────────────────\n\nexport { Flag, FlagGroup, useFlagGroup };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Breakpoint type\n// ---------------------------------------------------------------------------\n\nexport type Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Ordered list — index used for comparison */\nconst BREAKPOINT_ORDER: Breakpoint[] = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n\n/** Tailwind min-width values aligned with default config */\nconst BREAKPOINT_MIN_WIDTH: Record<Breakpoint, number> = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536,\n};\n\nfunction bpIndex(bp: Breakpoint): number {\n return BREAKPOINT_ORDER.indexOf(bp);\n}\n\n// ---------------------------------------------------------------------------\n// Show\n// ---------------------------------------------------------------------------\n\nexport interface ShowProps extends React.HTMLAttributes<HTMLElement> {\n /** Render children at this breakpoint and above. */\n above?: Breakpoint;\n /** Render children strictly below this breakpoint. */\n below?: Breakpoint;\n /** HTML element to render. Defaults to \"div\". */\n as?: React.ElementType;\n /** Display value to restore when visible. Defaults to \"block\". */\n display?: \"block\" | \"flex\" | \"inline\" | \"inline-block\" | \"grid\" | \"inline-flex\";\n children?: React.ReactNode;\n}\n\nconst DISPLAY_ABOVE_CLASS: Record<\n Breakpoint,\n Record<ShowProps[\"display\"] & string, string>\n> = {\n sm: {\n block: \"sm:block\",\n flex: \"sm:flex\",\n inline: \"sm:inline\",\n \"inline-block\": \"sm:inline-block\",\n grid: \"sm:grid\",\n \"inline-flex\": \"sm:inline-flex\",\n },\n md: {\n block: \"md:block\",\n flex: \"md:flex\",\n inline: \"md:inline\",\n \"inline-block\": \"md:inline-block\",\n grid: \"md:grid\",\n \"inline-flex\": \"md:inline-flex\",\n },\n lg: {\n block: \"lg:block\",\n flex: \"lg:flex\",\n inline: \"lg:inline\",\n \"inline-block\": \"lg:inline-block\",\n grid: \"lg:grid\",\n \"inline-flex\": \"lg:inline-flex\",\n },\n xl: {\n block: \"xl:block\",\n flex: \"xl:flex\",\n inline: \"xl:inline\",\n \"inline-block\": \"xl:inline-block\",\n grid: \"xl:grid\",\n \"inline-flex\": \"xl:inline-flex\",\n },\n \"2xl\": {\n block: \"2xl:block\",\n flex: \"2xl:flex\",\n inline: \"2xl:inline\",\n \"inline-block\": \"2xl:inline-block\",\n grid: \"2xl:grid\",\n \"inline-flex\": \"2xl:inline-flex\",\n },\n};\n\n/** Tailwind class to hide at a breakpoint and above */\nconst HIDDEN_ABOVE_CLASS: Record<Breakpoint, string> = {\n sm: \"sm:hidden\",\n md: \"md:hidden\",\n lg: \"lg:hidden\",\n xl: \"xl:hidden\",\n \"2xl\": \"2xl:hidden\",\n};\n\nexport const Show = React.forwardRef<HTMLElement, ShowProps>(\n (\n {\n above,\n below,\n as: Tag = \"div\",\n display = \"block\",\n className,\n children,\n ...props\n },\n ref\n ) => {\n let visibilityClass: string;\n\n if (above) {\n // hidden by default, become visible at `above` breakpoint\n visibilityClass = cn(\"hidden\", DISPLAY_ABOVE_CLASS[above][display]);\n } else if (below) {\n // visible by default, hidden at `below` breakpoint and above\n visibilityClass = HIDDEN_ABOVE_CLASS[below];\n } else {\n visibilityClass = \"\";\n }\n\n return (\n <Tag\n ref={ref}\n className={cn(visibilityClass, className)}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nShow.displayName = \"Show\";\n\n// ---------------------------------------------------------------------------\n// Hide\n// ---------------------------------------------------------------------------\n\nexport interface HideProps extends React.HTMLAttributes<HTMLElement> {\n /** Hide children at this breakpoint and above. */\n above?: Breakpoint;\n /** Hide children strictly below this breakpoint (i.e. visible at/above). */\n below?: Breakpoint;\n /** HTML element to render. Defaults to \"div\". */\n as?: React.ElementType;\n /** Display value to restore when visible. Defaults to \"block\". */\n display?: \"block\" | \"flex\" | \"inline\" | \"inline-block\" | \"grid\" | \"inline-flex\";\n children?: React.ReactNode;\n}\n\nexport const Hide = React.forwardRef<HTMLElement, HideProps>(\n (\n {\n above,\n below,\n as: Tag = \"div\",\n display = \"block\",\n className,\n children,\n ...props\n },\n ref\n ) => {\n let visibilityClass: string;\n\n if (above) {\n // visible by default, hidden at `above` breakpoint and above\n visibilityClass = HIDDEN_ABOVE_CLASS[above];\n } else if (below) {\n // hidden by default (below breakpoint), visible at/above breakpoint — inverse of Show above\n visibilityClass = cn(\"hidden\", DISPLAY_ABOVE_CLASS[below][display]);\n } else {\n visibilityClass = \"\";\n }\n\n return (\n <Tag\n ref={ref}\n className={cn(visibilityClass, className)}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nHide.displayName = \"Hide\";\n\n// ---------------------------------------------------------------------------\n// useBreakpoint hook\n// ---------------------------------------------------------------------------\n\nfunction getActiveBreakpoint(): Breakpoint | null {\n if (typeof window === \"undefined\") return null;\n // Walk from largest to smallest — first match wins\n for (let i = BREAKPOINT_ORDER.length - 1; i >= 0; i--) {\n const bp = BREAKPOINT_ORDER[i];\n if (window.matchMedia(`(min-width: ${BREAKPOINT_MIN_WIDTH[bp]}px)`).matches) {\n return bp;\n }\n }\n return null;\n}\n\nexport interface UseBreakpointReturn {\n /** The currently active (highest matching) breakpoint, or null on SSR / xs viewport. */\n breakpoint: Breakpoint | null;\n /** Returns true when the viewport is at or above `bp`. */\n isAbove: (bp: Breakpoint) => boolean;\n /** Returns true when the viewport is strictly below `bp`. */\n isBelow: (bp: Breakpoint) => boolean;\n /** True when no breakpoint is active (viewport < 640 px). */\n isMobile: boolean;\n /** True when active breakpoint is md (768–1023 px). */\n isTablet: boolean;\n /** True when active breakpoint is lg or above (≥ 1024 px). */\n isDesktop: boolean;\n}\n\nexport function useBreakpoint(): UseBreakpointReturn {\n const [breakpoint, setBreakpoint] = React.useState<Breakpoint | null>(() =>\n getActiveBreakpoint()\n );\n\n React.useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n // Build one MediaQueryList per breakpoint and attach listeners\n const queries = BREAKPOINT_ORDER.map((bp) =>\n window.matchMedia(`(min-width: ${BREAKPOINT_MIN_WIDTH[bp]}px)`)\n );\n\n function handleChange() {\n setBreakpoint(getActiveBreakpoint());\n }\n\n queries.forEach((mql) => mql.addEventListener(\"change\", handleChange));\n // Sync once on mount (handles SSR hydration mismatch)\n handleChange();\n\n return () => {\n queries.forEach((mql) => mql.removeEventListener(\"change\", handleChange));\n };\n }, []);\n\n const isAbove = React.useCallback(\n (bp: Breakpoint): boolean => {\n if (breakpoint === null) return false;\n return bpIndex(breakpoint) >= bpIndex(bp);\n },\n [breakpoint]\n );\n\n const isBelow = React.useCallback(\n (bp: Breakpoint): boolean => {\n if (breakpoint === null) return true;\n return bpIndex(breakpoint) < bpIndex(bp);\n },\n [breakpoint]\n );\n\n return {\n breakpoint,\n isAbove,\n isBelow,\n isMobile: breakpoint === null,\n isTablet: breakpoint === \"md\",\n isDesktop: breakpoint !== null && bpIndex(breakpoint) >= bpIndex(\"lg\"),\n };\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { Check, ChevronDown, Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nexport interface Country {\n code: string;\n name: string;\n flag: string;\n dialCode: string;\n}\n\nexport const COUNTRIES: Country[] = [\n { code: \"US\", name: \"United States\", flag: \"🇺🇸\", dialCode: \"+1\" },\n { code: \"GB\", name: \"United Kingdom\", flag: \"🇬🇧\", dialCode: \"+44\" },\n { code: \"IN\", name: \"India\", flag: \"🇮🇳\", dialCode: \"+91\" },\n { code: \"AU\", name: \"Australia\", flag: \"🇦🇺\", dialCode: \"+61\" },\n { code: \"CA\", name: \"Canada\", flag: \"🇨🇦\", dialCode: \"+1\" },\n { code: \"DE\", name: \"Germany\", flag: \"🇩🇪\", dialCode: \"+49\" },\n { code: \"FR\", name: \"France\", flag: \"🇫🇷\", dialCode: \"+33\" },\n { code: \"JP\", name: \"Japan\", flag: \"🇯🇵\", dialCode: \"+81\" },\n { code: \"SG\", name: \"Singapore\", flag: \"🇸🇬\", dialCode: \"+65\" },\n { code: \"AE\", name: \"United Arab Emirates\", flag: \"🇦🇪\", dialCode: \"+971\" },\n { code: \"CN\", name: \"China\", flag: \"🇨🇳\", dialCode: \"+86\" },\n { code: \"BR\", name: \"Brazil\", flag: \"🇧🇷\", dialCode: \"+55\" },\n { code: \"MX\", name: \"Mexico\", flag: \"🇲🇽\", dialCode: \"+52\" },\n { code: \"KR\", name: \"South Korea\", flag: \"🇰🇷\", dialCode: \"+82\" },\n { code: \"IT\", name: \"Italy\", flag: \"🇮🇹\", dialCode: \"+39\" },\n { code: \"ES\", name: \"Spain\", flag: \"🇪🇸\", dialCode: \"+34\" },\n { code: \"NL\", name: \"Netherlands\", flag: \"🇳🇱\", dialCode: \"+31\" },\n { code: \"SE\", name: \"Sweden\", flag: \"🇸🇪\", dialCode: \"+46\" },\n { code: \"NO\", name: \"Norway\", flag: \"🇳🇴\", dialCode: \"+47\" },\n { code: \"DK\", name: \"Denmark\", flag: \"🇩🇰\", dialCode: \"+45\" },\n { code: \"FI\", name: \"Finland\", flag: \"🇫🇮\", dialCode: \"+358\" },\n { code: \"CH\", name: \"Switzerland\", flag: \"🇨🇭\", dialCode: \"+41\" },\n { code: \"NZ\", name: \"New Zealand\", flag: \"🇳🇿\", dialCode: \"+64\" },\n { code: \"ZA\", name: \"South Africa\", flag: \"🇿🇦\", dialCode: \"+27\" },\n { code: \"NG\", name: \"Nigeria\", flag: \"🇳🇬\", dialCode: \"+234\" },\n { code: \"EG\", name: \"Egypt\", flag: \"🇪🇬\", dialCode: \"+20\" },\n { code: \"PK\", name: \"Pakistan\", flag: \"🇵🇰\", dialCode: \"+92\" },\n { code: \"BD\", name: \"Bangladesh\", flag: \"🇧🇩\", dialCode: \"+880\" },\n { code: \"ID\", name: \"Indonesia\", flag: \"🇮🇩\", dialCode: \"+62\" },\n { code: \"TH\", name: \"Thailand\", flag: \"🇹🇭\", dialCode: \"+66\" },\n];\n\nexport interface CountrySelectProps {\n value?: string;\n onValueChange?: (code: string) => void;\n placeholder?: string;\n showDialCode?: boolean;\n disabled?: boolean;\n className?: string;\n}\n\nconst CountrySelect = React.forwardRef<HTMLButtonElement, CountrySelectProps>(\n (\n {\n value,\n onValueChange,\n placeholder = \"Select country\",\n showDialCode = false,\n disabled = false,\n className,\n },\n ref\n ) => {\n const [open, setOpen] = React.useState(false);\n const [search, setSearch] = React.useState(\"\");\n const searchRef = React.useRef<HTMLInputElement>(null);\n\n const selected = React.useMemo(\n () => COUNTRIES.find((c) => c.code === value),\n [value]\n );\n\n const filtered = React.useMemo(() => {\n const q = search.trim().toLowerCase();\n if (!q) return COUNTRIES;\n return COUNTRIES.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.code.toLowerCase().includes(q) ||\n c.dialCode.includes(q)\n );\n }, [search]);\n\n React.useEffect(() => {\n if (open) {\n // Delay focus until popover has mounted\n const id = setTimeout(() => searchRef.current?.focus(), 0);\n return () => clearTimeout(id);\n } else {\n setSearch(\"\");\n }\n }, [open]);\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n className={cn(\n \"flex h-11 min-h-11 w-full items-center justify-between gap-2.5 rounded-lg border border-border bg-card px-4 text-[15px] text-foreground shadow-sm\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n !selected && \"text-muted-foreground\",\n className\n )}\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n {selected ? (\n <>\n <span className=\"text-base leading-none\" aria-hidden=\"true\">\n {selected.flag}\n </span>\n <span className=\"truncate\">{selected.name}</span>\n {showDialCode && (\n <span className=\"shrink-0 text-muted-foreground\">\n {selected.dialCode}\n </span>\n )}\n </>\n ) : (\n <span>{placeholder}</span>\n )}\n </span>\n <ChevronDown\n className={cn(\n \"h-4 w-4 shrink-0 text-muted-foreground opacity-70 transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\"\n )}\n aria-hidden=\"true\"\n />\n </button>\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal>\n {/* Takes over the scroll lock when this opens inside a Dialog or\n Drawer, so the list can be scrolled. See `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={6}\n className={cn(\n \"z-[120] w-[var(--radix-popover-trigger-width)] min-w-[260px] rounded-xl border border-border bg-popover text-popover-foreground shadow-lg outline-none\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\"\n )}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {/* Search */}\n <div className=\"flex items-center gap-2 border-b border-border px-3 py-2.5\">\n <Search className=\"h-4 w-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <input\n ref={searchRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search countries…\"\n className={cn(\n \"flex-1 bg-transparent text-[14px] text-foreground placeholder:text-muted-foreground\",\n \"focus-visible:outline-none\"\n )}\n aria-label=\"Search countries\"\n />\n {search && (\n <button\n type=\"button\"\n onClick={() => setSearch(\"\")}\n className=\"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-pg-fast ease-pg-standard\"\n aria-label=\"Clear search\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n </button>\n )}\n </div>\n\n {/* List */}\n <div\n role=\"listbox\"\n aria-label=\"Countries\"\n className=\"max-h-64 overflow-y-auto p-1\"\n >\n {filtered.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">\n No countries found\n </div>\n ) : (\n filtered.map((country) => {\n const isSelected = country.code === value;\n return (\n <button\n key={country.code}\n role=\"option\"\n aria-selected={isSelected}\n type=\"button\"\n onClick={() => {\n onValueChange?.(country.code);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"hover:bg-muted\",\n isSelected && \"bg-muted/60\"\n )}\n >\n <span className=\"text-base leading-none\" aria-hidden=\"true\">\n {country.flag}\n </span>\n <span className=\"flex-1 truncate text-foreground\">\n {country.name}\n </span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">\n {country.dialCode}\n </span>\n {isSelected && (\n <Check\n className=\"h-3.5 w-3.5 shrink-0 text-primary\"\n aria-hidden=\"true\"\n />\n )}\n </button>\n );\n })\n )}\n </div>\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n }\n);\nCountrySelect.displayName = \"CountrySelect\";\n\nexport { CountrySelect };\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { Loader2 } from \"lucide-react\";\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nexport interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n \"aria-label\": string;\n variant?: \"primary\" | \"secondary\" | \"ghost\" | \"outline\" | \"danger\";\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n isLoading?: boolean;\n rounded?: \"sm\" | \"md\" | \"lg\" | \"full\";\n}\n\nconst variantClasses: Record<NonNullable<IconButtonProps[\"variant\"]>, string> = {\n primary:\n \"bg-primary text-primary-foreground border border-primary shadow-sm hover:bg-[var(--primary-hover)]\",\n secondary:\n \"bg-muted text-foreground border border-border shadow-sm hover:bg-muted/85 dark:bg-muted/35 dark:text-foreground dark:border-border dark:hover:bg-muted/55\",\n ghost:\n \"bg-transparent text-foreground border border-transparent hover:bg-muted focus-visible:bg-muted/80 active:bg-muted/90\",\n outline:\n \"bg-card text-foreground border border-border shadow-sm hover:bg-muted\",\n danger:\n \"bg-red-600 text-white border border-red-600 shadow-sm hover:bg-red-700\",\n};\n\nconst sizeClasses: Record<NonNullable<IconButtonProps[\"size\"]>, string> = {\n xs: \"size-7 min-w-7\",\n sm: \"size-8 min-w-8\",\n md: \"size-9 min-w-9\",\n lg: \"size-10 min-w-10\",\n xl: \"size-11 min-w-11\",\n};\n\nconst iconSizeClasses: Record<NonNullable<IconButtonProps[\"size\"]>, string> = {\n xs: \"size-3.5\",\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-[1.125rem]\",\n xl: \"size-5\",\n};\n\nconst roundedClasses: Record<NonNullable<IconButtonProps[\"rounded\"]>, string> = {\n sm: \"rounded-md\",\n md: \"rounded-lg\",\n lg: \"rounded-xl\",\n full: \"rounded-full\",\n};\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n variant = \"primary\",\n size = \"md\",\n isLoading = false,\n rounded = \"lg\",\n className,\n disabled,\n children,\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n return (\n <button\n ref={ref}\n aria-label={ariaLabel}\n title={ariaLabel}\n disabled={disabled || isLoading}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center font-medium\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n variantClasses[variant],\n sizeClasses[size],\n roundedClasses[rounded],\n className\n )}\n {...props}\n >\n {isLoading ? (\n <Loader2 className={cn(\"animate-spin\", iconSizeClasses[size])} />\n ) : (\n children\n )}\n </button>\n );\n }\n);\nIconButton.displayName = \"IconButton\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { Clock, ChevronDown, X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\n/* ─── Types ──────────────────────────────────────────────────────────────── */\n\nexport interface TimePickerProps {\n /** Controlled value in 24-hour \"HH:MM\" format. Pass \"\" for no selection. */\n value: string;\n /** Called with a new \"HH:MM\" string, or \"\" when cleared. */\n onValueChange: (value: string) => void;\n /** Show 12-hour (AM/PM) columns instead of 24-hour. Default: false. */\n use24Hour?: boolean;\n placeholder?: string;\n label?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/* ─── Helpers ────────────────────────────────────────────────────────────── */\n\nfunction pad(n: number) {\n return String(n).padStart(2, \"0\");\n}\n\nfunction parseHHMM(v: string): { h: number; m: number } | null {\n if (!v) return null;\n const parts = v.split(\":\");\n if (parts.length < 2) return null;\n const h = Number(parts[0]);\n const m = Number(parts[1]);\n if (isNaN(h) || isNaN(m)) return null;\n return { h, m };\n}\n\nfunction toHHMM(h: number, m: number) {\n return `${pad(h)}:${pad(m)}`;\n}\n\nfunction displayTime(value: string, use24Hour: boolean) {\n const p = parseHHMM(value);\n if (!p) return \"\";\n if (use24Hour) return `${pad(p.h)}:${pad(p.m)}`;\n const period = p.h < 12 ? \"AM\" : \"PM\";\n const displayH = p.h % 12 === 0 ? 12 : p.h % 12;\n return `${pad(displayH)}:${pad(p.m)} ${period}`;\n}\n\n/* ─── ScrollColumn ───────────────────────────────────────────────────────── */\n\nconst ITEM_H = 36; // px\nconst VISIBLE = 5; // items visible at once\nconst PAD = 2; // invisible padding rows above/below\n\ninterface ScrollColumnProps<T> {\n items: T[];\n selected: T;\n onSelect: (item: T) => void;\n renderItem: (item: T) => React.ReactNode;\n getKey: (item: T) => string | number;\n}\n\nfunction ScrollColumn<T>({\n items,\n selected,\n onSelect,\n renderItem,\n getKey,\n}: ScrollColumnProps<T>) {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const debounceRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const programmaticRef = React.useRef(false);\n\n const selectedIndex = items.findIndex((item) => getKey(item) === getKey(selected));\n\n /* Scroll to selected item */\n const scrollToIndex = React.useCallback(\n (index: number, behavior: ScrollBehavior = \"smooth\") => {\n const el = containerRef.current;\n if (!el) return;\n programmaticRef.current = true;\n el.scrollTo({ top: index * ITEM_H, behavior });\n if (behavior === \"smooth\") {\n // Release flag after animation\n setTimeout(() => {\n programmaticRef.current = false;\n }, 350);\n } else {\n programmaticRef.current = false;\n }\n },\n []\n );\n\n /* Initial scroll (instant) */\n React.useEffect(() => {\n if (selectedIndex >= 0) scrollToIndex(selectedIndex, \"instant\");\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /* Scroll when selected changes from outside */\n React.useEffect(() => {\n if (selectedIndex >= 0) scrollToIndex(selectedIndex, \"smooth\");\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedIndex]);\n\n /* Snap on scroll end */\n function handleScroll() {\n if (programmaticRef.current) return;\n if (debounceRef.current) clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n const el = containerRef.current;\n if (!el) return;\n const index = Math.round(el.scrollTop / ITEM_H);\n const clamped = Math.max(0, Math.min(index, items.length - 1));\n onSelect(items[clamped]);\n scrollToIndex(clamped, \"smooth\");\n }, 80);\n }\n\n return (\n <div className=\"relative flex flex-col items-center\" style={{ width: 64 }}>\n {/* Highlight band */}\n <div\n className=\"pointer-events-none absolute left-0 right-0 rounded-lg bg-primary/10\"\n style={{\n top: PAD * ITEM_H,\n height: ITEM_H,\n zIndex: 1,\n }}\n />\n\n {/* Scroll container */}\n <div\n ref={containerRef}\n onScroll={handleScroll}\n className=\"relative z-10 overflow-y-scroll\"\n style={{\n height: VISIBLE * ITEM_H,\n scrollSnapType: \"y mandatory\",\n scrollbarWidth: \"none\",\n msOverflowStyle: \"none\",\n }}\n >\n {/* Top padding rows */}\n {Array.from({ length: PAD }).map((_, i) => (\n <div key={`pad-top-${i}`} style={{ height: ITEM_H }} />\n ))}\n\n {items.map((item) => {\n const isSelected = getKey(item) === getKey(selected);\n return (\n <div\n key={getKey(item)}\n onClick={() => {\n onSelect(item);\n scrollToIndex(items.findIndex((it) => getKey(it) === getKey(item)), \"smooth\");\n }}\n className={cn(\n \"flex cursor-pointer items-center justify-center text-[14px] font-medium transition-colors duration-150 select-none\",\n isSelected\n ? \"text-primary font-semibold\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n style={{\n height: ITEM_H,\n scrollSnapAlign: \"start\",\n }}\n >\n {renderItem(item)}\n </div>\n );\n })}\n\n {/* Bottom padding rows */}\n {Array.from({ length: PAD }).map((_, i) => (\n <div key={`pad-bot-${i}`} style={{ height: ITEM_H }} />\n ))}\n </div>\n </div>\n );\n}\n\n/* ─── TimePicker ─────────────────────────────────────────────────────────── */\n\nconst PANEL_W = 224;\nconst PANEL_H = 220;\n\nexport const TimePicker = React.forwardRef<HTMLButtonElement, TimePickerProps>(\n (\n {\n value,\n onValueChange,\n use24Hour = false,\n placeholder = \"Select time\",\n label,\n disabled = false,\n className,\n },\n ref\n ) => {\n const parsed = parseHHMM(value);\n\n /* ── Local column state (derived from value, kept in sync) ── */\n const [hour, setHour] = React.useState<number>(() => {\n if (!parsed) return use24Hour ? 0 : 12;\n if (use24Hour) return parsed.h;\n return parsed.h % 12 === 0 ? 12 : parsed.h % 12;\n });\n const [minute, setMinute] = React.useState<number>(() => parsed?.m ?? 0);\n const [period, setPeriod] = React.useState<\"AM\" | \"PM\">(() => {\n if (!parsed) return \"AM\";\n return parsed.h < 12 ? \"AM\" : \"PM\";\n });\n\n /* Sync columns when value prop changes */\n React.useEffect(() => {\n const p = parseHHMM(value);\n if (p) {\n setMinute(p.m);\n if (use24Hour) {\n setHour(p.h);\n } else {\n setHour(p.h % 12 === 0 ? 12 : p.h % 12);\n setPeriod(p.h < 12 ? \"AM\" : \"PM\");\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n /* ── Panel open/position ── */\n const [open, setOpen] = React.useState(false);\n const [panelPos, setPanelPos] = React.useState({ top: 0, left: 0 });\n const [mounted, setMounted] = React.useState(false);\n\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => { setMounted(true); }, []);\n\n function openPanel() {\n if (disabled) return;\n const el = triggerRef.current;\n if (!el) return;\n el.scrollIntoView({ block: \"nearest\", behavior: \"auto\" });\n requestAnimationFrame(() => {\n if (!triggerRef.current) return;\n const rect = triggerRef.current.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n let left = rect.left;\n if (left + PANEL_W > vw - 8) left = vw - PANEL_W - 8;\n let top = rect.bottom + 6;\n if (top + PANEL_H > vh - 8) top = rect.top - PANEL_H - 6;\n setPanelPos({ top, left });\n setOpen(true);\n });\n }\n\n /* Close on outside click */\n React.useEffect(() => {\n if (!open) return;\n function handler(e: MouseEvent) {\n const inTrigger = triggerRef.current?.contains(e.target as Node);\n const inPanel = panelRef.current?.contains(e.target as Node);\n if (!inTrigger && !inPanel) setOpen(false);\n }\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n /* ── Emit value when columns change ── */\n function emitChange(h: number, m: number, p: \"AM\" | \"PM\") {\n let h24 = h;\n if (!use24Hour) {\n if (p === \"AM\") h24 = h === 12 ? 0 : h;\n else h24 = h === 12 ? 12 : h + 12;\n }\n onValueChange(toHHMM(h24, m));\n }\n\n function handleHourChange(h: number) {\n setHour(h);\n emitChange(h, minute, period);\n }\n function handleMinuteChange(m: number) {\n setMinute(m);\n emitChange(hour, m, period);\n }\n function handlePeriodChange(p: \"AM\" | \"PM\") {\n setPeriod(p);\n emitChange(hour, minute, p);\n }\n\n /* ── Column data ── */\n const hours = use24Hour\n ? Array.from({ length: 24 }, (_, i) => i)\n : Array.from({ length: 12 }, (_, i) => i + 1);\n\n const minutes = Array.from({ length: 60 }, (_, i) => i);\n\n /* ── Clear ── */\n function handleClear(e: React.MouseEvent) {\n e.stopPropagation();\n onValueChange(\"\");\n }\n\n /* ── Panel ── */\n /**\n * Wrapped in `RemoveScroll` so the columns can be scrolled inside a modal\n * Dialog or Drawer.\n *\n * Radix's Dialog renders its overlay inside `RemoveScroll` with only\n * `Dialog.Content` as a shard. This panel is portaled to `document.body`, so\n * it is neither the lock container nor a shard, and react-remove-scroll's\n * `shouldPrevent` calls `preventDefault()` on every wheel and touch event it\n * receives — leaving only the rows already on screen reachable, and every\n * other time selectable solely by clicking two rows at a time.\n *\n * Mounting our own lock pushes it to the top of react-remove-scroll's\n * `lockStack`, and the sidecar bails out for any lock that is not the last\n * one, so this panel's scrolling is honoured while the dialog's own lock\n * still holds for the page behind it. It is the same thing Radix `Select`\n * does with its content, and the reason a Select works inside a dialog where\n * this panel did not.\n *\n * Enabled unconditionally rather than only inside a dialog: the panel's\n * position is `fixed` and computed once on open, so locking the page also\n * stops it drifting away from its trigger on a scrollable page.\n */\n const panel = open ? (\n <RemoveScroll allowPinchZoom>\n <div\n ref={panelRef}\n className={cn(\n \"isolate rounded-xl border border-border bg-popover text-popover-foreground shadow-lg\",\n \"flex flex-col gap-0\"\n )}\n style={{\n position: \"fixed\",\n top: panelPos.top,\n left: panelPos.left,\n width: PANEL_W,\n zIndex: 20000,\n // See DatePicker: a modal Radix Dialog puts `pointer-events: none`\n // on <body>, which this portaled panel would otherwise inherit —\n // the columns rendered but no row could be clicked.\n pointerEvents: \"auto\",\n }}\n >\n {/* Header */}\n <div className=\"flex items-center gap-1.5 border-b border-border px-4 py-2.5\">\n <Clock className=\"size-3.5 text-muted-foreground\" />\n <span className=\"text-[13px] font-medium text-muted-foreground\">\n {value ? displayTime(value, use24Hour) : \"—\"}\n </span>\n </div>\n\n {/* Column labels */}\n <div\n className=\"flex items-center justify-around px-2 pt-2 pb-0.5\"\n style={{ paddingLeft: 8, paddingRight: use24Hour ? 8 : 8 }}\n >\n <span className=\"w-16 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n Hr\n </span>\n <span className=\"w-16 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n Min\n </span>\n {!use24Hour && (\n <span className=\"w-16 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n AM/PM\n </span>\n )}\n </div>\n\n {/* Columns */}\n <div className=\"flex items-center justify-around px-2 pb-3\">\n <ScrollColumn\n items={hours}\n selected={hour}\n onSelect={handleHourChange}\n renderItem={(h) => pad(h)}\n getKey={(h) => h}\n />\n <div className=\"text-[18px] font-light text-muted-foreground/50 pb-0.5\">:</div>\n <ScrollColumn\n items={minutes}\n selected={minute}\n onSelect={handleMinuteChange}\n renderItem={(m) => pad(m)}\n getKey={(m) => m}\n />\n {!use24Hour && (\n <>\n <div className=\"w-px self-stretch bg-border mx-1\" />\n <ScrollColumn\n items={[\"AM\", \"PM\"] as const}\n selected={period}\n onSelect={handlePeriodChange}\n renderItem={(p) => p}\n getKey={(p) => p}\n />\n </>\n )}\n </div>\n </div>\n </RemoveScroll>\n ) : null;\n\n /* ── Merge refs ── */\n function mergeRef(el: HTMLButtonElement | null) {\n (triggerRef as React.MutableRefObject<HTMLButtonElement | null>).current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) (ref as React.MutableRefObject<HTMLButtonElement | null>).current = el;\n }\n\n return (\n <div className={cn(\"relative\", className)}>\n {label && (\n <p className=\"mb-1.5 text-sm font-medium text-foreground\">{label}</p>\n )}\n\n <button\n ref={mergeRef}\n type=\"button\"\n disabled={disabled}\n onClick={() => (open ? setOpen(false) : openPanel())}\n className={cn(\n \"flex h-11 min-h-11 w-full items-center gap-3 rounded-lg border border-border bg-card px-4 text-left text-[15px] shadow-sm\",\n \"transition-colors duration-150\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n open && \"border-ring ring-2 ring-ring/35\",\n !open && !disabled && \"hover:border-muted-foreground/45\",\n disabled && \"cursor-not-allowed opacity-50\"\n )}\n >\n <Clock className=\"size-[1.0625rem] shrink-0 text-muted-foreground\" />\n <span\n className={cn(\n \"flex-1 truncate\",\n value ? \"text-foreground\" : \"text-muted-foreground\"\n )}\n >\n {value ? displayTime(value, use24Hour) : placeholder}\n </span>\n {value && !disabled ? (\n <X\n className=\"size-3.5 shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150\"\n onClick={handleClear}\n />\n ) : (\n <ChevronDown\n className={cn(\n \"size-[1.0625rem] shrink-0 text-muted-foreground transition-transform duration-150\",\n open && \"rotate-180\"\n )}\n />\n )}\n </button>\n\n {/* Wrapped so the hour/minute columns can be scrolled when the picker\n opens inside a Dialog or Drawer. See `scroll-lock.tsx`. */}\n {mounted &&\n panel &&\n createPortal(<ScrollLockTakeover>{panel}</ScrollLockTakeover>, document.body)}\n </div>\n );\n }\n);\n\nTimePicker.displayName = \"TimePicker\";\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Heading\n// ---------------------------------------------------------------------------\n\nexport interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n as?: React.ElementType;\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n color?: \"default\" | \"subtle\" | \"primary\";\n}\n\nconst headingSizeClasses: Record<NonNullable<HeadingProps[\"size\"]>, string> = {\n xs: \"text-sm font-semibold\",\n sm: \"text-base font-semibold\",\n md: \"text-lg font-semibold\",\n lg: \"text-xl font-semibold\",\n xl: \"text-2xl font-semibold\",\n \"2xl\": \"text-3xl font-semibold tracking-tight\",\n \"3xl\": \"text-4xl font-semibold tracking-tight\",\n};\n\nconst headingColorClasses: Record<NonNullable<HeadingProps[\"color\"]>, string> = {\n default: \"text-foreground\",\n subtle: \"text-muted-foreground\",\n primary: \"text-primary\",\n};\n\nconst defaultSizeForLevel: Record<number, NonNullable<HeadingProps[\"size\"]>> = {\n 1: \"2xl\",\n 2: \"md\",\n 3: \"md\",\n 4: \"sm\",\n 5: \"xs\",\n 6: \"xs\",\n};\n\nexport const Heading = React.forwardRef<HTMLHeadingElement, HeadingProps>(\n (\n {\n level = 2,\n as,\n size,\n color = \"default\",\n className,\n children,\n ...props\n },\n ref\n ) => {\n const Tag = (as ?? (`h${level}` as React.ElementType)) as React.ElementType;\n const resolvedSize = size ?? defaultSizeForLevel[level] ?? \"md\";\n\n return (\n <Tag\n ref={ref}\n className={cn(\n headingSizeClasses[resolvedSize],\n headingColorClasses[color],\n className\n )}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nHeading.displayName = \"Heading\";\n\n// ---------------------------------------------------------------------------\n// Text\n// ---------------------------------------------------------------------------\n\nexport interface TextProps extends React.HTMLAttributes<HTMLElement> {\n as?: \"p\" | \"span\" | \"div\" | \"label\";\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\n weight?: \"normal\" | \"medium\" | \"semibold\";\n color?: \"default\" | \"subtle\" | \"primary\" | \"disabled\";\n truncate?: boolean;\n}\n\nconst textSizeClasses: Record<NonNullable<TextProps[\"size\"]>, string> = {\n xs: \"text-xs\",\n sm: \"text-sm\",\n md: \"text-base\",\n lg: \"text-lg\",\n};\n\nconst textWeightClasses: Record<NonNullable<TextProps[\"weight\"]>, string> = {\n normal: \"font-normal\",\n medium: \"font-medium\",\n semibold: \"font-semibold\",\n};\n\nconst textColorClasses: Record<NonNullable<TextProps[\"color\"]>, string> = {\n default: \"text-foreground\",\n subtle: \"text-muted-foreground\",\n primary: \"text-primary\",\n disabled: \"text-muted-foreground opacity-50\",\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const Text = React.forwardRef<any, TextProps>(\n (\n {\n as: Tag = \"p\",\n size = \"sm\",\n weight = \"normal\",\n color = \"default\",\n truncate = false,\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <Tag\n ref={ref}\n className={cn(\n textSizeClasses[size],\n textWeightClasses[weight],\n textColorClasses[color],\n truncate && \"truncate\",\n className\n )}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nText.displayName = \"Text\";\n\n// ---------------------------------------------------------------------------\n// MetricText\n// ---------------------------------------------------------------------------\n\nexport interface MetricTextProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n trend?: \"up\" | \"down\" | \"neutral\";\n prefix?: React.ReactNode;\n suffix?: React.ReactNode;\n}\n\nconst metricSizeClasses: Record<NonNullable<MetricTextProps[\"size\"]>, string> = {\n sm: \"text-xl\",\n md: \"text-2xl\",\n lg: \"text-3xl\",\n xl: \"text-4xl\",\n};\n\nconst metricTrendClasses: Record<NonNullable<MetricTextProps[\"trend\"]>, string> = {\n up: \"text-green-600\",\n down: \"text-red-600\",\n neutral: \"text-foreground\",\n};\n\nexport const MetricText = React.forwardRef<HTMLSpanElement, MetricTextProps>(\n (\n {\n size = \"md\",\n trend = \"neutral\",\n prefix,\n suffix,\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <span\n ref={ref}\n className={cn(\n \"font-semibold tabular-nums tracking-tight\",\n metricSizeClasses[size],\n metricTrendClasses[trend],\n className\n )}\n {...props}\n >\n {prefix != null && (\n <span className=\"mr-0.5 text-[0.75em] font-medium opacity-70\">\n {prefix}\n </span>\n )}\n {children}\n {suffix != null && (\n <span className=\"ml-0.5 text-[0.75em] font-medium opacity-70\">\n {suffix}\n </span>\n )}\n </span>\n );\n }\n);\nMetricText.displayName = \"MetricText\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport type ProgressIndicatorSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n selectedIndex: number;\n values: string[];\n size?: ProgressIndicatorSize;\n onChange?: (index: number) => void;\n}\n\nconst dotSizeMap: Record<ProgressIndicatorSize, { base: string; active: string }> = {\n sm: {\n base: \"h-1.5 w-1.5\",\n active: \"h-1.5 w-4\",\n },\n md: {\n base: \"h-2 w-2\",\n active: \"h-2 w-6\",\n },\n lg: {\n base: \"h-2.5 w-2.5\",\n active: \"h-2.5 w-8\",\n },\n};\n\nconst ProgressIndicator = React.forwardRef<HTMLDivElement, ProgressIndicatorProps>(\n ({ className, selectedIndex, values, size = \"md\", onChange, ...props }, ref) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!onChange) return;\n if (e.key === \"ArrowRight\") {\n e.preventDefault();\n const next = Math.min(selectedIndex + 1, values.length - 1);\n if (next !== selectedIndex) onChange(next);\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n const prev = Math.max(selectedIndex - 1, 0);\n if (prev !== selectedIndex) onChange(prev);\n }\n },\n [onChange, selectedIndex, values.length]\n );\n\n const sizes = dotSizeMap[size];\n\n return (\n <div\n ref={ref}\n role=\"tablist\"\n aria-label={props[\"aria-label\"] ?? \"Step indicator\"}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n className={cn(\"flex items-center gap-1.5 outline-none focus-visible:outline-none\", className)}\n {...props}\n >\n {values.map((label, index) => {\n const isActive = index === selectedIndex;\n return (\n <button\n key={index}\n type=\"button\"\n role=\"tab\"\n aria-label={label}\n aria-current={isActive ? \"step\" : undefined}\n aria-selected={isActive}\n tabIndex={-1}\n onClick={() => onChange?.(index)}\n className={cn(\n \"rounded-full transition-all duration-pg-normal ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n isActive\n ? cn(\"bg-primary\", sizes.active)\n : cn(\n \"bg-muted-foreground/30 hover:bg-muted-foreground/50\",\n sizes.base\n )\n )}\n />\n );\n })}\n </div>\n );\n }\n);\nProgressIndicator.displayName = \"ProgressIndicator\";\n\nexport { ProgressIndicator };\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface VisuallyHiddenProps extends React.HTMLAttributes<HTMLElement> {\n as?: React.ElementType;\n focusable?: boolean;\n}\n\nconst VisuallyHidden = React.forwardRef<HTMLElement, VisuallyHiddenProps>(\n ({ as: Component = \"span\", focusable = false, className, ...props }, ref) => (\n <Component\n ref={ref}\n className={cn(\n focusable\n ? \"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:px-4 focus:py-2 focus:bg-card focus:text-foreground focus:rounded-md focus:shadow-lg focus:ring-2 focus:ring-ring\"\n : \"sr-only\",\n className\n )}\n {...props}\n />\n )\n);\nVisuallyHidden.displayName = \"VisuallyHidden\";\n\nexport { VisuallyHidden };\n","\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from \"react\";\nimport {\n Check,\n ChevronLeft,\n ChevronRight,\n Plus,\n Search,\n SlidersHorizontal,\n X,\n} from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { DatePicker } from \"./date-picker\";\nimport { Input } from \"./input\";\nimport { Tabs, TabsList, TabsTrigger } from \"./tabs\";\nimport { IconButton } from \"./icon-button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Separator } from \"./separator\";\nimport { formatMonthLabel, MONTHS_SHORT } from \"./format-datetime\";\n\n/**\n * Bounds a popover by the space that is actually below (or above) the trigger,\n * rather than by a fixed pixel cap.\n *\n * A chip near the bottom of a long page has very little room beneath it, and a\n * `max-h-64` list plus a search box plus an Apply/Clear footer can easily run\n * past the fold — the last few options, and often Apply itself, end up\n * unreachable. Radix measures that space and publishes it as\n * `--radix-popover-content-available-height`; capping the content to it makes\n * the panel shrink to fit and its list scroll instead.\n *\n * The content becomes a flex column so the footer stays pinned to the bottom\n * while only the list scrolls. Panels pair this with `FILTER_SCROLL_AREA`.\n */\nconst POPOVER_FIT = \"flex max-h-[var(--radix-popover-content-available-height)] flex-col overflow-hidden\";\n\n/**\n * The scrolling half of a fitted popover: it takes whatever height is left over\n * once the fixed chrome has been laid out, never more than its own cap.\n * `min-h-0` is what lets a flex child shrink below its content height at all.\n */\nconst FILTER_SCROLL_AREA = \"min-h-0 flex-1 overflow-y-auto\";\n\nimport { cn } from \"./utils\";\n\nexport interface FilterChipOption {\n value: string;\n label: string;\n /** Optional leading glyph — a flag, a brand mark, a status dot. */\n icon?: ReactNode;\n /** Secondary text to the right, e.g. a matching count. */\n hint?: string;\n}\n\n// ── Group: one chip open at a time, without the flash ─────────────────────────\n\ntype FilterChipGroupContextValue = {\n openKey: string | null;\n setOpen: (key: string, open: boolean) => void;\n /**\n * True exactly once, for the chip that was closed to make way for another —\n * and clears itself on read. See `useFilterChipState`'s `onCloseAutoFocus`.\n */\n consumeHandoff: (key: string) => boolean;\n};\n\nconst FilterChipGroupContext = createContext<FilterChipGroupContextValue | null>(null);\n\n/**\n * Wraps a row of filter chips so only one popover is open at a time — and,\n * crucially, so switching between two chips does not make the second one flash.\n *\n * The flash comes from every chip sharing one `openChip` value while Radix\n * reports the two halves of the switch as separate events: the chip being\n * *opened* fires `onOpenChange(true)` and the chip being *dismissed* fires\n * `onOpenChange(false)`. A naive `setOpenChip(open ? key : null)` lets whichever\n * event lands second win, so when the dismissal lands second it wipes out the\n * chip that just opened — it mounts, paints, and unmounts.\n *\n * The fix is that a close only counts if the chip closing is still the one on\n * screen. A stale dismissal from the chip the user just left is then a no-op,\n * whatever order the events arrive in. This lives here rather than in each\n * toolbar because it is invisible until it is wrong, and it was wrong in every\n * toolbar that hand-rolled it.\n */\nexport function FilterChipGroup({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n const [openKey, setOpenKey] = useState<string | null>(null);\n\n /**\n * Mirrors `openKey` for synchronous reads. A switch is decided inside an\n * event handler, where the `openKey` from this render may already be stale.\n */\n const openKeyRef = useRef<string | null>(null);\n const frameRef = useRef<number | null>(null);\n /** The chip closed by a handoff, awaiting its close-auto-focus. */\n const handoffFromRef = useRef<string | null>(null);\n\n const apply = useCallback((next: string | null) => {\n openKeyRef.current = next;\n setOpenKey(next);\n }, []);\n\n /**\n * Opening a chip while another is open is a **handoff, not a swap**: the\n * outgoing chip closes now and the incoming one opens on the next frame, so\n * the two popovers never exist at the same moment.\n *\n * Simply reassigning `openKey` looks equivalent and is not. It mounts the new\n * popover inside the very click that closed the old one, which leaves the new\n * layer registering its dismissal listeners mid-event and able to catch the\n * tail of that same interaction — it opens, paints, and dismisses itself.\n * Deferring by a frame puts the mount cleanly after the click, so there is\n * nothing left of the previous interaction for it to react to.\n *\n * A close is still immediate, and only counts if the chip closing is the one\n * actually on screen — a stale close from the chip just left is a no-op\n * whatever order the events arrive in.\n */\n const setOpen = useCallback(\n (key: string, open: boolean) => {\n if (frameRef.current !== null) {\n cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n\n if (!open) {\n // A stale close from the chip just left is a no-op, whatever order the\n // events arrive in.\n if (openKeyRef.current === key) apply(null);\n return;\n }\n\n if (openKeyRef.current !== null && openKeyRef.current !== key) {\n handoffFromRef.current = openKeyRef.current;\n apply(null);\n frameRef.current = requestAnimationFrame(() => {\n frameRef.current = null;\n apply(key);\n });\n return;\n }\n\n apply(key);\n },\n [apply]\n );\n\n // A handoff in flight when the toolbar unmounts must not fire into nothing.\n useEffect(\n () => () => {\n if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);\n },\n []\n );\n\n const consumeHandoff = useCallback((key: string) => {\n if (handoffFromRef.current !== key) return false;\n handoffFromRef.current = null;\n return true;\n }, []);\n\n const value = useMemo(\n () => ({ openKey, setOpen, consumeHandoff }),\n [openKey, setOpen, consumeHandoff]\n );\n\n return (\n <FilterChipGroupContext.Provider value={value}>\n <div className={cn(\"flex flex-wrap items-center gap-2\", className)}>{children}</div>\n </FilterChipGroupContext.Provider>\n );\n}\n\n/**\n * Open state for one chip. Inside a {@link FilterChipGroup} the group owns it\n * so opening this chip closes its siblings; outside one, the chip keeps its own\n * state, so a lone chip works with no wrapper.\n *\n * Every chip below calls this rather than taking `open` / `onOpenChange` props,\n * which is what stops a call site from reintroducing the flicker by wiring the\n * state up itself. A chip that genuinely needs outside control can still pass\n * `open` / `onOpenChange` — a mounted-but-hidden twin of a chip, say — and\n * those win.\n */\nexport function useFilterChipState(\n key: string,\n controlled?: { open?: boolean; onOpenChange?: (open: boolean) => void }\n): {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Spread onto the chip's `PopoverContent`. See below. */\n onCloseAutoFocus: (event: Event) => void;\n} {\n const group = useContext(FilterChipGroupContext);\n const [localOpen, setLocalOpen] = useState(false);\n\n const isControlled = controlled?.open !== undefined;\n\n const onOpenChange = useCallback(\n (next: boolean) => {\n controlled?.onOpenChange?.(next);\n if (isControlled) return;\n if (group) group.setOpen(key, next);\n else setLocalOpen(next);\n },\n [controlled, isControlled, group, key]\n );\n\n const open = isControlled ? controlled!.open! : group ? group.openKey === key : localOpen;\n\n /**\n * Stops a chip closed by a **handoff** from pulling focus back to its own\n * trigger, which would land outside the chip now opening and make Radix\n * dismiss it — the flash.\n *\n * Radix restores focus on close unless the popover was dismissed by an\n * outside interaction. A handoff is neither: the group closes the chip\n * programmatically, so as far as Radix is concerned this is an ordinary close\n * and the trigger should get focus back. It should not — the user's attention\n * has moved to another chip.\n *\n * Escape and Apply still restore focus, because neither is a handoff.\n */\n const onCloseAutoFocus = useCallback(\n (event: Event) => {\n if (group?.consumeHandoff(key)) {\n event.preventDefault();\n }\n },\n [group, key]\n );\n\n return { open, onOpenChange, onCloseAutoFocus };\n}\n\n/** The `open` / `onOpenChange` pair every chip accepts for outside control. */\nexport interface FilterChipControl {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n// ── Chip shell ────────────────────────────────────────────────────────────────\n\n/**\n * Every filter chip is built from three pieces: this visual shell (the dashed\n * pill), a label trigger that opens the popover, and — only once the filter has\n * a value — a separate clear button to its left.\n *\n * The clear button and the trigger are two independent `<button>`s side by side\n * rather than one button whose leading icon doubles as a clear action: clicking\n * × must clear *without* opening the popover, and a real `<button>` cannot nest\n * inside another. Keeping them siblings means stopping the clear click from\n * also opening the popover needs no `stopPropagation` gymnastics — they are\n * simply two separate click targets.\n *\n * Inactive it reads as an \"add a filter\" affordance: a dashed outline in the\n * muted border colour. Active it flips to a solid primary ring with a tinted\n * fill, so an applied filter is unmistakable at a glance rather than a subtle\n * recolour of the same dashed outline.\n */\nexport function FilterChipShell({\n active,\n children,\n className,\n}: {\n active: boolean;\n children: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n \"inline-flex h-auto shrink-0 items-center rounded-full border border-dashed border-border bg-card shadow-sm\",\n active && \"border-solid border-primary bg-primary/10 shadow-none ring-1 ring-primary/30\",\n className\n )}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Leading × segment, rendered only when the filter is active.\n *\n * A `Button` rather than an `IconButton` so the `h-auto` / `min-h-0` height\n * override behaves the same way the label trigger's already does: IconButton\n * sizes with Tailwind's `size-*` utility, which a plain `h-auto` does not\n * reliably beat the way it beats Button's `h-9`.\n */\nexport function FilterChipClearButton({\n label,\n onClick,\n}: {\n label: string;\n onClick: () => void;\n}) {\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Clear ${label} filter`}\n onClick={onClick}\n className=\"h-auto min-h-0 shrink-0 rounded-full border border-transparent px-2 py-1 text-primary/70 hover:text-primary\"\n >\n <X className=\"h-3 w-3\" />\n </Button>\n );\n}\n\n/**\n * Trailing label segment — the actual `PopoverTrigger` target.\n *\n * A leading plus shows only while inactive, since once active the clear button\n * to its left already carries a leading icon. A trailing dot then marks\n * \"active\"; `count` replaces it with a number when *how many* values are\n * applied is worth saying.\n *\n * Must forward its ref and spread the rest of its props onto the underlying\n * Button: `PopoverTrigger asChild` clones its single child to inject\n * onClick/ref/aria-*, and a component that swallows those renders a chip that\n * looks right and does nothing when clicked.\n */\nexport const FilterChipLabelTrigger = forwardRef<\n HTMLButtonElement,\n {\n label: string;\n active: boolean;\n /** Show this number instead of the plain active dot. */\n count?: number;\n } & Omit<ComponentPropsWithoutRef<typeof Button>, \"children\">\n>(({ label, active, count, className, ...props }, ref) => (\n <Button\n ref={ref}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n leftIcon={\n !active ? (\n <span className=\"flex h-3.5 w-3.5 items-center justify-center\">\n <Plus className=\"h-3 w-3\" />\n </span>\n ) : undefined\n }\n rightIcon={\n active ? (\n <span className=\"flex h-3.5 items-center justify-center\">\n {count != null && count > 0 ? (\n <span className=\"rounded-full bg-primary/15 px-1.5 text-[10px] font-semibold tabular-nums text-primary\">\n {count}\n </span>\n ) : (\n /* Drawn the way Badge draws its dot: the same size-1.5 rounded\n fill in the primary accent. A state marker, not a count. */\n <span className=\"size-1.5 rounded-full bg-primary\" aria-hidden />\n )}\n </span>\n ) : undefined\n }\n className={cn(\n \"h-auto min-h-0 shrink-0 rounded-full border border-transparent py-1\",\n active\n ? \"pl-1.5 pr-2.5 font-semibold text-primary hover:text-primary\"\n : \"pl-2.5 pr-2.5 text-muted-foreground hover:text-foreground\",\n className\n )}\n {...props}\n >\n {label}\n </Button>\n));\nFilterChipLabelTrigger.displayName = \"FilterChipLabelTrigger\";\n\n/**\n * Apply / Clear footer shared by every panel, so the two buttons sit in the\n * same place and read the same wherever a chip's editor puts them.\n *\n * Both buttons **commit and close**. Clear is not \"untick everything and let me\n * carry on\" — that reading leaves the panel open over a filter that is still\n * applied, so the chip still reads \"Type 1\" while the list in front of you\n * shows nothing ticked, and closing the panel silently keeps the old filter.\n * Clear is the same act as the chip's own little x, reached from inside the\n * panel: it drops the filter and gets out of the way.\n */\nexport function FilterChipActions({\n onClear,\n onApply,\n clearDisabled,\n applyDisabled,\n}: {\n onClear: () => void;\n onApply: () => void;\n clearDisabled?: boolean;\n applyDisabled?: boolean;\n}) {\n return (\n <div className=\"flex shrink-0 items-center justify-between gap-2 border-t border-border px-3 py-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onClear}\n disabled={clearDisabled}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n Clear\n </Button>\n <Button type=\"button\" variant=\"primary\" size=\"sm\" onClick={onApply} disabled={applyDisabled}>\n Apply\n </Button>\n </div>\n );\n}\n\n/**\n * The full chip — shell, clear button, trigger and popover — with the editor\n * supplied as `children`. Build a bespoke chip on this rather than reassembling\n * the pieces, so a one-off filter still opens, closes and clears like the rest.\n */\nexport function FilterChip({\n chipKey,\n label,\n active,\n count,\n onClear,\n children,\n align = \"start\",\n contentClassName,\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n onOpen,\n}: {\n /** Identity within a {@link FilterChipGroup}. Must be unique in the row. */\n chipKey: string;\n label: string;\n active: boolean;\n count?: number;\n /** Omit to hide the × segment — for a chip that cannot be emptied. */\n onClear?: () => void;\n children: ReactNode;\n align?: \"start\" | \"center\" | \"end\";\n contentClassName?: string;\n /** Fires when the popover opens — the hook for seeding a draft from the\n * applied value, so an abandoned edit never leaks into the next open. */\n onOpen?: () => void;\n} & FilterChipControl) {\n const { open, onOpenChange, onCloseAutoFocus } = useFilterChipState(chipKey, {\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n });\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n onOpenChange(next);\n if (next) onOpen?.();\n }}\n >\n <FilterChipShell active={active}>\n {active && onClear ? (\n <FilterChipClearButton\n label={label}\n onClick={() => {\n onClear();\n onOpenChange(false);\n }}\n />\n ) : null}\n <PopoverTrigger asChild>\n <FilterChipLabelTrigger label={label} active={active} count={count} />\n </PopoverTrigger>\n </FilterChipShell>\n <PopoverContent\n align={align}\n className={cn(\"w-auto p-0\", POPOVER_FIT, contentClassName)}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n {children}\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Multi-select chip ─────────────────────────────────────────────────────────\n\nexport interface SelectFilterChipProps extends FilterChipControl {\n /** Identity within a group. Defaults to `label`. */\n chipKey?: string;\n label: string;\n options: FilterChipOption[];\n selected: string[];\n onChange: (next: string[]) => void;\n /** Show a search box above the list once there are this many options. Default 8. */\n searchThreshold?: number;\n /** Show the applied count on the chip instead of the plain active dot. */\n showCount?: boolean;\n /**\n * Adds an \"Invert filter\" tick below the list, turning the chosen set into an\n * exclusion. Pass both to enable it; omit for a plain include-only chip.\n *\n * It is staged with the options and applied with them, because inverting\n * without changing the set is still a change to what the table shows, and\n * committing it on the tick would make this one control in the panel behave\n * differently from the rest.\n */\n invert?: boolean;\n onInvertChange?: (next: boolean) => void;\n /** Label for the invert tick. Default \"Invert filter\". */\n invertLabel?: string;\n /** Empty-list line, for options that arrive from a request. */\n emptyText?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * The workhorse chip: a checkbox list staged behind Apply, so ticking four\n * boxes is one query rather than four. Escaping or clicking away discards the\n * draft — the applied value only changes on Apply or Clear.\n */\nexport function SelectFilterChip({\n chipKey,\n label,\n options,\n selected,\n onChange,\n searchThreshold = 8,\n showCount = true,\n invert = false,\n onInvertChange,\n invertLabel = \"Invert filter\",\n emptyText,\n align = \"start\",\n open,\n onOpenChange,\n}: SelectFilterChipProps) {\n const key = chipKey ?? label;\n // Resolved here, not just inside `FilterChip`, because this component's own\n // Apply and Clear need to close the popover — and under a `FilterChipGroup`\n // the `onOpenChange` prop is undefined, since the group owns that state.\n const chip = useFilterChipState(key, { open, onOpenChange });\n const [draft, setDraft] = useState<string[]>(selected);\n const [draftInvert, setDraftInvert] = useState(invert);\n const [query, setQuery] = useState(\"\");\n const supportsInvert = !!onInvertChange;\n // An inversion with nothing chosen excludes nothing, so it is not on its own\n // an active filter.\n const isActive = selected.length > 0;\n\n // Matched on the value as well as the label, so \"nz\" finds New Zealand and a\n // raw status code finds its prettified row. Someone who thinks in codes should\n // not have to know the display name.\n const visible = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return options;\n return options.filter(\n (o) => o.label.toLowerCase().includes(q) || o.value.toLowerCase().includes(q)\n );\n }, [options, query]);\n\n const toggle = (value: string) =>\n setDraft((prev) =>\n prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]\n );\n\n return (\n <FilterChip\n chipKey={key}\n // An inverted chip says so on the pill: \"Status Code\" and \"Status Code\n // (excluded)\" filter to opposite halves of the same data, and a shared\n // count would otherwise be the only difference between them.\n label={supportsInvert && invert && isActive ? `${label} (excluded)` : label}\n active={isActive}\n count={showCount ? selected.length : undefined}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n // Reseed from the applied value on every open, so a draft abandoned last\n // time does not reappear as though it had been applied.\n onOpen={() => {\n setDraft(selected);\n setDraftInvert(invert);\n setQuery(\"\");\n }}\n onClear={() => {\n onChange([]);\n setDraft([]);\n onInvertChange?.(false);\n setDraftInvert(false);\n }}\n >\n <FilterChipPanel\n options={visible}\n draft={draft}\n onToggle={toggle}\n query={options.length >= searchThreshold ? query : undefined}\n onQueryChange={setQuery}\n searchPlaceholder={`Search ${label.toLowerCase()}`}\n emptyText={emptyText}\n invert={supportsInvert ? draftInvert : undefined}\n onInvertChange={setDraftInvert}\n invertLabel={invertLabel}\n />\n <FilterChipActions\n onClear={() => {\n onChange([]);\n setDraft([]);\n onInvertChange?.(false);\n setDraftInvert(false);\n chip.onOpenChange(false);\n }}\n // Disabled only when there is genuinely nothing to drop: an applied\n // value with an emptied draft is still something to clear.\n clearDisabled={draft.length === 0 && selected.length === 0 && !draftInvert && !invert}\n onApply={() => {\n onChange(draft);\n onInvertChange?.(draftInvert);\n chip.onOpenChange(false);\n }}\n />\n </FilterChip>\n );\n}\n\n/** The checkbox list itself, reused by the multi-select chip and the add menu. */\nfunction FilterChipPanel({\n options,\n draft,\n onToggle,\n query,\n onQueryChange,\n searchPlaceholder,\n emptyText,\n invert,\n onInvertChange,\n invertLabel,\n}: {\n options: FilterChipOption[];\n draft: string[];\n onToggle: (value: string) => void;\n query?: string;\n onQueryChange: (q: string) => void;\n searchPlaceholder: string;\n emptyText?: string;\n /** Undefined hides the invert row entirely. */\n invert?: boolean;\n onInvertChange: (next: boolean) => void;\n invertLabel?: string;\n}) {\n return (\n <div className=\"flex min-h-0 w-60 flex-1 flex-col\">\n {query !== undefined ? (\n <div className=\"shrink-0 border-b border-border p-2\">\n <Input\n value={query}\n onChange={(e) => onQueryChange(e.target.value)}\n placeholder={searchPlaceholder}\n className=\"h-8 text-[12.5px]\"\n />\n </div>\n ) : null}\n <div className={cn(\"max-h-64 space-y-0.5 p-2\", FILTER_SCROLL_AREA)}>\n {options.length === 0 ? (\n <p className=\"px-1 py-4 text-center text-[12.5px] text-muted-foreground\">\n {emptyText ?? \"No matches\"}\n </p>\n ) : (\n options.map((option) => (\n <label\n key={option.value}\n className=\"flex cursor-pointer items-center gap-2 rounded-md px-1 py-1 text-[12.5px] text-foreground hover:bg-muted/50\"\n >\n <Checkbox\n checked={draft.includes(option.value)}\n onCheckedChange={() => onToggle(option.value)}\n />\n {option.icon}\n <span className=\"min-w-0 flex-1 truncate\">{option.label}</span>\n {option.hint ? (\n <span className=\"shrink-0 text-[11px] tabular-nums text-muted-foreground\">\n {option.hint}\n </span>\n ) : null}\n </label>\n ))\n )}\n </div>\n\n {invert !== undefined ? (\n <label className=\"flex shrink-0 cursor-pointer items-center gap-2 border-t border-border px-3 py-2 text-[12.5px] text-foreground\">\n <Checkbox checked={invert} onCheckedChange={(c) => onInvertChange(c === true)} />\n {invertLabel}\n </label>\n ) : null}\n </div>\n );\n}\n\n// ── Single-select chip ────────────────────────────────────────────────────────\n\nexport interface SingleSelectFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label: string;\n options: FilterChipOption[];\n value: string;\n onChange: (next: string) => void;\n align?: \"start\" | \"center\" | \"end\";\n /** Show the chosen option's label on the chip instead of the field name. */\n showValueInLabel?: boolean;\n}\n\n/**\n * One-of-many. Picking applies immediately — there is nothing to stage when a\n * choice replaces rather than accumulates, and an Apply button for a single\n * click is a step that only costs the user time.\n */\nexport function SingleSelectFilterChip({\n chipKey,\n label,\n options,\n value,\n onChange,\n align = \"start\",\n showValueInLabel = false,\n open,\n onOpenChange,\n}: SingleSelectFilterChipProps) {\n const key = chipKey ?? label;\n // See SelectFilterChip: picking an option has to close the popover itself.\n const chip = useFilterChipState(key, { open, onOpenChange });\n const isActive = value !== \"\";\n const chosen = options.find((o) => o.value === value);\n\n return (\n <FilterChip\n chipKey={key}\n label={showValueInLabel && chosen ? `${label}: ${chosen.label}` : label}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onClear={() => onChange(\"\")}\n >\n <div className={cn(\"max-h-64 w-52 p-1.5\", FILTER_SCROLL_AREA)}>\n {options.map((option) => (\n <Button\n key={option.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n onChange(option.value);\n chip.onOpenChange(false);\n }}\n className={cn(\n \"w-full justify-start rounded-md px-2 py-1.5 text-[12.5px] font-normal\",\n option.value === value && \"bg-primary/10 font-medium text-primary\"\n )}\n >\n {option.icon}\n <span className=\"truncate\">{option.label}</span>\n </Button>\n ))}\n </div>\n </FilterChip>\n );\n}\n\n// ── Date-range chip ───────────────────────────────────────────────────────────\n\nexport interface DateRangeValue {\n /** `yyyy-mm-dd`, or \"\" for unset. */\n from: string;\n to: string;\n}\n\n/**\n * `DatePicker` renders `<div className={cn(\"relative\", className)}>` with its\n * trigger `<button>` as the direct child, and hard-codes a tall trigger\n * (`h-12 rounded-xl px-5 text-[15px]`) sized for a form field. Inside a chip\n * popover that towers over everything around it, so `[&>button]` reaches the\n * trigger and brings it back to the size of the console's other dropdowns.\n */\nconst DATE_CHIP_TRIGGER =\n \"[&>button]:!h-10 [&>button]:!min-h-0 [&>button]:!gap-2 [&>button]:!rounded-lg [&>button]:!px-3.5 [&>button]:!text-sm [&>button]:!font-normal [&>button]:!shadow-none [&>button>svg]:!size-4\";\n\n/**\n * \"Last N weeks / days / hours / minutes\", counted back from now.\n *\n * A duration rather than a pair of dates, because that is what it is: \"last 2\n * days\" means two days before *now*, and resolving it to fixed timestamps when\n * the user picks it quietly freezes it at the moment of the click. The chip\n * reports the duration; the caller resolves it at request time with\n * {@link relativeRangeToMillis}.\n *\n * Every field is a string because each is a text input, and \"\" is a field the\n * user has not filled in — distinct from \"0\".\n */\nexport interface RelativeRangeValue {\n weeks: string;\n days: string;\n hours: string;\n minutes: string;\n}\n\nexport const EMPTY_RELATIVE_RANGE: RelativeRangeValue = {\n weeks: \"\",\n days: \"\",\n hours: \"\",\n minutes: \"\",\n};\n\nconst RELATIVE_UNITS: {\n key: keyof RelativeRangeValue;\n label: string;\n seconds: number;\n}[] = [\n { key: \"weeks\", label: \"Weeks\", seconds: 7 * 24 * 60 * 60 },\n { key: \"days\", label: \"Days\", seconds: 24 * 60 * 60 },\n { key: \"hours\", label: \"Hours\", seconds: 60 * 60 },\n { key: \"minutes\", label: \"Minutes\", seconds: 60 },\n];\n\nfunction relativeRangeSeconds(value: RelativeRangeValue): number {\n return RELATIVE_UNITS.reduce((total, unit) => {\n const parsed = parseInt(value[unit.key] || \"0\", 10);\n return total + (Number.isNaN(parsed) ? 0 : parsed) * unit.seconds;\n }, 0);\n}\n\n/** Whether a relative range names any span at all. */\nexport function hasRelativeRange(value: RelativeRangeValue | undefined): boolean {\n return !!value && relativeRangeSeconds(value) > 0;\n}\n\n/**\n * Resolves a relative range to absolute epoch millis, evaluated at call time.\n *\n * Deliberately not memoised and never computed during render: \"last 2 days\"\n * means two days before now, and now moves. Call it in the handler that builds\n * the request.\n */\nexport function relativeRangeToMillis(\n value: RelativeRangeValue\n): { startTime: number; endTime: number } | null {\n const seconds = relativeRangeSeconds(value);\n if (seconds <= 0) return null;\n const endTime = Date.now();\n return { startTime: endTime - seconds * 1000, endTime };\n}\n\n/** A relative range as a chip label: `Last 2d 6h`. */\nfunction relativeRangeLabel(value: RelativeRangeValue): string {\n const parts = RELATIVE_UNITS.flatMap((unit) => {\n const n = parseInt(value[unit.key] || \"0\", 10);\n return !n || Number.isNaN(n) ? [] : [`${n}${unit.key[0]}`];\n });\n return parts.length ? `Last ${parts.join(\" \")}` : \"\";\n}\n\nexport interface DateRangeFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value: DateRangeValue;\n onChange: (next: DateRangeValue) => void;\n /**\n * Turns on the \"Last…\" tab beside the date range. Omit both and the chip is\n * absolute-only.\n *\n * The two modes are exclusive by construction: applying one clears the other,\n * because a range that is both \"last 7 days\" and \"1–31 Jan\" cannot be\n * honoured and nothing downstream should have to guess which half won.\n */\n relativeValue?: RelativeRangeValue;\n onRelativeChange?: (next: RelativeRangeValue) => void;\n /** Earliest / latest selectable date, `YYYY-MM-DD`. */\n min?: string;\n max?: string;\n /** Shown under the fields when a picked date falls outside `min`/`max`. */\n outOfRangeHint?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * From / To, staged behind Apply. A half-filled range cannot be applied: an\n * open-ended date filter reads as a bug far more often than it is what someone\n * meant, and the disabled Apply says so without an error message.\n */\nexport function DateRangeFilterChip({\n chipKey = \"date\",\n label = \"Date\",\n value,\n onChange,\n relativeValue,\n onRelativeChange,\n min,\n max,\n outOfRangeHint,\n align = \"start\",\n open,\n onOpenChange,\n}: DateRangeFilterChipProps) {\n const chip = useFilterChipState(chipKey, { open, onOpenChange });\n const [draft, setDraft] = useState<DateRangeValue>(value);\n const [relativeDraft, setRelativeDraft] = useState<RelativeRangeValue>(\n relativeValue ?? EMPTY_RELATIVE_RANGE\n );\n\n // The tab the panel opens on follows what is applied, so reopening a chip set\n // to \"last 2 days\" does not land on an empty date range.\n const supportsRelative = !!onRelativeChange;\n const [mode, setMode] = useState<\"absolute\" | \"relative\">(\n hasRelativeRange(relativeValue) ? \"relative\" : \"absolute\"\n );\n\n const relativeLabel = hasRelativeRange(relativeValue)\n ? relativeRangeLabel(relativeValue!)\n : \"\";\n const isActive = !!(value.from && value.to) || !!relativeLabel;\n const isPartial = !!draft.from !== !!draft.to;\n\n const outside = (d: string) => !!d && ((!!min && d < min) || (!!max && d > max));\n const outOfRange = outside(draft.from) || outside(draft.to);\n\n const emptyRange: DateRangeValue = { from: \"\", to: \"\" };\n const isRelative = supportsRelative && mode === \"relative\";\n\n // Applying one mode clears the other, so the applied value is never both a\n // duration and a pair of dates.\n const commit = (range: DateRangeValue, relative: RelativeRangeValue) => {\n onChange(range);\n onRelativeChange?.(relative);\n setDraft(range);\n setRelativeDraft(relative);\n chip.onOpenChange(false);\n };\n\n return (\n <FilterChip\n chipKey={chipKey}\n // The chip carries the applied span, not just the word \"Date\": it is in\n // the request, so it should be readable without opening anything.\n label={\n relativeLabel\n ? `${label}: ${relativeLabel}`\n : isActive\n ? `${label}: ${value.from} → ${value.to}`\n : label\n }\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={() => {\n setDraft(value);\n setRelativeDraft(relativeValue ?? EMPTY_RELATIVE_RANGE);\n setMode(hasRelativeRange(relativeValue) ? \"relative\" : \"absolute\");\n }}\n onClear={() => {\n onChange(emptyRange);\n onRelativeChange?.(EMPTY_RELATIVE_RANGE);\n setDraft(emptyRange);\n setRelativeDraft(EMPTY_RELATIVE_RANGE);\n }}\n >\n <div className=\"w-72 space-y-3 p-3\">\n {supportsRelative ? (\n <Tabs value={mode} onValueChange={(v) => setMode(v as \"absolute\" | \"relative\")}>\n <TabsList className=\"w-full\">\n <TabsTrigger value=\"absolute\" className=\"flex-1\">\n Date range\n </TabsTrigger>\n <TabsTrigger value=\"relative\" className=\"flex-1\">\n Last…\n </TabsTrigger>\n </TabsList>\n </Tabs>\n ) : null}\n\n {isRelative ? (\n <div className=\"grid grid-cols-2 gap-2\">\n {RELATIVE_UNITS.map((unit) => (\n <label key={unit.key} className=\"space-y-1.5\">\n <span className=\"text-[11px] font-medium text-muted-foreground\">{unit.label}</span>\n <Input\n type=\"number\"\n min={0}\n inputMode=\"numeric\"\n placeholder=\"0\"\n value={relativeDraft[unit.key]}\n onChange={(e) =>\n setRelativeDraft((prev) => ({ ...prev, [unit.key]: e.target.value }))\n }\n className=\"h-8 text-[12.5px]\"\n />\n </label>\n ))}\n </div>\n ) : (\n <>\n <div className=\"space-y-1\">\n <p className=\"text-[11px] font-medium text-muted-foreground\">From</p>\n <DatePicker\n value={draft.from}\n onChange={(v) => setDraft((d) => ({ ...d, from: v }))}\n min={min}\n max={max}\n placeholder=\"Select start date\"\n className={DATE_CHIP_TRIGGER}\n />\n </div>\n <div className=\"space-y-1\">\n <p className=\"text-[11px] font-medium text-muted-foreground\">To</p>\n <DatePicker\n value={draft.to}\n onChange={(v) => setDraft((d) => ({ ...d, to: v }))}\n min={draft.from || min}\n max={max}\n placeholder=\"Select end date\"\n className={DATE_CHIP_TRIGGER}\n />\n </div>\n {isPartial ? (\n <p className=\"text-[11px] text-muted-foreground\">Pick both ends of the range.</p>\n ) : null}\n {outOfRange && outOfRangeHint ? (\n <p className=\"text-[11px] text-destructive\">{outOfRangeHint}</p>\n ) : null}\n </>\n )}\n </div>\n <FilterChipActions\n onClear={() => commit(emptyRange, EMPTY_RELATIVE_RANGE)}\n clearDisabled={\n !draft.from &&\n !draft.to &&\n !hasRelativeRange(relativeDraft) &&\n !value.from &&\n !value.to &&\n !relativeLabel\n }\n // A duration needs no dates; a date range needs both ends and must sit\n // inside the allowed window.\n applyDisabled={\n isRelative ? !hasRelativeRange(relativeDraft) : isPartial || outOfRange\n }\n onApply={() =>\n isRelative\n ? commit(emptyRange, relativeDraft)\n : commit(draft, EMPTY_RELATIVE_RANGE)\n }\n />\n </FilterChip>\n );\n}\n\n// ── Month-range chip ──────────────────────────────────────────────────────────\n\nexport interface MonthRange {\n /** Inclusive \"YYYY-MM\" bounds. Both ends compare as plain strings. */\n start: string;\n end: string;\n}\n\n/** A month index within a year → the \"YYYY-MM\" key the filter stores. */\nconst monthKey = (year: number, monthIndex: number) =>\n `${year}-${String(monthIndex + 1).padStart(2, \"0\")}`;\n\nconst yearOf = (monthKeyValue: string) => Number(monthKeyValue.slice(0, 4));\n\n/** Newest selected month's year, falling back to the range's last year. */\nfunction startingYear(selected: string[], fallbackYear: number): number {\n if (selected.length === 0) return fallbackYear;\n const newest = [...selected].sort().reverse()[0];\n const parsed = yearOf(newest);\n return Number.isNaN(parsed) ? fallbackYear : parsed;\n}\n\n/**\n * Month RANGE chip: pick a start month and an end month on the same year grid.\n *\n * Distinct from MonthFilterChip below, which ticks an arbitrary SET of months.\n * A range is the right shape when the value is going into a request rather than\n * being matched client-side — a start/end pair is what a \"from month, to month\"\n * endpoint takes, and a set of months is not expressible in one.\n *\n * The value is never empty: a caller sending it to an API always has some window\n * in force, so \"Reset\" restores `defaultRange` rather than clearing to nothing,\n * and the chip renders the range it is on at all times. That is deliberate — a\n * filter that silently governs a request should say what it is set to, not read\n * as unset while quietly bounding every row on screen.\n *\n * Clicking cycles the way a date-range picker does: the first click starts a new\n * range, the second closes it, and a click before the open start moves the start\n * instead of making a backwards range.\n */\nexport function MonthRangeFilterChip({\n chipKey,\n label = \"Period\",\n bounds,\n value,\n defaultRange,\n monthsWithData,\n onChange,\n}: {\n chipKey?: string;\n label?: string;\n /** The outer limits the grid lets the merchant navigate and pick within. */\n bounds: MonthRange;\n /** The range currently in force. Always set — see the note above. */\n value: MonthRange;\n /** What Reset goes back to, typically the window the page opens on. */\n defaultRange: MonthRange;\n /** Months with a row behind them, as \"YYYY-MM\". Drives the grid's dots. */\n monthsWithData: Set<string>;\n onChange: (next: MonthRange) => void;\n}) {\n const chip = useFilterChipState(chipKey ?? label);\n const minYear = yearOf(bounds.start);\n const maxYear = yearOf(bounds.end);\n\n const [draft, setDraft] = useState<MonthRange>(value);\n /** Set once a start has been picked and the end is still open, so the next\n * click closes the range instead of starting another one. */\n const [awaitingEnd, setAwaitingEnd] = useState(false);\n const [year, setYear] = useState(() => yearOf(value.end) || maxYear);\n\n // Always active: there is always a window in force.\n const isDefault = value.start === defaultRange.start && value.end === defaultRange.end;\n\n const pick = (month: string) => {\n if (!awaitingEnd) {\n setDraft({ start: month, end: month });\n setAwaitingEnd(true);\n return;\n }\n // A click before the open start moves the start rather than inverting the\n // range, which is what every date-range picker does and what a merchant\n // correcting an over-shot first click means.\n setDraft((prev) =>\n month < prev.start ? { start: month, end: prev.end } : { start: prev.start, end: month }\n );\n setAwaitingEnd(false);\n };\n\n const reset = () => {\n setDraft(defaultRange);\n setAwaitingEnd(false);\n };\n\n const summary = `${formatMonthLabel(draft.start)} – ${formatMonthLabel(draft.end)}`;\n\n return (\n <Popover\n open={chip.open}\n onOpenChange={(next) => {\n chip.onOpenChange(next);\n if (next) {\n setDraft(value);\n setAwaitingEnd(false);\n setYear(yearOf(value.end) || maxYear);\n }\n }}\n >\n <FilterChipShell active>\n <PopoverTrigger asChild>\n {/* The chip carries the range itself, not just the word \"Period\":\n this value is in the request body, so the merchant should be able\n to read what the table is bounded by without opening anything. */}\n <FilterChipLabelTrigger\n label={`${label}: ${formatMonthLabel(value.start)} – ${formatMonthLabel(value.end)}`}\n active\n />\n </PopoverTrigger>\n </FilterChipShell>\n <PopoverContent align=\"end\" className=\"w-60 p-3\" onCloseAutoFocus={chip.onCloseAutoFocus}>\n <div className=\"flex items-center justify-between\">\n <IconButton\n aria-label=\"Previous year\"\n variant=\"ghost\"\n size=\"xs\"\n disabled={year <= minYear}\n onClick={() => setYear((prev) => prev - 1)}\n >\n <ChevronLeft className=\"h-3.5 w-3.5\" />\n </IconButton>\n <span className=\"text-[12.5px] font-semibold text-foreground\">{year}</span>\n <IconButton\n aria-label=\"Next year\"\n variant=\"ghost\"\n size=\"xs\"\n disabled={year >= maxYear}\n onClick={() => setYear((prev) => prev + 1)}\n >\n <ChevronRight className=\"h-3.5 w-3.5\" />\n </IconButton>\n </div>\n\n <div className=\"mt-2 grid grid-cols-4 gap-1\">\n {MONTHS_SHORT.map((monthLabel, index) => {\n const monthValue = monthKey(year, index);\n // Plain string comparison: \"YYYY-MM\" sorts chronologically.\n const inBounds = monthValue >= bounds.start && monthValue <= bounds.end;\n const isEdge = monthValue === draft.start || monthValue === draft.end;\n const isBetween = monthValue > draft.start && monthValue < draft.end;\n const hasData = monthsWithData.has(monthValue);\n\n return (\n <Button\n key={monthValue}\n type=\"button\"\n variant={isEdge ? \"primary\" : \"ghost\"}\n size=\"sm\"\n disabled={!inBounds}\n aria-pressed={isEdge || isBetween}\n aria-label={`${monthLabel} ${year}${hasData ? \", has receipts\" : \"\"}`}\n onClick={() => pick(monthValue)}\n className={cn(\n \"relative h-auto min-h-0 w-full justify-center rounded-md px-0 pb-2.5 pt-1.5 text-[12px]\",\n !isEdge && \"text-foreground hover:bg-muted/60\",\n isBetween && \"bg-primary/15 text-primary\"\n )}\n >\n {monthLabel}\n {hasData && (\n <span\n aria-hidden\n className={cn(\n \"absolute bottom-1 left-1/2 size-1 -translate-x-1/2 rounded-full\",\n isEdge ? \"bg-primary-foreground\" : \"bg-primary\"\n )}\n />\n )}\n </Button>\n );\n })}\n </div>\n\n <p className=\"mt-2 truncate text-[11px] text-muted-foreground\" title={summary}>\n {awaitingEnd ? `${formatMonthLabel(draft.start)} – pick an end month` : summary}\n </p>\n\n <Separator className=\"my-2\" />\n\n <div className=\"flex items-center justify-between gap-2\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n leftIcon={<X className=\"h-3 w-3\" />}\n onClick={reset}\n disabled={isDefault && draft.start === defaultRange.start && draft.end === defaultRange.end}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n Reset\n </Button>\n <Button\n variant=\"primary\"\n size=\"sm\"\n onClick={() => {\n onChange(draft);\n chip.onOpenChange(false);\n }}\n >\n Apply\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Text chip ─────────────────────────────────────────────────────────────────\n\nexport interface TextFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value: string;\n onChange: (next: string) => void;\n /** Field label inside the panel. Defaults to `<label> contains`. */\n fieldLabel?: string;\n placeholder?: string;\n /** One line under the field — what the match actually does, typically. */\n hint?: string;\n /** Soft keyboard hint on touch devices. */\n inputMode?: \"text\" | \"email\" | \"tel\" | \"numeric\" | \"url\" | \"search\";\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * One free-text value, staged behind Apply.\n *\n * Deliberately not a live-filtering input: this chip sits in a toolbar whose\n * other chips all commit on Apply, and a field that filtered as you typed would\n * be the one control on the row that behaves differently. Enter applies, so it\n * still costs one keystroke.\n *\n * The applied value is trimmed — a trailing space pasted in with an address is\n * not something the user meant to search for.\n */\nexport function TextFilterChip({\n chipKey,\n label = \"Text\",\n value,\n onChange,\n fieldLabel,\n placeholder,\n hint,\n inputMode = \"text\",\n align = \"start\",\n open,\n onOpenChange,\n}: TextFilterChipProps) {\n const key = chipKey ?? label;\n const chip = useFilterChipState(key, { open, onOpenChange });\n const [draft, setDraft] = useState(value);\n\n const isActive = !!value.trim();\n const apply = () => {\n onChange(draft.trim());\n chip.onOpenChange(false);\n };\n\n return (\n <FilterChip\n chipKey={key}\n // The chip carries the value it is filtering on, so the toolbar can be\n // read without opening anything.\n label={isActive ? `${label}: ${value.trim()}` : label}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={() => setDraft(value)}\n onClear={() => {\n onChange(\"\");\n setDraft(\"\");\n }}\n >\n <div className=\"w-64 space-y-1.5 p-3\">\n <p className=\"text-[11px] font-medium text-muted-foreground\">\n {fieldLabel ?? `${label} contains`}\n </p>\n <Input\n type=\"text\"\n inputMode={inputMode}\n autoComplete=\"off\"\n placeholder={placeholder}\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\") return;\n e.preventDefault();\n apply();\n }}\n className=\"h-8 text-[12.5px]\"\n />\n {hint ? <p className=\"text-[11px] text-muted-foreground\">{hint}</p> : null}\n </div>\n <FilterChipActions\n onClear={() => {\n onChange(\"\");\n setDraft(\"\");\n chip.onOpenChange(false);\n }}\n clearDisabled={!draft && !value}\n onApply={apply}\n />\n </FilterChip>\n );\n}\n\n// ── Number-range chip ─────────────────────────────────────────────────────────\n\nexport interface NumberRangeValue {\n min: string;\n max: string;\n}\n\nexport interface NumberRangeFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value: NumberRangeValue;\n onChange: (next: NumberRangeValue) => void;\n /** Prefix inside each field — a currency symbol, typically. */\n prefix?: string;\n /** One line under the fields — what the bounds mean, or which field they match. */\n hint?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * Min / Max, staged behind Apply. Unlike a date range, one end alone is a\n * perfectly ordinary request (\"over ₹10,000\"), so a half-filled range applies.\n */\nexport function NumberRangeFilterChip({\n chipKey = \"amount\",\n label = \"Amount\",\n value,\n onChange,\n prefix,\n hint,\n align = \"start\",\n open,\n onOpenChange,\n}: NumberRangeFilterChipProps) {\n const chip = useFilterChipState(chipKey, { open, onOpenChange });\n const [draft, setDraft] = useState<NumberRangeValue>(value);\n const isActive = !!(value.min || value.max);\n const inverted = !!draft.min && !!draft.max && Number(draft.min) > Number(draft.max);\n\n return (\n <FilterChip\n chipKey={chipKey}\n label={label}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={() => setDraft(value)}\n onClear={() => {\n onChange({ min: \"\", max: \"\" });\n setDraft({ min: \"\", max: \"\" });\n }}\n >\n <div className=\"w-56 space-y-3 p-3\">\n {([\"min\", \"max\"] as const).map((end) => (\n <label key={end} className=\"block space-y-1\">\n <span className=\"text-[11px] font-medium capitalize text-muted-foreground\">{end}</span>\n <div className=\"relative\">\n {prefix ? (\n <span className=\"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[12.5px] text-muted-foreground\">\n {prefix}\n </span>\n ) : null}\n <Input\n type=\"number\"\n inputMode=\"decimal\"\n value={draft[end]}\n onChange={(e) => setDraft((d) => ({ ...d, [end]: e.target.value }))}\n className={cn(\"h-8 text-[12.5px]\", prefix && \"pl-6\")}\n />\n </div>\n </label>\n ))}\n {inverted ? (\n <p className=\"text-[11px] text-destructive\">Min must not exceed max.</p>\n ) : hint ? (\n <p className=\"text-[11px] text-muted-foreground\">{hint}</p>\n ) : null}\n </div>\n <FilterChipActions\n onClear={() => {\n const empty = { min: \"\", max: \"\" };\n onChange(empty);\n setDraft(empty);\n chip.onOpenChange(false);\n }}\n clearDisabled={!draft.min && !draft.max && !value.min && !value.max}\n applyDisabled={inverted}\n onApply={() => {\n onChange(draft);\n chip.onOpenChange(false);\n }}\n />\n </FilterChip>\n );\n}\n\n// ── Add-filter menu ───────────────────────────────────────────────────────────\n\nexport interface AddFilterDefinition {\n key: string;\n label: string;\n /**\n * The values this filter accepts, so the search can match them directly.\n * Omit for a filter whose values are not a list — a date or amount range —\n * and it will still be findable by name.\n */\n options?: FilterChipOption[];\n /** How many values are currently applied. Drives the count beside the name. */\n activeCount?: number;\n}\n\nexport interface AddFilterMenuProps extends FilterChipControl {\n chipKey?: string;\n /** Every filter this toolbar can offer, including ones already shown. */\n filters: AddFilterDefinition[];\n /** Keys already on screen as their own chip. */\n visibleKeys?: string[];\n /** Reveal a filter as its own chip. */\n onAddFilter: (key: string) => void;\n /**\n * Take a filter back out of the toolbar. Omit and a shown filter is simply\n * marked as shown; supply it and the row becomes a toggle.\n *\n * Removing must also clear whatever that filter had selected — a filter that\n * is still narrowing the table from somewhere the user cannot see it is worse\n * than one they have to scroll to.\n */\n onRemoveFilter?: (key: string) => void;\n /** Apply a value picked straight out of the search results. */\n onSelectValue?: (filterKey: string, value: string) => void;\n label?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\ntype MenuRow =\n | { kind: \"heading\"; id: string; text: string }\n | { kind: \"filter\"; id: string; filter: AddFilterDefinition }\n | { kind: \"value\"; id: string; filter: AddFilterDefinition; option: FilterChipOption };\n\n/**\n * \"Filter\" — a searchable way to reach every filter a table has, instead of a\n * second-class drawer of leftovers.\n *\n * Two things it does that a nested accordion of checkbox groups does not.\n * Typing searches filter **names and their values at once**, so someone who\n * knows they want \"USD\" finds it without first knowing it lives under\n * Currency. And choosing anything here promotes that filter to a real chip in\n * the toolbar, so there is exactly one place a filter can be — beside its\n * peers — rather than some being chips and some being hidden rows.\n *\n * That also means the toolbar scales: a table with twenty filters shows the\n * three or four in use and keeps the rest one keystroke away.\n */\nexport function AddFilterMenu({\n chipKey = \"__add-filter\",\n filters,\n visibleKeys = [],\n onAddFilter,\n onRemoveFilter,\n onSelectValue,\n label = \"Filter\",\n align = \"start\",\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n}: AddFilterMenuProps) {\n const { open, onOpenChange, onCloseAutoFocus } = useFilterChipState(chipKey, {\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n });\n\n const [query, setQuery] = useState(\"\");\n /** Raw highlight index; `cursor` below is this clamped to a real row. */\n const [storedCursor, setCursor] = useState(0);\n const listRef = useRef<HTMLDivElement | null>(null);\n const listId = useId();\n\n const q = query.trim().toLowerCase();\n\n /**\n * The flat row list the keyboard walks. Headings are in it so the rendered\n * order and the keyboard order cannot drift; they are skipped when moving.\n */\n const rows = useMemo<MenuRow[]>(() => {\n const out: MenuRow[] = [];\n\n if (q) {\n // Values first: someone who typed \"usd\" wants the value, and having to\n // step past the field that contains it is the slower of the two orders.\n const valueMatches = filters.flatMap((f) =>\n (f.options ?? [])\n .filter((o) => o.label.toLowerCase().includes(q))\n .map((option) => ({ filter: f, option }))\n );\n if (valueMatches.length && onSelectValue) {\n out.push({ kind: \"heading\", id: \"h-values\", text: \"Values\" });\n for (const { filter, option } of valueMatches.slice(0, 20)) {\n out.push({\n kind: \"value\",\n id: `v-${filter.key}-${option.value}`,\n filter,\n option,\n });\n }\n }\n\n const nameMatches = filters.filter((f) => f.label.toLowerCase().includes(q));\n if (nameMatches.length) {\n out.push({ kind: \"heading\", id: \"h-fields\", text: \"Filters\" });\n for (const filter of nameMatches) {\n out.push({ kind: \"filter\", id: `f-${filter.key}`, filter });\n }\n }\n return out;\n }\n\n // Resting state: every filter, with the ones already on screen marked so\n // the menu doubles as a map of what the toolbar is currently showing.\n out.push({\n kind: \"heading\",\n id: \"h-all\",\n text: onRemoveFilter ? \"Show filters\" : \"All filters\",\n });\n for (const filter of filters) {\n out.push({ kind: \"filter\", id: `f-${filter.key}`, filter });\n }\n return out;\n }, [filters, q, onSelectValue, onRemoveFilter]);\n\n const selectable = useMemo(\n () => rows.map((r, i) => (r.kind === \"heading\" ? -1 : i)).filter((i) => i >= 0),\n [rows]\n );\n\n /**\n * The highlighted row, clamped to something that actually exists.\n *\n * Derived rather than corrected in an effect. A new query rebuilds `rows`, so\n * the stored index can now point at a heading, at a row that has gone, or\n * past the end — and an effect that reset it would have to depend on the\n * rebuilt array, which is a new identity on every parent render. That effect\n * would then fight the arrow keys, snapping the highlight back to the first\n * row each time the parent happened to re-render. Deriving it cannot.\n */\n const cursor = selectable.includes(storedCursor) ? storedCursor : (selectable[0] ?? -1);\n\n /** Keeps the highlighted row inside the scroll viewport. */\n useEffect(() => {\n if (cursor < 0) return;\n listRef.current\n ?.querySelector<HTMLElement>(`[data-row-index=\"${cursor}\"]`)\n ?.scrollIntoView({ block: \"nearest\" });\n }, [cursor]);\n\n const choose = (row: MenuRow) => {\n if (row.kind === \"value\") {\n onSelectValue?.(row.filter.key, row.option.value);\n // The filter it belongs to becomes a chip, so the applied value is\n // visible and removable in the same place as every other filter.\n onAddFilter(row.filter.key);\n // A value is a decision: close, so the chip it just created is visible.\n onOpenChange(false);\n setQuery(\"\");\n return;\n }\n\n if (row.kind !== \"filter\") return;\n\n // A filter row is a toggle, and the menu stays open for it — turning three\n // filters on is one visit, not three. Only picking a value closes.\n if (onRemoveFilter && visibleKeys.includes(row.filter.key)) {\n onRemoveFilter(row.filter.key);\n } else {\n onAddFilter(row.filter.key);\n if (!onRemoveFilter) {\n // Without a remove handler the row is not a toggle, so there is nothing\n // to come back for.\n onOpenChange(false);\n setQuery(\"\");\n }\n }\n };\n\n const moveCursor = (delta: number) => {\n if (!selectable.length) return;\n const at = selectable.indexOf(cursor);\n const next = selectable[(at + delta + selectable.length) % selectable.length];\n setCursor(next);\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveCursor(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveCursor(-1);\n } else if (e.key === \"Enter\") {\n const row = rows[cursor];\n if (!row || row.kind === \"heading\") return;\n e.preventDefault();\n choose(row);\n }\n };\n\n const activeCount = filters.filter((f) => (f.activeCount ?? 0) > 0).length;\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n onOpenChange(next);\n if (next) setQuery(\"\");\n }}\n >\n <FilterChipShell active={false}>\n <PopoverTrigger asChild>\n <FilterChipLabelTrigger\n label={label}\n active={false}\n rightIcon={<SlidersHorizontal className=\"h-3 w-3\" />}\n aria-label={\n activeCount > 0 ? `${label}. ${activeCount} filters applied.` : label\n }\n />\n </PopoverTrigger>\n </FilterChipShell>\n\n <PopoverContent\n align={align}\n className={cn(\"w-72 p-0\", POPOVER_FIT)}\n onKeyDown={onKeyDown}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n <div className=\"flex h-10 shrink-0 items-center gap-2 border-b border-border px-3\">\n <Search className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n <input\n autoFocus\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search filters and values\"\n aria-controls={listId}\n aria-activedescendant={cursor >= 0 ? `${listId}-${cursor}` : undefined}\n className=\"h-full flex-1 bg-transparent text-[12.5px] outline-none placeholder:text-muted-foreground\"\n />\n </div>\n\n <div\n ref={listRef}\n id={listId}\n role=\"listbox\"\n className={cn(\"max-h-80 p-1\", FILTER_SCROLL_AREA)}\n >\n {rows.length === 0 ? (\n <p className=\"px-2 py-6 text-center text-[12.5px] text-muted-foreground\">\n Nothing matches “{query}”.\n </p>\n ) : (\n rows.map((row, i) =>\n row.kind === \"heading\" ? (\n <div\n key={row.id}\n className=\"px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground\"\n >\n {row.text}\n </div>\n ) : (\n <div\n key={row.id}\n id={`${listId}-${i}`}\n data-row-index={i}\n role=\"option\"\n aria-selected={i === cursor}\n onMouseEnter={() => setCursor(i)}\n onClick={() => choose(row)}\n className={cn(\n \"flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] text-foreground\",\n i === cursor && \"bg-muted\"\n )}\n >\n {row.kind === \"value\" ? (\n <>\n {row.option.icon}\n <span className=\"min-w-0 flex-1 truncate\">{row.option.label}</span>\n {/* Names the field the value belongs to: \"USD\" alone is\n ambiguous when two filters both take currencies. */}\n <span className=\"shrink-0 text-[11px] text-muted-foreground\">\n {row.filter.label}\n </span>\n </>\n ) : (\n <>\n <span className=\"min-w-0 flex-1 truncate\">{row.filter.label}</span>\n {row.filter.activeCount ? (\n <span className=\"shrink-0 rounded-full bg-primary/15 px-1.5 text-[10px] font-semibold tabular-nums text-primary\">\n {row.filter.activeCount}\n </span>\n ) : null}\n {visibleKeys.includes(row.filter.key) ? (\n <Check\n aria-label=\"Shown in the toolbar\"\n className=\"h-3.5 w-3.5 shrink-0 text-primary\"\n />\n ) : null}\n </>\n )}\n </div>\n )\n )\n )}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Toolbar ───────────────────────────────────────────────────────────────────\n\n/**\n * The row a table's filters live in: search at the left, chips beside it,\n * actions pinned right.\n *\n * Search and chips share one wrapping flex, so a chip that does not fit wraps\n * to the next line starting **under the search box** — a toolbar with three\n * filters is one line, one with eight grows a second, and nothing is ever\n * scrolled out of sight. Giving each group its own box instead would wrap the\n * chips inside their own column and leave a ragged left edge.\n *\n * Wraps its chips in a {@link FilterChipGroup}, so a toolbar built with it gets\n * the one-open-at-a-time behaviour without opting in.\n */\nexport function FilterToolbar({\n search,\n chips,\n actions,\n className,\n}: {\n search?: ReactNode;\n chips?: ReactNode;\n actions?: ReactNode;\n className?: string;\n}) {\n return (\n // `items-start` keeps the actions level with the FIRST line once the chips\n // wrap onto a second.\n <div className={cn(\"flex items-start gap-2\", className)}>\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-2\">\n {search}\n {/* `contents` so the group adds no box of its own: the chips become\n direct children of the wrapping flex and can break between lines. */}\n {chips ? <FilterChipGroup className=\"contents\">{chips}</FilterChipGroup> : null}\n </div>\n {actions ? (\n <div className=\"flex min-h-8 shrink-0 items-center gap-2\">{actions}</div>\n ) : null}\n </div>\n );\n}\n\n/**\n * The pill action button that sits at the right of a table toolbar — Refresh,\n * Columns, Export, Report.\n *\n * It exists because `Button size=\"sm\"` is `h-9`, which towers over the chips\n * beside it; every toolbar that wanted a level row was overriding the same four\n * classes by hand. Having it here means a toolbar's actions match its chips\n * without each one rediscovering that.\n */\nexport function ToolbarButton({ className, ...props }: ComponentPropsWithoutRef<typeof Button>) {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className={cn(\n \"h-auto min-h-0 shrink-0 py-1 text-muted-foreground hover:text-foreground\",\n className\n )}\n {...props}\n />\n );\n}\n","/**\n * The app-wide date and time format.\n *\n * Every timestamp a PayGlocal dashboard shows a user goes through here, so a\n * transaction row, a settlement detail page, an audit log line and a chart\n * tooltip all read the same: `27 Jul '26, 09:49 AM`.\n *\n * Nothing here goes through `toLocaleDateString` / `toLocaleTimeString`. That\n * is deliberate: Intl output varies with the machine's locale, so the same\n * record would read differently for an operator in Bengaluru and a merchant in\n * Frankfurt, and a screenshot in a support ticket would not match what the\n * agent sees. These build the string from fixed tables instead.\n *\n * Times are rendered in the **viewer's own timezone**, which is what every\n * `Date` getter below returns. That is the right default for an operations\n * console — \"did this settle before close of business *here*\" is the question\n * being asked — but it does mean two people in different zones see different\n * clock times for one event, so anywhere that matters should label the zone.\n */\n\nconst MONTHS_SHORT = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n] as const;\n\nconst DAYS_SHORT = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"] as const;\n\n/** What an absent or unparseable value renders as, everywhere. */\nexport const EMPTY_DATE = \"—\";\n\n/**\n * Parses the shapes PayGlocal APIs actually send, in the order they are most\n * likely to appear:\n *\n * - `DD/MM/YYYY HH:mm:ss` — the transactions search response's\n * `formattedCreationDateTime`. Tried **first**, because `new Date()` reads\n * `03/07/2026` as *March 7th* under US parsing rules, silently swapping the\n * day and month for the first twelve days of every month.\n * - epoch milliseconds, as a number **or a string** — several endpoints send\n * `\"1771329858260\"`. The string form needs `Number()` first: the `Date`\n * constructor reads a string as a date *format*, not a count of\n * milliseconds, so `new Date(\"1771329858260\")` is an Invalid Date.\n * - ISO 8601 — `settlementDate`, and most newer endpoints.\n */\nexport function parseApiDate(value: string | number | Date | null | undefined): Date | null {\n if (value === null || value === undefined || value === \"\") return null;\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;\n\n if (typeof value === \"number\") {\n const fromMillis = new Date(value);\n return Number.isNaN(fromMillis.getTime()) ? null : fromMillis;\n }\n\n const raw = value.trim();\n\n const slashed = raw.match(\n /^(\\d{2})\\/(\\d{2})\\/(\\d{4})(?:[ T](\\d{2}):(\\d{2})(?::(\\d{2}))?)?$/\n );\n if (slashed) {\n const [, dd, mm, yyyy, hh = \"0\", min = \"0\", ss = \"0\"] = slashed;\n const parsed = new Date(\n Number(yyyy),\n Number(mm) - 1,\n Number(dd),\n Number(hh),\n Number(min),\n Number(ss)\n );\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n }\n\n // A string of digits is epoch millis, not a date format.\n if (/^\\d+$/.test(raw)) {\n const parsed = new Date(Number(raw));\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n }\n\n const parsed = new Date(raw);\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n}\n\n/** `09:49 AM` — 12-hour, zero-padded, uppercase meridiem. */\nexport function formatTime(date: Date): string {\n const hours24 = date.getHours();\n const hours12 = hours24 % 12 || 12;\n const meridiem = hours24 >= 12 ? \"PM\" : \"AM\";\n return `${String(hours12).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")} ${meridiem}`;\n}\n\n/** `27 Jul '26` — the date half, on its own. */\nexport function formatDateOnly(date: Date): string {\n const yy = String(date.getFullYear() % 100).padStart(2, \"0\");\n return `${date.getDate()} ${MONTHS_SHORT[date.getMonth()]} '${yy}`;\n}\n\n/** `27 Jul '26, 09:49 AM` — the canonical form. */\nexport function formatDateTime(date: Date): string {\n return `${formatDateOnly(date)}, ${formatTime(date)}`;\n}\n\n/**\n * Any API value → `27 Jul '26, 09:49 AM`.\n *\n * This is the one to reach for in a column renderer or a detail field: it takes\n * whatever shape the endpoint sends, and returns the em dash rather than\n * \"Invalid Date\" when there is nothing to show.\n *\n * `fallback` is what an absent or unparseable value renders as. It defaults to\n * the em dash; pass `\"\"` where the timestamp sits inside a sentence that should\n * simply omit it rather than show a placeholder.\n */\nexport function formatTimestamp(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n return date ? formatDateTime(date) : fallback;\n}\n\n/** Any API value → `27 Jul '26`, with no time of day. */\nexport function formatDateStamp(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n return date ? formatDateOnly(date) : fallback;\n}\n\n/** Any API value → `09:49 AM`, with no date. */\nexport function formatTimeStamp(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n return date ? formatTime(date) : fallback;\n}\n\n/**\n * `Mon, 27 Jul` — weekday and date, no year. For a date close enough to the\n * present that naming the day of the week reads better than a bare calendar\n * date, such as a \"next settlement\" line.\n */\nexport function formatWeekdayDate(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n if (!date) return fallback;\n return `${DAYS_SHORT[date.getDay()]}, ${date.getDate()} ${MONTHS_SHORT[date.getMonth()]}`;\n}\n\n/** `Jan 2026` — a month key (`YYYY-MM`) as a label. */\nexport function formatMonthLabel(monthKey: string): string {\n const [year, month] = monthKey.split(\"-\");\n const name = MONTHS_SHORT[Number(month) - 1];\n if (!year || !name) return monthKey;\n return `${name} ${year}`;\n}\n\nexport { MONTHS_SHORT, DAYS_SHORT };\n","\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"./button\";\nimport { Calendar } from \"./calendar\";\nimport { FilterChip, FilterChipActions, useFilterChipState } from \"./filter-chips\";\nimport type { FilterChipControl } from \"./filter-chips\";\nimport { formatDateOnly, parseApiDate } from \"./format-datetime\";\nimport { cn } from \"./utils\";\n\nexport type DatePickMode = \"single\" | \"range\";\n\n/** What the calendar hands back while the user is picking. */\nexport type CalendarRange = { from: Date | undefined; to?: Date | undefined };\n\n/**\n * A named span offered above the calendar — \"Today\", \"Last 30 Days\".\n *\n * `resolve` runs when the preset is chosen, not when it is declared, so \"last\n * 7 days\" is counted from the day the user picks it rather than from whenever\n * the options array happened to be built.\n */\nexport interface CalendarDatePreset {\n value: string;\n label: string;\n resolve: () => { from: string; to: string };\n}\n\n/**\n * The applied value: a span, plus which preset produced it.\n *\n * `preset` is `\"\"` when the dates were picked by hand, and `to` equals `from`\n * for a single day — so a caller that only wants a window can read `from`/`to`\n * and ignore the rest.\n */\nexport interface CalendarDateValue {\n preset: string;\n /** YYYY-MM-DD */\n from: string;\n /** YYYY-MM-DD */\n to: string;\n}\n\nexport interface CalendarDateFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value?: CalendarDateValue;\n onChange: (next: CalendarDateValue | undefined) => void;\n /** Named spans above the calendar. Omit for a calendar-only chip. */\n presets?: readonly CalendarDatePreset[];\n /** Offer \"Single date\" alongside \"Date range\". Default true. */\n allowSingle?: boolean;\n /** Months shown side by side in range mode. Default 2. */\n numberOfMonths?: number;\n align?: \"start\" | \"center\" | \"end\";\n}\n\nconst PICK_MODES: { value: DatePickMode; label: string }[] = [\n { value: \"single\", label: \"Single date\" },\n { value: \"range\", label: \"Date range\" },\n];\n\nconst toKey = (d: Date): string => {\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const day = String(d.getDate()).padStart(2, \"0\");\n return `${d.getFullYear()}-${month}-${day}`;\n};\n\nconst fromKey = (key: string): Date | undefined => parseApiDate(key) ?? undefined;\n\n/**\n * A date filter over a real calendar, with optional named spans.\n *\n * Distinct from {@link DateRangeFilterChip}, which is two typed date fields.\n * This one is for a filter people reach for by *looking* — \"the week of the\n * 14th\", \"that Tuesday\" — where a pair of text inputs makes you count days in\n * your head. Both exist because both are right somewhere, and picking between\n * them is a call about the filter, not about the toolbar.\n *\n * Five features in pg-dashboard-v2 had built this chip separately, each with\n * its own preset list and its own value shape. They are the same control.\n */\nexport function CalendarDateFilterChip({\n chipKey,\n label = \"Date\",\n value,\n onChange,\n presets,\n allowSingle = true,\n numberOfMonths = 2,\n align = \"start\",\n open,\n onOpenChange,\n}: CalendarDateFilterChipProps) {\n const key = chipKey ?? label;\n const chip = useFilterChipState(key, { open, onOpenChange });\n\n const [mode, setMode] = useState<DatePickMode>(\"single\");\n const [singleDate, setSingleDate] = useState<Date | undefined>(undefined);\n const [range, setRange] = useState<CalendarRange | undefined>(undefined);\n // A preset and a hand-picked span are the same filter reached two ways, so\n // choosing one clears the other rather than leaving both staged.\n const [presetDraft, setPresetDraft] = useState(\"\");\n\n const activePreset = presets?.find((p) => p.value === value?.preset);\n const isActive = !!value?.from;\n\n const chipLabel = !isActive\n ? label\n : activePreset\n ? `${label}: ${activePreset.label}`\n : value!.to && value!.to !== value!.from\n ? `${label}: ${formatDateOnly(fromKey(value!.from)!)} – ${formatDateOnly(fromKey(value!.to)!)}`\n : `${label}: ${formatDateOnly(fromKey(value!.from)!)}`;\n\n /** Reseeds the working selection from what is applied, on every open. */\n const reseed = () => {\n setPresetDraft(value?.preset ?? \"\");\n const from = value?.from ? fromKey(value.from) : undefined;\n const to = value?.to ? fromKey(value.to) : undefined;\n const isSpan = !!value?.to && value.to !== value.from;\n setMode(isSpan || !allowSingle ? \"range\" : \"single\");\n setSingleDate(isSpan ? undefined : from);\n setRange(isSpan ? { from, to } : undefined);\n };\n\n const clear = () => {\n onChange(undefined);\n setPresetDraft(\"\");\n setSingleDate(undefined);\n setRange(undefined);\n setMode(allowSingle ? \"single\" : \"range\");\n };\n\n const apply = () => {\n if (presetDraft) {\n const chosen = presets?.find((p) => p.value === presetDraft);\n if (chosen) {\n const span = chosen.resolve();\n onChange({ preset: chosen.value, ...span });\n }\n } else if (mode === \"single\" && singleDate) {\n const k = toKey(singleDate);\n onChange({ preset: \"\", from: k, to: k });\n } else if (mode === \"range\" && range?.from) {\n const to = range.to ?? range.from;\n onChange({ preset: \"\", from: toKey(range.from), to: toKey(to) });\n } else {\n onChange(undefined);\n }\n chip.onOpenChange(false);\n };\n\n const hasDraft = !!presetDraft || !!singleDate || !!range?.from;\n\n return (\n <FilterChip\n chipKey={key}\n label={chipLabel}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={reseed}\n onClear={clear}\n >\n <div className=\"w-auto p-3\">\n {presets?.length ? (\n <div className=\"mb-3 flex flex-wrap gap-1.5\">\n {presets.map((p) => (\n <Button\n key={p.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n const next = presetDraft === p.value ? \"\" : p.value;\n setPresetDraft(next);\n // Picking a named span drops whatever was on the calendar,\n // so the panel never shows two answers at once.\n if (next) {\n setSingleDate(undefined);\n setRange(undefined);\n }\n }}\n className={cn(\n \"h-auto min-h-0 rounded-full border px-2.5 py-1 text-[11.5px] font-normal\",\n presetDraft === p.value\n ? \"border-primary bg-primary/10 font-medium text-primary\"\n : \"border-border text-muted-foreground hover:text-foreground\"\n )}\n >\n {p.label}\n </Button>\n ))}\n </div>\n ) : null}\n\n {allowSingle ? (\n <div className=\"mb-3 flex items-center gap-1 rounded-lg border border-border bg-muted/50 p-1\">\n {PICK_MODES.map((m) => (\n <Button\n key={m.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setMode(m.value)}\n className={cn(\n \"h-auto min-h-0 flex-1 whitespace-nowrap rounded-md px-2.5 py-1.5 text-xs font-medium\",\n mode === m.value\n ? \"bg-card text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {m.label}\n </Button>\n ))}\n </div>\n ) : null}\n\n {/* `bg-transparent p-0`: Calendar paints `bg-background` on itself and\n only drops it via a `[[data-slot=popover-content]_&]` selector that\n PopoverContent never sets. Left alone it renders the page's\n off-white as a solid block inside the white popover, with its own\n `p-3` on top of the popover's — a greyed, inset panel that reads as\n disabled. */}\n {mode === \"single\" && allowSingle ? (\n <Calendar\n mode=\"single\"\n selected={singleDate}\n onSelect={(d) => {\n setSingleDate(d);\n setPresetDraft(\"\");\n }}\n className=\"bg-transparent p-0\"\n />\n ) : (\n <Calendar\n mode=\"range\"\n selected={range}\n onSelect={(r) => {\n setRange(r);\n setPresetDraft(\"\");\n }}\n numberOfMonths={numberOfMonths}\n className=\"bg-transparent p-0\"\n />\n )}\n </div>\n\n <FilterChipActions\n onClear={() => {\n clear();\n chip.onOpenChange(false);\n }}\n clearDisabled={!hasDraft && !isActive}\n applyDisabled={!hasDraft}\n onApply={apply}\n />\n </FilterChip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AC,YAAY,CAAC;AAAA,YAC7B,eAAe,CAAC;AAAA,YAChB,SAAS;AAAA;AAAA,QACX;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_jsx_runtime","gapClass","import_jsx_runtime","import_lucide_react","import_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","React","import_jsx_runtime","import_jsx_runtime","React","PopoverPrimitive","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","CheckboxPrimitive","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_class_variance_authority","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","import_react","import_class_variance_authority","React","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_lucide_react","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","React","React","React","Slot","child","React","import_class_variance_authority","import_jsx_runtime","import_react","import_jsx_runtime","variantClasses","sizeClasses","import_react","import_jsx_runtime","variantClasses","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","step","import_lucide_react","import_jsx_runtime","React","DialogPrimitive","import_lucide_react","import_jsx_runtime","React","PopoverPrimitive","import_jsx_runtime","React","import_jsx_runtime","import_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","import_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","Icon","React","import_lucide_react","import_jsx_runtime","variantStyles","variantIcons","Icon","React","import_lucide_react","import_jsx_runtime","Icon","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","sizeClasses","step","import_jsx_runtime","import_lucide_react","import_jsx_runtime","Icon","import_lucide_react","import_react","import_jsx_runtime","pad","import_jsx_runtime","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","sizeClasses","React","AvatarPrimitive","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","import_react","import_react_remove_scroll","import_lucide_react","import_jsx_runtime","PANEL_W","PANEL_H","React","import_jsx_runtime","config","React","import_lucide_react","import_jsx_runtime","import_sonner","import_react","import_jsx_runtime","Sonner","React","import_lucide_react","import_jsx_runtime","React","PopoverPrimitive","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","Tag","React","PopoverPrimitive","import_lucide_react","import_jsx_runtime","import_lucide_react","import_react","import_jsx_runtime","variantClasses","sizeClasses","React","import_react_dom","import_react_remove_scroll","import_lucide_react","import_jsx_runtime","pad","displayTime","React","import_jsx_runtime","Tag","React","import_jsx_runtime","sizes","React","import_jsx_runtime","import_react","import_lucide_react","parsed","monthKey","import_jsx_runtime","import_react","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/elevation.ts","../src/layout.tsx","../src/grid-flex.tsx","../src/button.tsx","../src/button-group.tsx","../src/input.tsx","../src/password-input.tsx","../src/otp-input.tsx","../src/checkbox-select.tsx","../src/option-filter.ts","../src/scroll-lock.tsx","../src/single-select.tsx","../src/textarea.tsx","../src/label.tsx","../src/checkbox.tsx","../src/radio-group.tsx","../src/switch.tsx","../src/slider.tsx","../src/form.tsx","../src/field.tsx","../src/separator.tsx","../src/input-group.tsx","../src/currency-amount-input.tsx","../src/card.tsx","../src/scroll-area.tsx","../src/side-nav.tsx","../src/breadcrumb.tsx","../src/pagination.tsx","../src/link.tsx","../../../node_modules/@radix-ui/react-slot/src/slot.tsx","../../../node_modules/@radix-ui/react-compose-refs/src/compose-refs.tsx","../src/badge.tsx","../src/lozenge.tsx","../src/tag.tsx","../src/status-badge.tsx","../src/blanket.tsx","../src/spotlight.tsx","../src/dialog.tsx","../src/drawer.tsx","../src/popover.tsx","../src/tooltip.tsx","../src/menu.tsx","../src/dropdown-menu.tsx","../src/select.tsx","../src/command.tsx","../src/tabs.tsx","../src/tab-presets.tsx","../src/accordion.tsx","../src/alert.tsx","../src/callout.tsx","../src/section-message.tsx","../src/spinner.tsx","../src/progress.tsx","../src/skeleton.tsx","../src/empty-state.tsx","../src/data-table.tsx","../src/data-table-card.tsx","../src/data-card-list.tsx","../src/copyable-cell.tsx","../src/rotating-search-input.tsx","../src/column-manager.tsx","../src/page-header.tsx","../src/code.tsx","../src/avatar.tsx","../src/avatar-group.tsx","../src/avatar-tag.tsx","../src/calendar.tsx","../src/date-picker.tsx","../src/chart.tsx","../src/chart-templates.tsx","../src/sonner.tsx","../src/inline-edit.tsx","../src/inline-dialog.tsx","../src/flag.tsx","../src/responsive.tsx","../src/country-select.tsx","../src/icon-button.tsx","../src/time-picker.tsx","../src/heading.tsx","../src/progress-indicator.tsx","../src/visually-hidden.tsx","../src/filter-chips.tsx","../src/format-datetime.ts","../src/calendar-date-chip.tsx"],"sourcesContent":["export { cn } from \"./utils\";\nexport { elevation } from \"./elevation\";\n\n// Layout\nexport { Box, Stack, Inline } from \"./layout\";\nexport type { BoxProps, StackProps, InlineProps, LayoutSpacing } from \"./layout\";\nexport { Grid, Flex } from \"./grid-flex\";\nexport type { GridProps, GridCols, GridFlow, ResponsiveCols, FlexProps, FlexDirection, FlexAlign, FlexJustify, FlexWrap } from \"./grid-flex\";\n\n// Button\nexport { Button } from \"./button\";\nexport type { ButtonProps } from \"./button\";\nexport { ButtonGroup, SplitButton, SplitButtonItem } from \"./button-group\";\nexport type { ButtonGroupProps, SplitButtonProps, SplitButtonItemProps } from \"./button-group\";\n\n// Inputs\nexport { Input } from \"./input\";\nexport { PasswordInput } from \"./password-input\";\nexport type { PasswordInputProps } from \"./password-input\";\nexport { OtpInput } from \"./otp-input\";\nexport type { OtpInputProps } from \"./otp-input\";\nexport { CheckboxSelect } from \"./checkbox-select\";\nexport type { CheckboxSelectProps, CheckboxSelectOption } from \"./checkbox-select\";\nexport { SingleSelect } from \"./single-select\";\nexport type { SingleSelectProps, SingleSelectOption } from \"./single-select\";\nexport { defaultOptionFilter } from \"./option-filter\";\nexport { isScrollLocked, ScrollLockTakeover } from \"./scroll-lock\";\nexport type { OptionFilter, FilterableOption } from \"./option-filter\";\nexport { Textarea } from \"./textarea\";\nexport { Label } from \"./label\";\nexport { Checkbox } from \"./checkbox\";\nexport type { CheckboxProps } from \"./checkbox\";\nexport { RadioGroup, RadioGroupItem } from \"./radio-group\";\nexport type { RadioGroupItemProps } from \"./radio-group\";\nexport { Switch } from \"./switch\";\nexport type { SwitchProps } from \"./switch\";\nexport { Slider } from \"./slider\";\nexport type { SliderProps } from \"./slider\";\n\n// Form (validation wrapper)\nexport {\n Form,\n FormField,\n FormLabel,\n FormControl,\n FormDescription,\n FormError,\n FormItem,\n useForm,\n} from \"./form\";\nexport type {\n FormProps,\n FormFieldProps,\n FormValues,\n FormErrors,\n FieldConfig,\n FieldsConfig,\n RegisterResult,\n UseFormReturn,\n ValidatorRule,\n} from \"./form\";\n\n// Form fields\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n} from \"./field\";\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n InputGroupTextarea,\n} from \"./input-group\";\nexport { CurrencyAmountInput } from \"./currency-amount-input\";\n\n// Surfaces\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from \"./card\";\nexport { Separator } from \"./separator\";\nexport { ScrollArea, ScrollBar } from \"./scroll-area\";\n\n// SideNav\nexport {\n SideNav,\n SideNavHeader,\n SideNavSection,\n SideNavItem,\n SideNavFooter,\n} from \"./side-nav\";\nexport type { SideNavProps, SideNavItemProps } from \"./side-nav\";\n\n// Navigation\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n} from \"./breadcrumb\";\nexport {\n Pagination,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./pagination\";\nexport type {\n PaginationProps,\n PaginationContentProps,\n PaginationItemProps,\n PaginationLinkProps,\n PaginationPreviousProps,\n PaginationNextProps,\n PaginationEllipsisProps,\n} from \"./pagination\";\nexport { Link } from \"./link\";\nexport type { LinkProps } from \"./link\";\n\n// Labels & Badges\nexport { Badge } from \"./badge\";\nexport type { BadgeProps } from \"./badge\";\nexport { Lozenge } from \"./lozenge\";\nexport type { LozengeProps } from \"./lozenge\";\nexport { Tag, TagGroup } from \"./tag\";\nexport type { TagProps, TagGroupProps } from \"./tag\";\nexport { StatusBadge } from \"./status-badge\";\nexport type { StatusBadgeProps, BadgeVariant, BadgeTrailIcon } from \"./status-badge\";\n\n// Overlays\nexport { Blanket } from \"./blanket\";\nexport type { BlanketProps } from \"./blanket\";\nexport { Spotlight, SpotlightCard, useSpotlight } from \"./spotlight\";\nexport type { SpotlightProps, SpotlightCardProps, SpotlightStep, UseSpotlightReturn } from \"./spotlight\";\nexport {\n Dialog,\n DialogTrigger,\n DialogPortal,\n DialogClose,\n DialogContent,\n DialogTitle,\n DialogDescription,\n} from \"./dialog\";\nexport {\n Drawer,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from \"./drawer\";\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from \"./popover\";\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from \"./tooltip\";\n\n// Menu (standalone vertical)\nexport { Menu, MenuSection, MenuItem, MenuDivider } from \"./menu\";\nexport type { MenuProps, MenuSectionProps, MenuItemProps } from \"./menu\";\n\n// Menus & Select\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n} from \"./dropdown-menu\";\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n} from \"./select\";\nexport type { SelectTriggerSize } from \"./select\";\nexport { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator, CommandShortcut } from \"./command\";\nexport type {\n CommandProps,\n CommandInputProps,\n CommandListProps,\n CommandEmptyProps,\n CommandGroupProps,\n CommandItemProps,\n CommandSeparatorProps,\n CommandShortcutProps,\n} from \"./command\";\n\n// Tabs & Accordion\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from \"./tabs\";\nexport { UnderlineTabs, SegmentedTabs } from \"./tab-presets\";\nexport type { UnderlineTab, SegmentedTabOption } from \"./tab-presets\";\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from \"./accordion\";\n\n// Messaging & Feedback\nexport { Alert, AlertTitle, AlertDescription, Banner } from \"./alert\";\nexport type { AlertProps, BannerProps } from \"./alert\";\nexport { Callout, CalloutIcon, CalloutTitle, CalloutText } from \"./callout\";\nexport type { CalloutProps, CalloutVariant } from \"./callout\";\nexport {\n SectionMessage,\n SectionMessageTitle,\n SectionMessageContent,\n SectionMessageActions,\n} from \"./section-message\";\nexport type { SectionMessageProps, SectionMessageVariant } from \"./section-message\";\nexport { Spinner } from \"./spinner\";\nexport type { SpinnerProps } from \"./spinner\";\nexport { Progress, ProgressTracker } from \"./progress\";\nexport type { ProgressProps, ProgressTrackerStep, ProgressTrackerProps } from \"./progress\";\n\n// Loading & Skeleton\nexport { Shimmer, StatCardSkeleton, TableRowSkeleton, ChartSkeleton } from \"./skeleton\";\n\n// Data display\nexport { DataTable, frozenColumn } from \"./data-table\";\nexport type {\n Column,\n DataTableDensity,\n DataTableExpandable,\n DataTableFooterSummary,\n DataTableHeaderStyle,\n DataTablePagination,\n DataTableSorting,\n DataTableSortState,\n SortOrder,\n} from \"./data-table\";\nexport { DataTableCard, TableToolbarActions } from \"./data-table-card\";\nexport { DataCardList } from \"./data-card-list\";\nexport type { DataCardListProps } from \"./data-card-list\";\nexport { CopyableCell } from \"./copyable-cell\";\nexport type { CopyableCellProps } from \"./copyable-cell\";\nexport { RotatingSearchInput } from \"./rotating-search-input\";\nexport type { RotatingSearchInputProps } from \"./rotating-search-input\";\nexport type { DataTableCardProps } from \"./data-table-card\";\nexport { ColumnManager, useColumnPreferences, applyColumnPreferences } from \"./column-manager\";\nexport type {\n ColumnManagerProps,\n ColumnPreferences,\n ManagedColumn,\n UseColumnPreferencesOptions,\n UseColumnPreferencesResult,\n} from \"./column-manager\";\nexport { EmptyState } from \"./empty-state\";\nexport { PageHeader } from \"./page-header\";\nexport { Code, CodeBlock } from \"./code\";\nexport type { CodeProps, CodeBlockProps } from \"./code\";\n\n// Avatar\nexport { Avatar, AvatarImage, AvatarFallback } from \"./avatar\";\nexport { AvatarGroup } from \"./avatar-group\";\nexport type { AvatarGroupProps, AvatarGroupItem } from \"./avatar-group\";\nexport { AvatarTag } from \"./avatar-tag\";\nexport type { AvatarTagProps, AvatarTagSize } from \"./avatar-tag\";\n\n// Date & Calendar\nexport { Calendar, CalendarDayButton } from \"./calendar\";\nexport type { CalendarProps } from \"./calendar\";\nexport type { DateRange } from \"react-day-picker\";\nexport { DatePicker, type DatePickerTimeOptions } from \"./date-picker\";\n\n// Charts\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n} from \"./chart\";\nexport type { ChartConfig } from \"./chart\";\nexport {\n MetricSparklineCard,\n DashboardAreaChartTemplate,\n GroupedBarChartTemplate,\n RankedBarListTemplate,\n CategoryBarChartTemplate,\n MiniSparklineChartCard,\n AttentionListTemplate,\n} from \"./chart-templates\";\nexport type {\n MetricSparklinePoint,\n MetricSparklineCardProps,\n DashboardAreaChartPoint,\n DashboardAreaChartTemplateProps,\n GroupedBarSeries,\n GroupedBarChartTemplateProps,\n RankedBarItem,\n RankedBarListTemplateProps,\n CategoryBarPoint,\n CategoryBarChartTemplateProps,\n MiniSparklinePoint,\n MiniSparklineStat,\n MiniSparklineChartCardProps,\n AttentionListItem,\n AttentionListTemplateProps,\n} from \"./chart-templates\";\n\n// Toast\nexport { Toaster, toast } from \"./sonner\";\n\n// Inline Edit\nexport { InlineEdit } from \"./inline-edit\";\nexport type { InlineEditProps } from \"./inline-edit\";\n\n// Inline Dialog\nexport { InlineDialog, InlineDialogTrigger, InlineDialogContent } from \"./inline-dialog\";\nexport type { InlineDialogProps, InlineDialogContentProps } from \"./inline-dialog\";\n\n// Flag notifications\nexport { Flag, FlagGroup, useFlagGroup } from \"./flag\";\nexport type { FlagProps, FlagGroupProps, FlagVariant, FlagAction, FlagGroupPosition, UseFlagGroupReturn } from \"./flag\";\n\n// Responsive Show/Hide\nexport { Show, Hide, useBreakpoint } from \"./responsive\";\nexport type { ShowProps, HideProps, Breakpoint, UseBreakpointReturn } from \"./responsive\";\n\n// Country Select\nexport { CountrySelect, COUNTRIES } from \"./country-select\";\nexport type { CountrySelectProps, Country } from \"./country-select\";\n\n// Button variants\nexport { IconButton } from \"./icon-button\";\nexport type { IconButtonProps } from \"./icon-button\";\n\n// Inputs\nexport { TimePicker } from \"./time-picker\";\nexport type { TimePickerProps } from \"./time-picker\";\n\n// Typography\nexport { Heading, Text, MetricText } from \"./heading\";\nexport type { HeadingProps, TextProps, MetricTextProps } from \"./heading\";\n\n// Status\nexport { ProgressIndicator } from \"./progress-indicator\";\nexport type { ProgressIndicatorProps } from \"./progress-indicator\";\n\n// Utility\nexport { VisuallyHidden } from \"./visually-hidden\";\nexport type { VisuallyHiddenProps } from \"./visually-hidden\";\n\n// Filters\nexport {\n FilterChipGroup,\n useFilterChipState,\n FilterChipShell,\n FilterChipClearButton,\n FilterChipLabelTrigger,\n FilterChipActions,\n FilterChip,\n SelectFilterChip,\n SingleSelectFilterChip,\n DateRangeFilterChip,\n NumberRangeFilterChip,\n TextFilterChip,\n MonthRangeFilterChip,\n EMPTY_RELATIVE_RANGE,\n hasRelativeRange,\n relativeRangeToMillis,\n AddFilterMenu,\n FilterToolbar,\n ToolbarButton,\n} from \"./filter-chips\";\n\n// The calendar-based date chip, for a filter people reach for by looking\n// rather than by typing two dates.\nexport { CalendarDateFilterChip } from \"./calendar-date-chip\";\nexport type {\n CalendarDateValue,\n CalendarDatePreset,\n CalendarDateFilterChipProps,\n CalendarRange,\n DatePickMode,\n} from \"./calendar-date-chip\";\nexport type {\n FilterChipOption,\n FilterChipControl,\n SelectFilterChipProps,\n SingleSelectFilterChipProps,\n DateRangeValue,\n DateRangeFilterChipProps,\n NumberRangeValue,\n NumberRangeFilterChipProps,\n TextFilterChipProps,\n RelativeRangeValue,\n MonthRange,\n AddFilterDefinition,\n AddFilterMenuProps,\n} from \"./filter-chips\";\n\n// Date & time formatting (the app-wide \"27 Jul '26, 09:49 AM\" form)\nexport {\n parseApiDate,\n formatTime,\n formatDateOnly,\n formatDateTime,\n formatTimestamp,\n formatDateStamp,\n formatMonthLabel,\n formatTimeStamp,\n formatWeekdayDate,\n EMPTY_DATE,\n MONTHS_SHORT,\n DAYS_SHORT,\n} from \"./format-datetime\";\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","/**\n * Elevation — the one place flux decides what casts a shadow.\n *\n * Shadows used to be typed inline at ~60 call sites, which is how the library\n * drifted: a Card, an Alert and a Skeleton card are the same kind of surface,\n * but nothing held them to the same value, and \"the default card shadow\" was\n * whatever the last person wrote. These constants are that default, named.\n *\n * They are plain Tailwind utility strings rather than CSS custom properties on\n * purpose. flux ships no stylesheet — consuming apps compile its classes via\n * `@source \".../flux-ui/src\"` — so a `--shadow-*` token would have to be\n * redeclared in every app's globals.css and would silently resolve to nothing\n * in any app that forgot. A literal class here is scanned like any other and\n * needs no app-side setup.\n *\n * Changing a value here restyles every component that uses it. That is the point.\n */\nexport const elevation = {\n /**\n * Flat surfaces that sit ON the page and are delineated by their border:\n * Card, chart surfaces, DataTableCard, Alert, SectionMessage, Skeleton.\n * This is the shadow on the mca-home revenue card, and the reference the\n * rest of the library was pulled onto.\n */\n surface: \"shadow-sm\",\n\n /**\n * Button-shaped things: Button, IconButton, ButtonGroup segments, the\n * pagination page buttons, a table's row CTA. Just enough lift to read as\n * pressable. Ghost and link variants stay flat and do not use this.\n */\n control: \"shadow-sm\",\n\n /**\n * Anything you type into or pick from: Input, Textarea, every select\n * trigger, the date and time pickers, OTP boxes, Checkbox, Radio.\n *\n * Deliberately flat. A field is a well, not a raised object, and a form of\n * ten shadowed controls reads as clutter. Emitted as an explicit\n * `shadow-none` rather than by omitting the class so that a caller passing\n * `shadow-sm` through `className` still wins under tailwind-merge.\n */\n field: \"shadow-none\",\n\n /**\n * Things that genuinely float above the page, where depth is the signal that\n * says \"this is detached and dismissible\". Kept heavier than `surface` on\n * purpose — flattening these is what makes a dropdown look painted on.\n */\n tooltip: \"shadow-md\",\n popover: \"shadow-lg\",\n drawer: \"shadow-xl\",\n modal: \"shadow-2xl\",\n} as const;\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\n\n/** Maps to Tailwind spacing steps used across PayGlocal dashboard surfaces */\nexport type LayoutSpacing = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst gapClass: Record<LayoutSpacing, string> = {\n none: \"gap-0\",\n xs: \"gap-1\",\n sm: \"gap-2\",\n md: \"gap-3\",\n lg: \"gap-4\",\n xl: \"gap-6\",\n};\n\nconst padClass: Record<LayoutSpacing, string> = {\n none: \"p-0\",\n xs: \"p-1\",\n sm: \"p-2\",\n md: \"p-4\",\n lg: \"p-6\",\n xl: \"p-8\",\n};\n\nconst padXClass: Record<LayoutSpacing, string> = {\n none: \"px-0\",\n xs: \"px-1\",\n sm: \"px-2\",\n md: \"px-4\",\n lg: \"px-6\",\n xl: \"px-8\",\n};\n\nconst padYClass: Record<LayoutSpacing, string> = {\n none: \"py-0\",\n xs: \"py-1\",\n sm: \"py-2\",\n md: \"py-4\",\n lg: \"py-6\",\n xl: \"py-8\",\n};\n\nexport type BoxProps = React.HTMLAttributes<HTMLDivElement> & {\n as?: React.ElementType;\n p?: LayoutSpacing;\n px?: LayoutSpacing;\n py?: LayoutSpacing;\n};\n\n/** Neutral block with token-aligned padding; extend with `className` for radius, borders, flex, etc. */\nexport function Box({ as: Comp = \"div\", className, p = \"none\", px, py, ...props }: BoxProps) {\n const axis = px !== undefined || py !== undefined;\n return (\n <Comp\n className={cn(\n !axis && padClass[p],\n px !== undefined && padXClass[px],\n py !== undefined && padYClass[py],\n className\n )}\n {...props}\n />\n );\n}\n\nexport type StackProps = React.HTMLAttributes<HTMLDivElement> & {\n as?: React.ElementType;\n gap?: LayoutSpacing;\n align?: \"start\" | \"center\" | \"stretch\" | \"end\";\n};\n\n/** Vertical flex stack; default gap matches common section rhythm (`gap-4`). */\nexport function Stack({\n as: Comp = \"div\",\n className,\n gap = \"lg\",\n align = \"stretch\",\n ...props\n}: StackProps) {\n const alignCls =\n align === \"start\"\n ? \"items-start\"\n : align === \"center\"\n ? \"items-center\"\n : align === \"end\"\n ? \"items-end\"\n : \"items-stretch\";\n return <Comp className={cn(\"flex flex-col\", gapClass[gap], alignCls, className)} {...props} />;\n}\n\nexport type InlineProps = React.HTMLAttributes<HTMLDivElement> & {\n gap?: LayoutSpacing;\n wrap?: boolean;\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n};\n\n/** Horizontal flex row for toolbars and inline field groups */\nexport function Inline({\n className,\n gap = \"md\",\n wrap = false,\n justify = \"start\",\n ...props\n}: InlineProps) {\n const justifyCls =\n justify === \"center\"\n ? \"justify-center\"\n : justify === \"end\"\n ? \"justify-end\"\n : justify === \"between\"\n ? \"justify-between\"\n : \"justify-start\";\n return (\n <div\n className={cn(\"flex flex-row items-center\", gapClass[gap], justifyCls, wrap && \"flex-wrap\", className)}\n {...props}\n />\n );\n}\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\nimport type { LayoutSpacing } from \"./layout\";\n\n// ---------------------------------------------------------------------------\n// Shared gap map (mirrors layout.tsx)\n// ---------------------------------------------------------------------------\n\nconst gapClass: Record<LayoutSpacing, string> = {\n none: \"gap-0\",\n xs: \"gap-1\",\n sm: \"gap-2\",\n md: \"gap-3\",\n lg: \"gap-4\",\n xl: \"gap-6\",\n};\n\n// ---------------------------------------------------------------------------\n// Grid\n// ---------------------------------------------------------------------------\n\nexport type GridCols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | \"auto\";\n\nexport type ResponsiveCols = {\n base?: GridCols;\n sm?: GridCols;\n md?: GridCols;\n lg?: GridCols;\n};\n\nexport type GridFlow = \"row\" | \"col\" | \"dense\";\n\nexport type GridProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Number of columns (1–12 or \"auto\"), or a responsive object */\n cols?: GridCols | ResponsiveCols;\n /** Number of explicit rows */\n rows?: 1 | 2 | 3 | 4 | 5 | 6 | \"auto\";\n /** Gap between cells */\n gap?: LayoutSpacing;\n /** Grid auto-flow direction */\n flow?: GridFlow;\n};\n\nconst colClass: Record<string, string> = {\n 1: \"grid-cols-1\",\n 2: \"grid-cols-2\",\n 3: \"grid-cols-3\",\n 4: \"grid-cols-4\",\n 5: \"grid-cols-5\",\n 6: \"grid-cols-6\",\n 7: \"grid-cols-7\",\n 8: \"grid-cols-8\",\n 9: \"grid-cols-9\",\n 10: \"grid-cols-10\",\n 11: \"grid-cols-11\",\n 12: \"grid-cols-12\",\n auto: \"grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst smColClass: Record<string, string> = {\n 1: \"sm:grid-cols-1\",\n 2: \"sm:grid-cols-2\",\n 3: \"sm:grid-cols-3\",\n 4: \"sm:grid-cols-4\",\n 5: \"sm:grid-cols-5\",\n 6: \"sm:grid-cols-6\",\n 7: \"sm:grid-cols-7\",\n 8: \"sm:grid-cols-8\",\n 9: \"sm:grid-cols-9\",\n 10: \"sm:grid-cols-10\",\n 11: \"sm:grid-cols-11\",\n 12: \"sm:grid-cols-12\",\n auto: \"sm:grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst mdColClass: Record<string, string> = {\n 1: \"md:grid-cols-1\",\n 2: \"md:grid-cols-2\",\n 3: \"md:grid-cols-3\",\n 4: \"md:grid-cols-4\",\n 5: \"md:grid-cols-5\",\n 6: \"md:grid-cols-6\",\n 7: \"md:grid-cols-7\",\n 8: \"md:grid-cols-8\",\n 9: \"md:grid-cols-9\",\n 10: \"md:grid-cols-10\",\n 11: \"md:grid-cols-11\",\n 12: \"md:grid-cols-12\",\n auto: \"md:grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst lgColClass: Record<string, string> = {\n 1: \"lg:grid-cols-1\",\n 2: \"lg:grid-cols-2\",\n 3: \"lg:grid-cols-3\",\n 4: \"lg:grid-cols-4\",\n 5: \"lg:grid-cols-5\",\n 6: \"lg:grid-cols-6\",\n 7: \"lg:grid-cols-7\",\n 8: \"lg:grid-cols-8\",\n 9: \"lg:grid-cols-9\",\n 10: \"lg:grid-cols-10\",\n 11: \"lg:grid-cols-11\",\n 12: \"lg:grid-cols-12\",\n auto: \"lg:grid-cols-[repeat(auto-fit,minmax(0,1fr))]\",\n};\n\nconst rowClass: Record<string, string> = {\n 1: \"grid-rows-1\",\n 2: \"grid-rows-2\",\n 3: \"grid-rows-3\",\n 4: \"grid-rows-4\",\n 5: \"grid-rows-5\",\n 6: \"grid-rows-6\",\n auto: \"grid-rows-none\",\n};\n\nconst flowClass: Record<GridFlow, string> = {\n row: \"grid-flow-row\",\n col: \"grid-flow-col\",\n dense: \"grid-flow-dense\",\n};\n\nfunction resolveColClasses(cols: GridCols | ResponsiveCols | undefined): string {\n if (cols === undefined) return \"\";\n if (typeof cols === \"number\" || cols === \"auto\") {\n return colClass[String(cols)] ?? \"\";\n }\n // Responsive object\n const { base, sm, md, lg } = cols as ResponsiveCols;\n return cn(\n base !== undefined && colClass[String(base)],\n sm !== undefined && smColClass[String(sm)],\n md !== undefined && mdColClass[String(md)],\n lg !== undefined && lgColClass[String(lg)],\n );\n}\n\nexport const Grid = React.forwardRef<HTMLDivElement, GridProps>(\n ({ className, cols, rows, gap = \"md\", flow, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n \"grid\",\n resolveColClasses(cols),\n rows !== undefined && rowClass[String(rows)],\n gapClass[gap],\n flow !== undefined && flowClass[flow],\n className,\n )}\n {...props}\n />\n );\n },\n);\nGrid.displayName = \"Grid\";\n\n// ---------------------------------------------------------------------------\n// Flex\n// ---------------------------------------------------------------------------\n\nexport type FlexDirection = \"row\" | \"col\" | \"row-reverse\" | \"col-reverse\";\nexport type FlexWrap = boolean | \"reverse\";\nexport type FlexAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type FlexJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\";\n\nexport type FlexProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Flex direction */\n direction?: FlexDirection;\n /** Whether children wrap */\n wrap?: FlexWrap;\n /** Align items (cross axis) */\n align?: FlexAlign;\n /** Justify content (main axis) */\n justify?: FlexJustify;\n /** Gap between children */\n gap?: LayoutSpacing;\n /** Render as inline-flex */\n inline?: boolean;\n};\n\nconst directionClass: Record<FlexDirection, string> = {\n row: \"flex-row\",\n col: \"flex-col\",\n \"row-reverse\": \"flex-row-reverse\",\n \"col-reverse\": \"flex-col-reverse\",\n};\n\nconst alignClass: Record<FlexAlign, string> = {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n baseline: \"items-baseline\",\n};\n\nconst justifyClass: Record<FlexJustify, string> = {\n start: \"justify-start\",\n center: \"justify-center\",\n end: \"justify-end\",\n between: \"justify-between\",\n around: \"justify-around\",\n evenly: \"justify-evenly\",\n};\n\nexport const Flex = React.forwardRef<HTMLDivElement, FlexProps>(\n (\n {\n className,\n direction = \"row\",\n wrap = false,\n align = \"start\",\n justify = \"start\",\n gap = \"md\",\n inline = false,\n ...props\n },\n ref,\n ) => {\n const wrapCls =\n wrap === true ? \"flex-wrap\" : wrap === \"reverse\" ? \"flex-wrap-reverse\" : \"flex-nowrap\";\n\n return (\n <div\n ref={ref}\n className={cn(\n inline ? \"inline-flex\" : \"flex\",\n directionClass[direction],\n wrapCls,\n alignClass[align],\n justifyClass[justify],\n gapClass[gap],\n className,\n )}\n {...props}\n />\n );\n },\n);\nFlex.displayName = \"Flex\";\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { Loader2 } from \"lucide-react\";\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\" | \"ghost\" | \"danger\" | \"outline\" | \"link\";\n size?: \"sm\" | \"md\" | \"lg\";\n isLoading?: boolean;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n}\n\nconst variantClasses: Record<NonNullable<ButtonProps[\"variant\"]>, string> = {\n primary:\n `bg-primary text-primary-foreground border border-primary ${elevation.control} hover:bg-[var(--primary-hover)]`,\n secondary:\n `bg-muted text-foreground border border-border ${elevation.control} hover:bg-muted/85 dark:bg-muted/35 dark:text-foreground dark:border-border dark:hover:bg-muted/55`,\n ghost:\n \"bg-transparent text-foreground border border-transparent hover:bg-muted focus-visible:bg-muted/80 active:bg-muted/90\",\n danger:\n `bg-red-600 text-white border border-red-600 ${elevation.control} hover:bg-red-700`,\n outline:\n `bg-card text-foreground border border-border ${elevation.control} hover:bg-muted`,\n link:\n \"h-auto min-h-0 rounded-md border border-transparent bg-transparent px-2 py-2 text-[15px] font-medium text-primary shadow-none underline-offset-4 hover:bg-primary/5 hover:underline focus-visible:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 disabled:pointer-events-none disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:no-underline\",\n};\n\n/** Heights and padding match dashboard primary actions (~44–48px) and comfortable tap targets. */\nconst sizes = {\n sm: \"h-9 min-h-9 px-3.5 text-xs gap-1.5 rounded-lg\",\n md: \"h-10 min-h-10 px-5 text-sm gap-2 rounded-lg\",\n lg: \"h-[3.25rem] min-h-[3.25rem] px-10 text-[15px] gap-2.5 rounded-xl\",\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n variant = \"primary\",\n size = \"md\",\n isLoading = false,\n leftIcon,\n rightIcon,\n children,\n className,\n disabled,\n ...props\n },\n ref\n ) => {\n return (\n <button\n ref={ref}\n disabled={disabled || isLoading}\n className={cn(\n \"inline-flex items-center justify-center font-medium transition-colors duration-pg-fast ease-pg-standard\",\n // A button's label never wraps. Without this, a narrow button breaks\n // the line between an icon and its text — and an icon passed as a\n // child rather than through `leftIcon` sits inside the same span, so\n // it wraps with the words. Pass `whitespace-normal` in `className`\n // for the rare button that really should wrap.\n \"whitespace-nowrap\",\n variant !== \"link\" && \"disabled:cursor-not-allowed disabled:opacity-50\",\n variant === \"link\" && \"justify-center\",\n variant !== \"link\" && \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n variantClasses[variant],\n variant !== \"link\" && sizes[size],\n className\n )}\n {...props}\n >\n {isLoading ? (\n <Loader2\n className={cn(\n \"animate-spin\",\n size === \"sm\" ? \"size-3.5\" : size === \"lg\" ? \"size-[1.125rem]\" : \"size-3.5\"\n )}\n />\n ) : (\n leftIcon\n )}\n <span className={cn(isLoading && \"opacity-70\")}>{children}</span>\n {!isLoading && rightIcon}\n </button>\n );\n }\n);\nButton.displayName = \"Button\";\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { ChevronDown } from \"lucide-react\";\nimport {\n forwardRef,\n useState,\n useRef,\n useEffect,\n type HTMLAttributes,\n type ButtonHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"./button\";\nimport type { ButtonProps } from \"./button\";\n\n// ---------------------------------------------------------------------------\n// ButtonGroup\n// ---------------------------------------------------------------------------\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n orientation?: \"horizontal\" | \"vertical\";\n variant?: ButtonProps[\"variant\"];\n}\n\nexport const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(\n ({ orientation = \"horizontal\", variant, className, children, ...props }, ref) => {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-variant={variant}\n className={cn(\n \"inline-flex\",\n orientation === \"vertical\" ? \"flex-col\" : \"flex-row\",\n // Horizontal connected borders\n orientation === \"horizontal\" && [\n \"[&>*:not(:first-child)]:rounded-l-none\",\n \"[&>*:not(:last-child)]:rounded-r-none\",\n \"[&>*:not(:first-child)]:-ml-px\",\n ],\n // Vertical connected borders\n orientation === \"vertical\" && [\n \"[&>*:not(:first-child)]:rounded-t-none\",\n \"[&>*:not(:last-child)]:rounded-b-none\",\n \"[&>*:not(:first-child)]:-mt-px\",\n ],\n className\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nButtonGroup.displayName = \"ButtonGroup\";\n\n// ---------------------------------------------------------------------------\n// SplitButton\n// ---------------------------------------------------------------------------\n\nexport interface SplitButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onClick\"> {\n label: ReactNode;\n onClick?: ButtonHTMLAttributes<HTMLButtonElement>[\"onClick\"];\n children?: ReactNode;\n variant?: ButtonProps[\"variant\"];\n size?: ButtonProps[\"size\"];\n isLoading?: boolean;\n}\n\nexport const SplitButton = forwardRef<HTMLDivElement, SplitButtonProps>(\n (\n {\n label,\n onClick,\n children,\n variant = \"primary\",\n size = \"md\",\n isLoading = false,\n className,\n disabled,\n ...props\n },\n ref\n ) => {\n const [open, setOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Merge forwarded ref with internal ref\n function setRefs(el: HTMLDivElement | null) {\n (containerRef as React.MutableRefObject<HTMLDivElement | null>).current = el;\n if (typeof ref === \"function\") {\n ref(el);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = el;\n }\n }\n\n // Close dropdown when clicking outside\n useEffect(() => {\n if (!open) return;\n function handleOutside(e: MouseEvent) {\n if (\n containerRef.current &&\n !containerRef.current.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n }\n document.addEventListener(\"mousedown\", handleOutside);\n return () => document.removeEventListener(\"mousedown\", handleOutside);\n }, [open]);\n\n return (\n <div\n ref={setRefs}\n className={cn(\"relative inline-flex\", className)}\n {...(props as HTMLAttributes<HTMLDivElement>)}\n >\n {/* Primary action button */}\n <Button\n variant={variant}\n size={size}\n isLoading={isLoading}\n disabled={disabled}\n onClick={onClick}\n className=\"rounded-r-none\"\n >\n {label}\n </Button>\n\n {/* Dropdown trigger */}\n <button\n type=\"button\"\n disabled={disabled || isLoading}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n onClick={() => setOpen((v) => !v)}\n className={cn(\n \"inline-flex items-center justify-center px-2 rounded-l-none -ml-px\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n // Match variant styling\n variant === \"primary\" &&\n `bg-primary text-primary-foreground border border-primary ${elevation.control} hover:bg-[var(--primary-hover)] border-l border-l-primary-foreground/20`,\n variant === \"secondary\" &&\n `bg-muted text-foreground border border-border ${elevation.control} hover:bg-muted/85 dark:bg-muted/35 dark:hover:bg-muted/55 border-l-0`,\n variant === \"outline\" &&\n `bg-card text-foreground border border-border ${elevation.control} hover:bg-muted border-l-0`,\n variant === \"ghost\" &&\n \"bg-transparent text-foreground border border-transparent hover:bg-muted border-l-0\",\n variant === \"danger\" &&\n `bg-red-600 text-white border border-red-600 ${elevation.control} hover:bg-red-700 border-l border-l-white/20`,\n // Size heights to match Button\n size === \"sm\" && \"h-9 min-h-9 rounded-lg\",\n size === \"md\" && \"h-10 min-h-10 rounded-lg\",\n size === \"lg\" && \"h-[3.25rem] min-h-[3.25rem] rounded-xl\"\n )}\n >\n <ChevronDown\n className={cn(\n \"transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\",\n size === \"sm\" ? \"size-3.5\" : size === \"lg\" ? \"size-[1.125rem]\" : \"size-4\"\n )}\n />\n </button>\n\n {/* Dropdown menu */}\n {open && children && (\n <div\n role=\"menu\"\n className={cn(\n \"absolute right-0 top-full mt-1 z-50\",\n \"bg-card border border-border rounded-lg py-1 min-w-32\",\n elevation.popover\n )}\n >\n {children}\n </div>\n )}\n </div>\n );\n }\n);\nSplitButton.displayName = \"SplitButton\";\n\n// ---------------------------------------------------------------------------\n// SplitButtonItem — convenience wrapper for dropdown items\n// ---------------------------------------------------------------------------\n\nexport interface SplitButtonItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const SplitButtonItem = forwardRef<HTMLButtonElement, SplitButtonItemProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <button\n ref={ref}\n role=\"menuitem\"\n type=\"button\"\n className={cn(\n \"block w-full text-left px-3 py-2 text-sm text-foreground\",\n \"hover:bg-muted transition-colors duration-pg-fast ease-pg-standard\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"focus-visible:outline-none focus-visible:bg-muted\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n );\n }\n);\nSplitButtonItem.displayName = \"SplitButtonItem\";\n","import * as React from \"react\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<\"input\">>(\n ({ className, type, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-11 min-h-11 w-full rounded-lg border border-border bg-card px-4 py-2 text-[15px] leading-tight transition-colors\",\n elevation.field,\n \"file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground\",\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:bg-muted/40 disabled:opacity-60\",\n \"read-only:bg-muted/25 read-only:text-muted-foreground\",\n \"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/25 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n }\n);\nInput.displayName = \"Input\";\n\nexport { Input };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Eye, EyeOff } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { Input } from \"./input\";\n\nexport type PasswordInputProps = Omit<React.ComponentProps<typeof Input>, \"type\">;\n\nexport const PasswordInput = React.forwardRef<HTMLInputElement, PasswordInputProps>(\n ({ className, ...props }, ref) => {\n const [visible, setVisible] = React.useState(false);\n return (\n <div className=\"relative\">\n <Input\n ref={ref}\n type={visible ? \"text\" : \"password\"}\n className={cn(\"pr-10\", className)}\n {...props}\n />\n <button\n type=\"button\"\n onClick={() => setVisible((v) => !v)}\n aria-label={visible ? \"Hide password\" : \"Show password\"}\n tabIndex={-1}\n className=\"absolute inset-y-0 right-0 flex w-10 items-center justify-center text-muted-foreground transition-colors hover:text-foreground\"\n >\n {visible ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n </div>\n );\n }\n);\nPasswordInput.displayName = \"PasswordInput\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport interface OtpInputProps {\n /** Current OTP value (controlled). */\n value: string;\n /** Fires with the full joined string on every change. */\n onChange: (value: string) => void;\n /** Number of digit boxes. */\n length?: number;\n /** Fired when all boxes are filled. */\n onComplete?: (value: string) => void;\n disabled?: boolean;\n invalid?: boolean;\n autoFocus?: boolean;\n \"aria-label\"?: string;\n}\n\nexport function OtpInput({\n value,\n onChange,\n length = 6,\n onComplete,\n disabled,\n invalid,\n autoFocus,\n \"aria-label\": ariaLabel = \"One-time passcode\",\n}: OtpInputProps) {\n const refs = React.useRef<Array<HTMLInputElement | null>>([]);\n const digits = React.useMemo(() => {\n const arr = value.split(\"\").slice(0, length);\n return Array.from({ length }, (_, i) => arr[i] ?? \"\");\n }, [value, length]);\n\n const emit = (next: string) => {\n onChange(next);\n if (next.length === length && !next.includes(\" \")) onComplete?.(next);\n };\n\n const setAt = (index: number, char: string) => {\n const arr = digits.slice();\n arr[index] = char;\n emit(arr.join(\"\").replace(/\\s+$/g, \"\"));\n };\n\n const handleChange = (index: number, raw: string) => {\n const onlyDigits = raw.replace(/\\D/g, \"\");\n if (!onlyDigits) {\n setAt(index, \"\");\n return;\n }\n const chars = onlyDigits.split(\"\");\n const arr = digits.slice();\n let cursor = index;\n for (const c of chars) {\n if (cursor >= length) break;\n arr[cursor] = c;\n cursor += 1;\n }\n emit(arr.join(\"\"));\n refs.current[Math.min(cursor, length - 1)]?.focus();\n };\n\n const handleKeyDown = (index: number, e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Backspace\") {\n e.preventDefault();\n if (digits[index]) {\n setAt(index, \"\");\n } else if (index > 0) {\n refs.current[index - 1]?.focus();\n setAt(index - 1, \"\");\n }\n } else if (e.key === \"ArrowLeft\" && index > 0) {\n refs.current[index - 1]?.focus();\n } else if (e.key === \"ArrowRight\" && index < length - 1) {\n refs.current[index + 1]?.focus();\n }\n };\n\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n const pasted = e.clipboardData.getData(\"text\").replace(/\\D/g, \"\").slice(0, length);\n if (!pasted) return;\n emit(pasted);\n refs.current[Math.min(pasted.length, length - 1)]?.focus();\n };\n\n return (\n <div className=\"flex gap-2\" role=\"group\" aria-label={ariaLabel}>\n {digits.map((digit, i) => (\n <input\n key={i}\n ref={(el) => { refs.current[i] = el; }}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete={i === 0 ? \"one-time-code\" : \"off\"}\n maxLength={length}\n value={digit}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n autoFocus={autoFocus && i === 0}\n onChange={(e) => handleChange(i, e.target.value)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={handlePaste}\n className={cn(\n \"h-12 w-11 rounded-lg border bg-card text-center text-lg font-semibold text-foreground transition-colors\",\n elevation.field,\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 focus-visible:border-primary\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n invalid ? \"border-destructive ring-destructive/20\" : \"border-input\"\n )}\n />\n ))}\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, ChevronDown, Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { filterOptions, type OptionFilter } from \"./option-filter\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nexport interface CheckboxSelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface CheckboxSelectProps {\n options: CheckboxSelectOption[];\n value: string[];\n onChange: (values: string[]) => void;\n placeholder?: string;\n showSearch?: boolean;\n /** Placeholder inside the search box. Default \"Search...\". */\n searchPlaceholder?: string;\n /**\n * Replaces the default match (label or value, case-insensitive) — for a list\n * that has to be findable by something the row does not display.\n */\n filterOption?: OptionFilter<CheckboxSelectOption>;\n disabled?: boolean;\n maxDisplay?: number;\n className?: string;\n}\n\nfunction getTriggerLabel(\n value: string[],\n options: CheckboxSelectOption[],\n placeholder: string,\n maxDisplay: number\n): string {\n if (value.length === 0) return placeholder;\n if (value.length === options.length) return \"All\";\n if (value.length <= maxDisplay) {\n const labels = value\n .map((v) => options.find((o) => o.value === v)?.label ?? v)\n .filter(Boolean);\n return labels.join(\", \");\n }\n return `${value.length} selected`;\n}\n\nconst CheckboxSelect = React.forwardRef<HTMLButtonElement, CheckboxSelectProps>(\n (\n {\n options,\n value,\n onChange,\n placeholder = \"Select options\",\n showSearch = false,\n searchPlaceholder = \"Search...\",\n filterOption,\n disabled = false,\n maxDisplay = 2,\n className,\n },\n ref\n ) => {\n const [open, setOpen] = React.useState(false);\n const [search, setSearch] = React.useState(\"\");\n\n // Shared with SingleSelect and SelectFilterChip: the value matches as well\n // as the label, so a raw code finds its prettified row.\n const filtered = React.useMemo(\n () => filterOptions(options, search, filterOption),\n [options, search, filterOption]\n );\n\n const allFilteredValues = filtered.filter((o) => !o.disabled).map((o) => o.value);\n const allFilteredSelected =\n allFilteredValues.length > 0 && allFilteredValues.every((v) => value.includes(v));\n const someFilteredSelected = allFilteredValues.some((v) => value.includes(v));\n\n function handleSelectAll() {\n if (allFilteredSelected) {\n onChange(value.filter((v) => !allFilteredValues.includes(v)));\n } else {\n const merged = Array.from(new Set([...value, ...allFilteredValues]));\n onChange(merged);\n }\n }\n\n function handleClearAll() {\n onChange(value.filter((v) => !allFilteredValues.includes(v)));\n }\n\n function handleToggle(optValue: string) {\n if (value.includes(optValue)) {\n onChange(value.filter((v) => v !== optValue));\n } else {\n onChange([...value, optValue]);\n }\n }\n\n const triggerLabel = getTriggerLabel(value, options, placeholder, maxDisplay);\n const hasSelection = value.length > 0;\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n className={cn(\n \"flex h-11 w-full items-center justify-between gap-2.5 rounded-lg border border-border bg-card px-4 py-2 text-[15px] outline-none\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n hasSelection ? \"text-foreground\" : \"text-muted-foreground\",\n className\n )}\n >\n <span className=\"truncate\">{triggerLabel}</span>\n <ChevronDown\n className={cn(\n \"h-4 w-4 shrink-0 text-muted-foreground opacity-70 transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\"\n )}\n />\n </button>\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal>\n {/* Takes over the scroll lock when this opens inside a Dialog or\n Drawer, so the list can be scrolled. See `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={6}\n collisionPadding={8}\n className={cn(\n \"z-[120] min-w-[var(--radix-popover-trigger-width)] w-full rounded-xl border border-border bg-popover text-popover-foreground outline-none p-1\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\"\n )}\n >\n {showSearch && (\n <div className=\"relative mb-1 px-1 pt-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n className={cn(\n \"flex h-9 w-full rounded-md border border-border bg-card pl-8 pr-3 text-sm placeholder:text-muted-foreground\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n />\n </div>\n )}\n\n <div className=\"flex items-center justify-between px-2 py-1.5\">\n <button\n type=\"button\"\n onClick={handleSelectAll}\n className={cn(\n \"text-xs font-medium transition-colors duration-pg-fast ease-pg-standard\",\n allFilteredSelected\n ? \"text-primary hover:text-primary/80\"\n : someFilteredSelected\n ? \"text-primary hover:text-primary/80\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {allFilteredSelected ? \"Deselect all\" : \"Select all\"}\n </button>\n {value.length > 0 && (\n <button\n type=\"button\"\n onClick={handleClearAll}\n className=\"text-xs font-medium text-muted-foreground transition-colors duration-pg-fast ease-pg-standard hover:text-foreground\"\n >\n Clear\n </button>\n )}\n </div>\n\n <div className=\"my-0.5 h-px bg-border mx-1\" />\n\n {/* Capped by the room the popover has, so a long list near the\n bottom of a dialog scrolls rather than running off-screen. */}\n <div className=\"overflow-y-auto overscroll-contain py-0.5 max-h-[min(15rem,var(--radix-popover-content-available-height,15rem))]\">\n {filtered.length === 0 ? (\n <div className=\"px-3 py-6 text-center text-sm text-muted-foreground\">\n No options found.\n </div>\n ) : (\n filtered.map((option) => {\n const checked = value.includes(option.value);\n return (\n <div\n key={option.value}\n role=\"option\"\n aria-selected={checked}\n aria-disabled={option.disabled}\n onClick={() => !option.disabled && handleToggle(option.value)}\n className={cn(\n \"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm select-none\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n option.disabled\n ? \"cursor-not-allowed opacity-50\"\n : \"cursor-pointer hover:bg-muted\"\n )}\n >\n <CheckboxPrimitive.Root\n checked={checked}\n disabled={option.disabled}\n onCheckedChange={() => !option.disabled && handleToggle(option.value)}\n onClick={(e) => e.stopPropagation()}\n className={cn(\n \"peer h-4 w-4 shrink-0 rounded-md border border-border bg-card\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary data-[state=checked]:border-primary\"\n )}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-primary-foreground\">\n <Check className=\"size-3\" strokeWidth={3} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n <span\n className={cn(\n \"leading-none\",\n checked ? \"text-foreground\" : \"text-foreground\"\n )}\n >\n {option.label}\n </span>\n </div>\n );\n })\n )}\n </div>\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n }\n);\n\nCheckboxSelect.displayName = \"CheckboxSelect\";\n\nexport { CheckboxSelect };\n","/**\n * Shared option-search behaviour for the select family.\n *\n * Every picker that can be searched matches the same way, so a user who learns\n * that typing a raw code works in one dropdown can rely on it in the next.\n */\n\nexport interface FilterableOption {\n value: string;\n label: string;\n}\n\n/**\n * A custom match. Return true to keep the option in the list.\n *\n * The `query` arrives trimmed but otherwise untouched, so a predicate that\n * cares about case can have it.\n */\nexport type OptionFilter<T extends FilterableOption = FilterableOption> = (\n option: T,\n query: string\n) => boolean;\n\n/**\n * The default: case-insensitive against the label **and** the value, so \"nz\"\n * finds New Zealand and a raw status code finds its prettified row. Someone who\n * thinks in codes should not have to know the display name.\n *\n * This is the rule `SelectFilterChip` already applied to its list; the form\n * fields now share it rather than each picker inventing its own.\n */\nexport function defaultOptionFilter<T extends FilterableOption>(option: T, query: string): boolean {\n const q = query.toLowerCase();\n return option.label.toLowerCase().includes(q) || option.value.toLowerCase().includes(q);\n}\n\n/** Applies `filter` (or the default) to `options`, with an empty query passing everything. */\nexport function filterOptions<T extends FilterableOption>(\n options: T[],\n query: string,\n filter?: OptionFilter<T>\n): T[] {\n const q = query.trim();\n if (!q) return options;\n const match = filter ?? defaultOptionFilter;\n return options.filter((o) => match(o, q));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { RemoveScroll } from \"react-remove-scroll\";\n\n/**\n * Scrolling inside an overlay that sits on top of another overlay.\n *\n * ## The defect this exists to prevent\n *\n * A modal `Dialog` or `Drawer` installs a `react-remove-scroll` lock. That lock\n * listens for `wheel` and `touchmove` on `document` and, for any event whose\n * target is **outside** the locked subtree, calls `preventDefault()` — the\n * \"outside or shard event\" branch of its `SideEffect`. Radix passes only the\n * dialog's own content as a shard.\n *\n * Every panel a picker opens is portalled to `document.body`, which puts it\n * outside that subtree. So the panel renders, its list has `overflow-y-auto`,\n * and the wheel does nothing. It is invisible in code review, because the\n * component is correct on its own; it only misbehaves under an overlay.\n *\n * ## Why a lock, not an exception\n *\n * The same `SideEffect` returns early unless its own lock is the last one\n * pushed. So the fix is not to poke a hole in the dialog's lock — it is for the\n * panel to push a lock of its own while it is open, which suspends the one\n * underneath and makes the panel's subtree the locked one. When it closes, its\n * lock pops and the dialog's resumes.\n *\n * ## Why not just make the popover `modal`\n *\n * Radix installs a lock of its own for a `modal` popover, which would also fix\n * the wheel — but it comes with a focus trap and with outside clicks being\n * swallowed by the dismiss layer. Every popover already living inside a dialog\n * would start behaving differently for the sake of a scrolling fix. So the lock\n * is pushed directly, by {@link ScrollLockTakeover}, and modality is left\n * alone. `PopoverContent` wraps every panel in it, which covers the pickers and\n * anything an app composes; the hand-rolled `createPortal` panels\n * (`DatePicker`, `TimePicker`) wrap theirs the same way.\n */\n\n/**\n * Whether a `react-remove-scroll` lock is currently held — by a modal Dialog,\n * Drawer, AlertDialog, or another picker.\n *\n * `data-scroll-locked` is set on `<body>` by `react-remove-scroll-bar`, which\n * every such lock goes through, so this is the library's own signal rather\n * than a guess about which overlay is open.\n */\nexport function isScrollLocked(): boolean {\n return typeof document !== \"undefined\" && document.body.hasAttribute(\"data-scroll-locked\");\n}\n\n/**\n * The same takeover for a panel that portals itself instead of going through\n * Radix. Renders children untouched when no lock is held, so a picker on a\n * plain page behaves exactly as before.\n *\n * `removeScrollBar` is off: the page's scrollbar is already gone, and a second\n * `RemoveScrollBar` re-measures a gap that is now zero and writes it back over\n * the dialog's, shifting the layout while the panel is open. The consequence is\n * that this takeover does **not** bump `data-scroll-locked`; the wrapper's\n * `data-scroll-lock-takeover` is the marker instead, in the DOM for debugging\n * and for tests.\n */\nexport function ScrollLockTakeover({ children }: { children: React.ReactNode }) {\n // Read once, when the panel mounts — that is the moment it opens.\n const [active] = React.useState(isScrollLocked);\n if (!active) return <>{children}</>;\n return (\n <RemoveScroll removeScrollBar={false} allowPinchZoom data-scroll-lock-takeover=\"\">\n {children}\n </RemoveScroll>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { Check, ChevronDown, Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { filterOptions, type OptionFilter } from \"./option-filter\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nexport interface SingleSelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n /** Optional leading glyph — a flag, a brand mark, a status dot. */\n icon?: React.ReactNode;\n}\n\nexport interface SingleSelectProps {\n /** Put on the trigger, so a `FieldLabel`'s `htmlFor` can point at it. */\n id?: string;\n options: SingleSelectOption[];\n /** The chosen value, or \"\" for none. */\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n /**\n * Show a search box above the list. Left unset it appears once there are\n * `searchThreshold` options — a search field over three items is noise, and\n * remembering to pass the flag is how two lists of the same length end up\n * behaving differently.\n */\n showSearch?: boolean;\n /** How many options before the search box appears on its own. Default 8. */\n searchThreshold?: number;\n /** Placeholder inside that search box. Default \"Search...\". */\n searchPlaceholder?: string;\n /**\n * Replaces the default match (label or value, case-insensitive) — for a list\n * that has to be findable by something the row does not display, such as a\n * currency's full name behind a symbol.\n */\n filterOption?: OptionFilter<SingleSelectOption>;\n /** Adds a \"Clear\" row so a chosen value can be taken back to \"\". */\n clearable?: boolean;\n /** Line shown when the list is empty. Default \"No options found.\". */\n emptyText?: string;\n disabled?: boolean;\n /** Marks the field as failing validation, matching `Input`'s aria-invalid styling. */\n invalid?: boolean;\n className?: string;\n}\n\n/**\n * One-of-many as a **form field** — the single-value counterpart to\n * {@link CheckboxSelect}, with the same trigger, popover and search.\n *\n * Radix `Select` cannot host a text input (its own typeahead owns the\n * keystrokes), so a searchable single select has to be a popover over a\n * listbox. Before this existed, every screen needing one built that popover\n * itself, which is how a design system ends up with four dropdowns that filter\n * differently. `SingleSelectFilterChip` remains the toolbar form of the same\n * idea; this is the one that sits in a form, under a `FieldLabel`.\n */\nconst SingleSelect = React.forwardRef<HTMLButtonElement, SingleSelectProps>(\n (\n {\n id,\n options,\n value,\n onChange,\n placeholder = \"Select an option\",\n showSearch,\n searchThreshold = 8,\n searchPlaceholder = \"Search...\",\n filterOption,\n clearable = false,\n emptyText = \"No options found.\",\n disabled = false,\n invalid = false,\n className,\n },\n ref\n ) => {\n const [open, setOpen] = React.useState(false);\n const [search, setSearch] = React.useState(\"\");\n const searchRef = React.useRef<HTMLInputElement>(null);\n\n const searchable = showSearch ?? options.length >= searchThreshold;\n\n const filtered = React.useMemo(\n () => (searchable ? filterOptions(options, search, filterOption) : options),\n [options, search, filterOption, searchable]\n );\n\n const selected = options.find((o) => o.value === value);\n\n function close() {\n setOpen(false);\n // Dropped on close so the next open starts from the whole list rather\n // than yesterday's query.\n setSearch(\"\");\n }\n\n function pick(next: string) {\n onChange(next);\n close();\n }\n\n return (\n <PopoverPrimitive.Root\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n >\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={ref}\n id={id}\n type=\"button\"\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-invalid={invalid || undefined}\n className={cn(\n \"flex h-11 w-full items-center justify-between gap-2.5 rounded-lg border border-border bg-card px-4 py-2 text-[15px] outline-none\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/25 dark:aria-invalid:ring-destructive/40\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n selected ? \"text-foreground\" : \"text-muted-foreground\",\n className\n )}\n >\n <span className=\"flex min-w-0 items-center gap-2 truncate\">\n {selected?.icon}\n <span className=\"truncate\">{selected?.label ?? placeholder}</span>\n </span>\n <ChevronDown\n className={cn(\n \"h-4 w-4 shrink-0 text-muted-foreground opacity-70 transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\"\n )}\n />\n </button>\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal>\n {/* Takes over the scroll lock when this opens inside a Dialog or\n Drawer, so the list can be scrolled. See `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={6}\n collisionPadding={8}\n className={cn(\n \"z-[120] min-w-[var(--radix-popover-trigger-width)] w-full rounded-xl border border-border bg-popover text-popover-foreground outline-none p-1\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\"\n )}\n >\n {searchable && (\n <div className=\"relative mb-1 px-1 pt-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder={searchPlaceholder}\n aria-label={searchPlaceholder}\n className={cn(\n \"flex h-9 w-full rounded-md border border-border bg-card pl-8 pr-3 text-sm placeholder:text-muted-foreground\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n />\n </div>\n )}\n\n {clearable && value !== \"\" && (\n <>\n <button\n type=\"button\"\n onClick={() => pick(\"\")}\n className=\"w-full rounded-md px-3 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors duration-pg-fast ease-pg-standard hover:bg-muted hover:text-foreground\"\n >\n Clear\n </button>\n <div className=\"my-0.5 h-px bg-border mx-1\" />\n </>\n )}\n\n {/* Capped by the room the popover has, so a long list near the\n bottom of a dialog scrolls rather than running off-screen. */}\n <div\n role=\"listbox\"\n className=\"overflow-y-auto overscroll-contain py-0.5 max-h-[min(15rem,var(--radix-popover-content-available-height,15rem))]\"\n >\n {filtered.length === 0 ? (\n <div className=\"px-3 py-6 text-center text-sm text-muted-foreground\">\n {emptyText}\n </div>\n ) : (\n filtered.map((option) => {\n const isSelected = option.value === value;\n return (\n <div\n key={option.value}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={option.disabled}\n onClick={() => !option.disabled && pick(option.value)}\n className={cn(\n \"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm select-none\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n option.disabled\n ? \"cursor-not-allowed opacity-50\"\n : \"cursor-pointer hover:bg-muted\",\n isSelected && \"bg-muted\"\n )}\n >\n {option.icon}\n <span className=\"min-w-0 flex-1 truncate leading-none\">{option.label}</span>\n {isSelected && <Check className=\"size-3.5 shrink-0 text-primary\" strokeWidth={3} />}\n </div>\n );\n })\n )}\n </div>\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n }\n);\n\nSingleSelect.displayName = \"SingleSelect\";\n\nexport { SingleSelect };\n","import * as React from \"react\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<\"textarea\">>(\n ({ className, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n \"flex min-h-[5.5rem] w-full rounded-lg border border-border bg-card px-4 py-3 text-[15px] leading-relaxed transition-colors\",\n elevation.field,\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n }\n);\nTextarea.displayName = \"Textarea\";\n\nexport { Textarea };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport type CheckboxSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {\n size?: CheckboxSize;\n}\n\nconst sizeClasses: Record<CheckboxSize, string> = {\n sm: \"h-3.5 w-3.5 rounded\",\n md: \"h-4 w-4 rounded-md\",\n lg: \"h-[1.125rem] w-[1.125rem] rounded-md\",\n};\n\nconst iconSizes: Record<CheckboxSize, string> = {\n sm: \"size-2.5\",\n md: \"size-3\",\n lg: \"size-3.5\",\n};\n\nconst Checkbox = React.forwardRef<\n React.ElementRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n className={cn(\n \"peer shrink-0 border border-border bg-card transition-colors duration-pg-fast ease-pg-standard\",\n elevation.field,\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary data-[state=checked]:border-primary\",\n \"data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary\",\n sizeClasses[size],\n className\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-primary-foreground\">\n {props.checked === \"indeterminate\" ? (\n <Minus className={iconSizes[size]} strokeWidth={3} />\n ) : (\n <Check className={iconSizes[size]} strokeWidth={3} />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <RadioGroupPrimitive.Root\n ref={ref}\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n));\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\n\nexport type RadioGroupItemProps = React.ComponentPropsWithoutRef<\n typeof RadioGroupPrimitive.Item\n>;\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, ...props }, ref) => (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n \"size-4 shrink-0 rounded-full border border-border bg-card\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"data-[state=checked]:border-primary\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <span className=\"block size-2 rounded-full bg-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n));\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\n\nexport { RadioGroup, RadioGroupItem };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst switchRootVariants = cva(\n [\n \"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=unchecked]:bg-muted data-[state=unchecked]:border-border\",\n \"data-[state=checked]:bg-primary data-[state=checked]:border-transparent\",\n ],\n {\n variants: {\n size: {\n sm: \"h-5 w-9\",\n md: \"h-6 w-11\",\n lg: \"h-7 w-[3.25rem]\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n }\n);\n\nconst switchThumbVariants = cva(\n [\n \"pointer-events-none block rounded-full bg-white\",\n elevation.control,\n \"transition-transform duration-pg-fast ease-pg-standard\",\n \"ring-0\",\n ],\n {\n variants: {\n size: {\n sm: \"size-3.5 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5\",\n md: \"size-4.5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0.5\",\n lg: \"size-5.5 data-[state=checked]:translate-x-6 data-[state=unchecked]:translate-x-0.5\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n }\n);\n\nexport interface SwitchProps\n extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>,\n VariantProps<typeof switchRootVariants> {}\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, size, ...props }, ref) => (\n <SwitchPrimitive.Root\n ref={ref}\n className={cn(switchRootVariants({ size }), className)}\n {...props}\n >\n <SwitchPrimitive.Thumb className={cn(switchThumbVariants({ size }))} />\n </SwitchPrimitive.Root>\n));\nSwitch.displayName = SwitchPrimitive.Root.displayName;\n\nexport { Switch };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {}\n\nconst Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, SliderProps>(\n ({ className, ...props }, ref) => (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\"relative flex w-full touch-none select-none items-center\", className)}\n {...props}\n >\n <SliderPrimitive.Track className=\"relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted\">\n <SliderPrimitive.Range className=\"absolute h-full bg-primary\" />\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb className={cn(\n \"block h-[18px] w-[18px] rounded-full border-2 border-primary bg-card transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 disabled:pointer-events-none disabled:opacity-50\",\n elevation.control\n )} />\n </SliderPrimitive.Root>\n )\n);\nSlider.displayName = SliderPrimitive.Root.displayName;\n\nexport { Slider };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { AlertCircle } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type FormValues = Record<string, string>;\nexport type FormErrors = Record<string, string>;\n\nexport interface ValidatorRule {\n required?: boolean | string;\n minLength?: { value: number; message: string };\n maxLength?: { value: number; message: string };\n pattern?: { value: RegExp; message: string };\n validate?: (value: string) => string | undefined;\n}\n\nexport interface FieldConfig {\n defaultValue?: string;\n rules?: ValidatorRule;\n}\n\nexport type FieldsConfig = Record<string, FieldConfig>;\n\nexport interface RegisterResult {\n name: string;\n id: string;\n value: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;\n onBlur: () => void;\n}\n\nexport interface UseFormReturn {\n values: FormValues;\n errors: FormErrors;\n register: (name: string) => RegisterResult;\n handleSubmit: (onValid: (values: FormValues) => void, onInvalid?: (errors: FormErrors) => void) => (e: React.FormEvent) => void;\n setError: (name: string, message: string) => void;\n clearError: (name: string) => void;\n reset: () => void;\n setValue: (name: string, value: string) => void;\n}\n\nexport function useForm(fields: FieldsConfig = {}): UseFormReturn {\n const initial = Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, v.defaultValue ?? \"\"]));\n const [values, setValues] = React.useState<FormValues>(initial);\n const [errors, setErrors] = React.useState<FormErrors>({});\n\n function validate(name: string, value: string): string | undefined {\n const rules = fields[name]?.rules;\n if (!rules) return undefined;\n if (rules.required && !value.trim()) return typeof rules.required === \"string\" ? rules.required : \"This field is required\";\n if (rules.minLength && value.length < rules.minLength.value) return rules.minLength.message;\n if (rules.maxLength && value.length > rules.maxLength.value) return rules.maxLength.message;\n if (rules.pattern && !rules.pattern.value.test(value)) return rules.pattern.message;\n if (rules.validate) return rules.validate(value);\n }\n\n const register = (name: string): RegisterResult => ({\n name,\n id: name,\n value: values[name] ?? \"\",\n onChange: (e) => setValues(v => ({ ...v, [name]: e.target.value })),\n onBlur: () => {\n const err = validate(name, values[name] ?? \"\");\n setErrors(e => err ? { ...e, [name]: err } : (({ [name]: _, ...rest }) => rest)(e));\n },\n });\n\n const handleSubmit = (onValid: (v: FormValues) => void, onInvalid?: (e: FormErrors) => void) => (e: React.FormEvent) => {\n e.preventDefault();\n const newErrors: FormErrors = {};\n for (const [name] of Object.entries(fields)) {\n const err = validate(name, values[name] ?? \"\");\n if (err) newErrors[name] = err;\n }\n if (Object.keys(newErrors).length > 0) {\n setErrors(newErrors);\n onInvalid?.(newErrors);\n } else {\n setErrors({});\n onValid(values);\n }\n };\n\n return {\n values,\n errors,\n register,\n handleSubmit,\n setError: (name, msg) => setErrors(e => ({ ...e, [name]: msg })),\n clearError: (name) => setErrors(e => (({ [name]: _, ...rest }) => rest)(e)),\n reset: () => { setValues(initial); setErrors({}); },\n setValue: (name, value) => setValues(v => ({ ...v, [name]: value })),\n };\n}\n\nexport interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {}\n\nconst Form = React.forwardRef<HTMLFormElement, FormProps>(\n ({ className, ...props }, ref) => (\n <form ref={ref} className={cn(\"space-y-4\", className)} {...props} />\n )\n);\nForm.displayName = \"Form\";\n\nexport interface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col gap-1.5\", className)} {...props} />\n )\n);\nFormItem.displayName = \"FormItem\";\n\nexport interface FormLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n required?: boolean;\n}\n\nconst FormLabel = React.forwardRef<HTMLLabelElement, FormLabelProps>(\n ({ className, required, children, ...props }, ref) => (\n <label ref={ref} className={cn(\"text-sm font-medium text-foreground\", className)} {...props}>\n {children}\n {required && <span className=\"ml-1 text-destructive\">*</span>}\n </label>\n )\n);\nFormLabel.displayName = \"FormLabel\";\n\nexport interface FormControlProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormControl = React.forwardRef<HTMLDivElement, FormControlProps>(\n ({ ...props }, ref) => <div ref={ref} {...props} />\n);\nFormControl.displayName = \"FormControl\";\n\nexport interface FormDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, FormDescriptionProps>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-xs text-muted-foreground\", className)} {...props} />\n )\n);\nFormDescription.displayName = \"FormDescription\";\n\nexport interface FormErrorProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormError = React.forwardRef<HTMLParagraphElement, FormErrorProps>(\n ({ className, children, ...props }, ref) =>\n children ? (\n <p ref={ref} className={cn(\"flex items-center gap-1 text-xs text-destructive\", className)} {...props}>\n <AlertCircle className=\"size-3 shrink-0\" />\n {children}\n </p>\n ) : null\n);\nFormError.displayName = \"FormError\";\n\nexport interface FormFieldProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormField = React.forwardRef<HTMLDivElement, FormFieldProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col gap-1.5\", className)} {...props} />\n )\n);\nFormField.displayName = \"FormField\";\n\nexport { Form, FormItem, FormLabel, FormControl, FormDescription, FormError, FormField };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\nimport { Label } from \"./label\";\nimport { Separator } from \"./separator\";\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-6\",\n \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldLegend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-3 font-medium\",\n \"data-[variant=legend]:text-base\",\n \"data-[variant=label]:text-sm\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva(\"group/field flex w-full gap-3 data-[invalid=true]:text-destructive\", {\n variants: {\n orientation: {\n vertical: [\"flex-col [&>*]:w-full [&>.sr-only]:w-auto\"],\n horizontal: [\n \"flex-row items-center\",\n \"[&>[data-slot=field-label]]:flex-auto\",\n \"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start\",\n ],\n responsive: [\n \"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto\",\n \"@md/field-group:[&>[data-slot=field-label]]:flex-auto\",\n \"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n ],\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n});\n\nfunction Field({\n className,\n orientation = \"vertical\",\n invalid,\n disabled,\n ...props\n}: React.ComponentProps<\"div\"> &\n VariantProps<typeof fieldVariants> & {\n invalid?: boolean;\n disabled?: boolean;\n }) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n data-invalid={invalid ? true : undefined}\n data-disabled={disabled ? true : undefined}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\", className)}\n {...props}\n />\n );\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50\",\n \"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 [&>[data-slot=field]]:p-4\",\n \"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-sm font-normal leading-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance\",\n \"nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5\",\n \"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\",\n className\n )}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children ? (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n ) : null}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return errors[0].message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {errors.map(\n (error, index) => error?.message && <li key={index}>{error.message}</li>\n )}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-sm font-normal text-destructive\", className)}\n {...props}\n >\n {content}\n </div>\n );\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\n\nimport { cn } from \"./utils\";\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { Input } from \"./input\";\nimport { Textarea } from \"./textarea\";\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"input-group\"\n role=\"group\"\n className={cn(\n \"group/input-group relative flex w-full items-stretch rounded-xl border border-border bg-card outline-none transition-[color,box-shadow] dark:bg-card/50\",\n elevation.field,\n \"min-h-11 h-11 has-[>textarea]:h-auto\",\n \"has-[>[data-align=inline-start]]:[&>input]:pl-2\",\n \"has-[>[data-align=inline-end]]:[&>input]:pr-2\",\n \"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3\",\n \"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3\",\n \"has-[[data-slot=input-group-control]:focus-visible]:ring-1 has-[[data-slot=input-group-control]:focus-visible]:ring-ring\",\n \"has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40\",\n className\n )}\n {...props}\n />\n );\n}\n\nconst inputGroupAddonVariants = cva(\n \"text-muted-foreground flex h-auto min-h-11 cursor-text select-none items-center justify-center gap-2 px-0 text-[15px] font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n align: {\n \"inline-start\":\n \"order-first pl-3.5 has-[>button]:-ml-[0.45rem] has-[>kbd]:-ml-[0.35rem]\",\n \"inline-end\":\n \"order-last pr-3.5 has-[>button]:-mr-[0.4rem] has-[>kbd]:-mr-[0.35rem]\",\n \"block-start\":\n \"order-first w-full justify-start border-b px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3\",\n \"block-end\":\n \"order-last w-full justify-start border-t px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3\",\n },\n },\n defaultVariants: {\n align: \"inline-start\",\n },\n }\n);\n\nfunction InputGroupAddon({\n className,\n align = \"inline-start\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest(\"button\")) {\n return;\n }\n e.currentTarget.parentElement?.querySelector(\"input\")?.focus();\n }}\n {...props}\n />\n );\n}\n\nconst inputGroupButtonVariants = cva(\n \"inline-flex items-center justify-center gap-2 border border-transparent bg-transparent text-sm font-medium text-foreground shadow-none transition-colors hover:bg-muted\",\n {\n variants: {\n size: {\n xs: \"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5\",\n sm: \"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5\",\n \"icon-xs\": \"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0\",\n \"icon-sm\": \"size-8 p-0 has-[>svg]:p-0\",\n },\n },\n defaultVariants: {\n size: \"xs\",\n },\n }\n);\n\nfunction InputGroupButton({\n className,\n type = \"button\",\n size = \"xs\",\n ...props\n}: React.ComponentProps<\"button\"> & VariantProps<typeof inputGroupButtonVariants>) {\n return (\n <button\n type={type}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n );\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"text-muted-foreground flex items-center gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction InputGroupInput({ className, ...props }: React.ComponentProps<\"input\">) {\n return (\n <Input\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n return (\n <Textarea\n data-slot=\"input-group-control\"\n className={cn(\n \"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupText,\n InputGroupInput,\n InputGroupTextarea,\n};\n","\"use client\";\n\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst CURRENCIES = [\"USD\", \"INR\", \"EUR\", \"GBP\", \"SGD\", \"AED\", \"JPY\"];\n\ninterface CurrencyAmountInputProps {\n currency: string;\n amount: string;\n onCurrencyChange: (currency: string) => void;\n onAmountChange: (amount: string) => void;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n currencies?: string[];\n id?: string;\n}\n\nexport function CurrencyAmountInput({\n currency,\n amount,\n onCurrencyChange,\n onAmountChange,\n placeholder = \"0.00\",\n disabled = false,\n required = false,\n currencies = CURRENCIES,\n id,\n}: CurrencyAmountInputProps) {\n return (\n <div className=\"flex h-12 min-h-12 items-stretch overflow-hidden rounded-xl border border-border bg-card text-[15px] transition-all focus-within:border-muted-foreground/50 focus-within:ring-2 focus-within:ring-ring/20\">\n <div className=\"relative flex min-w-[5.25rem] shrink-0 items-center border-r border-border bg-muted/25 px-3\">\n <select\n value={currency}\n onChange={(e) => onCurrencyChange(e.target.value)}\n disabled={disabled}\n aria-label=\"Currency\"\n className={cn(\n \"h-full min-h-0 w-full min-w-0 cursor-pointer bg-transparent py-2 pl-1 pr-9 text-[15px] font-semibold text-foreground\",\n \"focus:outline-none disabled:opacity-50\",\n \"appearance-none [-webkit-appearance:none] [-moz-appearance:none]\",\n \"[&::-ms-expand]:hidden\"\n )}\n >\n {currencies.map((c) => (\n <option key={c} value={c}>\n {c}\n </option>\n ))}\n </select>\n <ChevronDown\n className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground opacity-80\"\n aria-hidden\n />\n </div>\n\n <input\n id={id}\n type=\"number\"\n value={amount}\n onChange={(e) => onAmountChange(e.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n min=\"0\"\n step=\"0.01\"\n className=\"min-h-0 min-w-0 flex-1 bg-transparent px-4 py-3 text-[15px] tabular-nums text-foreground placeholder:text-muted-foreground focus:outline-none disabled:opacity-50\"\n />\n </div>\n );\n}\n","import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst cardVariants = cva(\n cn(\"flex flex-col rounded-xl border border-border bg-card text-card-foreground\", elevation.surface),\n {\n variants: {\n size: {\n default: \"gap-10 px-10 py-10\",\n sm: \"gap-6 px-7 py-7\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n});\n\nfunction Card({\n className,\n size,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof cardVariants>) {\n return (\n <div\n data-slot=\"card\"\n className={cn(cardVariants({ size }), className)}\n {...props}\n />\n );\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-4 px-0 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\"text-lg font-semibold leading-snug tracking-tight\", className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm leading-relaxed text-muted-foreground\", className)}\n {...props}\n />\n );\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div data-slot=\"card-content\" className={cn(\"px-0\", className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex flex-wrap items-center gap-3 border-t border-border px-0 pt-8 pb-0 sm:gap-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"./utils\";\n\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n <ScrollAreaPrimitive.Root ref={ref} className={cn(\"relative overflow-hidden\", className)} {...props}>\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full rounded-[inherit]\">{children}</ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n));\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" && \"h-full w-2.5 border-l border-l-transparent p-px\",\n orientation === \"horizontal\" && \"h-2.5 flex-col border-t border-t-transparent p-px\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border hover:bg-muted-foreground/30\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;\n\nexport { ScrollArea, ScrollBar };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface SideNavProps extends React.ComponentPropsWithoutRef<\"aside\"> {\n /** \"collapsed\" renders icon-only at 60px; \"expanded\" renders full at 240px (default) */\n width?: \"collapsed\" | \"expanded\";\n /** Controlled collapsed state */\n isCollapsed?: boolean;\n /** Called when the sidebar requests a collapse/expand */\n onCollapse?: (collapsed: boolean) => void;\n}\n\nexport interface SideNavItemProps extends React.ComponentPropsWithoutRef<\"a\"> {\n /** Icon element — required, rendered at size-4 shrink-0 */\n icon: React.ReactNode;\n /** Visible label — hidden when sidebar is collapsed */\n label: string;\n /** Highlights the item as the current route */\n isActive?: boolean;\n /** Navigable href — renders an <a> when provided */\n href?: string;\n /** Click handler */\n onClick?: React.MouseEventHandler<HTMLElement>;\n /** Optional badge slot rendered after the label */\n badge?: React.ReactNode;\n /** Injected by SideNavSection — consumers should not pass this */\n _collapsed?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface SideNavContextValue {\n isCollapsed: boolean;\n}\n\nconst SideNavContext = React.createContext<SideNavContextValue>({\n isCollapsed: false,\n});\n\nfunction useSideNavContext() {\n return React.useContext(SideNavContext);\n}\n\n// ---------------------------------------------------------------------------\n// SideNav\n// ---------------------------------------------------------------------------\n\nconst SideNav = React.forwardRef<HTMLElement, SideNavProps>(\n (\n {\n className,\n width = \"expanded\",\n isCollapsed: isCollapsedProp,\n onCollapse,\n children,\n ...props\n },\n ref\n ) => {\n const collapsed =\n isCollapsedProp !== undefined ? isCollapsedProp : width === \"collapsed\";\n\n return (\n <SideNavContext.Provider value={{ isCollapsed: collapsed }}>\n <aside\n ref={ref}\n data-slot=\"side-nav\"\n data-collapsed={collapsed}\n className={cn(\n \"flex flex-col bg-sidebar border-r border-sidebar-border\",\n \"transition-all duration-pg-normal ease-pg-standard\",\n collapsed ? \"w-[60px]\" : \"w-[240px]\",\n className\n )}\n {...props}\n >\n {children}\n </aside>\n </SideNavContext.Provider>\n );\n }\n);\nSideNav.displayName = \"SideNav\";\n\n// ---------------------------------------------------------------------------\n// SideNavHeader\n// ---------------------------------------------------------------------------\n\nconst SideNavHeader = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"side-nav-header\"\n className={cn(\n \"px-4 py-4 border-b border-sidebar-border shrink-0\",\n className\n )}\n {...props}\n />\n));\nSideNavHeader.displayName = \"SideNavHeader\";\n\n// ---------------------------------------------------------------------------\n// SideNavSection\n// ---------------------------------------------------------------------------\n\ninterface SideNavSectionProps extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Optional section label — hidden when sidebar is collapsed */\n label?: string;\n}\n\nconst SideNavSection = React.forwardRef<HTMLDivElement, SideNavSectionProps>(\n ({ className, label, children, ...props }, ref) => {\n const { isCollapsed } = useSideNavContext();\n\n return (\n <div\n ref={ref}\n data-slot=\"side-nav-section\"\n className={cn(\"px-3 py-2\", className)}\n {...props}\n >\n {label && !isCollapsed && (\n <p className=\"mb-1 px-3 text-xs font-medium text-muted-foreground uppercase tracking-wider select-none\">\n {label}\n </p>\n )}\n {children}\n </div>\n );\n }\n);\nSideNavSection.displayName = \"SideNavSection\";\n\n// ---------------------------------------------------------------------------\n// SideNavItem\n// ---------------------------------------------------------------------------\n\nconst SideNavItem = React.forwardRef<HTMLAnchorElement, SideNavItemProps>(\n (\n {\n className,\n icon,\n label,\n isActive = false,\n href,\n onClick,\n badge,\n _collapsed,\n children,\n ...props\n },\n ref\n ) => {\n const { isCollapsed } = useSideNavContext();\n const collapsed = _collapsed !== undefined ? _collapsed : isCollapsed;\n\n const baseClassName = cn(\n \"flex items-center gap-3 px-3 py-2 rounded-lg text-sm cursor-pointer\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n isActive\n ? \"bg-primary/10 text-primary font-medium\"\n : \"text-sidebar-foreground hover:bg-muted/50\",\n collapsed && \"justify-center px-0\",\n className\n );\n\n const content = (\n <>\n <span className=\"size-4 shrink-0 flex items-center justify-center\">\n {icon}\n </span>\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate\">{label}</span>\n {badge && <span className=\"shrink-0\">{badge}</span>}\n </>\n )}\n </>\n );\n\n if (href) {\n return (\n <a\n ref={ref}\n href={href}\n title={collapsed ? label : undefined}\n aria-current={isActive ? \"page\" : undefined}\n className={baseClassName}\n onClick={onClick as React.MouseEventHandler<HTMLAnchorElement>}\n {...props}\n >\n {content}\n </a>\n );\n }\n\n return (\n <a\n ref={ref}\n role=\"button\"\n tabIndex={0}\n title={collapsed ? label : undefined}\n aria-current={isActive ? \"page\" : undefined}\n className={baseClassName}\n onClick={onClick as React.MouseEventHandler<HTMLAnchorElement>}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n onClick?.(e as unknown as React.MouseEvent<HTMLElement>);\n }\n }}\n {...props}\n >\n {content}\n </a>\n );\n }\n);\nSideNavItem.displayName = \"SideNavItem\";\n\n// ---------------------------------------------------------------------------\n// SideNavFooter\n// ---------------------------------------------------------------------------\n\nconst SideNavFooter = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"side-nav-footer\"\n className={cn(\n \"mt-auto border-t border-sidebar-border px-3 py-3 shrink-0\",\n className\n )}\n {...props}\n />\n));\nSideNavFooter.displayName = \"SideNavFooter\";\n\n// ---------------------------------------------------------------------------\n// Exports\n// ---------------------------------------------------------------------------\n\nexport {\n SideNav,\n SideNavHeader,\n SideNavSection,\n SideNavItem,\n SideNavFooter,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst Breadcrumb = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<\"nav\"> & {\n separator?: React.ReactNode;\n }\n>(({ className, ...props }, ref) => (\n <nav\n ref={ref}\n aria-label=\"breadcrumb\"\n className={cn(\"\", className)}\n {...props}\n />\n));\nBreadcrumb.displayName = \"Breadcrumb\";\n\nconst BreadcrumbList = React.forwardRef<\n HTMLOListElement,\n React.ComponentPropsWithoutRef<\"ol\">\n>(({ className, ...props }, ref) => (\n <ol\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2\",\n className\n )}\n {...props}\n />\n));\nBreadcrumbList.displayName = \"BreadcrumbList\";\n\nconst BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<\"li\">\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\"inline-flex items-center gap-1.5\", className)}\n {...props}\n />\n));\nBreadcrumbItem.displayName = \"BreadcrumbItem\";\n\nconst BreadcrumbLink = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentPropsWithoutRef<\"a\">\n>(({ className, ...props }, ref) => (\n <a\n ref={ref}\n className={cn(\n \"text-sm text-muted-foreground transition-colors duration-pg-fast ease-pg-standard hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 rounded-sm\",\n className\n )}\n {...props}\n />\n));\nBreadcrumbLink.displayName = \"BreadcrumbLink\";\n\nconst BreadcrumbPage = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\">\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n role=\"link\"\n aria-current=\"page\"\n aria-disabled=\"true\"\n className={cn(\"text-sm font-medium text-foreground\", className)}\n {...props}\n />\n));\nBreadcrumbPage.displayName = \"BreadcrumbPage\";\n\nconst BreadcrumbSeparator = ({\n children,\n className,\n ...props\n}: React.ComponentProps<\"li\">) => (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"[&>svg]:size-3.5\", className)}\n {...props}\n >\n {children ?? <ChevronRight className=\"text-muted-foreground\" />}\n </li>\n);\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\";\n\nconst BreadcrumbEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"flex size-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"size-4 text-muted-foreground\" />\n <span className=\"sr-only\">More</span>\n </span>\n);\nBreadcrumbEllipsis.displayName = \"BreadcrumbEllipsis\";\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n};\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\n// ---------------------------------------------------------------------------\n// Pagination (nav wrapper)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationProps extends React.ComponentPropsWithoutRef<\"nav\"> {}\n\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n ({ className, ...props }, ref) => (\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n )\n);\nPagination.displayName = \"Pagination\";\n\n// ---------------------------------------------------------------------------\n// PaginationContent (ul)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationContentProps\n extends React.ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const PaginationContent = forwardRef<\n HTMLUListElement,\n PaginationContentProps\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n));\nPaginationContent.displayName = \"PaginationContent\";\n\n// ---------------------------------------------------------------------------\n// PaginationItem (li)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationItemProps\n extends React.ComponentPropsWithoutRef<\"li\"> {}\n\nexport const PaginationItem = forwardRef<HTMLLIElement, PaginationItemProps>(\n ({ className, ...props }, ref) => (\n <li ref={ref} className={cn(\"list-none\", className)} {...props} />\n )\n);\nPaginationItem.displayName = \"PaginationItem\";\n\n// ---------------------------------------------------------------------------\n// PaginationLink (anchor / button-like)\n// ---------------------------------------------------------------------------\n\nexport interface PaginationLinkProps\n extends React.ComponentPropsWithoutRef<\"a\"> {\n isActive?: boolean;\n}\n\nexport const PaginationLink = forwardRef<HTMLAnchorElement, PaginationLinkProps>(\n ({ className, isActive = false, ...props }, ref) => (\n <a\n ref={ref}\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n // base\n \"h-9 w-9 inline-flex items-center justify-center rounded-lg text-sm font-medium border\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"cursor-pointer select-none\",\n // active\n isActive\n ? `bg-primary text-primary-foreground border-primary ${elevation.control}`\n : \"text-muted-foreground border-border hover:bg-muted hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n);\nPaginationLink.displayName = \"PaginationLink\";\n\n// ---------------------------------------------------------------------------\n// PaginationPrevious\n// ---------------------------------------------------------------------------\n\nexport interface PaginationPreviousProps\n extends React.ComponentPropsWithoutRef<\"a\"> {\n disabled?: boolean;\n}\n\nexport const PaginationPrevious = forwardRef<\n HTMLAnchorElement,\n PaginationPreviousProps\n>(({ className, disabled, ...props }, ref) => (\n <a\n ref={ref}\n aria-label=\"Go to previous page\"\n aria-disabled={disabled}\n className={cn(\n \"h-9 px-3 inline-flex items-center justify-center gap-1.5 rounded-lg text-sm font-medium border border-border\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"cursor-pointer select-none\",\n disabled\n ? \"cursor-not-allowed opacity-50 pointer-events-none text-muted-foreground border-border\"\n : \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n className\n )}\n {...props}\n >\n <ChevronLeft className=\"size-4\" />\n <span>Previous</span>\n </a>\n));\nPaginationPrevious.displayName = \"PaginationPrevious\";\n\n// ---------------------------------------------------------------------------\n// PaginationNext\n// ---------------------------------------------------------------------------\n\nexport interface PaginationNextProps\n extends React.ComponentPropsWithoutRef<\"a\"> {\n disabled?: boolean;\n}\n\nexport const PaginationNext = forwardRef<\n HTMLAnchorElement,\n PaginationNextProps\n>(({ className, disabled, ...props }, ref) => (\n <a\n ref={ref}\n aria-label=\"Go to next page\"\n aria-disabled={disabled}\n className={cn(\n \"h-9 px-3 inline-flex items-center justify-center gap-1.5 rounded-lg text-sm font-medium border border-border\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"cursor-pointer select-none\",\n disabled\n ? \"cursor-not-allowed opacity-50 pointer-events-none text-muted-foreground border-border\"\n : \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n className\n )}\n {...props}\n >\n <span>Next</span>\n <ChevronRight className=\"size-4\" />\n </a>\n));\nPaginationNext.displayName = \"PaginationNext\";\n\n// ---------------------------------------------------------------------------\n// PaginationEllipsis\n// ---------------------------------------------------------------------------\n\nexport interface PaginationEllipsisProps\n extends React.ComponentPropsWithoutRef<\"span\"> {}\n\nexport const PaginationEllipsis = forwardRef<\n HTMLSpanElement,\n PaginationEllipsisProps\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n aria-hidden\n className={cn(\n \"h-9 w-9 inline-flex items-center justify-center text-muted-foreground\",\n className\n )}\n {...props}\n >\n <MoreHorizontal className=\"size-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n));\nPaginationEllipsis.displayName = \"PaginationEllipsis\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"./utils\";\n\nconst linkVariants = cva(\n [\n \"inline-flex items-center gap-1 transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 rounded-sm\",\n \"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none\",\n ],\n {\n variants: {\n variant: {\n default: \"text-primary underline-offset-4 hover:underline\",\n subtle: \"text-muted-foreground hover:text-foreground\",\n nav: \"text-foreground hover:text-primary\",\n },\n size: {\n sm: \"text-xs\",\n md: \"text-sm\",\n lg: \"text-base\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n }\n);\n\nexport interface LinkProps\n extends React.AnchorHTMLAttributes<HTMLAnchorElement>,\n VariantProps<typeof linkVariants> {\n asChild?: boolean;\n}\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n className,\n variant,\n size,\n asChild = false,\n href,\n target,\n rel,\n children,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"a\";\n\n const isExternal =\n typeof href === \"string\" && href.startsWith(\"http\");\n\n const externalProps = isExternal\n ? {\n target: target ?? \"_blank\",\n rel: rel ?? \"noreferrer\",\n }\n : { target, rel };\n\n return (\n <Comp\n ref={ref}\n href={href}\n className={cn(linkVariants({ variant, size }), className)}\n {...externalProps}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n);\nLink.displayName = \"Link\";\n","import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\n\ndeclare module 'react' {\n interface ReactElement {\n $$typeof?: symbol | string;\n }\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\nexport type Usable<T> = PromiseLike<T> | React.Context<T>;\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n let slottableElement: React.ReactElement | null = null;\n let hasSlottable = false;\n const newChildren: React.ReactNode[] = [];\n\n if (isLazyComponent(children) && typeof use === 'function') {\n children = use(children._payload);\n }\n\n React.Children.forEach(children, (maybeSlottable) => {\n if (isSlottable(maybeSlottable)) {\n hasSlottable = true;\n const slottable = maybeSlottable;\n let child = 'child' in slottable.props ? slottable.props.child : slottable.props.children;\n\n if (isLazyComponent(child) && typeof use === 'function') {\n child = use(child._payload);\n }\n\n slottableElement = getSlottableElementFromSlottable(slottable, child);\n newChildren.push((slottableElement?.props as any)?.children);\n } else {\n newChildren.push(maybeSlottable);\n }\n });\n\n if (slottableElement) {\n slottableElement = React.cloneElement(slottableElement, undefined, newChildren);\n } else if (\n // A `Slottable` was found but it didn't resolve to a single element (e.g.\n // it wrapped multiple elements, text, or a render-prop `child` that\n // wasn't an element). Don't fall back to treating the `Slottable` wrapper\n // itself as the slot target — throw a descriptive error below instead.\n !hasSlottable &&\n React.Children.count(children) === 1 &&\n React.isValidElement(children)\n ) {\n slottableElement = children;\n }\n\n const slottableElementRef = slottableElement ? getElementRef(slottableElement) : undefined;\n const composedRef = useComposedRefs(forwardedRef, slottableElementRef);\n\n if (!slottableElement) {\n // Empty/falsy children (`null`, `undefined`, `false`, no children, etc.) are valid and\n // render nothing. Anything else is content we couldn't slot onto a single element, which\n // is a usage error, so we fail loudly with a clear message.\n if (children || children === 0) {\n throw new Error(\n hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName),\n );\n }\n return children;\n }\n\n const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});\n\n // do not pass ref to React.Fragment for React 19 compatibility\n if (slottableElement.type !== React.Fragment) {\n mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;\n }\n\n return React.cloneElement(slottableElement, mergedProps);\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol.for('radix.slottable');\n\ntype SlottableChildrenProps = { children: React.ReactNode };\ntype SlottableRenderFnProps = {\n child: React.ReactNode;\n children: (slottable: React.ReactNode) => React.ReactNode;\n};\n\ntype SlottableProps = SlottableRenderFnProps | SlottableChildrenProps;\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = (props) =>\n 'child' in props ? props.children(props.child) : props.children;\n\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* -------------------------------------------------------------------------------------------------\n * getSlottableElementFromSlottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst getSlottableElementFromSlottable = (slottable: SlottableElement, child: React.ReactNode) => {\n if ('child' in slottable.props) {\n const child = slottable.props.child;\n if (!React.isValidElement<React.PropsWithChildren>(child)) return null;\n return React.cloneElement(child, undefined, slottable.props.children(child.props.children));\n }\n\n return React.isValidElement(child) ? child : null;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * mergeProps\n * -----------------------------------------------------------------------------------------------*/\n\ntype AnyProps = Record<string, any>;\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n/* -------------------------------------------------------------------------------------------------\n * getElementRef\n * -----------------------------------------------------------------------------------------------*/\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype SlottableElement = React.ReactElement<SlottableProps, SlottableComponent>;\n\nfunction isSlottable(\n child: React.ReactNode,\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\n\ninterface LazyReactElement extends React.ReactElement {\n $$typeof: typeof REACT_LAZY_TYPE;\n _payload: PromiseLike<Exclude<React.ReactNode, PromiseLike<any>>>;\n}\n\nfunction isLazyComponent(element: React.ReactNode): element is LazyReactElement {\n return (\n element != null &&\n typeof element === 'object' &&\n '$$typeof' in element &&\n element.$$typeof === REACT_LAZY_TYPE &&\n '_payload' in element &&\n isPromiseLike(element._payload)\n );\n}\n\nfunction isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return typeof value === 'object' && value !== null && 'then' in value;\n}\n\nconst createSlotError = (ownerName: string) => {\n return `${ownerName} failed to slot onto its children. Expected a single React element child or \\`Slottable\\`.`;\n};\n\nconst createSlottableError = (ownerName: string) => {\n return `${ownerName} failed to slot onto its \\`Slottable\\`. Expected \\`Slottable\\` to receive a single React element child.`;\n};\n\nconst use: typeof React.use | undefined = (React as any)[' use '.trim().toString()];\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n variant?: \"default\" | \"secondary\" | \"success\" | \"warning\" | \"error\" | \"outline\";\n size?: \"sm\" | \"md\" | \"lg\";\n square?: boolean;\n dot?: boolean;\n leftIcon?: ReactNode;\n rightIcon?: ReactNode;\n}\n\nconst variantClasses: Record<NonNullable<BadgeProps[\"variant\"]>, string> = {\n default:\n \"bg-primary/10 text-primary border border-primary/20\",\n secondary:\n \"bg-muted text-muted-foreground border border-border\",\n success:\n \"bg-green-500/10 text-green-700 border border-green-500/20 dark:text-green-400\",\n warning:\n \"bg-amber-500/10 text-amber-700 border border-amber-500/20 dark:text-amber-400\",\n error:\n \"bg-red-500/10 text-red-700 border border-red-500/20 dark:text-red-400\",\n outline:\n \"bg-transparent text-foreground border border-border\",\n};\n\nconst sizeClasses: Record<NonNullable<BadgeProps[\"size\"]>, string> = {\n sm: \"text-[10px] px-1.5 py-0.5 gap-1\",\n md: \"text-xs px-2 py-0.5 gap-1\",\n lg: \"text-sm px-2.5 py-1 gap-1.5\",\n};\n\nconst dotColorClasses: Record<NonNullable<BadgeProps[\"variant\"]>, string> = {\n default: \"bg-primary\",\n secondary: \"bg-muted-foreground\",\n success: \"bg-green-500\",\n warning: \"bg-amber-500\",\n error: \"bg-red-500\",\n outline: \"bg-foreground\",\n};\n\nconst dotSizeClasses: Record<NonNullable<BadgeProps[\"size\"]>, string> = {\n sm: \"size-1.5\",\n md: \"size-1.5\",\n lg: \"size-2\",\n};\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(\n (\n {\n variant = \"default\",\n size = \"md\",\n square = false,\n dot = false,\n leftIcon,\n rightIcon,\n children,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center font-medium whitespace-nowrap transition-colors duration-pg-fast ease-pg-standard\",\n square ? \"rounded-md\" : \"rounded-full\",\n variantClasses[variant],\n sizeClasses[size],\n className\n )}\n {...props}\n >\n {dot && (\n <span\n className={cn(\n \"rounded-full flex-shrink-0\",\n dotSizeClasses[size],\n dotColorClasses[variant]\n )}\n />\n )}\n {!dot && leftIcon && (\n <span className=\"inline-flex items-center flex-shrink-0\">{leftIcon}</span>\n )}\n {children}\n {rightIcon && (\n <span className=\"inline-flex items-center flex-shrink-0\">{rightIcon}</span>\n )}\n </span>\n );\n }\n);\nBadge.displayName = \"Badge\";\n","\"use client\";\n\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface LozengeProps extends HTMLAttributes<HTMLSpanElement> {\n variant?: \"default\" | \"inprogress\" | \"success\" | \"moved\" | \"new\" | \"removed\";\n isBold?: boolean;\n maxWidth?: number | string;\n}\n\nconst variantClasses: Record<NonNullable<LozengeProps[\"variant\"]>, string> = {\n default: \"bg-muted text-muted-foreground\",\n inprogress: \"bg-blue-500/15 text-blue-700 dark:text-blue-300\",\n success: \"bg-green-500/15 text-green-700 dark:text-green-300\",\n moved: \"bg-purple-500/15 text-purple-700 dark:text-purple-300\",\n new: \"bg-teal-500/15 text-teal-700 dark:text-teal-300\",\n removed: \"bg-red-500/15 text-red-700 dark:text-red-300\",\n};\n\nexport const Lozenge = forwardRef<HTMLSpanElement, LozengeProps>(\n (\n {\n variant = \"default\",\n isBold = false,\n maxWidth,\n children,\n className,\n style,\n ...props\n },\n ref\n ) => {\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center rounded-sm px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide whitespace-nowrap transition-colors duration-pg-fast ease-pg-standard\",\n variantClasses[variant],\n isBold && \"ring-1 ring-current/30\",\n className\n )}\n style={\n maxWidth !== undefined\n ? { maxWidth, overflow: \"hidden\", textOverflow: \"ellipsis\", ...style }\n : style\n }\n {...props}\n >\n <span\n className={cn(\n maxWidth !== undefined ? \"truncate\" : undefined\n )}\n >\n {children}\n </span>\n </span>\n );\n }\n);\nLozenge.displayName = \"Lozenge\";\n","import * as React from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type TagColorScheme = \"neutral\" | \"blue\" | \"green\" | \"amber\" | \"red\" | \"purple\";\n\nexport interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {\n colorScheme?: TagColorScheme;\n onRemove?: () => void;\n disabled?: boolean;\n}\n\nconst colorClasses: Record<TagColorScheme, string> = {\n neutral: \"bg-card border-border text-foreground\",\n blue: \"bg-blue-500/10 border-blue-500/20 text-blue-700 dark:text-blue-300\",\n green: \"bg-green-500/10 border-green-500/20 text-green-700 dark:text-green-300\",\n amber: \"bg-amber-500/10 border-amber-500/20 text-amber-700 dark:text-amber-300\",\n red: \"bg-red-500/10 border-red-500/20 text-red-700 dark:text-red-300\",\n purple: \"bg-purple-500/10 border-purple-500/20 text-purple-700 dark:text-purple-300\",\n};\n\nconst Tag = React.forwardRef<HTMLSpanElement, TagProps>(\n ({ className, colorScheme = \"neutral\", onRemove, disabled, children, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium transition-colors\", colorClasses[colorScheme], disabled && \"opacity-50 cursor-not-allowed\", className)}\n {...props}\n >\n {children}\n {onRemove && !disabled && (\n <button\n type=\"button\"\n onClick={(e) => { e.stopPropagation(); onRemove(); }}\n className=\"ml-0.5 rounded-sm opacity-60 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n aria-label=\"Remove\"\n >\n <X className=\"size-3\" />\n </button>\n )}\n </span>\n )\n);\nTag.displayName = \"Tag\";\n\nexport interface TagGroupProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst TagGroup = React.forwardRef<HTMLDivElement, TagGroupProps>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn(\"flex flex-wrap gap-1.5\", className)} {...props} />\n);\nTagGroup.displayName = \"TagGroup\";\n\nexport { Tag, TagGroup };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Check, X, RefreshCw, Clock, AlertCircle, ArrowRight, Info } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type BadgeVariant =\n | \"success\"\n | \"info\"\n | \"warning\"\n | \"refund\"\n | \"danger\"\n | \"orange\"\n | \"muted\";\n\nexport type BadgeTrailIcon =\n | \"check\"\n | \"x\"\n | \"refresh\"\n | \"clock\"\n | \"alert\"\n | \"arrow-right\"\n | \"info\";\n\n/* Light: low-opacity hue-matched borders. Dark: stronger borders for contrast on dark surfaces. */\nconst VARIANT_CLASS: Record<BadgeVariant, string> = {\n success:\n \"bg-emerald-500/10 text-emerald-800 border-emerald-600/10 dark:bg-emerald-500/35 dark:text-emerald-50 dark:border-emerald-400/70\",\n info: \"bg-blue-500/10 text-blue-800 border-blue-600/10 dark:bg-sky-500/30 dark:text-sky-50 dark:border-sky-400/65\",\n warning:\n \"bg-amber-500/10 text-amber-900 border-amber-600/10 dark:bg-amber-500/35 dark:text-amber-50 dark:border-amber-400/70\",\n refund:\n \"bg-yellow-500/10 text-yellow-900 border-yellow-600/10 dark:bg-violet-500/30 dark:text-violet-100 dark:border-violet-400/60\",\n danger:\n \"bg-red-500/10 text-red-800 border-red-600/10 dark:bg-red-500/35 dark:text-red-50 dark:border-red-400/70\",\n orange:\n \"bg-orange-500/10 text-orange-900 border-orange-600/10 dark:bg-orange-500/35 dark:text-orange-50 dark:border-orange-400/65\",\n muted:\n \"bg-muted text-muted-foreground border-border/40 dark:bg-zinc-800/90 dark:text-zinc-200 dark:border-zinc-500/45\",\n};\n\nexport interface StatusBadgeProps {\n variant: BadgeVariant;\n label: string;\n trailIcon?: BadgeTrailIcon;\n size?: \"sm\" | \"md\";\n className?: string;\n}\n\nexport const StatusBadge = React.forwardRef<HTMLSpanElement, StatusBadgeProps>(\n ({ variant, label, trailIcon, size = \"md\", className }, ref) => {\n const iSize = size === \"sm\" ? 11 : 12;\n const iProps = {\n width: iSize,\n height: iSize,\n strokeWidth: 2.5,\n style: { flexShrink: 0 },\n } as const;\n\n const icon =\n trailIcon === \"check\" ? <Check {...iProps} /> :\n trailIcon === \"x\" ? <X {...iProps} strokeWidth={3} /> :\n trailIcon === \"refresh\" ? <RefreshCw {...{ ...iProps, strokeWidth: 2 }} /> :\n trailIcon === \"clock\" ? <Clock {...iProps} strokeWidth={2} /> :\n trailIcon === \"alert\" ? <AlertCircle {...iProps} strokeWidth={2} /> :\n trailIcon === \"arrow-right\" ? <ArrowRight {...iProps} strokeWidth={2.5} /> :\n trailIcon === \"info\" ? <Info {...iProps} strokeWidth={2.5} /> :\n null;\n\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-1.5 font-medium border whitespace-nowrap rounded-md\",\n VARIANT_CLASS[variant],\n size === \"sm\" ? \"text-[11px] px-2 py-[2px]\" : \"text-[13px] px-3 py-[5px]\",\n className\n )}\n >\n {label}\n {icon}\n </span>\n );\n }\n);\nStatusBadge.displayName = \"StatusBadge\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface BlanketProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controls visibility of the blanket */\n open?: boolean;\n /** Adds semi-transparent black background (default: true) */\n isTinted?: boolean;\n /** Makes blanket completely transparent — only blocks pointer events */\n isTransparent?: boolean;\n /** Called when the blanket is clicked */\n onClick?: React.MouseEventHandler<HTMLDivElement>;\n /** When true, pointer events pass through the blanket */\n shouldAllowClickThrough?: boolean;\n}\n\nconst Blanket = React.forwardRef<HTMLDivElement, BlanketProps>(\n (\n {\n open = true,\n isTinted = true,\n isTransparent = false,\n onClick,\n shouldAllowClickThrough = false,\n className,\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n data-open={open}\n aria-hidden=\"true\"\n onClick={onClick}\n className={cn(\n \"fixed inset-0 z-40\",\n // Animate in/out\n \"data-[open=true]:animate-in data-[open=false]:animate-out\",\n \"data-[open=true]:fade-in-0 data-[open=false]:fade-out-0\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n // Visibility\n !open && \"pointer-events-none\",\n // Background\n !isTransparent && isTinted && \"bg-black/50 backdrop-blur-sm\",\n isTransparent && \"bg-transparent\",\n // Click-through\n shouldAllowClickThrough && \"pointer-events-none\",\n className\n )}\n {...props}\n />\n );\n }\n);\n\nBlanket.displayName = \"Blanket\";\n\nexport { Blanket };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { X, ChevronLeft, ChevronRight, Check } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport interface SpotlightStep {\n title: string;\n body: string;\n image?: React.ReactNode;\n}\n\nexport interface SpotlightCardProps {\n title: string;\n body: string;\n image?: React.ReactNode;\n currentStep?: number;\n totalSteps?: number;\n onNext?: () => void;\n onBack?: () => void;\n onDismiss?: () => void;\n nextLabel?: string;\n className?: string;\n}\n\nconst SpotlightCard = React.forwardRef<HTMLDivElement, SpotlightCardProps>(\n ({ title, body, image, currentStep, totalSteps, onNext, onBack, onDismiss, nextLabel, className }, ref) => {\n const isLast = currentStep !== undefined && totalSteps !== undefined && currentStep >= totalSteps - 1;\n return (\n <div ref={ref} className={cn(\"bg-card border border-border rounded-xl p-5 w-72\", elevation.surface, className)}>\n {onDismiss && (\n <button\n onClick={onDismiss}\n className=\"absolute top-3 right-3 rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n aria-label=\"Dismiss\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n {image && <div className=\"mb-4\">{image}</div>}\n <h3 className=\"font-semibold text-base text-foreground pr-6\">{title}</h3>\n <p className=\"mt-1 text-sm text-muted-foreground leading-relaxed\">{body}</p>\n <div className=\"flex items-center justify-between mt-4\">\n <div className=\"flex items-center gap-2\">\n {totalSteps && totalSteps > 1 && (\n <>\n <span className=\"text-xs text-muted-foreground\">{(currentStep ?? 0) + 1} of {totalSteps}</span>\n <div className=\"flex gap-1\">\n {Array.from({ length: totalSteps }).map((_, i) => (\n <span\n key={i}\n className={cn(\n \"rounded-full transition-all duration-pg-fast\",\n i === (currentStep ?? 0)\n ? \"w-4 h-1.5 bg-primary\"\n : \"w-1.5 h-1.5 bg-muted-foreground/30\"\n )}\n />\n ))}\n </div>\n </>\n )}\n </div>\n <div className=\"flex gap-2\">\n {onBack && (currentStep ?? 0) > 0 && (\n <button\n onClick={onBack}\n className=\"inline-flex items-center gap-1 h-8 px-3 rounded-lg text-xs font-medium text-muted-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n >\n <ChevronLeft className=\"size-3\" /> Back\n </button>\n )}\n {onNext && (\n <button\n onClick={onNext}\n className=\"inline-flex items-center gap-1 h-8 px-3 rounded-lg text-xs font-medium bg-primary text-primary-foreground hover:bg-[var(--primary-hover)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n >\n {isLast ? (\n <><Check className=\"size-3\" /> {nextLabel ?? \"Done\"}</>\n ) : (\n <>{nextLabel ?? \"Next\"} <ChevronRight className=\"size-3\" /></>\n )}\n </button>\n )}\n </div>\n </div>\n </div>\n );\n }\n);\nSpotlightCard.displayName = \"SpotlightCard\";\n\nexport interface SpotlightProps {\n isOpen: boolean;\n onClose: () => void;\n children: React.ReactNode;\n className?: string;\n}\n\nconst Spotlight = ({ isOpen, onClose, children, className }: SpotlightProps) => {\n if (!isOpen) return null;\n return (\n <div className=\"fixed inset-0 z-50\">\n <div className=\"absolute inset-0 bg-black/50 backdrop-blur-sm\" onClick={onClose} />\n <div className={cn(\"relative z-10 flex items-center justify-center min-h-full p-4\", className)}>\n {children}\n </div>\n </div>\n );\n};\nSpotlight.displayName = \"Spotlight\";\n\nexport interface UseSpotlightReturn {\n isOpen: boolean;\n currentStep: number;\n open: () => void;\n close: () => void;\n goNext: () => void;\n goBack: () => void;\n goTo: (step: number) => void;\n}\n\nexport function useSpotlight(steps: SpotlightStep[], initialStep = 0): UseSpotlightReturn {\n const [isOpen, setIsOpen] = React.useState(false);\n const [currentStep, setCurrentStep] = React.useState(initialStep);\n\n return {\n isOpen,\n currentStep,\n open: () => { setCurrentStep(initialStep); setIsOpen(true); },\n close: () => setIsOpen(false),\n goNext: () => {\n if (currentStep >= steps.length - 1) setIsOpen(false);\n else setCurrentStep(s => s + 1);\n },\n goBack: () => setCurrentStep(s => Math.max(0, s - 1)),\n goTo: (step) => setCurrentStep(Math.max(0, Math.min(step, steps.length - 1))),\n };\n}\n\nexport { Spotlight, SpotlightCard };\n","\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nfunction DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-[100] min-h-[100dvh] w-full bg-black/50 backdrop-blur-[2px]\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-200\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showClose = true,\n overlayClassName,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Content> & {\n showClose?: boolean;\n overlayClassName?: string;\n}) {\n return (\n <DialogPortal>\n <DialogOverlay className={overlayClassName} />\n <DialogPrimitive.Content\n className={cn(\n \"fixed left-1/2 top-1/2 z-[101] w-[calc(100%-1.5rem)] max-w-[min(100%,26rem)] -translate-x-1/2 -translate-y-1/2\",\n // Default padding reserves space for the close button.\n // Pass p-0 in className to opt out (manage padding per section).\n \"rounded-2xl border border-border bg-card p-6 pt-10 text-card-foreground outline-none\",\n elevation.modal,\n \"max-h-[min(90vh,720px)] overflow-y-auto\",\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 data-[state=open]:scale-100 data-[state=closed]:scale-[0.98]\",\n \"transition-[opacity,transform] duration-200 ease-out\",\n className\n )}\n {...props}\n >\n {children}\n {showClose && (\n <DialogPrimitive.Close\n className=\"absolute right-3 top-3 inline-flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground transition-colors\"\n aria-label=\"Close\"\n >\n <X className=\"h-4 w-4\" />\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n className={cn(\"text-lg font-semibold text-foreground tracking-tight pr-10\", className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description className={cn(\"text-[13px] text-muted-foreground mt-1\", className)} {...props} />\n );\n}\n\nexport { Dialog, DialogTrigger, DialogPortal, DialogClose, DialogContent, DialogTitle, DialogDescription };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\ntype DrawerSide = \"right\" | \"left\" | \"top\" | \"bottom\";\nconst DrawerContext = React.createContext<{ side: DrawerSide }>({ side: \"right\" });\n\ninterface DrawerProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> { side?: DrawerSide; }\n\nconst Drawer = ({ side = \"right\", children, ...props }: DrawerProps) => (\n <DrawerContext.Provider value={{ side }}>\n <DialogPrimitive.Root {...props}>{children}</DialogPrimitive.Root>\n </DrawerContext.Provider>\n);\nDrawer.displayName = \"Drawer\";\n\nconst DrawerTrigger = DialogPrimitive.Trigger;\nconst DrawerClose = DialogPrimitive.Close;\n\nconst DrawerOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\", className)}\n {...props}\n />\n));\nDrawerOverlay.displayName = \"DrawerOverlay\";\n\nconst sideClasses: Record<DrawerSide, string> = {\n right: \"inset-y-0 right-0 h-full w-80 sm:w-96 border-l data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right\",\n left: \"inset-y-0 left-0 h-full w-80 sm:w-96 border-r data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left\",\n top: \"inset-x-0 top-0 w-full border-b rounded-b-2xl data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top\",\n bottom: \"inset-x-0 bottom-0 w-full border-t rounded-t-2xl max-h-[85vh] data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom\",\n};\n\nconst DrawerContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => {\n const { side } = React.useContext(DrawerContext);\n return (\n <DialogPrimitive.Portal>\n <DrawerOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(elevation.drawer, \"fixed z-50 flex flex-col bg-card border-border transition-all duration-pg-normal ease-pg-standard data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200\", sideClasses[side], className)}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-md p-1 text-muted-foreground opacity-70 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\">\n <X className=\"size-4\" /><span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n});\nDrawerContent.displayName = \"DrawerContent\";\n\nconst DrawerHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn(\"px-6 pt-6 pb-4 border-b border-border\", className)} {...props} />\n);\nDrawerHeader.displayName = \"DrawerHeader\";\n\nconst DrawerFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => <div ref={ref} className={cn(\"px-6 py-4 border-t border-border flex gap-2 justify-end mt-auto\", className)} {...props} />\n);\nDrawerFooter.displayName = \"DrawerFooter\";\n\nconst DrawerTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title ref={ref} className={cn(\"text-base font-semibold text-foreground pr-6\", className)} {...props} />\n));\nDrawerTitle.displayName = \"DrawerTitle\";\n\nconst DrawerDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description ref={ref} className={cn(\"mt-1 text-sm text-muted-foreground\", className)} {...props} />\n));\nDrawerDescription.displayName = \"DrawerDescription\";\n\nexport { Drawer, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nconst Popover = PopoverPrimitive.Root;\nconst PopoverTrigger = PopoverPrimitive.Trigger;\nconst PopoverAnchor = PopoverPrimitive.Anchor;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 6, collisionPadding = 12, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n {/* Every popover panel is portalled to `document.body`, which puts it\n outside a Dialog's or Drawer's scroll lock — and that lock cancels the\n wheel for everything outside itself, so a scrollable panel silently\n refuses to scroll. The takeover is a no-op when no lock is held, so a\n popover on a plain page behaves exactly as before, and unlike making the\n popover `modal` it changes nothing about focus or outside clicks. See\n `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n // Keep a gutter between the popover and the viewport edge, so a\n // content-bounded panel (see `--radix-popover-content-available-height`\n // below) stops short of the fold rather than sitting flush against it.\n collisionPadding={collisionPadding}\n className={cn(\n \"z-[120] w-72 rounded-xl border border-border bg-popover p-4 text-popover-foreground outline-none\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n className\n )}\n {...props}\n />\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 6, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-[130] max-w-xs overflow-hidden rounded-lg border border-border bg-popover px-3 py-2 text-sm leading-snug text-popover-foreground\",\n elevation.tooltip,\n className\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { forwardRef, type AnchorHTMLAttributes, type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from \"react\";\n\n// ─── MenuDivider ─────────────────────────────────────────────────────────────\n\nexport const MenuDivider = forwardRef<HTMLHRElement, HTMLAttributes<HTMLHRElement>>(\n ({ className, ...props }, ref) => (\n <hr\n ref={ref}\n className={cn(\"h-px bg-border border-none my-1\", className)}\n {...props}\n />\n )\n);\nMenuDivider.displayName = \"MenuDivider\";\n\n// ─── MenuSection ─────────────────────────────────────────────────────────────\n\nexport interface MenuSectionProps extends HTMLAttributes<HTMLDivElement> {\n label?: string;\n children: ReactNode;\n}\n\nexport const MenuSection = forwardRef<HTMLDivElement, MenuSectionProps>(\n ({ label, children, className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col\", className)} {...props}>\n {label && (\n <span className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground px-2 py-1.5 mt-2 first:mt-0 select-none\">\n {label}\n </span>\n )}\n {children}\n </div>\n )\n);\nMenuSection.displayName = \"MenuSection\";\n\n// ─── MenuItem ────────────────────────────────────────────────────────────────\n\ntype MenuItemBaseProps = {\n icon?: ReactNode;\n rightContent?: ReactNode;\n isSelected?: boolean;\n isDanger?: boolean;\n};\n\ntype MenuItemButtonProps = MenuItemBaseProps &\n ButtonHTMLAttributes<HTMLButtonElement> & {\n href?: undefined;\n };\n\ntype MenuItemAnchorProps = MenuItemBaseProps &\n AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n };\n\nexport type MenuItemProps = MenuItemButtonProps | MenuItemAnchorProps;\n\nconst menuItemBaseClasses =\n \"flex items-center gap-2.5 px-2 py-2 rounded-lg text-sm transition-colors duration-pg-fast ease-pg-standard w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\";\n\nexport const MenuItem = forwardRef<HTMLButtonElement | HTMLAnchorElement, MenuItemProps>(\n (props, ref) => {\n const {\n icon,\n rightContent,\n isSelected,\n isDanger,\n children,\n className,\n ...rest\n } = props;\n\n const resolvedClasses = cn(\n menuItemBaseClasses,\n !isDanger && !isSelected && \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n isSelected && !isDanger && \"bg-muted text-foreground font-medium\",\n isDanger && \"text-destructive hover:bg-destructive/10\",\n (rest as { disabled?: boolean }).disabled && \"opacity-50 cursor-not-allowed pointer-events-none\",\n className\n );\n\n const content = (\n <>\n {icon && (\n <span className=\"size-4 shrink-0 flex items-center justify-center [&>svg]:size-4\">\n {icon}\n </span>\n )}\n <span className=\"flex-1 text-left truncate\">{children}</span>\n {rightContent && (\n <span className=\"ml-auto shrink-0\">{rightContent}</span>\n )}\n </>\n );\n\n if (\"href\" in props && props.href !== undefined) {\n const { href, ...anchorRest } = rest as AnchorHTMLAttributes<HTMLAnchorElement> & { href: string };\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n className={resolvedClasses}\n {...anchorRest}\n >\n {content}\n </a>\n );\n }\n\n const { disabled, ...buttonRest } = rest as ButtonHTMLAttributes<HTMLButtonElement>;\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n disabled={disabled}\n className={resolvedClasses}\n {...buttonRest}\n >\n {content}\n </button>\n );\n }\n);\nMenuItem.displayName = \"MenuItem\";\n\n// ─── Menu ────────────────────────────────────────────────────────────────────\n\nexport interface MenuProps extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n}\n\nexport const Menu = forwardRef<HTMLElement, MenuProps>(\n ({ children, className, ...props }, ref) => (\n <nav\n ref={ref as React.Ref<HTMLElement>}\n className={cn(\"flex flex-col\", className)}\n {...props}\n >\n {children}\n </nav>\n )\n);\nMenu.displayName = \"Menu\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n // Matches DropdownMenuItem: a submenu row sits in the same list as the\n // plain rows, so it cannot be a different size from them.\n \"flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] outline-none\",\n \"focus:bg-muted data-[state=open]:bg-muted\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4 text-muted-foreground\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-[130] min-w-[8rem] overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 8, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-[130] min-w-[11rem] overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n // 13px / tighter padding: a menu drops out of a toolbar button or a\n // compact table control, and at 15px with 10px vertical padding it read\n // as a larger, separate UI than the control that opened it.\n \"relative flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[13px] outline-none transition-colors\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n // Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /\n // dot indicator's, not padding.\n \"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4 text-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n // Matches DropdownMenuItem. `pl-8` stays: that gutter is the check /\n // dot indicator's, not padding.\n \"relative flex cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-2.5 text-[13px] outline-none transition-colors\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current text-primary\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-xs font-semibold text-muted-foreground\", inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nfunction DropdownMenuShortcut({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) {\n return <span className={cn(\"ml-auto text-[10px] tracking-wide text-muted-foreground\", className)} {...props} />;\n}\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst Select = SelectPrimitive.Root;\nconst SelectGroup = SelectPrimitive.Group;\nconst SelectValue = SelectPrimitive.Value;\n\n/**\n * `md` (default) is the form-field trigger. `sm` is for dense furniture — a\n * rows-per-page picker in a table footer, a control inside a toolbar — where\n * the full-height field towers over everything beside it.\n *\n * This is a size prop rather than a job for `className` because the base sets\n * `min-h-11`, which beats an `h-8` utility: every caller wanting a short\n * trigger had to override min-height, padding, gap and text size together.\n */\nexport type SelectTriggerSize = \"sm\" | \"md\";\n\nconst selectTriggerSizes: Record<SelectTriggerSize, string> = {\n md: \"h-11 min-h-11 gap-2.5 px-4 py-2 text-[15px]\",\n sm: \"h-7 min-h-7 w-auto gap-1 px-2 py-0 text-[12px]\",\n};\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & { size?: SelectTriggerSize }\n>(({ className, children, size = \"md\", ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex w-full items-center justify-between rounded-lg border border-border bg-card text-foreground outline-none\",\n elevation.field,\n selectTriggerSizes[size],\n \"ring-ring/50 focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50\",\n \"[&>span]:line-clamp-1\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4 w-4 shrink-0 text-muted-foreground opacity-70\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1 text-muted-foreground\", className)}\n {...props}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1 text-muted-foreground\", className)}\n {...props}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-[120] max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1 max-h-72 overflow-y-auto\",\n position === \"popper\" && \"w-full min-w-[var(--radix-select-trigger-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label ref={ref} className={cn(\"px-2 py-1.5 text-xs font-medium text-muted-foreground\", className)} {...props} />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-lg py-2 pl-2 pr-8 text-sm outline-none\",\n \"focus:bg-muted focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4 text-primary\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport interface CommandProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandInputProps extends React.InputHTMLAttributes<HTMLInputElement> {}\nexport interface CommandListProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandGroupProps extends React.HTMLAttributes<HTMLDivElement> { heading?: string; }\nexport interface CommandItemProps extends React.HTMLAttributes<HTMLDivElement> { selected?: boolean; disabled?: boolean; onSelect?: () => void; }\nexport interface CommandSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {}\nexport interface CommandShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {}\n\nconst Command = React.forwardRef<HTMLDivElement, CommandProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"bg-card rounded-xl border border-border overflow-hidden\", elevation.popover, className)} {...props} />\n));\nCommand.displayName = \"Command\";\n\nconst CommandInput = React.forwardRef<HTMLInputElement, CommandInputProps>(({ className, ...props }, ref) => (\n <div className=\"flex items-center gap-2 border-b border-border px-3 h-11\">\n <Search className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden />\n <input ref={ref} className={cn(\"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\", className)} {...props} />\n </div>\n));\nCommandInput.displayName = \"CommandInput\";\n\nconst CommandList = React.forwardRef<HTMLDivElement, CommandListProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"max-h-72 overflow-y-auto py-1\", className)} role=\"listbox\" {...props} />\n));\nCommandList.displayName = \"CommandList\";\n\nconst CommandEmpty = React.forwardRef<HTMLDivElement, CommandEmptyProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"text-sm text-muted-foreground text-center py-6\", className)} {...props} />\n));\nCommandEmpty.displayName = \"CommandEmpty\";\n\nconst CommandGroup = React.forwardRef<HTMLDivElement, CommandGroupProps>(({ className, heading, children, ...props }, ref) => (\n <div ref={ref} className={cn(\"px-1 py-1\", className)} role=\"group\" {...props}>\n {heading && <div className=\"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider\">{heading}</div>}\n {children}\n </div>\n));\nCommandGroup.displayName = \"CommandGroup\";\n\nconst CommandItem = React.forwardRef<HTMLDivElement, CommandItemProps>(({ className, selected, disabled, onSelect, children, ...props }, ref) => (\n <div\n ref={ref}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled}\n onClick={disabled ? undefined : onSelect}\n className={cn(\n \"flex items-center gap-2 px-2 py-1.5 rounded-md text-sm cursor-pointer transition-colors duration-pg-fast ease-pg-standard select-none\",\n selected ? \"bg-muted text-foreground\" : \"text-foreground hover:bg-muted\",\n disabled && \"pointer-events-none opacity-50\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n));\nCommandItem.displayName = \"CommandItem\";\n\nconst CommandSeparator = React.forwardRef<HTMLDivElement, CommandSeparatorProps>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"h-px bg-border my-1 -mx-1\", className)} {...props} />\n));\nCommandSeparator.displayName = \"CommandSeparator\";\n\nconst CommandShortcut = React.forwardRef<HTMLSpanElement, CommandShortcutProps>(({ className, ...props }, ref) => (\n <span ref={ref} className={cn(\"ml-auto text-xs text-muted-foreground tracking-widest\", className)} {...props} />\n));\nCommandShortcut.displayName = \"CommandShortcut\";\n\nexport { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator, CommandShortcut };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport { cn } from \"./utils\";\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5 text-muted-foreground\",\n className\n )}\n {...props}\n />\n));\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-xs font-medium transition-colors\",\n \"ring-ring/50 focus-visible:outline-none focus-visible:ring-2\",\n \"data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className\n )}\n {...props}\n />\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-3 outline-none ring-ring/50 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-lg\",\n className\n )}\n {...props}\n />\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent };\n","\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"./select\";\nimport { Tabs, TabsList, TabsTrigger } from \"./tabs\";\nimport { cn } from \"./utils\";\n\n/**\n * Two presets over the `Tabs` primitives, for the two jobs a tab row actually\n * does. They are separate components on purpose, so a page can show both\n * without the reader having to work out which row governs what:\n *\n * - {@link UnderlineTabs} is the **page-level** bar that segments a view into\n * sections — full-width, one sliding indicator, the thing a URL usually\n * follows.\n * - {@link SegmentedTabs} is the **compact scoping strip** for a required\n * single choice that qualifies the content beside it: which status a list is\n * filtered by, which period a summary describes.\n *\n * Neither is a filter chip. A chip is for an *optional* filter that can be\n * cleared; both of these always have exactly one option selected, so neither\n * ever renders a clear affordance.\n */\n\nexport interface UnderlineTab {\n value: string;\n /**\n * A plain string for an ordinary tab; a node when the tab carries an\n * annotation beside its name, such as a status badge showing the state of\n * the section behind it.\n */\n label: ReactNode;\n}\n\n/**\n * Page-level tab bar with a single shared indicator that slides between tabs,\n * rather than each tab drawing its own underline.\n *\n * The indicator's position and width are measured from the DOM: text tabs have\n * different widths, so this cannot be derived from props or state. It sits\n * flush on the row's own bottom border instead of floating below the label.\n *\n * `actions` renders flush right on the same row, tabs staying left-aligned,\n * which is where a page puts its primary CTA.\n */\nexport function UnderlineTabs({\n tabs,\n value,\n onValueChange,\n actions,\n className,\n}: {\n tabs: readonly UnderlineTab[];\n value: string;\n onValueChange: (value: string) => void;\n actions?: ReactNode;\n className?: string;\n}) {\n const tabRefs = useRef<Record<string, HTMLButtonElement | null>>({});\n const [indicator, setIndicator] = useState<{ left: number; width: number } | null>(null);\n\n useEffect(() => {\n const measure = () => {\n const el = tabRefs.current[value];\n if (el) setIndicator({ left: el.offsetLeft, width: el.offsetWidth });\n };\n // Deferred into a rAF / resize callback rather than called in the effect\n // body: it reads post-layout geometry, which is not derivable from render.\n const raf = requestAnimationFrame(measure);\n window.addEventListener(\"resize\", measure);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener(\"resize\", measure);\n };\n }, [value]);\n\n return (\n <Tabs value={value} onValueChange={onValueChange} className={className}>\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n {/* `relative` here rather than on the row, so the indicator measures\n against the tab strip itself and is unaffected by `actions`. */}\n <TabsList className=\"relative h-auto justify-start gap-5 rounded-none border-0 bg-transparent p-0\">\n {tabs.map((tab) => (\n <TabsTrigger\n key={tab.value}\n ref={(el) => {\n tabRefs.current[tab.value] = el;\n }}\n value={tab.value}\n className=\"h-auto rounded-none px-0 py-2.5 text-[13px] font-medium text-muted-foreground shadow-none data-[state=active]:bg-transparent data-[state=active]:text-primary data-[state=active]:shadow-none\"\n >\n {tab.label}\n </TabsTrigger>\n ))}\n <span\n aria-hidden\n className=\"absolute bottom-0 h-0.5 bg-primary transition-all duration-200 ease-out\"\n style={{\n left: indicator?.left ?? 0,\n width: indicator?.width ?? 0,\n opacity: indicator ? 1 : 0,\n }}\n />\n </TabsList>\n\n {actions ? <div className=\"flex shrink-0 items-center gap-2\">{actions}</div> : null}\n </div>\n </Tabs>\n );\n}\n\nexport interface SegmentedTabOption<T extends string = string> {\n value: T;\n label: string;\n}\n\n/**\n * The compact strip that scopes the content beside it.\n *\n * Plain underlined triggers, not the `Tabs` pill look: no container\n * background, border or padding — a gap row of triggers, each just an\n * underline and a colour change when active. Still Radix `Tabs` underneath, so\n * keyboard navigation and `aria-selected` come free; only the classes differ.\n *\n * With `collapseToSelect`, the strip becomes a `Select` below `md`. Both\n * controls drive the same state, so resizing mid-session can never leave the\n * two disagreeing about which option is chosen.\n */\nexport function SegmentedTabs<T extends string>({\n options,\n value,\n onValueChange,\n label = \"Options\",\n collapseToSelect = true,\n className,\n}: {\n options: readonly SegmentedTabOption<T>[];\n value: T;\n onValueChange: (value: T) => void;\n /** Accessible name for both controls. */\n label?: string;\n /**\n * Swap to a `Select` below `md`. Leave on for a strip that would otherwise\n * crowd a narrow screen; turn it off where the row already has the room and\n * a dropdown would read as a different control appearing.\n */\n collapseToSelect?: boolean;\n className?: string;\n}) {\n return (\n <>\n <Tabs\n value={value}\n onValueChange={(next) => onValueChange(next as T)}\n className={cn(collapseToSelect && \"hidden md:block\", className)}\n >\n <TabsList\n aria-label={label}\n className=\"h-auto gap-4 rounded-none border-0 bg-transparent p-0\"\n >\n {options.map((option) => (\n <TabsTrigger\n key={option.value}\n value={option.value}\n className=\"h-auto rounded-none border-b-2 border-transparent px-0 py-1 text-[13px] font-medium text-muted-foreground shadow-none data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-primary data-[state=active]:shadow-none\"\n >\n {option.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n\n {collapseToSelect ? (\n <Select value={value} onValueChange={(next) => onValueChange(next as T)}>\n <SelectTrigger className=\"h-8 w-[9.5rem] md:hidden\" aria-label={label}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n ) : null}\n </>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nconst Accordion = AccordionPrimitive.Root;\n\nconst AccordionItem = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn(\"border-b border-border last:border-b-0\", className)}\n {...props}\n />\n));\nAccordionItem.displayName = \"AccordionItem\";\n\nconst AccordionTrigger = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex w-full items-center justify-between py-4 text-sm font-medium text-foreground\",\n \"hover:text-primary transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"[&[data-state=open]>svg]:rotate-180\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDown className=\"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-pg-fast ease-pg-standard\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n));\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\nconst AccordionContent = React.forwardRef<\n React.ElementRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <AccordionPrimitive.Content\n ref={ref}\n className={cn(\n \"overflow-hidden text-sm text-muted-foreground\",\n \"data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up\",\n className\n )}\n style={\n {\n \"--accordion-content-height\": \"var(--radix-accordion-content-height)\",\n } as React.CSSProperties\n }\n {...props}\n >\n <div className={cn(\"pb-4 pt-0\", className)}>{children}</div>\n </AccordionPrimitive.Content>\n));\nAccordionContent.displayName = \"AccordionContent\";\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { X, Info, CheckCircle2, AlertTriangle, XCircle } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant;\n dismissible?: boolean;\n onDismiss?: () => void;\n}\n\nconst variantStyles: Record<AlertVariant, string> = {\n info: \"bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200\",\n success: \"bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200\",\n warning: \"bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200\",\n error: \"bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200\",\n neutral: \"bg-muted border-border text-foreground\",\n};\n\nconst variantIcons: Record<AlertVariant, React.ElementType> = {\n info: Info,\n success: CheckCircle2,\n warning: AlertTriangle,\n error: XCircle,\n neutral: Info,\n};\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant = \"info\", dismissible, onDismiss, children, ...props }, ref) => {\n const Icon = variantIcons[variant];\n return (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(\"relative flex gap-3 rounded-xl border p-4\", elevation.surface, variantStyles[variant], className)}\n {...props}\n >\n <Icon className=\"mt-0.5 size-4 shrink-0\" aria-hidden />\n <div className=\"flex-1 min-w-0\">{children}</div>\n {dismissible && (\n <button\n type=\"button\"\n onClick={onDismiss}\n className=\"shrink-0 rounded-md p-0.5 opacity-60 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n aria-label=\"Dismiss\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n );\n }\n);\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement>>(\n ({ className, ...props }, ref) => (\n <h5 ref={ref} className={cn(\"mb-1 text-sm font-semibold leading-none\", className)} {...props} />\n )\n);\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-sm opacity-90 leading-relaxed\", className)} {...props} />\n )\n);\nAlertDescription.displayName = \"AlertDescription\";\n\nexport interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant;\n dismissible?: boolean;\n onDismiss?: () => void;\n}\n\nconst Banner = React.forwardRef<HTMLDivElement, BannerProps>(\n ({ className, variant = \"info\", dismissible, onDismiss, children, ...props }, ref) => {\n const Icon = variantIcons[variant];\n return (\n <div\n ref={ref}\n role=\"banner\"\n className={cn(\"flex items-center gap-3 border-b px-4 py-3\", variantStyles[variant], className)}\n {...props}\n >\n <Icon className=\"size-4 shrink-0\" aria-hidden />\n <div className=\"flex-1 min-w-0 text-sm\">{children}</div>\n {dismissible && (\n <button\n type=\"button\"\n onClick={onDismiss}\n className=\"shrink-0 rounded-md p-0.5 opacity-60 hover:opacity-100 transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n aria-label=\"Dismiss\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n );\n }\n);\nBanner.displayName = \"Banner\";\n\nexport { Alert, AlertTitle, AlertDescription, Banner };\n","import * as React from \"react\";\nimport { Info, CheckCircle2, AlertTriangle, XCircle, Sparkles } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type CalloutVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\" | \"discovery\";\n\nexport interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: CalloutVariant;\n}\n\nconst variantStyles: Record<CalloutVariant, string> = {\n info: \"bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200\",\n success: \"bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200\",\n warning: \"bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200\",\n error: \"bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200\",\n neutral: \"bg-muted border-border text-foreground\",\n discovery: \"bg-purple-50 border-purple-200 text-purple-900 dark:bg-purple-950/30 dark:border-purple-800 dark:text-purple-200\",\n};\n\nconst variantIcons: Record<CalloutVariant, React.ElementType> = {\n info: Info,\n success: CheckCircle2,\n warning: AlertTriangle,\n error: XCircle,\n neutral: Info,\n discovery: Sparkles,\n};\n\nconst Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n ({ className, variant = \"info\", children, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex gap-3 rounded-xl border p-4\", variantStyles[variant], className)} {...props}>\n {children}\n </div>\n )\n);\nCallout.displayName = \"Callout\";\n\ninterface CalloutIconProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: CalloutVariant;\n}\n\nconst CalloutIcon = React.forwardRef<HTMLDivElement, CalloutIconProps>(\n ({ className, variant = \"info\", ...props }, ref) => {\n const Icon = variantIcons[variant];\n return (\n <div ref={ref} className={cn(\"mt-0.5 shrink-0\", className)} {...props}>\n <Icon className=\"size-4\" aria-hidden />\n </div>\n );\n }\n);\nCalloutIcon.displayName = \"CalloutIcon\";\n\nconst CalloutTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-sm font-semibold\", className)} {...props} />\n )\n);\nCalloutTitle.displayName = \"CalloutTitle\";\n\nconst CalloutText = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\n ({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"mt-1 text-sm opacity-90 leading-relaxed\", className)} {...props} />\n )\n);\nCalloutText.displayName = \"CalloutText\";\n\nexport { Callout, CalloutIcon, CalloutTitle, CalloutText };\n","import * as React from \"react\";\nimport { Info, CheckCircle2, AlertTriangle, XCircle, Sparkles } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport type SectionMessageVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"discovery\";\n\nexport interface SectionMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: SectionMessageVariant;\n}\n\nconst variantConfig: Record<\n SectionMessageVariant,\n { border: string; bg: string; icon: React.ElementType; iconColor: string }\n> = {\n info: {\n border: \"border-l-blue-500\",\n bg: \"bg-blue-50/60 dark:bg-blue-950/20\",\n icon: Info,\n iconColor: \"text-blue-500 dark:text-blue-400\",\n },\n success: {\n border: \"border-l-green-500\",\n bg: \"bg-green-50/60 dark:bg-green-950/20\",\n icon: CheckCircle2,\n iconColor: \"text-green-500 dark:text-green-400\",\n },\n warning: {\n border: \"border-l-amber-500\",\n bg: \"bg-amber-50/60 dark:bg-amber-950/20\",\n icon: AlertTriangle,\n iconColor: \"text-amber-500 dark:text-amber-400\",\n },\n error: {\n border: \"border-l-red-500\",\n bg: \"bg-red-50/60 dark:bg-red-950/20\",\n icon: XCircle,\n iconColor: \"text-red-500 dark:text-red-400\",\n },\n discovery: {\n border: \"border-l-purple-500\",\n bg: \"bg-purple-50/60 dark:bg-purple-950/20\",\n icon: Sparkles,\n iconColor: \"text-purple-500 dark:text-purple-400\",\n },\n};\n\nconst SectionMessageVariantContext = React.createContext<SectionMessageVariant>(\"info\");\n\nconst SectionMessage = React.forwardRef<HTMLDivElement, SectionMessageProps>(\n ({ className, variant = \"info\", children, ...props }, ref) => {\n const config = variantConfig[variant];\n const Icon = config.icon;\n return (\n <SectionMessageVariantContext.Provider value={variant}>\n <div\n ref={ref}\n role=\"region\"\n className={cn(\n \"flex w-full gap-4 rounded-xl border border-l-4 border-border p-5 transition-colors duration-pg-fast ease-pg-standard\",\n elevation.surface,\n config.border,\n config.bg,\n className\n )}\n {...props}\n >\n <Icon\n className={cn(\"mt-0.5 size-5 shrink-0\", config.iconColor)}\n aria-hidden\n />\n <div className=\"flex-1 min-w-0\">{children}</div>\n </div>\n </SectionMessageVariantContext.Provider>\n );\n }\n);\nSectionMessage.displayName = \"SectionMessage\";\n\nconst SectionMessageTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h4\n ref={ref}\n className={cn(\"text-sm font-semibold text-foreground mb-1\", className)}\n {...props}\n />\n));\nSectionMessageTitle.displayName = \"SectionMessageTitle\";\n\nconst SectionMessageContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm text-muted-foreground leading-relaxed\", className)}\n {...props}\n />\n));\nSectionMessageContent.displayName = \"SectionMessageContent\";\n\nconst SectionMessageActions = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap gap-2 mt-3\", className)}\n {...props}\n />\n));\nSectionMessageActions.displayName = \"SectionMessageActions\";\n\nexport {\n SectionMessage,\n SectionMessageTitle,\n SectionMessageContent,\n SectionMessageActions,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nimport { cn } from \"./utils\";\n\nconst sizeMap = {\n xs: 12,\n sm: 16,\n md: 20,\n lg: 28,\n xl: 36,\n} as const;\n\nconst colorMap = {\n primary: \"text-primary\",\n muted: \"text-muted-foreground\",\n white: \"text-white\",\n inherit: \"\",\n} as const;\n\nexport interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {\n size?: keyof typeof sizeMap;\n color?: keyof typeof colorMap;\n}\n\nconst Spinner = React.forwardRef<HTMLSpanElement, SpinnerProps>(\n ({ className, size = \"md\", color = \"primary\", ...props }, ref) => {\n const px = sizeMap[size];\n\n return (\n <span\n ref={ref}\n data-slot=\"spinner\"\n role=\"status\"\n aria-label=\"Loading\"\n className={cn(\"inline-flex items-center justify-center\", colorMap[color], className)}\n {...props}\n >\n <Loader2\n width={px}\n height={px}\n className=\"animate-spin\"\n aria-hidden=\"true\"\n />\n <span className=\"sr-only\">Loading...</span>\n </span>\n );\n }\n);\nSpinner.displayName = \"Spinner\";\n\nexport { Spinner };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type ProgressVariant = \"default\" | \"success\" | \"warning\" | \"error\";\nexport type ProgressSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ProgressProps extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {\n variant?: ProgressVariant;\n size?: ProgressSize;\n label?: boolean;\n}\n\nconst variantTrack: Record<ProgressVariant, string> = {\n default: \"bg-primary\",\n success: \"bg-green-500\",\n warning: \"bg-amber-500\",\n error: \"bg-red-500\",\n};\n\nconst sizeClasses: Record<ProgressSize, string> = {\n xs: \"h-1\",\n sm: \"h-1.5\",\n md: \"h-2\",\n lg: \"h-3\",\n};\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(({ className, value, variant = \"default\", size = \"md\", label, ...props }, ref) => (\n <div className=\"w-full\">\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\"relative w-full overflow-hidden rounded-full bg-muted\", sizeClasses[size], className)}\n {...props}\n value={value}\n >\n <ProgressPrimitive.Indicator\n className={cn(\"h-full w-full flex-1 transition-all duration-pg-slow ease-pg-standard\", variantTrack[variant])}\n style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n {label && <p className=\"mt-1 text-xs text-muted-foreground text-right\">{value ?? 0}%</p>}\n </div>\n));\nProgress.displayName = \"Progress\";\n\nexport type ProgressStepStatus = \"complete\" | \"current\" | \"upcoming\";\n\nexport interface ProgressTrackerStep {\n label: string;\n description?: string;\n status: ProgressStepStatus;\n}\n\nexport interface ProgressTrackerProps extends React.HTMLAttributes<HTMLDivElement> {\n steps: ProgressTrackerStep[];\n}\n\nconst ProgressTracker = React.forwardRef<HTMLDivElement, ProgressTrackerProps>(\n ({ className, steps, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex items-start\", className)} {...props}>\n {steps.map((step, i) => (\n <React.Fragment key={i}>\n <div className=\"flex flex-col items-center gap-1.5 min-w-0\">\n <div className={cn(\n \"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors\",\n step.status === \"complete\" && \"bg-primary border-primary text-primary-foreground\",\n step.status === \"current\" && \"bg-primary/10 border-primary text-primary\",\n step.status === \"upcoming\" && \"bg-card border-border text-muted-foreground\"\n )}>\n {step.status === \"complete\" ? <Check className=\"size-4\" strokeWidth={2.5} /> : i + 1}\n </div>\n <div className=\"text-center px-1\">\n <p className={cn(\"text-xs font-medium\", step.status === \"upcoming\" ? \"text-muted-foreground\" : \"text-foreground\")}>{step.label}</p>\n {step.description && <p className=\"text-[11px] text-muted-foreground mt-0.5\">{step.description}</p>}\n </div>\n </div>\n {i < steps.length - 1 && (\n <div className=\"flex-1 mt-4 mx-1\">\n <div className={cn(\"h-0.5 w-full rounded-full transition-colors\", step.status === \"complete\" ? \"bg-primary\" : \"bg-border\")} />\n </div>\n )}\n </React.Fragment>\n ))}\n </div>\n )\n);\nProgressTracker.displayName = \"ProgressTracker\";\n\nexport { Progress, ProgressTracker };\n","import { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\ninterface ShimmerProps {\n className?: string;\n rounded?: \"sm\" | \"md\" | \"lg\" | \"full\";\n}\n\nexport function Shimmer({ className, rounded = \"md\" }: ShimmerProps) {\n const r = { sm: \"rounded\", md: \"rounded-lg\", lg: \"rounded-xl\", full: \"rounded-full\" }[rounded];\n return <div className={cn(\"shimmer\", r, className)} />;\n}\n\nexport function StatCardSkeleton() {\n return (\n <div\n className={cn(\n \"bg-card text-card-foreground rounded-xl p-5 flex flex-col gap-3 border border-border\",\n elevation.surface\n )}\n >\n <div className=\"flex items-center justify-between\">\n <Shimmer className=\"h-3 w-28\" />\n <Shimmer className=\"h-10 w-10\" rounded=\"full\" />\n </div>\n <Shimmer className=\"h-9 w-44 mt-1\" />\n <Shimmer className=\"h-3 w-32\" />\n </div>\n );\n}\n\nexport function TableRowSkeleton({\n cols = 6,\n comfortable = false,\n density: densityProp,\n snug = false,\n}: {\n cols?: number;\n /** @deprecated prefer `density` */\n comfortable?: boolean;\n density?: \"default\" | \"comfortable\" | \"compact\";\n snug?: boolean;\n}) {\n const density =\n densityProp ??\n (comfortable ? \"comfortable\" : \"default\");\n const cellPad =\n density === \"comfortable\"\n ? \"px-5 py-4\"\n : density === \"compact\"\n ? snug\n ? \"pl-1.5 pr-2.5 py-2.5\"\n : \"px-3 py-2.5\"\n : \"px-4 py-3.5\";\n return (\n <tr\n className={cn(\n \"border-b border-border/60\",\n density === \"comfortable\" && \"min-h-[56px]\",\n density === \"compact\" && \"min-h-[44px]\"\n )}\n >\n {Array.from({ length: cols }).map((_, i) => (\n <td key={i} className={cellPad}>\n <Shimmer className={cn(\"h-3.5\", i === 0 ? \"w-20\" : i === cols - 1 ? \"w-14\" : \"w-28\")} />\n </td>\n ))}\n </tr>\n );\n}\n\nexport function ChartSkeleton({ height = \"h-48\" }: { height?: string }) {\n return (\n <div className={cn(\"flex items-end gap-2 px-2\", height)}>\n {[55, 72, 40, 88, 65, 82, 48, 95, 60, 70].map((h, i) => (\n <div key={i} className=\"flex-1 shimmer rounded-t-md\" style={{ height: `${h}%` }} />\n ))}\n </div>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { cn } from \"./utils\";\nimport { type LucideIcon, Inbox } from \"lucide-react\";\n\ninterface EmptyStateProps {\n icon?: LucideIcon;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}\n\nexport function EmptyState({\n icon: Icon = Inbox,\n title,\n description,\n action,\n className,\n}: EmptyStateProps) {\n return (\n <div className={cn(\"flex flex-col items-center justify-center py-16 px-4 text-center\", className)}>\n <div className=\"w-14 h-14 rounded-2xl bg-slate-100 flex items-center justify-center mb-4\">\n <Icon className=\"w-6 h-6 text-slate-400\" />\n </div>\n <h3 className=\"text-sm font-semibold text-slate-700 mb-1\">{title}</h3>\n {description && (\n <p className=\"text-xs text-slate-500 max-w-xs leading-relaxed\">{description}</p>\n )}\n {action && <div className=\"mt-4\">{action}</div>}\n </div>\n );\n}\n","\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { Shimmer } from \"./skeleton\";\nimport { EmptyState } from \"./empty-state\";\nimport {\n ArrowDown,\n ArrowUp,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronsUpDown,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"./select\";\n\nexport type DataTableDensity = \"default\" | \"comfortable\" | \"compact\";\nexport type DataTableHeaderStyle = \"surface\" | \"minimal\";\n\n/**\n * Footer summary text.\n * - `range` — \"Showing 1–15 of 141 results\" (or \"Showing 1–15\" when no total\n * is knowable, i.e. cursor pagination).\n * - `count` — \"141 items\".\n * - `none` — no summary, just the pager.\n */\nexport type DataTableFooterSummary = \"range\" | \"count\" | \"none\";\n\nexport type SortOrder = \"ascend\" | \"descend\";\n/** `null` means unsorted — the table is in the order the data arrived in. */\nexport type DataTableSortState = { columnKey: string; order: SortOrder } | null;\n\n/** Builds the visible page numbers including ellipsis markers */\nfunction getPageRange(current: number, total: number): (number | \"…\")[] {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const pages: (number | \"…\")[] = [1];\n if (current > 3) pages.push(\"…\");\n const lo = Math.max(2, current - 1);\n const hi = Math.min(total - 1, current + 1);\n for (let p = lo; p <= hi; p++) pages.push(p);\n if (current < total - 2) pages.push(\"…\");\n pages.push(total);\n return pages;\n}\n\n// ── Pagination ───────────────────────────────────────────────────────────────\n\n/** Controls shared by every paginated mode. */\ntype PagerCommon = {\n /**\n * Summary text at the left of the footer. Defaults to `range`.\n */\n summary?: DataTableFooterSummary;\n /** Noun after the number when `summary=\"count\"`. Default `item` / `items`. */\n countLabels?: { singular: string; plural: string };\n /**\n * Page-size choices. Pass these — with `onPageSizeChange` — and the footer\n * grows a \"Rows per page\" picker at its far left. Omit and there is none.\n *\n * This lives here rather than being hand-passed as a footer slot because a\n * grid that had to hand-roll its own page-size control is how two different\n * pagers end up in the same app.\n */\n pageSizeOptions?: readonly number[];\n onPageSizeChange?: (size: number) => void;\n /** Escape hatch: an extra control at the far left, before the summary. */\n leading?: ReactNode;\n};\n\n/**\n * How the table pages. Which member you use is decided by the endpoint, not by\n * taste:\n *\n * - `client` — every row is already in `data`; the table slices it. The\n * default when `pagination` is omitted.\n * - `page` — the response carries a row **total**, so the footer can show\n * \"Showing 1–15 of 141 results\" and a full numbered strip with ellipses.\n * - `cursor` — the response carries no total (a `nextCursor` /\n * `exclusiveStartKey` API). The footer shows \"Showing 1–15\" with **no**\n * total and no page count, and the numbered strip is only ever the page\n * before, the current page, and — when `hasNext` says so — the page after.\n * Those are the only pages a cursor can actually reach in one step, so they\n * are the only ones offered.\n * - `none` — no footer at all.\n */\nexport type DataTablePagination =\n | ({\n mode: \"client\";\n /** Rows per page. Default 10. */\n pageSize?: number;\n } & PagerCommon)\n | ({\n mode: \"page\";\n /** 1-indexed. */\n page: number;\n pageSize: number;\n /** Total rows across all pages, from the response. */\n total: number;\n onPageChange: (page: number) => void;\n } & PagerCommon)\n | ({\n mode: \"cursor\";\n /** 1-indexed, for the \"Showing x–y\" range and the page marker. */\n page: number;\n pageSize: number;\n /** Whether a page exists after this one. Drives the next control. */\n hasNext: boolean;\n /** Defaults to `page > 1`. */\n hasPrev?: boolean;\n onNext: () => void;\n onPrev: () => void;\n } & PagerCommon)\n | { mode: \"none\" };\n\n// ── Sorting ──────────────────────────────────────────────────────────────────\n\n/**\n * Sorting, modelled on antd's `Table`: a column opts in with `sorter`, and the\n * table reports state as `{ columnKey, order }` with antd's `\"ascend\"` /\n * `\"descend\"` vocabulary.\n *\n * The one deliberate difference is that client and server sorting are told\n * apart by the **column**, not by a table-level flag: `sorter: true` means \"the\n * caller orders this\", a comparator means \"the table orders this\". A grid can\n * therefore mix the two, which matters when one column is a derived value the\n * server does not know about.\n */\nexport type DataTableSorting = {\n /**\n * Controlled sort state. Omit for uncontrolled — the table remembers, which\n * is all a client-sorted grid needs.\n */\n value?: DataTableSortState;\n /** Fires on every header activation, with the state being moved to. */\n onChange?: (next: DataTableSortState) => void;\n};\n\n/**\n * Row expansion: a disclosure column plus a full-width panel rendered directly\n * beneath the expanded row. Use it when the detail belongs *with* the row in\n * the flow of the table (a request's headers, a payload, a breakdown) rather\n * than in a drawer that covers it.\n *\n * Leave `expandedKeys` unset for uncontrolled behaviour (the table remembers\n * which rows are open). Pass `expandedKeys` + `onExpandedChange` to drive it\n * from outside — needed when opening a row triggers a fetch.\n */\nexport type DataTableExpandable<T> = {\n /** The panel shown under an expanded row. */\n render: (row: T, index: number) => ReactNode;\n /**\n * Which rows can open at all. Rows that cannot get no toggle and no chevron,\n * keeping the column's width without implying an affordance that isn't there.\n * Defaults to every row.\n */\n isExpandable?: (row: T, index: number) => boolean;\n /** Controlled open rows, as `rowKey` values. Omit for uncontrolled. */\n expandedKeys?: string[];\n /** Fires on every open/close in controlled mode. */\n onExpandedChange?: (keys: string[]) => void;\n /**\n * Fires only when a row opens, in both modes — the hook for lazily fetching\n * that row's detail. Not called on close.\n */\n onExpand?: (row: T, index: number) => void;\n /** Accessible name for the toggle. Default \"Toggle row details\". */\n toggleLabel?: string;\n};\n\nexport type Column<T> = {\n key: string;\n header: ReactNode;\n /**\n * Table column width: `48px`, `18%`, or `minmax(12rem, 1fr)` for a floor\n * that can still grow into whatever the other columns leave over.\n *\n * `minmax(min, max)` is translated rather than passed straight through: this\n * is a real `<table>`/`<colgroup>`, and `minmax()` is a CSS Grid function\n * that is not a legal `width` value outside a grid — the browser drops the\n * whole declaration and the column gets no floor at all. `min` becomes the\n * `<col>`'s `min-width`, and `max` becomes its `width` unless `max` is `1fr`\n * (or any other flex unit), in which case no `width` is set and the column\n * takes its share of whatever `table-layout: fixed` has left over, the same\n * way a grid track's `1fr` would.\n *\n * `overflow-x-auto` on the table's own scroll container is what makes the\n * floor mean something: once every column's minimum no longer fits, the\n * table grows past its container and scrolls instead of every column\n * shrinking under its `min-width` and the header text — deliberately not\n * truncated, see the `<th>` render below — overlapping the column beside it.\n */\n width?: string;\n minWidth?: number;\n maxWidth?: number;\n align?: \"left\" | \"right\" | \"center\";\n /** Allow cell text to wrap instead of truncating. */\n wrap?: boolean;\n /** Extra classes on `<th>` / `<td>` (e.g. wider horizontal padding per column) */\n cellClassName?: string;\n /**\n * Inline styles on `<th>` / `<td>`.\n *\n * For a value Tailwind cannot generate a class for because it is computed —\n * a sticky column's `left`, which is the running total of the widths before\n * it. Expressing that as a class means keeping a hand-written lookup table of\n * every offset the layout can produce, and silently getting the wrong one the\n * moment a column width changes. See `frozenColumn`.\n */\n cellStyle?: CSSProperties;\n /**\n * Makes this header a sort control.\n *\n * - `true` — the **caller** orders the rows (a server-side `sortBy` query).\n * The table reports the change through `sorting.onChange` and leaves `data`\n * exactly as given.\n * - a comparator — the **table** orders the rows with it, before paging.\n * Same contract as `Array.prototype.sort`'s argument, and the same as\n * antd's `sorter`.\n */\n sorter?: boolean | ((a: T, b: T) => number);\n /**\n * The orders this header cycles through before returning to unsorted.\n * Default `[\"ascend\", \"descend\"]`. Pass `[\"descend\", \"ascend\"]` for a column\n * where \"most recent\" or \"largest\" is the obvious first click.\n */\n sortDirections?: SortOrder[];\n render: (row: T, index: number) => ReactNode;\n};\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n data: T[];\n isLoading?: boolean;\n skeletonRows?: number;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * Pagination and the footer that carries it. Omit for client-side paging at\n * 10 rows a page. See {@link DataTablePagination}.\n */\n pagination?: DataTablePagination;\n /** Column sorting. See {@link DataTableSorting}. */\n sorting?: DataTableSorting;\n className?: string;\n rowKey: (row: T) => string;\n /** Optional hover CTA shown on the right of every row */\n rowCta?: {\n label: string;\n onClick?: (row: T) => void;\n };\n /**\n * Custom action revealed on row hover — typically a `<Button>` or\n * `<ButtonGroup>`, but any `ReactNode` is accepted. Pass a **function** to\n * render per-row: it receives `(row, index)`, so the action always has the\n * record for its row (e.g. to navigate or open a drawer for that row).\n *\n * It is not a real column: it floats as an overlay **pinned to the right edge\n * of the viewport**, so it stays in view as the table scrolls horizontally\n * (no scrolling to the end to reach it) while the last data column stays\n * flush with nothing trailing it. Takes precedence over `rowCta`.\n */\n rowAction?: ReactNode | ((row: T, index: number) => ReactNode);\n /**\n * Makes the whole row a click target — the row itself opens a drawer, a\n * detail page, whatever the table drills into — instead of that living in a\n * per-cell wrapper or a hover-revealed button.\n *\n * The handler sits on the `<tr>`, so the entire row including cell padding\n * and the empty space between columns is clickable, and the row gets\n * `cursor-pointer` plus keyboard access (focusable, Enter / Space).\n *\n * Clicks that originate inside something interactive — a `<button>`, `<a>`,\n * a form control, a Radix trigger, or anything marked\n * `data-row-click-ignore` — do NOT fire this. Copy buttons, per-row menus\n * and the `rowAction` overlay therefore keep doing only their own job\n * without each having to stop propagation.\n */\n onRowClick?: (row: T, index: number) => void;\n /** Row / cell vertical rhythm and horizontal gutters */\n density?: DataTableDensity;\n /**\n * Column-sizing strategy:\n * - `fixed` — widths come only from `colgroup` hints (`width`/`minWidth`/\n * `maxWidth`); content is ignored and overflow is clipped. Table fills 100%.\n * - `auto` — columns size to content but the table still fills 100%, so any\n * leftover space is distributed into the columns (they stretch).\n * - `content` — columns size to their content's intrinsic width and the table\n * shrinks to fit. Leftover space stays empty to the right of the last\n * column; it scrolls horizontally only once content exceeds the container.\n */\n tableLayout?: \"auto\" | \"fixed\" | \"content\";\n theadClassName?: string;\n headerStyle?: DataTableHeaderStyle;\n /** With `density=\"compact\"`, use tighter cell gutters (`pl-1.5 pr-2.5` vs `px-3`). Footer keeps normal horizontal padding. */\n snug?: boolean;\n /** Per-row disclosure panel rendered beneath the row. See `DataTableExpandable`. */\n expandable?: DataTableExpandable<T>;\n}\n\n/**\n * The pagination union flattened into one shape the render can read without\n * re-narrowing at every use.\n *\n * `total` and `totalPages` stay optional on purpose: `undefined` is the honest\n * answer for a cursor API, and keeping it optional here is what stops the\n * footer from quietly falling back to a made-up count.\n */\nexport type NormalizedPager = {\n showFooter: boolean;\n /** Whether the table slices `data` itself (client mode only). */\n sliceLocally: boolean;\n page: number;\n pageSize: number;\n total?: number;\n totalPages?: number;\n hasNext?: boolean;\n hasPrev?: boolean;\n onNext?: () => void;\n onPrev?: () => void;\n summary: DataTableFooterSummary;\n countLabels: { singular: string; plural: string };\n leading?: ReactNode;\n pageSizeOptions?: readonly number[];\n onPageSizeChange?: (size: number) => void;\n};\n\nconst DEFAULT_COUNT_LABELS = { singular: \"item\", plural: \"items\" };\n\nexport function normalizePagination(\n pagination: DataTablePagination,\n rowsHeld: number,\n internalPage: number\n): NormalizedPager {\n if (pagination.mode === \"none\") {\n return {\n showFooter: false,\n sliceLocally: false,\n page: 1,\n // A footerless table shows every row it was given; guard against a\n // zero divisor for the range arithmetic that never renders.\n pageSize: rowsHeld || 1,\n summary: \"none\",\n countLabels: DEFAULT_COUNT_LABELS,\n };\n }\n\n const shared = {\n showFooter: true,\n summary: pagination.summary ?? \"range\",\n countLabels: pagination.countLabels ?? DEFAULT_COUNT_LABELS,\n leading: pagination.leading,\n pageSizeOptions: pagination.pageSizeOptions,\n onPageSizeChange: pagination.onPageSizeChange,\n };\n\n if (pagination.mode === \"client\") {\n const pageSize = pagination.pageSize ?? 10;\n return {\n ...shared,\n sliceLocally: true,\n page: internalPage,\n pageSize,\n total: rowsHeld,\n totalPages: Math.max(1, Math.ceil(rowsHeld / pageSize)),\n };\n }\n\n if (pagination.mode === \"page\") {\n return {\n ...shared,\n sliceLocally: false,\n page: pagination.page,\n pageSize: pagination.pageSize,\n total: pagination.total,\n totalPages: Math.max(1, Math.ceil(pagination.total / pagination.pageSize)),\n };\n }\n\n // Cursor: no total, therefore no `totalPages`. That absence is what the\n // footer keys off to switch to prev/current/next numbering.\n return {\n ...shared,\n sliceLocally: false,\n page: pagination.page,\n pageSize: pagination.pageSize,\n hasNext: pagination.hasNext,\n hasPrev: pagination.hasPrev ?? pagination.page > 1,\n onNext: pagination.onNext,\n onPrev: pagination.onPrev,\n };\n}\n\n/** The order a header moves to on its next activation. */\nfunction nextSortOrder(\n current: DataTableSortState,\n columnKey: string,\n directions: SortOrder[]\n): DataTableSortState {\n if (!current || current.columnKey !== columnKey) {\n return { columnKey, order: directions[0] };\n }\n const at = directions.indexOf(current.order);\n const next = directions[at + 1];\n // Past the end of the cycle is \"unsorted\" — a third click always gets the\n // user back to the order the data arrived in, which is otherwise unreachable.\n return next ? { columnKey, order: next } : null;\n}\n\n/**\n * The sort glyph.\n *\n * Unsorted is one `ChevronsUpDown` rather than two chevrons stacked by hand:\n * the pair had to be pulled together with a negative margin, which left them\n * mis-kerned and heavier than the header text beside them. A single glyph is\n * drawn as one shape on lucide's own grid, so it sits on the baseline properly\n * at any size.\n *\n * Sorted is an arrow, not a highlighted half of a pair. An arrow says which way\n * the rows are ordered on its own; a chevron pair with one half tinted asks the\n * reader to compare two shapes to find out.\n *\n * The unsorted glyph stays visible rather than appearing on hover, so a column\n * that *can* sort says so before it is pointed at — but at 40% it reads as an\n * affordance rather than as state.\n */\nfunction SortIndicator({ order }: { order: SortOrder | null }) {\n const Glyph = order === \"ascend\" ? ArrowUp : order === \"descend\" ? ArrowDown : ChevronsUpDown;\n return (\n <Glyph\n aria-hidden\n className={cn(\n \"ml-1.5 h-3 w-3 shrink-0\",\n order ? \"text-primary\" : \"text-muted-foreground/40\"\n )}\n />\n );\n}\n\n/**\n * `minmax(A, B)` → its two halves, tolerant of whichever whitespace someone\n * wrote it with. `null` for anything else, including a plain length like\n * `\"180px\"` — that already IS a valid `width` and passes through untouched.\n */\nfunction parseMinMaxWidth(width: string | undefined): { min: string; max: string } | null {\n if (!width) return null;\n const match = /^minmax\\(\\s*([^,]+?)\\s*,\\s*([^)]+?)\\s*\\)$/.exec(width.trim());\n return match ? { min: match[1], max: match[2] } : null;\n}\n\n/** `1fr`, `2fr`, … — a Grid flex unit, meaningless as a table `width`. */\nfunction isFlexUnit(value: string): boolean {\n return /^[\\d.]*fr$/.test(value.trim());\n}\n\n/**\n * A column's `width` as the three real CSS properties a `<col>` understands.\n *\n * Anything that is not a `minmax(...)` string passes through exactly as it did\n * before this existed, so a plain `\"48px\"` or `\"18%\"` column is untouched.\n */\nfunction colWidthStyle(col: Pick<Column<unknown>, \"width\" | \"minWidth\" | \"maxWidth\">): {\n width: string | number | undefined;\n minWidth: string | number | undefined;\n maxWidth: string | number | undefined;\n} {\n const parsed = parseMinMaxWidth(col.width);\n if (!parsed) {\n return {\n width: col.width ?? (col.minWidth != null ? `${col.minWidth}px` : undefined),\n minWidth: col.minWidth,\n maxWidth: col.maxWidth,\n };\n }\n return {\n width: isFlexUnit(parsed.max) ? undefined : parsed.max,\n // An explicit numeric `minWidth`/`maxWidth` alongside a `minmax()` string\n // is not a combination any caller uses today; the string wins because it\n // is the more specific of the two.\n minWidth: parsed.min,\n maxWidth: isFlexUnit(parsed.max) ? col.maxWidth : undefined,\n };\n}\n\nexport function DataTable<T>({\n columns,\n data,\n isLoading = false,\n skeletonRows = 6,\n emptyTitle = \"No data yet\",\n emptyDescription,\n pagination = { mode: \"client\" },\n sorting,\n className,\n rowKey,\n rowCta,\n rowAction,\n onRowClick,\n density = \"default\",\n tableLayout = \"fixed\",\n theadClassName,\n headerStyle = \"surface\",\n snug = false,\n expandable,\n}: DataTableProps<T>) {\n // ── Sorting ───────────────────────────────────────────────────────────────\n const [internalSort, setInternalSort] = useState<DataTableSortState>(null);\n const isSortControlled = sorting?.value !== undefined;\n const sortState = isSortControlled ? sorting!.value! : internalSort;\n\n const columnByKey = useMemo(() => new Map(columns.map((c) => [c.key, c])), [columns]);\n\n /**\n * Rows in sorted order. Only a **comparator** sorts here: `sorter: true`\n * means the caller has already ordered the rows (or asked the server to), so\n * re-sorting them locally would fight the response.\n */\n const sortedData = useMemo(() => {\n if (!sortState) return data;\n const sorter = columnByKey.get(sortState.columnKey)?.sorter;\n if (typeof sorter !== \"function\") return data;\n // Copy first: sorting the caller's array in place mutates their state.\n const out = data.slice().sort(sorter);\n return sortState.order === \"descend\" ? out.reverse() : out;\n }, [data, sortState, columnByKey]);\n\n // ── Pagination ────────────────────────────────────────────────────────────\n const [internalPage, setInternalPage] = useState(1);\n\n /**\n * The discriminated union collapsed into one flat shape, so the render below\n * reads the same regardless of mode and every `undefined` is a deliberate\n * \"nobody knows\" rather than a missing prop.\n */\n const pager = normalizePagination(pagination, sortedData.length, internalPage);\n\n /** Only client mode holds every row, so only client mode slices. */\n const paginated = pager.sliceLocally\n ? sortedData.slice((pager.page - 1) * pager.pageSize, pager.page * pager.pageSize)\n : sortedData;\n\n /** Zero-based offset of this page's first row, for the \"Showing x–y\" range. */\n const from = (pager.page - 1) * pager.pageSize;\n\n const setSort = (next: DataTableSortState) => {\n if (isSortControlled) sorting!.onChange?.(next);\n else {\n setInternalSort(next);\n sorting?.onChange?.(next);\n }\n // A re-sort makes the current page number meaningless — the rows under it\n // have all changed. Only client mode can act on that; controlled callers\n // decide for themselves, since they may be paging by cursor.\n if (pagination.mode === \"client\") setInternalPage(1);\n };\n\n const goToPage = (p: number) => {\n if (pagination.mode === \"page\") pagination.onPageChange(p);\n else if (pagination.mode === \"client\") setInternalPage(p);\n };\n\n // The right-pinned row action. `rowAction` takes precedence over `rowCta`.\n // It is NOT a real column: it renders as a per-row overlay floating at the\n // right edge of the viewport (sticky), so the last data column stays flush\n // and there's no reserved/empty trailing column when scrolled to the end.\n const hasAction = rowAction != null || rowCta != null;\n\n // `content` layout: a greedy, empty trailing column that absorbs leftover\n // horizontal space so the data columns stay at their content (minimum)\n // width while the table still spans the full container width.\n const hasSpacer = tableLayout === \"content\";\n\n // Row expansion. Uncontrolled by default; `expandedKeys` hands control to the\n // caller, which is what a row whose panel fetches its own data needs.\n // `onExpand` fires only on open, in both modes.\n const [internalExpanded, setInternalExpanded] = useState<string[]>([]);\n const isExpandControlled = expandable?.expandedKeys !== undefined;\n const expandedKeys = isExpandControlled ? expandable!.expandedKeys! : internalExpanded;\n const hasExpand = expandable != null;\n /** Every column the expansion panel has to span. */\n const totalColSpan =\n columns.length + (hasExpand ? 1 : 0) + (hasSpacer ? 1 : 0) + (hasAction ? 1 : 0);\n\n /** Whether this row is open — drives both its own styling and the panel. */\n const rowExpanded = (row: T, index: number) =>\n hasExpand &&\n (expandable!.isExpandable?.(row, index) ?? true) &&\n expandedKeys.includes(rowKeys[index]);\n\n const toggleExpanded = (key: string, row: T, index: number) => {\n const isOpen = expandedKeys.includes(key);\n const next = isOpen ? expandedKeys.filter((k) => k !== key) : [...expandedKeys, key];\n if (isExpandControlled) expandable!.onExpandedChange?.(next);\n else setInternalExpanded(next);\n if (!isOpen) expandable!.onExpand?.(row, index);\n };\n\n // Guard against duplicate / non-unique rowKey() results. React silently fails\n // to unmount old <tr> nodes when sibling keys collide, leaving stale rows\n // rendered on top of new data (or the empty state). De-dupe by suffixing\n // repeats so every rendered row gets a unique, stable key.\n const seenKeys = new Map<string, number>();\n const rowKeys = paginated.map((row) => {\n const base = rowKey(row);\n const seen = seenKeys.get(base) ?? 0;\n seenKeys.set(base, seen + 1);\n return seen === 0 ? base : `${base}__${seen}`;\n });\n\n /**\n * No rows to show. The width hints are dropped in this state: a grid whose\n * columns carry minimums (via `colgroup` in fixed layout, or `cellClassName`\n * in the others) would otherwise have its HEADER row alone force the table\n * past the container and raise a horizontal scrollbar — over an empty region\n * with nothing to scroll to. Headers still render, at their natural width, so\n * the shape of the missing data is still legible.\n */\n const isEmpty = !isLoading && paginated.length === 0;\n\n const comfortable = density === \"comfortable\";\n const compact = density === \"compact\";\n const compactCellPad = compact\n ? snug\n ? \"pl-1.5 pr-2.5 py-2.5\"\n : \"px-3 py-2.5\"\n : \"px-4 py-3.5\";\n const cellPad = comfortable ? \"px-5 py-4\" : compactCellPad;\n const headPad = comfortable ? \"px-5 py-4\" : compactCellPad;\n /** Footer is outside the grid; do not reuse snug cell `pl-0`-style gutters here. */\n const footerPad = comfortable\n ? \"px-5 py-4\"\n : compact\n ? \"px-4 py-2.5\"\n : \"px-4 py-3.5\";\n const headText = comfortable\n ? \"text-[12px] font-medium text-muted-foreground tracking-normal\"\n : compact\n ? \"text-[11px] font-semibold text-muted-foreground\"\n : \"text-[11px] font-semibold text-foreground/75 dark:text-foreground/85\";\n /**\n * Expansion geometry, in px, derived from the same padding the cells use:\n *\n * - `expandIndent` lines the panel's content up with the first DATA column\n * (past the 40px disclosure column), so the detail reads as hanging off the\n * row rather than starting outside it.\n * - `expandGuideLeft` is the centre of the chevron, where the vertical\n * connector runs — the cue that the panel belongs to the row above.\n *\n * Both live here rather than in each consumer's panel: a hardcoded indent in\n * a feature silently drifts the moment this padding or the column width\n * changes.\n */\n const cellPadLeft = comfortable ? 20 : compact ? (snug ? 6 : 12) : 16;\n const expandIndent = 40 + cellPadLeft;\n const expandGuideLeft = cellPadLeft + 10;\n\n // Action overlay geometry: the action floats this many px in from the right\n // edge of the viewport (it has no reserved column — it overlays the row).\n const actionGutter = comfortable ? 20 : compact ? 12 : 16;\n\n /**\n * Selector for everything a row-level click must keep its hands off. A click\n * landing inside one of these belongs to that control alone — a copy button,\n * a per-row menu, a link, a checkbox, the `rowAction` overlay — so the row\n * handler ignores it rather than firing as well.\n *\n * `data-row-click-ignore` is the escape hatch for anything not covered here\n * (a custom widget in a cell, a drag handle) without it needing to stop\n * propagation itself.\n */\n const ROW_CLICK_IGNORE =\n 'button, a, input, select, textarea, label, [role=\"button\"], [role=\"link\"], ' +\n '[role=\"checkbox\"], [role=\"menuitem\"], [role=\"menu\"], [role=\"dialog\"], ' +\n \"[data-row-click-ignore]\";\n\n /**\n * Horizontal scroll position, so a frozen column can show a shadow only when\n * there is actually something scrolled underneath it.\n *\n * A shadow that is always on is just a heavier border: it says \"pinned\" when\n * nothing is hidden, and then says nothing new at the moment it matters. The\n * point of the shadow is to mark the edge that content is passing beneath.\n */\n const scrollRef = useRef<HTMLDivElement | null>(null);\n const [edge, setEdge] = useState({ start: false, end: false });\n\n const syncEdges = useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n const max = el.scrollWidth - el.clientWidth;\n setEdge({\n start: el.scrollLeft > 1,\n // 1px of slack: sub-pixel widths mean scrollLeft rarely reaches `max`\n // exactly, which would leave the end shadow stuck on at full scroll.\n end: max > 1 && el.scrollLeft < max - 1,\n });\n }, []);\n\n /**\n * Measured after layout rather than during render — it reads `scrollWidth`,\n * which render cannot know. Re-run when the column or row count changes,\n * since either changes whether the table overflows at all.\n */\n useEffect(() => {\n const raf = requestAnimationFrame(syncEdges);\n window.addEventListener(\"resize\", syncEdges);\n return () => {\n cancelAnimationFrame(raf);\n window.removeEventListener(\"resize\", syncEdges);\n };\n }, [syncEdges, columns.length, paginated.length]);\n\n /** Whether a click/keypress inside a row should reach `onRowClick`. */\n const isRowClickTarget = (target: EventTarget | null, rowEl: HTMLElement) => {\n if (!(target instanceof Element)) return false;\n // A React portal re-dispatches its clicks through the React tree, not the\n // DOM tree, so a row's overflow menu — rendered into document.body — still\n // arrives at this row's onClick. The target is not a DOM descendant of the\n // row, and that is exactly what says the click belonged to the menu rather\n // than to the row. Without this, choosing \"Edit\" from a row menu also fired\n // the row's own action, opening the edit dialog and the preview at once.\n if (!rowEl.contains(target)) return false;\n\n // Within the row, a click on a control belongs to that control. `closest`\n // can still walk above the row, so the match has to be inside it.\n const interactive = target.closest(ROW_CLICK_IGNORE);\n return !(interactive && rowEl.contains(interactive));\n };\n\n return (\n <div\n className={cn(\n \"bg-card text-card-foreground rounded-xl overflow-hidden border border-border\",\n className\n )}\n >\n {/* scrollbar space always reserved; thumb subtle on hover */}\n <div\n ref={scrollRef}\n onScroll={syncEdges}\n // Read by `frozenColumn`'s shadow through `group-data-[…]/table-scroll`.\n data-scrolled-start={edge.start ? \"true\" : \"false\"}\n data-scrolled-end={edge.end ? \"true\" : \"false\"}\n className={cn(\n \"group/table-scroll overflow-x-auto\",\n \"[&::-webkit-scrollbar]:h-[4px] [&::-webkit-scrollbar-track]:bg-transparent\",\n \"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent\",\n \"hover:[&::-webkit-scrollbar-thumb]:bg-border dark:hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/35\"\n )}\n style={{ scrollbarWidth: \"thin\", scrollbarColor: \"var(--border) transparent\" }}\n >\n <table\n className={cn(tableLayout === \"auto\" && \"min-w-[920px]\")}\n style={{\n // `content` uses the automatic algorithm but stays 100% wide; a\n // greedy spacer column (below) soaks up the slack so the data\n // columns collapse to their content width while the table fills.\n tableLayout: tableLayout === \"fixed\" ? \"fixed\" : \"auto\",\n width: \"100%\",\n }}\n >\n {tableLayout === \"fixed\" && !isEmpty && (\n <colgroup>\n {hasExpand ? <col style={{ width: 40 }} /> : null}\n {columns.map((col) => (\n <col key={col.key} style={colWidthStyle(col)} />\n ))}\n {/* Zero-width column: the action floats out of it as an overlay,\n so the last data column stays flush and nothing trails it. */}\n {hasAction ? <col style={{ width: 0 }} /> : null}\n </colgroup>\n )}\n\n <thead\n className={cn(\n headerStyle === \"surface\" && \"bg-muted/35\",\n headerStyle === \"minimal\" && \"bg-transparent\",\n theadClassName\n )}\n >\n <tr\n className={cn(\n \"border-b\",\n headerStyle === \"surface\" ? \"border-border\" : \"border-border/70\"\n )}\n >\n {hasExpand ? <th className={cn(headPad, \"w-10 p-0\")} aria-hidden /> : null}\n {columns.map((col) => {\n const sortable = col.sorter != null && col.sorter !== false;\n const activeOrder =\n sortState?.columnKey === col.key ? sortState.order : null;\n const align =\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\";\n return (\n <th\n key={col.key}\n style={col.cellStyle}\n // Announced to assistive tech as the sort state of the\n // column, which the caret pair alone does not convey.\n aria-sort={\n !sortable\n ? undefined\n : activeOrder === \"ascend\"\n ? \"ascending\"\n : activeOrder === \"descend\"\n ? \"descending\"\n : \"none\"\n }\n className={cn(\n headPad,\n headText,\n \"whitespace-nowrap align-middle\",\n align,\n // Width hints live in `cellClassName`; see `isEmpty`.\n !isEmpty && col.cellClassName\n )}\n >\n {sortable ? (\n <button\n type=\"button\"\n onClick={() =>\n setSort(\n nextSortOrder(\n sortState,\n col.key,\n col.sortDirections ?? [\"ascend\", \"descend\"]\n )\n )\n }\n className={cn(\n // Inherits the header's own type styling rather than\n // restating it, so a sortable header is visually\n // identical to a plain one apart from the glyph.\n //\n // Deliberately NOT truncating: a plain header does\n // not, so a sortable one that did would ellipsise\n // names the column beside it shows in full.\n // A bare <button>, so Preflight's `font: inherit`\n // already hands it the header's own type. The\n // `text-[inherit]` that used to be here did nothing\n // for size — Tailwind reads `text-[<non-length>]` as\n // a colour — and only looked like it worked because\n // nothing here sets a competing font-size.\n \"-mx-1 inline-flex items-center whitespace-nowrap rounded px-1 py-0.5 transition-colors\",\n \"hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n activeOrder && \"text-foreground\",\n // The glyph follows the text, so on a right-aligned\n // column it has to lead instead — otherwise it sits\n // between the label and the numbers it describes.\n col.align === \"right\" && \"flex-row-reverse [&>svg]:ml-0 [&>svg]:mr-1.5\"\n )}\n >\n {col.header}\n <SortIndicator order={activeOrder} />\n </button>\n ) : (\n col.header\n )}\n </th>\n );\n })}\n {hasSpacer ? <th className=\"w-full p-0\" aria-hidden /> : null}\n {hasAction ? (\n <th className=\"sticky right-0 z-[1] w-0 p-0\" aria-hidden />\n ) : null}\n </tr>\n </thead>\n\n <tbody>\n {isLoading ? (\n // The placeholder row mirrors the real row's cells exactly: one\n // per column, carrying that column's own width, alignment and\n // sticky classes, plus the same expand / spacer / action cells.\n //\n // It used to be a generic `TableRowSkeleton` with a cell count\n // and nothing else. With `tableLayout=\"content\"` the real row\n // also carries a greedy spacer cell, so the skeleton was one cell\n // short: the last shimmer stretched across the spacer's slot and\n // the placeholder columns stopped lining up with the headers\n // above them — which reads as a column missing while loading.\n Array.from({ length: skeletonRows }).map((_, r) => (\n <tr\n key={r}\n className={cn(\n \"border-b border-border/60\",\n comfortable && \"min-h-[56px]\",\n compact && \"min-h-[44px]\"\n )}\n >\n {hasExpand ? <td className={cn(cellPad, \"w-10\")} /> : null}\n {columns.map((col, c) => (\n <td\n key={col.key}\n style={col.cellStyle}\n className={cn(\n cellPad,\n \"align-middle overflow-hidden\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n col.cellClassName\n )}\n >\n {/* Varied widths so the block reads as rows of data\n rather than a striped grid. Inline-block so the\n column's own alignment still places it. */}\n <Shimmer\n className={cn(\n \"inline-block h-3.5 max-w-full\",\n c === 0 ? \"w-20\" : c === columns.length - 1 ? \"w-14\" : \"w-28\"\n )}\n />\n </td>\n ))}\n {hasSpacer ? <td className=\"p-0\" aria-hidden /> : null}\n {hasAction ? (\n <td className=\"sticky right-0 z-[1] w-0 p-0\" aria-hidden />\n ) : null}\n </tr>\n ))\n ) : paginated.length === 0 ? (\n <tr>\n <td colSpan={totalColSpan}>\n <EmptyState title={emptyTitle} description={emptyDescription} />\n </td>\n </tr>\n ) : (\n paginated.flatMap((row, i) => [\n <tr\n key={rowKeys[i]}\n className={cn(\n \"group transition-colors duration-150 border-b border-border/60 last:border-b-0\",\n comfortable && \"min-h-[56px]\",\n compact && \"min-h-[44px]\",\n \"hover:bg-muted/40 dark:hover:bg-muted/25\",\n hasAction &&\n \"hover:shadow-[0_1px_0_rgba(0,0,0,0.04)] dark:hover:shadow-none\",\n // Clickable rows read as clickable, and show a focus ring\n // when reached by keyboard. `focus-visible` only, so a\n // mouse click does not leave a ring behind on the row.\n onRowClick &&\n \"cursor-pointer focus-visible:outline-none focus-visible:bg-muted/40 dark:focus-visible:bg-muted/25\",\n // An open row takes its panel's background and drops the\n // divider beneath it, so the row and its detail read as one\n // block. Hover is pinned to the same value, or moving the\n // mouse over an open row would make it flicker away from\n // the panel it belongs to.\n rowExpanded(row, i) &&\n \"border-b-0 bg-muted/40 hover:bg-muted/40 dark:bg-muted/25 dark:hover:bg-muted/25\"\n )}\n // Keyboard parity with the mouse: the row is reachable by\n // Tab and activated by Enter / Space, which a bare <tr> with\n // an onClick would not be. No role override — the row stays a\n // row for assistive tech rather than claiming to be a button.\n tabIndex={onRowClick ? 0 : undefined}\n onClick={\n onRowClick\n ? (e) => {\n if (!isRowClickTarget(e.target, e.currentTarget)) return;\n onRowClick(row, i);\n }\n : undefined\n }\n onKeyDown={\n onRowClick\n ? (e) => {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n // Only the row's own focus activates it; a keypress\n // inside a control in the row belongs to that control.\n if (e.target !== e.currentTarget) return;\n // Space scrolls the page by default.\n e.preventDefault();\n onRowClick(row, i);\n }\n : undefined\n }\n >\n {hasExpand ? (\n <td className={cn(cellPad, \"w-10 align-middle\")}>\n {(expandable!.isExpandable?.(row, i) ?? true) ? (\n <button\n type=\"button\"\n aria-expanded={rowExpanded(row, i)}\n aria-label={expandable!.toggleLabel ?? \"Toggle row details\"}\n onClick={() => toggleExpanded(rowKeys[i], row, i)}\n className=\"inline-flex h-5 w-5 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <ChevronDown\n className={cn(\n \"h-3.5 w-3.5 transition-transform duration-150\",\n rowExpanded(row, i) && \"rotate-180\"\n )}\n />\n </button>\n ) : null}\n </td>\n ) : null}\n {columns.map((col) => (\n <td\n key={col.key}\n style={col.cellStyle}\n className={cn(\n cellPad,\n \"align-middle\",\n comfortable\n ? cn(\n \"text-[13px] leading-snug\",\n !col.wrap && \"whitespace-nowrap\"\n )\n : compact\n ? cn(\n \"text-[13px] leading-tight\",\n !col.wrap && \"whitespace-nowrap\",\n \"overflow-hidden\"\n )\n : \"whitespace-nowrap overflow-hidden\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n col.cellClassName\n )}\n >\n {col.render(row, i)}\n </td>\n ))}\n\n {hasSpacer ? <td className=\"p-0\" aria-hidden /> : null}\n\n {hasAction ? (\n // Zero-width sticky cell pinned to the right edge of the\n // viewport. Its children are positioned absolutely so they\n // float over the row (out of the 0-width cell) — the action\n // stays in view while scrolling and nothing trails the last\n // data column. Everything is revealed on hover only.\n <td className=\"sticky right-0 z-[1] w-0 p-0 align-middle\">\n {/* The action itself — `rowAction(row, i)` so it always\n receives this row's record. Vertically centered in the\n row and anchored `actionGutter`px from the right edge,\n overflowing left over the row content. Revealed on hover. */}\n <span\n className=\"absolute top-1/2 -translate-y-1/2 z-[1] inline-flex items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100\"\n style={{ right: actionGutter }}\n >\n {rowAction != null ? (\n typeof rowAction === \"function\" ? (\n rowAction(row, i)\n ) : (\n rowAction\n )\n ) : (\n <button\n type=\"button\"\n onClick={() => rowCta?.onClick?.(row)}\n className={cn(\n \"inline-flex items-center font-medium text-foreground bg-card rounded-lg border border-border hover:border-muted-foreground/50 whitespace-nowrap\",\n elevation.control,\n compact\n ? \"px-2.5 py-1 text-[11px]\"\n : \"px-3 py-1.5 text-[12px]\"\n )}\n >\n {rowCta?.label}\n </button>\n )}\n </span>\n </td>\n ) : null}\n </tr>,\n\n // The panel spans every column, including the toggle, spacer and\n // action cells, so it reads as one band under its row rather\n // than as a cell inside the grid.\n rowExpanded(row, i) ? (\n <tr\n key={`${rowKeys[i]}__panel`}\n className=\"border-b border-border/60 bg-muted/40 last:border-b-0 dark:bg-muted/25\"\n >\n <td colSpan={totalColSpan} className=\"p-0 align-top\">\n <div\n className=\"relative\"\n style={{ paddingLeft: expandIndent, paddingRight: cellPadLeft }}\n >\n {/* Connector: a hairline dropping from the chevron down\n the panel. The row and its detail share a background\n so they read as one block, which on its own leaves\n nothing to say the lower half is derived rather than\n more row content — this is that cue. Stops short of\n the bottom so it reads as hanging, not as a border. */}\n <span\n aria-hidden\n className=\"absolute top-0 bottom-4 w-px bg-border\"\n style={{ left: expandGuideLeft }}\n />\n {expandable!.render(row, i)}\n </div>\n </td>\n </tr>\n ) : null,\n ])\n )}\n </tbody>\n </table>\n </div>\n\n {pager.showFooter && !isLoading && paginated.length > 0 && (\n <DataTableFooter\n pad={footerPad}\n summary={pager.summary}\n countLabels={pager.countLabels}\n leading={pager.leading}\n pageSizeOptions={pager.pageSizeOptions}\n pageSize={pager.pageSize}\n onPageSizeChange={pager.onPageSizeChange}\n from={from}\n rowCount={paginated.length}\n total={pager.total}\n page={pager.page}\n totalPages={pager.totalPages}\n hasNext={pager.hasNext}\n hasPrev={pager.hasPrev}\n onNext={pager.onNext}\n onPrev={pager.onPrev}\n onPageChange={goToPage}\n />\n )}\n </div>\n );\n}\n\n// ── Footer ───────────────────────────────────────────────────────────────────\n\nconst PAGE_BUTTON =\n \"w-7 h-7 rounded-md flex items-center justify-center text-[12px] font-medium tabular-nums transition-colors\";\nconst PAGE_BUTTON_IDLE =\n \"text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed\";\nconst PAGE_BUTTON_ACTIVE = `bg-primary text-primary-foreground ${elevation.control}`;\n\n/**\n * One footer for every pagination mode, so a cursor-paged grid and a\n * page-paged one are indistinguishable apart from the two things that\n * genuinely differ: the total, and how many page numbers can honestly be\n * offered.\n *\n * `totalPages` being `undefined` is what marks cursor mode — it means \"nobody\n * knows\", and the footer answers by numbering only the pages a cursor can\n * actually reach in one step (previous, current, next).\n */\nfunction DataTableFooter({\n pad,\n summary,\n countLabels,\n leading,\n pageSizeOptions,\n pageSize,\n onPageSizeChange,\n from,\n rowCount,\n total,\n page,\n totalPages,\n hasNext,\n hasPrev,\n onNext,\n onPrev,\n onPageChange,\n}: {\n pad: string;\n summary: DataTableFooterSummary;\n countLabels: { singular: string; plural: string };\n leading?: ReactNode;\n pageSizeOptions?: readonly number[];\n pageSize: number;\n onPageSizeChange?: (size: number) => void;\n from: number;\n rowCount: number;\n total?: number;\n page: number;\n totalPages?: number;\n hasNext?: boolean;\n hasPrev?: boolean;\n onNext?: () => void;\n onPrev?: () => void;\n onPageChange: (page: number) => void;\n}) {\n const isCursor = totalPages === undefined;\n /** 0 in cursor mode, where it is never read. */\n const pageCount = totalPages ?? 0;\n /**\n * A pager with nowhere to go is noise. In `page` mode that is a single page;\n * in `cursor` mode it is a page with nothing before or after it, which is the\n * closest thing to a page count a cursor response gives us.\n */\n const showPager = isCursor ? !!hasPrev || !!hasNext : pageCount > 1;\n const showRowsPerPage = !!pageSizeOptions?.length && !!onPageSizeChange;\n\n const start = from + 1;\n const end = total !== undefined ? Math.min(from + pageSize, total) : from + rowCount;\n\n /**\n * Which page numbers to draw.\n *\n * With a total, the full strip with ellipses — any page is one click away.\n * Without one, only `page - 1`, `page`, and `page + 1`: those are the pages\n * a cursor can step to, and a number the user cannot actually reach is worse\n * than no number at all. `page + 1` appears only when `hasNext` says there is\n * something there, so the strip itself is the signal that more data exists.\n */\n const pages: (number | \"…\")[] = isCursor\n ? [...(hasPrev ? [page - 1] : []), page, ...(hasNext ? [page + 1] : [])]\n : getPageRange(page, pageCount);\n\n const goPrev = () => (isCursor ? onPrev?.() : onPageChange(Math.max(1, page - 1)));\n const goNext = () => (isCursor ? onNext?.() : onPageChange(Math.min(pageCount, page + 1)));\n\n /**\n * With a total, the arrows are always drawn and go disabled at the ends — the\n * strip has a known width, so nothing moves. Without one, they are drawn only\n * when the page they point at is known to exist: a cursor response says\n * whether there is a next page, and an arrow that is permanently disabled\n * says less than no arrow at all.\n */\n const showPrev = isCursor ? !!hasPrev : true;\n const showNext = isCursor ? !!hasNext : true;\n const prevDisabled = isCursor ? false : page === 1;\n const nextDisabled = isCursor ? false : page === pageCount;\n\n /** In cursor mode a number is only ever one step away, so it maps to a step. */\n const goToNumber = (p: number) => {\n if (!isCursor) return onPageChange(p);\n if (p === page - 1) onPrev?.();\n else if (p === page + 1) onNext?.();\n };\n\n return (\n <div\n className={cn(\n \"flex items-center gap-4 flex-wrap border-t border-border\",\n pad,\n summary === \"none\" && !showRowsPerPage && !leading ? \"justify-end\" : \"justify-between\"\n )}\n >\n {/* The rows-per-page picker and the summary group together on the left\n rather than becoming a third item that justify-between flings to its\n own corner. */}\n <div className=\"flex items-center gap-3\">\n {leading}\n\n {showRowsPerPage ? (\n <div className=\"flex items-center gap-2 text-[12px] text-muted-foreground\">\n <span>Rows per page</span>\n <Select\n value={String(pageSize)}\n onValueChange={(v) => onPageSizeChange!(Number(v))}\n >\n <SelectTrigger size=\"sm\" aria-label=\"Rows per page\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizeOptions!.map((n) => (\n <SelectItem key={n} value={String(n)}>\n {n}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n ) : null}\n\n {summary === \"count\" && total !== undefined ? (\n <span className=\"text-[12px] text-muted-foreground tabular-nums\">\n <span className=\"font-medium text-foreground\">{total.toLocaleString()}</span>{\" \"}\n {total === 1 ? countLabels.singular : countLabels.plural}\n </span>\n ) : summary === \"range\" ? (\n <span className=\"text-[12px] text-muted-foreground tabular-nums\">\n Showing{\" \"}\n <span className=\"text-foreground font-medium\">\n {Math.min(start, total ?? start)}–{end}\n </span>\n {/* No total, no \"of N\" and no results noun — cursor responses do not\n carry a count, and inventing one would be a lie the user would\n page against. */}\n {total !== undefined ? (\n <>\n {\" \"}\n of{\" \"}\n <span className=\"text-foreground font-medium\">{total.toLocaleString()}</span>{\" \"}\n {total !== 1 ? \"results\" : \"result\"}\n </>\n ) : null}\n </span>\n ) : null}\n </div>\n\n {showPager && (\n <div className=\"flex items-center gap-1\">\n {showPrev ? (\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n onClick={goPrev}\n disabled={prevDisabled}\n className={cn(PAGE_BUTTON, PAGE_BUTTON_IDLE)}\n >\n <ChevronLeft className=\"w-3.5 h-3.5\" />\n </button>\n ) : null}\n\n {pages.map((p, idx) =>\n p === \"…\" ? (\n <span\n key={`ellipsis-${idx}`}\n className=\"w-7 h-7 flex items-center justify-center text-[12px] text-muted-foreground select-none\"\n >\n …\n </span>\n ) : (\n <button\n key={p}\n type=\"button\"\n aria-current={p === page ? \"page\" : undefined}\n onClick={() => goToNumber(p)}\n className={cn(PAGE_BUTTON, p === page ? PAGE_BUTTON_ACTIVE : PAGE_BUTTON_IDLE)}\n >\n {p}\n </button>\n )\n )}\n\n {showNext ? (\n <button\n type=\"button\"\n aria-label=\"Next page\"\n onClick={goNext}\n disabled={nextDisabled}\n className={cn(PAGE_BUTTON, PAGE_BUTTON_IDLE)}\n >\n <ChevronRight className=\"w-3.5 h-3.5\" />\n </button>\n ) : null}\n </div>\n )}\n </div>\n );\n}\n\n// ── Frozen columns ───────────────────────────────────────────────────────────\n\n/**\n * The classes and offset for a column frozen to the left edge, so a grid that\n * pins its identifier columns does not have to reinvent the recipe. Five\n * feature files in the internal console had five copies of it, all carrying the\n * same two faults below.\n *\n * Spread the result onto the column:\n *\n * ```tsx\n * let left = 0;\n * columns.map((col) => {\n * if (!FROZEN.includes(col.key)) return col;\n * const frozen = { ...col, ...frozenColumn({ left, isLast: col.key === lastFrozen }) };\n * left += widthOf(col);\n * return frozen;\n * });\n * ```\n *\n * Two things it gets right that a hand-rolled version tends not to:\n *\n * **The background is opaque and is the table's own.** It has to be opaque or\n * the rows scrolling underneath show through the pinned block. It should not be\n * a tint, because a tint at full strength next to a row that highlights at 40%\n * makes the frozen block the heaviest thing on screen — the divider and the\n * shadow are what say \"pinned\", and the shadow is the honest signal anyway,\n * since it is what reads as content passing underneath.\n *\n * **It follows the row's hover.** The frozen cells are part of the row; pinning\n * them to a fixed colour makes a hovered row highlight in two different shades\n * and read as two rows. The hover colour is mixed rather than given an alpha,\n * for the same opacity reason.\n */\nexport function frozenColumn({\n left,\n right,\n isLast = false,\n}: {\n /** Offset from the left edge in px — the widths of the frozen columns before this one. */\n left?: number;\n /** Offset from the right edge in px, for a column pinned to that side instead. */\n right?: number;\n /** The column at the boundary, which carries the divider and the shadow. */\n isLast?: boolean;\n}): Pick<Column<unknown>, \"cellClassName\" | \"cellStyle\"> {\n // Pinned right is the trailing actions column; pinned left is the identifier\n // block. The divider and shadow face the scrolling content either way.\n const toRight = right !== undefined;\n\n /**\n * The divider and the shadow are pseudo-elements, NOT `border-r` and\n * `box-shadow`.\n *\n * That is not a style preference. Tailwind's Preflight sets\n * `border-collapse: collapse` on every table, and in the collapsed model a\n * cell's border belongs to the **table**, not the cell — so it is painted in\n * the table's layer and does not travel with a sticky cell. The border sits\n * still while the frozen column slides over the scrolling content, which\n * looks exactly like the divider vanishing the moment you scroll. A\n * `box-shadow` on the cell fails the same way.\n *\n * A pseudo-element paints inside the cell's own box, so it moves with it.\n * Both are anchored *inside* the cell's edge rather than hanging off it,\n * because the cell carries `overflow-hidden` at compact density and anything\n * outside would be clipped.\n *\n * That placement is why the gradient is kept deliberately slight — 4px at 7%,\n * barely a hairline of depth beside the divider. Sitting inside the cell, it\n * tints the pinned column itself rather than falling on the content passing\n * beneath, so anything heavier stops reading as a shadow and starts reading\n * as a smudge down the edge of the column. Dark mode carries more (35%)\n * because the same tint over a dark surface is close to invisible.\n */\n /**\n * Both branches are written out as complete literal class strings. Tailwind\n * scans source text for class names, so a name assembled at runtime —\n * `` `after:${edge}` `` — generates no CSS whatsoever. The duplication is the\n * price of the utilities existing at all.\n */\n const boundary = toRight\n ? [\n \"after:pointer-events-none after:absolute after:inset-y-0 after:left-0 after:w-px after:bg-border\",\n \"before:pointer-events-none before:absolute before:inset-y-0 before:left-0 before:w-1\",\n \"before:opacity-0 before:transition-opacity before:duration-200\",\n \"before:bg-[linear-gradient(to_right,rgb(0_0_0/0.07),transparent)]\",\n \"dark:before:bg-[linear-gradient(to_right,rgb(0_0_0/0.35),transparent)]\",\n \"group-data-[scrolled-end=true]/table-scroll:before:opacity-100\",\n ]\n : [\n \"after:pointer-events-none after:absolute after:inset-y-0 after:right-0 after:w-px after:bg-border\",\n \"before:pointer-events-none before:absolute before:inset-y-0 before:right-0 before:w-1\",\n \"before:opacity-0 before:transition-opacity before:duration-200\",\n \"before:bg-[linear-gradient(to_left,rgb(0_0_0/0.07),transparent)]\",\n \"dark:before:bg-[linear-gradient(to_left,rgb(0_0_0/0.35),transparent)]\",\n \"group-data-[scrolled-start=true]/table-scroll:before:opacity-100\",\n ];\n\n return {\n cellStyle: toRight ? { right } : { left: left ?? 0 },\n cellClassName: cn(\n \"sticky z-10 bg-card\",\n // Follow the row's own hover rather than sitting at a fixed tint: the\n // frozen cells are part of the row, and a row that highlights in two\n // shades reads as two rows. Mixed to an opaque colour, never an alpha —\n // a translucent pinned cell lets the rows scrolling beneath show through.\n \"group-hover:bg-[color-mix(in_oklab,var(--muted)_40%,var(--card))]\",\n \"dark:group-hover:bg-[color-mix(in_oklab,var(--muted)_25%,var(--card))]\",\n isLast && boundary\n ),\n };\n}\n","\"use client\";\n\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { DataTable } from \"./data-table\";\nimport type {\n Column,\n DataTableDensity,\n DataTableExpandable,\n DataTablePagination,\n DataTableSorting,\n} from \"./data-table\";\nimport { cn } from \"./utils\";\n\n/**\n * The canonical table surface: one bordered card holding a title, tabs, a\n * filter toolbar, the grid, and a footer — in that order, with the same\n * dividers and gutters every time.\n *\n * `DataTable` on its own is the grid. This is everything around it, and it\n * exists because that surrounding chrome is where tables actually drift: one\n * feature puts its filters above the card, another inside it; one draws a\n * divider under the tabs, another does not; one pads the toolbar `py-3` and the\n * next `py-2.5`. None of that is a decision a feature should be making.\n *\n * Pagination goes through `pagination`, in every mode — including cursor APIs\n * that carry no row total. The `footer` slot is for a footer that is genuinely\n * not a pager; passing one hides the table's own.\n */\nexport interface DataTableCardProps<T> {\n columns: Column<T>[];\n data: T[];\n rowKey: (row: T) => string;\n isLoading?: boolean;\n /**\n * Section title. For a grid that names itself — an analytics section like\n * \"Top 10 Merchants by Volume\" — rather than a page-level grid, whose name is\n * the page header. Renders above `tabs`.\n */\n title?: string;\n /** One line under the title. Only meaningful with `title`. */\n description?: string;\n /** Controls on the title row, flush right (a period toggle, Refresh, …). */\n actions?: ReactNode;\n /** Tab bar near the top of the card, above the toolbar. */\n tabs?: ReactNode;\n /** Filters / search / action buttons, as a row inside the card top. */\n toolbar?: ReactNode;\n /**\n * A non-pager footer inside the card bottom. Hides the table's own footer, so\n * do NOT use it for pagination — that is what `pagination` is for, in every\n * mode. Hand-rolling a pager here is how two different pagers end up in one\n * app.\n */\n footer?: ReactNode;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * Replaces the grid when there are no rows — an illustrated placeholder,\n * typically.\n *\n * `emptyTitle` / `emptyDescription` give the table's own text-only empty\n * state, which keeps the column headers and is right for \"nothing matched\n * your filters\". This is for the first-run case, where there is no data yet\n * because none has ever existed, and a drawn state says that better than a\n * header row over nothing.\n */\n emptyState?: ReactNode;\n /**\n * Replaces the rows entirely when the request failed.\n *\n * Distinct from an empty result with error-worded copy: that keeps the\n * column headers, which is right for \"nothing matched\" and wrong for \"we\n * could not load this\" — headers imply data was fetched and found empty.\n */\n errorState?: ReactNode;\n /** See {@link DataTablePagination}. Omit for client-side paging at 10/page. */\n pagination?: DataTablePagination;\n /** See {@link DataTableSorting}. */\n sorting?: DataTableSorting;\n rowAction?: ReactNode | ((row: T, index: number) => ReactNode);\n /**\n * Makes the whole row a click target, for a grid that drills into a detail\n * view. Passed straight through, so it brings the keyboard affordances with\n * it and does not fire for clicks landing on a button, link or form control\n * inside a cell.\n */\n onRowClick?: (row: T, index: number) => void;\n /** Defaults to \"content\"; pass \"fixed\" for grids with frozen sticky columns. */\n tableLayout?: \"auto\" | \"fixed\" | \"content\";\n /** Per-row disclosure panel rendered beneath the row. */\n expandable?: DataTableExpandable<T>;\n /** Row rhythm. Defaults to `compact`, which is what a data-dense grid wants. */\n density?: DataTableDensity;\n skeletonRows?: number;\n /**\n * CSS max-height for the internally scrolling body, so the toolbar and footer\n * stay put while the rows scroll and the page itself does not grow.\n *\n * The default assumes a page header plus this card's toolbar; a card that\n * also carries a `tabs` row needs a smaller cap, or the page starts scrolling\n * as well. Pass `\"none\"` to let the card grow with its content instead.\n */\n maxBodyHeight?: string;\n className?: string;\n}\n\nexport function DataTableCard<T>({\n columns,\n data,\n rowKey,\n isLoading,\n title,\n description,\n actions,\n tabs,\n toolbar,\n footer,\n emptyTitle,\n emptyDescription,\n emptyState,\n errorState,\n pagination,\n sorting,\n rowAction,\n onRowClick,\n tableLayout = \"content\",\n expandable,\n density = \"compact\",\n skeletonRows = 8,\n maxBodyHeight = \"calc(100vh - 260px)\",\n className,\n}: DataTableCardProps<T>) {\n const capped = maxBodyHeight !== \"none\";\n /** The illustrated stand-in only applies once loading has settled. */\n const showEmptyState = !!emptyState && !isLoading && data.length === 0;\n\n return (\n <div\n className={cn(\"overflow-hidden rounded-xl border border-border bg-card\", className)}\n style={\n capped ? ({ [\"--dtc-max-body\" as string]: maxBodyHeight } as CSSProperties) : undefined\n }\n >\n {title && (\n <div className=\"flex flex-wrap items-start justify-between gap-3 border-b border-border px-4 py-3.5\">\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-foreground\">{title}</h2>\n {description && <p className=\"mt-0.5 text-xs text-muted-foreground\">{description}</p>}\n </div>\n {actions && <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>}\n </div>\n )}\n\n {tabs && <div className=\"border-b border-border px-4 pt-3\">{tabs}</div>}\n {toolbar && <div className=\"border-b border-border px-4 py-3\">{toolbar}</div>}\n\n {errorState}\n {!errorState && showEmptyState && emptyState}\n\n <DataTable<T>\n className={cn(\n (showEmptyState || errorState) && \"hidden\",\n // The card already draws the border and radius; a second set inside\n // it would read as a table nested in a card.\n \"rounded-none border-0\",\n footer && \"[&>.border-t]:hidden\",\n // Cap the scroll container so the body scrolls internally while the\n // toolbar and footer stay fixed. The cap comes from an inline custom\n // property rather than a class, so a caller's `className` override\n // cannot depend on class-merge order.\n capped &&\n \"[&>div:first-child]:max-h-[var(--dtc-max-body)] [&>div:first-child]:overflow-y-auto\"\n )}\n // The header sticks to the top of that scroll area, which is only\n // meaningful while the body actually scrolls.\n theadClassName={capped ? \"sticky top-0 z-20 [&_th]:bg-card\" : undefined}\n tableLayout={tableLayout}\n columns={columns}\n data={data}\n isLoading={isLoading}\n rowKey={rowKey}\n skeletonRows={skeletonRows}\n density={density}\n pagination={pagination}\n sorting={sorting}\n rowAction={rowAction}\n onRowClick={onRowClick}\n emptyTitle={emptyTitle}\n emptyDescription={emptyDescription}\n expandable={expandable}\n />\n\n {footer && (\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t border-border px-4 py-3\">\n {footer}\n </div>\n )}\n </div>\n );\n}\n\n/** Right-aligned group for toolbar action buttons. */\nexport function TableToolbarActions({ children }: { children: ReactNode }) {\n return <div className=\"ml-auto flex items-center gap-2\">{children}</div>;\n}\n","\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { normalizePagination, type DataTablePagination } from \"./data-table\";\nimport { EmptyState } from \"./empty-state\";\nimport { Shimmer } from \"./skeleton\";\nimport { cn } from \"./utils\";\n\n/**\n * The narrow-viewport counterpart to {@link DataTableCard}: the same records as\n * a stack of cards.\n *\n * It is a separate component rather than a mode of the table on purpose. A\n * card list is not a table with its columns hidden — it chooses a handful of\n * fields, gives them a hierarchy, and drops the rest. Folding that into\n * `DataTableCard` would mean one component carrying two layouts and a\n * breakpoint, and every table paying for props it does not use.\n *\n * Pair the two with CSS, not a media-query hook:\n *\n * ```tsx\n * <DataTableCard className=\"hidden lg:block\" … />\n * <DataCardList className=\"lg:hidden\" … />\n * ```\n *\n * Both render; CSS shows one. A JS breakpoint would have to start with a guess\n * on the server, so one cohort sees the wrong layout on first paint, and a\n * resize across the breakpoint unmounts the visible half — taking scroll\n * position and any open row with it.\n *\n * What it owns is the surface, not the card: the bordered container, the\n * loading skeletons, the empty state and the pager. Those are the four things\n * every hand-rolled card list in the apps reimplemented, and the four that had\n * drifted. The card itself stays with the feature, via `renderCard` — that is\n * the part that genuinely differs per record.\n */\nexport interface DataCardListProps<T> {\n rows: T[];\n rowKey: (row: T) => string;\n /** One record as a card. The only part a feature has to write. */\n renderCard: (row: T, index: number) => ReactNode;\n isLoading?: boolean;\n /**\n * The loading placeholder for one card. Omit for a generic card-shaped\n * shimmer — good enough for most lists, and worth replacing only where the\n * real card has a distinctive shape worth pre-announcing.\n */\n renderSkeleton?: (index: number) => ReactNode;\n skeletonCount?: number;\n emptyTitle?: string;\n emptyDescription?: string;\n /**\n * Replaces the list when there are no rows — an illustrated placeholder,\n * typically. Same split as `DataTableCard`: the title/description pair is the\n * plain \"nothing matched\" state, this is the drawn first-run one.\n */\n emptyState?: ReactNode;\n /**\n * Replaces the rows entirely when the request failed.\n *\n * Distinct from an empty result with error-worded copy: that keeps the\n * column headers, which is right for \"nothing matched\" and wrong for \"we\n * could not load this\" — headers imply data was fetched and found empty.\n */\n errorState?: ReactNode;\n /**\n * The same {@link DataTablePagination} the table takes, so a list and the\n * table beside it cannot disagree about which page they are on. Rendered as\n * a compact Prev / Next pager rather than a numbered strip: a row of page\n * numbers is the first thing to go wrong on a phone.\n */\n pagination?: DataTablePagination;\n /** Wraps the list in the same bordered card the table uses. Default true. */\n bordered?: boolean;\n className?: string;\n}\n\n/** A generic card-shaped placeholder: a title line, two details, a value. */\nfunction DefaultCardSkeleton() {\n return (\n <div className=\"rounded-xl border border-border bg-card p-3.5\">\n <div className=\"flex items-center gap-2\">\n <Shimmer className=\"h-4 w-40\" />\n <Shimmer className=\"ml-auto h-3.5 w-5\" rounded=\"sm\" />\n </div>\n <Shimmer className=\"mt-2 h-3 w-28\" />\n <Shimmer className=\"mt-1.5 h-3 w-44\" />\n <Shimmer className=\"mt-2.5 h-3.5 w-32\" />\n </div>\n );\n}\n\nexport function DataCardList<T>({\n rows,\n rowKey,\n renderCard,\n isLoading = false,\n renderSkeleton,\n skeletonCount = 6,\n emptyTitle = \"Nothing to show\",\n emptyDescription,\n emptyState,\n errorState,\n pagination = { mode: \"client\" },\n bordered = true,\n className,\n}: DataCardListProps<T>) {\n const pager = normalizePagination(pagination, rows.length, 1);\n\n // Only `client` mode holds every row, so only `client` mode slices; the\n // others were handed exactly this page. Same rule as the table.\n const page = pager.sliceLocally\n ? rows.slice((pager.page - 1) * pager.pageSize, pager.page * pager.pageSize)\n : rows;\n\n const isCursor = pager.totalPages === undefined;\n const hasPrev = isCursor ? !!pager.hasPrev : pager.page > 1;\n const hasNext = isCursor ? !!pager.hasNext : pager.page < (pager.totalPages ?? 1);\n\n const goPrev = () =>\n isCursor ? pager.onPrev?.() : pagination.mode === \"page\" && pagination.onPageChange(pager.page - 1);\n const goNext = () =>\n isCursor ? pager.onNext?.() : pagination.mode === \"page\" && pagination.onPageChange(pager.page + 1);\n\n const showPager =\n !errorState && pager.showFooter && !isLoading && page.length > 0 && (hasPrev || hasNext);\n\n return (\n <div\n className={cn(\n \"flex flex-col gap-3 p-4\",\n bordered && \"rounded-xl border border-border bg-card\",\n className\n )}\n >\n {errorState ? (\n errorState\n ) : isLoading ? (\n Array.from({ length: skeletonCount }).map((_, i) =>\n renderSkeleton ? (\n <div key={i}>{renderSkeleton(i)}</div>\n ) : (\n <DefaultCardSkeleton key={i} />\n )\n )\n ) : page.length === 0 ? (\n (emptyState ?? <EmptyState title={emptyTitle} description={emptyDescription} />)\n ) : (\n page.map((row, i) => <div key={rowKey(row)}>{renderCard(row, i)}</div>)\n )}\n\n {showPager && (\n <div className=\"flex items-center justify-between gap-2 pt-1\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={!hasPrev}\n onClick={goPrev}\n leftIcon={<ChevronLeft className=\"h-3.5 w-3.5\" />}\n >\n Prev\n </Button>\n\n {/* No total in cursor mode, so no \"of N\" — the same honesty the\n table's own footer keeps. */}\n <span className=\"text-[12px] tabular-nums text-muted-foreground\">\n Page {pager.page}\n {pager.totalPages !== undefined ? ` of ${pager.totalPages}` : \"\"}\n </span>\n\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={!hasNext}\n onClick={goNext}\n rightIcon={<ChevronRight className=\"h-3.5 w-3.5\" />}\n >\n Next\n </Button>\n </div>\n )}\n </div>\n );\n}\n","\"use client\";\n\nimport { useEffect, useRef, useState, type MouseEvent } from \"react\";\nimport { Check, Copy } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { Button } from \"./button\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./tooltip\";\nimport { cn } from \"./utils\";\n\nexport interface CopyableCellProps {\n /**\n * The full value. This is what reaches the clipboard, the tooltip and the\n * accessible name — always, even when `display` shortens what is on screen.\n * Shortening what is shown must never shorten what the user walks away with.\n */\n value?: string | null;\n /** What to render instead of `value` — an elided form, typically. */\n display?: string;\n /** The noun in the tooltip and the toast: \"Transaction ID copied\". */\n label?: string;\n /**\n * Makes the value the handle that opens the row, rendered as a link. Without\n * it the value is plain text that can still be copied.\n *\n * The copy button stops propagation, so an id that opens a row does not also\n * open it when copied.\n */\n onClick?: () => void;\n /** Render the value in the primary colour. */\n accent?: boolean;\n monospace?: boolean;\n /** What an absent value renders as. Default the em dash every grid uses. */\n fallback?: string;\n /**\n * - `inline` (default) — the value, with its own copy button beside it.\n * - `cell` — the **whole** element is the copy target and the value\n * underlines on hover. For a fixed-width column where a separate button\n * would cost more room than the value it copies.\n *\n * `cell` ignores `onClick`: a cell cannot both copy and open the row on the\n * same click.\n */\n variant?: \"inline\" | \"cell\";\n /**\n * Keep the copy button invisible until the row (or any `group` ancestor) is\n * hovered, or the button itself is focused. Opacity only — it keeps its\n * space, so revealing it never shifts the row.\n *\n * Defaults to `true`, which is what a table wants: twelve permanent copy\n * buttons are twelve pieces of chrome competing with the data. Pass `false`\n * for a detail field, where there is no row to hover and the control would\n * simply never appear. Pointer-coarse devices have no hover to give, so it\n * stays visible there regardless.\n */\n revealOnHover?: boolean;\n /**\n * Announce the copy with a toast. Off for a field whose tick and tooltip are\n * feedback enough, and where a toast per copy would be noise.\n */\n showToast?: boolean;\n /** Extra classes on the value itself, e.g. a muted secondary placement. */\n valueClassName?: string;\n className?: string;\n}\n\n/**\n * The canonical identifier cell: a value plus a copy button that fades in on\n * the row's hover.\n *\n * Reveal-on-hover is the point. A table of twelve ids with twelve permanent\n * copy buttons is twelve pieces of chrome competing with the data; the row the\n * pointer is on is the only one whose button is useful.\n *\n * It relies on the row's own `group` class, which every `DataTable` `<tr>`\n * already carries. Outside a DataTable row, pass `className=\"group\"` on an\n * ancestor or the button stays hidden.\n */\nexport function CopyableCell({\n value,\n display,\n label = \"Value\",\n onClick,\n accent = false,\n monospace = false,\n fallback = \"—\",\n variant = \"inline\",\n revealOnHover = true,\n showToast = true,\n valueClassName,\n className,\n}: CopyableCellProps) {\n const [copied, setCopied] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // The tick reverts on a timer, so an unmount mid-flight must not leave it\n // running against a gone component.\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n []\n );\n\n if (!value) return <span className=\"text-muted-foreground\">{fallback}</span>;\n\n const copyValue = async () => {\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n if (showToast) toast.success(`${label} copied`);\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), 1500);\n } catch {\n // Clipboard blocked — an insecure context, or permission denied. Copying\n // an id is not worth an error toast over; the value is still on screen.\n }\n };\n\n /**\n * Copying is never also a request to open the record the value belongs to,\n * so the event stops here. DataTable's own `onRowClick` already skips a\n * click on a button; this also covers rows made clickable some other way.\n */\n const copy = (e: MouseEvent) => {\n e.stopPropagation();\n void copyValue();\n };\n\n const text = cn(\n \"min-w-0 truncate font-medium\",\n accent ? \"text-primary\" : \"text-foreground\",\n monospace && \"font-mono\",\n valueClassName\n );\n\n /** True when the screen is only showing part of the value. */\n const elided = display !== undefined && display !== value;\n const copyHint = copied ? \"Copied\" : `Copy ${label}`;\n\n if (variant === \"cell\") {\n // The whole box copies, so there is no separate button to reach for — in a\n // narrow column that button costs more width than the value it copies. The\n // value underlines on hover to say the box is the target; the icon is a\n // marker, not a second control, which is why it is not focusable.\n return (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <div\n role=\"button\"\n tabIndex={0}\n onClick={copy}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\" && e.key !== \" \") return;\n e.preventDefault();\n e.stopPropagation();\n void copyValue();\n }}\n aria-label={copied ? \"Copied to clipboard\" : `Copy ${value}`}\n className={cn(\n \"group/copy flex min-w-0 cursor-pointer items-center gap-1 rounded-md\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n className\n )}\n >\n <span className={cn(text, \"flex-1 group-hover/copy:underline\")}>\n {display ?? value}\n </span>\n {copied ? (\n <Check className=\"h-3 w-3 shrink-0 text-muted-foreground\" />\n ) : (\n <Copy\n className={cn(\n \"h-3 w-3 shrink-0 text-muted-foreground\",\n revealOnHover &&\n \"opacity-0 transition-opacity group-hover/copy:opacity-100 group-focus-visible/copy:opacity-100 [@media(hover:none)]:opacity-100\"\n )}\n />\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"text-xs\">\n {copied ? \"Copied\" : \"Copy\"}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n }\n\n /**\n * The value as drawn. An elided value carries the whole thing in the tooltip\n * below; `title` is only for the other case — a value `display` did not\n * shorten can still be cut by the column's own `truncate`, and there is no\n * React-side way to know that it was.\n */\n const valueNode = onClick ? (\n // A bare <button>, deliberately, where the rest of flux would reach for\n // `Button variant=\"link\"`. That variant hard-codes `text-[15px]`, and\n // the obvious override — `text-[inherit]` — does not beat it: Tailwind\n // and tailwind-merge read `text-[<non-length>]` as a COLOUR, so the\n // size class survives and the cell renders 2px larger than every other\n // cell in the row. Preflight already gives a bare button `font: inherit`,\n // so this simply inherits the cell's size at whatever density the table\n // is using, which is what a cell should do.\n <button\n type=\"button\"\n onClick={onClick}\n title={elided ? undefined : value}\n // The elided text is not the name of this control — the value is.\n aria-label={elided ? value : undefined}\n className={cn(\n \"cursor-pointer bg-transparent p-0 text-left underline-offset-4\",\n \"hover:underline focus-visible:underline focus-visible:outline-none\",\n text\n )}\n >\n {display ?? value}\n </button>\n ) : (\n <span\n className={text}\n title={elided ? undefined : value}\n // Hidden from assistive tech only when there is an sr-only twin below\n // carrying the whole value — otherwise the elided form would be read out\n // as well as it, twice for one id.\n aria-hidden={elided || undefined}\n >\n {display ?? value}\n </span>\n );\n\n return (\n <div className={cn(\"group/copy flex min-w-0 items-center gap-1\", className)}>\n {/* The full value hangs off the **text**, which is the part that was\n shortened and so the part a reader reaches for. It used to hang off\n the copy button instead, which meant the way to read an id was to\n hover the control that copies it. Only mounted when something was\n actually elided: a tooltip repeating text already fully on screen is\n noise. */}\n {elided ? (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>{valueNode}</TooltipTrigger>\n <TooltipContent side=\"top\" className=\"text-xs\">\n {value}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n valueNode\n )}\n\n {/* Elided text reads as noise aloud, so the full value is what goes to a\n screen reader. The interactive case names itself with `aria-label`\n above and needs none of this. */}\n {elided && !onClick && <span className=\"sr-only\">{value}</span>}\n\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={copy}\n aria-label={`Copy ${label}`}\n // `group-hover` is the DataTable row; `group-hover/copy` covers a\n // cell used outside one, where hovering the value itself should\n // still reveal the button.\n className={cn(\n \"h-5 w-5 min-h-0 min-w-0 shrink-0 rounded-md p-0 text-muted-foreground\",\n revealOnHover && [\n \"opacity-0 transition-opacity\",\n // `group-hover` is the DataTable row; `group-hover/copy`\n // covers a cell used outside one, where hovering the value\n // itself should still reveal the button.\n \"focus-visible:opacity-100 group-hover:opacity-100 group-hover/copy:opacity-100\",\n // No hover to wait for on a touch device, so it simply shows.\n \"[@media(hover:none)]:opacity-100\",\n ]\n )}\n >\n {copied ? <Check className=\"h-3 w-3\" /> : <Copy className=\"h-3 w-3\" />}\n </Button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"text-xs\">\n {copyHint}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n </div>\n );\n}\n","\"use client\";\n\nimport { useEffect, useMemo, useRef, useState, type ChangeEvent } from \"react\";\nimport { Search } from \"lucide-react\";\nimport { Input } from \"./input\";\nimport { cn } from \"./utils\";\n\n/** Height of one word slot, in px. The carousel translates by multiples of it. */\nconst WORD_HEIGHT = 20;\n\nexport interface RotatingSearchInputProps {\n /** Controlled value. Omit to let the field own it. */\n value?: string;\n /** Fires on the debounced value, not on every keystroke. */\n onSearch: (value: string) => void;\n /** The hints to cycle through: \"Amount\", \"Transaction ID\", \"Email\". */\n words: string[];\n /** Debounce before `onSearch` fires. Default 300ms. */\n debounceDelay?: number;\n className?: string;\n /** Screen-reader name for the field. */\n ariaLabel?: string;\n}\n\n/**\n * The table search box: one field whose placeholder cycles through what it can\n * actually match — \"Search by Amount\", then \"Transaction ID\", then \"Email\".\n *\n * That rotation is the whole point. A single grid search usually spans half a\n * dozen fields, and a static \"Search\" placeholder tells the user none of them,\n * so they guess at what is searchable and conclude the box is broken when their\n * guess misses. Naming the fields in turn costs no space and answers it.\n *\n * `onSearch` is debounced, so a search that hits the network fires once the\n * user pauses rather than once per keystroke.\n */\nexport function RotatingSearchInput({\n value,\n onSearch,\n words,\n debounceDelay = 300,\n className,\n ariaLabel = \"Search\",\n}: RotatingSearchInputProps) {\n const [internalValue, setInternalValue] = useState(value ?? \"\");\n const [index, setIndex] = useState(0);\n const [withTransition, setWithTransition] = useState(true);\n\n /**\n * The latest handler, read at fire time. Without this the debounce closes\n * over the handler it was created with, so a search firing after a re-render\n * would call a stale one — and these handlers close over filter state.\n */\n const latestOnSearch = useRef(onSearch);\n useEffect(() => {\n latestOnSearch.current = onSearch;\n }, [onSearch]);\n\n const debouncedRef = useRef<{ (val: string): void; cancel(): void } | null>(null);\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout> | null = null;\n const debounced = (val: string) => {\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(() => latestOnSearch.current(val), debounceDelay);\n };\n debounced.cancel = () => {\n if (timeout) clearTimeout(timeout);\n };\n debouncedRef.current = debounced;\n // Cancel on unmount, or a search fires into a component that is gone.\n return () => debounced.cancel();\n }, [debounceDelay]);\n\n // Mirror a controlled value. Deferred a tick so a parent that resets the\n // query while a debounce is in flight does not fight the field mid-keystroke.\n useEffect(() => {\n if (value === undefined) return;\n const timer = setTimeout(() => setInternalValue(value), 0);\n return () => clearTimeout(timer);\n }, [value]);\n\n /**\n * The first word again at the end, so the last-to-first step slides forward\n * like every other one instead of rewinding the whole list. The jump back to\n * the real first word then happens with the transition off, where it cannot\n * be seen.\n */\n const extendedWords = useMemo(\n () => (words.length === 0 ? [] : [...words, words[0]]),\n [words]\n );\n\n // A new word list restarts the carousel rather than leaving the index\n // pointing into a list that no longer has that many entries.\n useEffect(() => {\n const timer = setTimeout(() => {\n setWithTransition(false);\n setIndex(0);\n }, 0);\n return () => clearTimeout(timer);\n }, [words.length]);\n\n useEffect(() => {\n if (words.length === 0) return;\n const id = setInterval(() => {\n setWithTransition(true);\n setIndex((prev) => prev + 1);\n }, 2500);\n return () => clearInterval(id);\n }, [words.length]);\n\n // Landed on the duplicated first word: let it rest, then snap back to the\n // real one with the transition off.\n useEffect(() => {\n if (index !== words.length) return;\n const timer = setTimeout(() => {\n setWithTransition(false);\n setIndex(0);\n }, 2000);\n return () => clearTimeout(timer);\n }, [index, words.length]);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n setInternalValue(e.target.value);\n debouncedRef.current?.(e.target.value);\n };\n\n return (\n <div className={cn(\"relative\", className)}>\n {/* The rotating hint is an overlay, not the input's own `placeholder`,\n because a placeholder cannot animate. It is pointer-events-none so it\n never eats a click meant for the field, and it is dropped entirely\n once there is a value to avoid sitting behind the user's text. */}\n {!internalValue && words.length > 0 && (\n <div className=\"pointer-events-none absolute left-8 top-1/2 z-10 flex h-5 -translate-y-1/2 items-start gap-1 overflow-hidden text-xs text-muted-foreground\">\n <span className=\"h-5 shrink-0 leading-5\">Search by</span>\n <div\n style={{\n transform: `translateY(-${index * WORD_HEIGHT}px)`,\n transition: withTransition ? \"transform 2s cubic-bezier(0.4, 0, 0.2, 1)\" : \"none\",\n }}\n >\n {extendedWords.map((word, i) => (\n <div key={`${word}-${i}`} className=\"h-5 leading-5\">\n {word}\n </div>\n ))}\n </div>\n </div>\n )}\n\n <Search className=\"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n\n <Input\n type=\"text\"\n aria-label={ariaLabel}\n value={internalValue}\n placeholder=\"\"\n onChange={handleChange}\n className=\"!h-8 min-h-0 bg-muted/50 pl-8 text-xs\"\n />\n </div>\n );\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { GripVertical, RotateCcw } from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Separator } from \"./separator\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./tooltip\";\nimport { cn } from \"./utils\";\n\n/**\n * A column as the manager sees it: a key and something to call it in the list.\n * `label` is separate from the table's `header` because a header can be a node\n * (an icon, a tooltip, a two-line stack) and this list needs plain text.\n */\nexport interface ManagedColumn {\n key: string;\n label: string;\n}\n\nexport interface ColumnManagerProps {\n /** Every manageable column, in the table's *declared* order. */\n columns: ManagedColumn[];\n /** Current arrangement, as column keys. */\n order: string[];\n onOrderChange: (order: string[]) => void;\n /**\n * Column keys currently hidden. Omit — along with `onHiddenKeysChange` — to\n * drop the tick boxes entirely and keep this a reorder-only popover.\n */\n hiddenKeys?: string[];\n onHiddenKeysChange?: (hidden: string[]) => void;\n /**\n * Columns that cannot be **hidden**. Says nothing about where they sit — a\n * column the table cannot do without is still one the user may want to move.\n *\n * They keep a tick box rather than losing it, so the list reads as one set of\n * columns with some locked rather than as two lists — but the box is grey,\n * not primary, because nobody chose it.\n */\n fixedKeys?: string[];\n /**\n * Columns that cannot be **reordered**. Says nothing about whether they can\n * be hidden.\n *\n * The usual case is a frozen (sticky) column: its left offset is the running\n * total of the widths of the frozen columns before it, so the block only\n * works while they stay first and contiguous — drag one into the middle and\n * it keeps `left-0`, leaving a pinned column floating over the scrolling\n * ones. Hiding it is fine; that just shortens the block.\n *\n * A key can appear in both lists, and then neither control is offered.\n */\n pinnedKeys?: string[];\n /**\n * Why a fixed column cannot be hidden, shown on hover and focus. A disabled\n * control that stays silent leaves the user to guess whether they are doing\n * something wrong, so every caller should say something; the default is\n * deliberately generic so a missing one is still an answer.\n */\n fixedReason?: string;\n /**\n * Why a pinned column cannot be moved, shown on hover. Same reasoning as\n * `fixedReason`: a dead affordance should say why it is dead.\n */\n pinnedReason?: string;\n /**\n * Discards the saved arrangement so the table falls back to `columns`' own\n * order with nothing hidden. Separate from `onOrderChange` rather than\n * passing the default order through it, since \"no saved preference\" is its\n * own state in the caller, not just another arrangement.\n */\n onReset: () => void;\n /** Trigger label. Default \"Columns\". */\n label?: string;\n /** Render the trigger as an icon-only button — for a crowded toolbar. */\n iconOnly?: boolean;\n /** Extra classes on the trigger button. */\n className?: string;\n /** Popover alignment against the trigger. Default \"end\". */\n align?: \"start\" | \"center\" | \"end\";\n}\n\ninterface ColumnVisibility {\n checked: boolean;\n /** Locked on, with a reason. Renders grey rather than as an active choice. */\n lockedReason?: string;\n onToggle: () => void;\n}\n\n/**\n * One row of the list.\n *\n * `useSortable` hands back a transform for *every* row, not just the one under\n * the pointer — which is what makes the others slide out of the way as the\n * dragged row passes them, instead of the list snapping to a new order. The\n * transition it supplies drives that animation, so both go straight onto the\n * element's style.\n */\nfunction SortableColumnRow({\n id,\n label,\n visibility,\n pinned,\n pinnedReason,\n}: {\n id: string;\n label: string;\n visibility?: ColumnVisibility;\n /** A fixed column: it cannot be dragged, and nothing can be dropped on it. */\n pinned?: boolean;\n /** Why, for the cursor's tooltip and the accessible name. */\n pinnedReason?: string;\n}) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id,\n // Both halves matter. `draggable` is the request — a fixed column cannot be\n // picked up. `droppable` is what makes it actually stay put: without it the\n // row is still a valid drop target, so dragging any other row onto it\n // pushes it down and the \"fixed\" column has moved after all.\n disabled: pinned ? { draggable: true, droppable: true } : undefined,\n });\n\n const style = {\n // A pinned row takes no transform at all, so it holds its place while the\n // movable rows animate around it.\n transform: pinned ? undefined : CSS.Transform.toString(transform),\n transition: pinned ? undefined : transition,\n // Above its neighbours while moving, so it slides over them rather than\n // disappearing behind the next row's background.\n zIndex: isDragging ? 10 : undefined,\n };\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className={cn(\n \"flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] text-foreground\",\n isDragging && \"bg-muted opacity-90\",\n // No hover affordance on a pinned row: there is nothing to pick up.\n !isDragging && !pinned && \"hover:bg-muted/50\"\n )}\n >\n {/* The drag listeners live on the grip and the label, not the row, so the\n tick box stays clickable instead of being swallowed by a drag.\n\n A pinned row gets neither listeners nor the grab cursor. The grip\n still renders, dimmed: dropping it would reflow the labels out of\n line with every other row, and a row with no grip at all reads as a\n different kind of thing rather than as this one, locked. */}\n {pinned ? (\n <span\n title={pinnedReason}\n aria-label={`${label} column is fixed in place`}\n className=\"flex min-w-0 flex-1 cursor-not-allowed items-center gap-2\"\n >\n <GripVertical className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground/30\" />\n {/* The label keeps its normal colour even here. Only the grip dims:\n greying the text would read as \"this row is disabled\", which is\n wrong when its tick box is live. */}\n <span className=\"truncate\">{label}</span>\n </span>\n ) : (\n <span\n className=\"flex min-w-0 flex-1 cursor-grab items-center gap-2 active:cursor-grabbing\"\n {...attributes}\n {...listeners}\n >\n <GripVertical className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate\">{label}</span>\n </span>\n )}\n\n {visibility &&\n (visibility.lockedReason ? (\n /**\n * A locked column renders grey, not the primary blue a live tick\n * uses: blue says \"you chose this\", and nobody chose this. The\n * tooltip hangs off a wrapping span rather than the Checkbox, because\n * a disabled control receives no pointer events and a trigger on the\n * box itself would never fire. The span also carries the not-allowed\n * cursor and is focusable, so the reason is reachable by keyboard as\n * well as hover.\n */\n <TooltipProvider delayDuration={150}>\n <Tooltip>\n <TooltipTrigger asChild>\n <span tabIndex={0} className=\"shrink-0 cursor-not-allowed rounded-sm\">\n <Checkbox\n checked\n disabled\n aria-label={`${label} column is always shown`}\n className=\"pointer-events-none border-border opacity-100 data-[state=checked]:border-border data-[state=checked]:bg-muted-foreground/40 data-[state=checked]:text-foreground/70\"\n />\n </span>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-[15rem]\">{visibility.lockedReason}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n <Checkbox\n checked={visibility.checked}\n onCheckedChange={visibility.onToggle}\n aria-label={`Show ${label} column`}\n className=\"shrink-0\"\n />\n ))}\n </div>\n );\n}\n\n/**\n * Column manager: drag to reorder, tick to show or hide, with locked columns\n * and a reset. One implementation for every grid in every app, so a merchant\n * and an internal operator arrange their columns the same way.\n *\n * Reordering is @dnd-kit, the same stack the dashboard's widget grid uses, so\n * the rows animate out of each other's way as one is dragged past them. A\n * hand-rolled pointer drag can reorder the list correctly and still feel wrong:\n * without a per-row transform the rows simply teleport into their new slots,\n * and there is nothing to follow.\n *\n * dnd-kit is `external` in the build rather than bundled, because both\n * consuming apps already depend on it — two copies of `DndContext` in one app\n * is the kind of thing that breaks only in the app, never in the library.\n *\n * Keyboard users reorder without a mouse at all: Space picks a row up, the\n * arrows move it, Space drops it, Escape abandons it, and dnd-kit announces\n * each step as it goes.\n */\nexport function ColumnManager({\n columns,\n order,\n onOrderChange,\n hiddenKeys,\n onHiddenKeysChange,\n fixedKeys = [],\n pinnedKeys = [],\n fixedReason = \"Always shown. The table needs this column to make sense.\",\n pinnedReason = \"Fixed in place. This column stays frozen at the left of the table.\",\n onReset,\n label = \"Columns\",\n iconOnly = false,\n className,\n align = \"end\",\n}: ColumnManagerProps) {\n const canToggleVisibility = !!hiddenKeys && !!onHiddenKeysChange;\n const hidden = useMemo(() => hiddenKeys ?? [], [hiddenKeys]);\n\n /**\n * Every key that cannot move — `pinnedKeys` and nothing else.\n *\n * Visibility and position are independent, and deliberately not inferred from\n * one another: a column the table cannot do without is very often one the\n * user is still free to put wherever they like (a transaction id), and a\n * column frozen to the left edge is very often one they are free to hide\n * (a merchant id on a single-merchant view). Folding either into the other\n * takes away a control for no reason the user can see.\n */\n const immovable = pinnedKeys;\n\n const byKey = useMemo(() => new Map(columns.map((c) => [c.key, c])), [columns]);\n /** The arrangement to draw: saved order, minus keys the table no longer has. */\n const ordered = useMemo(\n () => order.map((k) => byKey.get(k)).filter((c): c is ManagedColumn => !!c),\n [order, byKey]\n );\n\n /**\n * `columns` arrives in the caller's declared order with nothing hidden, which\n * is exactly what resetting falls back to — so comparing against it tells us\n * whether there is a custom arrangement to reset at all.\n */\n const isCustomised =\n order.join(\"|\") !== columns.map((c) => c.key).join(\"|\") || hidden.length > 0;\n\n const toggleVisibility = (key: string) => {\n if (!onHiddenKeysChange || fixedKeys.includes(key)) return;\n onHiddenKeysChange(\n hidden.includes(key) ? hidden.filter((k) => k !== key) : [...hidden, key]\n );\n };\n\n /**\n * Drag sensors. The 4px activation distance is what keeps a *click* on the\n * grip from registering as a drag, so tapping a row does nothing rather than\n * nudging the order by a pixel.\n *\n * The keyboard sensor is the reason reordering is reachable without a mouse\n * at all: Space picks a row up, the arrows move it, Space drops it, Escape\n * abandons it — and dnd-kit announces each step to screen readers as it goes.\n */\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })\n );\n\n /** The keys that can actually move, in their current order. */\n const movableKeys = useMemo(\n () => order.filter((k) => !immovable.includes(k)),\n [order, immovable]\n );\n\n /**\n * Reorders within the movable keys only, then puts them back around the fixed\n * ones, which keep their exact indices.\n *\n * A plain `arrayMove` over the whole list would not do: moving the last row to\n * the top shifts every key below it by one, fixed keys included — so a column\n * nobody is allowed to drag ends up somewhere new anyway. This moves the\n * dragged key through the movable slots and leaves the fixed slots alone.\n */\n const onDragEnd = (e: DragEndEvent) => {\n const { active, over } = e;\n if (!over || active.id === over.id) return;\n\n const from = movableKeys.indexOf(active.id as string);\n const to = movableKeys.indexOf(over.id as string);\n if (from === -1 || to === -1) return;\n\n const moved = arrayMove(movableKeys, from, to);\n let next = 0;\n onOrderChange(order.map((key) => (immovable.includes(key) ? key : moved[next++])));\n };\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"sm\"\n aria-label={iconOnly ? label : undefined}\n // The same grip glyph the draggable rows inside use, so the button\n // names the gesture it opens.\n leftIcon={<GripVertical className=\"h-3.5 w-3.5\" />}\n className={cn(\n // Compact by default so it sits level with filter chips rather than\n // towering over them at Button's own `sm` height.\n \"h-auto min-h-0 shrink-0 py-1 text-muted-foreground hover:text-foreground\",\n className\n )}\n >\n {iconOnly ? null : label}\n </Button>\n </PopoverTrigger>\n\n {/* Bounded by the room Radix measures between the trigger and the\n viewport edge, not by a pixel cap: a grid with thirty columns used to\n render thirty rows in one tall popover, and the last of them — along\n with Reset — fell below the fold with no way to reach them. The hint\n line and the Reset footer stay put; only the list scrolls. */}\n <PopoverContent\n align={align}\n className=\"flex max-h-[var(--radix-popover-content-available-height)] w-56 flex-col overflow-hidden p-2\"\n >\n <p className=\"shrink-0 px-2 pb-1.5 text-[11px] font-medium text-muted-foreground\">\n {canToggleVisibility ? \"Drag to reorder · tick to show\" : \"Drag to reorder\"}\n </p>\n\n <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={onDragEnd}>\n {/* Only the movable keys are sortable; a fixed one is neither a\n drag source nor a drop target. */}\n <SortableContext items={movableKeys} strategy={verticalListSortingStrategy}>\n <div className=\"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto\">\n {ordered.map((col) => (\n <SortableColumnRow\n key={col.key}\n id={col.key}\n label={col.label}\n pinned={immovable.includes(col.key)}\n pinnedReason={pinnedReason}\n visibility={\n canToggleVisibility\n ? {\n checked: !hidden.includes(col.key),\n // A fixed column keeps a box rather than having none,\n // so the list reads as one set of columns with some\n // locked, not two lists.\n lockedReason: fixedKeys.includes(col.key) ? fixedReason : undefined,\n onToggle: () => toggleVisibility(col.key),\n }\n : undefined\n }\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n\n {/* Secondary action, divided off from the list so it reads as an escape\n hatch rather than another draggable row. */}\n <Separator className=\"my-2 shrink-0\" />\n {isCustomised ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n leftIcon={<RotateCcw className=\"h-3 w-3\" />}\n onClick={onReset}\n className=\"w-full justify-start text-muted-foreground hover:text-foreground\"\n >\n Reset to defaults\n </Button>\n ) : (\n /* Nothing to undo. A disabled button here would offer an action and\n then refuse it; saying the columns already are the default answers\n the question the button was raising. */\n <p className=\"px-2 py-1.5 text-[12px] text-muted-foreground\">\n Columns are in their default order.\n </p>\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Preferences ─────────────────────────────────────────────────────────────\n\nexport interface ColumnPreferences {\n order: string[];\n hidden: string[];\n}\n\nexport interface UseColumnPreferencesOptions {\n /**\n * `localStorage` key. Omit and the arrangement lives only for the session —\n * which is what a grid whose columns depend on the signed-in user's role\n * wants, since a saved order from another role would resurrect columns that\n * no longer exist.\n */\n storageKey?: string;\n}\n\nexport interface UseColumnPreferencesResult extends ColumnPreferences {\n setOrder: (order: string[]) => void;\n setHidden: (hidden: string[]) => void;\n reset: () => void;\n /** Spread straight onto `<ColumnManager>`. */\n managerProps: Pick<\n ColumnManagerProps,\n \"order\" | \"onOrderChange\" | \"hiddenKeys\" | \"onHiddenKeysChange\" | \"onReset\"\n >;\n}\n\n/**\n * Owns a grid's column arrangement, optionally persisted.\n *\n * `defaultOrder` is the source of truth for which columns exist: a stored order\n * is reconciled against it on every read, so a column added in a release shows\n * up for someone who saved an arrangement before it existed, and a removed one\n * disappears instead of leaving a hole.\n */\nexport function useColumnPreferences(\n defaultOrder: string[],\n { storageKey }: UseColumnPreferencesOptions = {}\n): UseColumnPreferencesResult {\n const defaultKey = defaultOrder.join(\"|\");\n\n const [prefs, setPrefs] = useState<ColumnPreferences>({ order: defaultOrder, hidden: [] });\n\n /**\n * Read in an effect rather than a lazy initialiser: this package renders on\n * the server too, and reading `localStorage` during the first render would\n * make the server and client trees disagree.\n */\n useEffect(() => {\n if (!storageKey || typeof window === \"undefined\") return;\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (!raw) return;\n const saved = JSON.parse(raw) as Partial<ColumnPreferences>;\n const savedOrder = Array.isArray(saved.order) ? saved.order : [];\n const savedHidden = Array.isArray(saved.hidden) ? saved.hidden : [];\n const known = new Set(defaultOrder);\n setPrefs({\n // Keep the saved arrangement for columns that still exist, then append\n // anything new in its declared position at the end.\n order: [\n ...savedOrder.filter((k) => known.has(k)),\n ...defaultOrder.filter((k) => !savedOrder.includes(k)),\n ],\n hidden: savedHidden.filter((k) => known.has(k)),\n });\n } catch {\n // Corrupt or unreadable storage (private mode, a bad hand-edit) is not\n // worth breaking a table over — the default arrangement is a fine answer.\n }\n // `defaultKey` rather than `defaultOrder`: a column list rebuilt on every\n // render is a new array each time, which would re-read storage forever.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [storageKey, defaultKey]);\n\n const persist = useCallback(\n (next: ColumnPreferences) => {\n setPrefs(next);\n if (!storageKey || typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(next));\n } catch {\n // Storage full or blocked. The arrangement still applies this session.\n }\n },\n [storageKey]\n );\n\n const setOrder = useCallback(\n (order: string[]) => persist({ order, hidden: prefs.hidden }),\n [persist, prefs.hidden]\n );\n const setHidden = useCallback(\n (hidden: string[]) => persist({ order: prefs.order, hidden }),\n [persist, prefs.order]\n );\n const reset = useCallback(() => {\n setPrefs({ order: defaultOrder, hidden: [] });\n if (!storageKey || typeof window === \"undefined\") return;\n try {\n window.localStorage.removeItem(storageKey);\n } catch {\n // See persist().\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [storageKey, defaultKey]);\n\n return {\n order: prefs.order,\n hidden: prefs.hidden,\n setOrder,\n setHidden,\n reset,\n managerProps: {\n order: prefs.order,\n onOrderChange: setOrder,\n hiddenKeys: prefs.hidden,\n onHiddenKeysChange: setHidden,\n onReset: reset,\n },\n };\n}\n\n/**\n * Applies a saved arrangement to a built column list.\n *\n * `pinnedKeys` stay where they are declared regardless of the saved order —\n * for the trailing \"action\" column, which is a utility, not a data field\n * anybody wants to move. Columns missing from `order` (a field that only\n * exists for some roles, say) are appended before them rather than dropped.\n */\nexport function applyColumnPreferences<T extends { key: string }>(\n columns: T[],\n { order, hidden }: Partial<ColumnPreferences> = {},\n pinnedKeys: string[] = [\"action\"]\n): T[] {\n const pinned = columns.filter((c) => pinnedKeys.includes(c.key));\n const movable = columns.filter((c) => !pinnedKeys.includes(c.key));\n\n const arranged = order?.length\n ? (() => {\n const byKey = new Map(movable.map((c) => [c.key, c]));\n const seen = order.map((k) => byKey.get(k)).filter((c): c is T => !!c);\n const missing = movable.filter((c) => !order.includes(c.key));\n return [...seen, ...missing];\n })()\n : movable;\n\n const visible = hidden?.length\n ? arranged.filter((c) => !hidden.includes(c.key))\n : arranged;\n\n return [...visible, ...pinned];\n}\n","import type { ReactNode } from \"react\";\nimport { cn } from \"./utils\";\n\ninterface PageHeaderProps {\n title: ReactNode;\n /** When title is non-plain text (e.g. includes a flag), set for screen readers. */\n titleAriaLabel?: string;\n subtitle?: string;\n actions?: ReactNode;\n className?: string;\n}\n\nexport function PageHeader({ title, titleAriaLabel, subtitle, actions, className }: PageHeaderProps) {\n return (\n <div className={cn(\"flex items-start justify-between mb-6\", className)}>\n <div>\n <h1\n className=\"text-xl font-semibold text-foreground tracking-tight flex items-center gap-2.5 flex-wrap\"\n {...(titleAriaLabel ? { \"aria-label\": titleAriaLabel } : {})}\n >\n {title}\n </h1>\n {subtitle && <p className=\"text-sm text-muted-foreground mt-0.5\">{subtitle}</p>}\n </div>\n {actions && <div className=\"flex items-center gap-2\">{actions}</div>}\n </div>\n );\n}\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { forwardRef, type HTMLAttributes, useState, useCallback } from \"react\";\nimport { Check, Copy } from \"lucide-react\";\n\n// ---------------------------------------------------------------------------\n// Code – inline\n// ---------------------------------------------------------------------------\n\nexport type CodeProps = HTMLAttributes<HTMLElement>;\n\nexport const Code = forwardRef<HTMLElement, CodeProps>(\n ({ className, children, ...props }, ref) => {\n return (\n <code\n ref={ref}\n className={cn(\n \"rounded-md bg-muted px-1.5 py-0.5 font-mono text-[13px] text-foreground ring-1 ring-border\",\n className\n )}\n {...props}\n >\n {children}\n </code>\n );\n }\n);\nCode.displayName = \"Code\";\n\n// ---------------------------------------------------------------------------\n// CodeBlock – multi-line\n// ---------------------------------------------------------------------------\n\nexport interface CodeBlockProps extends HTMLAttributes<HTMLDivElement> {\n /** The raw code string to display and optionally copy. */\n code: string;\n /** Optional filename shown in the header. */\n filename?: string;\n /** Optional language label shown as a badge in the header. */\n language?: string;\n /** Hide the copy button. Defaults to false. */\n hideCopy?: boolean;\n /**\n * Wrap long lines instead of scrolling them sideways.\n *\n * Worth turning on wherever the code is something to read and copy rather\n * than to study — a snippet in a dialog, say, where a horizontal scrollbar\n * hides the end of the only line that matters and no one thinks to drag it.\n * Leave it off for real source, where wrapping would break the indentation\n * that carries the structure.\n */\n wrap?: boolean;\n}\n\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(\n (\n {\n code,\n filename,\n language,\n hideCopy = false,\n wrap = false,\n className,\n ...props\n },\n ref\n ) => {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n const timer = setTimeout(() => setCopied(false), 2000);\n return () => clearTimeout(timer);\n } catch {\n // Clipboard access denied — fail silently.\n }\n }, [code]);\n\n const hasHeader = Boolean(filename || language);\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative overflow-hidden bg-[#0f1117] text-[#e5e7eb]\",\n hasHeader ? \"rounded-xl\" : \"rounded-xl\",\n className\n )}\n {...props}\n >\n {/* Header */}\n {hasHeader && (\n <div className=\"flex items-center justify-between bg-[#1a1f2e] px-4 py-2 border-b border-[#2a3441]\">\n <div className=\"flex items-center gap-2.5\">\n {filename && (\n <span className=\"text-[#9ca3af] text-xs font-mono\">\n {filename}\n </span>\n )}\n {language && (\n <span className=\"rounded-md bg-[#2a3441] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[#6b7280]\">\n {language}\n </span>\n )}\n </div>\n {!hideCopy && (\n <CopyButton copied={copied} onClick={handleCopy} inHeader />\n )}\n </div>\n )}\n\n {/* Code area */}\n <div className=\"relative\">\n <pre\n className={cn(\n \"p-4 font-mono text-[13px] leading-relaxed\",\n wrap ? \"whitespace-pre-wrap break-words\" : \"overflow-x-auto\",\n // Room for the floating copy button, which a wrapped line would\n // otherwise run underneath. Only when wrapping: a scrolling block\n // is unchanged from before this prop existed.\n wrap && !hasHeader && !hideCopy && \"pr-12\"\n )}\n >\n <code>{code}</code>\n </pre>\n\n {/* Copy button (no header case) */}\n {!hasHeader && !hideCopy && (\n <div className=\"absolute top-3 right-3\">\n <CopyButton copied={copied} onClick={handleCopy} />\n </div>\n )}\n </div>\n </div>\n );\n }\n);\nCodeBlock.displayName = \"CodeBlock\";\n\n// ---------------------------------------------------------------------------\n// Internal: CopyButton\n// ---------------------------------------------------------------------------\n\ninterface CopyButtonProps {\n copied: boolean;\n onClick: () => void;\n inHeader?: boolean;\n}\n\nfunction CopyButton({ copied, onClick, inHeader = false }: CopyButtonProps) {\n return (\n <button\n type=\"button\"\n aria-label={copied ? \"Copied\" : \"Copy code\"}\n onClick={onClick}\n className={cn(\n \"inline-flex items-center justify-center rounded-md transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n inHeader\n ? \"size-6 text-[#6b7280] hover:bg-[#2a3441] hover:text-[#9ca3af]\"\n : \"size-7 bg-[#1a1f2e]/80 text-[#6b7280] hover:bg-[#1a1f2e] hover:text-[#9ca3af]\"\n )}\n >\n {copied ? (\n <Check className=\"size-3.5 text-green-400\" />\n ) : (\n <Copy className=\"size-3.5\" />\n )}\n </button>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { cn } from \"./utils\";\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn(\"relative flex h-9 w-9 shrink-0 overflow-hidden rounded-full border border-border bg-muted\", className)}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image ref={ref} className={cn(\"aspect-square h-full w-full object-cover\", className)} {...props} />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\"flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground\", className)}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarImage, AvatarFallback };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\nimport { Avatar, AvatarImage, AvatarFallback } from \"./avatar\";\n\nexport interface AvatarGroupItem {\n src?: string;\n fallback: string;\n alt?: string;\n}\n\nexport interface AvatarGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n avatars: AvatarGroupItem[];\n max?: number;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nconst sizeClasses: Record<NonNullable<AvatarGroupProps[\"size\"]>, string> = {\n sm: \"h-6 w-6\",\n md: \"h-8 w-8\",\n lg: \"h-10 w-10\",\n};\n\nconst fontSizeClasses: Record<NonNullable<AvatarGroupProps[\"size\"]>, string> = {\n sm: \"text-[10px]\",\n md: \"text-xs\",\n lg: \"text-xs\",\n};\n\nconst overlapClasses: Record<NonNullable<AvatarGroupProps[\"size\"]>, string> = {\n sm: \"-ml-2\",\n md: \"-ml-2\",\n lg: \"-ml-2\",\n};\n\nconst AvatarGroup = React.forwardRef<HTMLDivElement, AvatarGroupProps>(\n ({ avatars, max = 4, size = \"md\", className, ...props }, ref) => {\n const visible = avatars.slice(0, max);\n const overflowCount = avatars.length - max;\n const totalSlots = visible.length + (overflowCount > 0 ? 1 : 0);\n\n return (\n <div\n ref={ref}\n className={cn(\"flex items-center\", className)}\n {...props}\n >\n {visible.map((avatar, index) => {\n const zIndex = totalSlots - index;\n return (\n <Avatar\n key={index}\n className={cn(\n sizeClasses[size],\n overlapClasses[size],\n \"ring-2 ring-background border border-border shrink-0 transition-[margin] duration-[var(--duration-pg-fast,150ms)] ease-[var(--ease-pg-standard,cubic-bezier(0.4,0,0.2,1))] first:ml-0\",\n )}\n style={{ zIndex }}\n >\n {avatar.src && (\n <AvatarImage src={avatar.src} alt={avatar.alt ?? avatar.fallback} />\n )}\n <AvatarFallback\n className={cn(\n fontSizeClasses[size],\n \"font-medium\",\n )}\n >\n {avatar.fallback}\n </AvatarFallback>\n </Avatar>\n );\n })}\n\n {overflowCount > 0 && (\n <div\n className={cn(\n sizeClasses[size],\n overlapClasses[size],\n fontSizeClasses[size],\n \"relative shrink-0 flex items-center justify-center rounded-full border border-border bg-muted text-muted-foreground font-medium ring-2 ring-background transition-[margin] duration-[var(--duration-pg-fast,150ms)] ease-[var(--ease-pg-standard,cubic-bezier(0.4,0,0.2,1))]\",\n )}\n style={{ zIndex: 0 }}\n >\n +{overflowCount}\n </div>\n )}\n </div>\n );\n }\n);\n\nAvatarGroup.displayName = \"AvatarGroup\";\n\nexport { AvatarGroup };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\n\nexport type AvatarTagSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface AvatarTagProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Display label for the tag */\n label: string;\n /** Optional image src for the avatar */\n src?: string;\n /** Alt text for the avatar image */\n alt?: string;\n /** Size variant */\n size?: AvatarTagSize;\n /** Called when the remove button is clicked */\n onRemove?: () => void;\n /** Disables interaction */\n disabled?: boolean;\n}\n\nfunction getInitials(label: string): string {\n const words = label.trim().split(/\\s+/);\n if (words.length === 1) {\n return words[0].slice(0, 2).toUpperCase();\n }\n return (words[0][0] + words[words.length - 1][0]).toUpperCase();\n}\n\nconst sizeConfig: Record<\n AvatarTagSize,\n { avatar: string; text: string; icon: string; padding: string }\n> = {\n sm: {\n avatar: \"h-[18px] w-[18px]\",\n text: \"text-[10px]\",\n icon: \"size-2.5\",\n padding: \"px-1.5 py-0.5 gap-1\",\n },\n md: {\n avatar: \"h-5 w-5\",\n text: \"text-xs\",\n icon: \"size-3\",\n padding: \"px-2 py-0.5 gap-1\",\n },\n lg: {\n avatar: \"h-6 w-6\",\n text: \"text-sm\",\n icon: \"size-3.5\",\n padding: \"px-2.5 py-1 gap-1.5\",\n },\n};\n\nconst AvatarTag = React.forwardRef<HTMLSpanElement, AvatarTagProps>(\n (\n {\n label,\n src,\n alt,\n size = \"md\",\n onRemove,\n disabled = false,\n className,\n ...props\n },\n ref\n ) => {\n const cfg = sizeConfig[size];\n const initials = getInitials(label);\n\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center rounded-full border border-border bg-card font-medium transition-colors duration-[var(--duration-pg-fast,150ms)] ease-[var(--ease-pg-standard,cubic-bezier(0.4,0,0.2,1))]\",\n cfg.padding,\n cfg.text,\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {/* Avatar */}\n <AvatarPrimitive.Root\n className={cn(\n \"relative shrink-0 overflow-hidden rounded-full\",\n cfg.avatar\n )}\n >\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? label}\n className=\"aspect-square h-full w-full object-cover\"\n />\n <AvatarPrimitive.Fallback\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-primary/10 text-primary font-semibold leading-none\",\n cfg.text\n )}\n >\n {initials}\n </AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n\n {/* Label */}\n <span className=\"leading-none select-none\">{label}</span>\n\n {/* Remove button */}\n {onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n if (!disabled) onRemove();\n }}\n disabled={disabled}\n className={cn(\n \"flex items-center justify-center rounded-full opacity-60 transition-opacity duration-[var(--duration-pg-fast,150ms)] hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n disabled && \"pointer-events-none\"\n )}\n aria-label={`Remove ${label}`}\n >\n <X className={cfg.icon} />\n </button>\n )}\n </span>\n );\n }\n);\n\nAvatarTag.displayName = \"AvatarTag\";\n\nexport { AvatarTag };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButtonProps,\n type DayPickerProps,\n} from \"react-day-picker\";\n\nimport { Button } from \"./button\";\nimport type { ButtonProps } from \"./button\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nconst cellSize = \"[--cell-size:2rem]\";\n\nfunction navButtonClasses(variant: NonNullable<ButtonProps[\"variant\"]>): string {\n const base =\n \"inline-flex items-center justify-center rounded-lg border font-medium transition-colors duration-pg-fast ease-pg-standard focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35 disabled:pointer-events-none disabled:opacity-50\";\n switch (variant) {\n case \"outline\":\n return cn(\n base,\n elevation.control,\n \"border-border bg-card text-foreground hover:bg-muted\"\n );\n case \"ghost\":\n default:\n return cn(\n base,\n \"border-transparent bg-transparent text-foreground hover:bg-muted focus-visible:bg-muted/80 active:bg-muted/90\"\n );\n }\n}\n\nexport type CalendarProps = DayPickerProps & {\n buttonVariant?: ButtonProps[\"variant\"];\n};\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale,\n formatters,\n components,\n showWeekNumber,\n ...props\n}: CalendarProps) {\n const defaultClassNames = getDefaultClassNames();\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n showWeekNumber={showWeekNumber}\n locale={locale}\n className={cn(\n \"group/calendar bg-background p-3\",\n cellSize,\n \"[[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent\",\n String.raw`rtl:**:[.rdp-button_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button_previous>svg]:rotate-180`,\n className\n )}\n captionLayout={captionLayout}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(locale?.code ?? \"default\", { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n nav: cn(\n \"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n navButtonClasses(buttonVariant),\n \"h-[var(--cell-size)] w-[var(--cell-size)] min-h-0 min-w-0 shrink-0 p-0 select-none\",\n defaultClassNames.button_previous\n ),\n button_next: cn(\n navButtonClasses(buttonVariant),\n \"h-[var(--cell-size)] w-[var(--cell-size)] min-h-0 min-w-0 shrink-0 p-0 select-none\",\n defaultClassNames.button_next\n ),\n month_caption: cn(\n \"flex h-[var(--cell-size)] w-full items-center justify-center px-[var(--cell-size)]\",\n defaultClassNames.month_caption\n ),\n dropdowns: cn(\n \"flex h-[var(--cell-size)] w-full items-center justify-center gap-1.5 text-sm font-medium\",\n defaultClassNames.dropdowns\n ),\n dropdown_root: cn(\n \"relative rounded-md border border-border bg-card focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/35\",\n elevation.field,\n defaultClassNames.dropdown_root\n ),\n dropdown: cn(\"absolute inset-0 cursor-pointer opacity-0\", defaultClassNames.dropdown),\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n month_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n \"flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none\",\n defaultClassNames.weekday\n ),\n week: cn(\"mt-2 flex w-full\", defaultClassNames.week),\n week_number_header: cn(\n \"w-[var(--cell-size)] select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\n day: cn(\n \"group/day relative aspect-square h-full w-full p-0 text-center select-none\",\n \"[&:last-child[data-selected=true]_button]:rounded-r-md\",\n showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-md\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-md\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"rounded-l-md bg-accent\",\n defaultClassNames.range_start\n ),\n range_middle: cn(\"rounded-none bg-accent/60\", defaultClassNames.range_middle),\n range_end: cn(\"rounded-r-md bg-accent\", defaultClassNames.range_end),\n today: cn(\n \"rounded-md bg-muted text-foreground data-[selected=true]:rounded-none\",\n defaultClassNames.today\n ),\n outside: cn(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\"text-muted-foreground opacity-50\", defaultClassNames.disabled),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className: rootClass, rootRef, ...rootProps }) => (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(rootClass)}\n {...rootProps}\n />\n ),\n Chevron: ({ className: chClass, orientation, ...chProps }) => {\n if (orientation === \"left\") {\n return <ChevronLeft className={cn(\"size-4\", chClass)} {...chProps} />;\n }\n if (orientation === \"right\") {\n return <ChevronRight className={cn(\"size-4\", chClass)} {...chProps} />;\n }\n return <ChevronDown className={cn(\"size-4\", chClass)} {...chProps} />;\n },\n DayButton: CalendarDayButton,\n WeekNumber: ({ children, ...weekProps }) => (\n <th {...weekProps}>\n <div className=\"flex h-[var(--cell-size)] w-[var(--cell-size)] min-h-[var(--cell-size)] min-w-[var(--cell-size)] items-center justify-center text-center text-xs tabular-nums\">\n {children}\n </div>\n </th>\n ),\n ...components,\n }}\n {...props}\n />\n );\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n ...props\n}: DayButtonProps) {\n const defaultClassNames = getDefaultClassNames();\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n return (\n <Button\n ref={ref}\n type=\"button\"\n variant=\"ghost\"\n {...props}\n disabled={Boolean(modifiers.disabled) || props.disabled}\n data-day={day.date.toLocaleDateString()}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n \"flex aspect-square h-auto min-h-[var(--cell-size)] w-full min-w-[var(--cell-size)] flex-col gap-1 rounded-md p-0 font-normal leading-none data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground hover:bg-muted/80 dark:hover:bg-muted/50 [&>span]:text-xs [&>span]:opacity-70\",\n \"group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/35\",\n defaultClassNames.day,\n className\n )}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n","\"use client\";\n\nimport { useState, useRef, useEffect, useMemo, useCallback } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { ChevronLeft, ChevronRight, ChevronDown, CalendarDays } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\n/* ─── Constants ─────────────────────────────────────────────────────────── */\nconst MONTHS = [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\"];\nconst DAYS = [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"];\nconst PRIMARY = \"#0061E3\";\n\n/** Width of the calendar half. The time columns are added to it. */\nconst CALENDAR_W = 296;\nconst TIME_COL_W = 58;\n/** One row in a time column. */\nconst TIME_ITEM_H = 28;\n/** Visible height of a time column, sized to sit flush with the day grid. */\nconst TIME_COL_H = 232;\n\n/* ─── Helpers ────────────────────────────────────────────────────────────── */\nfunction daysInMonth(y: number, m: number) { return new Date(y, m + 1, 0).getDate(); }\nfunction firstDayOf(y: number, m: number) { return new Date(y, m, 1).getDay(); }\nfunction pad(n: number) { return String(n).padStart(2, \"0\"); }\n\n/**\n * A parsed picker value. `hh`/`mm`/`ss` are the 24-hour clock, and are 0 for a\n * date-only value — a value carrying no time is \"midnight\", the same reading\n * antd gives it.\n */\ninterface Parts { y: number; m: number; d: number; hh: number; mm: number; ss: number }\n\n/**\n * Accepts `YYYY-MM-DD`, `YYYY-MM-DD HH:mm` and `YYYY-MM-DD HH:mm:ss`, so a\n * picker switched to `showTime` still reads back a value written before it was,\n * and `min`/`max` can be given as plain dates whatever the value carries.\n */\nfunction parseValue(s: string): Parts | null {\n if (!s) return null;\n const [datePart, timePart = \"\"] = s.trim().split(/[ T]/);\n const [y, m, d] = datePart.split(\"-\").map(Number);\n if (!y || !m || !d) return null;\n const [hh = 0, mm = 0, ss = 0] = timePart ? timePart.split(\":\").map(Number) : [];\n return {\n y,\n m: m - 1,\n d,\n hh: Number.isFinite(hh) ? hh : 0,\n mm: Number.isFinite(mm) ? mm : 0,\n ss: Number.isFinite(ss) ? ss : 0,\n };\n}\n\n/** Kept as the old name so nothing that imported it has to change. */\nfunction parseYMD(s: string) {\n const p = parseValue(s);\n return p ? { y: p.y, m: p.m, d: p.d } : null;\n}\n\nfunction toYMD(y: number, m: number, d: number) {\n return `${y}-${pad(m + 1)}-${pad(d)}`;\n}\n\n/**\n * The string this picker emits. Date-only unless a time is being shown, so a\n * picker without `showTime` keeps emitting exactly what it always did.\n */\nfunction formatValue(p: Parts, showTime: boolean, showSecond: boolean) {\n const date = toYMD(p.y, p.m, p.d);\n if (!showTime) return date;\n return showSecond\n ? `${date} ${pad(p.hh)}:${pad(p.mm)}:${pad(p.ss)}`\n : `${date} ${pad(p.hh)}:${pad(p.mm)}`;\n}\n\n/** 12-hour, to match every other timestamp flux renders. */\nfunction displayTime(p: Parts, showSecond: boolean) {\n const period = p.hh < 12 ? \"AM\" : \"PM\";\n const h12 = p.hh % 12 === 0 ? 12 : p.hh % 12;\n const base = showSecond\n ? `${pad(h12)}:${pad(p.mm)}:${pad(p.ss)}`\n : `${pad(h12)}:${pad(p.mm)}`;\n return `${base} ${period}`;\n}\n\nfunction displayValue(value: string, showTime: boolean, showSecond: boolean) {\n const p = parseValue(value);\n if (!p) return \"\";\n const date = `${pad(p.d)} ${MONTHS[p.m].slice(0, 3)} ${p.y}`;\n return showTime ? `${date}, ${displayTime(p, showSecond)}` : date;\n}\n\n/** `1`, or a step floored to at least 1 — a step of 0 would loop forever. */\nfunction step(n: number | undefined) {\n return Math.max(1, Math.floor(n ?? 1));\n}\n\n/* ─── Props ─────────────────────────────────────────────────────────────── */\n\n/**\n * `showTime`'s options, following antd's prop of the same name.\n *\n * Two defaults differ from antd's, both because of what flux renders elsewhere:\n * `use12Hours` is **on** (antd defaults it off) because `formatDateTime` prints\n * every timestamp in this library with `hour12`, and entering \"23:55\" to read it\n * back as \"11:55 PM\" is the mismatch that makes a reviewer check a row twice;\n * and `showSecond` is **off** (antd defaults it on) because nothing in flux\n * records a second.\n */\nexport interface DatePickerTimeOptions {\n /** Hour column is 12-hour with an AM/PM column beside it. Default `true`. */\n use12Hours?: boolean;\n /** Add a seconds column, and put seconds in the emitted value. Default `false`. */\n showSecond?: boolean;\n hourStep?: number;\n minuteStep?: number;\n secondStep?: number;\n /** `HH:mm[:ss]` used when a day is picked before any time. Default `\"00:00\"`. */\n defaultValue?: string;\n}\n\ninterface DatePickerProps {\n /**\n * `YYYY-MM-DD`, or `YYYY-MM-DD HH:mm` (`HH:mm:ss` with `showSecond`) when\n * `showTime` is set — the same widening antd does to its value when a time is\n * shown.\n */\n value: string;\n onChange: (v: string) => void;\n placeholder?: string;\n className?: string;\n /** Earliest selectable date, `YYYY-MM-DD`. Days before it are struck out. */\n min?: string;\n /**\n * Latest selectable date, `YYYY-MM-DD`.\n *\n * Its absence is why a feature ended up hand-rolling a whole date chip to\n * enforce an upper bound on Apply instead — an error after the fact, where\n * the calendar could have said so before the click.\n */\n max?: string;\n label?: string;\n /**\n * Put time columns beside the calendar, so a day and the time on it are one\n * control rather than two fields that can disagree.\n *\n * Follows antd: the panel gains Hr / Min (/ Sec) (/ AM-PM) columns and a\n * footer, picking a day no longer closes the panel, and **OK** is what\n * commits. `onChange` still fires on every edit — OK closes, it does not\n * gate the value — so a controlled caller sees each change as it happens.\n */\n showTime?: boolean | DatePickerTimeOptions;\n /**\n * antd's `showNow`: the \"Now\" shortcut in the footer. Default `true` when a\n * time is shown, and ignored otherwise.\n */\n showNow?: boolean;\n}\n\n/* ─── Time column ────────────────────────────────────────────────────────── */\n\n/**\n * One scrollable unit column.\n *\n * The selected row is scrolled to the **top** rather than centred, which is\n * antd's behaviour and the reason each column is padded underneath: without the\n * padding the last few values can never reach the top and look unreachable.\n */\nfunction TimeColumn<T extends string | number>({\n label,\n items,\n selected,\n onSelect,\n render,\n}: {\n label: string;\n items: T[];\n selected: T;\n onSelect: (item: T) => void;\n render?: (item: T) => string;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const index = items.indexOf(selected);\n\n // Scrolled with the panel's own layout effect timing rather than on every\n // render: a click that lands mid-scroll would otherwise fight the animation.\n useEffect(() => {\n const el = ref.current;\n if (!el || index < 0) return;\n el.scrollTo({ top: index * TIME_ITEM_H, behavior: \"smooth\" });\n }, [index]);\n\n return (\n <div className=\"flex flex-col border-l border-border\" style={{ width: TIME_COL_W }}>\n <div className=\"py-1 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n {label}\n </div>\n <div\n ref={ref}\n className=\"overflow-y-auto\"\n style={{ height: TIME_COL_H, scrollbarWidth: \"none\", msOverflowStyle: \"none\" }}\n >\n {items.map((item) => {\n const active = item === selected;\n return (\n <button\n key={String(item)}\n type=\"button\"\n onClick={() => onSelect(item)}\n className={cn(\n \"flex w-full items-center justify-center rounded-md text-[13px] font-medium transition-colors\",\n active\n ? \"font-semibold text-white\"\n : \"text-foreground hover:bg-muted\",\n )}\n style={{ height: TIME_ITEM_H, background: active ? PRIMARY : undefined }}\n >\n {render ? render(item) : String(item)}\n </button>\n );\n })}\n {/* Lets the final value reach the top of the column. */}\n <div style={{ height: TIME_COL_H - TIME_ITEM_H }} />\n </div>\n </div>\n );\n}\n\n/* ─── DatePicker ─────────────────────────────────────────────────────────── */\nexport function DatePicker({ value, onChange, placeholder = \"Select date\", className, min, max, label, showTime = false, showNow = true }: DatePickerProps) {\n const today = new Date();\n const parsed = parseValue(value);\n\n const timeOptions: DatePickerTimeOptions = useMemo(\n () => (typeof showTime === \"object\" ? showTime : {}),\n [showTime]\n );\n const withTime = showTime !== false && showTime !== undefined;\n const use12Hours = timeOptions.use12Hours ?? true;\n const showSecond = timeOptions.showSecond ?? false;\n\n const [open, setOpen] = useState(false);\n const [panelPos, setPanelPos] = useState({ top: 0, left: 0 });\n const [viewYear, setViewYear] = useState(parsed?.y ?? today.getFullYear());\n const [viewMonth, setViewMonth] = useState(parsed?.m ?? today.getMonth());\n const [yearMenu, setYearMenu] = useState(false);\n const [monthMenu, setMonthMenu] = useState(false);\n const [mounted, setMounted] = useState(false);\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => { setMounted(true); }, []);\n\n /* Sync view when value changes */\n useEffect(() => {\n if (parsed) { setViewYear(parsed.y); setViewMonth(parsed.m); }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n /* ── Panel size, which the time columns widen ── */\n const columnCount = withTime ? (showSecond ? 3 : 2) + (use12Hours ? 1 : 0) : 0;\n const PANEL_W = CALENDAR_W + columnCount * TIME_COL_W;\n // Calendar body, plus the footer that only exists when a time is shown.\n const PANEL_H = withTime ? 392 : 340;\n\n /* Compute fixed position from trigger rect */\n function openPanel() {\n if (!triggerRef.current) return;\n const trigger = triggerRef.current;\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n\n // Scroll trigger into view so panel can appear next to it (avoids panel far from input in scrollable forms)\n trigger.scrollIntoView({ block: \"center\", behavior: \"auto\" });\n\n requestAnimationFrame(() => {\n if (!triggerRef.current) return;\n const rect = triggerRef.current.getBoundingClientRect();\n\n // Horizontal: align left edge, clamp so it doesn't go off screen\n let left = rect.left;\n if (left + PANEL_W > vw - 8) left = vw - PANEL_W - 8;\n if (left < 8) left = 8;\n\n // Vertical: prefer below trigger; if not enough room open above\n let top = rect.bottom + 6;\n if (top + PANEL_H > vh - 8) top = rect.top - PANEL_H - 6;\n if (top < 8) top = 8;\n\n setPanelPos({ top, left });\n setOpen(true);\n });\n }\n\n function closePanel() {\n setOpen(false); setYearMenu(false); setMonthMenu(false);\n }\n\n /* Close on outside click */\n useEffect(() => {\n if (!open) return;\n function handler(e: MouseEvent) {\n const inTrigger = triggerRef.current?.contains(e.target as Node);\n const inPanel = panelRef.current?.contains(e.target as Node);\n if (!inTrigger && !inPanel) closePanel();\n }\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n /* Navigation */\n function prevMonth() {\n if (viewMonth === 0) { setViewMonth(11); setViewYear(y => y - 1); }\n else setViewMonth(m => m - 1);\n }\n function nextMonth() {\n if (viewMonth === 11) { setViewMonth(0); setViewYear(y => y + 1); }\n else setViewMonth(m => m + 1);\n }\n\n /* Day grid */\n const totalDays = daysInMonth(viewYear, viewMonth);\n const firstDay = firstDayOf(viewYear, viewMonth);\n const prevTotal = daysInMonth(viewYear, viewMonth === 0 ? 11 : viewMonth - 1);\n const minParsed = parseYMD(min ?? \"\");\n const maxParsed = parseYMD(max ?? \"\");\n\n function isDisabled(y: number, m: number, d: number) {\n const day = new Date(y, m, d);\n if (minParsed && day < new Date(minParsed.y, minParsed.m, minParsed.d)) return true;\n if (maxParsed && day > new Date(maxParsed.y, maxParsed.m, maxParsed.d)) return true;\n return false;\n }\n\n type Cell = { d: number; m: number; y: number; current: boolean };\n const cells: Cell[] = [];\n for (let i = 0; i < firstDay; i++) {\n const d = prevTotal - firstDay + 1 + i;\n const m = viewMonth === 0 ? 11 : viewMonth - 1;\n const y = viewMonth === 0 ? viewYear - 1 : viewYear;\n cells.push({ d, m, y, current: false });\n }\n for (let d = 1; d <= totalDays; d++) cells.push({ d, m: viewMonth, y: viewYear, current: true });\n const remaining = 42 - cells.length;\n for (let d = 1; d <= remaining; d++) {\n const m = viewMonth === 11 ? 0 : viewMonth + 1;\n const y = viewMonth === 11 ? viewYear + 1 : viewYear;\n cells.push({ d, m, y, current: false });\n }\n\n const years = Array.from({ length: 15 }, (_, i) => today.getFullYear() - 2 + i);\n\n /* ── The time half ── */\n\n /**\n * The time the columns show. A value with no time yet reads as `defaultValue`\n * (midnight unless the caller says otherwise) so the columns always have a\n * row highlighted rather than starting blank.\n */\n const fallback = parseValue(`2000-01-01 ${timeOptions.defaultValue ?? \"00:00\"}`)!;\n const current: Parts = parsed ?? {\n y: today.getFullYear(), m: today.getMonth(), d: today.getDate(),\n hh: fallback.hh, mm: fallback.mm, ss: fallback.ss,\n };\n\n const emit = useCallback(\n (next: Parts) => onChange(formatValue(next, withTime, showSecond)),\n [onChange, withTime, showSecond]\n );\n\n /**\n * Editing a time before a day has been picked commits today's date along with\n * it — antd does the same, and the alternative is a time that silently goes\n * nowhere until a day is clicked.\n */\n function patchTime(patch: Partial<Pick<Parts, \"hh\" | \"mm\" | \"ss\">>) {\n emit({ ...current, ...patch });\n }\n\n const hourStep = step(timeOptions.hourStep);\n const minuteStep = step(timeOptions.minuteStep);\n const secondStep = step(timeOptions.secondStep);\n\n // 12-hour runs 12, 01 … 11 rather than 01 … 12, because 12 AM is midnight and\n // so is the first hour of the block — the order antd uses, and ascending by\n // the underlying 24-hour value.\n const hourItems = use12Hours\n ? Array.from({ length: Math.ceil(12 / hourStep) }, (_, i) => (i * hourStep) % 12)\n : Array.from({ length: Math.ceil(24 / hourStep) }, (_, i) => i * hourStep);\n const minuteItems = Array.from({ length: Math.ceil(60 / minuteStep) }, (_, i) => i * minuteStep);\n const secondItems = Array.from({ length: Math.ceil(60 / secondStep) }, (_, i) => i * secondStep);\n\n const selectedHour = use12Hours ? current.hh % 12 : current.hh;\n const selectedMeridiem: \"AM\" | \"PM\" = current.hh < 12 ? \"AM\" : \"PM\";\n\n function selectHour(h: number) {\n if (!use12Hours) return patchTime({ hh: h });\n patchTime({ hh: selectedMeridiem === \"AM\" ? h : h + 12 });\n }\n function selectMeridiem(p: string) {\n const base = current.hh % 12;\n patchTime({ hh: p === \"AM\" ? base : base + 12 });\n }\n\n function selectDay(cell: Cell) {\n if (!cell.current) { setViewYear(cell.y); setViewMonth(cell.m); }\n if (cell.current && isDisabled(cell.y, cell.m, cell.d)) return;\n emit({ y: cell.y, m: cell.m, d: cell.d, hh: current.hh, mm: current.mm, ss: current.ss });\n // With a time panel open the day is only half the answer, so the panel\n // stays up and OK is what closes it. This is antd's behaviour, and without\n // it the panel would shut before a time could be picked.\n if (!withTime) setOpen(false);\n }\n\n function selectNow() {\n const n = new Date();\n if (isDisabled(n.getFullYear(), n.getMonth(), n.getDate())) return;\n emit({\n y: n.getFullYear(), m: n.getMonth(), d: n.getDate(),\n hh: n.getHours(), mm: n.getMinutes(), ss: n.getSeconds(),\n });\n closePanel();\n }\n\n const isToday = (c: Cell) => c.d === today.getDate() && c.m === today.getMonth() && c.y === today.getFullYear();\n const isSelected = (c: Cell) => !!parsed && c.d === parsed.d && c.m === parsed.m && c.y === parsed.y;\n\n /* ── Calendar half ── */\n const calendar = (\n <div style={{ width: CALENDAR_W }} className=\"flex flex-col\">\n {/* Header */}\n <div className=\"flex items-center justify-between px-4 pt-4 pb-3\">\n <button type=\"button\" onClick={prevMonth}\n className=\"w-8 h-8 rounded-full flex items-center justify-center text-muted-foreground hover:bg-muted transition-colors\">\n <ChevronLeft className=\"w-4 h-4\" />\n </button>\n\n <div className=\"flex items-center gap-1\">\n {/* Month */}\n <div className=\"relative\">\n <button type=\"button\" onClick={() => { setMonthMenu(o => !o); setYearMenu(false); }}\n className=\"flex items-center gap-1 px-2 py-1 rounded-lg text-[14px] font-semibold text-foreground hover:bg-muted transition-colors\">\n {MONTHS[viewMonth].slice(0, 3)}\n <ChevronDown className=\"w-3 h-3 text-muted-foreground\" />\n </button>\n <AnimatePresence>\n {monthMenu && (\n <motion.div\n initial={{ opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }}\n transition={{ duration: 0.12 }}\n className={`absolute top-full left-0 z-[10000] mt-1 max-h-[220px] min-w-[130px] overflow-y-auto rounded-xl border border-border bg-popover py-1 ${elevation.popover}`}\n >\n {MONTHS.map((mn, mi) => (\n <button type=\"button\" key={mn} onClick={() => { setViewMonth(mi); setMonthMenu(false); }}\n className=\"w-full px-3 py-2 text-left text-[13px] text-foreground transition-colors hover:bg-muted\"\n style={{ fontWeight: mi === viewMonth ? 600 : 400, color: mi === viewMonth ? PRIMARY : undefined }}\n >\n {mn}\n </button>\n ))}\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n\n {/* Year */}\n <div className=\"relative\">\n <button type=\"button\" onClick={() => { setYearMenu(o => !o); setMonthMenu(false); }}\n className=\"flex items-center gap-1 px-2 py-1 rounded-lg text-[14px] font-semibold text-foreground hover:bg-muted transition-colors\">\n {viewYear}\n <ChevronDown className=\"w-3 h-3 text-muted-foreground\" />\n </button>\n <AnimatePresence>\n {yearMenu && (\n <motion.div\n initial={{ opacity: 0, y: -4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }}\n transition={{ duration: 0.12 }}\n className={`absolute top-full left-0 z-[10000] mt-1 max-h-[200px] min-w-[90px] overflow-y-auto rounded-xl border border-border bg-popover py-1 ${elevation.popover}`}\n >\n {years.map(yr => (\n <button type=\"button\" key={yr} onClick={() => { setViewYear(yr); setYearMenu(false); }}\n className=\"w-full px-3 py-2 text-left text-[13px] text-foreground transition-colors hover:bg-muted\"\n style={{ fontWeight: yr === viewYear ? 600 : 400, color: yr === viewYear ? PRIMARY : undefined }}\n >\n {yr}\n </button>\n ))}\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n </div>\n\n <button type=\"button\" onClick={nextMonth}\n className=\"w-8 h-8 rounded-full flex items-center justify-center text-muted-foreground hover:bg-muted transition-colors\">\n <ChevronRight className=\"w-4 h-4\" />\n </button>\n </div>\n\n {/* Day headers — explicit grid: Tailwind grid-cols-7 can be dropped from CSS output for portalled nodes */}\n <div\n className=\"px-3 pb-1\"\n style={{ display: \"grid\", gridTemplateColumns: \"repeat(7, minmax(0, 1fr))\" }}\n >\n {DAYS.map((d) => (\n <div key={d} className=\"py-1 text-center text-[11.5px] font-semibold text-muted-foreground\">\n {d}\n </div>\n ))}\n </div>\n\n {/* Day grid */}\n <div\n className=\"gap-y-0.5 px-3 pb-4\"\n style={{ display: \"grid\", gridTemplateColumns: \"repeat(7, minmax(0, 1fr))\" }}\n >\n {cells.map((cell, i) => {\n const selected = isSelected(cell);\n const tod = isToday(cell);\n const disabled = cell.current && isDisabled(cell.y, cell.m, cell.d);\n return (\n <button type=\"button\" key={i} onClick={() => selectDay(cell)} disabled={disabled}\n className={cn(\n \"h-9 w-9 mx-auto rounded-full text-[13px] font-medium flex items-center justify-center transition-all\",\n selected && \"text-white font-semibold\",\n !selected && tod && \"font-semibold\",\n !selected && !tod && cell.current && !disabled && \"text-gray-800 hover:bg-gray-100\",\n !selected && !cell.current && \"text-gray-300 hover:bg-gray-50\",\n disabled && \"opacity-30 cursor-not-allowed\",\n )}\n style={selected ? { background: PRIMARY } : tod ? { background: `${PRIMARY}18`, color: PRIMARY } : {}}>\n {cell.d}\n </button>\n );\n })}\n </div>\n </div>\n );\n\n /* ── Time half ── */\n const timeColumns = withTime && (\n <div className=\"flex pt-3\">\n <TimeColumn\n label=\"Hr\"\n items={hourItems}\n selected={selectedHour}\n onSelect={selectHour}\n render={(h) => pad(use12Hours && h === 0 ? 12 : h)}\n />\n <TimeColumn label=\"Min\" items={minuteItems} selected={current.mm} onSelect={(m) => patchTime({ mm: m })} render={pad} />\n {showSecond && (\n <TimeColumn label=\"Sec\" items={secondItems} selected={current.ss} onSelect={(s) => patchTime({ ss: s })} render={pad} />\n )}\n {use12Hours && (\n <TimeColumn label=\"AM/PM\" items={[\"AM\", \"PM\"]} selected={selectedMeridiem} onSelect={selectMeridiem} />\n )}\n </div>\n );\n\n const body = (\n <>\n <div className=\"flex\">\n {calendar}\n {timeColumns}\n </div>\n\n {/* Footer only exists alongside a time panel: with no time to pick, a day\n click is the whole answer and an OK button would be a second click for\n nothing. Same rule antd applies. */}\n {withTime && (\n <div className=\"flex items-center justify-between border-t border-border px-4 py-2.5\">\n {showNow ? (\n <button type=\"button\" onClick={selectNow}\n className=\"rounded-md px-1 text-[13px] font-medium transition-colors hover:underline\"\n style={{ color: PRIMARY }}>\n Now\n </button>\n ) : <span />}\n <button type=\"button\" onClick={closePanel}\n className=\"rounded-lg px-3 py-1.5 text-[13px] font-semibold text-white transition-opacity hover:opacity-90\"\n style={{ background: PRIMARY }}>\n OK\n </button>\n </div>\n )}\n </>\n );\n\n /* ── Calendar panel (portalled) ── */\n const panel = (\n <AnimatePresence>\n {open && (\n <motion.div\n ref={panelRef}\n initial={{ opacity: 0, scale: 0.97, y: -6 }}\n animate={{ opacity: 1, scale: 1, y: 0 }}\n exit={{ opacity: 0, scale: 0.97, y: -6 }}\n transition={{ duration: 0.16, ease: [0.16, 1, 0.3, 1] }}\n className={cn(\n \"isolate rounded-2xl border border-border bg-popover text-popover-foreground select-none dark:shadow-black/40\",\n elevation.popover\n )}\n style={{\n position: \"fixed\",\n top: panelPos.top,\n left: panelPos.left,\n width: PANEL_W,\n zIndex: 20000,\n // A modal Radix Dialog sets `pointer-events: none` on <body> while\n // it is open, and this panel is portaled to <body> — so without\n // this every click on a day landed on nothing and the calendar\n // looked frozen inside a Dialog or Drawer. Hit-testing is\n // per-element, so re-enabling it here is enough; the page behind\n // the dialog stays inert. The click still reaches the dialog's\n // DismissableLayer through React's portal event propagation, so it\n // is treated as inside and does not dismiss the dialog.\n pointerEvents: \"auto\",\n backgroundColor: \"var(--popover)\",\n boxShadow: \"0 16px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07)\",\n }}\n >\n {/* The time columns are the only scrollable region this panel has, and\n a portalled node is neither the lock container nor a shard of a\n modal Dialog's `RemoveScroll` — so react-remove-scroll would\n `preventDefault()` every wheel event over them and leave only the\n rows already on screen reachable. Taking the top of the lock stack\n hands scrolling back, the same way TimePicker and Radix `Select`\n do. Mounted only with a time panel: the date-only panel has\n nothing to scroll and should not lock the page. */}\n {withTime ? <RemoveScroll allowPinchZoom>{body}</RemoveScroll> : body}\n </motion.div>\n )}\n </AnimatePresence>\n );\n\n return (\n <div className={cn(\"relative\", className)}>\n {label && <p className=\"mb-2 text-sm font-medium text-foreground\">{label}</p>}\n\n {/* Trigger */}\n <button\n ref={triggerRef}\n type=\"button\"\n onClick={() => open ? closePanel() : openPanel()}\n className={cn(\n \"flex h-12 min-h-12 w-full items-center gap-3 rounded-xl border border-border bg-card px-5 text-left text-[15px] transition-colors\",\n elevation.field,\n open ? \"border-ring ring-2 ring-ring/20\" : \"hover:border-muted-foreground/45\",\n )}\n >\n <CalendarDays className=\"size-[1.125rem] shrink-0 text-muted-foreground\" />\n <span className={cn(\"flex-1\", value ? \"text-foreground\" : \"text-muted-foreground\")}>\n {value ? displayValue(value, withTime, showSecond) : placeholder}\n </span>\n <ChevronDown className={cn(\"size-[1.125rem] shrink-0 text-muted-foreground transition-transform\", open && \"rotate-180\")} />\n </button>\n\n {/* Portal. Wrapped so the panel takes over the scroll lock when it opens\n inside a Dialog or Drawer — without it the year/month lists and the\n time columns cannot be scrolled with the wheel. See `scroll-lock.tsx`. */}\n {mounted &&\n createPortal(<ScrollLockTakeover>{panel}</ScrollLockTakeover>, document.body)}\n </div>\n );\n}\n","\"use client\"\n\n/**\n * Chart primitives from shadcn/ui (Recharts composition layer).\n * @see https://ui.shadcn.com/docs/components/radix/chart\n */\n\nimport * as React from \"react\"\nimport * as RechartsPrimitive from \"recharts\"\nimport type { TooltipValueType } from \"recharts\"\n\nimport { cn } from \"./utils\"\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const\ntype TooltipNameType = number | string\n\nexport type ChartConfig = Record<\n string,\n {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n )\n>\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error(\"useChart must be used within a <ChartContainer />\")\n }\n\n return context\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n initialDimension = INITIAL_DIMENSION,\n ...props\n}: React.ComponentProps<\"div\"> & {\n config: ChartConfig\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >[\"children\"]\n initialDimension?: {\n width: number\n height: number\n }\n}) {\n const uniqueId = React.useId()\n const chartId = `chart-${id ?? uniqueId.replace(/:/g, \"\")}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-slot=\"chart\"\n data-chart={chartId}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer\n initialDimension={initialDimension}\n >\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme ?? config.color\n )\n\n if (!colorConfig.length) {\n return null\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??\n itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join(\"\\n\")}\n}\n`\n )\n .join(\"\\n\"),\n }}\n />\n )\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n active,\n payload,\n className,\n indicator = \"dot\",\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<\"div\"> & {\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n nameKey?: string\n labelKey?: string\n } & Omit<\n RechartsPrimitive.DefaultTooltipContentProps<\n TooltipValueType,\n TooltipNameType\n >,\n \"accessibilityLayer\"\n >) {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey ?? item?.dataKey ?? item?.name ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === \"string\"\n ? (config[label]?.label ?? label)\n : itemConfig?.label\n\n if (labelFormatter) {\n return (\n <div className={cn(\"font-medium\", labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n )\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n <div\n className={cn(\n \"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl\",\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color ?? item.payload?.fill ?? item.color\n\n return (\n <div\n key={index}\n className={cn(\n \"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\n \"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)\",\n {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"w-1\": indicator === \"line\",\n \"w-0 border-[1.5px] border-dashed bg-transparent\":\n indicator === \"dashed\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n }\n )}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n \"flex flex-1 justify-between leading-none\",\n nestLabel ? \"items-end\" : \"items-center\"\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">\n {itemConfig?.label ?? item.name}\n </span>\n </div>\n {item.value != null && (\n <span className=\"font-mono font-medium text-foreground tabular-nums\">\n {typeof item.value === \"number\"\n ? item.value.toLocaleString()\n : String(item.value)}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = \"bottom\",\n nameKey,\n}: React.ComponentProps<\"div\"> & {\n hideIcon?: boolean\n nameKey?: string\n} & RechartsPrimitive.DefaultLegendContentProps) {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n className={cn(\n \"flex items-center justify-center gap-4\",\n verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n className\n )}\n >\n {payload\n .filter((item) => item.type !== \"none\")\n .map((item, index) => {\n const key = `${nameKey ?? item.dataKey ?? \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={index}\n className={cn(\n \"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground\"\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n}\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== \"object\" || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n \"payload\" in payload &&\n typeof payload.payload === \"object\" &&\n payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === \"string\"\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key]\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Line,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport {\n ArrowDownRight,\n ArrowUpRight,\n ExternalLink,\n Info,\n Minus,\n} from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { Button } from \"./button\";\nimport { Separator } from \"./separator\";\n\nconst gridStroke = \"color-mix(in srgb, var(--border) 65%, transparent)\";\nconst tickFill = \"var(--muted-foreground)\";\n\n/** ─── KPI + sparkline (dashboard stat tiles) ─────────────────────────── */\n\nexport type MetricSparklinePoint = { x: string | number; y: number };\n\nexport type MetricSparklineCardProps = {\n title: string;\n icon?: React.ReactNode;\n value: React.ReactNode;\n /** e.g. \"+8.4% vs last month\" */\n trend?: { direction: \"up\" | \"down\" | \"flat\"; label: string };\n data: MetricSparklinePoint[];\n /** Stroke / gradient accent (CSS color) */\n accentColor?: string;\n className?: string;\n onInfoClick?: () => void;\n};\n\nexport function MetricSparklineCard({\n title,\n icon,\n value,\n trend,\n data,\n accentColor = \"var(--chart-1)\",\n className,\n onInfoClick,\n}: MetricSparklineCardProps) {\n const gid = React.useId().replace(/:/g, \"\");\n const chartData = data.map((d) => ({ ...d, y: d.y }));\n\n const trendCls =\n trend?.direction === \"up\"\n ? \"text-emerald-600 dark:text-emerald-400\"\n : trend?.direction === \"down\"\n ? \"text-red-600 dark:text-red-400\"\n : \"text-muted-foreground\";\n\n const TrendIcon =\n trend?.direction === \"up\" ? ArrowUpRight : trend?.direction === \"down\" ? ArrowDownRight : Minus;\n\n return (\n <div\n className={cn(\n \"relative overflow-hidden rounded-xl border border-border bg-card p-5 text-card-foreground\",\n elevation.surface,\n className\n )}\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n {icon ? <span className=\"flex shrink-0 text-muted-foreground [&_svg]:size-4\">{icon}</span> : null}\n <span className=\"truncate text-sm font-semibold text-foreground\">{title}</span>\n </div>\n {onInfoClick ? (\n <button\n type=\"button\"\n onClick={onInfoClick}\n className=\"shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n aria-label=\"More info\"\n >\n <Info className=\"size-3.5\" />\n </button>\n ) : null}\n </div>\n\n <div className=\"mt-3 text-2xl font-semibold tabular-nums tracking-tight text-foreground\">{value}</div>\n\n <div className=\"pointer-events-none absolute bottom-3 right-3 h-14 w-[46%] max-w-[9rem] opacity-95\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={chartData} margin={{ top: 4, right: 0, left: 0, bottom: 0 }}>\n <defs>\n <linearGradient id={gid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={accentColor} stopOpacity={0.35} />\n <stop offset=\"100%\" stopColor={accentColor} stopOpacity={0} />\n </linearGradient>\n </defs>\n <Area\n type=\"monotone\"\n dataKey=\"y\"\n stroke={accentColor}\n strokeWidth={2}\n fill={`url(#${gid})`}\n isAnimationActive={false}\n />\n </AreaChart>\n </ResponsiveContainer>\n </div>\n\n {trend ? (\n <div className={cn(\"mt-10 flex items-center gap-1 text-xs font-medium\", trendCls)}>\n <TrendIcon className=\"size-3.5 shrink-0\" aria-hidden />\n <span>{trend.label}</span>\n </div>\n ) : (\n <div className=\"mt-10\" />\n )}\n </div>\n );\n}\n\n/** ─── Hero area + optional compare line + tabs + footer ──────────────── */\n\nexport type DashboardAreaChartPoint = Record<string, string | number>;\n\nexport type DashboardAreaChartTemplateProps = {\n title: string;\n tabs: { id: string; label: string }[];\n activeTabId: string;\n onTabChange: (id: string) => void;\n headline: React.ReactNode;\n delta?: React.ReactNode;\n data: DashboardAreaChartPoint[];\n xKey: string;\n areaKey: string;\n compareLineKey?: string;\n height?: number;\n formatYAxis?: (v: number) => string;\n footer?: React.ReactNode;\n className?: string;\n};\n\nexport function DashboardAreaChartTemplate({\n title,\n tabs,\n activeTabId,\n onTabChange,\n headline,\n delta,\n data,\n xKey,\n areaKey,\n compareLineKey,\n height = 220,\n formatYAxis = (v) =>\n v >= 1_000_000 ? `${(v / 1_000_000).toFixed(1)}L` : v >= 1_000 ? `${(v / 1_000).toFixed(0)}K` : `${v}`,\n footer,\n className,\n}: DashboardAreaChartTemplateProps) {\n const areaGid = React.useId().replace(/:/g, \"\");\n\n return (\n <div className={cn(\"rounded-xl border border-border bg-card text-card-foreground\", elevation.surface, className)}>\n <div className=\"flex flex-col gap-4 border-b border-border px-5 pt-4 pb-3 sm:flex-row sm:items-start sm:justify-between\">\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n <div className=\"flex flex-wrap gap-1 rounded-lg border border-border bg-muted/30 p-0.5\">\n {tabs.map((t) => (\n <button\n key={t.id}\n type=\"button\"\n onClick={() => onTabChange(t.id)}\n className={cn(\n \"rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors\",\n activeTabId === t.id\n ? \"bg-card text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {t.label}\n </button>\n ))}\n </div>\n </div>\n\n <div className=\"px-5 pt-4\">\n <div className=\"text-2xl font-semibold tabular-nums tracking-tight text-foreground\">{headline}</div>\n {delta ? <div className=\"mt-1 text-sm\">{delta}</div> : null}\n </div>\n\n <div className=\"px-3 pb-2 pt-2\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={data} margin={{ top: 8, right: 12, left: 0, bottom: 0 }}>\n <defs>\n <linearGradient id={areaGid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"var(--chart-1)\" stopOpacity={0.35} />\n <stop offset=\"100%\" stopColor=\"var(--chart-1)\" stopOpacity={0.02} />\n </linearGradient>\n </defs>\n <CartesianGrid strokeDasharray=\"3 3\" stroke={gridStroke} vertical={false} />\n <XAxis\n dataKey={xKey}\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 10, fill: tickFill }}\n interval=\"preserveStartEnd\"\n />\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 10, fill: tickFill }}\n tickFormatter={formatYAxis}\n width={44}\n />\n <Tooltip\n contentStyle={{\n borderRadius: 10,\n border: \"1px solid var(--border)\",\n fontSize: 12,\n background: \"var(--popover)\",\n color: \"var(--popover-foreground)\",\n }}\n />\n <Area\n type=\"monotone\"\n dataKey={areaKey}\n stroke=\"var(--chart-1)\"\n strokeWidth={2}\n fill={`url(#${areaGid})`}\n />\n {compareLineKey ? (\n <Line\n type=\"monotone\"\n dataKey={compareLineKey}\n stroke=\"var(--muted-foreground)\"\n strokeWidth={1.5}\n strokeDasharray=\"4 4\"\n dot={false}\n />\n ) : null}\n </AreaChart>\n </ResponsiveContainer>\n </div>\n\n {footer ? (\n <>\n <Separator />\n <div className=\"px-5 py-3\">{footer}</div>\n </>\n ) : null}\n </div>\n );\n}\n\n/** ─── Grouped vertical bars + legend (e.g. volume vs settled) ───────── */\n\nexport type GroupedBarSeries = { key: string; label: string; color: string };\n\nexport type GroupedBarChartTemplateProps = {\n title: string;\n subtitle?: string;\n data: DashboardAreaChartPoint[];\n xKey: string;\n series: GroupedBarSeries[];\n height?: number;\n formatYAxis?: (v: number) => string;\n className?: string;\n};\n\nexport function GroupedBarChartTemplate({\n title,\n subtitle,\n data,\n xKey,\n series,\n height = 200,\n formatYAxis = (v) =>\n v >= 1_000_000 ? `${(v / 1_000_000).toFixed(1)}M` : v >= 1_000 ? `${(v / 1_000).toFixed(0)}K` : `${v}`,\n className,\n}: GroupedBarChartTemplateProps) {\n return (\n <div className={cn(\"rounded-xl border border-border bg-card px-5 pt-4 pb-3 text-card-foreground\", elevation.surface, className)}>\n <div className=\"mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n {subtitle ? <p className=\"mt-0.5 text-xs text-muted-foreground\">{subtitle}</p> : null}\n </div>\n <div className=\"flex flex-wrap items-center gap-4\">\n {series.map((s) => (\n <div key={s.key} className=\"flex items-center gap-1.5\">\n <div className=\"size-2.5 rounded-sm\" style={{ background: s.color }} />\n <span className=\"text-[11px] font-medium text-muted-foreground\">{s.label}</span>\n </div>\n ))}\n </div>\n </div>\n <div style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={data} barCategoryGap=\"22%\" barGap={4}>\n <CartesianGrid strokeDasharray=\"3 3\" stroke={gridStroke} vertical={false} />\n <XAxis dataKey={xKey} axisLine={false} tickLine={false} tick={{ fontSize: 11, fill: tickFill }} />\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 11, fill: tickFill }}\n tickFormatter={formatYAxis}\n width={40}\n />\n <Tooltip\n contentStyle={{\n borderRadius: 10,\n border: \"1px solid var(--border)\",\n fontSize: 12,\n background: \"var(--popover)\",\n }}\n />\n {series.map((s) => (\n <Bar key={s.key} dataKey={s.key} name={s.label} fill={s.color} radius={[5, 5, 0, 0]} maxBarSize={36} />\n ))}\n </BarChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n\n/** ─── Ranked rows with horizontal bar (country / state insights) ────── */\n\nexport type RankedBarItem = {\n id: string;\n leading?: React.ReactNode;\n label: string;\n value: string;\n /** 0–100 width of the filled bar */\n percent: number;\n};\n\nexport type RankedBarListTemplateProps = {\n title: string;\n subtitle?: string;\n headerRight?: React.ReactNode;\n items: RankedBarItem[];\n /** CSS colors for bar gradient */\n barFrom?: string;\n barTo?: string;\n className?: string;\n};\n\nexport function RankedBarListTemplate({\n title,\n subtitle,\n headerRight,\n items,\n barFrom = \"var(--chart-1)\",\n barTo = \"var(--chart-3)\",\n className,\n}: RankedBarListTemplateProps) {\n return (\n <div className={cn(\"rounded-xl border border-border bg-card p-5 text-card-foreground\", elevation.surface, className)}>\n <div className=\"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n {subtitle ? <p className=\"mt-0.5 text-xs text-muted-foreground\">{subtitle}</p> : null}\n </div>\n {headerRight ? <div className=\"shrink-0\">{headerRight}</div> : null}\n </div>\n <ul className=\"space-y-3\">\n {items.map((row) => (\n <li key={row.id} className=\"flex items-center gap-3 text-sm\">\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n {row.leading ? <span className=\"shrink-0 text-muted-foreground\">{row.leading}</span> : null}\n <span className=\"truncate font-medium text-foreground\">{row.label}</span>\n </div>\n <div className=\"relative hidden h-2 w-[min(40%,9rem)] overflow-hidden rounded-full bg-muted sm:block\">\n <div\n className=\"absolute inset-y-0 left-0 rounded-full\"\n style={{\n width: `${Math.min(100, Math.max(0, row.percent))}%`,\n background: `linear-gradient(90deg, ${barFrom}, ${barTo})`,\n }}\n />\n </div>\n <span className=\"w-14 shrink-0 text-right text-xs font-semibold tabular-nums text-foreground\">\n {row.value}\n </span>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/** ─── Vertical category bars (e.g. T+N settlement mix) ──────────────── */\n\nexport type CategoryBarPoint = { category: string; value: number };\n\nexport type CategoryBarChartTemplateProps = {\n title: string;\n subtitle?: string;\n data: CategoryBarPoint[];\n valueLabel?: string;\n barColor?: string;\n height?: number;\n className?: string;\n};\n\nexport function CategoryBarChartTemplate({\n title,\n subtitle,\n data,\n valueLabel = \"Share\",\n barColor = \"var(--chart-1)\",\n height = 200,\n className,\n}: CategoryBarChartTemplateProps) {\n const chartData = data.map((d) => ({ name: d.category, v: d.value }));\n\n return (\n <div className={cn(\"rounded-xl border border-border bg-card px-5 pt-4 pb-3 text-card-foreground\", elevation.surface, className)}>\n <div className=\"mb-3\">\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n {subtitle ? <p className=\"mt-0.5 text-xs text-muted-foreground\">{subtitle}</p> : null}\n </div>\n <div style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={chartData} barCategoryGap=\"28%\">\n <CartesianGrid strokeDasharray=\"3 3\" stroke={gridStroke} vertical={false} />\n <XAxis dataKey=\"name\" axisLine={false} tickLine={false} tick={{ fontSize: 11, fill: tickFill }} />\n <YAxis\n axisLine={false}\n tickLine={false}\n tick={{ fontSize: 11, fill: tickFill }}\n tickFormatter={(v) => `${v}%`}\n domain={[0, \"dataMax + 5\"]}\n width={36}\n />\n <Tooltip\n formatter={(value) => [`${value ?? 0}%`, valueLabel]}\n contentStyle={{\n borderRadius: 10,\n border: \"1px solid var(--border)\",\n fontSize: 12,\n background: \"var(--popover)\",\n }}\n />\n <Bar dataKey=\"v\" fill={barColor} radius={[6, 6, 0, 0]} maxBarSize={48} />\n </BarChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n\n/** ─── Mini sparkline + stat row (success / failed / avg) ────────────── */\n\nexport type MiniSparklinePoint = { x: string | number; y: number; compare?: number };\n\nexport type MiniSparklineStat = { label: string; value: string; dotClassName?: string };\n\nexport type MiniSparklineChartCardProps = {\n title: string;\n value: React.ReactNode;\n data: MiniSparklinePoint[];\n accentColor?: string;\n stats: MiniSparklineStat[];\n height?: number;\n className?: string;\n};\n\nexport function MiniSparklineChartCard({\n title,\n value,\n data,\n accentColor = \"var(--chart-4)\",\n height = 100,\n stats,\n className,\n}: MiniSparklineChartCardProps) {\n const gid = React.useId().replace(/:/g, \"\");\n const hasCompare = data.some((d) => d.compare != null);\n\n return (\n <div className={cn(\"rounded-xl border border-border bg-card p-5 text-card-foreground\", elevation.surface, className)}>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n <div className=\"mt-2 text-2xl font-semibold tabular-nums\">{value}</div>\n <div className=\"mt-2\" style={{ height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <AreaChart data={data} margin={{ top: 4, right: 8, left: 0, bottom: 0 }}>\n <defs>\n <linearGradient id={gid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={accentColor} stopOpacity={0.3} />\n <stop offset=\"100%\" stopColor={accentColor} stopOpacity={0} />\n </linearGradient>\n </defs>\n <XAxis dataKey=\"x\" hide />\n <YAxis hide domain={[\"dataMin - 1\", \"dataMax + 1\"]} />\n <Area type=\"monotone\" dataKey=\"y\" stroke={accentColor} strokeWidth={2} fill={`url(#${gid})`} />\n {hasCompare ? (\n <Line\n type=\"monotone\"\n dataKey=\"compare\"\n stroke=\"var(--muted-foreground)\"\n strokeWidth={1.5}\n strokeDasharray=\"4 4\"\n dot={false}\n connectNulls\n />\n ) : null}\n </AreaChart>\n </ResponsiveContainer>\n </div>\n <div className=\"mt-3 flex flex-wrap gap-x-4 gap-y-2 border-t border-border pt-3 text-[11px]\">\n {stats.map((s) => (\n <div key={s.label} className=\"flex items-center gap-1.5\">\n {s.dotClassName ? <span className={cn(\"size-1.5 rounded-full\", s.dotClassName)} /> : null}\n <span className=\"text-muted-foreground\">{s.label}</span>\n <span className=\"font-semibold tabular-nums text-foreground\">{s.value}</span>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/** ─── “Needs attention” list with actions ───────────────────────────── */\n\nexport type AttentionListItem = {\n id: string;\n title: string;\n value: string;\n valueTone?: \"default\" | \"warning\" | \"danger\";\n meta?: string;\n actionLabel: string;\n onAction?: () => void;\n};\n\nexport type AttentionListTemplateProps = {\n title: string;\n items: AttentionListItem[];\n className?: string;\n};\n\nconst toneCls = {\n default: \"text-foreground\",\n warning: \"text-amber-600 dark:text-amber-400\",\n danger: \"text-red-600 dark:text-red-400\",\n} as const;\n\nexport function AttentionListTemplate({ title, items, className }: AttentionListTemplateProps) {\n return (\n <div className={cn(\"rounded-xl border border-border bg-card p-5 text-card-foreground\", elevation.surface, className)}>\n <h3 className=\"text-sm font-semibold text-foreground\">{title}</h3>\n <ul className=\"mt-4 space-y-4\">\n {items.map((item) => (\n <li\n key={item.id}\n className=\"flex flex-col gap-3 border-b border-border/60 pb-4 last:border-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between\"\n >\n <div className=\"min-w-0 space-y-0.5\">\n <p className=\"text-sm font-semibold text-foreground\">{item.title}</p>\n <p className={cn(\"text-lg font-semibold tabular-nums\", toneCls[item.valueTone ?? \"default\"])}>\n {item.value}\n </p>\n {item.meta ? <p className=\"text-xs text-muted-foreground\">{item.meta}</p> : null}\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"md\"\n className=\"shrink-0 gap-1.5\"\n onClick={item.onAction}\n >\n {item.actionLabel}\n <ExternalLink className=\"size-3.5 opacity-70\" aria-hidden />\n </Button>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n","\"use client\";\n\nimport { useTheme } from \"next-themes\";\nimport { Toaster as Sonner, type ToasterProps } from \"sonner\";\nimport { useEffect, useState } from \"react\";\nimport { elevation } from \"./elevation\";\n\n/** Drop-in toast host; pair with `toast` from `sonner`. Resolves theme via next-themes when mounted. */\nexport function Toaster({ theme, ...props }: ToasterProps) {\n const { resolvedTheme } = useTheme();\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n\n const resolved =\n theme ?? (mounted && resolvedTheme === \"dark\" ? \"dark\" : \"light\");\n\n return (\n <Sonner\n theme={resolved}\n position=\"bottom-right\"\n toastOptions={{\n classNames: {\n toast:\n `bg-[var(--popover)] text-[var(--popover-foreground)] border-[var(--border)] ${elevation.popover} rounded-[10px] text-[13px]`,\n description: \"text-[var(--muted-foreground)]\",\n },\n }}\n {...props}\n />\n );\n}\n\nexport { toast } from \"sonner\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Check, Pencil, X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\nexport interface InlineEditProps {\n value: string;\n onConfirm: (val: string) => void;\n placeholder?: string;\n multiline?: boolean;\n disabled?: boolean;\n showButtons?: boolean;\n readClassName?: string;\n inputClassName?: string;\n}\n\nconst InlineEdit = React.forwardRef<HTMLDivElement, InlineEditProps>(\n (\n {\n value,\n onConfirm,\n placeholder = \"Click to edit…\",\n multiline = false,\n disabled = false,\n showButtons = false,\n readClassName,\n inputClassName,\n },\n ref\n ) => {\n const [editing, setEditing] = React.useState(false);\n const [draft, setDraft] = React.useState(value);\n const [hovered, setHovered] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement & HTMLTextAreaElement>(null);\n\n React.useEffect(() => {\n if (!editing) setDraft(value);\n }, [value, editing]);\n\n React.useEffect(() => {\n if (editing) {\n inputRef.current?.focus();\n if (inputRef.current) {\n const el = inputRef.current;\n const len = el.value.length;\n el.setSelectionRange(len, len);\n }\n }\n }, [editing]);\n\n const confirm = React.useCallback(() => {\n setEditing(false);\n if (draft !== value) onConfirm(draft);\n }, [draft, value, onConfirm]);\n\n const cancel = React.useCallback(() => {\n setEditing(false);\n setDraft(value);\n }, [value]);\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\" && !multiline) {\n e.preventDefault();\n confirm();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n cancel();\n }\n },\n [confirm, cancel, multiline]\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent) => {\n // If showButtons, don't auto-confirm on blur unless focus leaves the whole group\n if (showButtons) {\n const related = e.relatedTarget as Node | null;\n const container = (e.currentTarget as HTMLElement).closest(\n \"[data-inline-edit]\"\n );\n if (container && related && container.contains(related)) return;\n }\n confirm();\n },\n [confirm, showButtons]\n );\n\n const startEditing = () => {\n if (disabled) return;\n setEditing(true);\n };\n\n const sharedInputClass = cn(\n \"w-full rounded-md border border-border bg-card px-2 py-1 text-[15px] leading-tight text-foreground\",\n elevation.field,\n \"placeholder:text-muted-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n inputClassName\n );\n\n return (\n <div ref={ref} data-inline-edit=\"\" className=\"relative inline-flex flex-col gap-1 max-w-full\">\n {editing ? (\n <>\n {multiline ? (\n <textarea\n ref={inputRef as React.Ref<HTMLTextAreaElement>}\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n placeholder={placeholder}\n rows={3}\n className={cn(sharedInputClass, \"resize-none leading-relaxed py-1.5\")}\n />\n ) : (\n <input\n ref={inputRef as React.Ref<HTMLInputElement>}\n type=\"text\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n placeholder={placeholder}\n className={sharedInputClass}\n />\n )}\n\n {showButtons && (\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onMouseDown={(e) => {\n e.preventDefault();\n confirm();\n }}\n className={cn(\n \"inline-flex items-center justify-center rounded-md p-1\",\n \"text-emerald-600 hover:bg-emerald-50 dark:hover:bg-emerald-950/40\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n aria-label=\"Confirm\"\n >\n <Check className=\"size-3.5\" />\n </button>\n <button\n type=\"button\"\n onMouseDown={(e) => {\n e.preventDefault();\n cancel();\n }}\n className={cn(\n \"inline-flex items-center justify-center rounded-md p-1\",\n \"text-destructive hover:bg-destructive/10\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\"\n )}\n aria-label=\"Cancel\"\n >\n <X className=\"size-3.5\" />\n </button>\n </div>\n )}\n </>\n ) : (\n <span\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-label={value || placeholder}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={startEditing}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n startEditing();\n }\n }}\n className={cn(\n \"inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[15px] leading-tight\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n !disabled && \"hover:bg-muted cursor-text\",\n disabled && \"cursor-not-allowed opacity-50\",\n readClassName\n )}\n >\n <span className={cn(!value && \"text-muted-foreground\")}>\n {value || placeholder}\n </span>\n {!disabled && (\n <Pencil\n className={cn(\n \"size-3.5 shrink-0 text-muted-foreground transition-opacity duration-pg-fast ease-pg-standard\",\n hovered ? \"opacity-100\" : \"opacity-0\"\n )}\n aria-hidden\n />\n )}\n </span>\n )}\n </div>\n );\n }\n);\n\nInlineEdit.displayName = \"InlineEdit\";\n\nexport { InlineEdit };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface InlineDialogProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n\nexport interface InlineDialogContentProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n \"side\" | \"sideOffset\"\n > {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n sideOffset?: number;\n /** Hide the built-in close button */\n hideClose?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// InlineDialog (Popover root)\n// ---------------------------------------------------------------------------\n\nconst InlineDialog = PopoverPrimitive.Root;\nInlineDialog.displayName = \"InlineDialog\";\n\n// ---------------------------------------------------------------------------\n// InlineDialogTrigger\n// ---------------------------------------------------------------------------\n\nconst InlineDialogTrigger = PopoverPrimitive.Trigger;\nInlineDialogTrigger.displayName = \"InlineDialogTrigger\";\n\n// ---------------------------------------------------------------------------\n// Arrow positioning helpers\n// ---------------------------------------------------------------------------\n\ntype ArrowSide = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/**\n * Returns Tailwind classes that position the 8×8 arrow square on the correct\n * edge of the floating card and rotate it so the corner points at the trigger.\n */\nfunction getArrowClasses(side: ArrowSide): string {\n const base =\n \"absolute size-2 bg-card border border-border pointer-events-none\";\n\n switch (side) {\n case \"top\":\n // Arrow appears on the bottom edge of the card (card is above trigger)\n return cn(\n base,\n \"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 rotate-45\",\n \"border-t-0 border-l-0\"\n );\n case \"bottom\":\n // Arrow appears on the top edge of the card (card is below trigger)\n return cn(\n base,\n \"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 rotate-45\",\n \"border-b-0 border-r-0\"\n );\n case \"left\":\n // Arrow appears on the right edge of the card (card is left of trigger)\n return cn(\n base,\n \"right-0 top-1/2 -translate-y-1/2 translate-x-1/2 rotate-45\",\n \"border-t-0 border-l-0\"\n );\n case \"right\":\n // Arrow appears on the left edge of the card (card is right of trigger)\n return cn(\n base,\n \"left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 rotate-45\",\n \"border-b-0 border-r-0\"\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// InlineDialogContent\n// ---------------------------------------------------------------------------\n\nconst InlineDialogContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n InlineDialogContentProps\n>(\n (\n {\n className,\n side = \"bottom\",\n sideOffset = 8,\n hideClose = false,\n children,\n ...props\n },\n ref\n ) => (\n <PopoverPrimitive.Portal>\n {/* Scrollable when opened from inside a Dialog or Drawer. See\n `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n sideOffset={sideOffset}\n className={cn(\n // Base card\n \"relative z-[120] max-w-xs overflow-visible\",\n \"rounded-xl border border-border bg-card p-4 text-foreground\",\n elevation.popover,\n // Animation\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0\",\n \"transition-opacity duration-pg-fast ease-pg-standard\",\n \"outline-none\",\n className\n )}\n {...props}\n >\n {/* Arrow pointer */}\n <span className={getArrowClasses(side)} aria-hidden=\"true\" />\n\n {/* Close button */}\n {!hideClose && (\n <PopoverPrimitive.Close\n className={cn(\n \"absolute right-2 top-2 z-10\",\n \"inline-flex size-6 items-center justify-center rounded-md\",\n \"text-muted-foreground hover:text-foreground\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\"\n )}\n aria-label=\"Close\"\n >\n <X className=\"size-3.5\" />\n </PopoverPrimitive.Close>\n )}\n\n {children}\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n )\n);\nInlineDialogContent.displayName = \"InlineDialogContent\";\n\n// ---------------------------------------------------------------------------\n// Exports\n// ---------------------------------------------------------------------------\n\nexport { InlineDialog, InlineDialogTrigger, InlineDialogContent };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Info, CheckCircle2, AlertTriangle, XCircle, X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport type FlagVariant = \"info\" | \"success\" | \"warning\" | \"error\";\nexport type FlagGroupPosition = \"bottom-right\" | \"bottom-left\" | \"top-right\" | \"top-left\";\n\nexport interface FlagAction {\n label: string;\n onClick: () => void;\n}\n\nexport interface FlagProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Heading text shown in bold */\n title: string;\n /** Optional body copy shown below the title */\n description?: string;\n /** Visual severity / colour */\n variant?: FlagVariant;\n /** Override the default lucide icon */\n icon?: React.ReactNode;\n /** Called when the close button is pressed */\n onDismiss?: () => void;\n /** Action buttons rendered below the content. Pass `false` to disable. */\n autoDismiss?: number | false;\n /** Optional CTA buttons */\n actions?: FlagAction[];\n}\n\nexport interface FlagGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Corner to anchor the stack */\n position?: FlagGroupPosition;\n}\n\nexport interface UseFlagGroupReturn {\n flags: Array<FlagProps & { id: string }>;\n addFlag: (flag: Omit<FlagProps, \"onDismiss\"> & { id?: string }) => string;\n removeFlag: (id: string) => void;\n clearAll: () => void;\n}\n\n// ─── Constants ────────────────────────────────────────────────────────────────\n\nconst DEFAULT_AUTO_DISMISS = 8000;\n\nconst variantBorder: Record<FlagVariant, string> = {\n info: \"border-l-blue-500\",\n success: \"border-l-green-500\",\n warning: \"border-l-amber-500\",\n error: \"border-l-red-500\",\n};\n\nconst variantProgressBar: Record<FlagVariant, string> = {\n info: \"bg-blue-500\",\n success: \"bg-green-500\",\n warning: \"bg-amber-500\",\n error: \"bg-red-500\",\n};\n\nconst variantIconColor: Record<FlagVariant, string> = {\n info: \"text-blue-500\",\n success: \"text-green-500\",\n warning: \"text-amber-500\",\n error: \"text-red-500\",\n};\n\nconst defaultIcons: Record<FlagVariant, React.ElementType> = {\n info: Info,\n success: CheckCircle2,\n warning: AlertTriangle,\n error: XCircle,\n};\n\n// ─── Flag ─────────────────────────────────────────────────────────────────────\n\nconst Flag = React.forwardRef<HTMLDivElement, FlagProps>(\n (\n {\n className,\n title,\n description,\n variant = \"info\",\n icon,\n onDismiss,\n autoDismiss = DEFAULT_AUTO_DISMISS,\n actions,\n ...props\n },\n ref\n ) => {\n const [progress, setProgress] = React.useState(100);\n const pausedRef = React.useRef(false);\n const startTimeRef = React.useRef<number | null>(null);\n const elapsedRef = React.useRef(0);\n const rafRef = React.useRef<number | null>(null);\n const duration = autoDismiss === false ? null : autoDismiss;\n\n React.useEffect(() => {\n if (duration === null) return;\n\n const tick = (now: number) => {\n if (pausedRef.current) {\n startTimeRef.current = now;\n rafRef.current = requestAnimationFrame(tick);\n return;\n }\n if (startTimeRef.current === null) startTimeRef.current = now;\n elapsedRef.current += now - startTimeRef.current;\n startTimeRef.current = now;\n\n const remaining = Math.max(0, duration - elapsedRef.current);\n const pct = (remaining / duration) * 100;\n setProgress(pct);\n\n if (remaining <= 0) {\n onDismiss?.();\n return;\n }\n rafRef.current = requestAnimationFrame(tick);\n };\n\n rafRef.current = requestAnimationFrame(tick);\n return () => {\n if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [duration]);\n\n const handleMouseEnter = () => {\n pausedRef.current = true;\n };\n const handleMouseLeave = () => {\n pausedRef.current = false;\n startTimeRef.current = null;\n };\n\n const DefaultIcon = defaultIcons[variant];\n const renderedIcon = icon ?? <DefaultIcon className={cn(\"size-4 shrink-0 mt-0.5\", variantIconColor[variant])} aria-hidden />;\n\n return (\n <div\n ref={ref}\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n className={cn(\n \"relative w-80 overflow-hidden rounded-xl border border-border bg-card\",\n elevation.popover,\n \"border-l-4\",\n variantBorder[variant],\n className\n )}\n {...props}\n >\n {/* Body */}\n <div className=\"flex gap-3 p-4 pr-10\">\n {renderedIcon}\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-semibold text-card-foreground leading-snug\">{title}</p>\n {description && (\n <p className=\"mt-1 text-sm text-muted-foreground leading-relaxed\">{description}</p>\n )}\n {actions && actions.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {actions.map((action) => (\n <button\n key={action.label}\n type=\"button\"\n onClick={action.onClick}\n className=\"text-xs font-medium text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded\"\n >\n {action.label}\n </button>\n ))}\n </div>\n )}\n </div>\n </div>\n\n {/* Close button */}\n {onDismiss && (\n <button\n type=\"button\"\n aria-label=\"Dismiss notification\"\n onClick={onDismiss}\n className=\"absolute top-3 right-3 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"size-3.5\" aria-hidden />\n </button>\n )}\n\n {/* Auto-dismiss progress bar */}\n {duration !== null && (\n <div className=\"absolute bottom-0 left-0 right-0 h-0.5 bg-muted\">\n <div\n className={cn(\"h-full transition-none\", variantProgressBar[variant])}\n style={{ width: `${progress}%` }}\n />\n </div>\n )}\n </div>\n );\n }\n);\nFlag.displayName = \"Flag\";\n\n// ─── FlagGroup ────────────────────────────────────────────────────────────────\n\nconst positionClasses: Record<FlagGroupPosition, string> = {\n \"bottom-right\": \"bottom-4 right-4 flex-col-reverse\",\n \"bottom-left\": \"bottom-4 left-4 flex-col-reverse\",\n \"top-right\": \"top-4 right-4 flex-col\",\n \"top-left\": \"top-4 left-4 flex-col\",\n};\n\nconst FlagGroup = React.forwardRef<HTMLDivElement, FlagGroupProps>(\n ({ className, position = \"bottom-right\", children, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"fixed z-50 flex gap-2\",\n positionClasses[position],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n);\nFlagGroup.displayName = \"FlagGroup\";\n\n// ─── useFlagGroup ─────────────────────────────────────────────────────────────\n\nfunction useFlagGroup(): UseFlagGroupReturn {\n const [flags, setFlags] = React.useState<Array<FlagProps & { id: string }>>([]);\n\n const removeFlag = React.useCallback((id: string) => {\n setFlags((prev) => prev.filter((f) => f.id !== id));\n }, []);\n\n const addFlag = React.useCallback(\n (flag: Omit<FlagProps, \"onDismiss\"> & { id?: string }): string => {\n const id = flag.id ?? `flag-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;\n setFlags((prev) => [...prev, { ...flag, id, onDismiss: () => removeFlag(id) }]);\n return id;\n },\n [removeFlag]\n );\n\n const clearAll = React.useCallback(() => {\n setFlags([]);\n }, []);\n\n return { flags, addFlag, removeFlag, clearAll };\n}\n\n// ─── Exports ──────────────────────────────────────────────────────────────────\n\nexport { Flag, FlagGroup, useFlagGroup };\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Breakpoint type\n// ---------------------------------------------------------------------------\n\nexport type Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Ordered list — index used for comparison */\nconst BREAKPOINT_ORDER: Breakpoint[] = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n\n/** Tailwind min-width values aligned with default config */\nconst BREAKPOINT_MIN_WIDTH: Record<Breakpoint, number> = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536,\n};\n\nfunction bpIndex(bp: Breakpoint): number {\n return BREAKPOINT_ORDER.indexOf(bp);\n}\n\n// ---------------------------------------------------------------------------\n// Show\n// ---------------------------------------------------------------------------\n\nexport interface ShowProps extends React.HTMLAttributes<HTMLElement> {\n /** Render children at this breakpoint and above. */\n above?: Breakpoint;\n /** Render children strictly below this breakpoint. */\n below?: Breakpoint;\n /** HTML element to render. Defaults to \"div\". */\n as?: React.ElementType;\n /** Display value to restore when visible. Defaults to \"block\". */\n display?: \"block\" | \"flex\" | \"inline\" | \"inline-block\" | \"grid\" | \"inline-flex\";\n children?: React.ReactNode;\n}\n\nconst DISPLAY_ABOVE_CLASS: Record<\n Breakpoint,\n Record<ShowProps[\"display\"] & string, string>\n> = {\n sm: {\n block: \"sm:block\",\n flex: \"sm:flex\",\n inline: \"sm:inline\",\n \"inline-block\": \"sm:inline-block\",\n grid: \"sm:grid\",\n \"inline-flex\": \"sm:inline-flex\",\n },\n md: {\n block: \"md:block\",\n flex: \"md:flex\",\n inline: \"md:inline\",\n \"inline-block\": \"md:inline-block\",\n grid: \"md:grid\",\n \"inline-flex\": \"md:inline-flex\",\n },\n lg: {\n block: \"lg:block\",\n flex: \"lg:flex\",\n inline: \"lg:inline\",\n \"inline-block\": \"lg:inline-block\",\n grid: \"lg:grid\",\n \"inline-flex\": \"lg:inline-flex\",\n },\n xl: {\n block: \"xl:block\",\n flex: \"xl:flex\",\n inline: \"xl:inline\",\n \"inline-block\": \"xl:inline-block\",\n grid: \"xl:grid\",\n \"inline-flex\": \"xl:inline-flex\",\n },\n \"2xl\": {\n block: \"2xl:block\",\n flex: \"2xl:flex\",\n inline: \"2xl:inline\",\n \"inline-block\": \"2xl:inline-block\",\n grid: \"2xl:grid\",\n \"inline-flex\": \"2xl:inline-flex\",\n },\n};\n\n/** Tailwind class to hide at a breakpoint and above */\nconst HIDDEN_ABOVE_CLASS: Record<Breakpoint, string> = {\n sm: \"sm:hidden\",\n md: \"md:hidden\",\n lg: \"lg:hidden\",\n xl: \"xl:hidden\",\n \"2xl\": \"2xl:hidden\",\n};\n\nexport const Show = React.forwardRef<HTMLElement, ShowProps>(\n (\n {\n above,\n below,\n as: Tag = \"div\",\n display = \"block\",\n className,\n children,\n ...props\n },\n ref\n ) => {\n let visibilityClass: string;\n\n if (above) {\n // hidden by default, become visible at `above` breakpoint\n visibilityClass = cn(\"hidden\", DISPLAY_ABOVE_CLASS[above][display]);\n } else if (below) {\n // visible by default, hidden at `below` breakpoint and above\n visibilityClass = HIDDEN_ABOVE_CLASS[below];\n } else {\n visibilityClass = \"\";\n }\n\n return (\n <Tag\n ref={ref}\n className={cn(visibilityClass, className)}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nShow.displayName = \"Show\";\n\n// ---------------------------------------------------------------------------\n// Hide\n// ---------------------------------------------------------------------------\n\nexport interface HideProps extends React.HTMLAttributes<HTMLElement> {\n /** Hide children at this breakpoint and above. */\n above?: Breakpoint;\n /** Hide children strictly below this breakpoint (i.e. visible at/above). */\n below?: Breakpoint;\n /** HTML element to render. Defaults to \"div\". */\n as?: React.ElementType;\n /** Display value to restore when visible. Defaults to \"block\". */\n display?: \"block\" | \"flex\" | \"inline\" | \"inline-block\" | \"grid\" | \"inline-flex\";\n children?: React.ReactNode;\n}\n\nexport const Hide = React.forwardRef<HTMLElement, HideProps>(\n (\n {\n above,\n below,\n as: Tag = \"div\",\n display = \"block\",\n className,\n children,\n ...props\n },\n ref\n ) => {\n let visibilityClass: string;\n\n if (above) {\n // visible by default, hidden at `above` breakpoint and above\n visibilityClass = HIDDEN_ABOVE_CLASS[above];\n } else if (below) {\n // hidden by default (below breakpoint), visible at/above breakpoint — inverse of Show above\n visibilityClass = cn(\"hidden\", DISPLAY_ABOVE_CLASS[below][display]);\n } else {\n visibilityClass = \"\";\n }\n\n return (\n <Tag\n ref={ref}\n className={cn(visibilityClass, className)}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nHide.displayName = \"Hide\";\n\n// ---------------------------------------------------------------------------\n// useBreakpoint hook\n// ---------------------------------------------------------------------------\n\nfunction getActiveBreakpoint(): Breakpoint | null {\n if (typeof window === \"undefined\") return null;\n // Walk from largest to smallest — first match wins\n for (let i = BREAKPOINT_ORDER.length - 1; i >= 0; i--) {\n const bp = BREAKPOINT_ORDER[i];\n if (window.matchMedia(`(min-width: ${BREAKPOINT_MIN_WIDTH[bp]}px)`).matches) {\n return bp;\n }\n }\n return null;\n}\n\nexport interface UseBreakpointReturn {\n /** The currently active (highest matching) breakpoint, or null on SSR / xs viewport. */\n breakpoint: Breakpoint | null;\n /** Returns true when the viewport is at or above `bp`. */\n isAbove: (bp: Breakpoint) => boolean;\n /** Returns true when the viewport is strictly below `bp`. */\n isBelow: (bp: Breakpoint) => boolean;\n /** True when no breakpoint is active (viewport < 640 px). */\n isMobile: boolean;\n /** True when active breakpoint is md (768–1023 px). */\n isTablet: boolean;\n /** True when active breakpoint is lg or above (≥ 1024 px). */\n isDesktop: boolean;\n}\n\nexport function useBreakpoint(): UseBreakpointReturn {\n const [breakpoint, setBreakpoint] = React.useState<Breakpoint | null>(() =>\n getActiveBreakpoint()\n );\n\n React.useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n // Build one MediaQueryList per breakpoint and attach listeners\n const queries = BREAKPOINT_ORDER.map((bp) =>\n window.matchMedia(`(min-width: ${BREAKPOINT_MIN_WIDTH[bp]}px)`)\n );\n\n function handleChange() {\n setBreakpoint(getActiveBreakpoint());\n }\n\n queries.forEach((mql) => mql.addEventListener(\"change\", handleChange));\n // Sync once on mount (handles SSR hydration mismatch)\n handleChange();\n\n return () => {\n queries.forEach((mql) => mql.removeEventListener(\"change\", handleChange));\n };\n }, []);\n\n const isAbove = React.useCallback(\n (bp: Breakpoint): boolean => {\n if (breakpoint === null) return false;\n return bpIndex(breakpoint) >= bpIndex(bp);\n },\n [breakpoint]\n );\n\n const isBelow = React.useCallback(\n (bp: Breakpoint): boolean => {\n if (breakpoint === null) return true;\n return bpIndex(breakpoint) < bpIndex(bp);\n },\n [breakpoint]\n );\n\n return {\n breakpoint,\n isAbove,\n isBelow,\n isMobile: breakpoint === null,\n isTablet: breakpoint === \"md\",\n isDesktop: breakpoint !== null && bpIndex(breakpoint) >= bpIndex(\"lg\"),\n };\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { Check, ChevronDown, Search } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\nexport interface Country {\n code: string;\n name: string;\n flag: string;\n dialCode: string;\n}\n\nexport const COUNTRIES: Country[] = [\n { code: \"US\", name: \"United States\", flag: \"🇺🇸\", dialCode: \"+1\" },\n { code: \"GB\", name: \"United Kingdom\", flag: \"🇬🇧\", dialCode: \"+44\" },\n { code: \"IN\", name: \"India\", flag: \"🇮🇳\", dialCode: \"+91\" },\n { code: \"AU\", name: \"Australia\", flag: \"🇦🇺\", dialCode: \"+61\" },\n { code: \"CA\", name: \"Canada\", flag: \"🇨🇦\", dialCode: \"+1\" },\n { code: \"DE\", name: \"Germany\", flag: \"🇩🇪\", dialCode: \"+49\" },\n { code: \"FR\", name: \"France\", flag: \"🇫🇷\", dialCode: \"+33\" },\n { code: \"JP\", name: \"Japan\", flag: \"🇯🇵\", dialCode: \"+81\" },\n { code: \"SG\", name: \"Singapore\", flag: \"🇸🇬\", dialCode: \"+65\" },\n { code: \"AE\", name: \"United Arab Emirates\", flag: \"🇦🇪\", dialCode: \"+971\" },\n { code: \"CN\", name: \"China\", flag: \"🇨🇳\", dialCode: \"+86\" },\n { code: \"BR\", name: \"Brazil\", flag: \"🇧🇷\", dialCode: \"+55\" },\n { code: \"MX\", name: \"Mexico\", flag: \"🇲🇽\", dialCode: \"+52\" },\n { code: \"KR\", name: \"South Korea\", flag: \"🇰🇷\", dialCode: \"+82\" },\n { code: \"IT\", name: \"Italy\", flag: \"🇮🇹\", dialCode: \"+39\" },\n { code: \"ES\", name: \"Spain\", flag: \"🇪🇸\", dialCode: \"+34\" },\n { code: \"NL\", name: \"Netherlands\", flag: \"🇳🇱\", dialCode: \"+31\" },\n { code: \"SE\", name: \"Sweden\", flag: \"🇸🇪\", dialCode: \"+46\" },\n { code: \"NO\", name: \"Norway\", flag: \"🇳🇴\", dialCode: \"+47\" },\n { code: \"DK\", name: \"Denmark\", flag: \"🇩🇰\", dialCode: \"+45\" },\n { code: \"FI\", name: \"Finland\", flag: \"🇫🇮\", dialCode: \"+358\" },\n { code: \"CH\", name: \"Switzerland\", flag: \"🇨🇭\", dialCode: \"+41\" },\n { code: \"NZ\", name: \"New Zealand\", flag: \"🇳🇿\", dialCode: \"+64\" },\n { code: \"ZA\", name: \"South Africa\", flag: \"🇿🇦\", dialCode: \"+27\" },\n { code: \"NG\", name: \"Nigeria\", flag: \"🇳🇬\", dialCode: \"+234\" },\n { code: \"EG\", name: \"Egypt\", flag: \"🇪🇬\", dialCode: \"+20\" },\n { code: \"PK\", name: \"Pakistan\", flag: \"🇵🇰\", dialCode: \"+92\" },\n { code: \"BD\", name: \"Bangladesh\", flag: \"🇧🇩\", dialCode: \"+880\" },\n { code: \"ID\", name: \"Indonesia\", flag: \"🇮🇩\", dialCode: \"+62\" },\n { code: \"TH\", name: \"Thailand\", flag: \"🇹🇭\", dialCode: \"+66\" },\n];\n\nexport interface CountrySelectProps {\n value?: string;\n onValueChange?: (code: string) => void;\n placeholder?: string;\n showDialCode?: boolean;\n disabled?: boolean;\n className?: string;\n}\n\nconst CountrySelect = React.forwardRef<HTMLButtonElement, CountrySelectProps>(\n (\n {\n value,\n onValueChange,\n placeholder = \"Select country\",\n showDialCode = false,\n disabled = false,\n className,\n },\n ref\n ) => {\n const [open, setOpen] = React.useState(false);\n const [search, setSearch] = React.useState(\"\");\n const searchRef = React.useRef<HTMLInputElement>(null);\n\n const selected = React.useMemo(\n () => COUNTRIES.find((c) => c.code === value),\n [value]\n );\n\n const filtered = React.useMemo(() => {\n const q = search.trim().toLowerCase();\n if (!q) return COUNTRIES;\n return COUNTRIES.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.code.toLowerCase().includes(q) ||\n c.dialCode.includes(q)\n );\n }, [search]);\n\n React.useEffect(() => {\n if (open) {\n // Delay focus until popover has mounted\n const id = setTimeout(() => searchRef.current?.focus(), 0);\n return () => clearTimeout(id);\n } else {\n setSearch(\"\");\n }\n }, [open]);\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n className={cn(\n \"flex h-11 min-h-11 w-full items-center justify-between gap-2.5 rounded-lg border border-border bg-card px-4 text-[15px] text-foreground\",\n elevation.field,\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n !selected && \"text-muted-foreground\",\n className\n )}\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n {selected ? (\n <>\n <span className=\"text-base leading-none\" aria-hidden=\"true\">\n {selected.flag}\n </span>\n <span className=\"truncate\">{selected.name}</span>\n {showDialCode && (\n <span className=\"shrink-0 text-muted-foreground\">\n {selected.dialCode}\n </span>\n )}\n </>\n ) : (\n <span>{placeholder}</span>\n )}\n </span>\n <ChevronDown\n className={cn(\n \"h-4 w-4 shrink-0 text-muted-foreground opacity-70 transition-transform duration-pg-fast ease-pg-standard\",\n open && \"rotate-180\"\n )}\n aria-hidden=\"true\"\n />\n </button>\n </PopoverPrimitive.Trigger>\n\n <PopoverPrimitive.Portal>\n {/* Takes over the scroll lock when this opens inside a Dialog or\n Drawer, so the list can be scrolled. See `scroll-lock.tsx`. */}\n <ScrollLockTakeover>\n <PopoverPrimitive.Content\n align=\"start\"\n sideOffset={6}\n className={cn(\n \"z-[120] w-[var(--radix-popover-trigger-width)] min-w-[260px] rounded-xl border border-border bg-popover text-popover-foreground outline-none\",\n elevation.popover,\n \"data-[state=open]:opacity-100 data-[state=closed]:opacity-0 transition-opacity duration-150\"\n )}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {/* Search */}\n <div className=\"flex items-center gap-2 border-b border-border px-3 py-2.5\">\n <Search className=\"h-4 w-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <input\n ref={searchRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n placeholder=\"Search countries…\"\n className={cn(\n \"flex-1 bg-transparent text-[14px] text-foreground placeholder:text-muted-foreground\",\n \"focus-visible:outline-none\"\n )}\n aria-label=\"Search countries\"\n />\n {search && (\n <button\n type=\"button\"\n onClick={() => setSearch(\"\")}\n className=\"shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-pg-fast ease-pg-standard\"\n aria-label=\"Clear search\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n </button>\n )}\n </div>\n\n {/* List */}\n <div\n role=\"listbox\"\n aria-label=\"Countries\"\n className=\"max-h-64 overflow-y-auto p-1\"\n >\n {filtered.length === 0 ? (\n <div className=\"py-6 text-center text-sm text-muted-foreground\">\n No countries found\n </div>\n ) : (\n filtered.map((country) => {\n const isSelected = country.code === value;\n return (\n <button\n key={country.code}\n role=\"option\"\n aria-selected={isSelected}\n type=\"button\"\n onClick={() => {\n onValueChange?.(country.code);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"hover:bg-muted\",\n isSelected && \"bg-muted/60\"\n )}\n >\n <span className=\"text-base leading-none\" aria-hidden=\"true\">\n {country.flag}\n </span>\n <span className=\"flex-1 truncate text-foreground\">\n {country.name}\n </span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">\n {country.dialCode}\n </span>\n {isSelected && (\n <Check\n className=\"h-3.5 w-3.5 shrink-0 text-primary\"\n aria-hidden=\"true\"\n />\n )}\n </button>\n );\n })\n )}\n </div>\n </PopoverPrimitive.Content>\n </ScrollLockTakeover>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n }\n);\nCountrySelect.displayName = \"CountrySelect\";\n\nexport { CountrySelect };\n","\"use client\";\n\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { Loader2 } from \"lucide-react\";\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nexport interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n \"aria-label\": string;\n variant?: \"primary\" | \"secondary\" | \"ghost\" | \"outline\" | \"danger\";\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n isLoading?: boolean;\n rounded?: \"sm\" | \"md\" | \"lg\" | \"full\";\n}\n\nconst variantClasses: Record<NonNullable<IconButtonProps[\"variant\"]>, string> = {\n primary:\n `bg-primary text-primary-foreground border border-primary ${elevation.control} hover:bg-[var(--primary-hover)]`,\n secondary:\n `bg-muted text-foreground border border-border ${elevation.control} hover:bg-muted/85 dark:bg-muted/35 dark:text-foreground dark:border-border dark:hover:bg-muted/55`,\n ghost:\n \"bg-transparent text-foreground border border-transparent hover:bg-muted focus-visible:bg-muted/80 active:bg-muted/90\",\n outline:\n `bg-card text-foreground border border-border ${elevation.control} hover:bg-muted`,\n danger:\n `bg-red-600 text-white border border-red-600 ${elevation.control} hover:bg-red-700`,\n};\n\nconst sizeClasses: Record<NonNullable<IconButtonProps[\"size\"]>, string> = {\n xs: \"size-7 min-w-7\",\n sm: \"size-8 min-w-8\",\n md: \"size-9 min-w-9\",\n lg: \"size-10 min-w-10\",\n xl: \"size-11 min-w-11\",\n};\n\nconst iconSizeClasses: Record<NonNullable<IconButtonProps[\"size\"]>, string> = {\n xs: \"size-3.5\",\n sm: \"size-3.5\",\n md: \"size-4\",\n lg: \"size-[1.125rem]\",\n xl: \"size-5\",\n};\n\nconst roundedClasses: Record<NonNullable<IconButtonProps[\"rounded\"]>, string> = {\n sm: \"rounded-md\",\n md: \"rounded-lg\",\n lg: \"rounded-xl\",\n full: \"rounded-full\",\n};\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n variant = \"primary\",\n size = \"md\",\n isLoading = false,\n rounded = \"lg\",\n className,\n disabled,\n children,\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n return (\n <button\n ref={ref}\n aria-label={ariaLabel}\n title={ariaLabel}\n disabled={disabled || isLoading}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center font-medium\",\n \"transition-colors duration-pg-fast ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n variantClasses[variant],\n sizeClasses[size],\n roundedClasses[rounded],\n className\n )}\n {...props}\n >\n {isLoading ? (\n <Loader2 className={cn(\"animate-spin\", iconSizeClasses[size])} />\n ) : (\n children\n )}\n </button>\n );\n }\n);\nIconButton.displayName = \"IconButton\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { Clock, ChevronDown, X } from \"lucide-react\";\nimport { cn } from \"./utils\";\nimport { elevation } from \"./elevation\";\nimport { ScrollLockTakeover } from \"./scroll-lock\";\n\n/* ─── Types ──────────────────────────────────────────────────────────────── */\n\nexport interface TimePickerProps {\n /** Controlled value in 24-hour \"HH:MM\" format. Pass \"\" for no selection. */\n value: string;\n /** Called with a new \"HH:MM\" string, or \"\" when cleared. */\n onValueChange: (value: string) => void;\n /** Show 12-hour (AM/PM) columns instead of 24-hour. Default: false. */\n use24Hour?: boolean;\n placeholder?: string;\n label?: string;\n disabled?: boolean;\n className?: string;\n}\n\n/* ─── Helpers ────────────────────────────────────────────────────────────── */\n\nfunction pad(n: number) {\n return String(n).padStart(2, \"0\");\n}\n\nfunction parseHHMM(v: string): { h: number; m: number } | null {\n if (!v) return null;\n const parts = v.split(\":\");\n if (parts.length < 2) return null;\n const h = Number(parts[0]);\n const m = Number(parts[1]);\n if (isNaN(h) || isNaN(m)) return null;\n return { h, m };\n}\n\nfunction toHHMM(h: number, m: number) {\n return `${pad(h)}:${pad(m)}`;\n}\n\nfunction displayTime(value: string, use24Hour: boolean) {\n const p = parseHHMM(value);\n if (!p) return \"\";\n if (use24Hour) return `${pad(p.h)}:${pad(p.m)}`;\n const period = p.h < 12 ? \"AM\" : \"PM\";\n const displayH = p.h % 12 === 0 ? 12 : p.h % 12;\n return `${pad(displayH)}:${pad(p.m)} ${period}`;\n}\n\n/* ─── ScrollColumn ───────────────────────────────────────────────────────── */\n\nconst ITEM_H = 36; // px\nconst VISIBLE = 5; // items visible at once\nconst PAD = 2; // invisible padding rows above/below\n\ninterface ScrollColumnProps<T> {\n items: T[];\n selected: T;\n onSelect: (item: T) => void;\n renderItem: (item: T) => React.ReactNode;\n getKey: (item: T) => string | number;\n}\n\nfunction ScrollColumn<T>({\n items,\n selected,\n onSelect,\n renderItem,\n getKey,\n}: ScrollColumnProps<T>) {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const debounceRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const programmaticRef = React.useRef(false);\n\n const selectedIndex = items.findIndex((item) => getKey(item) === getKey(selected));\n\n /* Scroll to selected item */\n const scrollToIndex = React.useCallback(\n (index: number, behavior: ScrollBehavior = \"smooth\") => {\n const el = containerRef.current;\n if (!el) return;\n programmaticRef.current = true;\n el.scrollTo({ top: index * ITEM_H, behavior });\n if (behavior === \"smooth\") {\n // Release flag after animation\n setTimeout(() => {\n programmaticRef.current = false;\n }, 350);\n } else {\n programmaticRef.current = false;\n }\n },\n []\n );\n\n /* Initial scroll (instant) */\n React.useEffect(() => {\n if (selectedIndex >= 0) scrollToIndex(selectedIndex, \"instant\");\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /* Scroll when selected changes from outside */\n React.useEffect(() => {\n if (selectedIndex >= 0) scrollToIndex(selectedIndex, \"smooth\");\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedIndex]);\n\n /* Snap on scroll end */\n function handleScroll() {\n if (programmaticRef.current) return;\n if (debounceRef.current) clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n const el = containerRef.current;\n if (!el) return;\n const index = Math.round(el.scrollTop / ITEM_H);\n const clamped = Math.max(0, Math.min(index, items.length - 1));\n onSelect(items[clamped]);\n scrollToIndex(clamped, \"smooth\");\n }, 80);\n }\n\n return (\n <div className=\"relative flex flex-col items-center\" style={{ width: 64 }}>\n {/* Highlight band */}\n <div\n className=\"pointer-events-none absolute left-0 right-0 rounded-lg bg-primary/10\"\n style={{\n top: PAD * ITEM_H,\n height: ITEM_H,\n zIndex: 1,\n }}\n />\n\n {/* Scroll container */}\n <div\n ref={containerRef}\n onScroll={handleScroll}\n className=\"relative z-10 overflow-y-scroll\"\n style={{\n height: VISIBLE * ITEM_H,\n scrollSnapType: \"y mandatory\",\n scrollbarWidth: \"none\",\n msOverflowStyle: \"none\",\n }}\n >\n {/* Top padding rows */}\n {Array.from({ length: PAD }).map((_, i) => (\n <div key={`pad-top-${i}`} style={{ height: ITEM_H }} />\n ))}\n\n {items.map((item) => {\n const isSelected = getKey(item) === getKey(selected);\n return (\n <div\n key={getKey(item)}\n onClick={() => {\n onSelect(item);\n scrollToIndex(items.findIndex((it) => getKey(it) === getKey(item)), \"smooth\");\n }}\n className={cn(\n \"flex cursor-pointer items-center justify-center text-[14px] font-medium transition-colors duration-150 select-none\",\n isSelected\n ? \"text-primary font-semibold\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n style={{\n height: ITEM_H,\n scrollSnapAlign: \"start\",\n }}\n >\n {renderItem(item)}\n </div>\n );\n })}\n\n {/* Bottom padding rows */}\n {Array.from({ length: PAD }).map((_, i) => (\n <div key={`pad-bot-${i}`} style={{ height: ITEM_H }} />\n ))}\n </div>\n </div>\n );\n}\n\n/* ─── TimePicker ─────────────────────────────────────────────────────────── */\n\nconst PANEL_W = 224;\nconst PANEL_H = 220;\n\nexport const TimePicker = React.forwardRef<HTMLButtonElement, TimePickerProps>(\n (\n {\n value,\n onValueChange,\n use24Hour = false,\n placeholder = \"Select time\",\n label,\n disabled = false,\n className,\n },\n ref\n ) => {\n const parsed = parseHHMM(value);\n\n /* ── Local column state (derived from value, kept in sync) ── */\n const [hour, setHour] = React.useState<number>(() => {\n if (!parsed) return use24Hour ? 0 : 12;\n if (use24Hour) return parsed.h;\n return parsed.h % 12 === 0 ? 12 : parsed.h % 12;\n });\n const [minute, setMinute] = React.useState<number>(() => parsed?.m ?? 0);\n const [period, setPeriod] = React.useState<\"AM\" | \"PM\">(() => {\n if (!parsed) return \"AM\";\n return parsed.h < 12 ? \"AM\" : \"PM\";\n });\n\n /* Sync columns when value prop changes */\n React.useEffect(() => {\n const p = parseHHMM(value);\n if (p) {\n setMinute(p.m);\n if (use24Hour) {\n setHour(p.h);\n } else {\n setHour(p.h % 12 === 0 ? 12 : p.h % 12);\n setPeriod(p.h < 12 ? \"AM\" : \"PM\");\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value]);\n\n /* ── Panel open/position ── */\n const [open, setOpen] = React.useState(false);\n const [panelPos, setPanelPos] = React.useState({ top: 0, left: 0 });\n const [mounted, setMounted] = React.useState(false);\n\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => { setMounted(true); }, []);\n\n function openPanel() {\n if (disabled) return;\n const el = triggerRef.current;\n if (!el) return;\n el.scrollIntoView({ block: \"nearest\", behavior: \"auto\" });\n requestAnimationFrame(() => {\n if (!triggerRef.current) return;\n const rect = triggerRef.current.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n let left = rect.left;\n if (left + PANEL_W > vw - 8) left = vw - PANEL_W - 8;\n let top = rect.bottom + 6;\n if (top + PANEL_H > vh - 8) top = rect.top - PANEL_H - 6;\n setPanelPos({ top, left });\n setOpen(true);\n });\n }\n\n /* Close on outside click */\n React.useEffect(() => {\n if (!open) return;\n function handler(e: MouseEvent) {\n const inTrigger = triggerRef.current?.contains(e.target as Node);\n const inPanel = panelRef.current?.contains(e.target as Node);\n if (!inTrigger && !inPanel) setOpen(false);\n }\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n /* ── Emit value when columns change ── */\n function emitChange(h: number, m: number, p: \"AM\" | \"PM\") {\n let h24 = h;\n if (!use24Hour) {\n if (p === \"AM\") h24 = h === 12 ? 0 : h;\n else h24 = h === 12 ? 12 : h + 12;\n }\n onValueChange(toHHMM(h24, m));\n }\n\n function handleHourChange(h: number) {\n setHour(h);\n emitChange(h, minute, period);\n }\n function handleMinuteChange(m: number) {\n setMinute(m);\n emitChange(hour, m, period);\n }\n function handlePeriodChange(p: \"AM\" | \"PM\") {\n setPeriod(p);\n emitChange(hour, minute, p);\n }\n\n /* ── Column data ── */\n const hours = use24Hour\n ? Array.from({ length: 24 }, (_, i) => i)\n : Array.from({ length: 12 }, (_, i) => i + 1);\n\n const minutes = Array.from({ length: 60 }, (_, i) => i);\n\n /* ── Clear ── */\n function handleClear(e: React.MouseEvent) {\n e.stopPropagation();\n onValueChange(\"\");\n }\n\n /* ── Panel ── */\n /**\n * Wrapped in `RemoveScroll` so the columns can be scrolled inside a modal\n * Dialog or Drawer.\n *\n * Radix's Dialog renders its overlay inside `RemoveScroll` with only\n * `Dialog.Content` as a shard. This panel is portaled to `document.body`, so\n * it is neither the lock container nor a shard, and react-remove-scroll's\n * `shouldPrevent` calls `preventDefault()` on every wheel and touch event it\n * receives — leaving only the rows already on screen reachable, and every\n * other time selectable solely by clicking two rows at a time.\n *\n * Mounting our own lock pushes it to the top of react-remove-scroll's\n * `lockStack`, and the sidecar bails out for any lock that is not the last\n * one, so this panel's scrolling is honoured while the dialog's own lock\n * still holds for the page behind it. It is the same thing Radix `Select`\n * does with its content, and the reason a Select works inside a dialog where\n * this panel did not.\n *\n * Enabled unconditionally rather than only inside a dialog: the panel's\n * position is `fixed` and computed once on open, so locking the page also\n * stops it drifting away from its trigger on a scrollable page.\n */\n const panel = open ? (\n <RemoveScroll allowPinchZoom>\n <div\n ref={panelRef}\n className={cn(\n \"isolate rounded-xl border border-border bg-popover text-popover-foreground\",\n elevation.popover,\n \"flex flex-col gap-0\"\n )}\n style={{\n position: \"fixed\",\n top: panelPos.top,\n left: panelPos.left,\n width: PANEL_W,\n zIndex: 20000,\n // See DatePicker: a modal Radix Dialog puts `pointer-events: none`\n // on <body>, which this portaled panel would otherwise inherit —\n // the columns rendered but no row could be clicked.\n pointerEvents: \"auto\",\n }}\n >\n {/* Header */}\n <div className=\"flex items-center gap-1.5 border-b border-border px-4 py-2.5\">\n <Clock className=\"size-3.5 text-muted-foreground\" />\n <span className=\"text-[13px] font-medium text-muted-foreground\">\n {value ? displayTime(value, use24Hour) : \"—\"}\n </span>\n </div>\n\n {/* Column labels */}\n <div\n className=\"flex items-center justify-around px-2 pt-2 pb-0.5\"\n style={{ paddingLeft: 8, paddingRight: use24Hour ? 8 : 8 }}\n >\n <span className=\"w-16 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n Hr\n </span>\n <span className=\"w-16 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n Min\n </span>\n {!use24Hour && (\n <span className=\"w-16 text-center text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">\n AM/PM\n </span>\n )}\n </div>\n\n {/* Columns */}\n <div className=\"flex items-center justify-around px-2 pb-3\">\n <ScrollColumn\n items={hours}\n selected={hour}\n onSelect={handleHourChange}\n renderItem={(h) => pad(h)}\n getKey={(h) => h}\n />\n <div className=\"text-[18px] font-light text-muted-foreground/50 pb-0.5\">:</div>\n <ScrollColumn\n items={minutes}\n selected={minute}\n onSelect={handleMinuteChange}\n renderItem={(m) => pad(m)}\n getKey={(m) => m}\n />\n {!use24Hour && (\n <>\n <div className=\"w-px self-stretch bg-border mx-1\" />\n <ScrollColumn\n items={[\"AM\", \"PM\"] as const}\n selected={period}\n onSelect={handlePeriodChange}\n renderItem={(p) => p}\n getKey={(p) => p}\n />\n </>\n )}\n </div>\n </div>\n </RemoveScroll>\n ) : null;\n\n /* ── Merge refs ── */\n function mergeRef(el: HTMLButtonElement | null) {\n (triggerRef as React.MutableRefObject<HTMLButtonElement | null>).current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) (ref as React.MutableRefObject<HTMLButtonElement | null>).current = el;\n }\n\n return (\n <div className={cn(\"relative\", className)}>\n {label && (\n <p className=\"mb-1.5 text-sm font-medium text-foreground\">{label}</p>\n )}\n\n <button\n ref={mergeRef}\n type=\"button\"\n disabled={disabled}\n onClick={() => (open ? setOpen(false) : openPanel())}\n className={cn(\n \"flex h-11 min-h-11 w-full items-center gap-3 rounded-lg border border-border bg-card px-4 text-left text-[15px]\",\n elevation.field,\n \"transition-colors duration-150\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n open && \"border-ring ring-2 ring-ring/35\",\n !open && !disabled && \"hover:border-muted-foreground/45\",\n disabled && \"cursor-not-allowed opacity-50\"\n )}\n >\n <Clock className=\"size-[1.0625rem] shrink-0 text-muted-foreground\" />\n <span\n className={cn(\n \"flex-1 truncate\",\n value ? \"text-foreground\" : \"text-muted-foreground\"\n )}\n >\n {value ? displayTime(value, use24Hour) : placeholder}\n </span>\n {value && !disabled ? (\n <X\n className=\"size-3.5 shrink-0 text-muted-foreground hover:text-foreground transition-colors duration-150\"\n onClick={handleClear}\n />\n ) : (\n <ChevronDown\n className={cn(\n \"size-[1.0625rem] shrink-0 text-muted-foreground transition-transform duration-150\",\n open && \"rotate-180\"\n )}\n />\n )}\n </button>\n\n {/* Wrapped so the hour/minute columns can be scrolled when the picker\n opens inside a Dialog or Drawer. See `scroll-lock.tsx`. */}\n {mounted &&\n panel &&\n createPortal(<ScrollLockTakeover>{panel}</ScrollLockTakeover>, document.body)}\n </div>\n );\n }\n);\n\nTimePicker.displayName = \"TimePicker\";\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\n\n// ---------------------------------------------------------------------------\n// Heading\n// ---------------------------------------------------------------------------\n\nexport interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n as?: React.ElementType;\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\n color?: \"default\" | \"subtle\" | \"primary\";\n}\n\nconst headingSizeClasses: Record<NonNullable<HeadingProps[\"size\"]>, string> = {\n xs: \"text-sm font-semibold\",\n sm: \"text-base font-semibold\",\n md: \"text-lg font-semibold\",\n lg: \"text-xl font-semibold\",\n xl: \"text-2xl font-semibold\",\n \"2xl\": \"text-3xl font-semibold tracking-tight\",\n \"3xl\": \"text-4xl font-semibold tracking-tight\",\n};\n\nconst headingColorClasses: Record<NonNullable<HeadingProps[\"color\"]>, string> = {\n default: \"text-foreground\",\n subtle: \"text-muted-foreground\",\n primary: \"text-primary\",\n};\n\nconst defaultSizeForLevel: Record<number, NonNullable<HeadingProps[\"size\"]>> = {\n 1: \"2xl\",\n 2: \"md\",\n 3: \"md\",\n 4: \"sm\",\n 5: \"xs\",\n 6: \"xs\",\n};\n\nexport const Heading = React.forwardRef<HTMLHeadingElement, HeadingProps>(\n (\n {\n level = 2,\n as,\n size,\n color = \"default\",\n className,\n children,\n ...props\n },\n ref\n ) => {\n const Tag = (as ?? (`h${level}` as React.ElementType)) as React.ElementType;\n const resolvedSize = size ?? defaultSizeForLevel[level] ?? \"md\";\n\n return (\n <Tag\n ref={ref}\n className={cn(\n headingSizeClasses[resolvedSize],\n headingColorClasses[color],\n className\n )}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nHeading.displayName = \"Heading\";\n\n// ---------------------------------------------------------------------------\n// Text\n// ---------------------------------------------------------------------------\n\nexport interface TextProps extends React.HTMLAttributes<HTMLElement> {\n as?: \"p\" | \"span\" | \"div\" | \"label\";\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\n weight?: \"normal\" | \"medium\" | \"semibold\";\n color?: \"default\" | \"subtle\" | \"primary\" | \"disabled\";\n truncate?: boolean;\n}\n\nconst textSizeClasses: Record<NonNullable<TextProps[\"size\"]>, string> = {\n xs: \"text-xs\",\n sm: \"text-sm\",\n md: \"text-base\",\n lg: \"text-lg\",\n};\n\nconst textWeightClasses: Record<NonNullable<TextProps[\"weight\"]>, string> = {\n normal: \"font-normal\",\n medium: \"font-medium\",\n semibold: \"font-semibold\",\n};\n\nconst textColorClasses: Record<NonNullable<TextProps[\"color\"]>, string> = {\n default: \"text-foreground\",\n subtle: \"text-muted-foreground\",\n primary: \"text-primary\",\n disabled: \"text-muted-foreground opacity-50\",\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const Text = React.forwardRef<any, TextProps>(\n (\n {\n as: Tag = \"p\",\n size = \"sm\",\n weight = \"normal\",\n color = \"default\",\n truncate = false,\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <Tag\n ref={ref}\n className={cn(\n textSizeClasses[size],\n textWeightClasses[weight],\n textColorClasses[color],\n truncate && \"truncate\",\n className\n )}\n {...props}\n >\n {children}\n </Tag>\n );\n }\n);\nText.displayName = \"Text\";\n\n// ---------------------------------------------------------------------------\n// MetricText\n// ---------------------------------------------------------------------------\n\nexport interface MetricTextProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n trend?: \"up\" | \"down\" | \"neutral\";\n prefix?: React.ReactNode;\n suffix?: React.ReactNode;\n}\n\nconst metricSizeClasses: Record<NonNullable<MetricTextProps[\"size\"]>, string> = {\n sm: \"text-xl\",\n md: \"text-2xl\",\n lg: \"text-3xl\",\n xl: \"text-4xl\",\n};\n\nconst metricTrendClasses: Record<NonNullable<MetricTextProps[\"trend\"]>, string> = {\n up: \"text-green-600\",\n down: \"text-red-600\",\n neutral: \"text-foreground\",\n};\n\nexport const MetricText = React.forwardRef<HTMLSpanElement, MetricTextProps>(\n (\n {\n size = \"md\",\n trend = \"neutral\",\n prefix,\n suffix,\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <span\n ref={ref}\n className={cn(\n \"font-semibold tabular-nums tracking-tight\",\n metricSizeClasses[size],\n metricTrendClasses[trend],\n className\n )}\n {...props}\n >\n {prefix != null && (\n <span className=\"mr-0.5 text-[0.75em] font-medium opacity-70\">\n {prefix}\n </span>\n )}\n {children}\n {suffix != null && (\n <span className=\"ml-0.5 text-[0.75em] font-medium opacity-70\">\n {suffix}\n </span>\n )}\n </span>\n );\n }\n);\nMetricText.displayName = \"MetricText\";\n","\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport type ProgressIndicatorSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n selectedIndex: number;\n values: string[];\n size?: ProgressIndicatorSize;\n onChange?: (index: number) => void;\n}\n\nconst dotSizeMap: Record<ProgressIndicatorSize, { base: string; active: string }> = {\n sm: {\n base: \"h-1.5 w-1.5\",\n active: \"h-1.5 w-4\",\n },\n md: {\n base: \"h-2 w-2\",\n active: \"h-2 w-6\",\n },\n lg: {\n base: \"h-2.5 w-2.5\",\n active: \"h-2.5 w-8\",\n },\n};\n\nconst ProgressIndicator = React.forwardRef<HTMLDivElement, ProgressIndicatorProps>(\n ({ className, selectedIndex, values, size = \"md\", onChange, ...props }, ref) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!onChange) return;\n if (e.key === \"ArrowRight\") {\n e.preventDefault();\n const next = Math.min(selectedIndex + 1, values.length - 1);\n if (next !== selectedIndex) onChange(next);\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n const prev = Math.max(selectedIndex - 1, 0);\n if (prev !== selectedIndex) onChange(prev);\n }\n },\n [onChange, selectedIndex, values.length]\n );\n\n const sizes = dotSizeMap[size];\n\n return (\n <div\n ref={ref}\n role=\"tablist\"\n aria-label={props[\"aria-label\"] ?? \"Step indicator\"}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n className={cn(\"flex items-center gap-1.5 outline-none focus-visible:outline-none\", className)}\n {...props}\n >\n {values.map((label, index) => {\n const isActive = index === selectedIndex;\n return (\n <button\n key={index}\n type=\"button\"\n role=\"tab\"\n aria-label={label}\n aria-current={isActive ? \"step\" : undefined}\n aria-selected={isActive}\n tabIndex={-1}\n onClick={() => onChange?.(index)}\n className={cn(\n \"rounded-full transition-all duration-pg-normal ease-pg-standard\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/35\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n isActive\n ? cn(\"bg-primary\", sizes.active)\n : cn(\n \"bg-muted-foreground/30 hover:bg-muted-foreground/50\",\n sizes.base\n )\n )}\n />\n );\n })}\n </div>\n );\n }\n);\nProgressIndicator.displayName = \"ProgressIndicator\";\n\nexport { ProgressIndicator };\n","import * as React from \"react\";\nimport { cn } from \"./utils\";\n\nexport interface VisuallyHiddenProps extends React.HTMLAttributes<HTMLElement> {\n as?: React.ElementType;\n focusable?: boolean;\n}\n\nconst VisuallyHidden = React.forwardRef<HTMLElement, VisuallyHiddenProps>(\n ({ as: Component = \"span\", focusable = false, className, ...props }, ref) => (\n <Component\n ref={ref}\n className={cn(\n focusable\n ? \"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:px-4 focus:py-2 focus:bg-card focus:text-foreground focus:rounded-md focus:shadow-lg focus:ring-2 focus:ring-ring\"\n : \"sr-only\",\n className\n )}\n {...props}\n />\n )\n);\nVisuallyHidden.displayName = \"VisuallyHidden\";\n\nexport { VisuallyHidden };\n","\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from \"react\";\nimport {\n Check,\n ChevronLeft,\n ChevronRight,\n Plus,\n Search,\n SlidersHorizontal,\n X,\n} from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { Checkbox } from \"./checkbox\";\nimport { DatePicker } from \"./date-picker\";\nimport { Input } from \"./input\";\nimport { Tabs, TabsList, TabsTrigger } from \"./tabs\";\nimport { IconButton } from \"./icon-button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { Separator } from \"./separator\";\nimport { formatMonthLabel, MONTHS_SHORT } from \"./format-datetime\";\n\n/**\n * Bounds a popover by the space that is actually below (or above) the trigger,\n * rather than by a fixed pixel cap.\n *\n * A chip near the bottom of a long page has very little room beneath it, and a\n * `max-h-64` list plus a search box plus an Apply/Clear footer can easily run\n * past the fold — the last few options, and often Apply itself, end up\n * unreachable. Radix measures that space and publishes it as\n * `--radix-popover-content-available-height`; capping the content to it makes\n * the panel shrink to fit and its list scroll instead.\n *\n * The content becomes a flex column so the footer stays pinned to the bottom\n * while only the list scrolls. Panels pair this with `FILTER_SCROLL_AREA`.\n */\nconst POPOVER_FIT = \"flex max-h-[var(--radix-popover-content-available-height)] flex-col overflow-hidden\";\n\n/**\n * The scrolling half of a fitted popover: it takes whatever height is left over\n * once the fixed chrome has been laid out, never more than its own cap.\n * `min-h-0` is what lets a flex child shrink below its content height at all.\n */\nconst FILTER_SCROLL_AREA = \"min-h-0 flex-1 overflow-y-auto\";\n\nimport { cn } from \"./utils\";\n\nexport interface FilterChipOption {\n value: string;\n label: string;\n /** Optional leading glyph — a flag, a brand mark, a status dot. */\n icon?: ReactNode;\n /** Secondary text to the right, e.g. a matching count. */\n hint?: string;\n}\n\n// ── Group: one chip open at a time, without the flash ─────────────────────────\n\ntype FilterChipGroupContextValue = {\n openKey: string | null;\n setOpen: (key: string, open: boolean) => void;\n /**\n * True exactly once, for the chip that was closed to make way for another —\n * and clears itself on read. See `useFilterChipState`'s `onCloseAutoFocus`.\n */\n consumeHandoff: (key: string) => boolean;\n};\n\nconst FilterChipGroupContext = createContext<FilterChipGroupContextValue | null>(null);\n\n/**\n * Wraps a row of filter chips so only one popover is open at a time — and,\n * crucially, so switching between two chips does not make the second one flash.\n *\n * The flash comes from every chip sharing one `openChip` value while Radix\n * reports the two halves of the switch as separate events: the chip being\n * *opened* fires `onOpenChange(true)` and the chip being *dismissed* fires\n * `onOpenChange(false)`. A naive `setOpenChip(open ? key : null)` lets whichever\n * event lands second win, so when the dismissal lands second it wipes out the\n * chip that just opened — it mounts, paints, and unmounts.\n *\n * The fix is that a close only counts if the chip closing is still the one on\n * screen. A stale dismissal from the chip the user just left is then a no-op,\n * whatever order the events arrive in. This lives here rather than in each\n * toolbar because it is invisible until it is wrong, and it was wrong in every\n * toolbar that hand-rolled it.\n */\nexport function FilterChipGroup({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n const [openKey, setOpenKey] = useState<string | null>(null);\n\n /**\n * Mirrors `openKey` for synchronous reads. A switch is decided inside an\n * event handler, where the `openKey` from this render may already be stale.\n */\n const openKeyRef = useRef<string | null>(null);\n const frameRef = useRef<number | null>(null);\n /** The chip closed by a handoff, awaiting its close-auto-focus. */\n const handoffFromRef = useRef<string | null>(null);\n\n const apply = useCallback((next: string | null) => {\n openKeyRef.current = next;\n setOpenKey(next);\n }, []);\n\n /**\n * Opening a chip while another is open is a **handoff, not a swap**: the\n * outgoing chip closes now and the incoming one opens on the next frame, so\n * the two popovers never exist at the same moment.\n *\n * Simply reassigning `openKey` looks equivalent and is not. It mounts the new\n * popover inside the very click that closed the old one, which leaves the new\n * layer registering its dismissal listeners mid-event and able to catch the\n * tail of that same interaction — it opens, paints, and dismisses itself.\n * Deferring by a frame puts the mount cleanly after the click, so there is\n * nothing left of the previous interaction for it to react to.\n *\n * A close is still immediate, and only counts if the chip closing is the one\n * actually on screen — a stale close from the chip just left is a no-op\n * whatever order the events arrive in.\n */\n const setOpen = useCallback(\n (key: string, open: boolean) => {\n if (frameRef.current !== null) {\n cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n\n if (!open) {\n // A stale close from the chip just left is a no-op, whatever order the\n // events arrive in.\n if (openKeyRef.current === key) apply(null);\n return;\n }\n\n if (openKeyRef.current !== null && openKeyRef.current !== key) {\n handoffFromRef.current = openKeyRef.current;\n apply(null);\n frameRef.current = requestAnimationFrame(() => {\n frameRef.current = null;\n apply(key);\n });\n return;\n }\n\n apply(key);\n },\n [apply]\n );\n\n // A handoff in flight when the toolbar unmounts must not fire into nothing.\n useEffect(\n () => () => {\n if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);\n },\n []\n );\n\n const consumeHandoff = useCallback((key: string) => {\n if (handoffFromRef.current !== key) return false;\n handoffFromRef.current = null;\n return true;\n }, []);\n\n const value = useMemo(\n () => ({ openKey, setOpen, consumeHandoff }),\n [openKey, setOpen, consumeHandoff]\n );\n\n return (\n <FilterChipGroupContext.Provider value={value}>\n <div className={cn(\"flex flex-wrap items-center gap-2\", className)}>{children}</div>\n </FilterChipGroupContext.Provider>\n );\n}\n\n/**\n * Open state for one chip. Inside a {@link FilterChipGroup} the group owns it\n * so opening this chip closes its siblings; outside one, the chip keeps its own\n * state, so a lone chip works with no wrapper.\n *\n * Every chip below calls this rather than taking `open` / `onOpenChange` props,\n * which is what stops a call site from reintroducing the flicker by wiring the\n * state up itself. A chip that genuinely needs outside control can still pass\n * `open` / `onOpenChange` — a mounted-but-hidden twin of a chip, say — and\n * those win.\n */\nexport function useFilterChipState(\n key: string,\n controlled?: { open?: boolean; onOpenChange?: (open: boolean) => void }\n): {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Spread onto the chip's `PopoverContent`. See below. */\n onCloseAutoFocus: (event: Event) => void;\n} {\n const group = useContext(FilterChipGroupContext);\n const [localOpen, setLocalOpen] = useState(false);\n\n const isControlled = controlled?.open !== undefined;\n\n const onOpenChange = useCallback(\n (next: boolean) => {\n controlled?.onOpenChange?.(next);\n if (isControlled) return;\n if (group) group.setOpen(key, next);\n else setLocalOpen(next);\n },\n [controlled, isControlled, group, key]\n );\n\n const open = isControlled ? controlled!.open! : group ? group.openKey === key : localOpen;\n\n /**\n * Stops a chip closed by a **handoff** from pulling focus back to its own\n * trigger, which would land outside the chip now opening and make Radix\n * dismiss it — the flash.\n *\n * Radix restores focus on close unless the popover was dismissed by an\n * outside interaction. A handoff is neither: the group closes the chip\n * programmatically, so as far as Radix is concerned this is an ordinary close\n * and the trigger should get focus back. It should not — the user's attention\n * has moved to another chip.\n *\n * Escape and Apply still restore focus, because neither is a handoff.\n */\n const onCloseAutoFocus = useCallback(\n (event: Event) => {\n if (group?.consumeHandoff(key)) {\n event.preventDefault();\n }\n },\n [group, key]\n );\n\n return { open, onOpenChange, onCloseAutoFocus };\n}\n\n/** The `open` / `onOpenChange` pair every chip accepts for outside control. */\nexport interface FilterChipControl {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n// ── Chip shell ────────────────────────────────────────────────────────────────\n\n/**\n * Every filter chip is built from three pieces: this visual shell (the dashed\n * pill), a label trigger that opens the popover, and — only once the filter has\n * a value — a separate clear button to its left.\n *\n * The clear button and the trigger are two independent `<button>`s side by side\n * rather than one button whose leading icon doubles as a clear action: clicking\n * × must clear *without* opening the popover, and a real `<button>` cannot nest\n * inside another. Keeping them siblings means stopping the clear click from\n * also opening the popover needs no `stopPropagation` gymnastics — they are\n * simply two separate click targets.\n *\n * Inactive it reads as an \"add a filter\" affordance: a dashed outline in the\n * muted border colour. Active it flips to a solid primary ring with a tinted\n * fill, so an applied filter is unmistakable at a glance rather than a subtle\n * recolour of the same dashed outline.\n */\nexport function FilterChipShell({\n active,\n children,\n className,\n}: {\n active: boolean;\n children: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n \"inline-flex h-auto shrink-0 items-center rounded-full border border-dashed border-border bg-card shadow-sm\",\n active && \"border-solid border-primary bg-primary/10 shadow-none ring-1 ring-primary/30\",\n className\n )}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Leading × segment, rendered only when the filter is active.\n *\n * A `Button` rather than an `IconButton` so the `h-auto` / `min-h-0` height\n * override behaves the same way the label trigger's already does: IconButton\n * sizes with Tailwind's `size-*` utility, which a plain `h-auto` does not\n * reliably beat the way it beats Button's `h-9`.\n */\nexport function FilterChipClearButton({\n label,\n onClick,\n}: {\n label: string;\n onClick: () => void;\n}) {\n return (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Clear ${label} filter`}\n onClick={onClick}\n className=\"h-auto min-h-0 shrink-0 rounded-full border border-transparent px-2 py-1 text-primary/70 hover:text-primary\"\n >\n <X className=\"h-3 w-3\" />\n </Button>\n );\n}\n\n/**\n * Trailing label segment — the actual `PopoverTrigger` target.\n *\n * A leading plus shows only while inactive, since once active the clear button\n * to its left already carries a leading icon. A trailing dot then marks\n * \"active\"; `count` replaces it with a number when *how many* values are\n * applied is worth saying.\n *\n * Must forward its ref and spread the rest of its props onto the underlying\n * Button: `PopoverTrigger asChild` clones its single child to inject\n * onClick/ref/aria-*, and a component that swallows those renders a chip that\n * looks right and does nothing when clicked.\n */\nexport const FilterChipLabelTrigger = forwardRef<\n HTMLButtonElement,\n {\n label: string;\n active: boolean;\n /** Show this number instead of the plain active dot. */\n count?: number;\n } & Omit<ComponentPropsWithoutRef<typeof Button>, \"children\">\n>(({ label, active, count, className, ...props }, ref) => (\n <Button\n ref={ref}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n leftIcon={\n !active ? (\n <span className=\"flex h-3.5 w-3.5 items-center justify-center\">\n <Plus className=\"h-3 w-3\" />\n </span>\n ) : undefined\n }\n rightIcon={\n active ? (\n <span className=\"flex h-3.5 items-center justify-center\">\n {count != null && count > 0 ? (\n <span className=\"rounded-full bg-primary/15 px-1.5 text-[10px] font-semibold tabular-nums text-primary\">\n {count}\n </span>\n ) : (\n /* Drawn the way Badge draws its dot: the same size-1.5 rounded\n fill in the primary accent. A state marker, not a count. */\n <span className=\"size-1.5 rounded-full bg-primary\" aria-hidden />\n )}\n </span>\n ) : undefined\n }\n className={cn(\n \"h-auto min-h-0 shrink-0 rounded-full border border-transparent py-1\",\n active\n ? \"pl-1.5 pr-2.5 font-semibold text-primary hover:text-primary\"\n : \"pl-2.5 pr-2.5 text-muted-foreground hover:text-foreground\",\n className\n )}\n {...props}\n >\n {label}\n </Button>\n));\nFilterChipLabelTrigger.displayName = \"FilterChipLabelTrigger\";\n\n/**\n * Apply / Clear footer shared by every panel, so the two buttons sit in the\n * same place and read the same wherever a chip's editor puts them.\n *\n * Both buttons **commit and close**. Clear is not \"untick everything and let me\n * carry on\" — that reading leaves the panel open over a filter that is still\n * applied, so the chip still reads \"Type 1\" while the list in front of you\n * shows nothing ticked, and closing the panel silently keeps the old filter.\n * Clear is the same act as the chip's own little x, reached from inside the\n * panel: it drops the filter and gets out of the way.\n */\nexport function FilterChipActions({\n onClear,\n onApply,\n clearDisabled,\n applyDisabled,\n}: {\n onClear: () => void;\n onApply: () => void;\n clearDisabled?: boolean;\n applyDisabled?: boolean;\n}) {\n return (\n <div className=\"flex shrink-0 items-center justify-between gap-2 border-t border-border px-3 py-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={onClear}\n disabled={clearDisabled}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n Clear\n </Button>\n <Button type=\"button\" variant=\"primary\" size=\"sm\" onClick={onApply} disabled={applyDisabled}>\n Apply\n </Button>\n </div>\n );\n}\n\n/**\n * The full chip — shell, clear button, trigger and popover — with the editor\n * supplied as `children`. Build a bespoke chip on this rather than reassembling\n * the pieces, so a one-off filter still opens, closes and clears like the rest.\n */\nexport function FilterChip({\n chipKey,\n label,\n active,\n count,\n onClear,\n children,\n align = \"start\",\n contentClassName,\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n onOpen,\n}: {\n /** Identity within a {@link FilterChipGroup}. Must be unique in the row. */\n chipKey: string;\n label: string;\n active: boolean;\n count?: number;\n /** Omit to hide the × segment — for a chip that cannot be emptied. */\n onClear?: () => void;\n children: ReactNode;\n align?: \"start\" | \"center\" | \"end\";\n contentClassName?: string;\n /** Fires when the popover opens — the hook for seeding a draft from the\n * applied value, so an abandoned edit never leaks into the next open. */\n onOpen?: () => void;\n} & FilterChipControl) {\n const { open, onOpenChange, onCloseAutoFocus } = useFilterChipState(chipKey, {\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n });\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n onOpenChange(next);\n if (next) onOpen?.();\n }}\n >\n <FilterChipShell active={active}>\n {active && onClear ? (\n <FilterChipClearButton\n label={label}\n onClick={() => {\n onClear();\n onOpenChange(false);\n }}\n />\n ) : null}\n <PopoverTrigger asChild>\n <FilterChipLabelTrigger label={label} active={active} count={count} />\n </PopoverTrigger>\n </FilterChipShell>\n <PopoverContent\n align={align}\n className={cn(\"w-auto p-0\", POPOVER_FIT, contentClassName)}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n {children}\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Multi-select chip ─────────────────────────────────────────────────────────\n\nexport interface SelectFilterChipProps extends FilterChipControl {\n /** Identity within a group. Defaults to `label`. */\n chipKey?: string;\n label: string;\n options: FilterChipOption[];\n selected: string[];\n onChange: (next: string[]) => void;\n /** Show a search box above the list once there are this many options. Default 8. */\n searchThreshold?: number;\n /** Show the applied count on the chip instead of the plain active dot. */\n showCount?: boolean;\n /**\n * Adds an \"Invert filter\" tick below the list, turning the chosen set into an\n * exclusion. Pass both to enable it; omit for a plain include-only chip.\n *\n * It is staged with the options and applied with them, because inverting\n * without changing the set is still a change to what the table shows, and\n * committing it on the tick would make this one control in the panel behave\n * differently from the rest.\n */\n invert?: boolean;\n onInvertChange?: (next: boolean) => void;\n /** Label for the invert tick. Default \"Invert filter\". */\n invertLabel?: string;\n /** Empty-list line, for options that arrive from a request. */\n emptyText?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * The workhorse chip: a checkbox list staged behind Apply, so ticking four\n * boxes is one query rather than four. Escaping or clicking away discards the\n * draft — the applied value only changes on Apply or Clear.\n */\nexport function SelectFilterChip({\n chipKey,\n label,\n options,\n selected,\n onChange,\n searchThreshold = 8,\n showCount = true,\n invert = false,\n onInvertChange,\n invertLabel = \"Invert filter\",\n emptyText,\n align = \"start\",\n open,\n onOpenChange,\n}: SelectFilterChipProps) {\n const key = chipKey ?? label;\n // Resolved here, not just inside `FilterChip`, because this component's own\n // Apply and Clear need to close the popover — and under a `FilterChipGroup`\n // the `onOpenChange` prop is undefined, since the group owns that state.\n const chip = useFilterChipState(key, { open, onOpenChange });\n const [draft, setDraft] = useState<string[]>(selected);\n const [draftInvert, setDraftInvert] = useState(invert);\n const [query, setQuery] = useState(\"\");\n const supportsInvert = !!onInvertChange;\n // An inversion with nothing chosen excludes nothing, so it is not on its own\n // an active filter.\n const isActive = selected.length > 0;\n\n // Matched on the value as well as the label, so \"nz\" finds New Zealand and a\n // raw status code finds its prettified row. Someone who thinks in codes should\n // not have to know the display name.\n const visible = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return options;\n return options.filter(\n (o) => o.label.toLowerCase().includes(q) || o.value.toLowerCase().includes(q)\n );\n }, [options, query]);\n\n const toggle = (value: string) =>\n setDraft((prev) =>\n prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]\n );\n\n return (\n <FilterChip\n chipKey={key}\n // An inverted chip says so on the pill: \"Status Code\" and \"Status Code\n // (excluded)\" filter to opposite halves of the same data, and a shared\n // count would otherwise be the only difference between them.\n label={supportsInvert && invert && isActive ? `${label} (excluded)` : label}\n active={isActive}\n count={showCount ? selected.length : undefined}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n // Reseed from the applied value on every open, so a draft abandoned last\n // time does not reappear as though it had been applied.\n onOpen={() => {\n setDraft(selected);\n setDraftInvert(invert);\n setQuery(\"\");\n }}\n onClear={() => {\n onChange([]);\n setDraft([]);\n onInvertChange?.(false);\n setDraftInvert(false);\n }}\n >\n <FilterChipPanel\n options={visible}\n draft={draft}\n onToggle={toggle}\n query={options.length >= searchThreshold ? query : undefined}\n onQueryChange={setQuery}\n searchPlaceholder={`Search ${label.toLowerCase()}`}\n emptyText={emptyText}\n invert={supportsInvert ? draftInvert : undefined}\n onInvertChange={setDraftInvert}\n invertLabel={invertLabel}\n />\n <FilterChipActions\n onClear={() => {\n onChange([]);\n setDraft([]);\n onInvertChange?.(false);\n setDraftInvert(false);\n chip.onOpenChange(false);\n }}\n // Disabled only when there is genuinely nothing to drop: an applied\n // value with an emptied draft is still something to clear.\n clearDisabled={draft.length === 0 && selected.length === 0 && !draftInvert && !invert}\n onApply={() => {\n onChange(draft);\n onInvertChange?.(draftInvert);\n chip.onOpenChange(false);\n }}\n />\n </FilterChip>\n );\n}\n\n/** The checkbox list itself, reused by the multi-select chip and the add menu. */\nfunction FilterChipPanel({\n options,\n draft,\n onToggle,\n query,\n onQueryChange,\n searchPlaceholder,\n emptyText,\n invert,\n onInvertChange,\n invertLabel,\n}: {\n options: FilterChipOption[];\n draft: string[];\n onToggle: (value: string) => void;\n query?: string;\n onQueryChange: (q: string) => void;\n searchPlaceholder: string;\n emptyText?: string;\n /** Undefined hides the invert row entirely. */\n invert?: boolean;\n onInvertChange: (next: boolean) => void;\n invertLabel?: string;\n}) {\n return (\n <div className=\"flex min-h-0 w-60 flex-1 flex-col\">\n {query !== undefined ? (\n <div className=\"shrink-0 border-b border-border p-2\">\n <Input\n value={query}\n onChange={(e) => onQueryChange(e.target.value)}\n placeholder={searchPlaceholder}\n className=\"h-8 text-[12.5px]\"\n />\n </div>\n ) : null}\n <div className={cn(\"max-h-64 space-y-0.5 p-2\", FILTER_SCROLL_AREA)}>\n {options.length === 0 ? (\n <p className=\"px-1 py-4 text-center text-[12.5px] text-muted-foreground\">\n {emptyText ?? \"No matches\"}\n </p>\n ) : (\n options.map((option) => (\n <label\n key={option.value}\n className=\"flex cursor-pointer items-center gap-2 rounded-md px-1 py-1 text-[12.5px] text-foreground hover:bg-muted/50\"\n >\n <Checkbox\n checked={draft.includes(option.value)}\n onCheckedChange={() => onToggle(option.value)}\n />\n {option.icon}\n <span className=\"min-w-0 flex-1 truncate\">{option.label}</span>\n {option.hint ? (\n <span className=\"shrink-0 text-[11px] tabular-nums text-muted-foreground\">\n {option.hint}\n </span>\n ) : null}\n </label>\n ))\n )}\n </div>\n\n {invert !== undefined ? (\n <label className=\"flex shrink-0 cursor-pointer items-center gap-2 border-t border-border px-3 py-2 text-[12.5px] text-foreground\">\n <Checkbox checked={invert} onCheckedChange={(c) => onInvertChange(c === true)} />\n {invertLabel}\n </label>\n ) : null}\n </div>\n );\n}\n\n// ── Single-select chip ────────────────────────────────────────────────────────\n\nexport interface SingleSelectFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label: string;\n options: FilterChipOption[];\n value: string;\n onChange: (next: string) => void;\n align?: \"start\" | \"center\" | \"end\";\n /** Show the chosen option's label on the chip instead of the field name. */\n showValueInLabel?: boolean;\n}\n\n/**\n * One-of-many. Picking applies immediately — there is nothing to stage when a\n * choice replaces rather than accumulates, and an Apply button for a single\n * click is a step that only costs the user time.\n */\nexport function SingleSelectFilterChip({\n chipKey,\n label,\n options,\n value,\n onChange,\n align = \"start\",\n showValueInLabel = false,\n open,\n onOpenChange,\n}: SingleSelectFilterChipProps) {\n const key = chipKey ?? label;\n // See SelectFilterChip: picking an option has to close the popover itself.\n const chip = useFilterChipState(key, { open, onOpenChange });\n const isActive = value !== \"\";\n const chosen = options.find((o) => o.value === value);\n\n return (\n <FilterChip\n chipKey={key}\n label={showValueInLabel && chosen ? `${label}: ${chosen.label}` : label}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onClear={() => onChange(\"\")}\n >\n <div className={cn(\"max-h-64 w-52 p-1.5\", FILTER_SCROLL_AREA)}>\n {options.map((option) => (\n <Button\n key={option.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n onChange(option.value);\n chip.onOpenChange(false);\n }}\n className={cn(\n \"w-full justify-start rounded-md px-2 py-1.5 text-[12.5px] font-normal\",\n option.value === value && \"bg-primary/10 font-medium text-primary\"\n )}\n >\n {option.icon}\n <span className=\"truncate\">{option.label}</span>\n </Button>\n ))}\n </div>\n </FilterChip>\n );\n}\n\n// ── Date-range chip ───────────────────────────────────────────────────────────\n\nexport interface DateRangeValue {\n /** `yyyy-mm-dd`, or \"\" for unset. */\n from: string;\n to: string;\n}\n\n/**\n * `DatePicker` renders `<div className={cn(\"relative\", className)}>` with its\n * trigger `<button>` as the direct child, and hard-codes a tall trigger\n * (`h-12 rounded-xl px-5 text-[15px]`) sized for a form field. Inside a chip\n * popover that towers over everything around it, so `[&>button]` reaches the\n * trigger and brings it back to the size of the console's other dropdowns.\n */\nconst DATE_CHIP_TRIGGER =\n \"[&>button]:!h-10 [&>button]:!min-h-0 [&>button]:!gap-2 [&>button]:!rounded-lg [&>button]:!px-3.5 [&>button]:!text-sm [&>button]:!font-normal [&>button]:!shadow-none [&>button>svg]:!size-4\";\n\n/**\n * \"Last N weeks / days / hours / minutes\", counted back from now.\n *\n * A duration rather than a pair of dates, because that is what it is: \"last 2\n * days\" means two days before *now*, and resolving it to fixed timestamps when\n * the user picks it quietly freezes it at the moment of the click. The chip\n * reports the duration; the caller resolves it at request time with\n * {@link relativeRangeToMillis}.\n *\n * Every field is a string because each is a text input, and \"\" is a field the\n * user has not filled in — distinct from \"0\".\n */\nexport interface RelativeRangeValue {\n weeks: string;\n days: string;\n hours: string;\n minutes: string;\n}\n\nexport const EMPTY_RELATIVE_RANGE: RelativeRangeValue = {\n weeks: \"\",\n days: \"\",\n hours: \"\",\n minutes: \"\",\n};\n\nconst RELATIVE_UNITS: {\n key: keyof RelativeRangeValue;\n label: string;\n seconds: number;\n}[] = [\n { key: \"weeks\", label: \"Weeks\", seconds: 7 * 24 * 60 * 60 },\n { key: \"days\", label: \"Days\", seconds: 24 * 60 * 60 },\n { key: \"hours\", label: \"Hours\", seconds: 60 * 60 },\n { key: \"minutes\", label: \"Minutes\", seconds: 60 },\n];\n\nfunction relativeRangeSeconds(value: RelativeRangeValue): number {\n return RELATIVE_UNITS.reduce((total, unit) => {\n const parsed = parseInt(value[unit.key] || \"0\", 10);\n return total + (Number.isNaN(parsed) ? 0 : parsed) * unit.seconds;\n }, 0);\n}\n\n/** Whether a relative range names any span at all. */\nexport function hasRelativeRange(value: RelativeRangeValue | undefined): boolean {\n return !!value && relativeRangeSeconds(value) > 0;\n}\n\n/**\n * Resolves a relative range to absolute epoch millis, evaluated at call time.\n *\n * Deliberately not memoised and never computed during render: \"last 2 days\"\n * means two days before now, and now moves. Call it in the handler that builds\n * the request.\n */\nexport function relativeRangeToMillis(\n value: RelativeRangeValue\n): { startTime: number; endTime: number } | null {\n const seconds = relativeRangeSeconds(value);\n if (seconds <= 0) return null;\n const endTime = Date.now();\n return { startTime: endTime - seconds * 1000, endTime };\n}\n\n/** A relative range as a chip label: `Last 2d 6h`. */\nfunction relativeRangeLabel(value: RelativeRangeValue): string {\n const parts = RELATIVE_UNITS.flatMap((unit) => {\n const n = parseInt(value[unit.key] || \"0\", 10);\n return !n || Number.isNaN(n) ? [] : [`${n}${unit.key[0]}`];\n });\n return parts.length ? `Last ${parts.join(\" \")}` : \"\";\n}\n\nexport interface DateRangeFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value: DateRangeValue;\n onChange: (next: DateRangeValue) => void;\n /**\n * Turns on the \"Last…\" tab beside the date range. Omit both and the chip is\n * absolute-only.\n *\n * The two modes are exclusive by construction: applying one clears the other,\n * because a range that is both \"last 7 days\" and \"1–31 Jan\" cannot be\n * honoured and nothing downstream should have to guess which half won.\n */\n relativeValue?: RelativeRangeValue;\n onRelativeChange?: (next: RelativeRangeValue) => void;\n /** Earliest / latest selectable date, `YYYY-MM-DD`. */\n min?: string;\n max?: string;\n /** Shown under the fields when a picked date falls outside `min`/`max`. */\n outOfRangeHint?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * From / To, staged behind Apply. A half-filled range cannot be applied: an\n * open-ended date filter reads as a bug far more often than it is what someone\n * meant, and the disabled Apply says so without an error message.\n */\nexport function DateRangeFilterChip({\n chipKey = \"date\",\n label = \"Date\",\n value,\n onChange,\n relativeValue,\n onRelativeChange,\n min,\n max,\n outOfRangeHint,\n align = \"start\",\n open,\n onOpenChange,\n}: DateRangeFilterChipProps) {\n const chip = useFilterChipState(chipKey, { open, onOpenChange });\n const [draft, setDraft] = useState<DateRangeValue>(value);\n const [relativeDraft, setRelativeDraft] = useState<RelativeRangeValue>(\n relativeValue ?? EMPTY_RELATIVE_RANGE\n );\n\n // The tab the panel opens on follows what is applied, so reopening a chip set\n // to \"last 2 days\" does not land on an empty date range.\n const supportsRelative = !!onRelativeChange;\n const [mode, setMode] = useState<\"absolute\" | \"relative\">(\n hasRelativeRange(relativeValue) ? \"relative\" : \"absolute\"\n );\n\n const relativeLabel = hasRelativeRange(relativeValue)\n ? relativeRangeLabel(relativeValue!)\n : \"\";\n const isActive = !!(value.from && value.to) || !!relativeLabel;\n const isPartial = !!draft.from !== !!draft.to;\n\n const outside = (d: string) => !!d && ((!!min && d < min) || (!!max && d > max));\n const outOfRange = outside(draft.from) || outside(draft.to);\n\n const emptyRange: DateRangeValue = { from: \"\", to: \"\" };\n const isRelative = supportsRelative && mode === \"relative\";\n\n // Applying one mode clears the other, so the applied value is never both a\n // duration and a pair of dates.\n const commit = (range: DateRangeValue, relative: RelativeRangeValue) => {\n onChange(range);\n onRelativeChange?.(relative);\n setDraft(range);\n setRelativeDraft(relative);\n chip.onOpenChange(false);\n };\n\n return (\n <FilterChip\n chipKey={chipKey}\n // The chip carries the applied span, not just the word \"Date\": it is in\n // the request, so it should be readable without opening anything.\n label={\n relativeLabel\n ? `${label}: ${relativeLabel}`\n : isActive\n ? `${label}: ${value.from} → ${value.to}`\n : label\n }\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={() => {\n setDraft(value);\n setRelativeDraft(relativeValue ?? EMPTY_RELATIVE_RANGE);\n setMode(hasRelativeRange(relativeValue) ? \"relative\" : \"absolute\");\n }}\n onClear={() => {\n onChange(emptyRange);\n onRelativeChange?.(EMPTY_RELATIVE_RANGE);\n setDraft(emptyRange);\n setRelativeDraft(EMPTY_RELATIVE_RANGE);\n }}\n >\n <div className=\"w-72 space-y-3 p-3\">\n {supportsRelative ? (\n <Tabs value={mode} onValueChange={(v) => setMode(v as \"absolute\" | \"relative\")}>\n <TabsList className=\"w-full\">\n <TabsTrigger value=\"absolute\" className=\"flex-1\">\n Date range\n </TabsTrigger>\n <TabsTrigger value=\"relative\" className=\"flex-1\">\n Last…\n </TabsTrigger>\n </TabsList>\n </Tabs>\n ) : null}\n\n {isRelative ? (\n <div className=\"grid grid-cols-2 gap-2\">\n {RELATIVE_UNITS.map((unit) => (\n <label key={unit.key} className=\"space-y-1.5\">\n <span className=\"text-[11px] font-medium text-muted-foreground\">{unit.label}</span>\n <Input\n type=\"number\"\n min={0}\n inputMode=\"numeric\"\n placeholder=\"0\"\n value={relativeDraft[unit.key]}\n onChange={(e) =>\n setRelativeDraft((prev) => ({ ...prev, [unit.key]: e.target.value }))\n }\n className=\"h-8 text-[12.5px]\"\n />\n </label>\n ))}\n </div>\n ) : (\n <>\n <div className=\"space-y-1\">\n <p className=\"text-[11px] font-medium text-muted-foreground\">From</p>\n <DatePicker\n value={draft.from}\n onChange={(v) => setDraft((d) => ({ ...d, from: v }))}\n min={min}\n max={max}\n placeholder=\"Select start date\"\n className={DATE_CHIP_TRIGGER}\n />\n </div>\n <div className=\"space-y-1\">\n <p className=\"text-[11px] font-medium text-muted-foreground\">To</p>\n <DatePicker\n value={draft.to}\n onChange={(v) => setDraft((d) => ({ ...d, to: v }))}\n min={draft.from || min}\n max={max}\n placeholder=\"Select end date\"\n className={DATE_CHIP_TRIGGER}\n />\n </div>\n {isPartial ? (\n <p className=\"text-[11px] text-muted-foreground\">Pick both ends of the range.</p>\n ) : null}\n {outOfRange && outOfRangeHint ? (\n <p className=\"text-[11px] text-destructive\">{outOfRangeHint}</p>\n ) : null}\n </>\n )}\n </div>\n <FilterChipActions\n onClear={() => commit(emptyRange, EMPTY_RELATIVE_RANGE)}\n clearDisabled={\n !draft.from &&\n !draft.to &&\n !hasRelativeRange(relativeDraft) &&\n !value.from &&\n !value.to &&\n !relativeLabel\n }\n // A duration needs no dates; a date range needs both ends and must sit\n // inside the allowed window.\n applyDisabled={\n isRelative ? !hasRelativeRange(relativeDraft) : isPartial || outOfRange\n }\n onApply={() =>\n isRelative\n ? commit(emptyRange, relativeDraft)\n : commit(draft, EMPTY_RELATIVE_RANGE)\n }\n />\n </FilterChip>\n );\n}\n\n// ── Month-range chip ──────────────────────────────────────────────────────────\n\nexport interface MonthRange {\n /** Inclusive \"YYYY-MM\" bounds. Both ends compare as plain strings. */\n start: string;\n end: string;\n}\n\n/** A month index within a year → the \"YYYY-MM\" key the filter stores. */\nconst monthKey = (year: number, monthIndex: number) =>\n `${year}-${String(monthIndex + 1).padStart(2, \"0\")}`;\n\nconst yearOf = (monthKeyValue: string) => Number(monthKeyValue.slice(0, 4));\n\n/** Newest selected month's year, falling back to the range's last year. */\nfunction startingYear(selected: string[], fallbackYear: number): number {\n if (selected.length === 0) return fallbackYear;\n const newest = [...selected].sort().reverse()[0];\n const parsed = yearOf(newest);\n return Number.isNaN(parsed) ? fallbackYear : parsed;\n}\n\n/**\n * Month RANGE chip: pick a start month and an end month on the same year grid.\n *\n * Distinct from MonthFilterChip below, which ticks an arbitrary SET of months.\n * A range is the right shape when the value is going into a request rather than\n * being matched client-side — a start/end pair is what a \"from month, to month\"\n * endpoint takes, and a set of months is not expressible in one.\n *\n * The value is never empty: a caller sending it to an API always has some window\n * in force, so \"Reset\" restores `defaultRange` rather than clearing to nothing,\n * and the chip renders the range it is on at all times. That is deliberate — a\n * filter that silently governs a request should say what it is set to, not read\n * as unset while quietly bounding every row on screen.\n *\n * Clicking cycles the way a date-range picker does: the first click starts a new\n * range, the second closes it, and a click before the open start moves the start\n * instead of making a backwards range.\n */\nexport function MonthRangeFilterChip({\n chipKey,\n label = \"Period\",\n bounds,\n value,\n defaultRange,\n monthsWithData,\n onChange,\n}: {\n chipKey?: string;\n label?: string;\n /** The outer limits the grid lets the merchant navigate and pick within. */\n bounds: MonthRange;\n /** The range currently in force. Always set — see the note above. */\n value: MonthRange;\n /** What Reset goes back to, typically the window the page opens on. */\n defaultRange: MonthRange;\n /** Months with a row behind them, as \"YYYY-MM\". Drives the grid's dots. */\n monthsWithData: Set<string>;\n onChange: (next: MonthRange) => void;\n}) {\n const chip = useFilterChipState(chipKey ?? label);\n const minYear = yearOf(bounds.start);\n const maxYear = yearOf(bounds.end);\n\n const [draft, setDraft] = useState<MonthRange>(value);\n /** Set once a start has been picked and the end is still open, so the next\n * click closes the range instead of starting another one. */\n const [awaitingEnd, setAwaitingEnd] = useState(false);\n const [year, setYear] = useState(() => yearOf(value.end) || maxYear);\n\n // Always active: there is always a window in force.\n const isDefault = value.start === defaultRange.start && value.end === defaultRange.end;\n\n const pick = (month: string) => {\n if (!awaitingEnd) {\n setDraft({ start: month, end: month });\n setAwaitingEnd(true);\n return;\n }\n // A click before the open start moves the start rather than inverting the\n // range, which is what every date-range picker does and what a merchant\n // correcting an over-shot first click means.\n setDraft((prev) =>\n month < prev.start ? { start: month, end: prev.end } : { start: prev.start, end: month }\n );\n setAwaitingEnd(false);\n };\n\n const reset = () => {\n setDraft(defaultRange);\n setAwaitingEnd(false);\n };\n\n const summary = `${formatMonthLabel(draft.start)} – ${formatMonthLabel(draft.end)}`;\n\n return (\n <Popover\n open={chip.open}\n onOpenChange={(next) => {\n chip.onOpenChange(next);\n if (next) {\n setDraft(value);\n setAwaitingEnd(false);\n setYear(yearOf(value.end) || maxYear);\n }\n }}\n >\n <FilterChipShell active>\n <PopoverTrigger asChild>\n {/* The chip carries the range itself, not just the word \"Period\":\n this value is in the request body, so the merchant should be able\n to read what the table is bounded by without opening anything. */}\n <FilterChipLabelTrigger\n label={`${label}: ${formatMonthLabel(value.start)} – ${formatMonthLabel(value.end)}`}\n active\n />\n </PopoverTrigger>\n </FilterChipShell>\n <PopoverContent align=\"end\" className=\"w-60 p-3\" onCloseAutoFocus={chip.onCloseAutoFocus}>\n <div className=\"flex items-center justify-between\">\n <IconButton\n aria-label=\"Previous year\"\n variant=\"ghost\"\n size=\"xs\"\n disabled={year <= minYear}\n onClick={() => setYear((prev) => prev - 1)}\n >\n <ChevronLeft className=\"h-3.5 w-3.5\" />\n </IconButton>\n <span className=\"text-[12.5px] font-semibold text-foreground\">{year}</span>\n <IconButton\n aria-label=\"Next year\"\n variant=\"ghost\"\n size=\"xs\"\n disabled={year >= maxYear}\n onClick={() => setYear((prev) => prev + 1)}\n >\n <ChevronRight className=\"h-3.5 w-3.5\" />\n </IconButton>\n </div>\n\n <div className=\"mt-2 grid grid-cols-4 gap-1\">\n {MONTHS_SHORT.map((monthLabel, index) => {\n const monthValue = monthKey(year, index);\n // Plain string comparison: \"YYYY-MM\" sorts chronologically.\n const inBounds = monthValue >= bounds.start && monthValue <= bounds.end;\n const isEdge = monthValue === draft.start || monthValue === draft.end;\n const isBetween = monthValue > draft.start && monthValue < draft.end;\n const hasData = monthsWithData.has(monthValue);\n\n return (\n <Button\n key={monthValue}\n type=\"button\"\n variant={isEdge ? \"primary\" : \"ghost\"}\n size=\"sm\"\n disabled={!inBounds}\n aria-pressed={isEdge || isBetween}\n aria-label={`${monthLabel} ${year}${hasData ? \", has receipts\" : \"\"}`}\n onClick={() => pick(monthValue)}\n className={cn(\n \"relative h-auto min-h-0 w-full justify-center rounded-md px-0 pb-2.5 pt-1.5 text-[12px]\",\n !isEdge && \"text-foreground hover:bg-muted/60\",\n isBetween && \"bg-primary/15 text-primary\"\n )}\n >\n {monthLabel}\n {hasData && (\n <span\n aria-hidden\n className={cn(\n \"absolute bottom-1 left-1/2 size-1 -translate-x-1/2 rounded-full\",\n isEdge ? \"bg-primary-foreground\" : \"bg-primary\"\n )}\n />\n )}\n </Button>\n );\n })}\n </div>\n\n <p className=\"mt-2 truncate text-[11px] text-muted-foreground\" title={summary}>\n {awaitingEnd ? `${formatMonthLabel(draft.start)} – pick an end month` : summary}\n </p>\n\n <Separator className=\"my-2\" />\n\n <div className=\"flex items-center justify-between gap-2\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n leftIcon={<X className=\"h-3 w-3\" />}\n onClick={reset}\n disabled={isDefault && draft.start === defaultRange.start && draft.end === defaultRange.end}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n Reset\n </Button>\n <Button\n variant=\"primary\"\n size=\"sm\"\n onClick={() => {\n onChange(draft);\n chip.onOpenChange(false);\n }}\n >\n Apply\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Text chip ─────────────────────────────────────────────────────────────────\n\nexport interface TextFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value: string;\n onChange: (next: string) => void;\n /** Field label inside the panel. Defaults to `<label> contains`. */\n fieldLabel?: string;\n placeholder?: string;\n /** One line under the field — what the match actually does, typically. */\n hint?: string;\n /** Soft keyboard hint on touch devices. */\n inputMode?: \"text\" | \"email\" | \"tel\" | \"numeric\" | \"url\" | \"search\";\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * One free-text value, staged behind Apply.\n *\n * Deliberately not a live-filtering input: this chip sits in a toolbar whose\n * other chips all commit on Apply, and a field that filtered as you typed would\n * be the one control on the row that behaves differently. Enter applies, so it\n * still costs one keystroke.\n *\n * The applied value is trimmed — a trailing space pasted in with an address is\n * not something the user meant to search for.\n */\nexport function TextFilterChip({\n chipKey,\n label = \"Text\",\n value,\n onChange,\n fieldLabel,\n placeholder,\n hint,\n inputMode = \"text\",\n align = \"start\",\n open,\n onOpenChange,\n}: TextFilterChipProps) {\n const key = chipKey ?? label;\n const chip = useFilterChipState(key, { open, onOpenChange });\n const [draft, setDraft] = useState(value);\n\n const isActive = !!value.trim();\n const apply = () => {\n onChange(draft.trim());\n chip.onOpenChange(false);\n };\n\n return (\n <FilterChip\n chipKey={key}\n // The chip carries the value it is filtering on, so the toolbar can be\n // read without opening anything.\n label={isActive ? `${label}: ${value.trim()}` : label}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={() => setDraft(value)}\n onClear={() => {\n onChange(\"\");\n setDraft(\"\");\n }}\n >\n <div className=\"w-64 space-y-1.5 p-3\">\n <p className=\"text-[11px] font-medium text-muted-foreground\">\n {fieldLabel ?? `${label} contains`}\n </p>\n <Input\n type=\"text\"\n inputMode={inputMode}\n autoComplete=\"off\"\n placeholder={placeholder}\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\") return;\n e.preventDefault();\n apply();\n }}\n className=\"h-8 text-[12.5px]\"\n />\n {hint ? <p className=\"text-[11px] text-muted-foreground\">{hint}</p> : null}\n </div>\n <FilterChipActions\n onClear={() => {\n onChange(\"\");\n setDraft(\"\");\n chip.onOpenChange(false);\n }}\n clearDisabled={!draft && !value}\n onApply={apply}\n />\n </FilterChip>\n );\n}\n\n// ── Number-range chip ─────────────────────────────────────────────────────────\n\nexport interface NumberRangeValue {\n min: string;\n max: string;\n}\n\nexport interface NumberRangeFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value: NumberRangeValue;\n onChange: (next: NumberRangeValue) => void;\n /** Prefix inside each field — a currency symbol, typically. */\n prefix?: string;\n /** One line under the fields — what the bounds mean, or which field they match. */\n hint?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\n/**\n * Min / Max, staged behind Apply. Unlike a date range, one end alone is a\n * perfectly ordinary request (\"over ₹10,000\"), so a half-filled range applies.\n */\nexport function NumberRangeFilterChip({\n chipKey = \"amount\",\n label = \"Amount\",\n value,\n onChange,\n prefix,\n hint,\n align = \"start\",\n open,\n onOpenChange,\n}: NumberRangeFilterChipProps) {\n const chip = useFilterChipState(chipKey, { open, onOpenChange });\n const [draft, setDraft] = useState<NumberRangeValue>(value);\n const isActive = !!(value.min || value.max);\n const inverted = !!draft.min && !!draft.max && Number(draft.min) > Number(draft.max);\n\n return (\n <FilterChip\n chipKey={chipKey}\n label={label}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={() => setDraft(value)}\n onClear={() => {\n onChange({ min: \"\", max: \"\" });\n setDraft({ min: \"\", max: \"\" });\n }}\n >\n <div className=\"w-56 space-y-3 p-3\">\n {([\"min\", \"max\"] as const).map((end) => (\n <label key={end} className=\"block space-y-1\">\n <span className=\"text-[11px] font-medium capitalize text-muted-foreground\">{end}</span>\n <div className=\"relative\">\n {prefix ? (\n <span className=\"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[12.5px] text-muted-foreground\">\n {prefix}\n </span>\n ) : null}\n <Input\n type=\"number\"\n inputMode=\"decimal\"\n value={draft[end]}\n onChange={(e) => setDraft((d) => ({ ...d, [end]: e.target.value }))}\n className={cn(\"h-8 text-[12.5px]\", prefix && \"pl-6\")}\n />\n </div>\n </label>\n ))}\n {inverted ? (\n <p className=\"text-[11px] text-destructive\">Min must not exceed max.</p>\n ) : hint ? (\n <p className=\"text-[11px] text-muted-foreground\">{hint}</p>\n ) : null}\n </div>\n <FilterChipActions\n onClear={() => {\n const empty = { min: \"\", max: \"\" };\n onChange(empty);\n setDraft(empty);\n chip.onOpenChange(false);\n }}\n clearDisabled={!draft.min && !draft.max && !value.min && !value.max}\n applyDisabled={inverted}\n onApply={() => {\n onChange(draft);\n chip.onOpenChange(false);\n }}\n />\n </FilterChip>\n );\n}\n\n// ── Add-filter menu ───────────────────────────────────────────────────────────\n\nexport interface AddFilterDefinition {\n key: string;\n label: string;\n /**\n * The values this filter accepts, so the search can match them directly.\n * Omit for a filter whose values are not a list — a date or amount range —\n * and it will still be findable by name.\n */\n options?: FilterChipOption[];\n /** How many values are currently applied. Drives the count beside the name. */\n activeCount?: number;\n}\n\nexport interface AddFilterMenuProps extends FilterChipControl {\n chipKey?: string;\n /** Every filter this toolbar can offer, including ones already shown. */\n filters: AddFilterDefinition[];\n /** Keys already on screen as their own chip. */\n visibleKeys?: string[];\n /** Reveal a filter as its own chip. */\n onAddFilter: (key: string) => void;\n /**\n * Take a filter back out of the toolbar. Omit and a shown filter is simply\n * marked as shown; supply it and the row becomes a toggle.\n *\n * Removing must also clear whatever that filter had selected — a filter that\n * is still narrowing the table from somewhere the user cannot see it is worse\n * than one they have to scroll to.\n */\n onRemoveFilter?: (key: string) => void;\n /** Apply a value picked straight out of the search results. */\n onSelectValue?: (filterKey: string, value: string) => void;\n label?: string;\n align?: \"start\" | \"center\" | \"end\";\n}\n\ntype MenuRow =\n | { kind: \"heading\"; id: string; text: string }\n | { kind: \"filter\"; id: string; filter: AddFilterDefinition }\n | { kind: \"value\"; id: string; filter: AddFilterDefinition; option: FilterChipOption };\n\n/**\n * \"Filter\" — a searchable way to reach every filter a table has, instead of a\n * second-class drawer of leftovers.\n *\n * Two things it does that a nested accordion of checkbox groups does not.\n * Typing searches filter **names and their values at once**, so someone who\n * knows they want \"USD\" finds it without first knowing it lives under\n * Currency. And choosing anything here promotes that filter to a real chip in\n * the toolbar, so there is exactly one place a filter can be — beside its\n * peers — rather than some being chips and some being hidden rows.\n *\n * That also means the toolbar scales: a table with twenty filters shows the\n * three or four in use and keeps the rest one keystroke away.\n */\nexport function AddFilterMenu({\n chipKey = \"__add-filter\",\n filters,\n visibleKeys = [],\n onAddFilter,\n onRemoveFilter,\n onSelectValue,\n label = \"Filter\",\n align = \"start\",\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n}: AddFilterMenuProps) {\n const { open, onOpenChange, onCloseAutoFocus } = useFilterChipState(chipKey, {\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n });\n\n const [query, setQuery] = useState(\"\");\n /** Raw highlight index; `cursor` below is this clamped to a real row. */\n const [storedCursor, setCursor] = useState(0);\n const listRef = useRef<HTMLDivElement | null>(null);\n const listId = useId();\n\n const q = query.trim().toLowerCase();\n\n /**\n * The flat row list the keyboard walks. Headings are in it so the rendered\n * order and the keyboard order cannot drift; they are skipped when moving.\n */\n const rows = useMemo<MenuRow[]>(() => {\n const out: MenuRow[] = [];\n\n if (q) {\n // Values first: someone who typed \"usd\" wants the value, and having to\n // step past the field that contains it is the slower of the two orders.\n const valueMatches = filters.flatMap((f) =>\n (f.options ?? [])\n .filter((o) => o.label.toLowerCase().includes(q))\n .map((option) => ({ filter: f, option }))\n );\n if (valueMatches.length && onSelectValue) {\n out.push({ kind: \"heading\", id: \"h-values\", text: \"Values\" });\n for (const { filter, option } of valueMatches.slice(0, 20)) {\n out.push({\n kind: \"value\",\n id: `v-${filter.key}-${option.value}`,\n filter,\n option,\n });\n }\n }\n\n const nameMatches = filters.filter((f) => f.label.toLowerCase().includes(q));\n if (nameMatches.length) {\n out.push({ kind: \"heading\", id: \"h-fields\", text: \"Filters\" });\n for (const filter of nameMatches) {\n out.push({ kind: \"filter\", id: `f-${filter.key}`, filter });\n }\n }\n return out;\n }\n\n // Resting state: every filter, with the ones already on screen marked so\n // the menu doubles as a map of what the toolbar is currently showing.\n out.push({\n kind: \"heading\",\n id: \"h-all\",\n text: onRemoveFilter ? \"Show filters\" : \"All filters\",\n });\n for (const filter of filters) {\n out.push({ kind: \"filter\", id: `f-${filter.key}`, filter });\n }\n return out;\n }, [filters, q, onSelectValue, onRemoveFilter]);\n\n const selectable = useMemo(\n () => rows.map((r, i) => (r.kind === \"heading\" ? -1 : i)).filter((i) => i >= 0),\n [rows]\n );\n\n /**\n * The highlighted row, clamped to something that actually exists.\n *\n * Derived rather than corrected in an effect. A new query rebuilds `rows`, so\n * the stored index can now point at a heading, at a row that has gone, or\n * past the end — and an effect that reset it would have to depend on the\n * rebuilt array, which is a new identity on every parent render. That effect\n * would then fight the arrow keys, snapping the highlight back to the first\n * row each time the parent happened to re-render. Deriving it cannot.\n */\n const cursor = selectable.includes(storedCursor) ? storedCursor : (selectable[0] ?? -1);\n\n /** Keeps the highlighted row inside the scroll viewport. */\n useEffect(() => {\n if (cursor < 0) return;\n listRef.current\n ?.querySelector<HTMLElement>(`[data-row-index=\"${cursor}\"]`)\n ?.scrollIntoView({ block: \"nearest\" });\n }, [cursor]);\n\n const choose = (row: MenuRow) => {\n if (row.kind === \"value\") {\n onSelectValue?.(row.filter.key, row.option.value);\n // The filter it belongs to becomes a chip, so the applied value is\n // visible and removable in the same place as every other filter.\n onAddFilter(row.filter.key);\n // A value is a decision: close, so the chip it just created is visible.\n onOpenChange(false);\n setQuery(\"\");\n return;\n }\n\n if (row.kind !== \"filter\") return;\n\n // A filter row is a toggle, and the menu stays open for it — turning three\n // filters on is one visit, not three. Only picking a value closes.\n if (onRemoveFilter && visibleKeys.includes(row.filter.key)) {\n onRemoveFilter(row.filter.key);\n } else {\n onAddFilter(row.filter.key);\n if (!onRemoveFilter) {\n // Without a remove handler the row is not a toggle, so there is nothing\n // to come back for.\n onOpenChange(false);\n setQuery(\"\");\n }\n }\n };\n\n const moveCursor = (delta: number) => {\n if (!selectable.length) return;\n const at = selectable.indexOf(cursor);\n const next = selectable[(at + delta + selectable.length) % selectable.length];\n setCursor(next);\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveCursor(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveCursor(-1);\n } else if (e.key === \"Enter\") {\n const row = rows[cursor];\n if (!row || row.kind === \"heading\") return;\n e.preventDefault();\n choose(row);\n }\n };\n\n const activeCount = filters.filter((f) => (f.activeCount ?? 0) > 0).length;\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n onOpenChange(next);\n if (next) setQuery(\"\");\n }}\n >\n <FilterChipShell active={false}>\n <PopoverTrigger asChild>\n <FilterChipLabelTrigger\n label={label}\n active={false}\n rightIcon={<SlidersHorizontal className=\"h-3 w-3\" />}\n aria-label={\n activeCount > 0 ? `${label}. ${activeCount} filters applied.` : label\n }\n />\n </PopoverTrigger>\n </FilterChipShell>\n\n <PopoverContent\n align={align}\n className={cn(\"w-72 p-0\", POPOVER_FIT)}\n onKeyDown={onKeyDown}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n <div className=\"flex h-10 shrink-0 items-center gap-2 border-b border-border px-3\">\n <Search className=\"size-3.5 shrink-0 text-muted-foreground\" aria-hidden />\n <input\n autoFocus\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search filters and values\"\n aria-controls={listId}\n aria-activedescendant={cursor >= 0 ? `${listId}-${cursor}` : undefined}\n className=\"h-full flex-1 bg-transparent text-[12.5px] outline-none placeholder:text-muted-foreground\"\n />\n </div>\n\n <div\n ref={listRef}\n id={listId}\n role=\"listbox\"\n className={cn(\"max-h-80 p-1\", FILTER_SCROLL_AREA)}\n >\n {rows.length === 0 ? (\n <p className=\"px-2 py-6 text-center text-[12.5px] text-muted-foreground\">\n Nothing matches “{query}”.\n </p>\n ) : (\n rows.map((row, i) =>\n row.kind === \"heading\" ? (\n <div\n key={row.id}\n className=\"px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground\"\n >\n {row.text}\n </div>\n ) : (\n <div\n key={row.id}\n id={`${listId}-${i}`}\n data-row-index={i}\n role=\"option\"\n aria-selected={i === cursor}\n onMouseEnter={() => setCursor(i)}\n onClick={() => choose(row)}\n className={cn(\n \"flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] text-foreground\",\n i === cursor && \"bg-muted\"\n )}\n >\n {row.kind === \"value\" ? (\n <>\n {row.option.icon}\n <span className=\"min-w-0 flex-1 truncate\">{row.option.label}</span>\n {/* Names the field the value belongs to: \"USD\" alone is\n ambiguous when two filters both take currencies. */}\n <span className=\"shrink-0 text-[11px] text-muted-foreground\">\n {row.filter.label}\n </span>\n </>\n ) : (\n <>\n <span className=\"min-w-0 flex-1 truncate\">{row.filter.label}</span>\n {row.filter.activeCount ? (\n <span className=\"shrink-0 rounded-full bg-primary/15 px-1.5 text-[10px] font-semibold tabular-nums text-primary\">\n {row.filter.activeCount}\n </span>\n ) : null}\n {visibleKeys.includes(row.filter.key) ? (\n <Check\n aria-label=\"Shown in the toolbar\"\n className=\"h-3.5 w-3.5 shrink-0 text-primary\"\n />\n ) : null}\n </>\n )}\n </div>\n )\n )\n )}\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ── Toolbar ───────────────────────────────────────────────────────────────────\n\n/**\n * The row a table's filters live in: search at the left, chips beside it,\n * actions pinned right.\n *\n * Search and chips share one wrapping flex, so a chip that does not fit wraps\n * to the next line starting **under the search box** — a toolbar with three\n * filters is one line, one with eight grows a second, and nothing is ever\n * scrolled out of sight. Giving each group its own box instead would wrap the\n * chips inside their own column and leave a ragged left edge.\n *\n * Wraps its chips in a {@link FilterChipGroup}, so a toolbar built with it gets\n * the one-open-at-a-time behaviour without opting in.\n */\nexport function FilterToolbar({\n search,\n chips,\n actions,\n className,\n}: {\n search?: ReactNode;\n chips?: ReactNode;\n actions?: ReactNode;\n className?: string;\n}) {\n return (\n // `items-start` keeps the actions level with the FIRST line once the chips\n // wrap onto a second.\n <div className={cn(\"flex items-start gap-2\", className)}>\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-2\">\n {search}\n {/* `contents` so the group adds no box of its own: the chips become\n direct children of the wrapping flex and can break between lines. */}\n {chips ? <FilterChipGroup className=\"contents\">{chips}</FilterChipGroup> : null}\n </div>\n {actions ? (\n <div className=\"flex min-h-8 shrink-0 items-center gap-2\">{actions}</div>\n ) : null}\n </div>\n );\n}\n\n/**\n * The pill action button that sits at the right of a table toolbar — Refresh,\n * Columns, Export, Report.\n *\n * It exists because `Button size=\"sm\"` is `h-9`, which towers over the chips\n * beside it; every toolbar that wanted a level row was overriding the same four\n * classes by hand. Having it here means a toolbar's actions match its chips\n * without each one rediscovering that.\n */\nexport function ToolbarButton({ className, ...props }: ComponentPropsWithoutRef<typeof Button>) {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className={cn(\n \"h-auto min-h-0 shrink-0 py-1 text-muted-foreground hover:text-foreground\",\n className\n )}\n {...props}\n />\n );\n}\n","/**\n * The app-wide date and time format.\n *\n * Every timestamp a PayGlocal dashboard shows a user goes through here, so a\n * transaction row, a settlement detail page, an audit log line and a chart\n * tooltip all read the same: `27 Jul '26, 09:49 AM`.\n *\n * Nothing here goes through `toLocaleDateString` / `toLocaleTimeString`. That\n * is deliberate: Intl output varies with the machine's locale, so the same\n * record would read differently for an operator in Bengaluru and a merchant in\n * Frankfurt, and a screenshot in a support ticket would not match what the\n * agent sees. These build the string from fixed tables instead.\n *\n * Times are rendered in the **viewer's own timezone**, which is what every\n * `Date` getter below returns. That is the right default for an operations\n * console — \"did this settle before close of business *here*\" is the question\n * being asked — but it does mean two people in different zones see different\n * clock times for one event, so anywhere that matters should label the zone.\n */\n\nconst MONTHS_SHORT = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n] as const;\n\nconst DAYS_SHORT = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"] as const;\n\n/** What an absent or unparseable value renders as, everywhere. */\nexport const EMPTY_DATE = \"—\";\n\n/**\n * Parses the shapes PayGlocal APIs actually send, in the order they are most\n * likely to appear:\n *\n * - `DD/MM/YYYY HH:mm:ss` — the transactions search response's\n * `formattedCreationDateTime`. Tried **first**, because `new Date()` reads\n * `03/07/2026` as *March 7th* under US parsing rules, silently swapping the\n * day and month for the first twelve days of every month.\n * - epoch milliseconds, as a number **or a string** — several endpoints send\n * `\"1771329858260\"`. The string form needs `Number()` first: the `Date`\n * constructor reads a string as a date *format*, not a count of\n * milliseconds, so `new Date(\"1771329858260\")` is an Invalid Date.\n * - ISO 8601 — `settlementDate`, and most newer endpoints.\n */\nexport function parseApiDate(value: string | number | Date | null | undefined): Date | null {\n if (value === null || value === undefined || value === \"\") return null;\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;\n\n if (typeof value === \"number\") {\n const fromMillis = new Date(value);\n return Number.isNaN(fromMillis.getTime()) ? null : fromMillis;\n }\n\n const raw = value.trim();\n\n const slashed = raw.match(\n /^(\\d{2})\\/(\\d{2})\\/(\\d{4})(?:[ T](\\d{2}):(\\d{2})(?::(\\d{2}))?)?$/\n );\n if (slashed) {\n const [, dd, mm, yyyy, hh = \"0\", min = \"0\", ss = \"0\"] = slashed;\n const parsed = new Date(\n Number(yyyy),\n Number(mm) - 1,\n Number(dd),\n Number(hh),\n Number(min),\n Number(ss)\n );\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n }\n\n // A string of digits is epoch millis, not a date format.\n if (/^\\d+$/.test(raw)) {\n const parsed = new Date(Number(raw));\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n }\n\n const parsed = new Date(raw);\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n}\n\n/** `09:49 AM` — 12-hour, zero-padded, uppercase meridiem. */\nexport function formatTime(date: Date): string {\n const hours24 = date.getHours();\n const hours12 = hours24 % 12 || 12;\n const meridiem = hours24 >= 12 ? \"PM\" : \"AM\";\n return `${String(hours12).padStart(2, \"0\")}:${String(date.getMinutes()).padStart(2, \"0\")} ${meridiem}`;\n}\n\n/** `27 Jul '26` — the date half, on its own. */\nexport function formatDateOnly(date: Date): string {\n const yy = String(date.getFullYear() % 100).padStart(2, \"0\");\n return `${date.getDate()} ${MONTHS_SHORT[date.getMonth()]} '${yy}`;\n}\n\n/** `27 Jul '26, 09:49 AM` — the canonical form. */\nexport function formatDateTime(date: Date): string {\n return `${formatDateOnly(date)}, ${formatTime(date)}`;\n}\n\n/**\n * Any API value → `27 Jul '26, 09:49 AM`.\n *\n * This is the one to reach for in a column renderer or a detail field: it takes\n * whatever shape the endpoint sends, and returns the em dash rather than\n * \"Invalid Date\" when there is nothing to show.\n *\n * `fallback` is what an absent or unparseable value renders as. It defaults to\n * the em dash; pass `\"\"` where the timestamp sits inside a sentence that should\n * simply omit it rather than show a placeholder.\n */\nexport function formatTimestamp(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n return date ? formatDateTime(date) : fallback;\n}\n\n/** Any API value → `27 Jul '26`, with no time of day. */\nexport function formatDateStamp(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n return date ? formatDateOnly(date) : fallback;\n}\n\n/** Any API value → `09:49 AM`, with no date. */\nexport function formatTimeStamp(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n return date ? formatTime(date) : fallback;\n}\n\n/**\n * `Mon, 27 Jul` — weekday and date, no year. For a date close enough to the\n * present that naming the day of the week reads better than a bare calendar\n * date, such as a \"next settlement\" line.\n */\nexport function formatWeekdayDate(\n value: string | number | Date | null | undefined,\n fallback: string = EMPTY_DATE\n): string {\n const date = parseApiDate(value);\n if (!date) return fallback;\n return `${DAYS_SHORT[date.getDay()]}, ${date.getDate()} ${MONTHS_SHORT[date.getMonth()]}`;\n}\n\n/** `Jan 2026` — a month key (`YYYY-MM`) as a label. */\nexport function formatMonthLabel(monthKey: string): string {\n const [year, month] = monthKey.split(\"-\");\n const name = MONTHS_SHORT[Number(month) - 1];\n if (!year || !name) return monthKey;\n return `${name} ${year}`;\n}\n\nexport { MONTHS_SHORT, DAYS_SHORT };\n","\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"./button\";\nimport { Calendar } from \"./calendar\";\nimport { FilterChip, FilterChipActions, useFilterChipState } from \"./filter-chips\";\nimport type { FilterChipControl } from \"./filter-chips\";\nimport { formatDateOnly, parseApiDate } from \"./format-datetime\";\nimport { cn } from \"./utils\";\n\nexport type DatePickMode = \"single\" | \"range\";\n\n/** What the calendar hands back while the user is picking. */\nexport type CalendarRange = { from: Date | undefined; to?: Date | undefined };\n\n/**\n * A named span offered above the calendar — \"Today\", \"Last 30 Days\".\n *\n * `resolve` runs when the preset is chosen, not when it is declared, so \"last\n * 7 days\" is counted from the day the user picks it rather than from whenever\n * the options array happened to be built.\n */\nexport interface CalendarDatePreset {\n value: string;\n label: string;\n resolve: () => { from: string; to: string };\n}\n\n/**\n * The applied value: a span, plus which preset produced it.\n *\n * `preset` is `\"\"` when the dates were picked by hand, and `to` equals `from`\n * for a single day — so a caller that only wants a window can read `from`/`to`\n * and ignore the rest.\n */\nexport interface CalendarDateValue {\n preset: string;\n /** YYYY-MM-DD */\n from: string;\n /** YYYY-MM-DD */\n to: string;\n}\n\nexport interface CalendarDateFilterChipProps extends FilterChipControl {\n chipKey?: string;\n label?: string;\n value?: CalendarDateValue;\n onChange: (next: CalendarDateValue | undefined) => void;\n /** Named spans above the calendar. Omit for a calendar-only chip. */\n presets?: readonly CalendarDatePreset[];\n /** Offer \"Single date\" alongside \"Date range\". Default true. */\n allowSingle?: boolean;\n /** Months shown side by side in range mode. Default 2. */\n numberOfMonths?: number;\n align?: \"start\" | \"center\" | \"end\";\n}\n\nconst PICK_MODES: { value: DatePickMode; label: string }[] = [\n { value: \"single\", label: \"Single date\" },\n { value: \"range\", label: \"Date range\" },\n];\n\nconst toKey = (d: Date): string => {\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const day = String(d.getDate()).padStart(2, \"0\");\n return `${d.getFullYear()}-${month}-${day}`;\n};\n\nconst fromKey = (key: string): Date | undefined => parseApiDate(key) ?? undefined;\n\n/**\n * A date filter over a real calendar, with optional named spans.\n *\n * Distinct from {@link DateRangeFilterChip}, which is two typed date fields.\n * This one is for a filter people reach for by *looking* — \"the week of the\n * 14th\", \"that Tuesday\" — where a pair of text inputs makes you count days in\n * your head. Both exist because both are right somewhere, and picking between\n * them is a call about the filter, not about the toolbar.\n *\n * Five features in pg-dashboard-v2 had built this chip separately, each with\n * its own preset list and its own value shape. They are the same control.\n */\nexport function CalendarDateFilterChip({\n chipKey,\n label = \"Date\",\n value,\n onChange,\n presets,\n allowSingle = true,\n numberOfMonths = 2,\n align = \"start\",\n open,\n onOpenChange,\n}: CalendarDateFilterChipProps) {\n const key = chipKey ?? label;\n const chip = useFilterChipState(key, { open, onOpenChange });\n\n const [mode, setMode] = useState<DatePickMode>(\"single\");\n const [singleDate, setSingleDate] = useState<Date | undefined>(undefined);\n const [range, setRange] = useState<CalendarRange | undefined>(undefined);\n // A preset and a hand-picked span are the same filter reached two ways, so\n // choosing one clears the other rather than leaving both staged.\n const [presetDraft, setPresetDraft] = useState(\"\");\n\n const activePreset = presets?.find((p) => p.value === value?.preset);\n const isActive = !!value?.from;\n\n const chipLabel = !isActive\n ? label\n : activePreset\n ? `${label}: ${activePreset.label}`\n : value!.to && value!.to !== value!.from\n ? `${label}: ${formatDateOnly(fromKey(value!.from)!)} – ${formatDateOnly(fromKey(value!.to)!)}`\n : `${label}: ${formatDateOnly(fromKey(value!.from)!)}`;\n\n /** Reseeds the working selection from what is applied, on every open. */\n const reseed = () => {\n setPresetDraft(value?.preset ?? \"\");\n const from = value?.from ? fromKey(value.from) : undefined;\n const to = value?.to ? fromKey(value.to) : undefined;\n const isSpan = !!value?.to && value.to !== value.from;\n setMode(isSpan || !allowSingle ? \"range\" : \"single\");\n setSingleDate(isSpan ? undefined : from);\n setRange(isSpan ? { from, to } : undefined);\n };\n\n const clear = () => {\n onChange(undefined);\n setPresetDraft(\"\");\n setSingleDate(undefined);\n setRange(undefined);\n setMode(allowSingle ? \"single\" : \"range\");\n };\n\n const apply = () => {\n if (presetDraft) {\n const chosen = presets?.find((p) => p.value === presetDraft);\n if (chosen) {\n const span = chosen.resolve();\n onChange({ preset: chosen.value, ...span });\n }\n } else if (mode === \"single\" && singleDate) {\n const k = toKey(singleDate);\n onChange({ preset: \"\", from: k, to: k });\n } else if (mode === \"range\" && range?.from) {\n const to = range.to ?? range.from;\n onChange({ preset: \"\", from: toKey(range.from), to: toKey(to) });\n } else {\n onChange(undefined);\n }\n chip.onOpenChange(false);\n };\n\n const hasDraft = !!presetDraft || !!singleDate || !!range?.from;\n\n return (\n <FilterChip\n chipKey={key}\n label={chipLabel}\n active={isActive}\n align={align}\n open={chip.open}\n onOpenChange={chip.onOpenChange}\n onOpen={reseed}\n onClear={clear}\n >\n <div className=\"w-auto p-3\">\n {presets?.length ? (\n <div className=\"mb-3 flex flex-wrap gap-1.5\">\n {presets.map((p) => (\n <Button\n key={p.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n const next = presetDraft === p.value ? \"\" : p.value;\n setPresetDraft(next);\n // Picking a named span drops whatever was on the calendar,\n // so the panel never shows two answers at once.\n if (next) {\n setSingleDate(undefined);\n setRange(undefined);\n }\n }}\n className={cn(\n \"h-auto min-h-0 rounded-full border px-2.5 py-1 text-[11.5px] font-normal\",\n presetDraft === p.value\n ? \"border-primary bg-primary/10 font-medium text-primary\"\n : \"border-border text-muted-foreground hover:text-foreground\"\n )}\n >\n {p.label}\n </Button>\n ))}\n </div>\n ) : null}\n\n {allowSingle ? (\n <div className=\"mb-3 flex items-center gap-1 rounded-lg border border-border bg-muted/50 p-1\">\n {PICK_MODES.map((m) => (\n <Button\n key={m.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setMode(m.value)}\n className={cn(\n \"h-auto min-h-0 flex-1 whitespace-nowrap rounded-md px-2.5 py-1.5 text-xs font-medium\",\n mode === m.value\n ? \"bg-card text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n )}\n >\n {m.label}\n </Button>\n ))}\n </div>\n ) : null}\n\n {/* `bg-transparent p-0`: Calendar paints `bg-background` on itself and\n only drops it via a `[[data-slot=popover-content]_&]` selector that\n PopoverContent never sets. Left alone it renders the page's\n off-white as a solid block inside the white popover, with its own\n `p-3` on top of the popover's — a greyed, inset panel that reads as\n disabled. */}\n {mode === \"single\" && allowSingle ? (\n <Calendar\n mode=\"single\"\n selected={singleDate}\n onSelect={(d) => {\n setSingleDate(d);\n setPresetDraft(\"\");\n }}\n className=\"bg-transparent p-0\"\n />\n ) : (\n <Calendar\n mode=\"range\"\n selected={range}\n onSelect={(r) => {\n setRange(r);\n setPresetDraft(\"\");\n }}\n numberOfMonths={numberOfMonths}\n className=\"bg-transparent p-0\"\n />\n )}\n </div>\n\n <FilterChipActions\n onClear={() => {\n clear();\n chip.onOpenChange(false);\n }}\n clearDisabled={!hasDraft && !isActive}\n applyDisabled={!hasDraft}\n onApply={apply}\n />\n </FilterChip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AAAA;AAAA,YArBE,EAAE;AAAA,UAsBT,CACD,GACH,IACE;AAAA,UAEH,cACC,8CAAC,SAAI,WAAU,gFACZ,qBAAW,IAAI,CAAC,MACf;AAAA,YAAC;AAAA;AAAA,cAEC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS,MAAM,QAAQ,EAAE,KAAK;AAAA,cAC9B,WAAW;AAAA,gBACT;AAAA,gBACA,SAAS,EAAE,QACP,sCACA;AAAA,cACN;AAAA,cAEC,YAAE;AAAA;AAAA,YAZE,EAAE;AAAA,UAaT,CACD,GACH,IACE;AAAA,UAQH,SAAS,YAAY,cACpB;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,UAAU,CAAC,MAAM;AACf,8BAAc,CAAC;AACf,+BAAe,EAAE;AAAA,cACnB;AAAA,cACA,WAAU;AAAA;AAAA,UACZ,IAEA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU;AAAA,cACV,UAAU,CAAC,MAAM;AACf,yBAAS,CAAC;AACV,+BAAe,EAAE;AAAA,cACnB;AAAA,cACA;AAAA,cACA,WAAU;AAAA;AAAA,UACZ;AAAA,WAEJ;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS,MAAM;AACb,oBAAM;AACN,mBAAK,aAAa,KAAK;AAAA,YACzB;AAAA,YACA,eAAe,CAAC,YAAY,CAAC;AAAA,YAC7B,eAAe,CAAC;AAAA,YAChB,SAAS;AAAA;AAAA,QACX;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_jsx_runtime","gapClass","import_jsx_runtime","import_lucide_react","import_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","React","import_jsx_runtime","import_jsx_runtime","React","PopoverPrimitive","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","CheckboxPrimitive","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_class_variance_authority","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","import_react","import_class_variance_authority","React","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","import_lucide_react","import_jsx_runtime","import_class_variance_authority","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","React","React","React","Slot","child","React","import_class_variance_authority","import_jsx_runtime","import_react","import_jsx_runtime","variantClasses","sizeClasses","import_react","import_jsx_runtime","variantClasses","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","step","import_lucide_react","import_jsx_runtime","React","DialogPrimitive","import_lucide_react","import_jsx_runtime","React","PopoverPrimitive","import_jsx_runtime","React","import_jsx_runtime","import_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","import_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","Icon","React","import_lucide_react","import_jsx_runtime","variantStyles","variantIcons","Icon","React","import_lucide_react","import_jsx_runtime","Icon","React","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","sizeClasses","step","import_jsx_runtime","import_lucide_react","import_jsx_runtime","Icon","import_lucide_react","import_react","import_jsx_runtime","pad","import_jsx_runtime","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","sizeClasses","React","AvatarPrimitive","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","import_react","import_react_remove_scroll","import_lucide_react","import_jsx_runtime","PANEL_W","PANEL_H","React","import_jsx_runtime","config","React","import_lucide_react","import_jsx_runtime","import_sonner","import_react","import_sonner","import_jsx_runtime","Sonner","React","import_lucide_react","import_jsx_runtime","React","PopoverPrimitive","import_lucide_react","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","Tag","React","PopoverPrimitive","import_lucide_react","import_jsx_runtime","import_lucide_react","import_react","import_jsx_runtime","variantClasses","sizeClasses","React","import_react_dom","import_react_remove_scroll","import_lucide_react","import_jsx_runtime","pad","displayTime","React","import_jsx_runtime","Tag","React","import_jsx_runtime","sizes","React","import_jsx_runtime","import_react","import_lucide_react","parsed","monthKey","import_jsx_runtime","import_react","import_jsx_runtime"]}
|