@overdoser/react-toolkit 0.0.11 → 0.0.13
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/components/inputs/Select/Select.d.ts +6 -0
- package/index.js +1400 -1389
- package/llms.txt +17 -0
- package/manifest.json +3 -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[])`
|
|
@@ -368,6 +384,7 @@ Props:
|
|
|
368
384
|
- `onValueChange?: (value: string) => void` — single-mode value-only callback.
|
|
369
385
|
- `onValuesChange?: (values: string[]) => void` — multi-mode callback.
|
|
370
386
|
- `clearSearchOnSelect?: boolean` — default `true`. Multi-mode only.
|
|
387
|
+
- `closeOnSelect?: boolean` — default `true`. Multi-mode only. The menu closes after each add/remove (and after a `Create` row click). Set to `false` for the "stay open until done" pattern when picking many values rapidly.
|
|
371
388
|
- `allowCreate?: boolean` — default `false`. Multi-mode only. Adds a "Create '<query>'" row when the search query doesn't match an existing option. Pressing Enter (or clicking the row) pushes the trimmed query into `onValuesChange` and fires `onCreate`.
|
|
372
389
|
- `onCreate?: (value: string) => void` — Multi-mode only, paired with `allowCreate`. Fires with the new value; consumers typically persist it (e.g. push it back into `options`).
|
|
373
390
|
- `createLabel?: (query: string) => ReactNode` — Multi-mode only. Custom render for the create row. Default: `Create "<query>"`.
|
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"] }
|
|
@@ -254,6 +256,7 @@
|
|
|
254
256
|
"onValueChange": { "type": "(value: string) => void", "notes": "Single-mode value-only callback." },
|
|
255
257
|
"onValuesChange": { "type": "(values: string[]) => void", "notes": "Multi-mode callback." },
|
|
256
258
|
"clearSearchOnSelect": { "type": "boolean", "default": true, "notes": "Multi-mode only." },
|
|
259
|
+
"closeOnSelect": { "type": "boolean", "default": true, "notes": "Multi-mode only. Menu closes after each add/remove/create. Set false for the stay-open pattern." },
|
|
257
260
|
"allowCreate": { "type": "boolean", "default": false, "notes": "Multi-mode only. Adds a 'Create <query>' row when the query doesn't match an existing option; pressing Enter (or clicking it) pushes the trimmed query into onValuesChange and fires onCreate." },
|
|
258
261
|
"onCreate": { "type": "(value: string) => void", "notes": "Multi-mode only. Paired with allowCreate." },
|
|
259
262
|
"createLabel": { "type": "(query: string) => ReactNode", "notes": "Multi-mode only. Custom render for the Create row." },
|