@app-studio/components 0.10.17 → 0.10.19

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 (141) hide show
  1. package/dist/index.d.ts +41 -0
  2. package/dist/native/components/Alert/Alert/Alert.style.js +20 -20
  3. package/dist/native/components/Alert/Alert/Alert.style.js.map +1 -1
  4. package/dist/native/components/Alert/Alert/Alert.view.native.js.map +1 -1
  5. package/dist/native/components/AudioInput/AudioInput/AudioInput.view.js +7 -4
  6. package/dist/native/components/AudioInput/AudioInput/AudioInput.view.js.map +1 -1
  7. package/dist/native/components/Background/Background/Background.view.native.js.map +1 -1
  8. package/dist/native/components/Badge/Badge/Badge.style.js +7 -11
  9. package/dist/native/components/Badge/Badge/Badge.style.js.map +1 -1
  10. package/dist/native/components/Badge/Badge/Badge.view.js +2 -6
  11. package/dist/native/components/Badge/Badge/Badge.view.js.map +1 -1
  12. package/dist/native/components/Button/Button/Button.view.js +2 -2
  13. package/dist/native/components/Button/Button/Button.view.js.map +1 -1
  14. package/dist/native/components/Button/Button/Button.view.native.js.map +1 -1
  15. package/dist/native/components/Card/Card/Card.style.js +10 -10
  16. package/dist/native/components/Card/Card/Card.style.js.map +1 -1
  17. package/dist/native/components/Carousel/Carousel/Carousel.view.native.js +10 -6
  18. package/dist/native/components/Carousel/Carousel/Carousel.view.native.js.map +1 -1
  19. package/dist/native/components/Chart/Chart/Chart.style.js +3 -3
  20. package/dist/native/components/Chart/Chart/Chart.style.js.map +1 -1
  21. package/dist/native/components/ChatInput/ChatInput/ChatInput.style.js +1 -1
  22. package/dist/native/components/ChatInput/ChatInput/ChatInput.style.js.map +1 -1
  23. package/dist/native/components/ChatWidget/ChatWidget/ChatWidget.style.js +16 -16
  24. package/dist/native/components/ChatWidget/ChatWidget/ChatWidget.style.js.map +1 -1
  25. package/dist/native/components/ChatWidget/ChatWidget/ChatWidget.view.js +2 -2
  26. package/dist/native/components/ChatWidget/ChatWidget/ChatWidget.view.js.map +1 -1
  27. package/dist/native/components/ColorPicker/ColorPicker/ColorPicker.style.js +6 -6
  28. package/dist/native/components/ColorPicker/ColorPicker/ColorPicker.style.js.map +1 -1
  29. package/dist/native/components/ColorPicker/ColorPicker/ColorPicker.view.js +1 -1
  30. package/dist/native/components/ColorPicker/ColorPicker/ColorPicker.view.js.map +1 -1
  31. package/dist/native/components/ContextMenu/ContextMenu/ContextMenu.view.native.js +4 -4
  32. package/dist/native/components/ContextMenu/ContextMenu/ContextMenu.view.native.js.map +1 -1
  33. package/dist/native/components/CookieConsent/CookieConsent/CookieConsent.style.js +18 -20
  34. package/dist/native/components/CookieConsent/CookieConsent/CookieConsent.style.js.map +1 -1
  35. package/dist/native/components/DropZone/DropZone/DropZone.view.js +3 -3
  36. package/dist/native/components/DropZone/DropZone/DropZone.view.js.map +1 -1
  37. package/dist/native/components/DropdownMenu/DropdownMenu/DropdownMenu.view.native.js +4 -4
  38. package/dist/native/components/DropdownMenu/DropdownMenu/DropdownMenu.view.native.js.map +1 -1
  39. package/dist/native/components/EditComponent/EditPanel.js.map +1 -1
  40. package/dist/native/components/EmojiPicker/EmojiPicker/EmojiPicker.view.js +3 -3
  41. package/dist/native/components/EmojiPicker/EmojiPicker/EmojiPicker.view.js.map +1 -1
  42. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.native.js +1 -5
  43. package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.native.js.map +1 -1
  44. package/dist/native/components/Form/CountryPicker/CountryPicker/CountryPicker.view.js +2 -8
  45. package/dist/native/components/Form/CountryPicker/CountryPicker/CountryPicker.view.js.map +1 -1
  46. package/dist/native/components/Form/DatePicker/DatePicker/DatePicker.view.js +1 -7
  47. package/dist/native/components/Form/DatePicker/DatePicker/DatePicker.view.js.map +1 -1
  48. package/dist/native/components/Form/Radio/Radio/Radio.view.native.js +1 -5
  49. package/dist/native/components/Form/Radio/Radio/Radio.view.native.js.map +1 -1
  50. package/dist/native/components/Form/Select/Select/Select.view.native.js +3 -9
  51. package/dist/native/components/Form/Select/Select/Select.view.native.js.map +1 -1
  52. package/dist/native/components/Form/TextArea/TextArea/TextArea.view.native.js.map +1 -1
  53. package/dist/native/components/Form/TextField/TextField/TextField.view.native.js.map +1 -1
  54. package/dist/native/components/Gradient/Gradient/Gradient.view.native.js +2 -6
  55. package/dist/native/components/Gradient/Gradient/Gradient.view.native.js.map +1 -1
  56. package/dist/native/components/HoverCard/HoverCard/HoverCard.view.js +1 -1
  57. package/dist/native/components/HoverCard/HoverCard/HoverCard.view.js.map +1 -1
  58. package/dist/native/components/HoverCard/HoverCard/HoverCard.view.native.js.map +1 -1
  59. package/dist/native/components/Icon/Icon.js.map +1 -1
  60. package/dist/native/components/Icon/Icon.native.js.map +1 -1
  61. package/dist/native/components/IconPicker/IconPicker/IconPicker.view.js +2 -2
  62. package/dist/native/components/IconPicker/IconPicker/IconPicker.view.js.map +1 -1
  63. package/dist/native/components/Input/FieldLayout/FieldLayout.js +1 -1
  64. package/dist/native/components/Input/FieldLayout/FieldLayout.js.map +1 -1
  65. package/dist/native/components/Link/Link/Link.view.native.js +1 -3
  66. package/dist/native/components/Link/Link/Link.view.native.js.map +1 -1
  67. package/dist/native/components/Loader/Loader/Loader.view.native.js +4 -4
  68. package/dist/native/components/Loader/Loader/Loader.view.native.js.map +1 -1
  69. package/dist/native/components/Menubar/Menubar/Menubar.view.native.js +2 -2
  70. package/dist/native/components/Menubar/Menubar/Menubar.view.native.js.map +1 -1
  71. package/dist/native/components/Message/Message/Message.view.js +1 -1
  72. package/dist/native/components/Message/Message/Message.view.js.map +1 -1
  73. package/dist/native/components/Modal/Modal/Modal.style.js +1 -1
  74. package/dist/native/components/Modal/Modal/Modal.style.js.map +1 -1
  75. package/dist/native/components/NavigationMenu/NavigationMenu/NavigationMenu.view.native.js +2 -2
  76. package/dist/native/components/NavigationMenu/NavigationMenu/NavigationMenu.view.native.js.map +1 -1
  77. package/dist/native/components/OTPInput/OTPInput/OTPInput.view.native.js +18 -2
  78. package/dist/native/components/OTPInput/OTPInput/OTPInput.view.native.js.map +1 -1
  79. package/dist/native/components/ProgressBar/ProgressBar/ProgressBar.view.js +2 -2
  80. package/dist/native/components/ProgressBar/ProgressBar/ProgressBar.view.js.map +1 -1
  81. package/dist/native/components/ProgressBar/ProgressBar/ProgressBar.view.native.js +6 -3
  82. package/dist/native/components/ProgressBar/ProgressBar/ProgressBar.view.native.js.map +1 -1
  83. package/dist/native/components/Resizable/Resizable/Resizable.view.native.js +9 -1
  84. package/dist/native/components/Resizable/Resizable/Resizable.view.native.js.map +1 -1
  85. package/dist/native/components/Sidebar/Sidebar/Sidebar.style.js +11 -11
  86. package/dist/native/components/Sidebar/Sidebar/Sidebar.style.js.map +1 -1
  87. package/dist/native/components/Sidebar/Sidebar/Sidebar.view.native.js.map +1 -1
  88. package/dist/native/components/Slider/Slider/Slider.view.native.js +3 -1
  89. package/dist/native/components/Slider/Slider/Slider.view.native.js.map +1 -1
  90. package/dist/native/components/Tabs/Tabs/Tabs.view.js +10 -10
  91. package/dist/native/components/Tabs/Tabs/Tabs.view.js.map +1 -1
  92. package/dist/native/components/Tabs/Tabs/Tabs.view.native.js +2 -2
  93. package/dist/native/components/Tabs/Tabs/Tabs.view.native.js.map +1 -1
  94. package/dist/native/components/Title/Title/Title.view.native.js.map +1 -1
  95. package/dist/native/components/Title/Title/TypewriterEffect.native.js +1 -3
  96. package/dist/native/components/Title/Title/TypewriterEffect.native.js.map +1 -1
  97. package/dist/native/components/Toast/Toast/Toast.view.native.js.map +1 -1
  98. package/dist/native/components/Toggle/Toggle/Toggle.style.js +7 -7
  99. package/dist/native/components/Toggle/Toggle/Toggle.style.js.map +1 -1
  100. package/dist/native/components/Toggle/Toggle/Toggle.view.js +2 -2
  101. package/dist/native/components/Toggle/Toggle/Toggle.view.js.map +1 -1
  102. package/dist/native/components/Toggle/Toggle/Toggle.view.native.js +3 -1
  103. package/dist/native/components/Toggle/Toggle/Toggle.view.native.js.map +1 -1
  104. package/dist/native/components/Uploader/Uploader/Uploader.view.js +2 -2
  105. package/dist/native/design-system/DesignSystemProvider.d.ts +8 -1
  106. package/dist/native/design-system/DesignSystemProvider.js +10 -4
  107. package/dist/native/design-system/DesignSystemProvider.js.map +1 -1
  108. package/dist/native/design-system/configs/airbnb.json +87 -87
  109. package/dist/native/design-system/configs/apple.json +89 -89
  110. package/dist/native/design-system/configs/coinbase.json +89 -89
  111. package/dist/native/design-system/configs/default.json +556 -0
  112. package/dist/native/design-system/configs/figma.json +63 -63
  113. package/dist/native/design-system/configs/index.d.ts +6 -0
  114. package/dist/native/design-system/configs/index.js +8 -1
  115. package/dist/native/design-system/configs/index.js.map +1 -1
  116. package/dist/native/design-system/configs/linear.json +86 -86
  117. package/dist/native/design-system/configs/nike.json +60 -60
  118. package/dist/native/design-system/configs/notion.json +88 -88
  119. package/dist/native/design-system/configs/revolut.json +89 -89
  120. package/dist/native/design-system/configs/shopify.json +76 -76
  121. package/dist/native/design-system/configs/spacex.json +68 -68
  122. package/dist/native/design-system/configs/spotify.json +89 -89
  123. package/dist/native/design-system/configs/stripe.json +88 -88
  124. package/dist/native/design-system/configs/tesla.json +75 -75
  125. package/dist/native/design-system/configs/uber.json +41 -41
  126. package/dist/native/design-system/configs/vercel.json +65 -65
  127. package/dist/native/design-system/types.d.ts +28 -0
  128. package/dist/native/pages/designSystem.page.js +103 -85
  129. package/dist/native/pages/designSystem.page.js.map +1 -1
  130. package/dist/web.cjs.js +8 -8
  131. package/dist/web.cjs.js.map +1 -1
  132. package/dist/web.esm.js +11786 -10987
  133. package/dist/web.esm.js.map +1 -1
  134. package/dist/web.umd.js +10 -10
  135. package/dist/web.umd.js.map +1 -1
  136. package/docs/README.md +1 -0
  137. package/docs/app-studio/Theming.md +7 -0
  138. package/docs/design-system/component-library.md +78 -42
  139. package/docs/design-system/llm-design-system.md +426 -0
  140. package/docs/design-system/theming.md +73 -13
  141. package/package.json +4 -4
@@ -53,7 +53,61 @@ You can also pin a single component to a specific mode using the `themeMode` pro
53
53
  <Badge themeMode="light">Always light</Badge>
54
54
  ```
55
55
 
56
- Brand configs declare their `defaultAppearance` in `metadata` (`light` or `dark`). The design-system showcase respects that when rendering each brand on its native canvas, but also renders an inverted PaletteFrame so you can see how the brand performs on the opposite surface.
56
+ Brand configs declare their `defaultAppearance` in `metadata` (`light` or `dark`). That value only decides **which mode the config opens in** — both modes work regardless (see §2.1). The design-system showcase respects `defaultAppearance` when rendering each brand on its native canvas, but also renders an inverted PaletteFrame so you can see the brand on the opposite surface.
57
+
58
+ ### 2.1 One config, both modes — the adaptive rule
59
+
60
+ You never write a separate dark config. A single `theme` block serves **both** light and dark, and the dark theme is **derived automatically**. What decides whether a slot flips or stays is the **form of the value** you give it — this is exactly what app-studio's `ThemeProvider` emits ([generateCSSVariables](../../../app-studio/src/providers/Theme.tsx)):
61
+
62
+ | Value you write in `theme.<slot>` | What app-studio emits | Behaviour when the mode switches |
63
+ |-----------------------------------|------------------------------|----------------------------------|
64
+ | A **raw hex** — `"#2563eb"` | `--theme-<slot>: #2563eb` | **Stays constant.** Identical in light and dark. |
65
+ | A **`color-*` token** — `"color-black"` | `--theme-<slot>: var(--color-black)` | **Flips automatically.** `color-black` → black in light, **white** in dark; `color-white` → black in dark; the `color-gray-*` ramp inverts. |
66
+
67
+ So the rule is:
68
+
69
+ > **Want the color to stay the same in both modes?** Use a **hex** — your brand identity (`primary`, `secondary`, status accents, `onPrimary`).
70
+ > **Want it to adapt when the mode flips?** Use a **`color-*` token** — your structural neutrals (`canvas`, `surface`, `text`, `muted`, `border`).
71
+
72
+ Recommended mapping for a config that works in both modes out of the box:
73
+
74
+ ```jsonc
75
+ "theme": {
76
+ "primary": "#2563eb", // hex → constant brand color
77
+ "secondary": "#7c3aed", // hex → constant
78
+ "success": "#16a34a", // hex → constant
79
+ "warning": "#d97706", // hex → constant
80
+ "error": "#dc2626", // hex → constant
81
+ "onPrimary": "#ffffff", // hex → constant (ink that sits on primary)
82
+
83
+ "canvas": "color-white", // → white in light, black in dark
84
+ "surface": "color-gray-50", // → #fafafa in light, near-black in dark
85
+ "text": "color-black", // → black in light, white in dark
86
+ "muted": "color-gray-500", // → readable mid-grey in both modes
87
+ "border": "color-gray-200" // → light hairline → dark hairline
88
+ }
89
+ ```
90
+
91
+ Because `theme-canvas` / `theme-text` / `theme-surface` / `theme-border` / `theme-muted` now point at auto-flipping palette variables, **every component that references those tokens adapts for free** — no `themeMode` branching in component code, no second config to maintain.
92
+
93
+ Two practical notes:
94
+
95
+ - **Brand slots don't flip, so they must read in *both* modes.** A `primary` chosen only for a white canvas can wash out on black. Pick a `primary` with ≥ 3:1 contrast against both `color-white` and `color-black` (most mid-tone brand colors already pass).
96
+ - **Use a neutral *family* for character.** Prefer a warmer or cooler grey while keeping auto-flip by swapping the family: `color-slate-*` (cool), `color-stone-*` (warm), `color-zinc-*`, `color-neutral-*`. The shade still inverts; only the hue changes.
97
+ - **For body ink, reference `theme-text` / `theme-muted` — never a constant brand slot** like `theme-secondary`. A constant dark `secondary` used as text becomes unreadable when the canvas turns dark.
98
+ - **`primary` and `onPrimary` must use the same *form*** — both hex, or both `color-*`. They are a fill/ink pair; if one flips and the other doesn't, the label disappears in one mode. For a black-or-white brand you may make *both* `color-*` (`primary: color-black`, `onPrimary: color-white`) so the CTA inverts authentically.
99
+
100
+ ### 2.2 Brand = fills, neutrals = foreground
101
+
102
+ The single rule that keeps **every** brand (including pure black/white ones) coherent on both light and dark surfaces:
103
+
104
+ > **Brand tokens (`theme-primary`, `theme-secondary`, …) are for *fills*** — they paint a background and pair with an `on*` ink. **Surface-contrasting foreground** (body text, outline borders, dividers, helper text) uses the **neutral** slots (`theme-text`, `theme-muted`, `theme-border`), which flip *with* the surface.
105
+
106
+ Why: a filled element brings its own background, so its `onPrimary` ink is always correct. But a foreground element (an outline border, a link, an active-tab label) sits *on* the surface — if you colour it with `theme-primary` and the brand's primary happens to equal the surface (a monochrome brand: black primary on a dark card), it vanishes. Neutral ink flips with the surface, so it is always readable.
107
+
108
+ A brand-coloured foreground accent (a link, an active-tab label, an alert icon) using `theme-primary` is fine **for chromatic brands**. For monochrome brands, use `theme-text` or a chromatic `theme-secondary` for those accents instead.
109
+
110
+ > **Note (resolver fix).** `theme-*` tokens flip correctly in **both** modes, including inside nested, mode-pinned providers (e.g. a "show on dark surface" frame). app-studio re-declares the token-referencing `--theme-*` variables inside the `[data-theme]` blocks so they re-substitute per mode — see [generateCSSVariables](../../../app-studio/src/providers/Theme.tsx). A `theme-text` foreground is therefore as reliable as a `color-black` one.
57
111
 
58
112
  ---
59
113
 
@@ -155,17 +209,22 @@ function Snippet() {
155
209
 
156
210
  Every slot has matching alpha-suffix variants: `theme-primary-100` (10% primary) through `theme-primary-1000` (100%). app-studio's resolver renders these as `color-mix(in srgb, var(--theme-primary) X%, transparent)`.
157
211
 
158
- Every brand provides all eleven. Use them in priority over neutral-scale tokens whenever the value should respect the brand.
212
+ Every brand provides all eleven. Use them in priority over neutral-scale tokens whenever the value should respect the brand. Which of these slots flip with the theme mode and which stay constant is decided by the config (see [§2.1](#21-one-config-both-modes--the-adaptive-rule)): the recommended setup makes `canvas`, `surface`, `text`, `muted`, `border` adaptive and keeps `primary`, `secondary`, `success`, `warning`, `error`, `onPrimary` constant.
159
213
 
160
- ### 4.2 Neutral / static colors
214
+ ### 4.2 Neutral / palette colors (`color-*`)
161
215
 
162
- For things that should stay constant across brands (utility chrome, debug overlays):
216
+ The `color-*` family is **brand-independent but theme-mode-aware** the same token resolves to different values in light vs dark:
163
217
 
164
- - `color-white`, `color-black`
165
- - `color-gray-50` through `color-gray-900`
218
+ - `color-white` (→ black in dark), `color-black` (→ white in dark)
219
+ - `color-gray-50` `color-gray-900` (the ramp inverts: `50` is lightest in light mode, darkest in dark mode), plus the tinted families `color-slate-*`, `color-stone-*`, `color-zinc-*`, `color-neutral-*`
166
220
  - `color-blue-*`, `color-green-*`, `color-red-*`, `color-yellow-*`, `color-purple-*`, `color-orange-*`, etc.
167
221
 
168
- These don't shift with the active brand. Use them sparingly anything user-visible should prefer `theme-*`.
222
+ You force a fixed mode with the `light-*` / `dark-*` prefix (`light-gray-100` stays light even in dark mode) — rarely needed.
223
+
224
+ Two ways to use them:
225
+
226
+ 1. **Inside a `theme` slot** (`"text": "color-black"`) — this is how you make a brand slot *adaptive* ([§2.1](#21-one-config-both-modes--the-adaptive-rule)).
227
+ 2. **Directly in a component** (`backgroundColor="color-gray-50"`) — for utility chrome that should track the mode but not the brand. Use sparingly; anything brand-facing should prefer `theme-*`.
169
228
 
170
229
  ### 4.3 The `'inherit'` keyword
171
230
 
@@ -280,16 +339,14 @@ For pages that need raw access to the brand:
280
339
  import { useDesignSystem } from 'src/design-system';
281
340
 
282
341
  function PageWithBrand() {
283
- const { config, configId, isEnabled } = useDesignSystem();
342
+ const { config, isEnabled } = useDesignSystem();
284
343
  if (!isEnabled) return null;
285
344
 
286
345
  return (
287
346
  <View
288
- style={{
289
- backgroundColor: config.theme.canvas,
290
- color: config.theme.text,
291
- fontFamily: config.tokens.typography.fontFamily,
292
- }}
347
+ backgroundColor="theme-canvas"
348
+ color="theme-text"
349
+ fontFamily={config.tokens.typography.fontFamily}
293
350
  >
294
351
  <Heading>{config.metadata.label}</Heading>
295
352
  </View>
@@ -297,6 +354,8 @@ function PageWithBrand() {
297
354
  }
298
355
  ```
299
356
 
357
+ > **Don't read `config.theme.canvas` / `config.theme.text` into a raw React `style={{}}`.** Those slots may hold token strings like `"color-white"` (adaptive), which the browser can't resolve as CSS. Pass them as app-studio **props** (`backgroundColor="theme-canvas"`) so the resolver turns them into the right per-mode value. Raw `config.theme.*` values are only safe in `style` when you know the brand pinned a literal hex.
358
+
300
359
  To pre-fetch one component's brand config (to compose a custom variant manually):
301
360
 
302
361
  ```tsx
@@ -330,6 +389,7 @@ For the common pattern of merging brand defaults with the user's explicit props
330
389
 
331
390
  ## See also
332
391
 
392
+ - [design-system.md](./design-system.md) — **step-by-step recipe to generate a new brand config** (agent-facing build instructions).
333
393
  - [component-library.md](./component-library.md) — how to author components and brand configs.
334
394
  - [src/design-system/types.ts](../../src/design-system/types.ts) — TypeScript types for `DesignSystemConfig`, `BrandPersonality`, all component slot maps.
335
395
  - [src/design-system/DesignSystemProvider.tsx](../../src/design-system/DesignSystemProvider.tsx) — provider source incl. CSS-var injection.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-studio/components",
3
- "version": "0.10.17",
3
+ "version": "0.10.19",
4
4
  "main": "dist/web.cjs.js",
5
5
  "module": "dist/web.esm.js",
6
6
  "react-native": "dist/native/components/index.js",
@@ -130,9 +130,10 @@
130
130
  "@mdx-js/react": "^3.1.0",
131
131
  "@mdxeditor/editor": "^3.21.0",
132
132
  "@size-limit/preset-small-lib": "^10.0.2",
133
+ "@testing-library/dom": "^10.4.0",
133
134
  "@testing-library/jest-dom": "^5.17.0",
134
- "@testing-library/react": "^14.3.1",
135
- "@testing-library/user-event": "^13.5.0",
135
+ "@testing-library/react": "^16.1.0",
136
+ "@testing-library/user-event": "^14.5.2",
136
137
  "@types/compression": "^1.8.1",
137
138
  "@types/jest": "^27.5.2",
138
139
  "@types/node": "^20.0.0",
@@ -171,7 +172,6 @@
171
172
  "prettier": "^2.8.8",
172
173
  "react": "^19.0.0",
173
174
  "react-dom": "^19.0.0",
174
- "react-helmet": "^6.1.0",
175
175
  "react-native": "^0.85.3",
176
176
  "react-native-linear-gradient": "^2.8.3",
177
177
  "react-native-reanimated": "^4.3.1",