@overdoser/react-toolkit 0.0.10 → 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/AGENTS.md +1 -1
- package/components/Table/Table.d.ts +13 -1
- package/index.js +1296 -1284
- package/llms.txt +16 -0
- package/manifest.json +2 -0
- package/package.json +1 -1
- package/recipes/multi-select-in-modal.tsx +7 -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"] }
|
package/package.json
CHANGED
|
@@ -21,6 +21,12 @@ const TAGS = [
|
|
|
21
21
|
* does NOT need to be sized large enough** to contain the menu. The menu
|
|
22
22
|
* uses `--crk-z-floating` (1060) which sits above `--crk-z-modal` (1050).
|
|
23
23
|
*
|
|
24
|
+
* Pair this pattern with `closeOnBackdrop={false}`: clicking the modal
|
|
25
|
+
* backdrop while the menu is open is "outside" the menu (closes the menu)
|
|
26
|
+
* AND on the backdrop (would close the modal too). Disabling backdrop
|
|
27
|
+
* dismissal scopes the click to closing only the menu — users dismiss the
|
|
28
|
+
* modal explicitly via Cancel/Save/×.
|
|
29
|
+
*
|
|
24
30
|
* If you have a reason to keep the menu inside the modal subtree (e.g.,
|
|
25
31
|
* parent-scoped CSS theming), pass `portal={false}` and size the modal
|
|
26
32
|
* generously.
|
|
@@ -32,7 +38,7 @@ export function MultiSelectInModalRecipe() {
|
|
|
32
38
|
return (
|
|
33
39
|
<>
|
|
34
40
|
<Button onClick={() => setOpen(true)}>Edit tags</Button>
|
|
35
|
-
<Modal open={open} onClose={() => setOpen(false)} size="sm">
|
|
41
|
+
<Modal open={open} onClose={() => setOpen(false)} size="sm" closeOnBackdrop={false}>
|
|
36
42
|
<Modal.Header onClose={() => setOpen(false)}>Tags</Modal.Header>
|
|
37
43
|
<Modal.Body>
|
|
38
44
|
<label style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|