ui-foundations 0.4.1 → 0.7.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 (61) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +49 -13
  3. package/dist/core/index.css +1 -0
  4. package/dist/macros/ui.njk +94 -0
  5. package/dist/main.css +723 -138
  6. package/dist/react/accordion.js +36 -0
  7. package/dist/react/avatar.js +34 -0
  8. package/dist/react/button.js +1 -12
  9. package/dist/react/checkbox.js +3 -20
  10. package/dist/react/divider.js +31 -0
  11. package/dist/react/form.js +111 -0
  12. package/dist/react/icon.js +1 -12
  13. package/dist/react/index.js +7 -0
  14. package/dist/react/input.js +7 -0
  15. package/dist/react/radio.js +3 -20
  16. package/dist/react/switch.js +3 -20
  17. package/dist/react/tabs.js +72 -0
  18. package/dist/react/textarea.js +45 -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 +12 -6
  22. package/dist/tokens/css/appearance-modes.tokens.mode-light.css +7 -1
  23. package/dist/tokens/css/components-ui.tokens.css +93 -73
  24. package/dist/tokens/css/core-primitives.tokens.css +72 -1
  25. package/dist/tokens/css/semantics-roles.tokens.css +1 -1
  26. package/dist/tokens/css/themes-brands.tokens.brand-a.css +11 -11
  27. package/dist/tokens/css/themes-brands.tokens.brand-b.css +1 -1
  28. package/dist/tokens/css/themes-brands.tokens.brand-c.css +22 -0
  29. package/dist/tokens/json/appearance-modes.tokens.mode-dark.json +24 -0
  30. package/dist/tokens/json/appearance-modes.tokens.mode-light.json +24 -0
  31. package/dist/tokens/json/components-ui.tokens.json +403 -269
  32. package/dist/tokens/json/core-primitives.tokens.json +302 -0
  33. package/dist/tokens/json/themes-brands.tokens.brand-a.json +10 -10
  34. package/dist/tokens/json/themes-brands.tokens.brand-b.json +10 -10
  35. package/dist/tokens/json/themes-brands.tokens.brand-c.json +81 -0
  36. package/dist/tokens/tokens.yaml +2138 -578
  37. package/dist/tokens/ts/appearance-modes.tokens.mode-dark.ts +12 -6
  38. package/dist/tokens/ts/appearance-modes.tokens.mode-light.ts +7 -1
  39. package/dist/tokens/ts/components-ui.tokens.ts +94 -74
  40. package/dist/tokens/ts/core-primitives.tokens.ts +73 -2
  41. package/dist/tokens/ts/semantics-roles.tokens.ts +1 -1
  42. package/dist/tokens/ts/themes-brands.tokens.brand-a.ts +11 -11
  43. package/dist/tokens/ts/themes-brands.tokens.brand-b.ts +1 -1
  44. package/dist/tokens/ts/themes-brands.tokens.brand-c.ts +32 -0
  45. package/dist/ui/index.css +7 -0
  46. package/dist/ui/patterns/accordion.css +81 -0
  47. package/dist/ui/patterns/avatar.css +57 -0
  48. package/dist/ui/patterns/button.css +3 -3
  49. package/dist/ui/patterns/checkbox.css +28 -28
  50. package/dist/ui/patterns/divider.css +25 -0
  51. package/dist/ui/patterns/form.css +112 -0
  52. package/dist/ui/patterns/input.css +12 -12
  53. package/dist/ui/patterns/label.css +1 -1
  54. package/dist/ui/patterns/tabs.css +71 -0
  55. package/dist/ui/patterns/textarea.css +50 -0
  56. package/dist/ui/patterns/tooltip.css +64 -0
  57. package/docs/agentic/README.md +1 -0
  58. package/docs/agentic/skills/component-accessibility-audit.md +132 -0
  59. package/docs/foundations/foundation-007-typography-selectors-and-specificity.md +1 -1
  60. package/package.json +15 -3
  61. package/dist/tokens/missing-tokens.json +0 -43
package/LICENSE ADDED
@@ -0,0 +1,73 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ Required Notice: Copyright Thomas Bielich (https://konsumkit.com)
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software.
22
+
23
+ ## Changes and New Works License
24
+
25
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
26
+
27
+ ## Patent License
28
+
29
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
30
+
31
+ ## Noncommercial Purposes
32
+
33
+ Any noncommercial purpose is a permitted purpose.
34
+
35
+ ## Personal Uses
36
+
37
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
38
+
39
+ ## Noncommercial Organizations
40
+
41
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
42
+
43
+ ## Fair Use
44
+
45
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
46
+
47
+ ## No Other Rights
48
+
49
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
50
+
51
+ ## Patent Defense
52
+
53
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
54
+
55
+ ## Violations
56
+
57
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
58
+
59
+ ## No Liability
60
+
61
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
62
+
63
+ ## Definitions
64
+
65
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
66
+
67
+ **You** refers to the individual or entity agreeing to these terms.
68
+
69
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
70
+
71
+ **Your licenses** are all the licenses granted to you for the software under these terms.
72
+
73
+ **Use** means anything you do with the software requiring one of your licenses.
package/README.md CHANGED
@@ -68,8 +68,9 @@ Components reference only Semantic or Core. Never raw values.
68
68
  ### Component Integration
69
69
 
70
70
  Every component ships with:
71
- CSS pattern, React wrapper, Nunjucks macro, playground page, docs page,
72
- and Code Connect mapping.
71
+ CSS pattern, Nunjucks macro, playground page, docs page,
72
+ and Code Connect mapping. React wrappers are available as an optional
73
+ convenience layer but are not required — the CSS classes work in any framework.
73
74
 
74
75
  All surfaces must be present for the component to work predictably across
75
76
  docs, playgrounds, and consumer apps.
@@ -108,15 +109,33 @@ npm install ui-foundations
108
109
 
109
110
  ### Import
110
111
 
112
+ ```css
113
+ @import "ui-foundations/core.css";
114
+ @import "ui-foundations/ui.css";
115
+ ```
116
+
117
+ ### Use Components (plain HTML)
118
+
119
+ ```html
120
+ <button class="button">Label</button>
121
+ <button class="button outline">Outline</button>
122
+ <input class="input" type="text" />
123
+ ```
124
+
125
+ ### Optional: React Wrappers
126
+
111
127
  ```js
112
- import "ui-foundations/core.css";
113
- import "ui-foundations/ui.css";
128
+ import { Button } from "ui-foundations/react/button";
114
129
  ```
115
130
 
131
+ The React wrappers are thin convenience layers that apply CSS classes and
132
+ add dev-mode accessibility warnings. They contain no framework-specific
133
+ logic — the same result is achievable with plain HTML + CSS classes.
134
+
116
135
  ### Apply Theming
117
136
 
118
137
  ```js
119
- document.documentElement.dataset.brand = "a"; // "a" | "b"
138
+ document.documentElement.dataset.brand = "a"; // "a" | "b" | "c"
120
139
  document.documentElement.dataset.mode = "light"; // "light" | "dark"
121
140
  ```
122
141
 
@@ -128,10 +147,11 @@ to see it in action.
128
147
 
129
148
  ## Components
130
149
 
131
- Label, Button (solid / outline / ghost), ButtonGroup, Input, Icon, Checkbox,
132
- Radio, RadioGroup, Switch, Slider, Link
150
+ Label, Button (solid / outline / ghost), ButtonGroup, Badge, Input, Icon, Checkbox,
151
+ Radio, Switch, Link, Divider, TextArea, Avatar, Accordion, Tabs, Tooltip
133
152
 
134
- Each component uses its own token layer and supports theming out of the box.
153
+ Each component uses semantic tokens (or its own token layer for complex variants)
154
+ and supports theming out of the box.
135
155
 
136
156
  ---
137
157
 
@@ -201,10 +221,11 @@ npm run rules:validate # rule pipeline traceability
201
221
 
202
222
  ## MCP Integration
203
223
 
204
- Figma integration via Model Context Protocol:
224
+ Figma integration uses the Model Context Protocol. Token exports live in
225
+ `figma/exports/` and are processed by `npm run tokens:generate`.
205
226
 
206
- - `figma-developer-mcp`REST API read access (requires `FIGMA_TOKEN` in `.env`)
207
- - Figma Desktop MCP local server via Figma Desktop app
227
+ - **Figma Desktop MCP** local server via the Figma Desktop app (primary path)
228
+ - **figma-developer-mcp** REST API read access (requires `FIGMA_TOKEN` in `.env`)
208
229
 
209
230
  ```json
210
231
  {
@@ -222,6 +243,15 @@ Figma integration via Model Context Protocol:
222
243
  - Validate before commit: `npm run ci:check`
223
244
  - Work on feature branches
224
245
 
246
+ ### Adding a New Component
247
+
248
+ Load the `#component-creation` steering file for the full 10-phase workflow.
249
+ Key steps: semantic HTML first, then Figma tokens (bind variables, never hardcode),
250
+ CSS pattern, Nunjucks macro, React wrapper, docs page, playground, Code Connect.
251
+
252
+ See `.kiro/steering/workflows/component-creation.md` for details and
253
+ `.kiro/steering/figma/figma-components.md` for Figma-specific rules.
254
+
225
255
  ---
226
256
 
227
257
  ## Release
@@ -236,8 +266,14 @@ npm run release:publish
236
266
 
237
267
  ## Tech Stack
238
268
 
239
- Vanilla CSS (Custom Properties, `@layer`) · Node.js · Eleventy · React (optional wrappers) · Nunjucks macros · Figma MCP
269
+ Vanilla CSS (Custom Properties, `@layer`) · Node.js · Eleventy · Nunjucks macros · Figma MCP · React (optional wrappers)
270
+
271
+ ---
272
+
273
+ ## Roadmap
274
+
275
+ - **Web Components** — replace React wrappers with framework-agnostic custom elements (light DOM, no shadow DOM) so the library is truly platform-independent.
240
276
 
241
277
  ---
242
278
 
243
- Designed for consistency, built for scale, ready for agents.
279
+ PolyForm Noncommercial License 1.0.0
@@ -9,4 +9,5 @@
9
9
  @import url("../tokens/css/appearance-modes.tokens.mode-light.css") layer(tokens);
10
10
  @import url("../tokens/css/themes-brands.tokens.brand-a.css") layer(tokens);
11
11
  @import url("../tokens/css/themes-brands.tokens.brand-b.css") layer(tokens);
12
+ @import url("../tokens/css/themes-brands.tokens.brand-c.css") layer(tokens);
12
13
  @import url("./themes/mode.css") layer(themes);
@@ -140,3 +140,97 @@
140
140
  <span class="badge__text">{{ text }}</span>
141
141
  </span>
142
142
  {%- endmacro %}
143
+
144
+ {% macro divider(orientation='horizontal', variant='', className='') -%}
145
+ {%- set classes = "divider" -%}
146
+ {%- if variant -%}{%- set classes = classes + " " + variant -%}{%- endif -%}
147
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
148
+ <hr class="{{ classes }}"{% if orientation == "vertical" %} aria-orientation="vertical"{% endif %} />
149
+ {%- endmacro %}
150
+
151
+ {% macro textarea(placeholder='', value='', disabled=false, readonly=false, rows='', state='default', className='') -%}
152
+ {%- set classes = "textarea" -%}
153
+ {%- if state == "hover" -%}{%- set classes = classes + " is-hover" -%}{%- endif -%}
154
+ {%- if state == "focus" -%}{%- set classes = classes + " is-focus-visible" -%}{%- endif -%}
155
+ {%- if state == "disabled" or disabled -%}{%- set classes = classes + " is-disabled" -%}{%- endif -%}
156
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
157
+ <textarea class="{{ classes }}"{% if placeholder %} placeholder="{{ placeholder }}"{% endif %}{% if rows %} rows="{{ rows }}"{% endif %}{% if readonly %} readonly{% endif %}{% if disabled or state == "disabled" %} disabled{% endif %}>{{ value }}</textarea>
158
+ {%- endmacro %}
159
+
160
+ {% macro avatar(src='', alt='', initials='', size='', className='') -%}
161
+ {%- set classes = "avatar" -%}
162
+ {%- if size and size != "md" -%}{%- set classes = classes + " " + size -%}{%- endif -%}
163
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
164
+ <span class="{{ classes }}" role="img" aria-label="{{ alt or initials }}">
165
+ {%- if src -%}<img src="{{ src }}" alt="{{ alt }}" />{%- else -%}<span class="avatar__initials">{{ initials }}</span>{%- endif -%}
166
+ </span>
167
+ {%- endmacro %}
168
+
169
+ {% macro accordion(className='') -%}
170
+ {%- set classes = "accordion" -%}
171
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
172
+ <div class="{{ classes }}">{{ caller() }}</div>
173
+ {%- endmacro %}
174
+
175
+ {% macro accordionItem(title='', open=false, disabled=false) -%}
176
+ {%- set classes = "accordion-item" -%}
177
+ {%- if disabled -%}{%- set classes = classes + " is-disabled" -%}{%- endif -%}
178
+ <details class="{{ classes }}"{% if open %} open{% endif %}>
179
+ <summary>{{ title }}</summary>
180
+ <div class="accordion-item__content">{{ caller() }}</div>
181
+ </details>
182
+ {%- endmacro %}
183
+
184
+ {% macro tabList(orientation='horizontal', ariaLabel='', className='') -%}
185
+ {%- set classes = "tab-list" -%}
186
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
187
+ <div class="{{ classes }}" role="tablist" aria-orientation="{{ orientation }}"{% if ariaLabel %} aria-label="{{ ariaLabel }}"{% endif %}>{{ caller() }}</div>
188
+ {%- endmacro %}
189
+
190
+ {% macro tab(label='', selected=false, disabled=false, controls='') -%}
191
+ {%- set classes = "tab" -%}
192
+ <button class="{{ classes }}" role="tab" type="button" aria-selected="{{ "true" if selected else "false" }}"{% if controls %} aria-controls="{{ controls }}"{% endif %}{% if disabled %} disabled{% endif %} tabindex="{{ "0" if selected else "-1" }}">{{ label }}</button>
193
+ {%- endmacro %}
194
+
195
+ {% macro tabPanel(id='', hidden=false) -%}
196
+ <div class="tab-panel" role="tabpanel"{% if id %} id="{{ id }}"{% endif %}{% if hidden %} hidden{% endif %} tabindex="0">{{ caller() }}</div>
197
+ {%- endmacro %}
198
+
199
+ {% macro tooltip(text='', placement='top', className='') -%}
200
+ {%- set classes = "tooltip-trigger" -%}
201
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
202
+ <span class="{{ classes }}">{{ caller() }}<span class="tooltip" role="tooltip" data-placement="{{ placement }}">{{ text }}</span></span>
203
+ {%- endmacro %}
204
+
205
+ {% macro form(borderless=false, className='') -%}
206
+ {%- set classes = "form" -%}
207
+ {%- if borderless -%}{%- set classes = classes + " borderless" -%}{%- endif -%}
208
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
209
+ <form class="{{ classes }}" novalidate>{{ caller() }}</form>
210
+ {%- endmacro %}
211
+
212
+ {% macro formGroup(title='', className='') -%}
213
+ {%- set classes = "form-group" -%}
214
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
215
+ <fieldset class="{{ classes }}">
216
+ {%- if title %}<legend class="form-group__title">{{ title }}</legend>{% endif -%}
217
+ {{ caller() }}
218
+ </fieldset>
219
+ {%- endmacro %}
220
+
221
+ {% macro formField(labelPosition='top', invalid=false, className='') -%}
222
+ {%- set classes = "form-field" -%}
223
+ {%- if invalid -%}{%- set classes = classes + " is-invalid" -%}{%- endif -%}
224
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
225
+ <div class="{{ classes }}"{% if labelPosition == "side" %} data-label-position="side"{% endif %}>{{ caller() }}</div>
226
+ {%- endmacro %}
227
+
228
+ {% macro formHelper(text='') -%}
229
+ <p class="form-field__helper">{{ text }}</p>
230
+ {%- endmacro %}
231
+
232
+ {% macro formActions(align='end', className='') -%}
233
+ {%- set classes = "form-actions" -%}
234
+ {%- if className -%}{%- set classes = classes + " " + className -%}{%- endif -%}
235
+ <div class="{{ classes }}"{% if align != "end" %} data-align="{{ align }}"{% endif %}>{{ caller() }}</div>
236
+ {%- endmacro %}