@snowpact/react-tanstack-query-table 1.6.3 → 1.6.4
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 +54 -35
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -6
- package/dist/index.js +1518 -1526
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
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
|
|
50
|
-
|
|
51
|
-
| `dataTable.search`
|
|
52
|
-
| `dataTable.elements`
|
|
53
|
-
| `dataTable.paginationSize`
|
|
54
|
-
| `dataTable.columnsConfiguration` | "Columns"
|
|
55
|
-
| `dataTable.resetFilters`
|
|
56
|
-
| `dataTable.resetColumns`
|
|
57
|
-
| `dataTable.searchFilters`
|
|
58
|
-
| `dataTable.searchEmpty`
|
|
59
|
-
| `dataTable.selectFilter`
|
|
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
|
-
|
|
111
|
-
--snow-
|
|
112
|
-
--snow-
|
|
113
|
-
--snow-
|
|
114
|
-
--snow-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
/* Base colors */
|
|
111
|
+
--snow-table-background: #ffffff;
|
|
112
|
+
--snow-table-foreground: #0a0a0a;
|
|
113
|
+
--snow-table-border: #e5e5e5;
|
|
114
|
+
--snow-table-ring: #a3a3a3;
|
|
115
|
+
|
|
116
|
+
/* UI-specific colors */
|
|
117
|
+
--snow-table-header: #f5f5f5; /* Table headers, tab list */
|
|
118
|
+
--snow-table-hover: #f5f5f5; /* Hover states */
|
|
119
|
+
--snow-table-skeleton: #f5f5f5; /* Skeleton loader */
|
|
120
|
+
--snow-table-separator: #e5e5e5; /* Dropdown separators */
|
|
121
|
+
--snow-table-placeholder: #a3a3a3; /* Input placeholders, icons */
|
|
122
|
+
--snow-table-text: #737373; /* Secondary text (labels, counts) */
|
|
123
|
+
|
|
124
|
+
/* Optional (transparent/inherited by default) */
|
|
125
|
+
--snow-table-row-even: #fafafa; /* Alternating rows - only set if you want zebra striping */
|
|
126
|
+
--snow-table-button: #f0f0f0; /* Button background - falls back to --snow-table-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-
|
|
124
|
-
--snow-
|
|
125
|
-
--snow-
|
|
126
|
-
--snow-
|
|
135
|
+
--snow-table-background: #1a1a2e;
|
|
136
|
+
--snow-table-foreground: #eaeaea;
|
|
137
|
+
--snow-table-border: #0f3460;
|
|
138
|
+
--snow-table-ring: #3b82f6;
|
|
139
|
+
--snow-table-header: #16213e;
|
|
140
|
+
--snow-table-hover: #16213e;
|
|
141
|
+
--snow-table-skeleton: #16213e;
|
|
142
|
+
--snow-table-separator: #0f3460;
|
|
143
|
+
--snow-table-row-even: #1f1f3a;
|
|
144
|
+
--snow-table-placeholder: #6b7280;
|
|
145
|
+
--snow-table-text: #a0a0a0;
|
|
146
|
+
--snow-table-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
|
-
|
|
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
|
|