react-native-terra-ui 0.7.2 → 0.8.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 (252) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -1
  3. package/lib/module/components/avatar/Avatar.js +20 -20
  4. package/lib/module/components/avatar/Avatar.js.map +1 -1
  5. package/lib/module/components/button/Button.js +11 -11
  6. package/lib/module/components/button/Button.js.map +1 -1
  7. package/lib/module/components/chip/Chip.js +32 -32
  8. package/lib/module/components/chip/Chip.js.map +1 -1
  9. package/lib/module/components/empty-state/EmptyState.js +3 -3
  10. package/lib/module/components/empty-state/EmptyState.js.map +1 -1
  11. package/lib/module/components/header/variants/LargeTitleHeader/index.js +30 -32
  12. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
  13. package/lib/module/components/header/variants/TitleHeader/index.js +26 -18
  14. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
  15. package/lib/module/components/icon/Icon.js +3 -3
  16. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +2 -2
  17. package/lib/module/components/screen/Screen.js +63 -34
  18. package/lib/module/components/screen/Screen.js.map +1 -1
  19. package/lib/module/components/screen/ScreenContext.js +28 -9
  20. package/lib/module/components/screen/ScreenContext.js.map +1 -1
  21. package/lib/module/components/screen/ScreenFlatList.js +4 -162
  22. package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
  23. package/lib/module/components/screen/ScreenList.js +81 -97
  24. package/lib/module/components/screen/ScreenList.js.map +1 -1
  25. package/lib/module/components/screen/ScreenScrollView.js +64 -115
  26. package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
  27. package/lib/module/components/screen/hooks/use-screen-ref.js +18 -0
  28. package/lib/module/components/screen/hooks/use-screen-ref.js.map +1 -0
  29. package/lib/module/components/screen/hooks/use-screen-scroll-handler.js +19 -0
  30. package/lib/module/components/screen/hooks/use-screen-scroll-handler.js.map +1 -0
  31. package/lib/module/components/screen/index.js.map +1 -1
  32. package/lib/module/components/screen/parts/ScreenFrame.js +47 -0
  33. package/lib/module/components/screen/parts/ScreenFrame.js.map +1 -0
  34. package/lib/module/components/screen/parts/ScreenHeaderAppearance.js +43 -0
  35. package/lib/module/components/screen/parts/ScreenHeaderAppearance.js.map +1 -0
  36. package/lib/module/components/screen/parts/ScreenPlaceholder.js +11 -13
  37. package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
  38. package/lib/module/components/screen/parts/ScreenSafeArea.android.js +27 -0
  39. package/lib/module/components/screen/parts/ScreenSafeArea.android.js.map +1 -0
  40. package/lib/module/components/screen/parts/ScreenSafeArea.js +26 -0
  41. package/lib/module/components/screen/parts/ScreenSafeArea.js.map +1 -0
  42. package/lib/module/components/screen/utils.js +18 -9
  43. package/lib/module/components/screen/utils.js.map +1 -1
  44. package/lib/module/components/spinner/Spinner.js +2 -2
  45. package/lib/module/components/text/Text.js +1 -1
  46. package/lib/module/components/toast/Toast.js +13 -13
  47. package/lib/module/components/toast/Toast.js.map +1 -1
  48. package/lib/module/components/toolbar/Toolbar.js +2 -2
  49. package/lib/module/context/ThemeProvider.js +22 -39
  50. package/lib/module/context/ThemeProvider.js.map +1 -1
  51. package/lib/module/context/index.js +1 -1
  52. package/lib/module/context/index.js.map +1 -1
  53. package/lib/module/theme/breakpoints.js +1 -1
  54. package/lib/module/theme/define-config.js +21 -0
  55. package/lib/module/theme/define-config.js.map +1 -0
  56. package/lib/module/theme/diagnostics.js +13 -0
  57. package/lib/module/theme/diagnostics.js.map +1 -0
  58. package/lib/module/theme/errors.js +15 -0
  59. package/lib/module/theme/errors.js.map +1 -0
  60. package/lib/module/theme/index.js +7 -1
  61. package/lib/module/theme/index.js.map +1 -1
  62. package/lib/module/theme/legacy-tokens.js +119 -0
  63. package/lib/module/theme/legacy-tokens.js.map +1 -0
  64. package/lib/module/theme/registry.js +122 -130
  65. package/lib/module/theme/registry.js.map +1 -1
  66. package/lib/module/theme/resolve-config.js +346 -0
  67. package/lib/module/theme/resolve-config.js.map +1 -0
  68. package/lib/module/theme/runtime.js +57 -12
  69. package/lib/module/theme/runtime.js.map +1 -1
  70. package/lib/module/theme/screen-margin.js +6 -14
  71. package/lib/module/theme/screen-margin.js.map +1 -1
  72. package/lib/module/theme/screen-padding.js +17 -0
  73. package/lib/module/theme/screen-padding.js.map +1 -0
  74. package/lib/module/theme/selection-store.js +75 -0
  75. package/lib/module/theme/selection-store.js.map +1 -0
  76. package/lib/module/theme/theme.js +81 -36
  77. package/lib/module/theme/theme.js.map +1 -1
  78. package/lib/module/theme/tokens/canonical-color-keys.js +102 -0
  79. package/lib/module/theme/tokens/canonical-color-keys.js.map +1 -0
  80. package/lib/module/theme/tokens/dark.js +72 -88
  81. package/lib/module/theme/tokens/dark.js.map +1 -1
  82. package/lib/module/theme/tokens/light.js +69 -83
  83. package/lib/module/theme/tokens/light.js.map +1 -1
  84. package/lib/module/theme/tokens/primitives.js +14 -14
  85. package/lib/module/theme/tokens/primitives.js.map +1 -1
  86. package/lib/module/theme/tokens/validate.js +238 -0
  87. package/lib/module/theme/tokens/validate.js.map +1 -0
  88. package/lib/module/theme/unistyles-adapter.js +77 -0
  89. package/lib/module/theme/unistyles-adapter.js.map +1 -0
  90. package/lib/module/utils/accent-generator.js +476 -0
  91. package/lib/module/utils/accent-generator.js.map +1 -0
  92. package/lib/module/utils/accent-utils.js +52 -35
  93. package/lib/module/utils/accent-utils.js.map +1 -1
  94. package/lib/module/utils/color-utils.js +224 -7
  95. package/lib/module/utils/color-utils.js.map +1 -1
  96. package/lib/module/utils/deep-merge.js +1 -1
  97. package/lib/module/utils/deep-merge.js.map +1 -1
  98. package/lib/module/utils/resolve-theme-color.js +2 -2
  99. package/lib/typescript/src/components/chip/types.d.ts +1 -1
  100. package/lib/typescript/src/components/empty-state/EmptyState.d.ts +1 -1
  101. package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -1
  102. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +6 -5
  103. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
  104. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +11 -5
  105. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
  106. package/lib/typescript/src/components/icon/Icon.d.ts +2 -2
  107. package/lib/typescript/src/components/screen/Screen.d.ts +45 -16
  108. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
  109. package/lib/typescript/src/components/screen/ScreenContext.d.ts +42 -26
  110. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
  111. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +5 -46
  112. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
  113. package/lib/typescript/src/components/screen/ScreenList.d.ts +62 -50
  114. package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
  115. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +18 -58
  116. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
  117. package/lib/typescript/src/components/screen/hooks/use-screen-ref.d.ts +5 -0
  118. package/lib/typescript/src/components/screen/hooks/use-screen-ref.d.ts.map +1 -0
  119. package/lib/typescript/src/components/screen/hooks/use-screen-scroll-handler.d.ts +53 -0
  120. package/lib/typescript/src/components/screen/hooks/use-screen-scroll-handler.d.ts.map +1 -0
  121. package/lib/typescript/src/components/screen/index.d.ts +2 -2
  122. package/lib/typescript/src/components/screen/index.d.ts.map +1 -1
  123. package/lib/typescript/src/components/screen/parts/ScreenFrame.d.ts +6 -0
  124. package/lib/typescript/src/components/screen/parts/ScreenFrame.d.ts.map +1 -0
  125. package/lib/typescript/src/components/screen/parts/ScreenHeaderAppearance.d.ts +21 -0
  126. package/lib/typescript/src/components/screen/parts/ScreenHeaderAppearance.d.ts.map +1 -0
  127. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +6 -8
  128. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
  129. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.android.d.ts +7 -0
  130. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.android.d.ts.map +1 -0
  131. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.d.ts +6 -0
  132. package/lib/typescript/src/components/screen/parts/ScreenSafeArea.d.ts.map +1 -0
  133. package/lib/typescript/src/components/screen/types.d.ts +27 -32
  134. package/lib/typescript/src/components/screen/types.d.ts.map +1 -1
  135. package/lib/typescript/src/components/screen/utils.d.ts +9 -8
  136. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
  137. package/lib/typescript/src/components/text/Text.d.ts +1 -1
  138. package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
  139. package/lib/typescript/src/components/toolbar/Toolbar.d.ts +2 -2
  140. package/lib/typescript/src/context/ThemeProvider.d.ts +29 -12
  141. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  142. package/lib/typescript/src/context/index.d.ts +1 -1
  143. package/lib/typescript/src/context/index.d.ts.map +1 -1
  144. package/lib/typescript/src/theme/breakpoints.d.ts +1 -1
  145. package/lib/typescript/src/theme/define-config.d.ts +23 -0
  146. package/lib/typescript/src/theme/define-config.d.ts.map +1 -0
  147. package/lib/typescript/src/theme/diagnostics.d.ts +4 -0
  148. package/lib/typescript/src/theme/diagnostics.d.ts.map +1 -0
  149. package/lib/typescript/src/theme/errors.d.ts +10 -0
  150. package/lib/typescript/src/theme/errors.d.ts.map +1 -0
  151. package/lib/typescript/src/theme/index.d.ts +10 -2
  152. package/lib/typescript/src/theme/index.d.ts.map +1 -1
  153. package/lib/typescript/src/theme/legacy-tokens.d.ts +187 -0
  154. package/lib/typescript/src/theme/legacy-tokens.d.ts.map +1 -0
  155. package/lib/typescript/src/theme/registry.d.ts +12 -17
  156. package/lib/typescript/src/theme/registry.d.ts.map +1 -1
  157. package/lib/typescript/src/theme/resolve-config.d.ts +99 -0
  158. package/lib/typescript/src/theme/resolve-config.d.ts.map +1 -0
  159. package/lib/typescript/src/theme/runtime.d.ts +25 -4
  160. package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
  161. package/lib/typescript/src/theme/screen-margin.d.ts +6 -14
  162. package/lib/typescript/src/theme/screen-margin.d.ts.map +1 -1
  163. package/lib/typescript/src/theme/screen-padding.d.ts +15 -0
  164. package/lib/typescript/src/theme/screen-padding.d.ts.map +1 -0
  165. package/lib/typescript/src/theme/selection-store.d.ts +41 -0
  166. package/lib/typescript/src/theme/selection-store.d.ts.map +1 -0
  167. package/lib/typescript/src/theme/theme.d.ts +54 -1
  168. package/lib/typescript/src/theme/theme.d.ts.map +1 -1
  169. package/lib/typescript/src/theme/tokens/canonical-color-keys.d.ts +95 -0
  170. package/lib/typescript/src/theme/tokens/canonical-color-keys.d.ts.map +1 -0
  171. package/lib/typescript/src/theme/tokens/dark.d.ts +56 -63
  172. package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -1
  173. package/lib/typescript/src/theme/tokens/light.d.ts +56 -71
  174. package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -1
  175. package/lib/typescript/src/theme/tokens/primitives.d.ts +11 -10
  176. package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
  177. package/lib/typescript/src/theme/tokens/validate.d.ts +34 -0
  178. package/lib/typescript/src/theme/tokens/validate.d.ts.map +1 -0
  179. package/lib/typescript/src/theme/types.d.ts +166 -86
  180. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  181. package/lib/typescript/src/theme/unistyles-adapter.d.ts +33 -0
  182. package/lib/typescript/src/theme/unistyles-adapter.d.ts.map +1 -0
  183. package/lib/typescript/src/utils/accent-generator.d.ts +103 -0
  184. package/lib/typescript/src/utils/accent-generator.d.ts.map +1 -0
  185. package/lib/typescript/src/utils/accent-utils.d.ts +15 -2
  186. package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
  187. package/lib/typescript/src/utils/color-utils.d.ts +59 -2
  188. package/lib/typescript/src/utils/color-utils.d.ts.map +1 -1
  189. package/lib/typescript/src/utils/deep-merge.d.ts +1 -0
  190. package/lib/typescript/src/utils/deep-merge.d.ts.map +1 -1
  191. package/lib/typescript/src/utils/resolve-theme-color.d.ts +2 -2
  192. package/package.json +1 -1
  193. package/src/components/avatar/Avatar.tsx +20 -20
  194. package/src/components/button/Button.tsx +11 -11
  195. package/src/components/chip/Chip.tsx +32 -32
  196. package/src/components/chip/types.ts +1 -1
  197. package/src/components/empty-state/EmptyState.tsx +4 -4
  198. package/src/components/header/variants/LargeTitleHeader/index.tsx +31 -30
  199. package/src/components/header/variants/TitleHeader/index.tsx +33 -22
  200. package/src/components/icon/Icon.tsx +4 -4
  201. package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +2 -2
  202. package/src/components/screen/Screen.tsx +89 -43
  203. package/src/components/screen/ScreenContext.tsx +48 -28
  204. package/src/components/screen/ScreenFlatList.tsx +5 -191
  205. package/src/components/screen/ScreenList.tsx +197 -175
  206. package/src/components/screen/ScreenScrollView.tsx +92 -167
  207. package/src/components/screen/hooks/use-screen-ref.ts +24 -0
  208. package/src/components/screen/hooks/use-screen-scroll-handler.ts +31 -0
  209. package/src/components/screen/index.ts +8 -2
  210. package/src/components/screen/parts/ScreenFrame.tsx +49 -0
  211. package/src/components/screen/parts/ScreenHeaderAppearance.tsx +52 -0
  212. package/src/components/screen/parts/ScreenPlaceholder.tsx +16 -16
  213. package/src/components/screen/parts/ScreenSafeArea.android.tsx +22 -0
  214. package/src/components/screen/parts/ScreenSafeArea.tsx +20 -0
  215. package/src/components/screen/types.ts +29 -32
  216. package/src/components/screen/utils.ts +24 -11
  217. package/src/components/spinner/Spinner.tsx +2 -2
  218. package/src/components/text/Text.tsx +2 -2
  219. package/src/components/toast/Toast.tsx +13 -13
  220. package/src/components/toolbar/Toolbar.tsx +4 -4
  221. package/src/context/ThemeProvider.tsx +47 -51
  222. package/src/context/index.ts +1 -1
  223. package/src/theme/breakpoints.ts +1 -1
  224. package/src/theme/define-config.ts +27 -0
  225. package/src/theme/diagnostics.ts +11 -0
  226. package/src/theme/errors.ts +14 -0
  227. package/src/theme/index.ts +40 -1
  228. package/src/theme/legacy-tokens.ts +227 -0
  229. package/src/theme/registry.ts +119 -137
  230. package/src/theme/resolve-config.ts +406 -0
  231. package/src/theme/runtime.ts +52 -14
  232. package/src/theme/screen-margin.ts +6 -25
  233. package/src/theme/screen-padding.ts +26 -0
  234. package/src/theme/selection-store.ts +76 -0
  235. package/src/theme/theme.ts +104 -39
  236. package/src/theme/tokens/canonical-color-keys.ts +107 -0
  237. package/src/theme/tokens/dark.ts +91 -98
  238. package/src/theme/tokens/light.ts +88 -93
  239. package/src/theme/tokens/primitives.ts +14 -14
  240. package/src/theme/tokens/validate.ts +271 -0
  241. package/src/theme/types.ts +184 -95
  242. package/src/theme/unistyles-adapter.ts +75 -0
  243. package/src/utils/accent-generator.ts +530 -0
  244. package/src/utils/accent-utils.ts +66 -39
  245. package/src/utils/color-utils.ts +225 -8
  246. package/src/utils/deep-merge.ts +1 -1
  247. package/src/utils/resolve-theme-color.ts +2 -2
  248. package/lib/module/components/screen/parts/BottomSafeArea.js +0 -62
  249. package/lib/module/components/screen/parts/BottomSafeArea.js.map +0 -1
  250. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts +0 -30
  251. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +0 -1
  252. package/src/components/screen/parts/BottomSafeArea.tsx +0 -59
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Pure, deterministic accent generation from a single seed color.
3
+ *
4
+ * Consumed by the resolver (`theme/resolve-config.ts`) for startup, runtime
5
+ * accent changes and `createTerraThemes`, and by the `normalizeAccent`
6
+ * compatibility wrapper. Must not import the registry, provider, Unistyles,
7
+ * or renderers — only `#theme/types` and the colour maths in `./color-utils`.
8
+ *
9
+ * ## Algorithm
10
+ *
11
+ * Every role is derived in OKLCH (Björn Ottosson's OKLab, in-house
12
+ * implementation in `./color-utils`): the seed's hue is kept for every role,
13
+ * chroma is capped per role and reduced further by sRGB gamut mapping, and
14
+ * perceptual lightness is *solved* per role against the scheme's actual
15
+ * ordinary surfaces so that WCAG 2.x targets are met (4.5:1 for text and
16
+ * solid/soft labels, 3:1 for the accent border). Contrast is evaluated with
17
+ * sRGB alpha compositing over each of the four surfaces and, for solid
18
+ * controls, additionally with the pressed opacity applied to the whole control.
19
+ *
20
+ * - `accent.solid.bg` keeps the seed exactly when black or white text reads on
21
+ * it at both opacities; otherwise the fill is moved the smallest lightness
22
+ * distance (ties prefer darker in light, lighter in dark) until a readable
23
+ * label exists — so the fill MAY differ from the seed. Pin `accent.solid.bg`
24
+ * through overrides for an exact fill.
25
+ * - `accent.solid.fg` is a tinted near-black or near-white (pure black/white
26
+ * when the tint would not reach 4.5:1) picked by contrast, not brightness.
27
+ * - Hover/pressed fills darken in light and lighten in dark (mirroring the
28
+ * built-in tokens); the direction flips only where following the scheme
29
+ * would break the label contrast or leave the lightness range.
30
+ * - `accent.soft.bg` is a light tint in light / dark tint in dark, placed
31
+ * relative to the surfaces; `accent.soft.fg` is solved on all three soft
32
+ * states. `accent.text` (and `text.link`, the existing shorthand) is solved
33
+ * on every surface; `accent.border` is solved to 3:1 on every surface.
34
+ * - Disabled fills are desaturated and low-contrast-but-visible, in the
35
+ * spirit of the default `slate.200`/`slate.700`-like tokens.
36
+ *
37
+ * Unsatisfiable pairs (e.g. one very light and one very dark surface) are
38
+ * reported as `unsatisfied` diagnostics with the best deterministic colour
39
+ * kept; unparseable surfaces are excluded from solving and reported as
40
+ * `unsupported`. Nothing ever falls back to white silently.
41
+ *
42
+ */
43
+ import type { CanonicalThemeColor, Scheme } from "../theme/types";
44
+ /** Every canonical role a seed generates. `text.link` is kept for the existing shorthand behaviour. */
45
+ export type GeneratedAccentRole = "accent.text" | "accent.border" | "accent.solid.bg" | "accent.solid.bg.hover" | "accent.solid.bg.pressed" | "accent.solid.bg.disabled" | "accent.solid.fg" | "accent.soft.bg" | "accent.soft.bg.hover" | "accent.soft.bg.pressed" | "accent.soft.bg.disabled" | "accent.soft.fg" | "text.link";
46
+ export declare const GENERATED_ACCENT_ROLES: readonly GeneratedAccentRole[];
47
+ export type AccentSurfaceRole = "surface.canvas" | "surface.default" | "surface.raised" | "surface.sunken";
48
+ /** The four ordinary surfaces every accent pair is evaluated over, in a fixed order. */
49
+ export declare const ACCENT_SURFACE_ROLES: readonly AccentSurfaceRole[];
50
+ /**
51
+ * The resolved scheme context a generator needs: the scheme's actual ordinary
52
+ * surfaces (after defaults, shared and scheme patches) and the opacity that
53
+ * components apply to a whole pressed control.
54
+ */
55
+ export interface AccentGenerationContext {
56
+ scheme: Scheme;
57
+ surfaces: Record<AccentSurfaceRole, string>;
58
+ pressedOpacity: number;
59
+ }
60
+ /**
61
+ * `unsatisfied` — the pair was evaluated and fell below `required`.
62
+ * `unsupported` — a colour could not be evaluated (non-sRGB/opaque format);
63
+ * `ratio` is `null` and no accessibility claim is made.
64
+ */
65
+ export type ContrastDiagnosticKind = "unsatisfied" | "unsupported";
66
+ export interface ContrastDiagnostic {
67
+ kind: ContrastDiagnosticKind;
68
+ /** Foreground role checked, e.g. `accent.solid.fg` or `accent.text`. */
69
+ role: string;
70
+ /** Background role the foreground sits on, e.g. `accent.solid.bg` or `surface.canvas`. */
71
+ background: string;
72
+ /** Ordinary surface the pair was composited over. */
73
+ surface: AccentSurfaceRole;
74
+ /** Opacity applied to the whole control for this check (1 when none). */
75
+ opacity: number;
76
+ ratio: number | null;
77
+ required: number;
78
+ message: string;
79
+ }
80
+ export interface AccentGenerationResult {
81
+ colors: Record<GeneratedAccentRole, string>;
82
+ /** Pairs the generator could not satisfy or evaluate in the supported domain. */
83
+ diagnostics: ContrastDiagnostic[];
84
+ }
85
+ /** Whether `value` is an opaque six-digit sRGB hex seed (`#rrggbb`, case-insensitive). */
86
+ export declare function isSupportedAccentSeed(value: unknown): value is string;
87
+ /** WCAG 2.x minimum for normal text and solid/soft labels. */
88
+ export declare const ACCENT_TEXT_CONTRAST = 4.5;
89
+ /** WCAG 2.x minimum for a meaningful accent boundary on an ordinary surface. */
90
+ export declare const ACCENT_BORDER_CONTRAST = 3;
91
+ /**
92
+ * Generates every {@link GeneratedAccentRole} for `seed` in the given scheme
93
+ * context. Pure and deterministic: same inputs → same output. Callers must
94
+ * validate the seed with {@link isSupportedAccentSeed} first.
95
+ */
96
+ export declare function generateAccentColors(seed: string, context: AccentGenerationContext): AccentGenerationResult;
97
+ /**
98
+ * Evaluates the final accent roles (after explicit overrides) against their
99
+ * intended backgrounds in the supported domain and returns the failing or
100
+ * unevaluable pairs. Never repairs a colour.
101
+ */
102
+ export declare function checkAccentContrast(colors: Pick<CanonicalThemeColor, GeneratedAccentRole>, context: AccentGenerationContext): ContrastDiagnostic[];
103
+ //# sourceMappingURL=accent-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accent-generator.d.ts","sourceRoot":"","sources":["../../../../src/utils/accent-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAYhE,uGAAuG;AACvG,MAAM,MAAM,mBAAmB,GAC3B,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,uBAAuB,GACvB,yBAAyB,GACzB,0BAA0B,GAC1B,iBAAiB,GACjB,gBAAgB,GAChB,sBAAsB,GACtB,wBAAwB,GACxB,yBAAyB,GACzB,gBAAgB,GAChB,WAAW,CAAC;AAEhB,eAAO,MAAM,sBAAsB,EAAE,SAAS,mBAAmB,EAchE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAE3G,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,EAAE,SAAS,iBAAiB,EAK5D,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,aAAa,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,UAAU,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC5C,iFAAiF;IACjF,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC;AAED,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAErE;AAID,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,IAAI,CAAC;AA8JxC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAiI3G;AA+BD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,EACtD,OAAO,EAAE,uBAAuB,GAC/B,kBAAkB,EAAE,CAqDtB"}
@@ -1,4 +1,17 @@
1
- import type { Accent, NormalizedAccent } from "../theme/types";
2
- /** Normalizes any accent input into per-scheme partial-theme overrides. */
1
+ import type { Accent, NormalizedAccent, Scheme } from "../theme/types";
2
+ import { type AccentGenerationContext } from "./accent-generator.js";
3
+ /**
4
+ * The generation context of a built-in default theme: its four ordinary
5
+ * surfaces and pressed opacity. Used by the {@link normalizeAccent}
6
+ * compatibility wrapper, which has no access to shared/scheme patches.
7
+ */
8
+ export declare function defaultAccentContext(scheme: Scheme): AccentGenerationContext;
9
+ /**
10
+ * Compatibility wrapper: normalizes any accent input into per-scheme
11
+ * partial-theme overrides. Strings and `{ seed, overrides }` are generated
12
+ * against the DEFAULT themes' surfaces and pressed opacity (the resolver
13
+ * pipeline uses the actual resolved surfaces instead); full theme patches
14
+ * pass through unchanged. Pure and independent of the registry.
15
+ */
3
16
  export declare function normalizeAccent(accent: Accent): NormalizedAccent;
4
17
  //# sourceMappingURL=accent-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accent-utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/accent-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAmB,gBAAgB,EAAc,MAAM,cAAc,CAAC;AAuC1F,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAQhE"}
1
+ {"version":3,"file":"accent-utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/accent-utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,MAAM,EAEN,gBAAgB,EAChB,MAAM,EAGP,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,uBAAuB,EAG7B,MAAM,uBAAoB,CAAC;AAG5B;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAK5E;AAkCD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAKhE"}
@@ -1,4 +1,61 @@
1
- /** Small color helpers for deriving accent shades from a single hue. */
1
+ /**
2
+ * Colour helpers shared by the accent generator, the contrast diagnostics and
3
+ * the public `shade` / `withAlpha` / `readableOn` utilities.
4
+ *
5
+ * Everything here is pure sRGB maths with no runtime dependency:
6
+ * - parsing of `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` and `rgba()`,
7
+ * - WCAG 2.x relative luminance / contrast with sRGB alpha compositing,
8
+ * - OKLab / OKLCH conversions (Björn Ottosson's published matrices) with
9
+ * sRGB gamut mapping by chroma reduction at constant lightness and hue.
10
+ */
11
+ export interface RGB {
12
+ r: number;
13
+ g: number;
14
+ b: number;
15
+ }
16
+ /** A parsed sRGB colour with 0-255 channels and a 0-1 alpha. */
17
+ export interface RGBA extends RGB {
18
+ a: number;
19
+ }
20
+ /** OKLCH coordinates: L in [0, 1], C ≥ 0, h in degrees [0, 360). */
21
+ export interface OKLCH {
22
+ l: number;
23
+ c: number;
24
+ h: number;
25
+ }
26
+ /** Formats 0-255 channels as a lowercase `#rrggbb` string (channels are rounded and clamped). */
27
+ export declare function rgbToHex(rgb: RGB): string;
28
+ /**
29
+ * Parses an sRGB colour string. Accepts `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`
30
+ * (case-insensitive) and `rgb(r, g, b)` / `rgba(r, g, b, a)` with integer or
31
+ * percentage channels. Returns `null` for anything else (named colours,
32
+ * `transparent`, hsl(), gradients, platform dynamic colours, ...).
33
+ */
34
+ export declare function parseColor(value: unknown): RGBA | null;
35
+ /** Source-over compositing of `front` at `alpha` onto an opaque `back`, in gamma-encoded sRGB. */
36
+ export declare function compositeOver(front: RGB, back: RGB, alpha: number): RGB;
37
+ /** WCAG 2.x relative luminance of an opaque sRGB colour (0-255 channels). */
38
+ export declare function relativeLuminance(rgb: RGB): number;
39
+ /** WCAG 2.x contrast ratio between two opaque sRGB colours (≥ 1). */
40
+ export declare function contrastRatio(a: RGB, b: RGB): number;
41
+ /**
42
+ * Contrast of a foreground on a background, both composited over an opaque
43
+ * `surface`, with `opacity` applied to the whole control afterwards (the way a
44
+ * pressed Button or Toast action fades as one unit). Matches the reference
45
+ * calculation in `theme/__tests__/color-contrast.test.ts`.
46
+ */
47
+ export declare function compositedContrast(fg: RGBA, bg: RGBA, surface: RGB, opacity?: number): number;
48
+ /** Converts 0-255 sRGB channels to OKLCH. Achromatic input yields `c ≈ 0` and `h = 0`. */
49
+ export declare function rgbToOklch(rgb: RGB): OKLCH;
50
+ /**
51
+ * Converts OKLCH to 0-255 sRGB channels. Colours outside the sRGB gamut are
52
+ * mapped by reducing chroma at constant lightness and hue (binary search)
53
+ * until they fit, so the requested lightness — what the contrast targets
54
+ * depend on — is preserved as closely as the gamut allows.
55
+ */
56
+ export declare function oklchToRgb(color: OKLCH): RGB;
57
+ /** `oklchToRgb` followed by `rgbToHex`. */
58
+ export declare function oklchToHex(color: OKLCH): string;
2
59
  /**
3
60
  * Shifts a hex color toward black (negative `amount`) or white (positive),
4
61
  * by a fraction in [-1, 1]. Returns the input unchanged if not a 6-digit hex.
@@ -6,6 +63,6 @@
6
63
  export declare function shade(hex: string, amount: number): string;
7
64
  /** Returns an `rgba(...)` string for a hex color at the given alpha. */
8
65
  export declare function withAlpha(hex: string, alpha: number): string;
9
- /** Picks black or white for legible text/icons on top of `hex`. */
66
+ /** Picks the higher-contrast black/white foreground for an opaque 6-digit hex. */
10
67
  export declare function readableOn(hex: string): string;
11
68
  //# sourceMappingURL=color-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/color-utils.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAoBxE;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUzD;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9C"}
1
+ {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../../src/utils/color-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,gEAAgE;AAChE,MAAM,WAAW,IAAK,SAAQ,GAAG;IAC/B,CAAC,EAAE,MAAM,CAAC;CACX;AAED,oEAAoE;AACpE,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAeD,iGAAiG;AACjG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CA8CtD;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAOvE;AAYD,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAIlD;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAIpD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,SAAI,GAAG,MAAM,CAOxF;AA6BD,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAU1C;AAYD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAqB5C;AAED,2CAA2C;AAC3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE/C;AAID;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUzD;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO9C"}
@@ -2,6 +2,7 @@
2
2
  export type DeepPartial<T> = T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? {
3
3
  [K in keyof T]?: DeepPartial<T[K]>;
4
4
  } : T;
5
+ export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
5
6
  /**
6
7
  * Deep-merges `override` onto `base`, returning a new object.
7
8
  * Plain objects merge recursively; all other values (and arrays) replace.
@@ -1 +1 @@
1
- {"version":3,"file":"deep-merge.d.ts","sourceRoot":"","sources":["../../../../src/utils/deep-merge.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC9C,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAQR;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAiBlE"}
1
+ {"version":3,"file":"deep-merge.d.ts","sourceRoot":"","sources":["../../../../src/utils/deep-merge.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC9C,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAER,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAI3B,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAiBlE"}
@@ -4,8 +4,8 @@ import type { ColorToken, TerraTheme } from "../theme/types";
4
4
  * Raw literals pass through unchanged.
5
5
  *
6
6
  * @example
7
- * resolveThemeColor('text.default', theme) // → '#020618'
8
- * resolveThemeColor('action.bg.primary', theme) // → '#009966'
7
+ * resolveThemeColor('text.primary', theme) // → '#020618'
8
+ * resolveThemeColor('accent.solid.bg', theme) // → '#009966'
9
9
  * resolveThemeColor('#ff0000', theme) // → '#ff0000'
10
10
  */
11
11
  export declare function resolveThemeColor(token: ColorToken | undefined, theme: TerraTheme): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-terra-ui",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "Themeable React Native UI components built on react-native-unistyles",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -149,80 +149,80 @@ const styles = StyleSheet.create((theme) => {
149
149
  color: "secondary",
150
150
  variant: "solid",
151
151
  styles: {
152
- backgroundColor: c["action.bg.secondary"],
153
- color: c["action.fg.secondary"],
152
+ backgroundColor: c["neutral.solid.bg"],
153
+ color: c["neutral.solid.fg"],
154
154
  },
155
155
  },
156
156
  {
157
157
  color: "secondary",
158
158
  variant: "soft",
159
159
  styles: {
160
- backgroundColor: c["action.bg.secondary.subtle"],
161
- color: c["action.fg.secondary.subtle"],
160
+ backgroundColor: c["neutral.soft.bg"],
161
+ color: c["neutral.soft.fg"],
162
162
  },
163
163
  },
164
164
  {
165
165
  color: "primary",
166
166
  variant: "solid",
167
167
  styles: {
168
- backgroundColor: c["action.bg.primary"],
169
- color: c["action.fg.primary"],
168
+ backgroundColor: c["accent.solid.bg"],
169
+ color: c["accent.solid.fg"],
170
170
  },
171
171
  },
172
172
  {
173
173
  color: "primary",
174
174
  variant: "soft",
175
175
  styles: {
176
- backgroundColor: c["action.bg.primary.subtle"],
177
- color: c["action.fg.primary.subtle"],
176
+ backgroundColor: c["accent.soft.bg"],
177
+ color: c["accent.soft.fg"],
178
178
  },
179
179
  },
180
180
  {
181
181
  color: "success",
182
182
  variant: "solid",
183
183
  styles: {
184
- backgroundColor: c["status.success.bg"],
185
- color: c["status.success.fg"],
184
+ backgroundColor: c["success.solid.bg"],
185
+ color: c["success.solid.fg"],
186
186
  },
187
187
  },
188
188
  {
189
189
  color: "success",
190
190
  variant: "soft",
191
191
  styles: {
192
- backgroundColor: c["status.success.bg.subtle"],
193
- color: c["status.success.fg.subtle"],
192
+ backgroundColor: c["success.soft.bg"],
193
+ color: c["success.soft.fg"],
194
194
  },
195
195
  },
196
196
  {
197
197
  color: "warning",
198
198
  variant: "solid",
199
199
  styles: {
200
- backgroundColor: c["status.warning.bg"],
201
- color: c["status.warning.fg"],
200
+ backgroundColor: c["warning.solid.bg"],
201
+ color: c["warning.solid.fg"],
202
202
  },
203
203
  },
204
204
  {
205
205
  color: "warning",
206
206
  variant: "soft",
207
207
  styles: {
208
- backgroundColor: c["status.warning.bg.subtle"],
209
- color: c["status.warning.fg.subtle"],
208
+ backgroundColor: c["warning.soft.bg"],
209
+ color: c["warning.soft.fg"],
210
210
  },
211
211
  },
212
212
  {
213
213
  color: "danger",
214
214
  variant: "solid",
215
215
  styles: {
216
- backgroundColor: c["status.danger.bg"],
217
- color: c["status.danger.fg"],
216
+ backgroundColor: c["danger.solid.bg"],
217
+ color: c["danger.solid.fg"],
218
218
  },
219
219
  },
220
220
  {
221
221
  color: "danger",
222
222
  variant: "soft",
223
223
  styles: {
224
- backgroundColor: c["status.danger.bg.subtle"],
225
- color: c["status.danger.fg.subtle"],
224
+ backgroundColor: c["danger.soft.bg"],
225
+ color: c["danger.soft.fg"],
226
226
  },
227
227
  },
228
228
  ],
@@ -70,38 +70,38 @@ function getColors(variant: ButtonVariant, theme: TerraTheme): ButtonColors {
70
70
  switch (variant) {
71
71
  case "primary":
72
72
  return {
73
- bg: get("action.bg.primary"),
74
- border: get("action.bg.primary"),
73
+ bg: get("accent.solid.bg"),
74
+ border: get("accent.solid.bg"),
75
75
  borderWidth: 0,
76
- fg: get("action.fg.primary"),
76
+ fg: get("accent.solid.fg"),
77
77
  };
78
78
  case "secondary":
79
79
  return {
80
- bg: get("action.bg.secondary"),
81
- border: get("action.bg.secondary"),
80
+ bg: get("neutral.solid.bg"),
81
+ border: get("neutral.solid.bg"),
82
82
  borderWidth: 0,
83
- fg: get("action.fg.secondary"),
83
+ fg: get("neutral.solid.fg"),
84
84
  };
85
85
  case "outline":
86
86
  return {
87
87
  bg: "transparent",
88
88
  border: get("border.default"),
89
89
  borderWidth: 1,
90
- fg: get("text.default"),
90
+ fg: get("text.primary"),
91
91
  };
92
92
  case "ghost":
93
93
  return {
94
94
  bg: "transparent",
95
95
  border: "transparent",
96
96
  borderWidth: 0,
97
- fg: get("text.default"),
97
+ fg: get("text.primary"),
98
98
  };
99
99
  case "danger":
100
100
  return {
101
- bg: get("status.danger.bg"),
102
- border: get("status.danger.bg"),
101
+ bg: get("danger.solid.bg"),
102
+ border: get("danger.solid.bg"),
103
103
  borderWidth: 0,
104
- fg: get("status.danger.fg"),
104
+ fg: get("danger.solid.fg"),
105
105
  };
106
106
  }
107
107
  }
@@ -31,7 +31,7 @@ interface ChipContextValue {
31
31
  }
32
32
 
33
33
  const ChipContext = createContext<ChipContextValue>({
34
- color: "text.default",
34
+ color: "text.primary",
35
35
  size: "md",
36
36
  });
37
37
 
@@ -66,29 +66,29 @@ function paintedVariant(variant: ChipVariant): ChipPaintedVariant {
66
66
  /** Foreground token per (scheme, variant) — mirrors the spec's token table. */
67
67
  const FG_TOKEN: Record<ChipScheme, Record<ChipPaintedVariant, ColorToken>> = {
68
68
  primary: {
69
- solid: "action.fg.primary",
70
- soft: "action.fg.primary.subtle",
71
- outline: "text.accent",
69
+ solid: "accent.solid.fg",
70
+ soft: "accent.soft.fg",
71
+ outline: "accent.text",
72
72
  },
73
73
  secondary: {
74
- solid: "action.fg.secondary",
75
- soft: "action.fg.secondary.subtle",
76
- outline: "text.default",
74
+ solid: "neutral.solid.fg",
75
+ soft: "neutral.soft.fg",
76
+ outline: "text.primary",
77
77
  },
78
78
  success: {
79
- solid: "status.success.fg",
80
- soft: "status.success.fg.subtle",
81
- outline: "status.success.fg.subtle",
79
+ solid: "success.solid.fg",
80
+ soft: "success.soft.fg",
81
+ outline: "success.soft.fg",
82
82
  },
83
83
  warning: {
84
- solid: "status.warning.fg",
85
- soft: "status.warning.fg.subtle",
86
- outline: "status.warning.fg.subtle",
84
+ solid: "warning.solid.fg",
85
+ soft: "warning.soft.fg",
86
+ outline: "warning.soft.fg",
87
87
  },
88
88
  danger: {
89
- solid: "status.danger.fg",
90
- soft: "status.danger.fg.subtle",
91
- outline: "status.danger.fg.subtle",
89
+ solid: "danger.solid.fg",
90
+ soft: "danger.soft.fg",
91
+ outline: "danger.soft.fg",
92
92
  },
93
93
  };
94
94
 
@@ -222,7 +222,7 @@ type ChipComponent = typeof ChipRoot & {
222
222
  // change that computes a value equal to that stale record emits no update at
223
223
  // all, and the node keeps whatever the theme switch painted. That is reachable
224
224
  // whenever one colour fills two roles across themes — an accent equal to
225
- // another theme's `action.bg.secondary.subtle`, say — and it shows up as a
225
+ // another theme's `neutral.soft.bg`, say — and it shows up as a
226
226
  // deselected chip still wearing the selected background.
227
227
  //
228
228
  // Re-rendering on a theme switch commits the new value there and then, so no
@@ -327,7 +327,7 @@ const styles = StyleSheet.create((theme) => {
327
327
  color: "primary",
328
328
  variant: "solid",
329
329
  styles: {
330
- backgroundColor: c["action.bg.primary"],
330
+ backgroundColor: c["accent.solid.bg"],
331
331
  borderWidth: 0,
332
332
  },
333
333
  },
@@ -335,7 +335,7 @@ const styles = StyleSheet.create((theme) => {
335
335
  color: "primary",
336
336
  variant: "soft",
337
337
  styles: {
338
- backgroundColor: c["action.bg.primary.subtle"],
338
+ backgroundColor: c["accent.soft.bg"],
339
339
  borderWidth: 0,
340
340
  },
341
341
  },
@@ -344,7 +344,7 @@ const styles = StyleSheet.create((theme) => {
344
344
  variant: "outline",
345
345
  styles: {
346
346
  backgroundColor: "transparent",
347
- borderColor: c["action.bg.primary.subtle"],
347
+ borderColor: c["accent.soft.bg"],
348
348
  borderWidth: 1,
349
349
  },
350
350
  },
@@ -352,7 +352,7 @@ const styles = StyleSheet.create((theme) => {
352
352
  color: "secondary",
353
353
  variant: "solid",
354
354
  styles: {
355
- backgroundColor: c["action.bg.secondary"],
355
+ backgroundColor: c["neutral.solid.bg"],
356
356
  borderWidth: 0,
357
357
  },
358
358
  },
@@ -360,7 +360,7 @@ const styles = StyleSheet.create((theme) => {
360
360
  color: "secondary",
361
361
  variant: "soft",
362
362
  styles: {
363
- backgroundColor: c["action.bg.secondary.subtle"],
363
+ backgroundColor: c["neutral.soft.bg"],
364
364
  borderWidth: 0,
365
365
  },
366
366
  },
@@ -369,7 +369,7 @@ const styles = StyleSheet.create((theme) => {
369
369
  variant: "outline",
370
370
  styles: {
371
371
  backgroundColor: "transparent",
372
- borderColor: c["action.bg.secondary.subtle"],
372
+ borderColor: c["neutral.soft.bg"],
373
373
  borderWidth: 1,
374
374
  },
375
375
  },
@@ -377,7 +377,7 @@ const styles = StyleSheet.create((theme) => {
377
377
  color: "success",
378
378
  variant: "solid",
379
379
  styles: {
380
- backgroundColor: c["status.success.bg"],
380
+ backgroundColor: c["success.solid.bg"],
381
381
  borderWidth: 0,
382
382
  },
383
383
  },
@@ -385,7 +385,7 @@ const styles = StyleSheet.create((theme) => {
385
385
  color: "success",
386
386
  variant: "soft",
387
387
  styles: {
388
- backgroundColor: c["status.success.bg.subtle"],
388
+ backgroundColor: c["success.soft.bg"],
389
389
  borderWidth: 0,
390
390
  },
391
391
  },
@@ -394,7 +394,7 @@ const styles = StyleSheet.create((theme) => {
394
394
  variant: "outline",
395
395
  styles: {
396
396
  backgroundColor: "transparent",
397
- borderColor: c["status.success.bg.subtle"],
397
+ borderColor: c["success.soft.bg"],
398
398
  borderWidth: 1,
399
399
  },
400
400
  },
@@ -402,7 +402,7 @@ const styles = StyleSheet.create((theme) => {
402
402
  color: "warning",
403
403
  variant: "solid",
404
404
  styles: {
405
- backgroundColor: c["status.warning.bg"],
405
+ backgroundColor: c["warning.solid.bg"],
406
406
  borderWidth: 0,
407
407
  },
408
408
  },
@@ -410,7 +410,7 @@ const styles = StyleSheet.create((theme) => {
410
410
  color: "warning",
411
411
  variant: "soft",
412
412
  styles: {
413
- backgroundColor: c["status.warning.bg.subtle"],
413
+ backgroundColor: c["warning.soft.bg"],
414
414
  borderWidth: 0,
415
415
  },
416
416
  },
@@ -419,7 +419,7 @@ const styles = StyleSheet.create((theme) => {
419
419
  variant: "outline",
420
420
  styles: {
421
421
  backgroundColor: "transparent",
422
- borderColor: c["status.warning.bg.subtle"],
422
+ borderColor: c["warning.soft.bg"],
423
423
  borderWidth: 1,
424
424
  },
425
425
  },
@@ -427,7 +427,7 @@ const styles = StyleSheet.create((theme) => {
427
427
  color: "danger",
428
428
  variant: "solid",
429
429
  styles: {
430
- backgroundColor: c["status.danger.bg"],
430
+ backgroundColor: c["danger.solid.bg"],
431
431
  borderWidth: 0,
432
432
  },
433
433
  },
@@ -435,7 +435,7 @@ const styles = StyleSheet.create((theme) => {
435
435
  color: "danger",
436
436
  variant: "soft",
437
437
  styles: {
438
- backgroundColor: c["status.danger.bg.subtle"],
438
+ backgroundColor: c["danger.soft.bg"],
439
439
  borderWidth: 0,
440
440
  },
441
441
  },
@@ -444,7 +444,7 @@ const styles = StyleSheet.create((theme) => {
444
444
  variant: "outline",
445
445
  styles: {
446
446
  backgroundColor: "transparent",
447
- borderColor: c["status.danger.bg.subtle"],
447
+ borderColor: c["danger.soft.bg"],
448
448
  borderWidth: 1,
449
449
  },
450
450
  },
@@ -3,7 +3,7 @@ export type ChipVariant = "solid" | "soft" | "outline" | "ghost";
3
3
 
4
4
  /**
5
5
  * Semantic color scheme, or a raw CSS color literal (`#fff`, `rgb(...)`, `hsl(...)`).
6
- * Has no effect when `variant="ghost"` — ghost always renders `text.default`.
6
+ * Has no effect when `variant="ghost"` — ghost always renders `text.primary`.
7
7
  */
8
8
  export type ChipColor =
9
9
  | "primary"
@@ -11,7 +11,7 @@ import type { EmptyStateSize } from "./types";
11
11
  export interface EmptyStateProps extends Omit<ViewProps, "children"> {
12
12
  /** Icon rendered in the circular badge above the title. */
13
13
  icon?: TerraIconName;
14
- /** Icon tint. Defaults to `text.subtle`. */
14
+ /** Icon tint. Defaults to `text.tertiary`. */
15
15
  iconColor?: ColorToken;
16
16
  /**
17
17
  * Replaces the icon badge entirely — an illustration, `Image`, or any custom
@@ -75,7 +75,7 @@ function renderSlot(node: ReactNode, wrap: (value: ReactNode) => ReactNode): Rea
75
75
  export const EmptyState = forwardRef<ComponentRef<typeof View>, EmptyStateProps>(function EmptyState(
76
76
  {
77
77
  icon,
78
- iconColor = "text.default",
78
+ iconColor = "text.primary",
79
79
  media,
80
80
  title,
81
81
  description,
@@ -107,7 +107,7 @@ export const EmptyState = forwardRef<ComponentRef<typeof View>, EmptyStateProps>
107
107
  </Text>
108
108
  ))}
109
109
  {renderSlot(description, (value) => (
110
- <Text variant={typography.description} color="text.subtle" align="center">
110
+ <Text variant={typography.description} color="text.tertiary" align="center">
111
111
  {value}
112
112
  </Text>
113
113
  ))}
@@ -160,7 +160,7 @@ const styles = StyleSheet.create((theme) => ({
160
160
  iconBadge: {
161
161
  alignItems: "center",
162
162
  justifyContent: "center",
163
- backgroundColor: theme.color["action.bg.primary.subtle"],
163
+ backgroundColor: theme.color["accent.soft.bg"],
164
164
  borderRadius: theme.radius.full,
165
165
  variants: {
166
166
  size: {