@dashforge/tw 0.6.0-beta → 0.8.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +451 -0
  2. package/THEME-AUDIT.md +175 -0
  3. package/dist/index.esm.js +2009 -87
  4. package/dist/src/components/Accordion/accordion.variants.d.ts.map +1 -1
  5. package/dist/src/components/Box/box.variants.d.ts.map +1 -1
  6. package/dist/src/components/DataGrid/DataGrid.d.ts +29 -0
  7. package/dist/src/components/DataGrid/DataGrid.d.ts.map +1 -0
  8. package/dist/src/components/DataGrid/dataGrid.types.d.ts +214 -0
  9. package/dist/src/components/DataGrid/dataGrid.types.d.ts.map +1 -0
  10. package/dist/src/components/DataGrid/dataGrid.variants.d.ts +222 -0
  11. package/dist/src/components/DataGrid/dataGrid.variants.d.ts.map +1 -0
  12. package/dist/src/components/DataGrid/filters/ColumnFilters.d.ts +23 -0
  13. package/dist/src/components/DataGrid/filters/ColumnFilters.d.ts.map +1 -0
  14. package/dist/src/components/DataGrid/reorder/useColumnReorder.d.ts +50 -0
  15. package/dist/src/components/DataGrid/reorder/useColumnReorder.d.ts.map +1 -0
  16. package/dist/src/components/DataGrid/resize/useColumnResize.d.ts +32 -0
  17. package/dist/src/components/DataGrid/resize/useColumnResize.d.ts.map +1 -0
  18. package/dist/src/components/DataGrid/visibility/ColumnVisibilityDialog.d.ts +33 -0
  19. package/dist/src/components/DataGrid/visibility/ColumnVisibilityDialog.d.ts.map +1 -0
  20. package/dist/src/components/Dialog/dialog.variants.d.ts.map +1 -1
  21. package/dist/src/components/Divider/divider.variants.d.ts.map +1 -1
  22. package/dist/src/components/Pagination/Pagination.d.ts.map +1 -1
  23. package/dist/src/components/Pagination/pagination.variants.d.ts.map +1 -1
  24. package/dist/src/components/Popover/popover.variants.d.ts.map +1 -1
  25. package/dist/src/components/Skeleton/skeleton.variants.d.ts.map +1 -1
  26. package/dist/src/components/Table/Table.d.ts.map +1 -1
  27. package/dist/src/components/Table/table.types.d.ts +77 -5
  28. package/dist/src/components/Table/table.types.d.ts.map +1 -1
  29. package/dist/src/components/Tabs/tabs.variants.d.ts.map +1 -1
  30. package/dist/src/components/Tooltip/tooltip.variants.d.ts.map +1 -1
  31. package/dist/src/components/Typography/typography.variants.d.ts.map +1 -1
  32. package/dist/src/components/_shared/data/getNestedValue.d.ts.map +1 -0
  33. package/dist/src/components/{Table/_internal → _shared/data}/useColumnAutoDetect.d.ts +1 -1
  34. package/dist/src/components/_shared/data/useColumnAutoDetect.d.ts.map +1 -0
  35. package/dist/src/components/_shared/data/useControllableState.d.ts.map +1 -0
  36. package/dist/src/components/_shared/data/useDebouncedValue.d.ts.map +1 -0
  37. package/dist/src/components/_shared/data/useTableFilter.d.ts +36 -0
  38. package/dist/src/components/_shared/data/useTableFilter.d.ts.map +1 -0
  39. package/dist/src/components/{Table/_internal → _shared/data}/useTableSearch.d.ts +1 -1
  40. package/dist/src/components/_shared/data/useTableSearch.d.ts.map +1 -0
  41. package/dist/src/components/{Table/_internal → _shared/data}/useTableSelection.d.ts +1 -1
  42. package/dist/src/components/_shared/data/useTableSelection.d.ts.map +1 -0
  43. package/dist/src/components/{Table/_internal → _shared/data}/useTableSort.d.ts +1 -1
  44. package/dist/src/components/_shared/data/useTableSort.d.ts.map +1 -0
  45. package/dist/src/components/_shared/data/useVirtualizer.d.ts +107 -0
  46. package/dist/src/components/_shared/data/useVirtualizer.d.ts.map +1 -0
  47. package/dist/src/index.d.ts +6 -3
  48. package/dist/src/index.d.ts.map +1 -1
  49. package/package.json +5 -5
  50. package/src/components/Accordion/accordion.variants.ts +5 -3
  51. package/src/components/Box/Box.test.tsx +32 -11
  52. package/src/components/Box/box.variants.ts +23 -4
  53. package/src/components/DataGrid/DataGrid.test.tsx +917 -0
  54. package/src/components/DataGrid/DataGrid.tsx +1199 -0
  55. package/src/components/DataGrid/dataGrid.types.ts +238 -0
  56. package/src/components/DataGrid/dataGrid.variants.ts +152 -0
  57. package/src/components/DataGrid/filters/ColumnFilters.tsx +432 -0
  58. package/src/components/DataGrid/reorder/useColumnReorder.test.ts +38 -0
  59. package/src/components/DataGrid/reorder/useColumnReorder.ts +144 -0
  60. package/src/components/DataGrid/resize/useColumnResize.ts +106 -0
  61. package/src/components/DataGrid/visibility/ColumnVisibilityDialog.tsx +200 -0
  62. package/src/components/Dialog/dialog.variants.ts +10 -6
  63. package/src/components/Divider/Divider.test.tsx +3 -1
  64. package/src/components/Divider/Divider.tsx +1 -1
  65. package/src/components/Divider/divider.variants.ts +2 -1
  66. package/src/components/Pagination/Pagination.tsx +3 -1
  67. package/src/components/Pagination/pagination.variants.ts +19 -13
  68. package/src/components/Popover/popover.variants.ts +10 -4
  69. package/src/components/Skeleton/skeleton.variants.ts +2 -1
  70. package/src/components/Table/Table.tsx +22 -8
  71. package/src/components/Table/table.types.ts +83 -5
  72. package/src/components/Tabs/tabs.variants.ts +19 -8
  73. package/src/components/Tooltip/tooltip.variants.ts +12 -2
  74. package/src/components/Typography/Typography.test.tsx +3 -1
  75. package/src/components/Typography/typography.variants.ts +6 -2
  76. package/src/components/{Table/_internal → _shared/data}/useColumnAutoDetect.test.ts +1 -1
  77. package/src/components/{Table/_internal → _shared/data}/useColumnAutoDetect.ts +1 -1
  78. package/src/components/_shared/data/useTableFilter.test.ts +166 -0
  79. package/src/components/_shared/data/useTableFilter.ts +118 -0
  80. package/src/components/{Table/_internal → _shared/data}/useTableSearch.test.ts +1 -1
  81. package/src/components/{Table/_internal → _shared/data}/useTableSearch.ts +1 -1
  82. package/src/components/{Table/_internal → _shared/data}/useTableSelection.ts +1 -1
  83. package/src/components/{Table/_internal → _shared/data}/useTableSort.test.ts +1 -1
  84. package/src/components/{Table/_internal → _shared/data}/useTableSort.ts +1 -1
  85. package/src/components/_shared/data/useVirtualizer.test.ts +158 -0
  86. package/src/components/_shared/data/useVirtualizer.ts +199 -0
  87. package/src/components/_shared/themeIdentity.test.ts +113 -0
  88. package/src/index.ts +20 -2
  89. package/dist/src/components/Table/_internal/getNestedValue.d.ts.map +0 -1
  90. package/dist/src/components/Table/_internal/useColumnAutoDetect.d.ts.map +0 -1
  91. package/dist/src/components/Table/_internal/useControllableState.d.ts.map +0 -1
  92. package/dist/src/components/Table/_internal/useDebouncedValue.d.ts.map +0 -1
  93. package/dist/src/components/Table/_internal/useTableFilter.d.ts +0 -13
  94. package/dist/src/components/Table/_internal/useTableFilter.d.ts.map +0 -1
  95. package/dist/src/components/Table/_internal/useTableSearch.d.ts.map +0 -1
  96. package/dist/src/components/Table/_internal/useTableSelection.d.ts.map +0 -1
  97. package/dist/src/components/Table/_internal/useTableSort.d.ts.map +0 -1
  98. package/src/components/Table/_internal/themeIdentity.test.ts +0 -84
  99. package/src/components/Table/_internal/useTableFilter.ts +0 -37
  100. /package/dist/src/components/{Table/_internal → _shared/data}/getNestedValue.d.ts +0 -0
  101. /package/dist/src/components/{Table/_internal → _shared/data}/useControllableState.d.ts +0 -0
  102. /package/dist/src/components/{Table/_internal → _shared/data}/useDebouncedValue.d.ts +0 -0
  103. /package/src/components/{Table/_internal → _shared/data}/getNestedValue.test.ts +0 -0
  104. /package/src/components/{Table/_internal → _shared/data}/getNestedValue.ts +0 -0
  105. /package/src/components/{Table/_internal → _shared/data}/useControllableState.ts +0 -0
  106. /package/src/components/{Table/_internal → _shared/data}/useDebouncedValue.ts +0 -0
  107. /package/src/components/{Table/_internal → _shared/data}/useTableSelection.test.ts +0 -0
@@ -0,0 +1,238 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AccessRequirement } from '@dashforge/rbac';
3
+ import type { DataGridVariants } from './dataGrid.variants.js';
4
+ import type {
5
+ TableColumn,
6
+ TableSortModel,
7
+ TableFilterModel,
8
+ TableRowSelectionMode,
9
+ TableLabels,
10
+ } from '../Table/table.types.js';
11
+
12
+ // Re-export the column type unchanged — DataGrid uses the SAME shape
13
+ // as Table. Consumers writing `cols: TableColumn<T>[]` get autocomplete
14
+ // and don't need a parallel `DataGridColumn<T>` type.
15
+
16
+ // ───── Selection scope ─────
17
+
18
+ /**
19
+ * Determines what the "select all" header checkbox covers when
20
+ * `rowSelection="multiple"` is enabled.
21
+ *
22
+ * - `'visible'` — only the rows currently in the viewport (after
23
+ * virtualization windowing) are toggled. Useful when the
24
+ * underlying data is paginated server-side and "all" semantically
25
+ * refers to the screen.
26
+ * - `'allLoaded'` (default) — all rows currently in the `rows` prop
27
+ * are toggled. The standard "select everything I can see in this
28
+ * dataset" pattern.
29
+ *
30
+ * For "select all in server-side dataset", the consumer wires it
31
+ * themselves (e.g. fetch all ids + setSelectedRowIds).
32
+ */
33
+ export type DataGridSelectAllScope = 'visible' | 'allLoaded';
34
+
35
+ // ───── Server-side mode flags ─────
36
+
37
+ /**
38
+ * Independent opt-in flags that delegate the corresponding pipeline
39
+ * step to the consumer. With each flag enabled, DataGrid emits the
40
+ * `onXChange` callback but does NOT perform the operation locally
41
+ * — the consumer is expected to provide the resulting `rows` array.
42
+ */
43
+ export interface DataGridServerSideFlags {
44
+ serverSideSort?: boolean;
45
+ serverSideFilter?: boolean;
46
+ serverSideSearch?: boolean;
47
+ /**
48
+ * When true, DataGrid does NOT slice `rows` for pagination. The
49
+ * virtualization math uses `totalCount` (required) to size the
50
+ * scroll container.
51
+ */
52
+ serverSidePagination?: boolean;
53
+ }
54
+
55
+ // ───── Pagination (DataGrid-internal, opt-in) ─────
56
+
57
+ export interface DataGridPaginationConfig {
58
+ page: number;
59
+ pageSize: number;
60
+ onPageChange: (page: number) => void;
61
+ onPageSizeChange?: (pageSize: number) => void;
62
+ pageSizeOptions?: number[];
63
+ }
64
+
65
+ // ───── Slot props ─────
66
+
67
+ export interface DataGridSlotProps {
68
+ root?: { className?: string };
69
+ toolbar?: { className?: string };
70
+ search?: { className?: string };
71
+ scroll?: { className?: string };
72
+ table?: { className?: string };
73
+ thead?: { className?: string };
74
+ tbody?: { className?: string };
75
+ headerRow?: { className?: string };
76
+ headerCell?: { className?: string };
77
+ row?: { className?: string };
78
+ cell?: { className?: string };
79
+ emptyState?: { className?: string };
80
+ loadingOverlay?: { className?: string };
81
+ selectionCell?: { className?: string };
82
+ rowActionsCell?: { className?: string };
83
+ bulkActionFooter?: { className?: string };
84
+ /** Optional Pagination wrapper below the virtualized scroll. */
85
+ pagination?: { className?: string };
86
+ }
87
+
88
+ // ───── Main props ─────
89
+
90
+ /**
91
+ * Props for `<DataGrid>`.
92
+ *
93
+ * Companion to `<Table>` for large data sets. Where Table renders
94
+ * every row in DOM, DataGrid uses **homemade virtualization**
95
+ * (`IntersectionObserver` + scroll-event + `requestAnimationFrame`
96
+ * — no external libs) to render only a window of visible rows.
97
+ *
98
+ * Required:
99
+ * - `rows`, `cols`, `getRowId` — same as Table
100
+ * - `rowHeight` (fixed in v1; variable-height deferred to v1-bis)
101
+ * - `height` — explicit container height in CSS units, OR
102
+ * consumer sets it via `sx` / parent layout (the scroll container
103
+ * needs a bounded height for virtualization to work)
104
+ *
105
+ * Optional:
106
+ * - `overscan` — extra rows above/below viewport (default 5)
107
+ * - Server-side mode flags (4 independent opt-ins)
108
+ * - Internal pagination (opt-in via `pagination` config)
109
+ * - `selectAllScope` — `'visible'` vs `'allLoaded'` for header
110
+ * select-all checkbox
111
+ * - Everything Table accepts: sort / filter / search / selection /
112
+ * row actions / RBAC / variants / i18n labels / sx / slotProps
113
+ */
114
+ export interface DataGridProps<T extends object>
115
+ extends Pick<DataGridVariants, 'variant' | 'size' | 'density'>,
116
+ DataGridServerSideFlags {
117
+ // ───── Data ─────
118
+ rows: T[];
119
+ cols: TableColumn<T>[];
120
+ getRowId: (row: T, index: number) => string;
121
+
122
+ /** Required: total dataset count. In client-side mode equals
123
+ * `rows.length`; in `serverSidePagination` mode the consumer
124
+ * provides the full count so the virtual scroll height matches. */
125
+ totalCount?: number;
126
+
127
+ // ───── Virtualization (REQUIRED) ─────
128
+ /** Fixed row height in pixels. Required for windowing math. */
129
+ rowHeight: number;
130
+ /** Rows rendered above/below the viewport. @default 5 */
131
+ overscan?: number;
132
+ /** Container height in CSS units (e.g. `"600px"`, `"100vh"`).
133
+ * Required for the scroll container to bound the virtualization. */
134
+ height?: string;
135
+
136
+ // ───── Sort ─────
137
+ sortModel?: TableSortModel;
138
+ onSortChange?: (model: TableSortModel) => void;
139
+ defaultSortModel?: TableSortModel;
140
+
141
+ // ───── Search ─────
142
+ enableSearch?: boolean;
143
+ searchQuery?: string;
144
+ onSearchQueryChange?: (q: string) => void;
145
+ searchPlaceholder?: string;
146
+ searchDebounceMs?: number;
147
+
148
+ // ───── Filter (model + in-header per-column UI) ─────
149
+ filterModel?: TableFilterModel;
150
+ onFilterChange?: (model: TableFilterModel) => void;
151
+
152
+ // ───── Column visibility (dialog UI in toolbar) ─────
153
+ /**
154
+ * List of column `field`s currently hidden. Drives the column
155
+ * visibility dialog. When omitted, the dialog manages state
156
+ * internally (seeded from each column's `defaultHidden`).
157
+ */
158
+ hiddenColumns?: string[];
159
+ /** Called when the user commits a change in the visibility dialog. */
160
+ onHiddenColumnsChange?: (next: string[]) => void;
161
+ /**
162
+ * Show the "Columns" button in the toolbar. Defaults to `true` so
163
+ * the dialog is discoverable; set `false` for embedded / compact
164
+ * grids where columns are externally controlled.
165
+ * @default true
166
+ */
167
+ enableColumnVisibility?: boolean;
168
+
169
+ // ───── Column resize (drag the right edge of a <th>) ─────
170
+ /**
171
+ * Map of `field → width (px)` for user-resized columns. When
172
+ * omitted, DataGrid manages widths internally — seeded from each
173
+ * column's `width` prop.
174
+ */
175
+ columnWidths?: Record<string, number>;
176
+ /** Called when the user finishes (or actively drags) a resize. */
177
+ onColumnWidthsChange?: (next: Record<string, number>) => void;
178
+ /**
179
+ * Allow user-driven column resize via drag on the right edge of
180
+ * each `<th>`. Per-column opt-out via `col.resizable = false`.
181
+ * @default true
182
+ */
183
+ enableColumnResize?: boolean;
184
+
185
+ // ───── Column reorder (drag a header to reposition) ─────
186
+ /**
187
+ * Custom display order, as a list of `field`s. Columns not in the
188
+ * list are appended in their original order at the end. When
189
+ * omitted, DataGrid uses the order from the `cols` prop.
190
+ */
191
+ columnOrder?: string[];
192
+ /** Called when the user finishes a reorder drag. */
193
+ onColumnOrderChange?: (next: string[]) => void;
194
+ /**
195
+ * Allow user-driven column reorder via native HTML5 drag-and-drop
196
+ * on each `<th>`. Per-column opt-out via `col.reorderable = false`.
197
+ * @default true
198
+ */
199
+ enableColumnReorder?: boolean;
200
+
201
+ // ───── Selection ─────
202
+ rowSelection?: TableRowSelectionMode;
203
+ selectedRowIds?: string[];
204
+ onSelectionChange?: (ids: string[]) => void;
205
+ /** Bulk action sticky footer (visible only when selection > 0). */
206
+ bulkActions?: (selectedRows: T[]) => ReactNode;
207
+ /**
208
+ * Scope of the "select all" header checkbox.
209
+ * @default 'allLoaded'
210
+ */
211
+ selectAllScope?: DataGridSelectAllScope;
212
+
213
+ // ───── Internal pagination (opt-in) ─────
214
+ pagination?: DataGridPaginationConfig;
215
+
216
+ // ───── Row actions ─────
217
+ rowActions?: (row: T) => ReactNode;
218
+
219
+ // ───── States ─────
220
+ loading?: boolean;
221
+ loadingRowCount?: number;
222
+ emptyState?: ReactNode;
223
+
224
+ // ───── A11Y ─────
225
+ stickyHeader?: boolean;
226
+ caption?: ReactNode;
227
+ showCaption?: boolean;
228
+
229
+ // ───── RBAC ─────
230
+ access?: AccessRequirement;
231
+
232
+ // ───── i18n ─────
233
+ labels?: TableLabels;
234
+
235
+ // ───── Customization ─────
236
+ sx?: string;
237
+ slotProps?: DataGridSlotProps;
238
+ }
@@ -0,0 +1,152 @@
1
+ import { tv, type VariantProps } from 'tailwind-variants';
2
+
3
+ /**
4
+ * `<DataGrid>` variant recipe.
5
+ *
6
+ * Sibling of `tableVariants` — shares the same visual axes (variant /
7
+ * size / density) and the same identity-rule patterns:
8
+ * - No `dark:` variants on neutral palette (auto-invert via the
9
+ * dashforgePreset() CSS var swap).
10
+ * - Selected row uses LeftNav `itemActive` pattern
11
+ * (`bg-primary-100 text-primary-900`) — guaranteed contrast.
12
+ * - Hover uses one-tier elevation (`bg-neutral-100`).
13
+ *
14
+ * DataGrid-specific slot additions vs Table:
15
+ * - `stickyLeftCell` — column that uses `cols[i].sticky === 'left'`.
16
+ * Z-index ordering: `thead` (z-10) < `stickyLeftCell` (z-11) <
17
+ * `header × stickyLeft top-left corner cell` (z-20).
18
+ * - `paginationFooter` — wraps the optional `<Pagination>`.
19
+ */
20
+ export const dataGridVariants = tv({
21
+ slots: {
22
+ root: 'w-full',
23
+ toolbar: 'flex flex-wrap items-center gap-3 mb-3',
24
+ search: [
25
+ 'inline-flex items-center gap-2',
26
+ 'w-full max-w-sm rounded-md',
27
+ 'border border-neutral-300',
28
+ 'bg-neutral-50',
29
+ 'focus-within:ring-2 focus-within:ring-primary-500',
30
+ 'transition-colors motion-reduce:transition-none',
31
+ ],
32
+ // The scroll container needs an explicit bounded height for
33
+ // virtualization to compute the window. The consumer passes
34
+ // `height` prop (inline style) or sets it via `sx` / parent
35
+ // layout — DataGrid does NOT default a height (would be wrong
36
+ // for most layouts).
37
+ scroll: 'relative w-full overflow-auto rounded-md',
38
+ table: 'w-full caption-bottom text-left',
39
+ thead: 'bg-neutral-50 sticky top-0 z-10',
40
+ tbody: '',
41
+ headerRow: '',
42
+ headerCell: [
43
+ 'text-neutral-700',
44
+ 'font-semibold whitespace-nowrap select-none',
45
+ 'border-b border-neutral-200',
46
+ 'bg-neutral-50',
47
+ ],
48
+ headerCellButton: [
49
+ 'group inline-flex items-center gap-1 select-none',
50
+ 'hover:text-neutral-900',
51
+ 'focus:outline-none focus-visible:underline',
52
+ 'transition-colors motion-reduce:transition-none',
53
+ ],
54
+ row: [
55
+ 'group/row transition-colors motion-reduce:transition-none',
56
+ 'hover:bg-neutral-100',
57
+ 'data-[selected=true]:bg-primary-100',
58
+ 'data-[selected=true]:text-primary-900',
59
+ 'data-[selected=true]:font-medium',
60
+ ],
61
+ cell: [
62
+ 'text-neutral-900',
63
+ 'border-b border-neutral-200',
64
+ 'align-middle',
65
+ ],
66
+ selectionCell: 'w-10 text-center',
67
+ rowActionsCell: [
68
+ 'w-12 text-right',
69
+ 'opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100',
70
+ 'transition-opacity motion-reduce:transition-none',
71
+ ],
72
+ emptyState: 'py-12 text-center text-neutral-500',
73
+ loadingOverlay: 'pointer-events-none',
74
+ bulkActionFooter: [
75
+ 'sticky bottom-0 z-20',
76
+ 'flex flex-wrap items-center justify-between gap-3',
77
+ 'px-3 py-2',
78
+ 'border-t border-neutral-200',
79
+ 'bg-neutral-50 shadow-md',
80
+ ],
81
+ // Sticky LEFT column — uses `position: sticky; left: 0` + z-index
82
+ // so the column stays pinned during horizontal scroll. The
83
+ // `bg-neutral-50` ensures the column doesn't bleed when content
84
+ // scrolls underneath.
85
+ stickyLeftCell: 'sticky left-0 z-[1] bg-neutral-50',
86
+ // Sticky left × header intersection (top-left corner): higher
87
+ // z-index than both header (`z-10`) and sticky col (`z-[1]`).
88
+ stickyLeftHeaderCell: 'sticky left-0 z-20 bg-neutral-50',
89
+ // Sticky RIGHT column — mirror of stickyLeftCell. The first
90
+ // right-sticky column gets a `border-l` to separate it visually
91
+ // from the scrollable area (the consumer can override via
92
+ // slotProps if they don't want it).
93
+ stickyRightCell:
94
+ 'sticky right-0 z-[1] bg-neutral-50 border-l border-neutral-200',
95
+ stickyRightHeaderCell:
96
+ 'sticky right-0 z-20 bg-neutral-50 border-l border-neutral-200',
97
+ paginationFooter: 'flex justify-end mt-3',
98
+ },
99
+ variants: {
100
+ variant: {
101
+ plain: {},
102
+ lines: {},
103
+ striped: {
104
+ row: 'odd:bg-neutral-100/60',
105
+ },
106
+ bordered: {
107
+ table: 'border border-neutral-200',
108
+ cell: 'border-r last:border-r-0 border-neutral-200',
109
+ headerCell:
110
+ 'border-r last:border-r-0 border-neutral-200',
111
+ },
112
+ },
113
+ size: {
114
+ sm: {
115
+ headerCell: 'text-xs',
116
+ cell: 'text-xs',
117
+ search: 'text-xs',
118
+ },
119
+ md: {
120
+ headerCell: 'text-sm',
121
+ cell: 'text-sm',
122
+ search: 'text-sm',
123
+ },
124
+ lg: {
125
+ headerCell: 'text-base',
126
+ cell: 'text-base',
127
+ search: 'text-base',
128
+ },
129
+ },
130
+ density: {
131
+ compact: {
132
+ headerCell: 'px-2 py-1',
133
+ cell: 'px-2 py-1',
134
+ },
135
+ comfortable: {
136
+ headerCell: 'px-3 py-2',
137
+ cell: 'px-3 py-2',
138
+ },
139
+ spacious: {
140
+ headerCell: 'px-4 py-3',
141
+ cell: 'px-4 py-3',
142
+ },
143
+ },
144
+ },
145
+ defaultVariants: {
146
+ variant: 'lines',
147
+ size: 'md',
148
+ density: 'comfortable',
149
+ },
150
+ });
151
+
152
+ export type DataGridVariants = VariantProps<typeof dataGridVariants>;