@spark-web/design-system 5.1.3 → 5.1.5
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.md +38 -192
- package/package.json +20 -21
- package/patterns/CLAUDE.md +75 -35
- package/patterns/internal-admin/CLAUDE.md +7 -19
- package/patterns/internal-admin/{details-page.md → detail-page.md} +114 -51
- package/patterns/internal-admin/list-page.md +199 -137
- package/patterns/internal-admin/portal-hub.md +165 -0
- package/patterns/vendor-admin/CLAUDE.md +216 -0
- package/patterns/vendor-admin/dashboard.md +681 -0
- package/patterns/vendor-admin/form-page.md +504 -0
- package/patterns/vendor-admin/list-page.md +709 -0
- package/patterns/vendor-admin/vendor-portal.md +309 -0
- package/ai-context/layer-1-root.md +0 -158
- package/ai-context/layer-2-surface-pattern.md +0 -236
- package/ai-context/layer-3-component.md +0 -271
package/CLAUDE.md
CHANGED
|
@@ -3,41 +3,6 @@
|
|
|
3
3
|
This file provides guidance to Claude Code (claude.ai/code) when working with
|
|
4
4
|
code in this repository.
|
|
5
5
|
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
Spark Web is the Brighte Design System — a React component library organized as
|
|
9
|
-
a Yarn monorepo (~50 packages). It uses Preconstruct for bundling, Emotion for
|
|
10
|
-
CSS-in-JS, and Changesets for versioning.
|
|
11
|
-
|
|
12
|
-
## Common Commands
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Development
|
|
16
|
-
yarn dev # Run docs, playroom, and storybook concurrently
|
|
17
|
-
yarn dev:storybook # Storybook only (port 6006)
|
|
18
|
-
yarn dev:docs # Next.js docs site only
|
|
19
|
-
yarn dev:playroom # Playroom only
|
|
20
|
-
|
|
21
|
-
# Testing
|
|
22
|
-
yarn test:unit # Run all Jest tests
|
|
23
|
-
yarn test:unit -- --testPathPatterns=packages/alert # Run tests for a specific package
|
|
24
|
-
yarn check # Run format + lint + package + type checks
|
|
25
|
-
|
|
26
|
-
# Linting & Formatting
|
|
27
|
-
yarn check:lint # ESLint check
|
|
28
|
-
yarn fix:lint # ESLint autofix
|
|
29
|
-
yarn check:format # Prettier check
|
|
30
|
-
yarn fix:format # Prettier autoformat
|
|
31
|
-
|
|
32
|
-
# Build
|
|
33
|
-
yarn build:packages # Build all packages via Preconstruct
|
|
34
|
-
yarn build:docs # Build docs site
|
|
35
|
-
|
|
36
|
-
# Package management
|
|
37
|
-
yarn new:package # Scaffold a new component package via Plop
|
|
38
|
-
yarn release # Build + publish to npm (CI only)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
6
|
## How to approach any build task
|
|
42
7
|
|
|
43
8
|
When given any build task — whether a PRD, a feature description, or a prompt —
|
|
@@ -46,68 +11,54 @@ ask for clarification before completing step 1.
|
|
|
46
11
|
|
|
47
12
|
### Step 1 — Classify the surface
|
|
48
13
|
|
|
49
|
-
Read node_modules/@spark-web/design-system/patterns/CLAUDE.md in full
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
admin
|
|
54
|
-
- "vendor portal", "vendor", "accreditation", "installer" → Vendor portal (not
|
|
55
|
-
yet defined — flag to team)
|
|
56
|
-
- "website", "marketing", "landing page", "public" → Website (not yet defined —
|
|
57
|
-
flag to team)
|
|
58
|
-
- "mobile", "app", "iOS", "Android" → Mobile app (not yet defined — flag to
|
|
59
|
-
team)
|
|
60
|
-
|
|
61
|
-
If the surface cannot be determined from the PRD, flag it and ask before
|
|
62
|
-
proceeding. Do not assume.
|
|
14
|
+
Read `node_modules/@spark-web/design-system/patterns/CLAUDE.md` in full and
|
|
15
|
+
classify the surface using its signal table. That file is the single source of
|
|
16
|
+
truth for which surfaces exist. If the surface cannot be determined, flag it and
|
|
17
|
+
ask before proceeding. Do not assume.
|
|
63
18
|
|
|
64
19
|
### Step 2 — Read the surface rules
|
|
65
20
|
|
|
66
|
-
Read the surface rules file for the classified surface.
|
|
67
|
-
|
|
68
|
-
Surface rules take
|
|
21
|
+
Read the surface rules file for the classified surface. Read, in full, the rules
|
|
22
|
+
file at the location given in the registry's Step 2 table
|
|
23
|
+
(`node_modules/@spark-web/design-system/patterns/CLAUDE.md`). Surface rules take
|
|
24
|
+
precedence over all component rules.
|
|
69
25
|
|
|
70
26
|
If the surface is not yet defined, flag it to the team and do not proceed with
|
|
71
27
|
building until the surface rules exist.
|
|
72
28
|
|
|
73
29
|
### Step 3 — Identify the feature type and read the pattern file
|
|
74
30
|
|
|
75
|
-
Match the task to a pattern file
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
node_modules/@spark-web/design-system/patterns/internal-admin/form-page.md
|
|
81
|
-
(not yet defined)
|
|
82
|
-
- Record detail, view details, drill down →
|
|
83
|
-
node_modules/@spark-web/design-system/patterns/internal-admin/detail-page.md
|
|
84
|
-
(not yet defined)
|
|
85
|
-
|
|
86
|
-
Read the pattern file in full. It defines which components to assemble, in what
|
|
87
|
-
order, and with what rules. Follow it exactly.
|
|
88
|
-
|
|
89
|
-
If no pattern file exists for the feature type, use the surface rules and
|
|
90
|
-
component documentation to make the best decision, then flag that a pattern file
|
|
91
|
-
should be created for this feature type before the next similar build.
|
|
31
|
+
Match the task to a pattern file using the feature-type table in
|
|
32
|
+
`node_modules/@spark-web/design-system/patterns/CLAUDE.md` (Step 3). Read the
|
|
33
|
+
pattern file in full and follow it exactly. If no pattern exists for the feature
|
|
34
|
+
type, use the surface rules and component documentation to make the best
|
|
35
|
+
decision, then flag that a pattern file should be created.
|
|
92
36
|
|
|
93
37
|
### Step 4 — Read the relevant component CLAUDE.md files
|
|
94
38
|
|
|
95
39
|
Only read the components the pattern file tells you to use. Do not read all
|
|
96
|
-
component files — only the ones needed for this specific feature.
|
|
40
|
+
component files — only the ones needed for this specific feature. For each named
|
|
41
|
+
component doc you MUST read its **props/API**, **composition rules**, **usage
|
|
42
|
+
examples**, and **anti-patterns (Do NOTs)** — these hold the load-bearing rules
|
|
43
|
+
and the canonical code to copy. You MAY defer the narrative overview ('What this
|
|
44
|
+
is' / 'What this is NOT') and the 'Token usage' prose, reading them only if a
|
|
45
|
+
prop value or example is unclear. Component docs are short — when in doubt, read
|
|
46
|
+
the whole file.
|
|
97
47
|
|
|
98
|
-
### Step 5 —
|
|
48
|
+
### Step 5 — Usage examples
|
|
99
49
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
50
|
+
The usage examples in each component CLAUDE.md are canonical. If (and only if)
|
|
51
|
+
you are working inside the spark-web monorepo itself, you may also read
|
|
52
|
+
`packages/[component]/src/*.stories.tsx` — stories are not published to npm and
|
|
53
|
+
do not exist in consumer repos.
|
|
103
54
|
|
|
104
55
|
### Step 6 — Assemble, do not invent
|
|
105
56
|
|
|
106
|
-
Use only
|
|
57
|
+
Use only published `@spark-web/*` packages. Do not build custom components or
|
|
107
58
|
apply custom styling outside of the documented exceptions in each component
|
|
108
59
|
CLAUDE.md.
|
|
109
60
|
|
|
110
|
-
If a feature requires something that
|
|
61
|
+
If a feature requires something that has no published `@spark-web/*` package:
|
|
111
62
|
|
|
112
63
|
- Use the closest available Spark primitive as a placeholder
|
|
113
64
|
- Add a comment in the generated code: // COMPONENT GAP: [ComponentName] needed
|
|
@@ -154,121 +105,16 @@ listing which failures are structural versus prop-level.
|
|
|
154
105
|
|
|
155
106
|
## Architecture
|
|
156
107
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
- `packages/` — ~50 component packages, each published as `@spark-web/{name}`
|
|
164
|
-
- `docs/` — Next.js documentation site with Storybook, Playroom, and
|
|
165
|
-
Contentlayer
|
|
166
|
-
- `examples/` — Reference Next.js apps (example-site, preapprovals)
|
|
167
|
-
- `scripts/` + `plop-templates/` — Package scaffolding
|
|
168
|
-
|
|
169
|
-
### Dependency Layers
|
|
170
|
-
|
|
171
|
-
**Foundation** (no internal deps): `utils`, `theme`, `ssr`
|
|
172
|
-
|
|
173
|
-
**Core components**: `a11y`, `box`, `text`, `icon` — depend on foundation
|
|
174
|
-
|
|
175
|
-
**Composition layer**: Layout (`stack`, `row`, `columns`, `container`,
|
|
176
|
-
`inline`), form inputs, complex components — compose from core
|
|
177
|
-
|
|
178
|
-
**Integration**: `next-utils`, `design-system` (barrel re-export of all
|
|
179
|
-
packages)
|
|
180
|
-
|
|
181
|
-
### Component Package Structure
|
|
182
|
-
|
|
183
|
-
Each package under `packages/{name}/src/` typically contains:
|
|
184
|
-
|
|
185
|
-
- `{ComponentName}.tsx` — Main component
|
|
186
|
-
- `{component-name}.stories.tsx` — Storybook stories
|
|
187
|
-
- `{component-name}.test.tsx` — Jest + Testing Library unit tests
|
|
188
|
-
- `types.ts` — Shared type definitions
|
|
189
|
-
- `index.ts` — Public exports
|
|
190
|
-
|
|
191
|
-
Preconstruct generates dual CJS/ESM bundles in `dist/`.
|
|
192
|
-
|
|
193
|
-
### Styling
|
|
194
|
-
|
|
195
|
-
All styling uses Emotion (CSS-in-JS). Components access the design token system
|
|
196
|
-
via `useTheme()` from `@spark-web/theme`. The theme provides color tones
|
|
197
|
-
(primary, secondary, positive, caution, critical, info), typography scales, and
|
|
198
|
-
spacing utilities. Never use raw CSS values — always use theme tokens.
|
|
199
|
-
|
|
200
|
-
### Key Patterns
|
|
201
|
-
|
|
202
|
-
- **Composition**: Components are built by composing smaller components (Box,
|
|
203
|
-
Text, Icon, Row, Stack)
|
|
204
|
-
- **Responsive**: Use theme utilities and Facepaint for responsive styles — not
|
|
205
|
-
media query literals
|
|
206
|
-
- **Accessibility**: All components include proper ARIA attributes; use
|
|
207
|
-
`@spark-web/a11y` utilities
|
|
208
|
-
- **`data` prop**: Components support a `data` prop for test selectors and
|
|
209
|
-
analytics
|
|
210
|
-
- **TypeScript discriminated unions**: Used for related props that must appear
|
|
211
|
-
together (e.g., `onClose` requires `closeLabel`)
|
|
212
|
-
- **`forwardRef`**: Used on all interactive/DOM-exposed components
|
|
213
|
-
|
|
214
|
-
### Releases
|
|
215
|
-
|
|
216
|
-
Changesets manages versioning. To add a changeset for your PR: `yarn changeset`.
|
|
217
|
-
Snapshot releases can be triggered on a PR by commenting `/snapit`.
|
|
218
|
-
|
|
219
|
-
### Pattern library
|
|
220
|
-
|
|
221
|
-
Agent pattern and surface rules live in
|
|
222
|
-
`node_modules/@spark-web/design-system/patterns/`. Always read
|
|
223
|
-
`node_modules/@spark-web/design-system/patterns/CLAUDE.md` before any build
|
|
224
|
-
task.
|
|
225
|
-
|
|
226
|
-
## New packages (in progress)
|
|
227
|
-
|
|
228
|
-
### data-table
|
|
229
|
-
|
|
230
|
-
TanStack Table v8-based table. See node_modules/@spark-web/data-table/CLAUDE.md
|
|
231
|
-
before writing any code using this package. Exports a single `DataTable`
|
|
232
|
-
component — not composable sub-components.
|
|
233
|
-
|
|
234
|
-
Key rules:
|
|
235
|
-
|
|
236
|
-
- Single `DataTable` component, not composable sub-components
|
|
237
|
-
- Use `createColumnHelper` from this package for type-safe column defs
|
|
238
|
-
- Pagination handled externally — never put pagination inside DataTable
|
|
239
|
-
- All values from useTheme() tokens — never raw hex, px, or Tailwind
|
|
240
|
-
|
|
241
|
-
### meatball-menu
|
|
242
|
-
|
|
243
|
-
Three-dot dropdown for 2+ record-level actions. See
|
|
244
|
-
node_modules/@spark-web/meatball-menu/CLAUDE.md. Usage rules:
|
|
245
|
-
node_modules/@spark-web/design-system/patterns/internal-admin/CLAUDE.md.
|
|
246
|
-
|
|
247
|
-
### section-header
|
|
248
|
-
|
|
249
|
-
Section-level heading bar with optional action. See
|
|
250
|
-
node_modules/@spark-web/section-header/CLAUDE.md. Depends on:
|
|
251
|
-
@spark-web/status-badge, @spark-web/meatball-menu.
|
|
252
|
-
|
|
253
|
-
### status-badge
|
|
254
|
-
|
|
255
|
-
Standalone label pill with colored background and optional icon. No dot. See
|
|
256
|
-
node_modules/@spark-web/status-badge/CLAUDE.md. Tones: accent, positive,
|
|
257
|
-
caution, critical, info, neutral. Only used in PageHeader and SectionHeader via
|
|
258
|
-
their `statusBadge` prop — never in table status columns. Use @spark-web/badge
|
|
259
|
-
for table status columns and any dot+label pattern.
|
|
260
|
-
|
|
261
|
-
### base-edit-modal
|
|
262
|
-
|
|
263
|
-
Reusable modal shell for all edit and action modals. Pinned header + scrollable
|
|
264
|
-
body + pinned footer. Depends on: @spark-web/modal-dialog. Never pass
|
|
265
|
-
scrollable={false}. Never use control as a prop.
|
|
108
|
+
Repo architecture, dependency layers, styling tokens, and key patterns live in
|
|
109
|
+
the repo-root CLAUDE.md. Pattern and surface rules live under
|
|
110
|
+
`node_modules/@spark-web/design-system/patterns/` — reached via "How to approach
|
|
111
|
+
any build task" above; always follow that sequence, never jump straight to
|
|
112
|
+
component docs.
|
|
266
113
|
|
|
267
|
-
|
|
114
|
+
## Component quick-reference
|
|
268
115
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
JSX children.
|
|
116
|
+
Component rules live in each package's own CLAUDE.md (component-level docs).
|
|
117
|
+
Read them via `node_modules/@spark-web/[name]/CLAUDE.md`. Notable packages whose
|
|
118
|
+
rules are frequently needed on admin surfaces: data-table, meatball-menu,
|
|
119
|
+
section-header, status-badge, page-header, action-dropdown, portal-table, badge.
|
|
120
|
+
Never rely on this file for component-level rules.
|
package/package.json
CHANGED
|
@@ -1,67 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/design-system",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/spark-web-design-system.cjs.js",
|
|
6
6
|
"module": "dist/spark-web-design-system.esm.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"CLAUDE.md",
|
|
9
|
-
"ai-context",
|
|
10
9
|
"patterns",
|
|
11
10
|
"dist"
|
|
12
11
|
],
|
|
13
12
|
"dependencies": {
|
|
14
|
-
"@spark-web/a11y": "5.3.
|
|
13
|
+
"@spark-web/a11y": "5.3.1",
|
|
15
14
|
"@spark-web/accordion": "5.2.0",
|
|
16
|
-
"@spark-web/action-dropdown": "2.0.
|
|
17
|
-
"@spark-web/alert": "5.2.
|
|
15
|
+
"@spark-web/action-dropdown": "2.0.2",
|
|
16
|
+
"@spark-web/alert": "5.2.1",
|
|
18
17
|
"@spark-web/analytics": "5.1.0",
|
|
19
18
|
"@spark-web/badge": "^5.1.1",
|
|
20
19
|
"@spark-web/box": "6.0.1",
|
|
21
20
|
"@spark-web/button": "5.6.1",
|
|
22
|
-
"@spark-web/checkbox": "5.1.
|
|
21
|
+
"@spark-web/checkbox": "5.1.2",
|
|
23
22
|
"@spark-web/columns": "5.1.1",
|
|
24
|
-
"@spark-web/combobox": "6.
|
|
25
|
-
"@spark-web/container": "5.1.
|
|
23
|
+
"@spark-web/combobox": "6.1.0",
|
|
24
|
+
"@spark-web/container": "5.1.1",
|
|
26
25
|
"@spark-web/control-label": "5.1.0",
|
|
27
26
|
"@spark-web/core": "5.2.0",
|
|
28
|
-
"@spark-web/currency-input": "6.0.
|
|
29
|
-
"@spark-web/data-table": "5.2.
|
|
30
|
-
"@spark-web/date-picker": "5.2.
|
|
27
|
+
"@spark-web/currency-input": "6.0.1",
|
|
28
|
+
"@spark-web/data-table": "5.2.3",
|
|
29
|
+
"@spark-web/date-picker": "5.2.1",
|
|
31
30
|
"@spark-web/description-list": "0.1.0",
|
|
32
|
-
"@spark-web/divider": "5.1.
|
|
31
|
+
"@spark-web/divider": "5.1.1",
|
|
33
32
|
"@spark-web/dropzone": "6.0.0",
|
|
34
33
|
"@spark-web/field": "5.3.2",
|
|
35
34
|
"@spark-web/fieldset": "5.1.0",
|
|
36
35
|
"@spark-web/float-input": "6.0.0",
|
|
37
|
-
"@spark-web/heading": "5.2.
|
|
36
|
+
"@spark-web/heading": "5.2.1",
|
|
38
37
|
"@spark-web/hidden": "5.1.0",
|
|
39
38
|
"@spark-web/highlight-card": "0.1.0",
|
|
40
|
-
"@spark-web/icon": "5.1.
|
|
39
|
+
"@spark-web/icon": "5.1.1",
|
|
41
40
|
"@spark-web/inline": "5.1.0",
|
|
42
41
|
"@spark-web/link": "5.1.0",
|
|
43
42
|
"@spark-web/meatball-menu": "0.1.0",
|
|
44
|
-
"@spark-web/modal-dialog": "6.0.
|
|
45
|
-
"@spark-web/multi-select": "6.0.
|
|
43
|
+
"@spark-web/modal-dialog": "6.0.3",
|
|
44
|
+
"@spark-web/multi-select": "6.0.2",
|
|
46
45
|
"@spark-web/nav-link": "5.1.0",
|
|
47
46
|
"@spark-web/next-utils": "5.1.0",
|
|
48
47
|
"@spark-web/page-header": "1.0.0",
|
|
49
48
|
"@spark-web/password-input": "6.0.0",
|
|
50
|
-
"@spark-web/portal-table": "^1.0.
|
|
49
|
+
"@spark-web/portal-table": "^1.0.1",
|
|
51
50
|
"@spark-web/radio": "5.3.1",
|
|
52
51
|
"@spark-web/row": "5.1.1",
|
|
53
52
|
"@spark-web/section-card": "0.1.0",
|
|
54
|
-
"@spark-web/section-header": "0.1.
|
|
53
|
+
"@spark-web/section-header": "0.1.1",
|
|
55
54
|
"@spark-web/select": "6.0.2",
|
|
56
55
|
"@spark-web/spinner": "5.1.1",
|
|
57
56
|
"@spark-web/ssr": "5.0.0",
|
|
58
57
|
"@spark-web/stack": "5.1.1",
|
|
59
58
|
"@spark-web/status-badge": "0.1.0",
|
|
60
59
|
"@spark-web/switch": "5.0.3",
|
|
61
|
-
"@spark-web/tabs": "5.2.
|
|
60
|
+
"@spark-web/tabs": "5.2.2",
|
|
62
61
|
"@spark-web/text": "5.3.1",
|
|
63
|
-
"@spark-web/text-area": "6.0.
|
|
64
|
-
"@spark-web/text-input": "6.0.
|
|
62
|
+
"@spark-web/text-area": "6.0.2",
|
|
63
|
+
"@spark-web/text-input": "6.0.3",
|
|
65
64
|
"@spark-web/text-link": "5.4.0",
|
|
66
65
|
"@spark-web/text-list": "5.1.0",
|
|
67
66
|
"@spark-web/theme": "5.13.2",
|
package/patterns/CLAUDE.md
CHANGED
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
# Pattern library — surface classifier
|
|
1
|
+
# Pattern library — surface registry and classifier
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
This file is the SINGLE SOURCE OF TRUTH for which surfaces exist, how to
|
|
4
|
+
classify a task into a surface, and which pattern file to read for a feature
|
|
5
|
+
type. Other documents must link here — never copy these tables.
|
|
6
|
+
|
|
7
|
+
When an agent receives a PRD or feature brief, it must read this file first,
|
|
8
|
+
before any component or pattern documentation.
|
|
5
9
|
|
|
6
10
|
---
|
|
7
11
|
|
|
8
12
|
## Step 1 — Identify the surface
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
The design system supports exactly three surfaces:
|
|
15
|
+
|
|
16
|
+
| Signal in PRD | Surface | Status |
|
|
17
|
+
| -------------------------------------------------------------------------------- | -------------- | --------- |
|
|
18
|
+
| "admin", "admin portal", "internal", "back office", "ops", "manage", "dashboard" | internal-admin | Defined |
|
|
19
|
+
| "vendor", "vendor portal", "accreditation", "installer", "partner" | vendor-admin | Defined |
|
|
20
|
+
| "website", "marketing", "landing page", "public", "brighte.com.au" | website | (planned) |
|
|
11
21
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| "mobile", "app", "iOS", "Android" | Mobile app (not yet defined) |
|
|
22
|
+
Classify by who uses the screen, not by which words appear most: internal
|
|
23
|
+
Brighte staff operating the business → internal-admin; vendors/installers
|
|
24
|
+
signing in to manage their own work → vendor-admin; unauthenticated public
|
|
25
|
+
visitors → website. If signals from more than one row match and the audience is
|
|
26
|
+
unclear, ask for clarification — never pick a surface by signal count.
|
|
18
27
|
|
|
19
28
|
If the surface cannot be determined from the PRD, ask for clarification before
|
|
20
|
-
proceeding. Do not assume.
|
|
29
|
+
proceeding. Do not assume. If a PRD matches a surface marked (planned), flag to
|
|
30
|
+
the team that the surface rules do not exist yet and do not proceed with
|
|
31
|
+
building until they do.
|
|
21
32
|
|
|
22
33
|
---
|
|
23
34
|
|
|
24
35
|
## Step 2 — Read the rules for that surface
|
|
25
36
|
|
|
26
|
-
| Surface
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
| Mobile app | Not yet defined — flag to the team |
|
|
37
|
+
| Surface | Rules location |
|
|
38
|
+
| -------------- | ------------------------------------------------------------------------- |
|
|
39
|
+
| internal-admin | `node_modules/@spark-web/design-system/patterns/internal-admin/CLAUDE.md` |
|
|
40
|
+
| vendor-admin | `node_modules/@spark-web/design-system/patterns/vendor-admin/CLAUDE.md` |
|
|
41
|
+
| website | (planned) — flag to the team |
|
|
32
42
|
|
|
33
43
|
Read the surface rules file in full before reading any component documentation.
|
|
34
44
|
Surface rules take precedence over component rules.
|
|
@@ -37,14 +47,25 @@ Surface rules take precedence over component rules.
|
|
|
37
47
|
|
|
38
48
|
## Step 3 — Read the pattern for the feature type
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
Use the table for the surface you classified in Step 1.
|
|
51
|
+
|
|
52
|
+
### internal-admin
|
|
53
|
+
|
|
54
|
+
| Feature type | Pattern file |
|
|
55
|
+
| ---------------------------- | -------------------------------------------------------------------------------------- |
|
|
56
|
+
| List of records with actions | `node_modules/@spark-web/design-system/patterns/internal-admin/list-page.md` |
|
|
57
|
+
| Record detail view | `node_modules/@spark-web/design-system/patterns/internal-admin/detail-page.md` |
|
|
58
|
+
| Create or edit a record | `node_modules/@spark-web/design-system/patterns/internal-admin/form-page.md` (planned) |
|
|
42
59
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
60
|
+
### vendor-admin
|
|
61
|
+
|
|
62
|
+
| Feature type | Pattern file |
|
|
63
|
+
| ------------------------------------ | -------------------------------------------------------------------------- |
|
|
64
|
+
| Vendor list of records with actions | `node_modules/@spark-web/design-system/patterns/vendor-admin/list-page.md` |
|
|
65
|
+
| Vendor create / edit / settings form | `node_modules/@spark-web/design-system/patterns/vendor-admin/form-page.md` |
|
|
66
|
+
| Vendor record detail view | (planned) |
|
|
67
|
+
| Vendor dashboard | `node_modules/@spark-web/design-system/patterns/vendor-admin/dashboard.md` |
|
|
68
|
+
| Vendor tabbed screen | (planned) |
|
|
48
69
|
|
|
49
70
|
If no pattern file exists yet for the feature type, use the surface rules and
|
|
50
71
|
component documentation to make the best decision, and flag that a pattern file
|
|
@@ -52,16 +73,35 @@ should be created for this feature type.
|
|
|
52
73
|
|
|
53
74
|
---
|
|
54
75
|
|
|
76
|
+
## Consumer overlays
|
|
77
|
+
|
|
78
|
+
Pattern files describe the design-system-canonical implementation using
|
|
79
|
+
`@spark-web/*` components only. Where a specific consuming repo must substitute
|
|
80
|
+
a local component (legacy constraints), that substitution lives in a
|
|
81
|
+
per-consumer overlay file in the surface directory, named after the consumer —
|
|
82
|
+
e.g.
|
|
83
|
+
`node_modules/@spark-web/design-system/patterns/internal-admin/portal-hub.md`
|
|
84
|
+
for portal-hub on internal-admin, and
|
|
85
|
+
`node_modules/@spark-web/design-system/patterns/vendor-admin/vendor-portal.md`
|
|
86
|
+
for vendor-portal on vendor-admin.
|
|
87
|
+
|
|
88
|
+
Reading rule: after reading a pattern file, check the surface directory for an
|
|
89
|
+
overlay matching the repo you are working in and apply its substitutions. An
|
|
90
|
+
overlay overrides the pattern only where it explicitly says so.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
55
94
|
## Reading order for any build task
|
|
56
95
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
96
|
+
Full reading order (including how to read component docs): see
|
|
97
|
+
`node_modules/@spark-web/design-system/CLAUDE.md`. This file owns the Step 1-3
|
|
98
|
+
classification tables above. Pattern files are decision trees — always read them
|
|
99
|
+
in full.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Maintaining this file
|
|
104
|
+
|
|
105
|
+
When a surface or pattern file is added, renamed, or removed under `patterns/`,
|
|
106
|
+
update the tables above in the same commit. `yarn check:agent-docs` fails CI if
|
|
107
|
+
these tables and the filesystem disagree.
|
|
@@ -29,14 +29,10 @@ Hover state is determined entirely by whether the row is clickable:
|
|
|
29
29
|
trigger)
|
|
30
30
|
- Row is not clickable → hover state is never applied, no exceptions
|
|
31
31
|
|
|
32
|
-
Never apply a hover state to a non-clickable row. It implies interactivity that
|
|
33
|
-
does not exist and misleads the user.
|
|
34
|
-
|
|
35
32
|
When a clickable row contains a MeatballMenu, the row hover must be suppressed
|
|
36
|
-
while the cursor is over the meatball button.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
exact pattern.
|
|
33
|
+
while the cursor is over the meatball button. DataTable implements this
|
|
34
|
+
automatically when `enableClickableRow` is set — see `@spark-web/data-table`
|
|
35
|
+
CLAUDE.md.
|
|
40
36
|
|
|
41
37
|
---
|
|
42
38
|
|
|
@@ -58,9 +54,7 @@ Does the row have actions?
|
|
|
58
54
|
2+ actions → always overflow menu
|
|
59
55
|
```
|
|
60
56
|
|
|
61
|
-
Never place inline action buttons alongside a clickable row.
|
|
62
|
-
inline buttons create two competing interaction targets and confuse the user
|
|
63
|
-
about what clicking does.
|
|
57
|
+
Never place inline action buttons alongside a clickable row.
|
|
64
58
|
|
|
65
59
|
---
|
|
66
60
|
|
|
@@ -115,12 +109,6 @@ Spark Web theme.
|
|
|
115
109
|
|
|
116
110
|
When a new pattern or component is added to the internal admin surface, update
|
|
117
111
|
this file with any new interaction rules that apply globally. Do not duplicate
|
|
118
|
-
rules that already exist here in component-level CLAUDE.md files.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## Pattern library
|
|
123
|
-
|
|
124
|
-
Agent pattern and surface rules live in
|
|
125
|
-
node_modules/@spark-web/design-system/patterns/. Always read
|
|
126
|
-
node_modules/@spark-web/design-system/patterns/CLAUDE.md before any build task.
|
|
112
|
+
rules that already exist here in component-level CLAUDE.md files. If a new
|
|
113
|
+
pattern file is added, also update the feature-type table in
|
|
114
|
+
`node_modules/@spark-web/design-system/patterns/CLAUDE.md` in the same commit.
|