@spark-web/design-system 5.0.99 → 5.1.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.
@@ -0,0 +1,67 @@
1
+ # Pattern library — surface classifier
2
+
3
+ When an agent receives a PRD or feature brief, it must read this file first
4
+ before reading any component or pattern documentation.
5
+
6
+ ---
7
+
8
+ ## Step 1 — Identify the surface
9
+
10
+ Determine which surface is being built by reading the PRD for these signals:
11
+
12
+ | Signal in PRD | Surface |
13
+ | ---------------------------------------------------------------- | --------------------------------- |
14
+ | "admin", "internal", "back office", "ops", "manage", "dashboard" | Internal admin |
15
+ | "customer", "portal", "my account", "self-service" | Customer portal (not yet defined) |
16
+ | "website", "marketing", "landing page", "public" | Website (not yet defined) |
17
+ | "mobile", "app", "iOS", "Android" | Mobile app (not yet defined) |
18
+
19
+ If the surface cannot be determined from the PRD, ask for clarification before
20
+ proceeding. Do not assume.
21
+
22
+ ---
23
+
24
+ ## Step 2 — Read the rules for that surface
25
+
26
+ | Surface | Rules location |
27
+ | --------------- | ------------------------------------------------------------------------- |
28
+ | Internal admin | `node_modules/@spark-web/design-system/patterns/internal-admin/CLAUDE.md` |
29
+ | Customer portal | Not yet defined — flag to the team |
30
+ | Website | Not yet defined — flag to the team |
31
+ | Mobile app | Not yet defined — flag to the team |
32
+
33
+ Read the surface rules file in full before reading any component documentation.
34
+ Surface rules take precedence over component rules.
35
+
36
+ ---
37
+
38
+ ## Step 3 — Read the pattern for the feature type
39
+
40
+ After reading surface rules, identify the feature type and read the
41
+ corresponding pattern file:
42
+
43
+ | Feature type | Pattern file |
44
+ | ---------------------------- | -------------------------------------------------------------------------------------------- |
45
+ | List of records with actions | `node_modules/@spark-web/design-system/patterns/internal-admin/list-page.md` |
46
+ | Create or edit a record | `node_modules/@spark-web/design-system/patterns/internal-admin/form-page.md` (coming soon) |
47
+ | Record detail view | `node_modules/@spark-web/design-system/patterns/internal-admin/detail-page.md` (coming soon) |
48
+
49
+ If no pattern file exists yet for the feature type, use the surface rules and
50
+ component documentation to make the best decision, and flag that a pattern file
51
+ should be created for this feature type.
52
+
53
+ ---
54
+
55
+ ## Reading order for any build task
56
+
57
+ 1. `node_modules/@spark-web/design-system/patterns/CLAUDE.md` ← this file
58
+ (surface classifier)
59
+ 2. `node_modules/@spark-web/design-system/patterns/[surface]/CLAUDE.md` ←
60
+ surface interaction rules
61
+ 3. `node_modules/@spark-web/design-system/patterns/[surface]/[pattern].md` ←
62
+ feature pattern (if exists)
63
+ 4. `node_modules/@spark-web/[component]/CLAUDE.md` ← component rules
64
+ 5. `node_modules/@spark-web/[component]/src/[component].stories.tsx` ← usage
65
+ examples
66
+
67
+ Never skip steps. Never read component documentation before surface rules.
@@ -0,0 +1,126 @@
1
+ # Internal admin — interaction and pattern rules
2
+
3
+ These rules apply to all components and patterns built for internal admin
4
+ surfaces. They sit above individual component rules. When a conflict exists
5
+ between these rules and a component-level CLAUDE.md, these rules take precedence
6
+ for admin surfaces.
7
+
8
+ ---
9
+
10
+ ## Row interaction rules
11
+
12
+ ### Clickable rows
13
+
14
+ A row is clickable when the data model has a record-level detail view or
15
+ destination page. The agent must determine this from the PRD:
16
+
17
+ - If the PRD describes a detail page, record view, or drill-down → row is
18
+ clickable
19
+ - If the PRD describes a read-only data display with no record destination → row
20
+ is not clickable
21
+ - If unsure, default to clickable
22
+
23
+ ### Hover state
24
+
25
+ Hover state is determined entirely by whether the row is clickable:
26
+
27
+ - Row is clickable → hover state is applied when the cursor is over the row,
28
+ **except** when hovering a button within the row (e.g. the MeatballMenu
29
+ trigger)
30
+ - Row is not clickable → hover state is never applied, no exceptions
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
+ When a clickable row contains a MeatballMenu, the row hover must be suppressed
36
+ while the cursor is over the meatball button. Two competing hover targets (row
37
+ and menu trigger) confuse the user about what will happen on click. Implement
38
+ using CSS `:has()` on the `<tr>` — see `@spark-web/data-table` CLAUDE.md for the
39
+ exact pattern.
40
+
41
+ ---
42
+
43
+ ## Overflow menu rules
44
+
45
+ An overflow menu on a row is used only when ALL of the following are true:
46
+
47
+ - There are 2 or more actions that apply to the row record
48
+ - The actions relate only to that specific record, not to the page or table
49
+
50
+ Use this decision tree:
51
+
52
+ ```
53
+ Does the row have actions?
54
+ No → no overflow menu, no action column
55
+ Yes → how many actions?
56
+ 1 action + row is NOT clickable → inline button or icon
57
+ 1 action + row IS clickable → overflow menu
58
+ 2+ actions → always overflow menu
59
+ ```
60
+
61
+ Never place inline action buttons alongside a clickable row. A clickable row and
62
+ inline buttons create two competing interaction targets and confuse the user
63
+ about what clicking does.
64
+
65
+ ---
66
+
67
+ ## Badge and pill rules
68
+
69
+ A badge or pill is used only when:
70
+
71
+ - The field represents a status with 2 or more distinct values
72
+ - The status values have meaningful visual distinction (e.g. active vs inactive,
73
+ pending vs approved vs rejected)
74
+
75
+ Do not use a badge when:
76
+
77
+ - The field is free-form text
78
+ - The field is a boolean with no meaningful status distinction
79
+ - There is only one possible value
80
+
81
+ ### Badge tone mapping
82
+
83
+ This mapping is authoritative for the internal-admin surface. If a component
84
+ CLAUDE.md defines tone guidance, the mapping below takes precedence.
85
+
86
+ Map status values to tones using this logic derived from the PRD:
87
+
88
+ - Positive / active / approved / complete → `positive` tone
89
+ - Warning / approaching limit / expiring → `caution` tone
90
+ - Critical / rejected / failed / overdue / suspended → `critical` tone
91
+ - Neutral / inactive / archived / unknown → `neutral` tone
92
+ - Pending / in review / awaiting approval → `info` tone
93
+
94
+ **Caution vs info (pending):** Use `caution` for warnings that are
95
+ time-sensitive or approaching a limit. Use `info` for states where a record is
96
+ waiting on a human decision or review (e.g. "Pending approval", "Under review").
97
+
98
+ Component choice:
99
+
100
+ - Always use `<Badge>` (dot + label) for status columns in list-page tables —
101
+ never `<StatusBadge>`
102
+ - Use `<StatusBadge>` (colored pill, no dot) only in page headers and section
103
+ headers via their `statusBadge` prop — never in table status columns
104
+
105
+ Available tones for both components:
106
+ `accent | caution | critical | info | neutral | positive`. There is no `pending`
107
+ tone — always use `info` for pending/awaiting states.
108
+
109
+ When in doubt, use `neutral`. Never invent a tone that does not exist in the
110
+ Spark Web theme.
111
+
112
+ ---
113
+
114
+ ## Rules that update as the system grows
115
+
116
+ When a new pattern or component is added to the internal admin surface, update
117
+ 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
+ Then open the root CLAUDE.md and append this line to the Architecture section:
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.