ui-foundations 0.3.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +181 -37
  2. package/dist/assets/icons/checkmark.svg +1 -0
  3. package/dist/core/index.css +8 -7
  4. package/dist/macros/ui.njk +203 -0
  5. package/dist/main.css +941 -210
  6. package/dist/react/accordion.js +36 -0
  7. package/dist/react/avatar.js +34 -0
  8. package/dist/react/badge.js +41 -0
  9. package/dist/react/button.js +4 -6
  10. package/dist/react/checkbox.js +21 -8
  11. package/dist/react/divider.js +31 -0
  12. package/dist/react/icon.js +8 -1
  13. package/dist/react/index.js +8 -0
  14. package/dist/react/label.js +1 -1
  15. package/dist/react/radio.js +45 -0
  16. package/dist/react/switch.js +9 -8
  17. package/dist/react/tabs.js +72 -0
  18. package/dist/react/textarea.js +38 -0
  19. package/dist/react/tooltip.js +25 -0
  20. package/dist/react/warn-dev.js +15 -0
  21. package/dist/tokens/css/{appearance-(modes).tokens.mode-dark.css → appearance-modes.tokens.mode-dark.css} +6 -6
  22. package/dist/tokens/css/{appearance-(modes).tokens.mode-light.css → appearance-modes.tokens.mode-light.css} +1 -1
  23. package/dist/tokens/css/{components-(ui).tokens.css → components-ui.tokens.css} +73 -32
  24. package/dist/tokens/css/core-primitives.tokens.css +240 -0
  25. package/dist/tokens/css/{semantics-(roles).tokens.css → semantics-roles.tokens.css} +1 -1
  26. package/dist/tokens/css/themes-brands.tokens.brand-a.css +22 -0
  27. package/dist/tokens/css/{themes-(brands).tokens.brand-b.css → themes-brands.tokens.brand-b.css} +9 -9
  28. package/dist/tokens/css/themes-brands.tokens.brand-c.css +22 -0
  29. package/dist/tokens/json/appearance-modes.tokens.mode-dark.json +121 -0
  30. package/dist/tokens/json/appearance-modes.tokens.mode-light.json +121 -0
  31. package/dist/tokens/json/components-ui.tokens.json +713 -0
  32. package/dist/tokens/json/{core-(primitives).tokens.json → core-primitives.tokens.json} +526 -410
  33. package/dist/tokens/json/semantics-roles.tokens.json +141 -0
  34. package/dist/tokens/json/themes-brands.tokens.brand-a.json +81 -0
  35. package/dist/tokens/json/themes-brands.tokens.brand-b.json +81 -0
  36. package/dist/tokens/json/themes-brands.tokens.brand-c.json +81 -0
  37. package/dist/tokens/tokens.yaml +2722 -499
  38. package/dist/tokens/ts/{appearance-(modes).tokens.mode-dark.ts → appearance-modes.tokens.mode-dark.ts} +6 -6
  39. package/dist/tokens/ts/{appearance-(modes).tokens.mode-light.ts → appearance-modes.tokens.mode-light.ts} +1 -1
  40. package/dist/tokens/ts/{components-(ui).tokens.ts → components-ui.tokens.ts} +74 -33
  41. package/dist/tokens/ts/core-primitives.tokens.ts +265 -0
  42. package/dist/tokens/ts/{semantics-(roles).tokens.ts → semantics-roles.tokens.ts} +1 -1
  43. package/dist/tokens/ts/themes-brands.tokens.brand-a.ts +32 -0
  44. package/dist/tokens/ts/{themes-(brands).tokens.brand-b.ts → themes-brands.tokens.brand-b.ts} +9 -9
  45. package/dist/tokens/ts/{themes-(brands).tokens.brand-a.ts → themes-brands.tokens.brand-c.ts} +9 -9
  46. package/dist/ui/index.css +8 -0
  47. package/dist/ui/patterns/accordion.css +81 -0
  48. package/dist/ui/patterns/avatar.css +57 -0
  49. package/dist/ui/patterns/badge.css +49 -0
  50. package/dist/ui/patterns/checkbox.css +71 -22
  51. package/dist/ui/patterns/divider.css +25 -0
  52. package/dist/ui/patterns/radio.css +109 -0
  53. package/dist/ui/patterns/tabs.css +71 -0
  54. package/dist/ui/patterns/textarea.css +50 -0
  55. package/dist/ui/patterns/tooltip.css +64 -0
  56. package/docs/README.md +38 -0
  57. package/docs/agentic/README.md +35 -0
  58. package/docs/agentic/assistant-behavior-rules.md +48 -0
  59. package/docs/agentic/skills/component-accessibility-audit.md +132 -0
  60. package/docs/agentic/skills/ux-writing-coach.md +116 -0
  61. package/docs/foundations/README.md +31 -0
  62. package/docs/foundations/foundation-001-token-layering.md +6 -0
  63. package/docs/foundations/foundation-002-naming-and-grouping.md +6 -0
  64. package/docs/foundations/foundation-003-color-semantics-and-status.md +6 -0
  65. package/docs/foundations/foundation-004-typography-scale-and-line-height.md +6 -0
  66. package/docs/foundations/foundation-005-responsive-breakpoints-and-containers.md +6 -0
  67. package/docs/foundations/foundation-006-z-index-layering.md +6 -0
  68. package/docs/foundations/foundation-007-typography-selectors-and-specificity.md +7 -1
  69. package/docs/foundations/foundation-008-mode-activation-and-consumer-control.md +6 -0
  70. package/docs/foundations/foundation-009-component-boundaries-and-utility.md +6 -0
  71. package/docs/foundations/foundation-010-implementation-and-pipeline-workflow.md +6 -0
  72. package/docs/foundations/foundation-011-branching-and-release-governance.md +6 -0
  73. package/docs/foundations/foundation-012-minimal-markup-and-composition.md +6 -0
  74. package/package.json +16 -11
  75. package/dist/tokens/css/core-(primitives).tokens.css +0 -127
  76. package/dist/tokens/css/themes-(brands).tokens.brand-a.css +0 -22
  77. package/dist/tokens/json/appearance-(modes).tokens.mode-dark.json +0 -182
  78. package/dist/tokens/json/appearance-(modes).tokens.mode-light.json +0 -182
  79. package/dist/tokens/json/components-(ui).tokens.json +0 -739
  80. package/dist/tokens/json/semantics-(roles).tokens.json +0 -203
  81. package/dist/tokens/json/themes-(brands).tokens.brand-a.json +0 -115
  82. package/dist/tokens/json/themes-(brands).tokens.brand-b.json +0 -115
  83. package/dist/tokens/ts/core-(primitives).tokens.ts +0 -152
  84. package/docs/agentic/skills/README.md +0 -51
  85. package/docs/agentic/skills/design-ops-specialist/SKILL.md +0 -60
  86. package/docs/agentic/skills/design-system-architect/SKILL.md +0 -106
  87. package/docs/agentic/team-ai-playbook.md +0 -226
@@ -1,106 +0,0 @@
1
- ---
2
- name: design-system-architect
3
- description: "Strategic design-system architecture for this repo. Use when reviewing or evolving foundations, deciding token governance, evaluating component boundaries, reconciling Figma/code drift, auditing semantic coverage, or making architecture-level decisions that span beyond a single component proposal. Prefer this skill over design-ops-specialist when the request is system-wide, governance-heavy, or about whether something should enter the system at all."
4
- ---
5
-
6
- # Design System Architect
7
-
8
- ## Intent
9
-
10
- Use this skill for system-level decisions, reviews, and governance.
11
-
12
- This skill is broader than `design-ops-specialist`.
13
-
14
- - Use `design-ops-specialist` for tactical, proposal-first component drafts.
15
- - Use `design-system-architect` for architecture, boundaries, token governance, and Figma/code alignment decisions.
16
-
17
- ## Required source alignment
18
-
19
- Before responding, align to these repo sources:
20
-
21
- - `docs/foundations/`
22
- - `docs/agentic/assistant-behavior-rules.md`
23
- - `docs/agentic/team-ai-playbook.md`
24
-
25
- At minimum, check these when relevant:
26
-
27
- - `docs/foundations/foundation-001-token-layering.md`
28
- - `docs/foundations/foundation-002-naming-and-grouping.md`
29
- - `docs/foundations/foundation-003-color-semantics-and-status.md`
30
- - `docs/foundations/foundation-009-component-boundaries-and-utility.md`
31
- - `docs/foundations/foundation-010-implementation-and-pipeline-workflow.md`
32
- - `docs/foundations/foundation-011-branching-and-release-governance.md`
33
-
34
- ## Task types
35
-
36
- ### 1. Foundation review
37
-
38
- Use when reviewing the health of the system.
39
-
40
- Check for:
41
-
42
- - layering integrity
43
- - semantic gaps
44
- - naming drift
45
- - duplicate concepts
46
- - hard-coded or leaky component decisions
47
- - weak state coverage
48
- - Figma/code mismatch
49
-
50
- ### 2. Token governance
51
-
52
- Use when deciding whether to create, alias, rename, or reject token changes.
53
-
54
- Report:
55
-
56
- - correct layer
57
- - rationale
58
- - consumer scope
59
- - theme/mode impact
60
- - migration implications
61
-
62
- ### 3. Boundary decision
63
-
64
- Use before proposing or implementing a new component.
65
-
66
- Decide:
67
-
68
- - composition inside an existing family, or
69
- - standalone system component
70
-
71
- Apply the Snowflake check from `foundation-009`.
72
-
73
- ### 4. Figma/code reconciliation
74
-
75
- Use when system contracts drift between Figma and implementation.
76
-
77
- Review:
78
-
79
- - token exports in `figma/exports/`
80
- - Code Connect mappings in `figma/connections/`
81
- - implementation in `src/ui/` and `src/react/`
82
- - docs/playground representation in `site/components/`
83
-
84
- ### 5. System handoff
85
-
86
- Use when another designer or engineer needs a structured architectural recommendation.
87
-
88
- ## Output format
89
-
90
- Provide these sections when relevant:
91
-
92
- 1. Task type
93
- 2. Current system reading
94
- 3. Decision
95
- 4. Rationale
96
- 5. Repo surfaces affected
97
- 6. Risks / mismatches
98
- 7. Recommended next step
99
-
100
- ## Guardrails
101
-
102
- - Do not invent raw values inside components.
103
- - Keep the 4-layer architecture intact.
104
- - Treat token work and component boundary decisions as separate questions.
105
- - Prefer small, reviewable changes and feature-branch delivery.
106
- - Say explicitly when something should remain local instead of entering the system.
@@ -1,226 +0,0 @@
1
- # AI Playbook
2
-
3
- This playbook defines how to use AI as an engineering copilot in this repository.
4
-
5
- ## Goal
6
-
7
- Use AI to speed up component incubation and implementation while keeping output:
8
-
9
- - token-first
10
- - reviewable in Git
11
- - consistent with existing architecture
12
-
13
- ## Principles
14
-
15
- 1. Keep changes small and incremental.
16
- 2. Prefer existing patterns over introducing new abstractions.
17
- 3. Keep Figma and code aligned through explicit token roundtrips.
18
- 4. Always validate with local checks before pushing.
19
-
20
- ## Component Boundary Check (Mandatory)
21
-
22
- Run this decision gate before implementing a "new component":
23
-
24
- 1. Start with composition-first:
25
- - If the new idea is primarily grouping, layout, or orchestration of existing components, implement it as composition within the existing component family and document it there.
26
- 2. Promote to standalone only when needed:
27
- - The candidate introduces distinct semantics (own role/responsibility), a stable API surface, or independent lifecycle/behavior that is not just a wrapper.
28
- 3. Apply a utility test ("Snowflake check"):
29
- - One-off/local case -> keep it local or document as composition.
30
- - Reusable across contexts/products -> valid candidate for system-level component.
31
- 4. Keep token work independent:
32
- - New tokens may be needed in both paths.
33
- - Token creation does not automatically justify a new standalone component.
34
- 5. Source of truth:
35
- - `docs/foundations/foundation-009-component-boundaries-and-utility.md`
36
-
37
- ## Standard Workflow: New Component
38
-
39
- 1. Run the Component Boundary Check and decide:
40
- - standalone component, or
41
- - composition inside existing component docs/API.
42
- 2. Ask AI for a first proposal:
43
- - structure: HTML/CSS/React
44
- - token names and states
45
- - docs + playground example
46
- 3. Review and adjust naming before implementation.
47
- 4. Add/import proposed tokens in Figma.
48
- 5. Export tokens from Figma to `figma/exports/`.
49
- 6. Let AI integrate implementation:
50
- - `src/ui/patterns/<component>.css`
51
- - `src/react/<component>.js` and `src/react/index.js` (if needed)
52
- - `site/components/<component>.md`
53
- - `site/components/<component>-playground.md`
54
- - `figma/connections/web-<component>.figma.ts` (if needed)
55
- 7. Run validation:
56
- - `npm run ci:check`
57
- 8. Iterate naming/states/a11y until stable.
58
-
59
- ## Skill selection
60
-
61
- Use the repo skills intentionally:
62
-
63
- - `design-ops-specialist` for tactical, proposal-first component work
64
- - `design-system-architect` for strategic, system-level reviews and decisions
65
-
66
- See also:
67
- - `docs/agentic/skills/README.md`
68
-
69
- ## Proposal Mode: Design Ops Specialist
70
-
71
- Use this mode when the request is explicitly a proposal (no implementation yet).
72
-
73
- 1. Confirm scope and constraints first:
74
- - component name
75
- - variants/sizes/states/parts
76
- - platform constraints
77
- 2. Review source rules before proposing:
78
- - `docs/foundations/`
79
- - `docs/agentic/assistant-behavior-rules.md`
80
- - this playbook
81
- 3. Deliver a concise proposal with these sections:
82
- - token naming proposal (variants/parts/states)
83
- - CSS pattern structure under `src/ui/patterns`
84
- - optional React wrapper API (only if requested/needed)
85
- - docs + playground integration plan
86
- 4. Keep recommendations minimal and non-breaking by default.
87
-
88
- ## Standard Workflow: Token Roundtrip
89
-
90
- 1. Create or update tokens in Figma.
91
- 2. Export into `figma/exports/*.tokens.json`.
92
- 3. Run:
93
- - `npm run build:all`
94
- - `npm run tokens:validate`
95
- 4. Check output consistency:
96
- - `dist/tokens/css/*.tokens.css`
97
- - `dist/tokens/json/*.json`
98
- - `dist/tokens/tokens.yaml`
99
- 5. If warnings appear (missing/invalid WEB syntax, alias issues), fix in Figma first.
100
-
101
- ## Standard Workflow: Figma Drift Reconciliation
102
-
103
- Use this when the component was scaffolded in code first and component variables/variants are created or changed in Figma afterwards.
104
-
105
- 1. Define the contract first:
106
- - component API (props/states/semantics)
107
- - token names and expected usage
108
- 2. Update Figma variables/variants and export tokens:
109
- - `figma/exports/*.tokens.json`
110
- 3. Rebuild token artifacts:
111
- - `npm run build:all`
112
- - `npm run tokens:validate`
113
- 4. Reconcile Code Connect mappings:
114
- - update `figma/connections/web-<component>.figma.ts`
115
- - align node-id targets and property names with actual Figma top-level component/component set
116
- - run `figma connect parse`
117
- - run `figma connect publish --dry-run`
118
- 5. Reconcile implementation only where needed:
119
- - adjust CSS/React/docs/playground to match agreed contract
120
- - avoid broad rewrites; keep changes minimal
121
- 6. Validate and stabilize:
122
- - `npm run lint`
123
- - `npm run test:unit`
124
- - `npm run ci:check`
125
- 7. Commit with explicit scope, for example:
126
- - `chore(figma): reconcile <component> code-connect mapping`
127
- - `feat(<component>): align states and tokens with figma`
128
-
129
- ## Standard Workflow: Refactor and Quality
130
-
131
- 1. Ask AI to identify one small refactor target.
132
- 2. Implement only one focused change set.
133
- 3. Add or update tests when behavior is touched.
134
- 4. Run:
135
- - `npm run lint`
136
- - `npm run test:unit`
137
- - `npm run ci:check`
138
- 5. Commit with clear scope in message.
139
-
140
- ## Prompt Templates
141
-
142
- ### 1) New component incubation
143
-
144
- ```text
145
- You are my Design OPS Manager. Propose a token-first setup for a new <component>.
146
- Include:
147
- - token naming proposal (variants/parts/states)
148
- - CSS pattern structure under src/ui/patterns
149
- - optional React wrapper API
150
- - docs + playground integration
151
- Keep changes minimal and aligned with existing repository conventions.
152
- ```
153
-
154
- ### 2) Token integration after Figma export
155
-
156
- ```text
157
- I updated figma/exports. Please run the token/build pipeline, review warnings,
158
- and apply minimal fixes so docs and bundles are green.
159
- ```
160
-
161
- ### 3) Safe refactor
162
-
163
- ```text
164
- Refactor <target file/module> for maintainability in small steps only.
165
- No behavior changes. Add tests if needed. Keep ci:check green.
166
- ```
167
-
168
- ### 4) Prompt to UI component (scaffold + implement)
169
-
170
- ```text
171
- Scaffold and implement a new UI component named <component-name> in this repository.
172
-
173
- Follow these sources strictly:
174
- - docs/agentic/team-ai-playbook.md
175
- - docs/agentic/assistant-behavior-rules.md
176
- - docs/foundations/*
177
-
178
- Execution requirements:
179
- 1) Run the Component Boundary Check first and state the decision (composition vs standalone).
180
- 2) Keep scope small, incremental, and reviewable in Git.
181
- 3) Implement token-first and reuse existing patterns:
182
- - src/ui/patterns/<component>.css
183
- - src/react/<component>.js and src/react/index.js (if needed)
184
- - site/components/<component>.md
185
- - site/components/<component>-playground.md
186
- - figma/connections/web-<component>.figma.ts (only if a publishable top-level Figma component/component-set exists)
187
- 4) Validate before handoff:
188
- - npm run lint
189
- - npm run test:unit
190
- - npm run ci:check
191
-
192
- Mandatory progress tracker for this task type:
193
- - Start with: Tasks completion: 0/4
194
- - Update after each phase: 1/4, 2/4, 3/4, 4/4
195
-
196
- Handoff format:
197
- - boundary decision result
198
- - files changed
199
- - validation results
200
- - open follow-ups (if any)
201
- ```
202
-
203
- ## Definition of Done (AI Task)
204
-
205
- - Scope is clear and minimal.
206
- - Affected files are easy to review.
207
- - No broken exports or docs.
208
- - `npm run ci:check` passes.
209
- - README/docs updated when behavior or workflow changes.
210
-
211
- ## Worked example: Button Group
212
-
213
- This repository now includes a concrete walkthrough based on a `Button Group`:
214
-
215
- 1. AI proposal:
216
- - layout model (`orientation`, `attached`, `justify`)
217
- - token proposal (`--button-group-gap`, `--button-group-border-radius`)
218
- 2. Implementation in code:
219
- - integrated button family CSS: `src/ui/patterns/button.css`
220
- - React wrapper API in `src/react/button.js` (`ButtonGroup`)
221
- 3. Documentation:
222
- - integrated in `site/components/button.md` under grouped usage
223
- 4. Validation:
224
- - `npm run ci:check`
225
-
226
- Use this pattern as the reference baseline for future AI-assisted component incubation where wrappers extend an existing component family.