@snowpact/react-tanstack-query-table 1.6.3 → 1.7.0

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/README.md CHANGED
@@ -46,17 +46,17 @@ setupSnowTable({
46
46
  - **Dynamic keys** (column labels, etc.) - Your `translate` function handles these
47
47
  - **Static UI keys** (`dataTable.*`) - Built-in English defaults if `translate` returns the key unchanged
48
48
 
49
- | Key | Default |
50
- |-----|---------|
51
- | `dataTable.search` | "Search..." |
52
- | `dataTable.elements` | "elements" |
53
- | `dataTable.paginationSize` | "per page" |
54
- | `dataTable.columnsConfiguration` | "Columns" |
55
- | `dataTable.resetFilters` | "Reset filters" |
56
- | `dataTable.resetColumns` | "Reset" |
57
- | `dataTable.searchFilters` | "Search..." |
58
- | `dataTable.searchEmpty` | "No results found" |
59
- | `dataTable.selectFilter` | "Select..." |
49
+ | Key | Default |
50
+ | -------------------------------- | ------------------ |
51
+ | `dataTable.search` | "Search..." |
52
+ | `dataTable.elements` | "elements" |
53
+ | `dataTable.paginationSize` | "per page" |
54
+ | `dataTable.columnsConfiguration` | "Columns" |
55
+ | `dataTable.resetFilters` | "Reset filters" |
56
+ | `dataTable.resetColumns` | "Reset" |
57
+ | `dataTable.searchFilters` | "Search..." |
58
+ | `dataTable.searchEmpty` | "No results found" |
59
+ | `dataTable.selectFilter` | "Select..." |
60
60
 
61
61
  Override static keys without i18n:
62
62
  ```tsx
@@ -103,27 +103,47 @@ That's it! You have a working data table.
103
103
 
104
104
  ### Theme Customization
105
105
 
106
- Override CSS variables to match your design:
106
+ Override CSS variables to match your design. Variables use `@property` so they won't override values you set before importing the styles.
107
107
 
108
108
  ```css
109
109
  :root {
110
- --snow-background: #ffffff;
111
- --snow-foreground: #0a0a0a;
112
- --snow-secondary: #f5f5f5;
113
- --snow-secondary-foreground: #737373;
114
- --snow-border: #d4d4d4;
115
- --snow-ring: #a3a3a3;
116
- --snow-radius: 0.375rem;
110
+ /* Base colors */
111
+ --snow-table-background: #ffffff;
112
+ --snow-table-foreground: #0a0a0a;
113
+ --snow-table-border: #e5e5e5; /* Table borders, row separators */
114
+ --snow-table-input-border: #e5e5e5; /* Inputs, buttons, dropdowns */
115
+ --snow-table-active-ring: #a3a3a3;
116
+
117
+ /* UI-specific colors */
118
+ --snow-table-header: #f5f5f5; /* Table headers, tab list */
119
+ --snow-table-hover: #f5f5f5; /* Hover states */
120
+ --snow-table-skeleton: #f5f5f5; /* Skeleton loader */
121
+ --snow-table-placeholder: #a3a3a3; /* Input placeholders */
122
+ --snow-table-muted: #737373; /* Secondary text (counts, pagination, inactive tabs) */
123
+
124
+ /* Optional (transparent/inherited by default) */
125
+ --snow-table-row-even: #fafafa; /* Alternating rows - zebra striping */
126
+ --snow-table-action-button: #f0f0f0; /* Action button background */
127
+
128
+ /* Other */
129
+ --snow-table-radius: 0.375rem;
130
+ --snow-table-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
117
131
  }
118
132
 
119
- /* Dark mode */
133
+ /* Dark mode example */
120
134
  .dark {
121
- --snow-background: #1a1a2e;
122
- --snow-foreground: #eaeaea;
123
- --snow-secondary: #16213e;
124
- --snow-secondary-foreground: #a0a0a0;
125
- --snow-border: #0f3460;
126
- --snow-ring: #3b82f6;
135
+ --snow-table-background: #1a1a2e;
136
+ --snow-table-foreground: #eaeaea;
137
+ --snow-table-border: #0f3460;
138
+ --snow-table-input-border: #0f3460;
139
+ --snow-table-active-ring: #3b82f6;
140
+ --snow-table-header: #16213e;
141
+ --snow-table-hover: #16213e;
142
+ --snow-table-skeleton: #16213e;
143
+ --snow-table-row-even: #1f1f3a;
144
+ --snow-table-placeholder: #6b7280;
145
+ --snow-table-muted: #a0a0a0;
146
+ --snow-table-action-button: #16213e;
127
147
  }
128
148
  ```
129
149
 
@@ -209,7 +229,7 @@ For API calls with built-in mutation handling:
209
229
  type: 'endpoint',
210
230
  icon: TrashIcon,
211
231
  label: 'Delete',
212
- variant: 'danger',
232
+ className: 'my-danger-btn', // Optional: add custom styling
213
233
  endpoint: (item) => api.deleteUser(item.id),
214
234
  onSuccess: () => {
215
235
  toast.success('User deleted');
@@ -228,7 +248,6 @@ Use `withConfirm` to show a confirmation dialog before the endpoint is called:
228
248
  type: 'endpoint',
229
249
  icon: TrashIcon,
230
250
  label: 'Delete',
231
- variant: 'danger',
232
251
  endpoint: (item) => api.deleteUser(item.id),
233
252
  withConfirm: async (item) => {
234
253
  // Return true to proceed, false to cancel
@@ -419,14 +438,14 @@ const columns: SnowColumnConfig<User>[] = [
419
438
 
420
439
  #### SnowColumnMeta options
421
440
 
422
- | Option | Type | Description |
423
- | -------------------- | ------------------ | ------------------------------------------------ |
424
- | `width` | `string \| number` | Column width (e.g., `'200px'`, `'20%'`, `'auto'`) |
425
- | `minWidth` | `string \| number` | Minimum column width |
426
- | `maxWidth` | `string \| number` | Maximum column width |
441
+ | Option | Type | Description |
442
+ | -------------------- | ------------------ | --------------------------------------------------------- |
443
+ | `width` | `string \| number` | Column width (e.g., `'200px'`, `'20%'`, `'auto'`) |
444
+ | `minWidth` | `string \| number` | Minimum column width |
445
+ | `maxWidth` | `string \| number` | Maximum column width |
427
446
  | `defaultHidden` | `boolean` | Hide column by default (with `enableColumnConfiguration`) |
428
- | `disableColumnClick` | `boolean` | Disable `onRowClick` for this column |
429
- | `center` | `boolean` | Center column content |
447
+ | `disableColumnClick` | `boolean` | Disable `onRowClick` for this column |
448
+ | `center` | `boolean` | Center column content |
430
449
 
431
450
  ---
432
451