@react-ui-org/react-ui 0.63.1 → 0.64.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/.claude/agents/code-reviewer.md +122 -0
- package/.claude/rules/code.md +22 -0
- package/.claude/rules/docs.md +35 -0
- package/.claude/rules/frontend.md +72 -0
- package/.claude/rules/git.md +13 -0
- package/.claude/rules/safety-guards.md +9 -0
- package/.claude/rules/styling.md +32 -0
- package/.claude/rules/testing.md +59 -0
- package/.claude/settings.json +32 -0
- package/.claude/skills/commit/SKILL.md +54 -0
- package/.devcontainer/devcontainer.json +23 -0
- package/.mcp.json +8 -0
- package/CLAUDE.md +82 -0
- package/dist/react-ui.css +4 -4
- package/dist/react-ui.development.css +600 -590
- package/dist/react-ui.development.js +20 -10
- package/dist/react-ui.js +1 -1
- package/docker-compose.base.yml +93 -0
- package/docker-compose.yml.dist +41 -0
- package/opencode.json +10 -0
- package/package.json +3 -2
- package/scripts/auto-start-mkdocs.sh +5 -0
- package/scripts/auto-start-node.sh +33 -0
- package/scripts/mcps/chrome-host/README.md +118 -0
- package/scripts/mcps/chrome-host/cdp_proxy.py +90 -0
- package/scripts/mcps/chrome-host/mcp-entry.sh +33 -0
- package/scripts/mcps/chrome-host/mcp-launch.sh +36 -0
- package/scripts/mcps/chrome-host/mcp-setup.sh +70 -0
- package/scripts/mcps/chrome-host/start-host-chrome.sh +267 -0
- package/scripts/write-lockfile-hash.sh +15 -0
- package/setup.sh +107 -0
- package/src/components/Button/Button.jsx +4 -0
- package/src/components/Button/Button.module.scss +11 -0
- package/src/components/FileInputField/FileInputField.jsx +9 -2
- package/src/components/FormLayout/FormLayoutCustomField.jsx +4 -1
- package/src/components/FormLayout/FormLayoutCustomFieldContext.js +3 -0
- package/src/components/FormLayout/README.md +168 -161
- package/src/components/FormLayout/index.js +1 -0
- package/src/components/Popover/Popover.jsx +1 -0
- package/src/components/Popover/Popover.module.scss +1 -0
- package/src/components/Popover/README.md +29 -0
- package/src/components/Popover/_helpers/cleanPlacementStyle.js +1 -0
- package/src/components/Popover/_theme.scss +1 -0
- package/src/components/SelectField/SelectField.jsx +8 -3
- package/src/components/TextArea/TextArea.jsx +9 -2
- package/src/components/TextField/TextField.jsx +8 -3
- package/src/theme.scss +1 -0
- package/.env.playwright +0 -9
- package/.env.playwright.dist +0 -9
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-reviewer
|
|
3
|
+
description: Thorough review of a change against this repo's rules — intent/requirements, correctness, design, security (incl. dependency audit), and test coverage. Reviews flexibly by scope: uncommitted work, the whole branch against its base (default master), a specific commit, or a named branch — always as one combined diff. Use after implementing a change, or to review a branch before merge. Complements the generic /code-review skill, which does not know these project rules.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Reviewer
|
|
8
|
+
|
|
9
|
+
Review a change as one coherent diff and report findings only — do not edit
|
|
10
|
+
files. Read enough of the surrounding code to judge it, read the cited rule and
|
|
11
|
+
doc files before ruling, and cite `file:line` for every finding.
|
|
12
|
+
|
|
13
|
+
## Scope — what to review
|
|
14
|
+
|
|
15
|
+
Orient first: `git status --short` and `git rev-parse --abbrev-ref HEAD`. Then
|
|
16
|
+
pick the scope and state which you chose. Always review the **net result as a
|
|
17
|
+
single diff, never commit-by-commit** — later commits (fixups, reverts) may
|
|
18
|
+
correct earlier ones, and only the final state matters.
|
|
19
|
+
|
|
20
|
+
* **Explicitly requested** — honour what the invocation asks for: a base branch
|
|
21
|
+
(`git diff <branch>...HEAD`), a single commit (`git show <sha>`), or a commit
|
|
22
|
+
range (`git diff <from>..<to>`).
|
|
23
|
+
* **Uncommitted work present** (`git status --short` non-empty) → review the
|
|
24
|
+
working tree against `HEAD` (`git diff HEAD`) plus any untracked files (list
|
|
25
|
+
with `git status`, then read them).
|
|
26
|
+
* **Clean tree** → review the whole branch against its base (default `master`):
|
|
27
|
+
`git diff master...HEAD` (three dots = only what this branch introduced).
|
|
28
|
+
|
|
29
|
+
Work top-down: first establish what the change is supposed to do, then judge
|
|
30
|
+
whether it does so correctly, cleanly, safely, and with tests. The repo-specific
|
|
31
|
+
rules in section 6 are the easiest to miss — do not skip them.
|
|
32
|
+
|
|
33
|
+
## 1. Intent & requirements
|
|
34
|
+
|
|
35
|
+
* Establish the intent from the task / PR description and any linked issue (a
|
|
36
|
+
GitHub issue number appears in parentheses in the commit/PR name, e.g.
|
|
37
|
+
`(#261)`). Check the diff against it.
|
|
38
|
+
* Is all the planned functionality present, or is something stubbed, `TODO`, or
|
|
39
|
+
silently dropped?
|
|
40
|
+
* Flag scope creep — unrelated changes riding along
|
|
41
|
+
([code.md](../rules/code.md)).
|
|
42
|
+
|
|
43
|
+
## 2. Correctness & robustness
|
|
44
|
+
|
|
45
|
+
* **Error handling.** Failures are handled at the right level, not swallowed;
|
|
46
|
+
promises are awaited; rejections are handled.
|
|
47
|
+
* **Edge cases.** Empty / `null` / `undefined`, zero / one / many, boundary
|
|
48
|
+
values, async ordering, and failure paths are handled. Component edge cases:
|
|
49
|
+
missing `children`, controlled vs uncontrolled, ref forwarding.
|
|
50
|
+
* **Resource hygiene.** `useEffect` subscriptions / listeners / timers are
|
|
51
|
+
cleaned up; no retained references or unbounded state growth.
|
|
52
|
+
|
|
53
|
+
## 3. Design & maintainability
|
|
54
|
+
|
|
55
|
+
* Clean separation of concerns; the change integrates with the existing patterns
|
|
56
|
+
rather than introducing a parallel style — `React.forwardRef` +
|
|
57
|
+
`withGlobalProps`, context-aware variants via `useContext`, `classNames()` for
|
|
58
|
+
CSS Module classes, `transferProps()` for HTML attribute pass-through, CSS
|
|
59
|
+
Modules for styles ([frontend.md](../rules/frontend.md),
|
|
60
|
+
[styling.md](../rules/styling.md)).
|
|
61
|
+
* Props follow the [API Guidelines](../../src/docs/contribute/api.md) and nesting
|
|
62
|
+
follows [Composition](../../src/docs/contribute/composition.md).
|
|
63
|
+
* DRY without premature abstraction; sound, reasonably performant code — no heavy
|
|
64
|
+
work in render, no needless re-renders.
|
|
65
|
+
|
|
66
|
+
## 4. Security
|
|
67
|
+
|
|
68
|
+
* Validate / sanitise external data; no unsafe HTML
|
|
69
|
+
(`dangerouslySetInnerHTML`) with untrusted content; no secrets committed.
|
|
70
|
+
* **Dependencies.** If `package.json` / `package-lock.json` changed: new
|
|
71
|
+
dependencies need explicit approval
|
|
72
|
+
([safety-guards.md](../rules/safety-guards.md)); run `npm audit` (in the
|
|
73
|
+
devcontainer) and report advisories; sanity-check the lockfile diff for
|
|
74
|
+
unexpected or transitive version bumps.
|
|
75
|
+
|
|
76
|
+
## 5. Tests
|
|
77
|
+
|
|
78
|
+
* New or changed code is covered — co-located Jest tests in `__tests__/` and/or
|
|
79
|
+
Playwright component tests (`.spec.tsx` + `.story.tsx`); obsolete tests for
|
|
80
|
+
removed code are deleted. Never leave a component or helper untested
|
|
81
|
+
([testing.md](../rules/testing.md)).
|
|
82
|
+
* A bug-fix test must fail before the fix and pass after.
|
|
83
|
+
* Tests assert behaviour, not implementation details.
|
|
84
|
+
|
|
85
|
+
## 6. This repo's rules
|
|
86
|
+
|
|
87
|
+
Easy-to-miss invariants beyond the generic checks above:
|
|
88
|
+
|
|
89
|
+
* **Lint gate** ([CLAUDE.md](../../CLAUDE.md#commands)): `npm run lint` =
|
|
90
|
+
eslint + markdownlint + stylelint. It is not auto-run — remind the author to
|
|
91
|
+
run `npm run lint`, `npm run test:jest`, and `npm run test:playwright-ct:all`.
|
|
92
|
+
* **Component layout** ([frontend.md](../rules/frontend.md)): every component
|
|
93
|
+
folder has the `.jsx` + `index.js` barrel + `*.module.scss` + `_settings`/
|
|
94
|
+
`_theme`/`_tools` SCSS partials + `README.md` + `__tests__/`. PropTypes, not
|
|
95
|
+
TypeScript, in source.
|
|
96
|
+
* **CSS Modules class naming** ([styling.md](../rules/styling.md)): `root`,
|
|
97
|
+
`isRootXxx`, `hasRootXxx`, `isRootInXxx`, `isRootLayoutXxx`.
|
|
98
|
+
* **Docs** ([docs.md](../rules/docs.md)): component docs live in the component's
|
|
99
|
+
`README.md`; new doc pages are wired into `mkdocs.yml`.
|
|
100
|
+
* **Git hygiene** ([git.md](../rules/git.md)): no push or remote change without
|
|
101
|
+
approval; commit/PR subjects imperative English with backticked symbols and a
|
|
102
|
+
trailing `(#issue)` when one exists; **no `Co-Authored-By`**. PR names land in
|
|
103
|
+
the changelog.
|
|
104
|
+
|
|
105
|
+
## Output format
|
|
106
|
+
|
|
107
|
+
Group findings by severity. For each:
|
|
108
|
+
`severity | file:line | rule/doc cited | what is wrong | concrete fix`.
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
## Blocking
|
|
112
|
+
- [requirements] src/components/Foo/Foo.jsx:42 — acceptance criterion not implemented.
|
|
113
|
+
- [tests] src/helpers/bar/bar.js:10 (testing.md) — new helper `bar` has no test.
|
|
114
|
+
|
|
115
|
+
## Non-blocking / nits
|
|
116
|
+
- [design] src/components/Foo/Foo.jsx:7 (frontend.md) — ref not forwarded to root element.
|
|
117
|
+
|
|
118
|
+
## Reminders
|
|
119
|
+
- Run `npm run lint`, `npm run test:jest`, and `npm run test:playwright-ct:all` before committing.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
End with a one-line verdict: APPROVE / APPROVE WITH NITS / REQUEST CHANGES.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Code
|
|
2
|
+
|
|
3
|
+
* Modify files only within defined scope, do not make changes that affect
|
|
4
|
+
unrelated parts of the codebase, e.g. do not change unrelated comments,
|
|
5
|
+
imports, code or documentation.
|
|
6
|
+
* Keep changes minimal and focused.
|
|
7
|
+
* Follow the project formatting and style sources:
|
|
8
|
+
[.editorconfig](../../.editorconfig) (general),
|
|
9
|
+
[.markdownlint.jsonc](../../.markdownlint.jsonc) (Markdown),
|
|
10
|
+
[.eslintrc](../../.eslintrc) / [.eslintrc-ts](../../.eslintrc-ts)
|
|
11
|
+
(JavaScript/TypeScript), [stylelint.config.js](../../stylelint.config.js)
|
|
12
|
+
(SCSS).
|
|
13
|
+
* Only fix linting/formatting issues in files you created or modified for the
|
|
14
|
+
current task. Do not fix pre-existing issues outside that scope.
|
|
15
|
+
* Keep comments simple and use terminology and language matching repository
|
|
16
|
+
standards.
|
|
17
|
+
* Revert unrelated changes. If they are worth keeping, ask the user whether to
|
|
18
|
+
track them separately — either as a GitHub issue (propose a title and
|
|
19
|
+
description first, and confirm before creating it) or, for small changes, on a
|
|
20
|
+
separate branch without an issue.
|
|
21
|
+
* Do not use one character long variable names or shortened names unless it is a
|
|
22
|
+
common abbreviation.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "src/docs/**"
|
|
4
|
+
- "src/components/**/README.md"
|
|
5
|
+
- "src/helpers/**/README.md"
|
|
6
|
+
- "README.md"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Documentation
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
* Run `npm run markdownlint` after changes (add `-- --fix` to autofix).
|
|
14
|
+
* Run `mkdocs build` and `mkdocs serve` to build and serve the documentation
|
|
15
|
+
* To verify a rendered component or the docs previews in a real browser
|
|
16
|
+
(navigate, click, screenshot, inspect the running docs site), drive host
|
|
17
|
+
Chrome through the `chrome-host` MCP. See
|
|
18
|
+
[AI Integration](../../src/docs/contribute/ai-integration.md).
|
|
19
|
+
|
|
20
|
+
See [Commands](../../CLAUDE.md#commands).
|
|
21
|
+
|
|
22
|
+
## Conventions
|
|
23
|
+
|
|
24
|
+
* Documentation is built with [Material for MkDocs][mkdocs-material] and
|
|
25
|
+
[Docoff][docoff] (live, runnable component previews). Component docs live in
|
|
26
|
+
each component's `README.md`; guides and foundations live under `src/docs/`.
|
|
27
|
+
* New pages must be wired into the navigation in [mkdocs.yml](../../mkdocs.yml).
|
|
28
|
+
* Use relative links between docs.
|
|
29
|
+
|
|
30
|
+
## Reference
|
|
31
|
+
|
|
32
|
+
* [General Guidelines › Documenting](../../src/docs/contribute/general-guidelines.md#documenting)
|
|
33
|
+
|
|
34
|
+
[mkdocs-material]: https://squidfunk.github.io/mkdocs-material/
|
|
35
|
+
[docoff]: https://github.com/react-ui-org/docoff
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "src/**/*.js"
|
|
4
|
+
- "src/**/*.jsx"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Frontend (React component library)
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
* If dependencies change, run `npm ci`.
|
|
12
|
+
* Run `npm run eslint` after changes (add `-- --fix` to autofix).
|
|
13
|
+
* To verify a rendered component or the docs previews in a real browser
|
|
14
|
+
(navigate, click, screenshot, inspect the running docs site), drive host
|
|
15
|
+
Chrome through the `chrome-host` MCP. See
|
|
16
|
+
[AI Integration](../../src/docs/contribute/ai-integration.md).
|
|
17
|
+
|
|
18
|
+
## Stack
|
|
19
|
+
|
|
20
|
+
React UI is a themeable React component library, distributed as a UMD bundle
|
|
21
|
+
(with separate CSS) and as ESM (consumers run their own SASS pipeline).
|
|
22
|
+
Components are plain JavaScript / JSX (Babel, no TypeScript in the source) for
|
|
23
|
+
React 18, validated with `prop-types`. TypeScript appears only in tests and type
|
|
24
|
+
checks.
|
|
25
|
+
|
|
26
|
+
## Component structure
|
|
27
|
+
|
|
28
|
+
Each component lives in `src/components/<ComponentName>/` and follows this
|
|
29
|
+
layout:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Button/
|
|
33
|
+
Button.jsx # Component implementation (React.forwardRef + withGlobalProps)
|
|
34
|
+
Button.module.scss # CSS Modules styles
|
|
35
|
+
index.js # Re-exports default (withGlobalProps-wrapped) as named export
|
|
36
|
+
_settings.scss # Component-level SCSS variables
|
|
37
|
+
_theme.scss # CSS custom properties (design tokens)
|
|
38
|
+
_tools.scss # SCSS mixins
|
|
39
|
+
README.md # Docoff/MkDocs documentation with live previews
|
|
40
|
+
helpers/ # Component-specific helper functions
|
|
41
|
+
__tests__/
|
|
42
|
+
Button.spec.tsx # Playwright visual + functional tests
|
|
43
|
+
Button.story.tsx # Story components used as test fixtures
|
|
44
|
+
_propTests/ # Reusable prop test generators (arrays of test cases)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Implementation pattern
|
|
48
|
+
|
|
49
|
+
Components are `.jsx` files (not `.tsx`) using PropTypes. They:
|
|
50
|
+
|
|
51
|
+
1. Use `React.forwardRef` to forward refs to the root HTML element.
|
|
52
|
+
2. Are wrapped with `withGlobalProps(Component, 'ComponentName')` for global prop
|
|
53
|
+
injection; the wrapped version is the default export.
|
|
54
|
+
3. Use `useContext` to detect layout/group contexts (`FormLayoutContext`,
|
|
55
|
+
`ButtonGroupContext`, `InputGroupContext`) and apply CSS class variants
|
|
56
|
+
accordingly.
|
|
57
|
+
4. Use the `classNames()` helper to conditionally combine CSS Module class names.
|
|
58
|
+
5. Use `transferProps()` to pass through non-React HTML attributes to the root
|
|
59
|
+
element.
|
|
60
|
+
|
|
61
|
+
Honour the [API Guidelines](../../src/docs/contribute/api.md) and
|
|
62
|
+
[Composition](../../src/docs/contribute/composition.md) when shaping props and
|
|
63
|
+
nesting.
|
|
64
|
+
|
|
65
|
+
## Styling
|
|
66
|
+
|
|
67
|
+
Component styles use SCSS with CSS Modules — see the [styling rule](styling.md).
|
|
68
|
+
|
|
69
|
+
## Tests
|
|
70
|
+
|
|
71
|
+
Components are covered by Jest unit tests and table-driven Playwright component
|
|
72
|
+
tests — see the [testing rule](testing.md).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Git
|
|
2
|
+
|
|
3
|
+
## Skills
|
|
4
|
+
|
|
5
|
+
Use `/commit` to commit changes.
|
|
6
|
+
|
|
7
|
+
## Conventions
|
|
8
|
+
|
|
9
|
+
Full rules are in [General Guidelines › Git Workflow](../../src/docs/contribute/general-guidelines.md#git-workflow).
|
|
10
|
+
|
|
11
|
+
## Reference
|
|
12
|
+
|
|
13
|
+
* [General Guidelines › Git Workflow](../../src/docs/contribute/general-guidelines.md#git-workflow)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Safety guards
|
|
2
|
+
|
|
3
|
+
* Never modify files listed in [.gitignore](../../.gitignore) unless approved
|
|
4
|
+
in a skill
|
|
5
|
+
* Never modify any files outside the project root
|
|
6
|
+
* Never run shell commands that can alter system state or access sensitive data
|
|
7
|
+
when run on the host system
|
|
8
|
+
* Never modify the git remote (e.g. `git push`) without explicit human approval
|
|
9
|
+
* Never introduce new dependencies without explicit human approval
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "src/**/*.scss"
|
|
4
|
+
- "src/**/*.css"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Styling
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
Run `npm run stylelint` after changes (add `-- --fix` to autofix).
|
|
12
|
+
|
|
13
|
+
## Styling
|
|
14
|
+
|
|
15
|
+
Styles use SCSS with CSS Modules (`.module.scss`) with camelCase class names. A
|
|
16
|
+
component's styles live next to it as `Foo.module.scss` and are imported as a
|
|
17
|
+
module.
|
|
18
|
+
|
|
19
|
+
Class naming convention:
|
|
20
|
+
|
|
21
|
+
* `root` for the root element.
|
|
22
|
+
* Modifiers follow `isRootXxx` (state), `hasRootXxx` (has feature),
|
|
23
|
+
`isRootInXxx` (context), `isRootLayoutXxx` (layout variant).
|
|
24
|
+
|
|
25
|
+
`src/styles/` contains the global theming system: settings (variables), tools
|
|
26
|
+
(mixins), and a large set of CSS custom properties for theming. Component SCSS
|
|
27
|
+
files `@use` their own `_settings`, `_theme`, `_tools` partials plus the shared
|
|
28
|
+
styles from `src/styles/`. Theme tokens are exposed as CSS custom properties.
|
|
29
|
+
|
|
30
|
+
## Reference
|
|
31
|
+
|
|
32
|
+
* [CSS Guidelines](../../src/docs/contribute/css.md)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.spec.tsx"
|
|
4
|
+
- "**/*.story.tsx"
|
|
5
|
+
- "**/__tests__/**"
|
|
6
|
+
- "tests/**"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Testing
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
* Run all Jest unit tests with `npm run test:jest` (TS + JS). For a single file:
|
|
14
|
+
`npm run test:jest:ts -- <file>` or `npm run test:jest:js -- <file>`.
|
|
15
|
+
* Run all Playwright component tests with `npm run test:playwright-ct:all`; for
|
|
16
|
+
one component, `npm run test:playwright-ct:all -- -- src/components/Button`.
|
|
17
|
+
* Update Playwright snapshots with `npm run test:playwright-ct:all-with-update`.
|
|
18
|
+
* Serve the report with `npm run test:playwright-ct:show-report`.
|
|
19
|
+
|
|
20
|
+
## Testing
|
|
21
|
+
|
|
22
|
+
Create/update tests for added or changed components and helpers, and remove
|
|
23
|
+
obsolete tests when functionality is removed. Never leave a component or helper
|
|
24
|
+
without tests. When fixing a bug, add a test that fails before the fix and
|
|
25
|
+
passes after it.
|
|
26
|
+
|
|
27
|
+
### Organization
|
|
28
|
+
|
|
29
|
+
Jest unit/component tests are co-located in a component's `__tests__/` folder.
|
|
30
|
+
|
|
31
|
+
### Playwright component tests
|
|
32
|
+
|
|
33
|
+
`.spec.tsx` specs use a table-driven pattern:
|
|
34
|
+
|
|
35
|
+
* Import arrays of test cases from `_propTests/` directories and from shared
|
|
36
|
+
`tests/playwright/propTests/`.
|
|
37
|
+
* Each test case is `{ name, props, onBeforeTest?, onBeforeSnapshot? }`; custom
|
|
38
|
+
field tests add `customFieldLayoutProps`, `customFieldProps`, etc.
|
|
39
|
+
* `mixPropTests([...arrays])` generates the cartesian product of multiple prop
|
|
40
|
+
arrays.
|
|
41
|
+
* `propTests` from `tests/playwright/` provides standard reusable test sets
|
|
42
|
+
(e.g. `layoutPropTest`, `sizePropTest`, `disabledPropTest`).
|
|
43
|
+
* Snapshot images are stored alongside the spec file in
|
|
44
|
+
`<ComponentName>.spec.tsx-snapshots/`.
|
|
45
|
+
|
|
46
|
+
**Story components** (`.story.tsx`) wrap the real component in a minimal fixture
|
|
47
|
+
(sometimes inside a context provider) and are imported only by `.spec.tsx`
|
|
48
|
+
files. Naming convention: `<ComponentName>ForTest`, `<ComponentName>ForRefTest`,
|
|
49
|
+
`<ComponentName>ForFormLayoutTests` — the FormLayout story component is always
|
|
50
|
+
last.
|
|
51
|
+
|
|
52
|
+
**Test describe structure:** `test.describe('ComponentName')` →
|
|
53
|
+
`test.describe('base')` (if present) → `visual` / `non-visual` /
|
|
54
|
+
`functionality`; the `formLayout` describe is always the last block at the same
|
|
55
|
+
level as `base`.
|
|
56
|
+
|
|
57
|
+
## Reference
|
|
58
|
+
|
|
59
|
+
* [Testing Guidelines](../../src/docs/contribute/testing-guidelines.md)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"permissions": {
|
|
4
|
+
"allow": [
|
|
5
|
+
"Bash(git diff:*)",
|
|
6
|
+
"Bash(git log:*)",
|
|
7
|
+
"Bash(git rev-parse:*)",
|
|
8
|
+
"Bash(git show:*)",
|
|
9
|
+
"Bash(git status:*)",
|
|
10
|
+
"Bash(npm audit)",
|
|
11
|
+
"Bash(npm audit signatures)",
|
|
12
|
+
"Bash(npm ci)",
|
|
13
|
+
"Bash(npm run build:*)",
|
|
14
|
+
"Bash(npm run lint)",
|
|
15
|
+
"Bash(npm run eslint:*)",
|
|
16
|
+
"Bash(npm run stylelint:*)",
|
|
17
|
+
"Bash(npm run markdownlint:*)",
|
|
18
|
+
"Bash(npm start)",
|
|
19
|
+
"Bash(npm run start:*)",
|
|
20
|
+
"Bash(npm test)",
|
|
21
|
+
"Bash(npm run test:jest:*)",
|
|
22
|
+
"Bash(npm run test:playwright-ct:*)"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"enabledMcpjsonServers": [
|
|
26
|
+
"chrome-host"
|
|
27
|
+
],
|
|
28
|
+
"enabledPlugins": {
|
|
29
|
+
"github@claude-plugins-official": true,
|
|
30
|
+
"context7@claude-plugins-official": true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Draft a commit message and commit staged changes, following the project git conventions
|
|
3
|
+
allowed-tools: Bash(git status), Bash(git diff:*), Bash(git log:*), Bash(git blame:*), Bash(git merge-base:*), Bash(git rev-parse:*), Bash(git add:*), Bash(git commit:*)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Commit
|
|
7
|
+
|
|
8
|
+
Draft a commit message and commit the staged changes, following the project's
|
|
9
|
+
git conventions.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
* You invoke this to commit staged work. User-only — never auto-invoked.
|
|
14
|
+
|
|
15
|
+
## Context
|
|
16
|
+
|
|
17
|
+
Status:
|
|
18
|
+
|
|
19
|
+
!`git status`
|
|
20
|
+
|
|
21
|
+
Staged diff:
|
|
22
|
+
|
|
23
|
+
!`git diff --staged`
|
|
24
|
+
|
|
25
|
+
Branch:
|
|
26
|
+
|
|
27
|
+
!`git rev-parse --abbrev-ref HEAD`
|
|
28
|
+
|
|
29
|
+
Branch commits since `master`:
|
|
30
|
+
|
|
31
|
+
!`git log master..HEAD --oneline 2>/dev/null | head -20`
|
|
32
|
+
|
|
33
|
+
## Steps
|
|
34
|
+
|
|
35
|
+
Each commit must be atomic and never leave the app broken.
|
|
36
|
+
|
|
37
|
+
If nothing is staged, stop and tell the user.
|
|
38
|
+
|
|
39
|
+
Before committing, check the following (see [Commands](../../../CLAUDE.md#commands)):
|
|
40
|
+
|
|
41
|
+
* `npm run build` passes
|
|
42
|
+
* `mkdocs build` passes
|
|
43
|
+
* `npm run lint` passes
|
|
44
|
+
* `npm run test:jest` passes
|
|
45
|
+
* `npm run test:playwright-ct:all` passes
|
|
46
|
+
|
|
47
|
+
Write a commit message for the staged changes following the project's git
|
|
48
|
+
conventions ([General Guidelines › Git Workflow](../../../src/docs/contribute/general-guidelines.md#git-workflow)):
|
|
49
|
+
|
|
50
|
+
Do not append `Co-Authored-By`.
|
|
51
|
+
|
|
52
|
+
## Reference
|
|
53
|
+
|
|
54
|
+
* [General Guidelines › Git Workflow](../../../src/docs/contribute/general-guidelines.md#git-workflow)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "React UI (${localWorkspaceFolderBasename})",
|
|
3
|
+
"initializeCommand": "bash ./setup.sh",
|
|
4
|
+
"dockerComposeFile": [
|
|
5
|
+
"../docker-compose.yml"
|
|
6
|
+
],
|
|
7
|
+
"service": "devcontainer",
|
|
8
|
+
"shutdownAction": "stopCompose",
|
|
9
|
+
"workspaceFolder": "/workspace",
|
|
10
|
+
"forwardPorts": [
|
|
11
|
+
"docs:8000"
|
|
12
|
+
],
|
|
13
|
+
"portsAttributes": {
|
|
14
|
+
"docs:8000": {
|
|
15
|
+
"label": "Docs server",
|
|
16
|
+
"protocol": "http",
|
|
17
|
+
"onAutoForward": "openBrowser"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"otherPortsAttributes": {
|
|
21
|
+
"onAutoForward": "ignore"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/.mcp.json
ADDED
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository
|
|
4
|
+
|
|
5
|
+
## Environment
|
|
6
|
+
|
|
7
|
+
This project is developed inside a Docker container called `devcontainer`.
|
|
8
|
+
The commands below assume you are running inside the `devcontainer`.
|
|
9
|
+
|
|
10
|
+
From the host, run them inside it with
|
|
11
|
+
`docker compose exec -T devcontainer <command>` (start it first with
|
|
12
|
+
`docker compose up -d`). The other service containers (`node`, `playwright`,
|
|
13
|
+
`docs`) are implementation details — do not call them directly.
|
|
14
|
+
|
|
15
|
+
If file `/.dockerenv` is present, you are in a Docker container.
|
|
16
|
+
|
|
17
|
+
For details, see the
|
|
18
|
+
[Contributing Guide](src/docs/contribute/general-guidelines.md#development-environment).
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
Run these inside the `devcontainer` (from the host, prefix with
|
|
23
|
+
`docker compose exec -T devcontainer`). For details, see the
|
|
24
|
+
[Contributing Guide](src/docs/contribute/general-guidelines.md).
|
|
25
|
+
|
|
26
|
+
| Task | Command |
|
|
27
|
+
|-----------------------------------|---------------------------------------------------------------------|
|
|
28
|
+
| Install JS | `npm ci` |
|
|
29
|
+
| Build library | `npm run build` |
|
|
30
|
+
| Run static checks | `npm run lint` |
|
|
31
|
+
| Run unit tests | `npm run test:jest` |
|
|
32
|
+
| Run a single unit test file | `npm run test:jest:ts -- <file>` / `npm run test:jest:js -- <file>` |
|
|
33
|
+
| Run component tests | `npm run test:playwright-ct:all` |
|
|
34
|
+
| Component tests for one component | `npm run test:playwright-ct:all -- -- src/components/Button` |
|
|
35
|
+
| Update component snapshots | `npm run test:playwright-ct:all-with-update` |
|
|
36
|
+
| Start build watcher | `npm start` |
|
|
37
|
+
| Build documentation | `mkdocs build` |
|
|
38
|
+
| Serve documentation | `mkdocs serve` |
|
|
39
|
+
|
|
40
|
+
Notes:
|
|
41
|
+
|
|
42
|
+
* Commands like `npm`, `playwright` run in specific Docker containers.
|
|
43
|
+
Normally, when you run those commands, they are executed within dedicated
|
|
44
|
+
containers. If you need to communicate directly with specific Docker container,
|
|
45
|
+
use `sudo docker compose ...`. It can be useful when stopping server that is
|
|
46
|
+
running within `node` container even though it is started from `devcontainer`.
|
|
47
|
+
* See the `scripts` section in `package.json` for the full list of commands.
|
|
48
|
+
|
|
49
|
+
## Topics (Claude Rules)
|
|
50
|
+
|
|
51
|
+
Project rules live in [.claude/rules/](.claude/rules/). There are two kinds.
|
|
52
|
+
|
|
53
|
+
**Always-on** (no frontmatter) — apply to every change:
|
|
54
|
+
|
|
55
|
+
* [code.md](.claude/rules/code.md) — scope discipline, minimal changes.
|
|
56
|
+
* [git.md](.claude/rules/git.md) — branches, commits, PRs.
|
|
57
|
+
* [safety-guards.md](.claude/rules/safety-guards.md) — hard guard rails.
|
|
58
|
+
|
|
59
|
+
**Path-scoped** — each carries a `paths:` glob declaring the files it governs;
|
|
60
|
+
consult it when touching those files:
|
|
61
|
+
|
|
62
|
+
* [frontend.md](.claude/rules/frontend.md) — `src/**/*.js`, `src/**/*.jsx`:
|
|
63
|
+
stack, component structure, implementation pattern.
|
|
64
|
+
* [styling.md](.claude/rules/styling.md) — `src/**/*.scss`, `src/**/*.css`:
|
|
65
|
+
CSS Modules, class naming, theming.
|
|
66
|
+
* [testing.md](.claude/rules/testing.md) — `*.spec.tsx`, `*.story.tsx`,
|
|
67
|
+
`__tests__/**`, `tests/**`: Jest and table-driven Playwright tests.
|
|
68
|
+
* [docs.md](.claude/rules/docs.md) — `src/docs/**`, component `README.md`.
|
|
69
|
+
|
|
70
|
+
## Agents (Claude Agents)
|
|
71
|
+
|
|
72
|
+
Specialized agents live in [.claude/agents/](.claude/agents/).
|
|
73
|
+
|
|
74
|
+
* `code-reviewer` — review a change against this repo's rules (uncommitted work,
|
|
75
|
+
or a whole branch vs its base).
|
|
76
|
+
|
|
77
|
+
## AI Integration
|
|
78
|
+
|
|
79
|
+
MCP-capable assistants in the `devcontainer` can drive host Chrome to verify the
|
|
80
|
+
docs site and rendered components. See
|
|
81
|
+
[AI Integration](src/docs/contribute/ai-integration.md) and
|
|
82
|
+
[scripts/mcps/chrome-host/README.md](scripts/mcps/chrome-host/README.md).
|