@handamade/psi-react 0.4.1 → 0.6.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/Dialog/Dialog.d.ts +24 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -0
- package/dist/Field/Field.d.ts +36 -0
- package/dist/Field/Field.d.ts.map +1 -0
- package/dist/Input/Input.d.ts +4 -2
- package/dist/Input/Input.d.ts.map +1 -1
- package/dist/Select/Select.d.ts +4 -2
- package/dist/Select/Select.d.ts.map +1 -1
- package/dist/a11y-meta.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +560 -435
- package/dist/manifest.json +190 -4
- package/dist/patterns.json +139 -0
- package/dist/styles.css +1 -1
- package/docs/AspectRatio.md +2 -0
- package/docs/Button.md +2 -0
- package/docs/Card.md +2 -0
- package/docs/Checkbox.md +2 -0
- package/docs/Dialog.md +43 -0
- package/docs/Field.md +42 -0
- package/docs/IconButton.md +2 -0
- package/docs/Input.md +5 -3
- package/docs/NavBar.md +2 -0
- package/docs/Select.md +5 -3
- package/docs/Switch.md +2 -0
- package/docs/Tag.md +2 -0
- package/docs/Tooltip.md +2 -0
- package/llms.txt +5 -3
- package/package.json +3 -3
package/docs/Select.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!-- Generated by emit-docs.ts — do not edit. -->
|
|
2
2
|
# Select
|
|
3
3
|
|
|
4
|
-
Styled native `<select>` with pixel-true heights (24–48) and an error state.
|
|
4
|
+
Styled native `<select>` with pixel-true heights (24–48) and an error state. Inside a Field, id/aria-describedby/aria-invalid/required are wired automatically (D49).
|
|
5
5
|
|
|
6
6
|
## Props
|
|
7
7
|
|
|
8
8
|
| Prop | Type | Default | Required | Description |
|
|
9
9
|
|---|---|---|---|---|
|
|
10
10
|
| `size` | `24 \| 32 \| 40 \| 48` | 32 | no | Height in px (24 \| 32 \| 40 \| 48). Replaces the native `size` attribute (which sets the visible option-row count on a listbox-style `<select>`) with the design system's control height in pixels. |
|
|
11
|
-
| `error` | `boolean` | false | no | Show error styling. |
|
|
11
|
+
| `error` | `boolean` | false | no | Show error styling. Inside a Field, the Field's error also lights this. |
|
|
12
12
|
| `ref` | `Ref<HTMLSelectElement>` | — | no | Forwarded ref to the underlying `<select>` element. |
|
|
13
13
|
| `className` | `string` | — | no | Additional CSS class name(s) merged onto the component's root element. |
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ Styled native `<select>` with pixel-true heights (24–48) and an error state.
|
|
|
19
19
|
| Tab | Focuses the native <select>. |
|
|
20
20
|
| Arrow keys / typeahead | Native option navigation. |
|
|
21
21
|
|
|
22
|
-
error: same contract as Input.
|
|
22
|
+
error: same contract as Input — sets a red border only. Inside a Field, aria-invalid and aria-describedby are wired automatically (D49); standalone, pair them yourself.
|
|
23
23
|
|
|
24
24
|
## Theming
|
|
25
25
|
|
|
@@ -35,3 +35,5 @@ Override `--psi-select-*` custom properties at any scope; interactive states der
|
|
|
35
35
|
- Typography tokens are --psi-text-{size}-{lineHeight}-{weight}.
|
|
36
36
|
- Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.
|
|
37
37
|
- --psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).
|
|
38
|
+
- 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.
|
|
39
|
+
- Use Dialog for blocking modal flows — title/footer slots, dismissible gate; danger stays on the footer Buttons, one accent per group.
|
package/docs/Switch.md
CHANGED
|
@@ -32,3 +32,5 @@ Override `--psi-switch-*` custom properties at any scope; interactive states der
|
|
|
32
32
|
- Typography tokens are --psi-text-{size}-{lineHeight}-{weight}.
|
|
33
33
|
- Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.
|
|
34
34
|
- --psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).
|
|
35
|
+
- 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.
|
|
36
|
+
- Use Dialog for blocking modal flows — title/footer slots, dismissible gate; danger stays on the footer Buttons, one accent per group.
|
package/docs/Tag.md
CHANGED
|
@@ -45,3 +45,5 @@ Override `--psi-tag-*` custom properties at any scope; interactive states derive
|
|
|
45
45
|
- Typography tokens are --psi-text-{size}-{lineHeight}-{weight}.
|
|
46
46
|
- Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.
|
|
47
47
|
- --psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).
|
|
48
|
+
- 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.
|
|
49
|
+
- Use Dialog for blocking modal flows — title/footer slots, dismissible gate; danger stays on the footer Buttons, one accent per group.
|
package/docs/Tooltip.md
CHANGED
|
@@ -34,3 +34,5 @@ Override `--psi-tooltip-*` custom properties at any scope; interactive states de
|
|
|
34
34
|
- Typography tokens are --psi-text-{size}-{lineHeight}-{weight}.
|
|
35
35
|
- Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.
|
|
36
36
|
- --psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).
|
|
37
|
+
- 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.
|
|
38
|
+
- 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,9 +1,10 @@
|
|
|
1
1
|
# @handamade/psi-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
13 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
|
|
7
|
+
- dist/patterns.json: 3 composition patterns (D47) — gap-annotated recipes with clarifying parameters; presets are generated JSX, never hand-written
|
|
7
8
|
- docs/{Component}.md: per-component docs (props, theming, variant guidance)
|
|
8
9
|
|
|
9
10
|
## Rules for generated code
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
- size is a px number (24|32|40|48), never "sm"/"md"/"lg".
|
|
13
14
|
- variant vocabulary: accent | accent-subtle | neutral | neutral-subtle | ghost | danger | danger-subtle | outline.
|
|
14
15
|
- One accent per visual group. danger only for destructive actions.
|
|
16
|
+
- Before composing multi-component UI, consult dist/patterns.json (or psi-mcp search) for a matching pattern and honor its clarifying parameters; presets are copy-paste JSX generated from the compose tree.
|
|
15
17
|
|
|
16
18
|
## Button: href + outline (D33/D34)
|
|
17
19
|
- Button renders as an <a> when given `href` (plus optional `target`/`rel`); disabled anchors get aria-disabled, no href attribute, and pointer-events: none instead of the disabled attribute.
|
|
@@ -32,14 +34,14 @@
|
|
|
32
34
|
|
|
33
35
|
## Compositions (recipes for what has no component yet)
|
|
34
36
|
|
|
35
|
-
- Form field:
|
|
37
|
+
- 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.
|
|
36
38
|
- Stacks/rows: `.psi-gap-*` utilities set only the gap — they do not create a flex/grid container. Pair them with `display: flex` (column for stacks, row for button groups).
|
|
37
39
|
- Native pass-through: components spread unlisted props onto their underlying element (Input → `<input>`, Select → `<select>`, Button → `<button>`/`<a>`), so `value`, `onChange`, `type`, `id`, `autoComplete`, `checked` etc. all work even though manifest.json lists only the component-specific props. Exception: Tooltip takes no host props — put handlers/attributes on its trigger child.
|
|
38
40
|
- Theming, programmatic: the standard setup is `data-psi-theme` on `<html>`. From JS, set it once at app init: `document.documentElement.dataset.psiTheme = "dark"` (React: in a root-level effect). Theme CSS does NOT paint the page background — paint `background: var(--psi-bg-primary)` at your app root yourself. For a themed subtree, set `data-psi-theme` on a wrapper and paint its background the same way; brand font combos do not reach nested subtrees (see guidance.fonts.scope).
|
|
39
41
|
- Size selection: 32 is the default (compact UI); 40 for comfortable forms and marketing pages; 24 for inline/table-row actions; 48 for hero CTAs.
|
|
40
42
|
- Tags & the accent rule (D40): Tags are passive labels — they do NOT count against "one accent per visual group" (that rule governs buttons/CTAs). Badge mapping: highlight (e.g. a plan badge) → `accent-subtle`; meta → `neutral-subtle`; status → `success`/`warning`/`danger`.
|
|
41
43
|
- CSS import order: all DS stylesheets are order-independent — base.css opens with an explicit `@layer psi.base, psi.theme, psi.components, psi.utilities;` statement. Recommended listing for readability: base → theme → components → utilities → @handamade/psi-react/styles.
|
|
42
|
-
- Widths: content widths are app-level; the system tokenizes the page container only (`--psi-container-max`).
|
|
44
|
+
- Widths: content widths are app-level; the system tokenizes the page container only (`--psi-container-max`). Dialog is the first component with its own width union — `width` is `400 | 560 | 720` (default 560).
|
|
43
45
|
- Full semantic token roster: `@handamade/psi-tokens/resolved/<theme>.json` has every token with resolved values — this file lists only the patterns.
|
|
44
46
|
|
|
45
47
|
Live MCP access to this data: see packages/mcp/llms.txt (hosted: https://psi.kurkin.de/mcp).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handamade/psi-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"tsx": "^4.22.4",
|
|
39
39
|
"vite": "^6.0.0",
|
|
40
40
|
"vitest": "^3.2.6",
|
|
41
|
-
"@handamade/psi-tokens": "0.
|
|
41
|
+
"@handamade/psi-tokens": "0.6.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "vite build && tsc -p tsconfig.build.json && tsx scripts/emit-manifest.ts && tsx scripts/emit-docs.ts",
|
|
44
|
+
"build": "vite build && tsc -p tsconfig.build.json && tsx scripts/emit-manifest.ts && tsx scripts/emit-patterns.ts && tsx scripts/emit-docs.ts",
|
|
45
45
|
"dev": "vite build --watch"
|
|
46
46
|
}
|
|
47
47
|
}
|