@slipstream-ui/core 0.11.8 → 0.11.9
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.d.mts +61 -9
- package/dist/index.d.ts +61 -9
- package/dist/index.js +604 -469
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +603 -469
- package/dist/index.mjs.map +1 -1
- package/dist/manifests/accordion.manifest.json +1 -1
- package/dist/manifests/alert.manifest.json +1 -1
- package/dist/manifests/announcement-bar.manifest.json +1 -1
- package/dist/manifests/app-shell.manifest.json +1 -1
- package/dist/manifests/applied-filters.manifest.json +1 -1
- package/dist/manifests/article-card.manifest.json +1 -1
- package/dist/manifests/auth-layout.manifest.json +1 -1
- package/dist/manifests/autocomplete.manifest.json +1 -1
- package/dist/manifests/avatar.manifest.json +1 -1
- package/dist/manifests/badge.manifest.json +1 -1
- package/dist/manifests/block.manifest.json +1 -1
- package/dist/manifests/bottom-nav.manifest.json +1 -1
- package/dist/manifests/breadcrumb.manifest.json +1 -1
- package/dist/manifests/button-group.manifest.json +1 -1
- package/dist/manifests/button.manifest.json +4 -2
- package/dist/manifests/calendar.manifest.json +1 -1
- package/dist/manifests/card.manifest.json +1 -1
- package/dist/manifests/checkbox.manifest.json +1 -1
- package/dist/manifests/comparison-table.manifest.json +1 -1
- package/dist/manifests/confirm-dialog.manifest.json +1 -1
- package/dist/manifests/contact-strip.manifest.json +1 -1
- package/dist/manifests/container.manifest.json +1 -1
- package/dist/manifests/cover-image.manifest.json +1 -1
- package/dist/manifests/cta-section.manifest.json +1 -1
- package/dist/manifests/data-table.manifest.json +22 -1
- package/dist/manifests/date-picker-popover.manifest.json +1 -1
- package/dist/manifests/date-picker.manifest.json +1 -1
- package/dist/manifests/date-range-picker.manifest.json +1 -1
- package/dist/manifests/deal-card.manifest.json +1 -1
- package/dist/manifests/dialog.manifest.json +1 -1
- package/dist/manifests/document-card.manifest.json +1 -1
- package/dist/manifests/drawer.manifest.json +1 -1
- package/dist/manifests/empty-state.manifest.json +1 -1
- package/dist/manifests/entity-card.manifest.json +1 -1
- package/dist/manifests/feature-grid.manifest.json +1 -1
- package/dist/manifests/feature-row.manifest.json +1 -1
- package/dist/manifests/fieldset.manifest.json +1 -1
- package/dist/manifests/file-upload.manifest.json +1 -1
- package/dist/manifests/filter-bar.manifest.json +1 -1
- package/dist/manifests/filter-chips.manifest.json +1 -1
- package/dist/manifests/filter-panel.manifest.json +1 -1
- package/dist/manifests/flex.manifest.json +1 -1
- package/dist/manifests/form-field.manifest.json +1 -1
- package/dist/manifests/form-layout.manifest.json +1 -1
- package/dist/manifests/form.manifest.json +1 -1
- package/dist/manifests/grid.manifest.json +1 -1
- package/dist/manifests/heading.manifest.json +1 -1
- package/dist/manifests/hero.manifest.json +1 -1
- package/dist/manifests/image.manifest.json +1 -1
- package/dist/manifests/input-group.manifest.json +1 -1
- package/dist/manifests/input.manifest.json +1 -1
- package/dist/manifests/label.manifest.json +1 -1
- package/dist/manifests/link-tabs.manifest.json +1 -1
- package/dist/manifests/link.manifest.json +1 -1
- package/dist/manifests/list-toolbar.manifest.json +120 -0
- package/dist/manifests/list.manifest.json +1 -1
- package/dist/manifests/load-more.manifest.json +1 -1
- package/dist/manifests/logo-cloud.manifest.json +1 -1
- package/dist/manifests/menu.manifest.json +1 -1
- package/dist/manifests/metric-card.manifest.json +1 -1
- package/dist/manifests/multi-select.manifest.json +1 -1
- package/dist/manifests/newsletter.manifest.json +1 -1
- package/dist/manifests/page-header.manifest.json +1 -1
- package/dist/manifests/pagination.manifest.json +1 -1
- package/dist/manifests/password-input.manifest.json +1 -1
- package/dist/manifests/popover.manifest.json +1 -1
- package/dist/manifests/process-steps.manifest.json +1 -1
- package/dist/manifests/progress.manifest.json +1 -1
- package/dist/manifests/prose.manifest.json +1 -1
- package/dist/manifests/radio.manifest.json +1 -1
- package/dist/manifests/range-slider.manifest.json +1 -1
- package/dist/manifests/search.manifest.json +1 -1
- package/dist/manifests/section-heading.manifest.json +1 -1
- package/dist/manifests/section.manifest.json +1 -1
- package/dist/manifests/segmented-control.manifest.json +4 -4
- package/dist/manifests/select-menu.manifest.json +1 -1
- package/dist/manifests/select.manifest.json +1 -1
- package/dist/manifests/separator.manifest.json +1 -1
- package/dist/manifests/site-footer.manifest.json +1 -1
- package/dist/manifests/site-header.manifest.json +1 -1
- package/dist/manifests/skeleton.manifest.json +1 -1
- package/dist/manifests/spinner.manifest.json +1 -1
- package/dist/manifests/stat-band.manifest.json +1 -1
- package/dist/manifests/stepper.manifest.json +1 -1
- package/dist/manifests/switch.manifest.json +1 -1
- package/dist/manifests/table-card.manifest.json +1 -1
- package/dist/manifests/table-of-contents.manifest.json +1 -1
- package/dist/manifests/table.manifest.json +1 -1
- package/dist/manifests/tabs.manifest.json +1 -1
- package/dist/manifests/testimonial.manifest.json +1 -1
- package/dist/manifests/text.manifest.json +1 -1
- package/dist/manifests/textarea.manifest.json +1 -1
- package/dist/manifests/theme-toggle.manifest.json +1 -1
- package/dist/manifests/time-picker.manifest.json +1 -1
- package/dist/manifests/timeline.manifest.json +1 -1
- package/dist/manifests/toast.manifest.json +1 -1
- package/dist/manifests/tombstone-card.manifest.json +1 -1
- package/dist/manifests/tooltip.manifest.json +1 -1
- package/dist/src/components/button/Button.d.ts +2 -2
- package/dist/src/components/button/Button.js +1 -0
- package/dist/src/components/button/Button.js.map +1 -1
- package/dist/src/components/button/Button.mjs +1 -0
- package/dist/src/components/button/Button.mjs.map +1 -1
- package/dist/src/components/data-table/DataTable.d.ts +12 -1
- package/dist/src/components/data-table/DataTable.js +189 -112
- package/dist/src/components/data-table/DataTable.js.map +1 -1
- package/dist/src/components/data-table/DataTable.mjs +189 -112
- package/dist/src/components/data-table/DataTable.mjs.map +1 -1
- package/dist/src/components/list-toolbar/ListToolbar.d.ts +25 -0
- package/dist/src/components/list-toolbar/ListToolbar.js +68 -0
- package/dist/src/components/list-toolbar/ListToolbar.js.map +1 -0
- package/dist/src/components/list-toolbar/ListToolbar.mjs +44 -0
- package/dist/src/components/list-toolbar/ListToolbar.mjs.map +1 -0
- package/dist/src/components/list-toolbar/index.d.ts +1 -0
- package/dist/src/components/list-toolbar/index.js +23 -0
- package/dist/src/components/list-toolbar/index.js.map +1 -0
- package/dist/src/components/list-toolbar/index.mjs +2 -0
- package/dist/src/components/list-toolbar/index.mjs.map +1 -0
- package/dist/src/components/segmented-control/SegmentedControl.d.ts +20 -4
- package/dist/src/components/segmented-control/SegmentedControl.js +17 -3
- package/dist/src/components/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/src/components/segmented-control/SegmentedControl.mjs +17 -3
- package/dist/src/components/segmented-control/SegmentedControl.mjs.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/components/button/Button.ssr.test.tsx +1 -1
- package/src/components/button/Button.test.tsx +6 -0
- package/src/components/button/Button.tsx +1 -0
- package/src/components/data-table/DataTable.test.tsx +99 -0
- package/src/components/data-table/DataTable.tsx +115 -1
- package/src/components/list-toolbar/ListToolbar.test.tsx +50 -0
- package/src/components/list-toolbar/ListToolbar.tsx +64 -0
- package/src/components/list-toolbar/index.ts +1 -0
- package/src/components/segmented-control/SegmentedControl.test.tsx +51 -0
- package/src/components/segmented-control/SegmentedControl.tsx +36 -4
- package/src/index.ts +1 -0
- package/src/manifests/accordion.manifest.json +1 -1
- package/src/manifests/alert.manifest.json +1 -1
- package/src/manifests/announcement-bar.manifest.json +1 -1
- package/src/manifests/app-shell.manifest.json +1 -1
- package/src/manifests/applied-filters.manifest.json +1 -1
- package/src/manifests/article-card.manifest.json +1 -1
- package/src/manifests/auth-layout.manifest.json +1 -1
- package/src/manifests/autocomplete.manifest.json +1 -1
- package/src/manifests/avatar.manifest.json +1 -1
- package/src/manifests/badge.manifest.json +1 -1
- package/src/manifests/block.manifest.json +1 -1
- package/src/manifests/bottom-nav.manifest.json +1 -1
- package/src/manifests/breadcrumb.manifest.json +1 -1
- package/src/manifests/button-group.manifest.json +1 -1
- package/src/manifests/button.manifest.json +4 -2
- package/src/manifests/calendar.manifest.json +1 -1
- package/src/manifests/card.manifest.json +1 -1
- package/src/manifests/checkbox.manifest.json +1 -1
- package/src/manifests/comparison-table.manifest.json +1 -1
- package/src/manifests/confirm-dialog.manifest.json +1 -1
- package/src/manifests/contact-strip.manifest.json +1 -1
- package/src/manifests/container.manifest.json +1 -1
- package/src/manifests/cover-image.manifest.json +1 -1
- package/src/manifests/cta-section.manifest.json +1 -1
- package/src/manifests/data-table.manifest.json +22 -1
- package/src/manifests/date-picker-popover.manifest.json +1 -1
- package/src/manifests/date-picker.manifest.json +1 -1
- package/src/manifests/date-range-picker.manifest.json +1 -1
- package/src/manifests/deal-card.manifest.json +1 -1
- package/src/manifests/dialog.manifest.json +1 -1
- package/src/manifests/document-card.manifest.json +1 -1
- package/src/manifests/drawer.manifest.json +1 -1
- package/src/manifests/empty-state.manifest.json +1 -1
- package/src/manifests/entity-card.manifest.json +1 -1
- package/src/manifests/feature-grid.manifest.json +1 -1
- package/src/manifests/feature-row.manifest.json +1 -1
- package/src/manifests/fieldset.manifest.json +1 -1
- package/src/manifests/file-upload.manifest.json +1 -1
- package/src/manifests/filter-bar.manifest.json +1 -1
- package/src/manifests/filter-chips.manifest.json +1 -1
- package/src/manifests/filter-panel.manifest.json +1 -1
- package/src/manifests/flex.manifest.json +1 -1
- package/src/manifests/form-field.manifest.json +1 -1
- package/src/manifests/form-layout.manifest.json +1 -1
- package/src/manifests/form.manifest.json +1 -1
- package/src/manifests/grid.manifest.json +1 -1
- package/src/manifests/heading.manifest.json +1 -1
- package/src/manifests/hero.manifest.json +1 -1
- package/src/manifests/image.manifest.json +1 -1
- package/src/manifests/input-group.manifest.json +1 -1
- package/src/manifests/input.manifest.json +1 -1
- package/src/manifests/label.manifest.json +1 -1
- package/src/manifests/link-tabs.manifest.json +1 -1
- package/src/manifests/link.manifest.json +1 -1
- package/src/manifests/list-toolbar.manifest.json +120 -0
- package/src/manifests/list.manifest.json +1 -1
- package/src/manifests/load-more.manifest.json +1 -1
- package/src/manifests/logo-cloud.manifest.json +1 -1
- package/src/manifests/menu.manifest.json +1 -1
- package/src/manifests/metric-card.manifest.json +1 -1
- package/src/manifests/multi-select.manifest.json +1 -1
- package/src/manifests/newsletter.manifest.json +1 -1
- package/src/manifests/page-header.manifest.json +1 -1
- package/src/manifests/pagination.manifest.json +1 -1
- package/src/manifests/password-input.manifest.json +1 -1
- package/src/manifests/popover.manifest.json +1 -1
- package/src/manifests/process-steps.manifest.json +1 -1
- package/src/manifests/progress.manifest.json +1 -1
- package/src/manifests/prose.manifest.json +1 -1
- package/src/manifests/radio.manifest.json +1 -1
- package/src/manifests/range-slider.manifest.json +1 -1
- package/src/manifests/search.manifest.json +1 -1
- package/src/manifests/section-heading.manifest.json +1 -1
- package/src/manifests/section.manifest.json +1 -1
- package/src/manifests/segmented-control.manifest.json +4 -4
- package/src/manifests/select-menu.manifest.json +1 -1
- package/src/manifests/select.manifest.json +1 -1
- package/src/manifests/separator.manifest.json +1 -1
- package/src/manifests/site-footer.manifest.json +1 -1
- package/src/manifests/site-header.manifest.json +1 -1
- package/src/manifests/skeleton.manifest.json +1 -1
- package/src/manifests/spinner.manifest.json +1 -1
- package/src/manifests/stat-band.manifest.json +1 -1
- package/src/manifests/stepper.manifest.json +1 -1
- package/src/manifests/switch.manifest.json +1 -1
- package/src/manifests/table-card.manifest.json +1 -1
- package/src/manifests/table-of-contents.manifest.json +1 -1
- package/src/manifests/table.manifest.json +1 -1
- package/src/manifests/tabs.manifest.json +1 -1
- package/src/manifests/testimonial.manifest.json +1 -1
- package/src/manifests/text.manifest.json +1 -1
- package/src/manifests/textarea.manifest.json +1 -1
- package/src/manifests/theme-toggle.manifest.json +1 -1
- package/src/manifests/time-picker.manifest.json +1 -1
- package/src/manifests/timeline.manifest.json +1 -1
- package/src/manifests/toast.manifest.json +1 -1
- package/src/manifests/tombstone-card.manifest.json +1 -1
- package/src/manifests/tooltip.manifest.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n danger: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n // Semantic status variants — foregrounds are the paired AA tokens\n // (white on dark green, ink on amber/cyan) in both themes.\n success: 'bg-success text-success-foreground hover:bg-success/90',\n warning: 'bg-warning text-warning-foreground hover:bg-warning/90',\n info: 'bg-info text-info-foreground hover:bg-info/90',\n outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n // Colored outlines: semantic border + AA ink label on the page\n // surface, with a faint tint on hover - mirrors the Alert recipe.\n 'outline-destructive':\n 'border border-destructive/50 bg-background text-destructive hover:border-destructive hover:bg-destructive/10',\n 'outline-success':\n 'border border-success/50 bg-background text-success hover:border-success hover:bg-success/10',\n 'outline-warning':\n 'border border-warning/50 bg-background text-warning-ink hover:border-warning hover:bg-warning/10',\n 'outline-info':\n 'border border-info/50 bg-background text-info-ink hover:border-info hover:bg-info/10',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary-ink underline-offset-4 hover:underline',\n // High-contrast fills for hero and other always-dark surfaces. These\n // do not read the theme surface, so they stay legible in both modes.\n // Fixed ink, not --primary: in dark mode --primary lightens and would\n // sit at low contrast on the white surface.\n contrast: 'bg-white text-slate-900 shadow-sm hover:bg-slate-100',\n onDark:\n 'border border-white/45 bg-transparent text-white hover:border-white/70 hover:bg-white/10',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-10 w-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n /** Shows a spinner, disables the button and sets aria-busy while an action runs. */\n loading?: boolean;\n /** Screen-reader text while loading (default \"Loading\"). */\n loadingLabel?: string;\n};\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, loading = false, loadingLabel = 'Loading', disabled, children, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n if (asChild) {\n return (\n <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props}>\n {children}\n </Comp>\n );\n }\n return (\n <button\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {loading && (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n )}\n {loading && <span className=\"sr-only\">{loadingLabel}</span>}\n {children}\n </button>\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n danger: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n // Semantic status variants — foregrounds are the paired AA tokens\n // (white on dark green, ink on amber/cyan) in both themes.\n success: 'bg-success text-success-foreground hover:bg-success/90',\n warning: 'bg-warning text-warning-foreground hover:bg-warning/90',\n info: 'bg-info text-info-foreground hover:bg-info/90',\n outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n // Colored outlines: semantic border + AA ink label on the page\n // surface, with a faint tint on hover - mirrors the Alert recipe.\n 'outline-destructive':\n 'border border-destructive/50 bg-background text-destructive hover:border-destructive hover:bg-destructive/10',\n 'outline-success':\n 'border border-success/50 bg-background text-success hover:border-success hover:bg-success/10',\n 'outline-warning':\n 'border border-warning/50 bg-background text-warning-ink hover:border-warning hover:bg-warning/10',\n 'outline-info':\n 'border border-info/50 bg-background text-info-ink hover:border-info hover:bg-info/10',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary-ink underline-offset-4 hover:underline',\n // High-contrast fills for hero and other always-dark surfaces. These\n // do not read the theme surface, so they stay legible in both modes.\n // Fixed ink, not --primary: in dark mode --primary lightens and would\n // sit at low contrast on the white surface.\n contrast: 'bg-white text-slate-900 shadow-sm hover:bg-slate-100',\n onDark:\n 'border border-white/45 bg-transparent text-white hover:border-white/70 hover:bg-white/10',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n xs: 'h-8 rounded-md px-2.5 text-xs',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-10 w-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n /** Shows a spinner, disables the button and sets aria-busy while an action runs. */\n loading?: boolean;\n /** Screen-reader text while loading (default \"Loading\"). */\n loadingLabel?: string;\n};\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, loading = false, loadingLabel = 'Loading', disabled, children, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n if (asChild) {\n return (\n <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props}>\n {children}\n </Comp>\n );\n }\n return (\n <button\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {loading && (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n )}\n {loading && <span className=\"sr-only\">{loadingLabel}</span>}\n {children}\n </button>\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqEQ;AArER,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,gBAAmB;AAEnB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,QACT,aAAa;AAAA,QACb,QAAQ;AAAA;AAAA;AAAA,QAGR,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,SAAS;AAAA;AAAA;AAAA,QAGT,uBACE;AAAA,QACF,mBACE;AAAA,QACF,mBACE;AAAA,QACF,gBACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,QAKN,UAAU;AAAA,QACV,QACE;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAUA,MAAM,SAAS,MAAM;AAAA,EACnB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,UAAU,OAAO,eAAe,WAAW,UAAU,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/H,UAAM,OAAO,UAAU,yBAAO;AAC9B,QAAI,SAAS;AACX,aACE,4CAAC,QAAK,eAAW,cAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAG,KAAW,GAAG,OAC9E,UACH;AAAA,IAEJ;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,cAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,QAC1D;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,aAAW,WAAW;AAAA,QACrB,GAAG;AAAA,QAEH;AAAA,qBACC;AAAA,YAAC;AAAA;AAAA,cACC,eAAY;AAAA,cACZ,WAAU;AAAA;AAAA,UACZ;AAAA,UAED,WAAW,4CAAC,UAAK,WAAU,WAAW,wBAAa;AAAA,UACnD;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n danger: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n // Semantic status variants — foregrounds are the paired AA tokens\n // (white on dark green, ink on amber/cyan) in both themes.\n success: 'bg-success text-success-foreground hover:bg-success/90',\n warning: 'bg-warning text-warning-foreground hover:bg-warning/90',\n info: 'bg-info text-info-foreground hover:bg-info/90',\n outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n // Colored outlines: semantic border + AA ink label on the page\n // surface, with a faint tint on hover - mirrors the Alert recipe.\n 'outline-destructive':\n 'border border-destructive/50 bg-background text-destructive hover:border-destructive hover:bg-destructive/10',\n 'outline-success':\n 'border border-success/50 bg-background text-success hover:border-success hover:bg-success/10',\n 'outline-warning':\n 'border border-warning/50 bg-background text-warning-ink hover:border-warning hover:bg-warning/10',\n 'outline-info':\n 'border border-info/50 bg-background text-info-ink hover:border-info hover:bg-info/10',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary-ink underline-offset-4 hover:underline',\n // High-contrast fills for hero and other always-dark surfaces. These\n // do not read the theme surface, so they stay legible in both modes.\n // Fixed ink, not --primary: in dark mode --primary lightens and would\n // sit at low contrast on the white surface.\n contrast: 'bg-white text-slate-900 shadow-sm hover:bg-slate-100',\n onDark:\n 'border border-white/45 bg-transparent text-white hover:border-white/70 hover:bg-white/10',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-10 w-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n /** Shows a spinner, disables the button and sets aria-busy while an action runs. */\n loading?: boolean;\n /** Screen-reader text while loading (default \"Loading\"). */\n loadingLabel?: string;\n};\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, loading = false, loadingLabel = 'Loading', disabled, children, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n if (asChild) {\n return (\n <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props}>\n {children}\n </Comp>\n );\n }\n return (\n <button\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {loading && (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n )}\n {loading && <span className=\"sr-only\">{loadingLabel}</span>}\n {children}\n </button>\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n danger: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n // Semantic status variants — foregrounds are the paired AA tokens\n // (white on dark green, ink on amber/cyan) in both themes.\n success: 'bg-success text-success-foreground hover:bg-success/90',\n warning: 'bg-warning text-warning-foreground hover:bg-warning/90',\n info: 'bg-info text-info-foreground hover:bg-info/90',\n outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n // Colored outlines: semantic border + AA ink label on the page\n // surface, with a faint tint on hover - mirrors the Alert recipe.\n 'outline-destructive':\n 'border border-destructive/50 bg-background text-destructive hover:border-destructive hover:bg-destructive/10',\n 'outline-success':\n 'border border-success/50 bg-background text-success hover:border-success hover:bg-success/10',\n 'outline-warning':\n 'border border-warning/50 bg-background text-warning-ink hover:border-warning hover:bg-warning/10',\n 'outline-info':\n 'border border-info/50 bg-background text-info-ink hover:border-info hover:bg-info/10',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary-ink underline-offset-4 hover:underline',\n // High-contrast fills for hero and other always-dark surfaces. These\n // do not read the theme surface, so they stay legible in both modes.\n // Fixed ink, not --primary: in dark mode --primary lightens and would\n // sit at low contrast on the white surface.\n contrast: 'bg-white text-slate-900 shadow-sm hover:bg-slate-100',\n onDark:\n 'border border-white/45 bg-transparent text-white hover:border-white/70 hover:bg-white/10',\n },\n size: {\n default: 'h-10 px-4 py-2',\n sm: 'h-9 rounded-md px-3',\n xs: 'h-8 rounded-md px-2.5 text-xs',\n lg: 'h-11 rounded-md px-8',\n icon: 'h-10 w-10',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n);\n\nexport type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n /** Shows a spinner, disables the button and sets aria-busy while an action runs. */\n loading?: boolean;\n /** Screen-reader text while loading (default \"Loading\"). */\n loadingLabel?: string;\n};\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, loading = false, loadingLabel = 'Loading', disabled, children, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n if (asChild) {\n return (\n <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props}>\n {children}\n </Comp>\n );\n }\n return (\n <button\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {loading && (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n )}\n {loading && <span className=\"sr-only\">{loadingLabel}</span>}\n {children}\n </button>\n );\n }\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"],"mappings":"AAqEQ,cAMF,YANE;AArER,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAEnB,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,QACT,aAAa;AAAA,QACb,QAAQ;AAAA;AAAA;AAAA,QAGR,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,SAAS;AAAA;AAAA;AAAA,QAGT,uBACE;AAAA,QACF,mBACE;AAAA,QACF,mBACE;AAAA,QACF,gBACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,QAKN,UAAU;AAAA,QACV,QACE;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAUA,MAAM,SAAS,MAAM;AAAA,EACnB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,UAAU,OAAO,eAAe,WAAW,UAAU,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/H,UAAM,OAAO,UAAU,OAAO;AAC9B,QAAI,SAAS;AACX,aACE,oBAAC,QAAK,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAG,KAAW,GAAG,OAC9E,UACH;AAAA,IAEJ;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,QAC1D;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,aAAW,WAAW;AAAA,QACrB,GAAG;AAAA,QAEH;AAAA,qBACC;AAAA,YAAC;AAAA;AAAA,cACC,eAAY;AAAA,cACZ,WAAU;AAAA;AAAA,UACZ;AAAA,UAED,WAAW,oBAAC,UAAK,WAAU,WAAW,wBAAa;AAAA,UACnD;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
|
@@ -18,6 +18,8 @@ export type DataTableColumn<T> = {
|
|
|
18
18
|
onClick?: (row: T) => void;
|
|
19
19
|
};
|
|
20
20
|
export type SortIconState = 'none' | 'asc' | 'desc';
|
|
21
|
+
/** Viewport breakpoint below which card layout takes over. */
|
|
22
|
+
export type DataTableCardBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
21
23
|
export type DataTableProps<T> = {
|
|
22
24
|
/** Column configuration — everything about the table's shape. */
|
|
23
25
|
columns: DataTableColumn<T>[];
|
|
@@ -76,6 +78,15 @@ export type DataTableProps<T> = {
|
|
|
76
78
|
density?: 'default' | 'compact';
|
|
77
79
|
/** Zebra-striped rows. */
|
|
78
80
|
zebra?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Responsive card fallback: below the given breakpoint each row renders as
|
|
83
|
+
* a definition-list card (column headers become field labels) instead of a
|
|
84
|
+
* table row — the fix for unreadable horizontal scroll on narrow viewports.
|
|
85
|
+
* `true` enables it below `md` (768px); a string picks the breakpoint.
|
|
86
|
+
* Both layouts are rendered and swapped with CSS only, so sorting,
|
|
87
|
+
* selection, pagination, and row callbacks behave identically in each.
|
|
88
|
+
*/
|
|
89
|
+
cardLayout?: boolean | DataTableCardBreakpoint;
|
|
79
90
|
/** Render skeleton placeholder rows (announced via aria-busy). */
|
|
80
91
|
loading?: boolean;
|
|
81
92
|
/**
|
|
@@ -92,4 +103,4 @@ export type DataTableProps<T> = {
|
|
|
92
103
|
* aria-sort, cursor pagination when `pageSize` is set, and a friendly empty
|
|
93
104
|
* state — so most tables never need hand-rolled table code.
|
|
94
105
|
*/
|
|
95
|
-
export declare function DataTable<T>({ columns, data, rowId, caption, defaultSort, sortKey, sortDir, onSortChange, renderSortIcon, pageSize, page, onPageChange, pageCount: pageCountProp, total, manualPagination, selectedRowIds, onSelectedRowIdsChange, isRowSelectable, bulkActions, onRowClick, emptyMessage, selectAllLabel, selectedLabel, stickyHeader, density, zebra, loading, loadingRows, className, }: DataTableProps<T>): React.JSX.Element;
|
|
106
|
+
export declare function DataTable<T>({ columns, data, rowId, caption, defaultSort, sortKey, sortDir, onSortChange, renderSortIcon, pageSize, page, onPageChange, pageCount: pageCountProp, total, manualPagination, selectedRowIds, onSelectedRowIdsChange, isRowSelectable, bulkActions, onRowClick, emptyMessage, selectAllLabel, selectedLabel, stickyHeader, density, zebra, cardLayout, loading, loadingRows, className, }: DataTableProps<T>): React.JSX.Element;
|
|
@@ -38,6 +38,13 @@ var import_cn = require("../../utils/cn.js");
|
|
|
38
38
|
var import_Pagination = require("../pagination/Pagination.js");
|
|
39
39
|
var import_Skeleton = require("../skeleton/Skeleton.js");
|
|
40
40
|
var import_Checkbox = require("../checkbox/Checkbox.js");
|
|
41
|
+
const cardBreakpointClasses = {
|
|
42
|
+
sm: { table: "max-sm:hidden", cards: "sm:hidden" },
|
|
43
|
+
md: { table: "max-md:hidden", cards: "md:hidden" },
|
|
44
|
+
lg: { table: "max-lg:hidden", cards: "lg:hidden" },
|
|
45
|
+
xl: { table: "max-xl:hidden", cards: "xl:hidden" },
|
|
46
|
+
"2xl": { table: "max-2xl:hidden", cards: "2xl:hidden" }
|
|
47
|
+
};
|
|
41
48
|
function compareValues(a, b) {
|
|
42
49
|
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
43
50
|
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
@@ -72,6 +79,7 @@ function DataTable({
|
|
|
72
79
|
stickyHeader,
|
|
73
80
|
density = "default",
|
|
74
81
|
zebra,
|
|
82
|
+
cardLayout,
|
|
75
83
|
loading,
|
|
76
84
|
loadingRows,
|
|
77
85
|
className
|
|
@@ -145,134 +153,203 @@ function DataTable({
|
|
|
145
153
|
if (typeof raw === "string" || typeof raw === "number") return raw;
|
|
146
154
|
return String(raw);
|
|
147
155
|
};
|
|
156
|
+
const cardBreakpoint = typeof cardLayout === "string" ? cardLayout : cardLayout ? "md" : null;
|
|
157
|
+
const cardClasses = cardBreakpoint ? cardBreakpointClasses[cardBreakpoint] : null;
|
|
148
158
|
const alignClass = (align) => align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left";
|
|
159
|
+
const cardCell = (row, column, index) => {
|
|
160
|
+
const value = cellValue(row, column, index);
|
|
161
|
+
if (column.onClick) {
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
"button",
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
onClick: () => column.onClick(row),
|
|
167
|
+
className: "block w-full rounded px-1.5 py-0.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
168
|
+
children: value
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return value;
|
|
173
|
+
};
|
|
149
174
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_cn.cn)("w-full space-y-3", className), children: [
|
|
150
175
|
selectionEnabled && selectedIds.length > 0 && bulkActions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm", children: [
|
|
151
176
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium", children: selectedLabel.replace("{count}", String(selectedIds.length)) }),
|
|
152
177
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: bulkActions })
|
|
153
178
|
] }),
|
|
154
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
|
-
"
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
+
"div",
|
|
156
181
|
{
|
|
157
|
-
className: (0, import_cn.cn)("w-full
|
|
158
|
-
children:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
182
|
+
className: (0, import_cn.cn)("w-full overflow-x-auto rounded-lg border border-border", cardClasses?.table),
|
|
183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
184
|
+
"table",
|
|
185
|
+
{
|
|
186
|
+
className: (0, import_cn.cn)("w-full caption-bottom", density === "compact" ? "text-xs" : "text-sm"),
|
|
187
|
+
children: [
|
|
188
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { className: "px-3 py-2 text-left text-xs text-muted-foreground", children: caption }),
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { className: (0, import_cn.cn)("bg-muted/50", stickyHeader && "sticky top-0 z-10 bg-background"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
190
|
+
selectionEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", className: "w-10 border-b border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
|
+
import_Checkbox.Checkbox,
|
|
192
|
+
{
|
|
193
|
+
"aria-label": selectAllLabel,
|
|
194
|
+
checked: allSelected,
|
|
195
|
+
ref: (node) => {
|
|
196
|
+
if (node) node.indeterminate = someSelected && !allSelected;
|
|
197
|
+
},
|
|
198
|
+
onCheckedChange: toggleAll
|
|
199
|
+
}
|
|
200
|
+
) }),
|
|
201
|
+
columns.map((column) => {
|
|
202
|
+
const isSorted = sort?.key === column.key;
|
|
203
|
+
const ariaSort = !column.sortable ? void 0 : isSorted ? sort.dir === "asc" ? "ascending" : "descending" : "none";
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
|
+
"th",
|
|
206
|
+
{
|
|
207
|
+
scope: "col",
|
|
208
|
+
"aria-sort": ariaSort,
|
|
209
|
+
className: (0, import_cn.cn)(
|
|
210
|
+
"border-b border-border px-3 py-2 font-medium",
|
|
211
|
+
alignClass(column.align),
|
|
212
|
+
column.className
|
|
213
|
+
),
|
|
214
|
+
children: column.sortable ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
215
|
+
"button",
|
|
216
|
+
{
|
|
217
|
+
type: "button",
|
|
218
|
+
onClick: () => applySort(column.key),
|
|
219
|
+
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
220
|
+
children: [
|
|
221
|
+
column.header,
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", className: "text-[10px] text-muted-foreground", children: renderSortIcon ? renderSortIcon(isSorted ? sort.dir === "asc" ? "asc" : "desc" : "none") : isSorted ? sort.dir === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
) : column.header
|
|
226
|
+
},
|
|
227
|
+
column.key
|
|
228
|
+
);
|
|
229
|
+
})
|
|
230
|
+
] }) }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { "aria-busy": loading || void 0, children: loading ? Array.from(
|
|
232
|
+
{ length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },
|
|
233
|
+
(_, skeletonRow) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
234
|
+
selectionEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: (0, import_cn.cn)("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: "h-4 w-4" }) }),
|
|
235
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: (0, import_cn.cn)("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: density === "compact" ? "h-3 w-full" : "h-4 w-full" }) }, column.key))
|
|
236
|
+
] }, `skeleton-${skeletonRow}`)
|
|
237
|
+
) : visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
+
"td",
|
|
239
|
+
{
|
|
240
|
+
colSpan: columns.length + (selectionEnabled ? 1 : 0),
|
|
241
|
+
className: "px-3 py-8 text-center text-sm text-muted-foreground",
|
|
242
|
+
children: emptyMessage
|
|
243
|
+
}
|
|
244
|
+
) }) : visible.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
245
|
+
"tr",
|
|
177
246
|
{
|
|
178
|
-
|
|
179
|
-
|
|
247
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
248
|
+
onClick: onRowClick ? () => onRowClick(row) : void 0,
|
|
249
|
+
onKeyDown: onRowClick ? (event) => {
|
|
250
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
onRowClick(row);
|
|
253
|
+
}
|
|
254
|
+
} : void 0,
|
|
180
255
|
className: (0, import_cn.cn)(
|
|
181
|
-
"border-b border-border
|
|
182
|
-
|
|
183
|
-
|
|
256
|
+
"border-b border-border last:border-0",
|
|
257
|
+
zebra && "[&:nth-child(odd)]:bg-muted/30",
|
|
258
|
+
onRowClick && "cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
|
|
184
259
|
),
|
|
185
|
-
children:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
type: "button",
|
|
189
|
-
onClick: () => applySort(column.key),
|
|
190
|
-
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
191
|
-
children: [
|
|
192
|
-
column.header,
|
|
193
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", className: "text-[10px] text-muted-foreground", children: renderSortIcon ? renderSortIcon(isSorted ? sort.dir === "asc" ? "asc" : "desc" : "none") : isSorted ? sort.dir === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
|
|
194
|
-
]
|
|
195
|
-
}
|
|
196
|
-
) : column.header
|
|
197
|
-
},
|
|
198
|
-
column.key
|
|
199
|
-
);
|
|
200
|
-
})
|
|
201
|
-
] }) }),
|
|
202
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { "aria-busy": loading || void 0, children: loading ? Array.from(
|
|
203
|
-
{ length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },
|
|
204
|
-
(_, skeletonRow) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
205
|
-
selectionEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: (0, import_cn.cn)("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: "h-4 w-4" }) }),
|
|
206
|
-
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: (0, import_cn.cn)("px-3 py-2", density === "compact" && "px-2 py-1"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: density === "compact" ? "h-3 w-full" : "h-4 w-full" }) }, column.key))
|
|
207
|
-
] }, `skeleton-${skeletonRow}`)
|
|
208
|
-
) : visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
209
|
-
"td",
|
|
210
|
-
{
|
|
211
|
-
colSpan: columns.length + (selectionEnabled ? 1 : 0),
|
|
212
|
-
className: "px-3 py-8 text-center text-sm text-muted-foreground",
|
|
213
|
-
children: emptyMessage
|
|
214
|
-
}
|
|
215
|
-
) }) : visible.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
216
|
-
"tr",
|
|
217
|
-
{
|
|
218
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
219
|
-
onClick: onRowClick ? () => onRowClick(row) : void 0,
|
|
220
|
-
onKeyDown: onRowClick ? (event) => {
|
|
221
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
222
|
-
event.preventDefault();
|
|
223
|
-
onRowClick(row);
|
|
224
|
-
}
|
|
225
|
-
} : void 0,
|
|
226
|
-
className: (0, import_cn.cn)(
|
|
227
|
-
"border-b border-border last:border-0",
|
|
228
|
-
zebra && "[&:nth-child(odd)]:bg-muted/30",
|
|
229
|
-
onRowClick && "cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
|
|
230
|
-
),
|
|
231
|
-
children: [
|
|
232
|
-
selectionEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
233
|
-
"td",
|
|
234
|
-
{
|
|
235
|
-
className: (0, import_cn.cn)("align-middle", density === "compact" ? "px-2 py-1" : "px-3 py-2"),
|
|
236
|
-
onClick: (event) => event.stopPropagation(),
|
|
237
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
-
import_Checkbox.Checkbox,
|
|
260
|
+
children: [
|
|
261
|
+
selectionEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
262
|
+
"td",
|
|
239
263
|
{
|
|
240
|
-
"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
264
|
+
className: (0, import_cn.cn)("align-middle", density === "compact" ? "px-2 py-1" : "px-3 py-2"),
|
|
265
|
+
onClick: (event) => event.stopPropagation(),
|
|
266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
267
|
+
import_Checkbox.Checkbox,
|
|
268
|
+
{
|
|
269
|
+
"aria-label": `Select row ${rowId(row)}`,
|
|
270
|
+
checked: selectedSet.has(rowId(row)),
|
|
271
|
+
disabled: isRowSelectable ? !isRowSelectable(row) : void 0,
|
|
272
|
+
onCheckedChange: () => toggleRow(rowId(row))
|
|
273
|
+
}
|
|
274
|
+
)
|
|
244
275
|
}
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
),
|
|
248
|
-
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
249
|
-
"td",
|
|
250
|
-
{
|
|
251
|
-
className: (0, import_cn.cn)(
|
|
252
|
-
"align-middle",
|
|
253
|
-
density === "compact" ? "px-2 py-1" : "px-3 py-2",
|
|
254
|
-
alignClass(column.align),
|
|
255
|
-
column.className
|
|
256
276
|
),
|
|
257
|
-
|
|
258
|
-
"
|
|
277
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
278
|
+
"td",
|
|
259
279
|
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
280
|
+
className: (0, import_cn.cn)(
|
|
281
|
+
"align-middle",
|
|
282
|
+
density === "compact" ? "px-2 py-1" : "px-3 py-2",
|
|
283
|
+
alignClass(column.align),
|
|
284
|
+
column.className
|
|
285
|
+
),
|
|
286
|
+
children: column.onClick ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
287
|
+
"button",
|
|
288
|
+
{
|
|
289
|
+
type: "button",
|
|
290
|
+
onClick: () => column.onClick(row),
|
|
291
|
+
className: "block w-full rounded px-1.5 py-0.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
292
|
+
children: cellValue(row, column, index)
|
|
293
|
+
}
|
|
294
|
+
) : cellValue(row, column, index)
|
|
295
|
+
},
|
|
296
|
+
column.key
|
|
297
|
+
))
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
rowId(row)
|
|
301
|
+
)) })
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
cardClasses && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { "aria-label": caption, "aria-busy": loading || void 0, className: (0, import_cn.cn)("space-y-3", cardClasses.cards), children: loading ? Array.from(
|
|
308
|
+
{ length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },
|
|
309
|
+
(_, skeletonRow) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "rounded-lg border border-border p-3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: "h-4 w-1/3" }),
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: "h-4 w-full" }),
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Skeleton.Skeleton, { className: "h-4 w-2/3" })
|
|
313
|
+
] }) }, `skeleton-${skeletonRow}`)
|
|
314
|
+
) : visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "rounded-lg border border-border px-3 py-8 text-center text-sm text-muted-foreground", children: emptyMessage }) : visible.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
318
|
+
onClick: onRowClick ? () => onRowClick(row) : void 0,
|
|
319
|
+
onKeyDown: onRowClick ? (event) => {
|
|
320
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
321
|
+
event.preventDefault();
|
|
322
|
+
onRowClick(row);
|
|
323
|
+
}
|
|
324
|
+
} : void 0,
|
|
325
|
+
className: (0, import_cn.cn)(
|
|
326
|
+
"rounded-lg border border-border",
|
|
327
|
+
onRowClick && "cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
328
|
+
),
|
|
329
|
+
children: [
|
|
330
|
+
selectionEnabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
className: "flex items-center justify-end px-3 pt-2",
|
|
334
|
+
onClick: (event) => event.stopPropagation(),
|
|
335
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
336
|
+
import_Checkbox.Checkbox,
|
|
337
|
+
{
|
|
338
|
+
"aria-label": `Select row ${rowId(row)}`,
|
|
339
|
+
checked: selectedSet.has(rowId(row)),
|
|
340
|
+
disabled: isRowSelectable ? !isRowSelectable(row) : void 0,
|
|
341
|
+
onCheckedChange: () => toggleRow(rowId(row))
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
),
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dl", { className: "divide-y divide-border", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "px-3 py-2", children: [
|
|
347
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { className: "text-xs font-medium text-muted-foreground", children: column.header }),
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { className: (0, import_cn.cn)("mt-0.5 text-sm", alignClass(column.align)), children: cardCell(row, column, index) })
|
|
349
|
+
] }, column.key)) })
|
|
273
350
|
]
|
|
274
351
|
}
|
|
275
|
-
) }),
|
|
352
|
+
) }, rowId(row))) }),
|
|
276
353
|
pageSize && pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [
|
|
277
354
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
278
355
|
"p",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/data-table/DataTable.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Pagination } from '../pagination/Pagination';\nimport { Skeleton } from '../skeleton/Skeleton';\nimport { Checkbox } from '../checkbox/Checkbox';\n\nexport type DataTableColumn<T> = {\n /** Unique column key; also the value passed to onSortChange when sortable. */\n key: string;\n /** Header cell content. */\n header: React.ReactNode;\n /**\n * Cell renderer. Defaults to reading `row[key]` (nullish values render\n * as an em dash).\n */\n cell?: (row: T, index: number) => React.ReactNode;\n /** Enables a sort toggle on this column's header. */\n sortable?: boolean;\n align?: 'left' | 'center' | 'right';\n /** Extra classes for the th/td cells (e.g. 'w-40', 'hidden sm:table-cell'). */\n className?: string;\n /** Per-cell click callback — the cell content renders as a button. */\n onClick?: (row: T) => void;\n};\n\nexport type SortIconState = 'none' | 'asc' | 'desc';\n\nexport type DataTableProps<T> = {\n /** Column configuration — everything about the table's shape. */\n columns: DataTableColumn<T>[];\n /** Row data. */\n data: T[];\n /** Stable id per row (React key + test hooks). */\n rowId: (row: T) => string;\n /** Accessible table caption (visible; pass captionHidden styling to hide). */\n caption?: string;\n /** Initial sort (uncontrolled). Omit for no initial sort. */\n defaultSort?: { key: string; dir: 'asc' | 'desc' } | null;\n /** Controlled sort. */\n sortKey?: string | null;\n sortDir?: 'asc' | 'desc';\n /**\n * Fires when the sort changes (controlled or not) — wire it to a server\n * query to sort at the database while DataTable renders aria-sort.\n */\n onSortChange?: (key: string, dir: 'asc' | 'desc') => void;\n /** Replace the default ▲/▼/↕ header glyphs. */\n renderSortIcon?: (state: SortIconState) => React.ReactNode;\n /** Rows per page; enables pagination when set. */\n pageSize?: number;\n /** Controlled page (1-based) when pageSize is set. */\n page?: number;\n /** Total page count (manual/server pagination). */\n pageCount?: number;\n /** Total row count across all pages (summary + derived page count). */\n total?: number;\n /** Server pagination: render `data` as-is; don't slice or sort client-side. */\n manualPagination?: boolean;\n /** Selected row ids (controlled). Enables the leading selection column. */\n selectedRowIds?: string[];\n /** Fires with the full selection after a row or select-all toggle. */\n onSelectedRowIdsChange?: (ids: string[]) => void;\n /** Disable selection for individual rows. */\n isRowSelectable?: (row: T) => boolean;\n /** Rendered above the table while at least one row is selected. */\n bulkActions?: React.ReactNode;\n /** Fires on page change (controlled or not). */\n onPageChange?: (page: number) => void;\n /** Click/keyboard activation on a row. */\n onRowClick?: (row: T) => void;\n /** Message shown when data is empty. */\n emptyMessage?: string;\n /** Accessible label for the select-all checkbox (default \"Select all rows\"). */\n selectAllLabel?: string;\n /** Selection summary template above the table; `{count}` is replaced (default \"{count} selected\"). */\n selectedLabel?: string;\n /** Pin the header while the body scrolls (needs a max-height on the wrapper via className). */\n stickyHeader?: boolean;\n /** Compact row density. */\n density?: 'default' | 'compact';\n /** Zebra-striped rows. */\n zebra?: boolean;\n /** Render skeleton placeholder rows (announced via aria-busy). */\n loading?: boolean;\n /**\n * Skeleton row count while loading (defaults to the page size, else 5).\n * Match it to your visible data length so rows don't jump when real\n * data replaces the placeholders.\n */\n loadingRows?: number;\n className?: string;\n};\n\ntype SortState = { key: string; dir: 'asc' | 'desc' } | null;\n\nfunction compareValues(a: unknown, b: unknown): number {\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n const an = a == null ? '' : String(a);\n const bn = b == null ? '' : String(b);\n return an.localeCompare(bn, undefined, { numeric: true, sensitivity: 'base' });\n}\n\n/**\n * Config-driven table: one component + a `columns` config that owns shape,\n * sorting, pagination, and row interaction. Built-in sorting toggles with\n * aria-sort, cursor pagination when `pageSize` is set, and a friendly empty\n * state — so most tables never need hand-rolled table code.\n */\nexport function DataTable<T>({\n columns,\n data,\n rowId,\n caption,\n defaultSort = null,\n sortKey,\n sortDir,\n onSortChange,\n renderSortIcon,\n pageSize,\n page,\n onPageChange,\n pageCount: pageCountProp,\n total,\n manualPagination = false,\n selectedRowIds,\n onSelectedRowIdsChange,\n isRowSelectable,\n bulkActions,\n onRowClick,\n emptyMessage = 'No results.',\n selectAllLabel = 'Select all rows',\n selectedLabel = '{count} selected',\n stickyHeader,\n density = 'default',\n zebra,\n loading,\n loadingRows,\n className,\n}: DataTableProps<T>) {\n const [internalSort, setInternalSort] = React.useState<SortState>(defaultSort);\n const [internalPage, setInternalPage] = React.useState(1);\n\n const sort = React.useMemo<SortState>(() => {\n if (sortKey !== undefined) {\n return sortKey === null ? null : { key: sortKey, dir: sortDir ?? 'asc' };\n }\n return internalSort;\n }, [sortKey, sortDir, internalSort]);\n const currentPage = page ?? internalPage;\n\n const applySort = (key: string) => {\n const nextDir: 'asc' | 'desc' = sort?.key === key && sort.dir === 'asc' ? 'desc' : 'asc';\n if (sortKey === undefined) setInternalSort({ key, dir: nextDir });\n onSortChange?.(key, nextDir);\n if (pageSize && currentPage !== 1) setPage(1);\n };\n\n const setPage = (next: number) => {\n if (page === undefined) setInternalPage(next);\n onPageChange?.(next);\n };\n\n const sorted = React.useMemo(() => {\n if (!sort) return data;\n const column = columns.find((c) => c.key === sort.key);\n if (!column) return data;\n const read = (row: T): unknown =>\n column.cell ? undefined : (row as unknown as Record<string, unknown>)[column.key];\n // When a custom cell renders the value, fall back to the raw key access\n // for sorting — configs should keep row data addressable by column.key.\n const copy = [...data];\n copy.sort((a, b) => {\n const cmp = compareValues(\n (a as unknown as Record<string, unknown>)[column.key] ?? read(a),\n (b as unknown as Record<string, unknown>)[column.key] ?? read(b)\n );\n return sort.dir === 'asc' ? cmp : -cmp;\n });\n return copy;\n }, [data, sort, columns]);\n\n const effectiveTotal = total ?? sorted.length;\n const computedPageCount = pageSize ? Math.max(1, Math.ceil(effectiveTotal / pageSize)) : 0;\n const pageCount = pageCountProp ?? computedPageCount;\n const safePage = Math.min(currentPage, pageCount || 1);\n const visible = manualPagination\n ? data\n : pageSize\n ? sorted.slice((safePage - 1) * pageSize, safePage * pageSize)\n : sorted;\n\n // ----- Row selection (controlled or uncontrolled) -----\n const [internalSelected, setInternalSelected] = React.useState<string[]>([]);\n const selectionEnabled = selectedRowIds !== undefined || onSelectedRowIdsChange !== undefined;\n const selectedIds = selectedRowIds ?? internalSelected;\n const selectedSet = React.useMemo(() => new Set(selectedIds), [selectedIds]);\n const selectableVisible = isRowSelectable ? visible.filter(isRowSelectable) : visible;\n const allSelected = selectableVisible.length > 0 && selectableVisible.every((row) => selectedSet.has(rowId(row)));\n const someSelected = selectableVisible.some((row) => selectedSet.has(rowId(row)));\n\n const commitSelection = (next: string[]) => {\n if (selectedRowIds === undefined) setInternalSelected(next);\n onSelectedRowIdsChange?.(next);\n };\n const toggleAll = () => {\n if (allSelected) {\n const visibleIds = new Set(selectableVisible.map((row) => rowId(row)));\n commitSelection(selectedIds.filter((id) => !visibleIds.has(id)));\n return;\n }\n const merged = new Set([...selectedIds, ...selectableVisible.map((row) => rowId(row))]);\n commitSelection([...merged]);\n };\n const toggleRow = (id: string) => {\n commitSelection(selectedSet.has(id) ? selectedIds.filter((entry) => entry !== id) : [...selectedIds, id]);\n };\n\n const cellValue = (row: T, column: DataTableColumn<T>, index: number): React.ReactNode => {\n if (column.cell) return column.cell(row, index);\n const raw = (row as unknown as Record<string, unknown>)[column.key];\n if (raw == null) return '—';\n if (typeof raw === 'string' || typeof raw === 'number') return raw;\n return String(raw);\n };\n\n const alignClass = (align?: DataTableColumn<T>['align']) =>\n align === 'right' ? 'text-right' : align === 'center' ? 'text-center' : 'text-left';\n\n return (\n <div className={cn('w-full space-y-3', className)}>\n {selectionEnabled && selectedIds.length > 0 && bulkActions && (\n <div className=\"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm\">\n <span className=\"font-medium\">{selectedLabel.replace('{count}', String(selectedIds.length))}</span>\n <div className=\"flex flex-wrap items-center gap-2\">{bulkActions}</div>\n </div>\n )}\n <div className=\"w-full overflow-x-auto rounded-lg border border-border\">\n <table\n className={cn('w-full caption-bottom', density === 'compact' ? 'text-xs' : 'text-sm')}\n >\n {caption && <caption className=\"px-3 py-2 text-left text-xs text-muted-foreground\">{caption}</caption>}\n <thead className={cn('bg-muted/50', stickyHeader && 'sticky top-0 z-10 bg-background')}>\n <tr>\n {selectionEnabled && (\n <th scope=\"col\" className=\"w-10 border-b border-border px-3 py-2\">\n <Checkbox\n aria-label={selectAllLabel}\n checked={allSelected}\n ref={(node) => {\n if (node) node.indeterminate = someSelected && !allSelected;\n }}\n onCheckedChange={toggleAll}\n />\n </th>\n )}\n {columns.map((column) => {\n const isSorted = sort?.key === column.key;\n const ariaSort = !column.sortable\n ? undefined\n : isSorted\n ? sort!.dir === 'asc'\n ? 'ascending'\n : 'descending'\n : 'none';\n return (\n <th\n key={column.key}\n scope=\"col\"\n aria-sort={ariaSort}\n className={cn(\n 'border-b border-border px-3 py-2 font-medium',\n alignClass(column.align),\n column.className\n )}\n >\n {column.sortable ? (\n <button\n type=\"button\"\n onClick={() => applySort(column.key)}\n className=\"inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {column.header}\n <span aria-hidden=\"true\" className=\"text-[10px] text-muted-foreground\">\n {renderSortIcon\n ? renderSortIcon(isSorted ? (sort!.dir === 'asc' ? 'asc' : 'desc') : 'none')\n : isSorted\n ? sort!.dir === 'asc'\n ? '▲'\n : '▼'\n : '↕'}\n </span>\n </button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody aria-busy={loading || undefined}>\n {loading ? (\n Array.from(\n { length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },\n (_, skeletonRow) => (\n <tr key={`skeleton-${skeletonRow}`}>\n {selectionEnabled && (\n <td className={cn('px-3 py-2', density === 'compact' && 'px-2 py-1')}>\n <Skeleton className=\"h-4 w-4\" />\n </td>\n )}\n {columns.map((column) => (\n <td key={column.key} className={cn('px-3 py-2', density === 'compact' && 'px-2 py-1')}>\n {/* Height tracks density so skeleton rows match real row\n height and replacing them doesn't shift the table. */}\n <Skeleton className={density === 'compact' ? 'h-3 w-full' : 'h-4 w-full'} />\n </td>\n ))}\n </tr>\n )\n )\n ) : visible.length === 0 ? (\n <tr>\n <td\n colSpan={columns.length + (selectionEnabled ? 1 : 0)}\n className=\"px-3 py-8 text-center text-sm text-muted-foreground\"\n >\n {emptyMessage}\n </td>\n </tr>\n ) : (\n visible.map((row, index) => (\n <tr\n key={rowId(row)}\n tabIndex={onRowClick ? 0 : undefined}\n onClick={onRowClick ? () => onRowClick(row) : undefined}\n onKeyDown={\n onRowClick\n ? (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onRowClick(row);\n }\n }\n : undefined\n }\n className={cn(\n 'border-b border-border last:border-0',\n zebra && '[&:nth-child(odd)]:bg-muted/30',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring'\n )}\n >\n {selectionEnabled && (\n <td\n className={cn('align-middle', density === 'compact' ? 'px-2 py-1' : 'px-3 py-2')}\n onClick={(event) => event.stopPropagation()}\n >\n <Checkbox\n aria-label={`Select row ${rowId(row)}`}\n checked={selectedSet.has(rowId(row))}\n disabled={isRowSelectable ? !isRowSelectable(row) : undefined}\n onCheckedChange={() => toggleRow(rowId(row))}\n />\n </td>\n )}\n {columns.map((column) => (\n <td\n key={column.key}\n className={cn(\n 'align-middle',\n density === 'compact' ? 'px-2 py-1' : 'px-3 py-2',\n alignClass(column.align),\n column.className\n )}\n >\n {column.onClick ? (\n <button\n type=\"button\"\n onClick={() => column.onClick!(row)}\n className=\"block w-full rounded px-1.5 py-0.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {cellValue(row, column, index)}\n </button>\n ) : (\n cellValue(row, column, index)\n )}\n </td>\n ))}\n </tr>\n ))\n )}\n </tbody>\n </table>\n </div>\n {pageSize && pageCount > 1 && (\n <div className=\"flex flex-wrap items-center justify-between gap-x-4 gap-y-2\">\n <p\n className=\"min-h-8 leading-none text-xs text-muted-foreground\"\n aria-live=\"polite\"\n >\n {(safePage - 1) * pageSize + 1}–{Math.min(safePage * pageSize, effectiveTotal)} of{' '}\n {effectiveTotal}\n </p>\n <Pagination page={safePage} pageCount={pageCount} onPageChange={setPage} />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0OQ;AAxOR,YAAuB;AACvB,gBAAmB;AACnB,wB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A,YAClF;AAAA;AAAA;AAAA,MACH;AAAA,MACA,4CAAC,gCAAW,MAAM,UAAU,WAAsB,cAAc,SAAS;AAAA,OAC3E;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/data-table/DataTable.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { Pagination } from '../pagination/Pagination';\nimport { Skeleton } from '../skeleton/Skeleton';\nimport { Checkbox } from '../checkbox/Checkbox';\n\nexport type DataTableColumn<T> = {\n /** Unique column key; also the value passed to onSortChange when sortable. */\n key: string;\n /** Header cell content. */\n header: React.ReactNode;\n /**\n * Cell renderer. Defaults to reading `row[key]` (nullish values render\n * as an em dash).\n */\n cell?: (row: T, index: number) => React.ReactNode;\n /** Enables a sort toggle on this column's header. */\n sortable?: boolean;\n align?: 'left' | 'center' | 'right';\n /** Extra classes for the th/td cells (e.g. 'w-40', 'hidden sm:table-cell'). */\n className?: string;\n /** Per-cell click callback — the cell content renders as a button. */\n onClick?: (row: T) => void;\n};\n\nexport type SortIconState = 'none' | 'asc' | 'desc';\n\n/** Viewport breakpoint below which card layout takes over. */\nexport type DataTableCardBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\nexport type DataTableProps<T> = {\n /** Column configuration — everything about the table's shape. */\n columns: DataTableColumn<T>[];\n /** Row data. */\n data: T[];\n /** Stable id per row (React key + test hooks). */\n rowId: (row: T) => string;\n /** Accessible table caption (visible; pass captionHidden styling to hide). */\n caption?: string;\n /** Initial sort (uncontrolled). Omit for no initial sort. */\n defaultSort?: { key: string; dir: 'asc' | 'desc' } | null;\n /** Controlled sort. */\n sortKey?: string | null;\n sortDir?: 'asc' | 'desc';\n /**\n * Fires when the sort changes (controlled or not) — wire it to a server\n * query to sort at the database while DataTable renders aria-sort.\n */\n onSortChange?: (key: string, dir: 'asc' | 'desc') => void;\n /** Replace the default ▲/▼/↕ header glyphs. */\n renderSortIcon?: (state: SortIconState) => React.ReactNode;\n /** Rows per page; enables pagination when set. */\n pageSize?: number;\n /** Controlled page (1-based) when pageSize is set. */\n page?: number;\n /** Total page count (manual/server pagination). */\n pageCount?: number;\n /** Total row count across all pages (summary + derived page count). */\n total?: number;\n /** Server pagination: render `data` as-is; don't slice or sort client-side. */\n manualPagination?: boolean;\n /** Selected row ids (controlled). Enables the leading selection column. */\n selectedRowIds?: string[];\n /** Fires with the full selection after a row or select-all toggle. */\n onSelectedRowIdsChange?: (ids: string[]) => void;\n /** Disable selection for individual rows. */\n isRowSelectable?: (row: T) => boolean;\n /** Rendered above the table while at least one row is selected. */\n bulkActions?: React.ReactNode;\n /** Fires on page change (controlled or not). */\n onPageChange?: (page: number) => void;\n /** Click/keyboard activation on a row. */\n onRowClick?: (row: T) => void;\n /** Message shown when data is empty. */\n emptyMessage?: string;\n /** Accessible label for the select-all checkbox (default \"Select all rows\"). */\n selectAllLabel?: string;\n /** Selection summary template above the table; `{count}` is replaced (default \"{count} selected\"). */\n selectedLabel?: string;\n /** Pin the header while the body scrolls (needs a max-height on the wrapper via className). */\n stickyHeader?: boolean;\n /** Compact row density. */\n density?: 'default' | 'compact';\n /** Zebra-striped rows. */\n zebra?: boolean;\n /**\n * Responsive card fallback: below the given breakpoint each row renders as\n * a definition-list card (column headers become field labels) instead of a\n * table row — the fix for unreadable horizontal scroll on narrow viewports.\n * `true` enables it below `md` (768px); a string picks the breakpoint.\n * Both layouts are rendered and swapped with CSS only, so sorting,\n * selection, pagination, and row callbacks behave identically in each.\n */\n cardLayout?: boolean | DataTableCardBreakpoint;\n /** Render skeleton placeholder rows (announced via aria-busy). */\n loading?: boolean;\n /**\n * Skeleton row count while loading (defaults to the page size, else 5).\n * Match it to your visible data length so rows don't jump when real\n * data replaces the placeholders.\n */\n loadingRows?: number;\n className?: string;\n};\n\ntype SortState = { key: string; dir: 'asc' | 'desc' } | null;\n\nconst cardBreakpointClasses: Record<DataTableCardBreakpoint, { table: string; cards: string }> = {\n sm: { table: 'max-sm:hidden', cards: 'sm:hidden' },\n md: { table: 'max-md:hidden', cards: 'md:hidden' },\n lg: { table: 'max-lg:hidden', cards: 'lg:hidden' },\n xl: { table: 'max-xl:hidden', cards: 'xl:hidden' },\n '2xl': { table: 'max-2xl:hidden', cards: '2xl:hidden' },\n};\n\nfunction compareValues(a: unknown, b: unknown): number {\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();\n const an = a == null ? '' : String(a);\n const bn = b == null ? '' : String(b);\n return an.localeCompare(bn, undefined, { numeric: true, sensitivity: 'base' });\n}\n\n/**\n * Config-driven table: one component + a `columns` config that owns shape,\n * sorting, pagination, and row interaction. Built-in sorting toggles with\n * aria-sort, cursor pagination when `pageSize` is set, and a friendly empty\n * state — so most tables never need hand-rolled table code.\n */\nexport function DataTable<T>({\n columns,\n data,\n rowId,\n caption,\n defaultSort = null,\n sortKey,\n sortDir,\n onSortChange,\n renderSortIcon,\n pageSize,\n page,\n onPageChange,\n pageCount: pageCountProp,\n total,\n manualPagination = false,\n selectedRowIds,\n onSelectedRowIdsChange,\n isRowSelectable,\n bulkActions,\n onRowClick,\n emptyMessage = 'No results.',\n selectAllLabel = 'Select all rows',\n selectedLabel = '{count} selected',\n stickyHeader,\n density = 'default',\n zebra,\n cardLayout,\n loading,\n loadingRows,\n className,\n}: DataTableProps<T>) {\n const [internalSort, setInternalSort] = React.useState<SortState>(defaultSort);\n const [internalPage, setInternalPage] = React.useState(1);\n\n const sort = React.useMemo<SortState>(() => {\n if (sortKey !== undefined) {\n return sortKey === null ? null : { key: sortKey, dir: sortDir ?? 'asc' };\n }\n return internalSort;\n }, [sortKey, sortDir, internalSort]);\n const currentPage = page ?? internalPage;\n\n const applySort = (key: string) => {\n const nextDir: 'asc' | 'desc' = sort?.key === key && sort.dir === 'asc' ? 'desc' : 'asc';\n if (sortKey === undefined) setInternalSort({ key, dir: nextDir });\n onSortChange?.(key, nextDir);\n if (pageSize && currentPage !== 1) setPage(1);\n };\n\n const setPage = (next: number) => {\n if (page === undefined) setInternalPage(next);\n onPageChange?.(next);\n };\n\n const sorted = React.useMemo(() => {\n if (!sort) return data;\n const column = columns.find((c) => c.key === sort.key);\n if (!column) return data;\n const read = (row: T): unknown =>\n column.cell ? undefined : (row as unknown as Record<string, unknown>)[column.key];\n // When a custom cell renders the value, fall back to the raw key access\n // for sorting — configs should keep row data addressable by column.key.\n const copy = [...data];\n copy.sort((a, b) => {\n const cmp = compareValues(\n (a as unknown as Record<string, unknown>)[column.key] ?? read(a),\n (b as unknown as Record<string, unknown>)[column.key] ?? read(b)\n );\n return sort.dir === 'asc' ? cmp : -cmp;\n });\n return copy;\n }, [data, sort, columns]);\n\n const effectiveTotal = total ?? sorted.length;\n const computedPageCount = pageSize ? Math.max(1, Math.ceil(effectiveTotal / pageSize)) : 0;\n const pageCount = pageCountProp ?? computedPageCount;\n const safePage = Math.min(currentPage, pageCount || 1);\n const visible = manualPagination\n ? data\n : pageSize\n ? sorted.slice((safePage - 1) * pageSize, safePage * pageSize)\n : sorted;\n\n // ----- Row selection (controlled or uncontrolled) -----\n const [internalSelected, setInternalSelected] = React.useState<string[]>([]);\n const selectionEnabled = selectedRowIds !== undefined || onSelectedRowIdsChange !== undefined;\n const selectedIds = selectedRowIds ?? internalSelected;\n const selectedSet = React.useMemo(() => new Set(selectedIds), [selectedIds]);\n const selectableVisible = isRowSelectable ? visible.filter(isRowSelectable) : visible;\n const allSelected = selectableVisible.length > 0 && selectableVisible.every((row) => selectedSet.has(rowId(row)));\n const someSelected = selectableVisible.some((row) => selectedSet.has(rowId(row)));\n\n const commitSelection = (next: string[]) => {\n if (selectedRowIds === undefined) setInternalSelected(next);\n onSelectedRowIdsChange?.(next);\n };\n const toggleAll = () => {\n if (allSelected) {\n const visibleIds = new Set(selectableVisible.map((row) => rowId(row)));\n commitSelection(selectedIds.filter((id) => !visibleIds.has(id)));\n return;\n }\n const merged = new Set([...selectedIds, ...selectableVisible.map((row) => rowId(row))]);\n commitSelection([...merged]);\n };\n const toggleRow = (id: string) => {\n commitSelection(selectedSet.has(id) ? selectedIds.filter((entry) => entry !== id) : [...selectedIds, id]);\n };\n\n const cellValue = (row: T, column: DataTableColumn<T>, index: number): React.ReactNode => {\n if (column.cell) return column.cell(row, index);\n const raw = (row as unknown as Record<string, unknown>)[column.key];\n if (raw == null) return '—';\n if (typeof raw === 'string' || typeof raw === 'number') return raw;\n return String(raw);\n };\n\n const cardBreakpoint = typeof cardLayout === 'string' ? cardLayout : cardLayout ? 'md' : null;\n const cardClasses = cardBreakpoint ? cardBreakpointClasses[cardBreakpoint] : null;\n\n const alignClass = (align?: DataTableColumn<T>['align']) =>\n align === 'right' ? 'text-right' : align === 'center' ? 'text-center' : 'text-left';\n\n // Card cells reuse the table's cellValue/cell-button logic; the only\n // difference is presentation (dt/dd definition list instead of td).\n const cardCell = (row: T, column: DataTableColumn<T>, index: number): React.ReactNode => {\n const value = cellValue(row, column, index);\n if (column.onClick) {\n return (\n <button\n type=\"button\"\n onClick={() => column.onClick!(row)}\n className=\"block w-full rounded px-1.5 py-0.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {value}\n </button>\n );\n }\n return value;\n };\n\n return (\n <div className={cn('w-full space-y-3', className)}>\n {selectionEnabled && selectedIds.length > 0 && bulkActions && (\n <div className=\"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm\">\n <span className=\"font-medium\">{selectedLabel.replace('{count}', String(selectedIds.length))}</span>\n <div className=\"flex flex-wrap items-center gap-2\">{bulkActions}</div>\n </div>\n )}\n <div\n className={cn('w-full overflow-x-auto rounded-lg border border-border', cardClasses?.table)}\n >\n <table\n className={cn('w-full caption-bottom', density === 'compact' ? 'text-xs' : 'text-sm')}\n >\n {caption && <caption className=\"px-3 py-2 text-left text-xs text-muted-foreground\">{caption}</caption>}\n <thead className={cn('bg-muted/50', stickyHeader && 'sticky top-0 z-10 bg-background')}>\n <tr>\n {selectionEnabled && (\n <th scope=\"col\" className=\"w-10 border-b border-border px-3 py-2\">\n <Checkbox\n aria-label={selectAllLabel}\n checked={allSelected}\n ref={(node) => {\n if (node) node.indeterminate = someSelected && !allSelected;\n }}\n onCheckedChange={toggleAll}\n />\n </th>\n )}\n {columns.map((column) => {\n const isSorted = sort?.key === column.key;\n const ariaSort = !column.sortable\n ? undefined\n : isSorted\n ? sort!.dir === 'asc'\n ? 'ascending'\n : 'descending'\n : 'none';\n return (\n <th\n key={column.key}\n scope=\"col\"\n aria-sort={ariaSort}\n className={cn(\n 'border-b border-border px-3 py-2 font-medium',\n alignClass(column.align),\n column.className\n )}\n >\n {column.sortable ? (\n <button\n type=\"button\"\n onClick={() => applySort(column.key)}\n className=\"inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {column.header}\n <span aria-hidden=\"true\" className=\"text-[10px] text-muted-foreground\">\n {renderSortIcon\n ? renderSortIcon(isSorted ? (sort!.dir === 'asc' ? 'asc' : 'desc') : 'none')\n : isSorted\n ? sort!.dir === 'asc'\n ? '▲'\n : '▼'\n : '↕'}\n </span>\n </button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody aria-busy={loading || undefined}>\n {loading ? (\n Array.from(\n { length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },\n (_, skeletonRow) => (\n <tr key={`skeleton-${skeletonRow}`}>\n {selectionEnabled && (\n <td className={cn('px-3 py-2', density === 'compact' && 'px-2 py-1')}>\n <Skeleton className=\"h-4 w-4\" />\n </td>\n )}\n {columns.map((column) => (\n <td key={column.key} className={cn('px-3 py-2', density === 'compact' && 'px-2 py-1')}>\n {/* Height tracks density so skeleton rows match real row\n height and replacing them doesn't shift the table. */}\n <Skeleton className={density === 'compact' ? 'h-3 w-full' : 'h-4 w-full'} />\n </td>\n ))}\n </tr>\n )\n )\n ) : visible.length === 0 ? (\n <tr>\n <td\n colSpan={columns.length + (selectionEnabled ? 1 : 0)}\n className=\"px-3 py-8 text-center text-sm text-muted-foreground\"\n >\n {emptyMessage}\n </td>\n </tr>\n ) : (\n visible.map((row, index) => (\n <tr\n key={rowId(row)}\n tabIndex={onRowClick ? 0 : undefined}\n onClick={onRowClick ? () => onRowClick(row) : undefined}\n onKeyDown={\n onRowClick\n ? (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onRowClick(row);\n }\n }\n : undefined\n }\n className={cn(\n 'border-b border-border last:border-0',\n zebra && '[&:nth-child(odd)]:bg-muted/30',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring'\n )}\n >\n {selectionEnabled && (\n <td\n className={cn('align-middle', density === 'compact' ? 'px-2 py-1' : 'px-3 py-2')}\n onClick={(event) => event.stopPropagation()}\n >\n <Checkbox\n aria-label={`Select row ${rowId(row)}`}\n checked={selectedSet.has(rowId(row))}\n disabled={isRowSelectable ? !isRowSelectable(row) : undefined}\n onCheckedChange={() => toggleRow(rowId(row))}\n />\n </td>\n )}\n {columns.map((column) => (\n <td\n key={column.key}\n className={cn(\n 'align-middle',\n density === 'compact' ? 'px-2 py-1' : 'px-3 py-2',\n alignClass(column.align),\n column.className\n )}\n >\n {column.onClick ? (\n <button\n type=\"button\"\n onClick={() => column.onClick!(row)}\n className=\"block w-full rounded px-1.5 py-0.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {cellValue(row, column, index)}\n </button>\n ) : (\n cellValue(row, column, index)\n )}\n </td>\n ))}\n </tr>\n ))\n )}\n </tbody>\n </table>\n </div>\n {cardClasses && (\n <ul aria-label={caption} aria-busy={loading || undefined} className={cn('space-y-3', cardClasses.cards)}>\n {loading ? (\n Array.from(\n { length: (loadingRows ?? pageSize ?? Math.min(visible.length, 5)) || 5 },\n (_, skeletonRow) => (\n <li key={`skeleton-${skeletonRow}`} className=\"rounded-lg border border-border p-3\">\n <div className=\"space-y-2\">\n <Skeleton className=\"h-4 w-1/3\" />\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-2/3\" />\n </div>\n </li>\n )\n )\n ) : visible.length === 0 ? (\n <li className=\"rounded-lg border border-border px-3 py-8 text-center text-sm text-muted-foreground\">\n {emptyMessage}\n </li>\n ) : (\n visible.map((row, index) => (\n <li key={rowId(row)}>\n <div\n tabIndex={onRowClick ? 0 : undefined}\n onClick={onRowClick ? () => onRowClick(row) : undefined}\n onKeyDown={\n onRowClick\n ? (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onRowClick(row);\n }\n }\n : undefined\n }\n className={cn(\n 'rounded-lg border border-border',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'\n )}\n >\n {selectionEnabled && (\n <div\n className=\"flex items-center justify-end px-3 pt-2\"\n onClick={(event) => event.stopPropagation()}\n >\n <Checkbox\n aria-label={`Select row ${rowId(row)}`}\n checked={selectedSet.has(rowId(row))}\n disabled={isRowSelectable ? !isRowSelectable(row) : undefined}\n onCheckedChange={() => toggleRow(rowId(row))}\n />\n </div>\n )}\n <dl className=\"divide-y divide-border\">\n {columns.map((column) => (\n <div key={column.key} className=\"px-3 py-2\">\n <dt className=\"text-xs font-medium text-muted-foreground\">{column.header}</dt>\n <dd className={cn('mt-0.5 text-sm', alignClass(column.align))}>\n {cardCell(row, column, index)}\n </dd>\n </div>\n ))}\n </dl>\n </div>\n </li>\n ))\n )}\n </ul>\n )}\n {pageSize && pageCount > 1 && (\n <div className=\"flex flex-wrap items-center justify-between gap-x-4 gap-y-2\">\n <p\n className=\"min-h-8 leading-none text-xs text-muted-foreground\"\n aria-live=\"polite\"\n >\n {(safePage - 1) * pageSize + 1}–{Math.min(safePage * pageSize, effectiveTotal)} of{' '}\n {effectiveTotal}\n </p>\n <Pagination page={safePage} pageCount={pageCount} onPageChange={setPage} />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqQQ;AAnQR,YAAuB;AACvB,gBAAmB;AACnB,wBAA2B;AAC3B,sBAAyB;AACzB,sBAAyB;AAuGzB,MAAM,wBAA2F;AAAA,EAC/F,IAAI,EAAE,OAAO,iBAAiB,OAAO,YAAY;AAAA,EACjD,IAAI,EAAE,OAAO,iBAAiB,OAAO,YAAY;AAAA,EACjD,IAAI,EAAE,OAAO,iBAAiB,OAAO,YAAY;AAAA,EACjD,IAAI,EAAE,OAAO,iBAAiB,OAAO,YAAY;AAAA,EACjD,OAAO,EAAE,OAAO,kBAAkB,OAAO,aAAa;AACxD;AAEA,SAAS,cAAc,GAAY,GAAoB;AACrD,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,SAAU,QAAO,IAAI;AAC/D,MAAI,aAAa,QAAQ,aAAa,KAAM,QAAO,EAAE,QAAQ,IAAI,EAAE,QAAQ;AAC3E,QAAM,KAAK,KAAK,OAAO,KAAK,OAAO,CAAC;AACpC,QAAM,KAAK,KAAK,OAAO,KAAK,OAAO,CAAC;AACpC,SAAO,GAAG,cAAc,IAAI,QAAW,EAAE,SAAS,MAAM,aAAa,OAAO,CAAC;AAC/E;AAQO,SAAS,UAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB;AA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