@revikornmann/muka-ui 0.27.2 → 0.27.3

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.
@@ -45,7 +45,10 @@ export interface AvatarProps {
45
45
  * - Loading and error states
46
46
  * - Clickable support
47
47
  *
48
- * @accessibility WCAG 2.1 AA compliant
48
+ * @accessibility WCAG 2.1 AA, except initials contrast
49
+ * - Initials and "+N" use subtle text by design (Figma "Avatar"), about 2.5–3.4:1
50
+ * on the avatar fill, below the 4.5:1 AA text minimum. They are decorative:
51
+ * the accessible name comes from `name`, so always pass it
49
52
  * - Requires alt text when using image
50
53
  * - Uses role="img" with aria-label for non-image avatars
51
54
  * - Status indicators include aria-label
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElF,MAAM,WAAW,WAAW;IAC1B,uBAAuB;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,0BAA0B;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,0EAA0E;IAC1E,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB,oBAAoB;IACpB,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAE5B,uBAAuB;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAEhD,gCAAgC;IAChC,cAAc,CAAC,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AM,CAAC;IAEnB,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAaD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkKxC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -214,8 +214,12 @@ const link = document.getElementById('muka-theme') as HTMLLinkElement;
214
214
  link.href = `/styles/tokens-acme-${mode}.css`;
215
215
  ```
216
216
 
217
- Copy the generated CSS into your static/public directory so those hrefs resolve.
218
- This is exactly how Muka's own Storybook switches between its ten themes.
217
+ Those hrefs need the generated CSS at a stable URL: have your token build write
218
+ or copy it into your static/public directory, as part of the same `build:tokens`
219
+ step described under [Keeping your brand current](#keeping-your-brand-current).
220
+ Don't keep a hand-made copy there — it stays frozen while the light stylesheet
221
+ moves on, and any token missing from the dark copy shows its light value in dark
222
+ mode. This is exactly how Muka's own Storybook switches between its ten themes.
219
223
 
220
224
  ## Keeping your brand current
221
225
 
@@ -71,9 +71,41 @@ document.getElementById('muka-theme').href =
71
71
  `/styles/tokens-${brand}-${mode}.css`;
72
72
  ```
73
73
 
74
- Copy the token CSS you need into your static/public directory (or let your
75
- bundler emit it at a stable URL) so those hrefs resolve. Muka's own Storybook
76
- switches between all ten themes exactly this way — see
74
+ Those hrefs need the token CSS at a stable URL. Copy it from the installed
75
+ package **as part of every `dev` and `build`** (or let your bundler emit it), so
76
+ it always matches the Muka version you have installed:
77
+
78
+ ```js
79
+ // scripts/sync-theme-tokens.mjs
80
+ import { copyFileSync, mkdirSync } from 'node:fs';
81
+ import { createRequire } from 'node:module';
82
+
83
+ const require = createRequire(import.meta.url);
84
+ mkdirSync('public/styles', { recursive: true });
85
+ for (const mode of ['light', 'dark']) {
86
+ const file = `tokens-muka-${mode}.css`;
87
+ copyFileSync(require.resolve(`@revikornmann/muka-ui/styles/${file}`), `public/styles/${file}`);
88
+ }
89
+ ```
90
+
91
+ ```json
92
+ "scripts": {
93
+ "sync:themes": "node scripts/sync-theme-tokens.mjs",
94
+ "dev": "npm run sync:themes && next dev",
95
+ "build": "npm run sync:themes && next build"
96
+ }
97
+ ```
98
+
99
+ Gitignore the copies (`public/styles/tokens-*.css`). Chain the script into
100
+ `dev` and `build` rather than using `predev` / `prebuild`: pnpm 9 skips `pre*`
101
+ scripts by default.
102
+
103
+ **Never commit a hand-made copy.** It is frozen at the version you copied, and
104
+ each Muka release adds tokens it lacks. A token missing from the dark copy keeps
105
+ the value from the light stylesheet, so new components show light colours in
106
+ dark mode (e.g. a white ring around grouped avatars).
107
+
108
+ Muka's own Storybook switches between all ten themes this way — see
77
109
  `.storybook/ThemeDecorator.ts` in the repo.
78
110
 
79
111
  ### `data-layout`: the one attribute that does do something
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revikornmann/muka-ui",
3
- "version": "0.27.2",
3
+ "version": "0.27.3",
4
4
  "description": "Muka Design System - Multi-brand design tokens and React components",
5
5
  "main": "dist/cjs/components/index.js",
6
6
  "module": "dist/esm/components/index.js",
@@ -82,9 +82,42 @@ const link = document.getElementById('muka-theme') as HTMLLinkElement;
82
82
  link.href = `/styles/tokens-${brand}-${mode}.css`;
83
83
  ```
84
84
 
85
- Copy the brand's token CSS into the app's static/public directory (or let the
86
- bundler emit it with a stable URL) so those hrefs resolve. This is exactly what
87
- Muka's own Storybook does.
85
+ Those hrefs need the brand's token CSS at a stable URL. Add a script that copies
86
+ it from the installed package into the app's static/public directory, run it
87
+ before `dev` and `build`, and gitignore the copies (or let the bundler emit the
88
+ CSS). Use the brand the app actually loads in place of `muka`:
89
+
90
+ ```js
91
+ // scripts/sync-theme-tokens.mjs
92
+ import { copyFileSync, mkdirSync } from 'node:fs';
93
+ import { createRequire } from 'node:module';
94
+
95
+ const require = createRequire(import.meta.url);
96
+ mkdirSync('public/styles', { recursive: true });
97
+ for (const mode of ['light', 'dark']) {
98
+ const file = `tokens-muka-${mode}.css`;
99
+ copyFileSync(require.resolve(`@revikornmann/muka-ui/styles/${file}`), `public/styles/${file}`);
100
+ }
101
+ ```
102
+
103
+ ```json
104
+ "scripts": {
105
+ "sync:themes": "node scripts/sync-theme-tokens.mjs",
106
+ "dev": "npm run sync:themes && next dev",
107
+ "build": "npm run sync:themes && next build"
108
+ }
109
+ ```
110
+
111
+ Gitignore the copies (`public/styles/tokens-*.css`). Chain the script into
112
+ `dev` and `build` rather than using `predev` / `prebuild`: pnpm 9 skips `pre*`
113
+ scripts by default.
114
+
115
+ **Never commit a hand-made copy.** It is frozen at the version you copied, and
116
+ each Muka release adds tokens it lacks. A token missing from the dark copy keeps
117
+ the value from the light stylesheet, so new components show light colours in
118
+ dark mode (e.g. a white ring around grouped avatars).
119
+
120
+ This is exactly how Muka's own Storybook switches themes.
88
121
 
89
122
  ### Fonts come from Muka — do not load them yourself
90
123
 
@@ -38,6 +38,38 @@
38
38
  "$value": "{size.10xl}"
39
39
  }
40
40
  },
41
+ "icon": {
42
+ "size": {
43
+ "3xs": {
44
+ "$type": "sizing",
45
+ "$value": "{size.md}"
46
+ },
47
+ "2xs": {
48
+ "$type": "sizing",
49
+ "$value": "{size.lg}"
50
+ },
51
+ "xs": {
52
+ "$type": "sizing",
53
+ "$value": "{size.xl}"
54
+ },
55
+ "sm": {
56
+ "$type": "sizing",
57
+ "$value": "{size.2xl}"
58
+ },
59
+ "md": {
60
+ "$type": "sizing",
61
+ "$value": "{size.3xl}"
62
+ },
63
+ "lg": {
64
+ "$type": "sizing",
65
+ "$value": "{size.4xl}"
66
+ },
67
+ "xl": {
68
+ "$type": "sizing",
69
+ "$value": "{size.6xl}"
70
+ }
71
+ }
72
+ },
41
73
  "color": {
42
74
  "background": {
43
75
  "default": {
@@ -52,7 +84,7 @@
52
84
  "foreground": {
53
85
  "default": {
54
86
  "$type": "color",
55
- "$value": "{color.text.default.default}"
87
+ "$value": "{color.text.subtle.default}"
56
88
  },
57
89
  "muted": {
58
90
  "$type": "color",