@handamade/psi-react 0.9.1 → 0.10.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 +1 -1
- package/dist/Checkbox/Checkbox.d.ts +6 -0
- package/dist/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Pagination/Pagination.d.ts +45 -0
- package/dist/Pagination/Pagination.d.ts.map +1 -0
- package/dist/Table/Table.d.ts +38 -0
- package/dist/Table/Table.d.ts.map +1 -0
- package/dist/Table/TableBody.d.ts +8 -0
- package/dist/Table/TableBody.d.ts.map +1 -0
- package/dist/Table/TableCell.d.ts +11 -0
- package/dist/Table/TableCell.d.ts.map +1 -0
- package/dist/Table/TableContext.d.ts +19 -0
- package/dist/Table/TableContext.d.ts.map +1 -0
- package/dist/Table/TableHead.d.ts +12 -0
- package/dist/Table/TableHead.d.ts.map +1 -0
- package/dist/Table/TableHeaderCell.d.ts +13 -0
- package/dist/Table/TableHeaderCell.d.ts.map +1 -0
- package/dist/Table/TableRow.d.ts +12 -0
- package/dist/Table/TableRow.d.ts.map +1 -0
- package/dist/Table/TableSelectionCell.d.ts +8 -0
- package/dist/Table/TableSelectionCell.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +700 -490
- package/dist/manifest.json +250 -0
- package/dist/patterns.json +80 -16
- package/dist/styles.css +1 -1
- package/docs/Checkbox.md +1 -0
- package/docs/Pagination.md +32 -0
- package/docs/Table.md +36 -0
- package/docs/TableBody.md +27 -0
- package/docs/TableCell.md +28 -0
- package/docs/TableHead.md +27 -0
- package/docs/TableHeaderCell.md +29 -0
- package/docs/TableRow.md +29 -0
- package/llms.txt +10 -1
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- Generated by emit-docs.ts — do not edit. -->
|
|
2
|
+
# TableHeaderCell
|
|
3
|
+
|
|
4
|
+
`<th scope="col">`. `aria-sort` belongs on the th, never on the inner button — assistive tech reads the sort state from the column header.
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Prop | Type | Default | Required | Description |
|
|
9
|
+
|---|---|---|---|---|
|
|
10
|
+
| `sortKey` | `string` | — | no | Sort key this column emits. Enables the sort control when the table is `sortable`. |
|
|
11
|
+
| `numeric` | `boolean` | — | no | Right-aligns and renders tabular figures (D62). |
|
|
12
|
+
| `className` | `string` | — | no | Additional CSS class name(s) merged onto the component's root element. |
|
|
13
|
+
|
|
14
|
+
## Theming
|
|
15
|
+
|
|
16
|
+
This component has no `--psi-table-header-cell-*` tokens — its styling binds scale tokens only, so there is nothing component-scoped to override. Theme changes reach it through the semantic tokens of its children and surroundings.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
|
|
22
|
+
- One accent per visual group; everything else neutral or ghost.
|
|
23
|
+
- danger only for actions with real consequences.
|
|
24
|
+
- Sizes are px numbers (24|32|40|48), never S/M/L.
|
|
25
|
+
- Typography tokens are --psi-text-{size}-{lineHeight}-{weight}.
|
|
26
|
+
- Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.
|
|
27
|
+
- --psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).
|
|
28
|
+
- Wrap labeled form controls in Field — label association, description/error line, aria-describedby and aria-invalid come wired; don't hand-roll label+message rows.
|
|
29
|
+
- Use Dialog for blocking modal flows — title/footer slots, dismissible gate; danger stays on the footer Buttons, one accent per group.
|
package/docs/TableRow.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- Generated by emit-docs.ts — do not edit. -->
|
|
2
|
+
# TableRow
|
|
3
|
+
|
|
4
|
+
`<tr>`. `rowId` is the key the `selected` set holds.
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Prop | Type | Default | Required | Description |
|
|
9
|
+
|---|---|---|---|---|
|
|
10
|
+
| `rowId` | `string` | — | no | Stable identity for selection. Required for selectable tables (D62). |
|
|
11
|
+
| `selectLabel` | `string` | — | no | Accessible name for this row's selection checkbox. |
|
|
12
|
+
| `className` | `string` | — | no | Additional CSS class name(s) merged onto the component's root element. |
|
|
13
|
+
|
|
14
|
+
## Theming
|
|
15
|
+
|
|
16
|
+
This component has no `--psi-table-row-*` tokens — its styling binds scale tokens only, so there is nothing component-scoped to override. Theme changes reach it through the semantic tokens of its children and surroundings.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
|
|
22
|
+
- One accent per visual group; everything else neutral or ghost.
|
|
23
|
+
- danger only for actions with real consequences.
|
|
24
|
+
- Sizes are px numbers (24|32|40|48), never S/M/L.
|
|
25
|
+
- Typography tokens are --psi-text-{size}-{lineHeight}-{weight}.
|
|
26
|
+
- Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.
|
|
27
|
+
- --psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).
|
|
28
|
+
- Wrap labeled form controls in Field — label association, description/error line, aria-describedby and aria-invalid come wired; don't hand-roll label+message rows.
|
|
29
|
+
- Use Dialog for blocking modal flows — title/footer slots, dismissible gate; danger stays on the footer Buttons, one accent per group.
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @handamade/psi-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
25 React 19 components consuming @handamade/psi-tokens. Zero runtime deps, CSS Modules, ref-as-prop.
|
|
4
4
|
|
|
5
5
|
## Machine-readable artifacts
|
|
6
6
|
- dist/manifest.json: full component/prop inventory with types and defaults
|
|
@@ -39,6 +39,15 @@
|
|
|
39
39
|
## Icons (22)
|
|
40
40
|
- Full icon set: IconPlus, IconMinus, IconCheck, IconClose, IconChevronDown, IconChevronRight, IconSearch, IconSettings, IconUser, IconEye, IconEyeOff, IconEdit, IconCopy, IconTrash, IconLoader, IconExternalLink, plus D36 additions — arrows IconArrowDown and IconArrowUpRight, and social glyphs IconLinkedIn, IconGitHub, IconX, IconInstagram.
|
|
41
41
|
|
|
42
|
+
## Table family (6)
|
|
43
|
+
- `<Table>` renders `<table>` and is **controlled-only** — it holds no state (D62). Sorting is `sort={{key, direction}}` + `onSortChange`; selection is `selected` (a `ReadonlySet<string>` keyed by each `<TableRow rowId>`) + `onSelectionChange`. `sortable` and `selectable` only enable the affordances. `size` is `32 | 40 | 48` px (default 40) and `stickyHeader` pins the header. It does no filtering, sorting or slicing of rows — the consumer does that.
|
|
44
|
+
- `<TableHead>`, `<TableBody>`, `<TableRow>` render `<thead>`, `<tbody>`, `<tr>`. `<TableHeaderCell>` renders `<th scope="col">`, taking `sortKey` to become sortable and putting `aria-sort` on the `<th>`. `<TableCell>` renders `<td>`. Both cells take `numeric`, which right-aligns **and** renders tabular figures.
|
|
45
|
+
- Selecting rows: give each `<TableRow>` a `rowId` and a `selectLabel` — the row checkbox has no visible label, so `selectLabel` is its accessible name. `<TableHead>` grows the select-all checkbox automatically; do not add one. Consult dist/patterns.json for the `data-table` pattern.
|
|
46
|
+
|
|
47
|
+
## Pagination
|
|
48
|
+
- `<Pagination page={n} pageCount={total} onPageChange={...}>`: a numbered pager with ellipsis truncation (`‹ 1 … 4 5 6 … 13 ›`), built from Button/IconButton (D63). `siblingCount` (default 1) sets how many pages flank the current one before truncating; `aria-current="page"` marks the active page and the ellipsis is inert.
|
|
49
|
+
- It is **standalone, not a Table family member** and has no connection to `Table` — `Table` has no `page` prop. The `table-pagination` pattern composes it as a `Toolbar` sibling of a page-size `Select`; the consumer owns page state and slices the rows.
|
|
50
|
+
|
|
42
51
|
## Compositions (recipes for what has no component yet)
|
|
43
52
|
|
|
44
53
|
- Form field: wrap the label, control, and message with `<Field label description error required>{control}</Field>` — label association (htmlFor/id), the description/error message line (swaps to error, aria-live="polite"), and aria-describedby/aria-invalid wiring onto a nested Input/Select are automatic (D49). `group` mode renders fieldset/legend for self-labeled controls (Checkbox/Switch). Standalone Input/Select used outside Field still need `aria-invalid` and `aria-describedby` paired manually. Spacing: `psi-gap-24` between fields, `psi-gap-12` for toggle groups, `psi-gap-8` for button rows and label+Tag rows.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handamade/psi-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"tsx": "^4.22.4",
|
|
41
41
|
"vite": "^6.0.0",
|
|
42
42
|
"vitest": "^3.2.6",
|
|
43
|
-
"@handamade/psi-tokens": "0.
|
|
43
|
+
"@handamade/psi-tokens": "0.10.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "vite build && tsc -p tsconfig.build.json && tsx scripts/emit-manifest.ts && tsx scripts/emit-patterns.ts && tsx scripts/emit-docs.ts",
|