@carbonid1/design-system 7.4.0 → 7.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/dist/Autocomplete/Autocomplete.d.ts +12 -12
- package/dist/Autocomplete/Autocomplete.js +9 -7
- package/dist/Badge/Badge.d.ts +1 -1
- package/dist/Badge/Badge.js +1 -1
- package/dist/Badge/Badge.variants.js +1 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.variants.js +4 -4
- package/dist/Card/Card.d.ts +7 -7
- package/dist/ContextMenu/ContextMenu.d.ts +10 -10
- package/dist/Dialog/Dialog.d.ts +3 -3
- package/dist/Dialog/Dialog.js +1 -1
- package/dist/Field/Field.d.ts +6 -6
- package/dist/Field/Field.js +2 -2
- package/dist/Input/Input.d.ts +1 -1
- package/dist/Input/Input.js +1 -1
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.js +4 -2
- package/dist/Item/Item.d.ts +6 -6
- package/dist/Item/Item.js +1 -1
- package/dist/Kbd/Kbd.d.ts +1 -1
- package/dist/Kbd/Kbd.js +42 -13
- package/dist/Kbd/Kbd.types.d.ts +3 -1
- package/dist/Menu/Menu.d.ts +10 -10
- package/dist/Menu/Menu.js +4 -4
- package/dist/MessageScroller/MessageScroller.d.ts +5 -5
- package/dist/MeterRing/MeterRing.d.ts +1 -1
- package/dist/Popover/Popover.d.ts +2 -2
- package/dist/Popover/Popover.js +2 -2
- package/dist/ProgressRing/ProgressRing.d.ts +1 -1
- package/dist/RingVisual/RingVisual.d.ts +1 -1
- package/dist/ScrollArea/ScrollArea.d.ts +6 -6
- package/dist/ScrollArea/ScrollArea.js +4 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts +2 -2
- package/dist/Select/Select.d.ts +10 -10
- package/dist/Select/Select.js +48 -11
- package/dist/Select/Select.types.d.ts +1 -0
- package/dist/Slider/Slider.d.ts +8 -8
- package/dist/Slider/Slider.js +2 -2
- package/dist/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +2 -2
- package/dist/Table/Table.d.ts +1 -1
- package/dist/TableScrollRegion/TableScrollRegion.d.ts +1 -1
- package/dist/TableScrollRegion/TableScrollRegion.js +1 -1
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.js +2 -2
- package/dist/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/Toaster/Toaster.d.ts +1 -1
- package/dist/Toaster/Toaster.js +2 -2
- package/dist/Tooltip/Tooltip.d.ts +4 -4
- package/dist/Tooltip/Tooltip.js +2 -2
- package/dist/helpers/cn/cn.tables.js +12 -12
- package/dist/helpers/contrast/contrast.d.ts +6 -0
- package/dist/helpers/contrast/contrast.js +26 -0
- package/package.json +31 -30
- package/skills/design-system/references/theming.md +23 -20
- package/skills/design-system-package/SKILL.md +10 -2
- package/skills/design-system-package/references/stories.md +44 -0
- package/skills/design-system-package/references/tokens.md +4 -0
- package/skills/design-system-package/references/verification.md +16 -3
- package/themes/dashboard.css +17 -3
- package/themes/reader.css +19 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonid1/design-system",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0",
|
|
4
4
|
"description": "Shared React UI primitives + design tokens (themes, postcss config)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"scripts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tailwindcss/postcss": "^4.
|
|
36
|
+
"@tailwindcss/postcss": "^4.3.3",
|
|
37
37
|
"class-variance-authority": "^0.7.1",
|
|
38
|
-
"cn": "0.
|
|
39
|
-
"lucide-react": "^1.
|
|
38
|
+
"cn": "0.4.0",
|
|
39
|
+
"lucide-react": "^1.47.0",
|
|
40
40
|
"next-themes": "^0.4.6",
|
|
41
|
-
"react-hotkeys-hook": "^5.
|
|
42
|
-
"tailwindcss": "^4.
|
|
41
|
+
"react-hotkeys-hook": "^5.3.3",
|
|
42
|
+
"tailwindcss": "^4.3.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@base-ui/react": "^1.
|
|
45
|
+
"@base-ui/react": "^1.8.0",
|
|
46
46
|
"postcss": "^8.0.0",
|
|
47
47
|
"react": "^19.0.0",
|
|
48
48
|
"react-dom": "^19.0.0"
|
|
@@ -51,38 +51,39 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@base-ui/react": "^1.
|
|
55
|
-
"@storybook/addon-a11y": "^10.
|
|
56
|
-
"@storybook/addon-docs": "^10.
|
|
57
|
-
"@storybook/addon-themes": "^10.
|
|
58
|
-
"@storybook/addon-vitest": "^10.
|
|
59
|
-
"@storybook/react-vite": "^10.
|
|
60
|
-
"@testing-library/jest-dom": "^
|
|
61
|
-
"@testing-library/react": "^16.3.
|
|
62
|
-
"@testing-library/user-event": "^14.6.
|
|
63
|
-
"@types/react": "^19.
|
|
64
|
-
"@types/react-dom": "^19.
|
|
65
|
-
"@vitejs/plugin-react": "^6.
|
|
66
|
-
"@vitest/browser-playwright": "^4.1.
|
|
67
|
-
"jsdom": "^
|
|
54
|
+
"@base-ui/react": "^1.8.0",
|
|
55
|
+
"@storybook/addon-a11y": "^10.6.0",
|
|
56
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
57
|
+
"@storybook/addon-themes": "^10.6.0",
|
|
58
|
+
"@storybook/addon-vitest": "^10.6.0",
|
|
59
|
+
"@storybook/react-vite": "^10.6.0",
|
|
60
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
61
|
+
"@testing-library/react": "^16.3.3",
|
|
62
|
+
"@testing-library/user-event": "^14.6.7",
|
|
63
|
+
"@types/react": "^19.3.0",
|
|
64
|
+
"@types/react-dom": "^19.3.0",
|
|
65
|
+
"@vitejs/plugin-react": "^6.1.1",
|
|
66
|
+
"@vitest/browser-playwright": "^4.1.11",
|
|
67
|
+
"jsdom": "^30.1.1",
|
|
68
68
|
"next-themes": "^0.4.6",
|
|
69
|
-
"playwright": "^1.
|
|
70
|
-
"react": "^19.
|
|
71
|
-
"react-dom": "^19.
|
|
72
|
-
"storybook": "^10.
|
|
73
|
-
"tailwindcss": "^4.
|
|
74
|
-
"vite": "^8.0
|
|
75
|
-
"vitest": "^4.1.
|
|
69
|
+
"playwright": "^1.63.0",
|
|
70
|
+
"react": "^19.3.0",
|
|
71
|
+
"react-dom": "^19.3.0",
|
|
72
|
+
"storybook": "^10.6.0",
|
|
73
|
+
"tailwindcss": "^4.3.3",
|
|
74
|
+
"vite": "^8.3.0",
|
|
75
|
+
"vitest": "^4.1.11",
|
|
76
76
|
"@carbonid1/tsconfig": "0.3.0"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"build": "tsc",
|
|
80
|
+
"typecheck": "tsc -p tsconfig.check.json",
|
|
80
81
|
"storybook": "storybook dev -p 7006 --no-open",
|
|
81
82
|
"build-storybook": "storybook build",
|
|
82
83
|
"test": "vitest --run",
|
|
83
84
|
"test:watch": "vitest",
|
|
84
|
-
"test:storybook": "vitest --project=storybook",
|
|
85
|
-
"test:run:storybook": "vitest run --project=storybook",
|
|
85
|
+
"test:storybook": "vitest --project='storybook*'",
|
|
86
|
+
"test:run:storybook": "vitest run --project='storybook*'",
|
|
86
87
|
"postinstall": "node scripts/install-skill.mjs"
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -31,31 +31,33 @@ Tokens are defined in the package’s `themes/reader.css` and `themes/dashboard.
|
|
|
31
31
|
|
|
32
32
|
### Base tokens (from shadcn naming)
|
|
33
33
|
|
|
34
|
-
| Token | Role | Sub-variants
|
|
35
|
-
| ----------------- | --------------------------------------------------------------- |
|
|
36
|
-
| `--background` | Page background (the desk) | —
|
|
37
|
-
| `--foreground` | Default text | —
|
|
38
|
-
| `--card` | Raised card surfaces | foreground
|
|
39
|
-
| `--popover` | Floating popover/drawer/menu surfaces | foreground
|
|
40
|
-
| `--surface-inset` | Inset blocks carved into a card (inputs, preview boxes) | —
|
|
41
|
-
| `--primary` | Interactive color (buttons, links, selections, focus, progress) | foreground
|
|
42
|
-
| `--secondary` | Supporting interaction fills | foreground
|
|
43
|
-
| `--muted` | Muted interaction fills and text | foreground
|
|
44
|
-
| `--accent` | Hover/expanded tints | foreground
|
|
45
|
-
| `--destructive` | Errors, danger
|
|
46
|
-
| `--border` | Default borders | —
|
|
47
|
-
| `--input` | Input borders | —
|
|
48
|
-
| `--ring` | Focus rings | —
|
|
34
|
+
| Token | Role | Sub-variants |
|
|
35
|
+
| ----------------- | --------------------------------------------------------------- | ----------------- |
|
|
36
|
+
| `--background` | Page background (the desk) | — |
|
|
37
|
+
| `--foreground` | Default text | — |
|
|
38
|
+
| `--card` | Raised card surfaces | foreground |
|
|
39
|
+
| `--popover` | Floating popover/drawer/menu surfaces | foreground |
|
|
40
|
+
| `--surface-inset` | Inset blocks carved into a card (inputs, preview boxes) | — |
|
|
41
|
+
| `--primary` | Interactive color (buttons, links, selections, focus, progress) | foreground, hover |
|
|
42
|
+
| `--secondary` | Supporting interaction fills | foreground |
|
|
43
|
+
| `--muted` | Muted interaction fills and text | foreground |
|
|
44
|
+
| `--accent` | Hover/expanded tints | foreground |
|
|
45
|
+
| `--destructive` | Errors, danger (fills, borders, icons) | foreground |
|
|
46
|
+
| `--border` | Default borders | — |
|
|
47
|
+
| `--input` | Input borders | — |
|
|
48
|
+
| `--ring` | Focus rings | — |
|
|
49
|
+
|
|
50
|
+
A hand-rolled `bg-primary` fill hovers with `hover:bg-primary-hover`, not `hover:bg-primary/90`: the opacity modifier lets the page show through and drops the label under 4.5:1 in light mode.
|
|
49
51
|
|
|
50
52
|
### Elevation shadows
|
|
51
53
|
|
|
52
54
|
Each elevated surface pairs with a tuned shadow. Tailwind utilities: `shadow-card`, `inset-shadow-surface`, `shadow-popover`.
|
|
53
55
|
|
|
54
|
-
| Token | Pairs with | Notes
|
|
55
|
-
| ------------------------ | ------------------ |
|
|
56
|
-
| `--card-shadow` | `bg-card` | Subtle drop, neutral or hue-tinted per theme
|
|
57
|
-
| `--surface-inset-shadow` | `bg-surface-inset` | Hairline inset top in light,
|
|
58
|
-
| `--popover-shadow` | `bg-popover` | Stronger drop with larger geometry in dark
|
|
56
|
+
| Token | Pairs with | Notes |
|
|
57
|
+
| ------------------------ | ------------------ | ------------------------------------------------ |
|
|
58
|
+
| `--card-shadow` | `bg-card` | Subtle drop, neutral or hue-tinted per theme |
|
|
59
|
+
| `--surface-inset-shadow` | `bg-surface-inset` | Hairline inset top in light, transparent in dark |
|
|
60
|
+
| `--popover-shadow` | `bg-popover` | Stronger drop with larger geometry in dark |
|
|
59
61
|
|
|
60
62
|
Why dark mode skips the inset shadow: top-edge highlights fake a "light source from above" convention that reads as a sharp border artifact on dark surfaces, not as a soft recess. Tonal contrast (a wider inset-vs-card lightness delta) carries the elevation instead.
|
|
61
63
|
|
|
@@ -102,6 +104,7 @@ Don't use `bg-surface-inset` for empty placeholders — that signals "a control
|
|
|
102
104
|
## Notes
|
|
103
105
|
|
|
104
106
|
- **`::selection`** uses solid oklch values, not opacity modifiers — semi-transparent backgrounds create visible seams at line boundaries.
|
|
107
|
+
- **Status text uses the `-foreground` shade.** For `destructive`, `success`, `attention`, and `highlight`, put text in `text-<role>-foreground` — error copy, and labels on the role's own tints (`bg-destructive/10 text-destructive-foreground`). The bare token is for fills, borders, and icons; its tints darken with it, so it can't carry text on them.
|
|
105
108
|
- **Tooltip** uses inverted tokens (`bg-foreground text-background`) since it's a dark-on-light / light-on-dark surface. Kbd badge: `bg-background/15`.
|
|
106
109
|
- **DebugPanel** is excluded from token migration — physically fixed terminal aesthetic.
|
|
107
110
|
|
|
@@ -19,6 +19,11 @@ shared changes there; installed skill copies belong to the published package.
|
|
|
19
19
|
semantic tokens, with `bg-background`, `bg-card`, `bg-surface-inset`, and
|
|
20
20
|
`bg-popover` for surfaces. Reserve `bg-muted`, `bg-accent`, and `bg-secondary`
|
|
21
21
|
for interaction states and fills.
|
|
22
|
+
- Focus rings are box-shadows, which High Contrast (forced colors) drops. Pair
|
|
23
|
+
`focus-visible:ring-*` with `focus-visible:outline-hidden` and
|
|
24
|
+
`forced-colors:focus-visible:outline-[Highlight]`. A bare `outline-hidden`
|
|
25
|
+
draws a permanent box in High Contrast; use `outline-none` where no ring is
|
|
26
|
+
shown, and no outline class on parts that never take focus.
|
|
22
27
|
- Interactive files need `'use client'` for Next.js consumers. Preserve tree
|
|
23
28
|
shaking: no module-level side effects in component files; `package.json`
|
|
24
29
|
declares only CSS in `sideEffects`.
|
|
@@ -43,9 +48,12 @@ visual states, and export it from the barrel.
|
|
|
43
48
|
- Adding or changing semantic tokens: [token changes](references/tokens.md).
|
|
44
49
|
For existing color roles and elevation, use the shared
|
|
45
50
|
[theming reference](../design-system/references/theming.md).
|
|
51
|
+
- Adding or changing stories and story tests:
|
|
52
|
+
[writing stories](references/stories.md).
|
|
46
53
|
- Visual, interactive, token, or helper behavior changes:
|
|
47
|
-
[verification](references/verification.md), including Storybook
|
|
48
|
-
|
|
54
|
+
[verification](references/verification.md), including Storybook, an
|
|
55
|
+
agent-browser visual check for rendering changes, and downstream checks
|
|
56
|
+
appropriate to the change. Skill text and other non-visual documentation
|
|
49
57
|
changes do not require a visual review or Storybook run.
|
|
50
58
|
- Preparing an authorized release: [release workflow](references/release.md).
|
|
51
59
|
Publishing uses `pnpm release` and `NPM_TOKEN`; a draft or implementation
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Writing stories
|
|
2
|
+
|
|
3
|
+
Stories are CSF factories. Import the preview relatively, build `meta` from it, and export each story from `meta.story()`. There is no `export default`, no `StoryObj`, and no `title`: the sidebar path comes from the file.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { expect, fn } from 'storybook/test'
|
|
7
|
+
import preview from '../../.storybook/preview'
|
|
8
|
+
import { Button } from './Button'
|
|
9
|
+
|
|
10
|
+
const meta = preview.meta({
|
|
11
|
+
component: Button,
|
|
12
|
+
args: { onClick: fn() },
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
/** Primary button with a text label. */
|
|
16
|
+
export const Primary = meta.story({
|
|
17
|
+
args: { children: 'Primary', variant: 'primary' },
|
|
18
|
+
})
|
|
19
|
+
Primary.test('fires onClick when clicked', async ({ canvas, userEvent, args }) => {
|
|
20
|
+
await userEvent.click(canvas.getByRole('button', { name: 'Primary' }))
|
|
21
|
+
await expect(args.onClick).toHaveBeenCalledOnce()
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Stories
|
|
26
|
+
|
|
27
|
+
- **One story per visual state.** Each story should earn its place in the sidebar with its tests stripped away. Attach a test to an existing story when that story's props already cover it. Add a story only when the test needs props no story has, and name it for what it shows, not what it asserts.
|
|
28
|
+
- **A one-line JSDoc on every story**, saying what's on screen as a noun phrase, optionally with when to reach for it: `/** Disabled primary button. */`, `/** Right-aligned numeric column — for metric-heavy tables. */`. Leave out behaviour verbs ("closes when…", "tests that…"); those belong in test names.
|
|
29
|
+
- **Keep a file under about 500 lines.** Past that, move the shared fixtures, render helpers and test helpers into a sibling `stories/` folder. The package build skips `stories/` folders, like it skips story files.
|
|
30
|
+
|
|
31
|
+
## Typing
|
|
32
|
+
|
|
33
|
+
- `preview.meta({ component })` infers args from the component, generics included (`component: Table<Person>`).
|
|
34
|
+
- Use `preview.type<{ args: X }>()` only when a wrapper render takes args the component lacks, like Switch's `label`.
|
|
35
|
+
- When meta args set a union prop, write `'muted' as const`. A widened string makes Storybook drop the meta args, and every story then asks for those props again.
|
|
36
|
+
|
|
37
|
+
## Tests
|
|
38
|
+
|
|
39
|
+
- **One user workflow per `.test()`.** Each test remounts the story, and every story runs in four palette and mode projects, so ten one-assertion tests cost forty mounts. Put the steps a user takes in one sequence into one test: "hidden, then opens with its items" is one test, and the ways to dismiss it can be another.
|
|
40
|
+
- **Leave a popup open at the end of one test.** axe audits whatever each test leaves on screen, so if every test closes the popup, nobody checks it.
|
|
41
|
+
- **Use `waitFor` only across a real async gap:** a transition, a portal mounting, a timer, or an observer. After `userEvent`, assert synchronous changes directly.
|
|
42
|
+
- **Don't `waitFor` something to stay the same.** It passes on its first check, before a late change lands. Wait a couple of animation frames, then assert directly.
|
|
43
|
+
- A Base UI popup is in the DOM right after the click, but it animates in from opacity 0. Assert `toBeInTheDocument()` straight away, or wait before asserting `toBeVisible()`.
|
|
44
|
+
- Popups render in a portal, so query them through `screen`, not `canvas`.
|
|
@@ -5,3 +5,7 @@
|
|
|
5
5
|
3. Use it via Tailwind classes in components (`bg-my-token`, `text-my-token-foreground`). Opacity modifiers like `bg-my-token/10` work natively on those color variables.
|
|
6
6
|
|
|
7
7
|
Use enough sub-variants for depth — don't squeeze a semantic color into just `base + foreground` when the role needs distinct text/background/border values. Opacity modifiers are a poor substitute for dedicated tokens tuned per role.
|
|
8
|
+
|
|
9
|
+
## Non-color tokens in a color-sharing namespace
|
|
10
|
+
|
|
11
|
+
A custom `--shadow-*` or `--inset-shadow-*` token shares its utility prefix with colors (`shadow-black/10`), and `cn` classifies any value it doesn't know as a color. `cn` learns the name from the `@theme inline` block in `themes/reader.css`, so bridge it there as usual (`--shadow-card: var(--card-shadow);`). Then add a merge case to `cn.test.ts`. The first test run rebuilds `cn.tables.js`; commit it. Namespaces without a color twin, like `font-*` and `animate-*`, merge correctly without this.
|
|
@@ -6,11 +6,24 @@ Run these commands from `packages/design-system`:
|
|
|
6
6
|
|
|
7
7
|
- `pnpm storybook` starts the standalone component browser at `http://localhost:7006`.
|
|
8
8
|
- `pnpm build-storybook` builds the static component documentation.
|
|
9
|
-
- `pnpm
|
|
9
|
+
- `pnpm typecheck` type-checks everything in the package, including stories, tests and the Storybook config, which `pnpm build` skips. The pre-commit hook runs it when design-system TypeScript is staged.
|
|
10
|
+
- `pnpm test:run:storybook` runs story interaction and accessibility tests through Vitest, once per palette and mode. Add `--project=storybook-dashboard-dark` (or `storybook`, `storybook-dark`, `storybook-dashboard`) to run one combination.
|
|
11
|
+
|
|
12
|
+
## Look at it with agent-browser
|
|
13
|
+
|
|
14
|
+
Story tests prove behavior, not appearance. When a change can affect rendering, drive the affected stories with the repo's pinned `agent-browser` CLI and open the screenshots with an image viewer. A screenshot command that succeeds is not a visual pass. Playwright stays the Vitest browser provider and e2e runner; don't write ad-hoc Playwright scripts to inspect stories.
|
|
15
|
+
|
|
16
|
+
- Read the CLI's guide first: `pnpm exec agent-browser skills get core`. If its browser is missing, run `pnpm exec agent-browser install`. Use this project binary, not a global one.
|
|
17
|
+
- Run every call in your own session: `--session "$(pnpm exec agent-browser session id --scope worktree --prefix ds)"`.
|
|
18
|
+
- Open a story in isolation at `http://localhost:7006/iframe.html?id=<story-id>&viewMode=story`. Story ids are in `http://localhost:7006/index.json`. Before reusing a running Storybook, confirm it serves this checkout.
|
|
19
|
+
- Palettes and modes go in the URL: `&globals=palette:dashboard;theme:dark`. For reduced motion, use `set media light reduced-motion`.
|
|
20
|
+
- For High Contrast (forced colors), open the story with `--args "--force-high-contrast"` and confirm it took with `eval "matchMedia('(forced-colors: active)').matches"`. The forced palette is dark.
|
|
21
|
+
- Drive only the states the change touches, with real input: `press Tab` for focus-visible, plus clicks and typing. For a fix, screenshot the broken state before editing so you can compare.
|
|
22
|
+
- When done, `close` the session and stop any Storybook you started.
|
|
10
23
|
|
|
11
24
|
## Verify before you ship
|
|
12
25
|
|
|
13
|
-
- **Stories for everything visual** — `Component.stories.tsx`, one story per visual state, each rendering under both palettes × both modes (the `.storybook/preview.ts` toolbar switchers prove it in isolation before shipping). Story-level `.test()` methods for interaction behavior. **Vitest** for non-visual helpers in `src/helpers/`.
|
|
14
|
-
- **Run the story tests** with `pnpm test:run:storybook` and resolve interaction and accessibility failures before shipping.
|
|
26
|
+
- **Stories for everything visual** — `Component.stories.tsx`, one story per visual state, each rendering under both palettes × both modes (the `.storybook/preview.ts` toolbar switchers prove it in isolation before shipping). Don't add per-palette copies of a story with pinned `globals`: a story's globals override the test projects', so each copy renders its one combination four times. Story-level `.test()` methods for interaction behavior; [writing stories](stories.md) covers the format, typing and test rules. **Vitest** for non-visual helpers in `src/helpers/`.
|
|
27
|
+
- **Run the story tests** with `pnpm test:run:storybook` and resolve interaction and accessibility failures before shipping. axe runs on every story after its tests, and a violation fails the story. It checks whatever the test leaves on screen, in both palettes and both modes. To audit a popup, end a test with the popup open. Since every test runs in all four, compare against the element's resting value instead of expecting one mode's shadow or color. For focus and invalid rings, assert `ringWidth(element)` from `.storybook/shadows.ts`: Tailwind pads every `box-shadow` with transparent layers, so a raw `boxShadow` check passes even when no ring shows. Turning a rule off for a story (`parameters.a11y.config.rules`) needs a comment saying why, plus a test covering what the rule would have caught.
|
|
15
28
|
- **UI/UX Pro Max accessibility review** — For any visual, interactive, or token change, invoke the UI/UX Pro Max plugin review lens when available (prefer `ui-ux-pro-max:design-system` for primitives and tokens, `ui-ux-pro-max:ui-styling` for component styling, and `ui-ux-pro-max:ui-ux-pro-max` when unsure) and let it choose the relevant checks for the diff. The review must still cover keyboard navigation, visible focus states, contrast, accessible names/ARIA, screen-reader semantics, responsive behavior, interaction states, and reduced-motion behavior where they apply. In the handoff, name the lens used and summarize findings; for non-visual package housekeeping, say it does not apply. Package rules stay authoritative over broad style suggestions.
|
|
16
29
|
- **Prove it downstream.** The real proof a change works is at least one app or fixture outside the package rendering it; a primitive that type-checks can still look wrong under a palette you never opened.
|
package/themes/dashboard.css
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
--inset-shadow-surface: var(--surface-inset-shadow);
|
|
40
40
|
--color-primary: var(--primary);
|
|
41
41
|
--color-primary-foreground: var(--primary-foreground);
|
|
42
|
+
--color-primary-hover: var(--primary-hover);
|
|
42
43
|
--color-primary-muted: var(--primary-muted);
|
|
43
44
|
--color-primary-border: var(--primary-border);
|
|
44
45
|
--color-secondary: var(--secondary);
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
--color-accent: var(--accent);
|
|
49
50
|
--color-accent-foreground: var(--accent-foreground);
|
|
50
51
|
--color-destructive: var(--destructive);
|
|
52
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
51
53
|
--color-highlight: var(--highlight);
|
|
52
54
|
--color-highlight-foreground: var(--highlight-foreground);
|
|
53
55
|
--color-highlight-muted: var(--highlight-muted);
|
|
@@ -116,15 +118,22 @@
|
|
|
116
118
|
--surface-inset-shadow: inset 0 1px 1px 0 oklch(0.2 0 0 / 0.04);
|
|
117
119
|
--primary: oklch(0.546 0.245 262.881);
|
|
118
120
|
--primary-foreground: oklch(1 0 0);
|
|
121
|
+
/* Hover darkens the fill. An opacity modifier would lighten it toward the page and drop
|
|
122
|
+
* the label under 4.5:1. */
|
|
123
|
+
--primary-hover: oklch(0.488 0.243 264.376);
|
|
119
124
|
--primary-muted: oklch(0.97 0.014 254);
|
|
120
125
|
--primary-border: oklch(0.882 0.059 254);
|
|
121
126
|
--secondary: oklch(0.97 0 0);
|
|
122
127
|
--secondary-foreground: oklch(0.205 0 0);
|
|
123
128
|
--muted: oklch(0.97 0 0);
|
|
124
|
-
|
|
129
|
+
/* Clears 4.5:1 on every light surface, including surface-inset and muted fills. */
|
|
130
|
+
--muted-foreground: oklch(0.53 0 0);
|
|
125
131
|
--accent: oklch(0.97 0 0);
|
|
126
132
|
--accent-foreground: oklch(0.205 0 0);
|
|
127
133
|
--destructive: oklch(0.58 0.22 27);
|
|
134
|
+
/* Text shade of the destructive role, for error copy and labels on destructive tints.
|
|
135
|
+
* `--destructive` tints darken with it, so it cannot carry text on them. */
|
|
136
|
+
--destructive-foreground: oklch(0.46 0.17 27);
|
|
128
137
|
--border: oklch(0.922 0 0);
|
|
129
138
|
--input: oklch(0.922 0 0);
|
|
130
139
|
/* Resting boundary for form controls (Button outline, inputs) — distinct from
|
|
@@ -158,9 +167,13 @@
|
|
|
158
167
|
--surface-inset: oklch(0.225 0.028 261);
|
|
159
168
|
--card-shadow: 0 1px 2px 0 oklch(0 0 0 / 0.2);
|
|
160
169
|
--popover-shadow: 0 12px 32px -4px oklch(0 0 0 / 0.4), 0 4px 8px -2px oklch(0 0 0 / 0.2);
|
|
161
|
-
|
|
170
|
+
/* Transparent, not `none`, so it doesn't wipe out a focus ring. See reader.css. */
|
|
171
|
+
--surface-inset-shadow: 0 0 #0000;
|
|
162
172
|
--primary: oklch(0.78 0.13 256);
|
|
163
|
-
|
|
173
|
+
/* Dark primary is a light blue, so its label is dark: white text on it reads at ~2:1.
|
|
174
|
+
* The contrast test holds the label to 4.5:1 on the fill. */
|
|
175
|
+
--primary-foreground: oklch(0.21 0.032 265);
|
|
176
|
+
--primary-hover: oklch(0.73 0.13 256);
|
|
164
177
|
--primary-muted: oklch(0.282 0.091 267 / 0.2);
|
|
165
178
|
--primary-border: oklch(0.393 0.155 264);
|
|
166
179
|
--secondary: oklch(0.373 0.031 260);
|
|
@@ -170,6 +183,7 @@
|
|
|
170
183
|
--accent: oklch(0.446 0.026 257);
|
|
171
184
|
--accent-foreground: oklch(0.967 0.003 265);
|
|
172
185
|
--destructive: oklch(0.704 0.191 22.216);
|
|
186
|
+
--destructive-foreground: oklch(0.82 0.1 22);
|
|
173
187
|
--border: oklch(0.373 0.031 260 / 50%);
|
|
174
188
|
--input: oklch(0.373 0.031 260 / 60%);
|
|
175
189
|
--input-border: oklch(0.58 0.025 262);
|
package/themes/reader.css
CHANGED
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
--inset-shadow-surface: var(--surface-inset-shadow);
|
|
62
62
|
--color-primary: var(--primary);
|
|
63
63
|
--color-primary-foreground: var(--primary-foreground);
|
|
64
|
+
--color-primary-hover: var(--primary-hover);
|
|
64
65
|
--color-primary-muted: var(--primary-muted);
|
|
65
66
|
--color-primary-border: var(--primary-border);
|
|
66
67
|
--color-secondary: var(--secondary);
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
--color-accent: var(--accent);
|
|
71
72
|
--color-accent-foreground: var(--accent-foreground);
|
|
72
73
|
--color-destructive: var(--destructive);
|
|
74
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
73
75
|
--color-highlight: var(--highlight);
|
|
74
76
|
--color-highlight-foreground: var(--highlight-foreground);
|
|
75
77
|
--color-highlight-muted: var(--highlight-muted);
|
|
@@ -141,15 +143,22 @@
|
|
|
141
143
|
--surface-inset-shadow: inset 0 1px 1px 0 oklch(0.2 0.02 75 / 0.04);
|
|
142
144
|
--primary: oklch(0.546 0.245 262.881);
|
|
143
145
|
--primary-foreground: oklch(1 0 0);
|
|
146
|
+
/* Hover darkens the fill. An opacity modifier would lighten it toward the page and drop
|
|
147
|
+
* the label under 4.5:1. */
|
|
148
|
+
--primary-hover: oklch(0.488 0.243 264.376);
|
|
144
149
|
--primary-muted: oklch(0.97 0.014 254);
|
|
145
150
|
--primary-border: oklch(0.882 0.059 254);
|
|
146
151
|
--secondary: oklch(0.97 0 0);
|
|
147
152
|
--secondary-foreground: oklch(0.205 0 0);
|
|
148
153
|
--muted: oklch(0.97 0 0);
|
|
149
|
-
|
|
154
|
+
/* Clears 4.5:1 on every light surface, including surface-inset and muted fills. */
|
|
155
|
+
--muted-foreground: oklch(0.53 0 0);
|
|
150
156
|
--accent: oklch(0.97 0 0);
|
|
151
157
|
--accent-foreground: oklch(0.205 0 0);
|
|
152
158
|
--destructive: oklch(0.58 0.22 27);
|
|
159
|
+
/* Text shade of the destructive role, for error copy and labels on destructive tints.
|
|
160
|
+
* `--destructive` tints darken with it, so it cannot carry text on them. */
|
|
161
|
+
--destructive-foreground: oklch(0.46 0.17 27);
|
|
153
162
|
--border: oklch(0.922 0 0);
|
|
154
163
|
--input: oklch(0.922 0 0);
|
|
155
164
|
/* Resting boundary for form controls (Button outline, inputs) — distinct from
|
|
@@ -185,12 +194,17 @@
|
|
|
185
194
|
--surface-inset: oklch(0.225 0.028 261);
|
|
186
195
|
/* Inset shadow disabled: top-edge highlights fake a light-source-from-above
|
|
187
196
|
* convention that reads as a sharp border artifact on dark surfaces rather
|
|
188
|
-
* than a soft recess. The tonal delta above carries the elevation instead.
|
|
197
|
+
* than a soft recess. The tonal delta above carries the elevation instead.
|
|
198
|
+
* It's a transparent shadow, not `none`: Tailwind lists it alongside the focus
|
|
199
|
+
* ring in one box-shadow, and a `none` in that list drops the ring too. */
|
|
189
200
|
--card-shadow: 0 1px 2px 0 oklch(0 0 0 / 0.2);
|
|
190
201
|
--popover-shadow: 0 12px 32px -4px oklch(0 0 0 / 0.4), 0 4px 8px -2px oklch(0 0 0 / 0.2);
|
|
191
|
-
--surface-inset-shadow:
|
|
202
|
+
--surface-inset-shadow: 0 0 #0000;
|
|
192
203
|
--primary: oklch(0.78 0.13 256);
|
|
193
|
-
|
|
204
|
+
/* Dark primary is a light blue, so its label is dark: white text on it reads at ~2:1.
|
|
205
|
+
* The contrast test holds the label to 4.5:1 on the fill. */
|
|
206
|
+
--primary-foreground: oklch(0.21 0.032 265);
|
|
207
|
+
--primary-hover: oklch(0.73 0.13 256);
|
|
194
208
|
--primary-muted: oklch(0.282 0.091 267 / 0.2);
|
|
195
209
|
--primary-border: oklch(0.393 0.155 264);
|
|
196
210
|
--secondary: oklch(0.373 0.031 260);
|
|
@@ -200,6 +214,7 @@
|
|
|
200
214
|
--accent: oklch(0.446 0.026 257);
|
|
201
215
|
--accent-foreground: oklch(0.967 0.003 265);
|
|
202
216
|
--destructive: oklch(0.704 0.191 22.216);
|
|
217
|
+
--destructive-foreground: oklch(0.82 0.1 22);
|
|
203
218
|
--border: oklch(0.373 0.031 260 / 50%);
|
|
204
219
|
--input: oklch(0.373 0.031 260 / 60%);
|
|
205
220
|
--input-border: oklch(0.58 0.025 262);
|