@overdoser/react-toolkit 0.0.11 → 0.0.12
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/components/Table/Table.d.ts +13 -1
- package/index.js +1294 -1284
- package/llms.txt +16 -0
- package/manifest.json +2 -0
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -106,6 +106,8 @@ Props:
|
|
|
106
106
|
- `hoverable?: boolean` — default `false`
|
|
107
107
|
- `compact?: boolean` — default `false`
|
|
108
108
|
- `rowKey?: keyof T & string` — column key to use as React key; falls back to row index.
|
|
109
|
+
- `rowClassName?: string | ((row: T, index: number) => string | undefined)` — per-row class. Pass a string for a static class or a callback to compute it dynamically (e.g. highlight rows matching a predicate).
|
|
110
|
+
- `rowStyle?: CSSProperties | ((row: T, index: number) => CSSProperties | undefined)` — per-row inline style. Same shape as `rowClassName`.
|
|
109
111
|
- `emptyMessage?: ReactNode` — default `'No data'`
|
|
110
112
|
- `pagination?: PaginationConfig` — see below. When omitted, all rows render.
|
|
111
113
|
- `classes?: Partial<TableClasses>` where `TableClasses = { wrapper, root, headerCell, row, cell, emptyCell, paginator, pageButton }`
|
|
@@ -162,6 +164,20 @@ Server-side (controlled) example:
|
|
|
162
164
|
/>
|
|
163
165
|
```
|
|
164
166
|
|
|
167
|
+
Row-level styling (highlight rows of interest):
|
|
168
|
+
```tsx
|
|
169
|
+
<Table
|
|
170
|
+
data={orders}
|
|
171
|
+
columns={columns}
|
|
172
|
+
rowClassName={(row) => (row.flagged ? 'crk-row-flagged' : undefined)}
|
|
173
|
+
// …or inline:
|
|
174
|
+
rowStyle={(row) =>
|
|
175
|
+
row.amount > 10000 ? { backgroundColor: 'var(--crk-color-warning-light)' } : undefined
|
|
176
|
+
}
|
|
177
|
+
/>
|
|
178
|
+
```
|
|
179
|
+
Both accept a static value or `(row, index) => …`. Returned `undefined` is treated as no class/style.
|
|
180
|
+
|
|
165
181
|
### `useTableSort` (hook)
|
|
166
182
|
Import: `import { useTableSort } from '@overdoser/react-toolkit'`
|
|
167
183
|
Signature: `useTableSort<T>(data: T[], initialSort?: SortConfig[])`
|
package/manifest.json
CHANGED
|
@@ -78,6 +78,8 @@
|
|
|
78
78
|
"hoverable": { "type": "boolean", "default": false },
|
|
79
79
|
"compact": { "type": "boolean", "default": false },
|
|
80
80
|
"rowKey": { "type": "keyof T & string" },
|
|
81
|
+
"rowClassName": { "type": "string | ((row: T, index: number) => string | undefined)", "notes": "Per-row class. Use a callback to highlight rows matching a predicate." },
|
|
82
|
+
"rowStyle": { "type": "CSSProperties | ((row: T, index: number) => CSSProperties | undefined)", "notes": "Per-row inline style. Same shape as rowClassName." },
|
|
81
83
|
"emptyMessage": { "type": "ReactNode", "default": "No data" },
|
|
82
84
|
"pagination": { "type": "PaginationConfig" },
|
|
83
85
|
"classes": { "type": "Partial<TableClasses>", "shape": ["wrapper", "root", "headerCell", "row", "cell", "emptyCell", "paginator", "pageButton"] }
|