@ankhorage/surface 1.4.0 → 2.0.1

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 (223) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/components/action-sheet/ActionSheet.d.ts +4 -0
  3. package/dist/components/action-sheet/ActionSheet.d.ts.map +1 -0
  4. package/dist/components/action-sheet/ActionSheet.js +71 -0
  5. package/dist/components/action-sheet/ActionSheet.js.map +1 -0
  6. package/dist/components/action-sheet/ActionSheetItem.d.ts +4 -0
  7. package/dist/components/action-sheet/ActionSheetItem.d.ts.map +1 -0
  8. package/dist/components/action-sheet/ActionSheetItem.js +27 -0
  9. package/dist/components/action-sheet/ActionSheetItem.js.map +1 -0
  10. package/dist/components/action-sheet/index.d.ts +4 -0
  11. package/dist/components/action-sheet/index.d.ts.map +1 -0
  12. package/dist/components/action-sheet/index.js +3 -0
  13. package/dist/components/action-sheet/index.js.map +1 -0
  14. package/dist/components/action-sheet/types.d.ts +24 -0
  15. package/dist/components/action-sheet/types.d.ts.map +1 -0
  16. package/dist/components/action-sheet/types.js +2 -0
  17. package/dist/components/action-sheet/types.js.map +1 -0
  18. package/dist/components/badge/Badge.d.ts +1 -1
  19. package/dist/components/badge/Badge.d.ts.map +1 -1
  20. package/dist/components/badge/Badge.js +3 -3
  21. package/dist/components/badge/Badge.js.map +1 -1
  22. package/dist/components/badge/types.d.ts +2 -2
  23. package/dist/components/badge/types.d.ts.map +1 -1
  24. package/dist/components/badge/types.js.map +1 -1
  25. package/dist/components/button/Button.d.ts +1 -1
  26. package/dist/components/button/Button.d.ts.map +1 -1
  27. package/dist/components/button/Button.js +6 -3
  28. package/dist/components/button/Button.js.map +1 -1
  29. package/dist/components/button/types.d.ts +2 -2
  30. package/dist/components/button/types.d.ts.map +1 -1
  31. package/dist/components/button/types.js.map +1 -1
  32. package/dist/components/checkbox/Checkbox.d.ts +1 -1
  33. package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
  34. package/dist/components/checkbox/Checkbox.js +7 -4
  35. package/dist/components/checkbox/Checkbox.js.map +1 -1
  36. package/dist/components/checkbox/types.d.ts +2 -2
  37. package/dist/components/checkbox/types.d.ts.map +1 -1
  38. package/dist/components/checkbox/types.js.map +1 -1
  39. package/dist/components/field/Field.d.ts.map +1 -1
  40. package/dist/components/field/Field.js +6 -2
  41. package/dist/components/field/Field.js.map +1 -1
  42. package/dist/components/helper-text/HelperText.d.ts +1 -1
  43. package/dist/components/helper-text/HelperText.d.ts.map +1 -1
  44. package/dist/components/helper-text/HelperText.js +2 -2
  45. package/dist/components/helper-text/HelperText.js.map +1 -1
  46. package/dist/components/helper-text/types.d.ts +3 -2
  47. package/dist/components/helper-text/types.d.ts.map +1 -1
  48. package/dist/components/helper-text/types.js.map +1 -1
  49. package/dist/components/icon-button/IconButton.d.ts +1 -1
  50. package/dist/components/icon-button/IconButton.d.ts.map +1 -1
  51. package/dist/components/icon-button/IconButton.js +2 -2
  52. package/dist/components/icon-button/IconButton.js.map +1 -1
  53. package/dist/components/icon-button/types.d.ts +2 -2
  54. package/dist/components/icon-button/types.d.ts.map +1 -1
  55. package/dist/components/icon-button/types.js.map +1 -1
  56. package/dist/components/label/Label.d.ts +1 -1
  57. package/dist/components/label/Label.d.ts.map +1 -1
  58. package/dist/components/label/Label.js +3 -3
  59. package/dist/components/label/Label.js.map +1 -1
  60. package/dist/components/label/types.d.ts +3 -2
  61. package/dist/components/label/types.d.ts.map +1 -1
  62. package/dist/components/label/types.js.map +1 -1
  63. package/dist/components/list-item/ListItem.js +1 -1
  64. package/dist/components/list-item/ListItem.js.map +1 -1
  65. package/dist/components/menu/Menu.d.ts.map +1 -1
  66. package/dist/components/menu/Menu.js +1 -3
  67. package/dist/components/menu/Menu.js.map +1 -1
  68. package/dist/components/navigation/NavigationItem.d.ts.map +1 -1
  69. package/dist/components/navigation/NavigationItem.js +1 -1
  70. package/dist/components/navigation/NavigationItem.js.map +1 -1
  71. package/dist/components/navigation/TabBarItem.d.ts.map +1 -1
  72. package/dist/components/navigation/TabBarItem.js +1 -1
  73. package/dist/components/navigation/TabBarItem.js.map +1 -1
  74. package/dist/components/radio/Radio.d.ts +1 -1
  75. package/dist/components/radio/Radio.d.ts.map +1 -1
  76. package/dist/components/radio/Radio.js +4 -3
  77. package/dist/components/radio/Radio.js.map +1 -1
  78. package/dist/components/radio/types.d.ts +2 -2
  79. package/dist/components/radio/types.d.ts.map +1 -1
  80. package/dist/components/radio/types.js.map +1 -1
  81. package/dist/components/switch/Switch.d.ts +1 -1
  82. package/dist/components/switch/Switch.d.ts.map +1 -1
  83. package/dist/components/switch/Switch.js +4 -3
  84. package/dist/components/switch/Switch.js.map +1 -1
  85. package/dist/components/switch/types.d.ts +2 -2
  86. package/dist/components/switch/types.d.ts.map +1 -1
  87. package/dist/components/switch/types.js.map +1 -1
  88. package/dist/components/tabs/Tab.d.ts.map +1 -1
  89. package/dist/components/tabs/Tab.js +1 -1
  90. package/dist/components/tabs/Tab.js.map +1 -1
  91. package/dist/components/toast/Toast.d.ts +1 -1
  92. package/dist/components/toast/Toast.d.ts.map +1 -1
  93. package/dist/components/toast/Toast.js +34 -9
  94. package/dist/components/toast/Toast.js.map +1 -1
  95. package/dist/components/toast/ToastProvider.js +1 -1
  96. package/dist/components/toast/ToastProvider.js.map +1 -1
  97. package/dist/components/toast/index.d.ts +1 -1
  98. package/dist/components/toast/index.d.ts.map +1 -1
  99. package/dist/components/toast/index.js.map +1 -1
  100. package/dist/components/toast/types.d.ts +3 -2
  101. package/dist/components/toast/types.d.ts.map +1 -1
  102. package/dist/components/toast/types.js.map +1 -1
  103. package/dist/components/tooltip/Tooltip.js +1 -1
  104. package/dist/components/tooltip/Tooltip.js.map +1 -1
  105. package/dist/examples/DocsExamples.js +4 -4
  106. package/dist/examples/DocsExamples.js.map +1 -1
  107. package/dist/index.d.ts +5 -1
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js +2 -0
  110. package/dist/index.js.map +1 -1
  111. package/dist/internal/resolvers/index.d.ts +1 -1
  112. package/dist/internal/resolvers/index.d.ts.map +1 -1
  113. package/dist/internal/resolvers/index.js +1 -1
  114. package/dist/internal/resolvers/index.js.map +1 -1
  115. package/dist/internal/resolvers/resolveFieldPresentation.d.ts +5 -5
  116. package/dist/internal/resolvers/resolveFieldPresentation.d.ts.map +1 -1
  117. package/dist/internal/resolvers/resolveFieldPresentation.js +8 -6
  118. package/dist/internal/resolvers/resolveFieldPresentation.js.map +1 -1
  119. package/dist/internal/resolvers/resolveInteractiveColors.d.ts +3 -3
  120. package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
  121. package/dist/internal/resolvers/resolveInteractiveColors.js +4 -6
  122. package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
  123. package/dist/internal/resolvers/resolveSelectionControlColors.d.ts +3 -3
  124. package/dist/internal/resolvers/resolveSelectionControlColors.d.ts.map +1 -1
  125. package/dist/internal/resolvers/resolveSelectionControlColors.js +4 -4
  126. package/dist/internal/resolvers/resolveSelectionControlColors.js.map +1 -1
  127. package/dist/internal/resolvers/resolveSurfaceColor.d.ts +4 -0
  128. package/dist/internal/resolvers/resolveSurfaceColor.d.ts.map +1 -0
  129. package/dist/internal/resolvers/resolveSurfaceColor.js +26 -0
  130. package/dist/internal/resolvers/resolveSurfaceColor.js.map +1 -0
  131. package/dist/internal/resolvers/resolveTextColor.d.ts +2 -3
  132. package/dist/internal/resolvers/resolveTextColor.d.ts.map +1 -1
  133. package/dist/internal/resolvers/resolveTextColor.js +7 -11
  134. package/dist/internal/resolvers/resolveTextColor.js.map +1 -1
  135. package/dist/primitives/heading/Heading.d.ts.map +1 -1
  136. package/dist/primitives/heading/Heading.js +2 -2
  137. package/dist/primitives/heading/Heading.js.map +1 -1
  138. package/dist/primitives/heading/resolveHeadingStyle.d.ts +2 -1
  139. package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +1 -1
  140. package/dist/primitives/heading/resolveHeadingStyle.js +2 -2
  141. package/dist/primitives/heading/resolveHeadingStyle.js.map +1 -1
  142. package/dist/primitives/heading/types.d.ts +3 -0
  143. package/dist/primitives/heading/types.d.ts.map +1 -1
  144. package/dist/primitives/heading/types.js.map +1 -1
  145. package/dist/primitives/text/Text.d.ts +1 -1
  146. package/dist/primitives/text/Text.d.ts.map +1 -1
  147. package/dist/primitives/text/Text.js +2 -2
  148. package/dist/primitives/text/Text.js.map +1 -1
  149. package/dist/primitives/text/types.d.ts +3 -3
  150. package/dist/primitives/text/types.d.ts.map +1 -1
  151. package/dist/primitives/text/types.js.map +1 -1
  152. package/dist/surfaceColor.d.ts +9 -0
  153. package/dist/surfaceColor.d.ts.map +1 -0
  154. package/dist/surfaceColor.js +15 -0
  155. package/dist/surfaceColor.js.map +1 -0
  156. package/dist/theme/colorEngine.d.ts.map +1 -1
  157. package/dist/theme/colorEngine.js +9 -1
  158. package/dist/theme/colorEngine.js.map +1 -1
  159. package/dist/theme/types.d.ts +5 -0
  160. package/dist/theme/types.d.ts.map +1 -1
  161. package/dist/theme/types.js.map +1 -1
  162. package/package.json +2 -2
  163. package/src/components/action-sheet/ActionSheet.tsx +121 -0
  164. package/src/components/action-sheet/ActionSheetItem.tsx +57 -0
  165. package/src/components/action-sheet/index.ts +3 -0
  166. package/src/components/action-sheet/types.ts +26 -0
  167. package/src/components/badge/Badge.tsx +8 -3
  168. package/src/components/badge/types.ts +2 -2
  169. package/src/components/button/Button.tsx +9 -3
  170. package/src/components/button/types.ts +2 -2
  171. package/src/components/checkbox/Checkbox.tsx +13 -4
  172. package/src/components/checkbox/types.ts +2 -2
  173. package/src/components/field/Field.tsx +11 -3
  174. package/src/components/helper-text/HelperText.tsx +2 -2
  175. package/src/components/helper-text/types.ts +3 -2
  176. package/src/components/icon-button/IconButton.tsx +2 -2
  177. package/src/components/icon-button/types.ts +2 -2
  178. package/src/components/label/Label.tsx +9 -3
  179. package/src/components/label/types.ts +3 -2
  180. package/src/components/list-item/ListItem.tsx +1 -1
  181. package/src/components/menu/Menu.tsx +1 -8
  182. package/src/components/navigation/NavigationItem.tsx +2 -1
  183. package/src/components/navigation/TabBarItem.tsx +2 -1
  184. package/src/components/radio/Radio.tsx +5 -3
  185. package/src/components/radio/types.ts +2 -2
  186. package/src/components/switch/Switch.tsx +5 -3
  187. package/src/components/switch/types.ts +2 -2
  188. package/src/components/tabs/Tab.tsx +1 -5
  189. package/src/components/toast/Toast.tsx +38 -10
  190. package/src/components/toast/ToastProvider.tsx +1 -1
  191. package/src/components/toast/index.ts +1 -1
  192. package/src/components/toast/types.ts +4 -2
  193. package/src/components/tooltip/Tooltip.tsx +1 -1
  194. package/src/examples/DocsExamples.tsx +4 -4
  195. package/src/index.test.ts +1 -0
  196. package/src/index.ts +15 -1
  197. package/src/internal/resolvers/index.ts +1 -1
  198. package/src/internal/resolvers/resolveFieldPresentation.test.ts +12 -10
  199. package/src/internal/resolvers/resolveFieldPresentation.ts +13 -11
  200. package/src/internal/resolvers/resolveInteractiveColors.test.ts +4 -4
  201. package/src/internal/resolvers/resolveInteractiveColors.ts +6 -7
  202. package/src/internal/resolvers/resolveSelectionControlColors.test.ts +8 -8
  203. package/src/internal/resolvers/resolveSelectionControlColors.ts +6 -5
  204. package/src/internal/resolvers/resolveSurfaceColor.test.ts +21 -0
  205. package/src/internal/resolvers/resolveSurfaceColor.ts +31 -0
  206. package/src/internal/resolvers/resolveTextColor.test.ts +16 -5
  207. package/src/internal/resolvers/resolveTextColor.ts +10 -22
  208. package/src/primitives/heading/Heading.tsx +3 -1
  209. package/src/primitives/heading/resolveHeadingStyle.test.ts +1 -1
  210. package/src/primitives/heading/resolveHeadingStyle.ts +4 -1
  211. package/src/primitives/heading/types.ts +4 -0
  212. package/src/primitives/text/Text.tsx +2 -2
  213. package/src/primitives/text/types.ts +3 -3
  214. package/src/surfaceColor.test.ts +46 -0
  215. package/src/surfaceColor.ts +22 -0
  216. package/src/theme/colorEngine.test.ts +6 -0
  217. package/src/theme/colorEngine.ts +9 -1
  218. package/src/theme/types.ts +5 -0
  219. package/dist/internal/resolvers/resolveTone.d.ts +0 -4
  220. package/dist/internal/resolvers/resolveTone.d.ts.map +0 -1
  221. package/dist/internal/resolvers/resolveTone.js +0 -16
  222. package/dist/internal/resolvers/resolveTone.js.map +0 -1
  223. package/src/internal/resolvers/resolveTone.ts +0 -19
@@ -82,6 +82,9 @@ export function generatePalette(config, mode = 'light') {
82
82
  const danger = buildRoleSemantics(semanticStatusSwatches.danger, isDark);
83
83
  const success = buildRoleSemantics(semanticStatusSwatches.success, isDark);
84
84
  const warning = buildRoleSemantics(semanticStatusSwatches.warning, isDark);
85
+ // Keep destructive action and feedback error aligned until a dedicated error status swatch is introduced.
86
+ const error = danger;
87
+ const info = buildRoleSemantics(secondarySwatch, isDark);
85
88
  const surfaceSemantics = {
86
89
  default: neutral.surface,
87
90
  subtle: neutral.bgSubtle,
@@ -108,14 +111,17 @@ export function generatePalette(config, mode = 'light') {
108
111
  secondary: secondarySwatch[500],
109
112
  accent: tertiarySwatch[500],
110
113
  highlight: quaternarySwatch[500],
114
+ tertiary: tertiarySwatch[500],
115
+ quaternary: quaternarySwatch[500],
111
116
  background: neutral.bg,
112
117
  surface: neutral.surface,
113
118
  text: neutral.text,
114
119
  textSecondary: neutral.textMuted,
115
120
  border: neutral.border,
116
- error: danger.base,
121
+ error: error.base,
117
122
  success: success.base,
118
123
  warning: warning.base,
124
+ info: info.base,
119
125
  };
120
126
  return {
121
127
  colors,
@@ -129,6 +135,8 @@ export function generatePalette(config, mode = 'light') {
129
135
  danger,
130
136
  success,
131
137
  warning,
138
+ error,
139
+ info,
132
140
  surface: surfaceSemantics,
133
141
  content,
134
142
  border,
@@ -1 +1 @@
1
- {"version":3,"file":"colorEngine.js","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mCAAmC,EACnC,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAmBjC,M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AgB,EAAE,MAAM,CAAC;YACvD,MAAM;YACN,OAAO;YACP,OAAO;YACP,OAAO,EAAE,gBAAgB;YACzB,OAAO;YACP,MAAM;YACN,MAAM;SACP;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ColorSwatch,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nimport {\n createDefaultSemanticStatusSwatches,\n generateThemeModeColors,\n getReadableForeground,\n parseHexColorOrThrow,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type {\n ActionSemantics,\n BorderSemantics,\n ContentSemantics,\n NeutralSemantics,\n RoleSemantics,\n SurfaceSemantics,\n ThemeSemantics,\n} from './types';\n\n/**\n * Surface semantic resolver: maps color-theory SemanticColorToken references\n * to hex values from the generated swatches.\n */\nexport type SurfaceSemanticColors = Record<SemanticColorToken, HexColor>;\n\nexport function resolveSemanticColors(\n generated: GeneratedThemeModeColors,\n references: SemanticColorReferenceMap,\n): SurfaceSemanticColors {\n return Object.fromEntries(\n Object.entries(references).map(([token, ref]) => {\n const swatch = generated.swatches[ref.role];\n if (!swatch) {\n throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);\n }\n return [token, swatch[ref.step]];\n }),\n ) as SurfaceSemanticColors;\n}\n\nfunction buildNeutralSemantics(neutralSwatch: ColorSwatch, isDark: boolean): NeutralSemantics {\n if (isDark) {\n return {\n bg: neutralSwatch[950],\n bgSubtle: neutralSwatch[900],\n surface: neutralSwatch[900],\n surfaceHover: neutralSwatch[800],\n surfaceActive: neutralSwatch[700],\n border: neutralSwatch[800],\n borderStrong: neutralSwatch[600],\n divider: neutralSwatch[800],\n text: neutralSwatch[50],\n textMuted: neutralSwatch[200],\n textSubtle: neutralSwatch[300],\n };\n }\n return {\n bg: neutralSwatch[50],\n bgSubtle: neutralSwatch[100],\n surface: neutralSwatch[100],\n surfaceHover: neutralSwatch[200],\n surfaceActive: neutralSwatch[300],\n border: neutralSwatch[200],\n borderStrong: neutralSwatch[300],\n divider: neutralSwatch[200],\n text: neutralSwatch[900],\n textMuted: neutralSwatch[700],\n textSubtle: neutralSwatch[600],\n };\n}\n\nfunction buildRoleSemantics(swatch: ColorSwatch, isDark: boolean): RoleSemantics {\n const base = swatch[500];\n const { foreground: onSolidText } = getReadableForeground(base);\n\n if (isDark) {\n return {\n base,\n hover: swatch[400],\n strong: swatch[300],\n softBg: swatch[900],\n softHover: swatch[800],\n softActive: swatch[700],\n outline: swatch[500],\n onSolidText,\n };\n }\n\n return {\n base,\n hover: swatch[600],\n strong: swatch[700],\n softBg: swatch[100],\n softHover: swatch[200],\n softActive: swatch[300],\n outline: swatch[400],\n onSolidText,\n };\n}\n\nexport function generatePalette(\n config: ThemeConfig,\n mode: 'light' | 'dark' = 'light',\n): {\n colors: Record<string, string>;\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n} {\n const modeConfig = mode === 'dark' ? config.dark : config.light;\n const isDark = mode === 'dark';\n\n // Throws deterministically on invalid primary color\n parseHexColorOrThrow(modeConfig.primaryColor);\n\n const generated = generateThemeModeColors(modeConfig);\n\n const { swatches } = generated;\n const neutralSwatch = swatches.neutral;\n\n const neutral = buildNeutralSemantics(neutralSwatch, isDark);\n const brand = buildRoleSemantics(swatches.primary, isDark);\n\n // Fallback to primary swatch for missing ordinal roles\n const secondarySwatch = swatches.secondary ?? swatches.primary;\n const tertiarySwatch = swatches.tertiary ?? swatches.primary;\n const quaternarySwatch = swatches.quaternary ?? swatches.primary;\n\n const semanticStatusSwatches = createDefaultSemanticStatusSwatches().swatches;\n\n const danger = buildRoleSemantics(semanticStatusSwatches.danger, isDark);\n const success = buildRoleSemantics(semanticStatusSwatches.success, isDark);\n const warning = buildRoleSemantics(semanticStatusSwatches.warning, isDark);\n\n const surfaceSemantics: SurfaceSemantics = {\n default: neutral.surface,\n subtle: neutral.bgSubtle,\n raised: neutral.surface,\n };\n\n const content: ContentSemantics = {\n default: neutral.text,\n muted: neutral.textMuted,\n subtle: neutral.textSubtle,\n inverse: brand.onSolidText,\n };\n\n const border: BorderSemantics = {\n default: neutral.border,\n strong: neutral.borderStrong,\n focus: brand.outline,\n };\n\n const action: ActionSemantics = {\n primary: brand,\n neutral: buildRoleSemantics(neutralSwatch, isDark),\n danger,\n };\n\n const colors: Record<string, string> = {\n primary: brand.base,\n secondary: secondarySwatch[500],\n accent: tertiarySwatch[500],\n highlight: quaternarySwatch[500],\n background: neutral.bg,\n surface: neutral.surface,\n text: neutral.text,\n textSecondary: neutral.textMuted,\n border: neutral.border,\n error: danger.base,\n success: success.base,\n warning: warning.base,\n };\n\n return {\n colors,\n swatches,\n semantics: {\n neutral,\n brand,\n secondary: buildRoleSemantics(secondarySwatch, isDark),\n accent: buildRoleSemantics(tertiarySwatch, isDark),\n highlight: buildRoleSemantics(quaternarySwatch, isDark),\n danger,\n success,\n warning,\n surface: surfaceSemantics,\n content,\n border,\n action,\n },\n };\n}\n"]}
1
+ {"version":3,"file":"colorEngine.js","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,mCAAmC,EACnC,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAmBjC,MAAM,UAAU,qBAAqB,CACnC,SAAmC,EACnC,UAAqC;IAErC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,IAAI,cAAc,KAAK,IAAI,CAAC,CAAC;QAC/E,CAAC;QACD,OA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AC","sourcesContent":["import type {\n ColorSwatch,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nimport {\n createDefaultSemanticStatusSwatches,\n generateThemeModeColors,\n getReadableForeground,\n parseHexColorOrThrow,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type {\n ActionSemantics,\n BorderSemantics,\n ContentSemantics,\n NeutralSemantics,\n RoleSemantics,\n SurfaceSemantics,\n ThemeSemantics,\n} from './types';\n\n/**\n * Surface semantic resolver: maps color-theory SemanticColorToken references\n * to hex values from the generated swatches.\n */\nexport type SurfaceSemanticColors = Record<SemanticColorToken, HexColor>;\n\nexport function resolveSemanticColors(\n generated: GeneratedThemeModeColors,\n references: SemanticColorReferenceMap,\n): SurfaceSemanticColors {\n return Object.fromEntries(\n Object.entries(references).map(([token, ref]) => {\n const swatch = generated.swatches[ref.role];\n if (!swatch) {\n throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);\n }\n return [token, swatch[ref.step]];\n }),\n ) as SurfaceSemanticColors;\n}\n\nfunction buildNeutralSemantics(neutralSwatch: ColorSwatch, isDark: boolean): NeutralSemantics {\n if (isDark) {\n return {\n bg: neutralSwatch[950],\n bgSubtle: neutralSwatch[900],\n surface: neutralSwatch[900],\n surfaceHover: neutralSwatch[800],\n surfaceActive: neutralSwatch[700],\n border: neutralSwatch[800],\n borderStrong: neutralSwatch[600],\n divider: neutralSwatch[800],\n text: neutralSwatch[50],\n textMuted: neutralSwatch[200],\n textSubtle: neutralSwatch[300],\n };\n }\n return {\n bg: neutralSwatch[50],\n bgSubtle: neutralSwatch[100],\n surface: neutralSwatch[100],\n surfaceHover: neutralSwatch[200],\n surfaceActive: neutralSwatch[300],\n border: neutralSwatch[200],\n borderStrong: neutralSwatch[300],\n divider: neutralSwatch[200],\n text: neutralSwatch[900],\n textMuted: neutralSwatch[700],\n textSubtle: neutralSwatch[600],\n };\n}\n\nfunction buildRoleSemantics(swatch: ColorSwatch, isDark: boolean): RoleSemantics {\n const base = swatch[500];\n const { foreground: onSolidText } = getReadableForeground(base);\n\n if (isDark) {\n return {\n base,\n hover: swatch[400],\n strong: swatch[300],\n softBg: swatch[900],\n softHover: swatch[800],\n softActive: swatch[700],\n outline: swatch[500],\n onSolidText,\n };\n }\n\n return {\n base,\n hover: swatch[600],\n strong: swatch[700],\n softBg: swatch[100],\n softHover: swatch[200],\n softActive: swatch[300],\n outline: swatch[400],\n onSolidText,\n };\n}\n\nexport function generatePalette(\n config: ThemeConfig,\n mode: 'light' | 'dark' = 'light',\n): {\n colors: Record<string, string>;\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n} {\n const modeConfig = mode === 'dark' ? config.dark : config.light;\n const isDark = mode === 'dark';\n\n // Throws deterministically on invalid primary color\n parseHexColorOrThrow(modeConfig.primaryColor);\n\n const generated = generateThemeModeColors(modeConfig);\n\n const { swatches } = generated;\n const neutralSwatch = swatches.neutral;\n\n const neutral = buildNeutralSemantics(neutralSwatch, isDark);\n const brand = buildRoleSemantics(swatches.primary, isDark);\n\n // Fallback to primary swatch for missing ordinal roles\n const secondarySwatch = swatches.secondary ?? swatches.primary;\n const tertiarySwatch = swatches.tertiary ?? swatches.primary;\n const quaternarySwatch = swatches.quaternary ?? swatches.primary;\n\n const semanticStatusSwatches = createDefaultSemanticStatusSwatches().swatches;\n\n const danger = buildRoleSemantics(semanticStatusSwatches.danger, isDark);\n const success = buildRoleSemantics(semanticStatusSwatches.success, isDark);\n const warning = buildRoleSemantics(semanticStatusSwatches.warning, isDark);\n // Keep destructive action and feedback error aligned until a dedicated error status swatch is introduced.\n const error = danger;\n const info = buildRoleSemantics(secondarySwatch, isDark);\n\n const surfaceSemantics: SurfaceSemantics = {\n default: neutral.surface,\n subtle: neutral.bgSubtle,\n raised: neutral.surface,\n };\n\n const content: ContentSemantics = {\n default: neutral.text,\n muted: neutral.textMuted,\n subtle: neutral.textSubtle,\n inverse: brand.onSolidText,\n };\n\n const border: BorderSemantics = {\n default: neutral.border,\n strong: neutral.borderStrong,\n focus: brand.outline,\n };\n\n const action: ActionSemantics = {\n primary: brand,\n neutral: buildRoleSemantics(neutralSwatch, isDark),\n danger,\n };\n\n const colors: Record<string, string> = {\n primary: brand.base,\n secondary: secondarySwatch[500],\n accent: tertiarySwatch[500],\n highlight: quaternarySwatch[500],\n tertiary: tertiarySwatch[500],\n quaternary: quaternarySwatch[500],\n background: neutral.bg,\n surface: neutral.surface,\n text: neutral.text,\n textSecondary: neutral.textMuted,\n border: neutral.border,\n error: error.base,\n success: success.base,\n warning: warning.base,\n info: info.base,\n };\n\n return {\n colors,\n swatches,\n semantics: {\n neutral,\n brand,\n secondary: buildRoleSemantics(secondarySwatch, isDark),\n accent: buildRoleSemantics(tertiarySwatch, isDark),\n highlight: buildRoleSemantics(quaternarySwatch, isDark),\n danger,\n success,\n warning,\n error,\n info,\n surface: surfaceSemantics,\n content,\n border,\n action,\n },\n };\n}\n"]}
@@ -55,6 +55,8 @@ export interface ThemeSemantics {
55
55
  danger: RoleSemantics;
56
56
  success: RoleSemantics;
57
57
  warning: RoleSemantics;
58
+ error: RoleSemantics;
59
+ info: RoleSemantics;
58
60
  surface: SurfaceSemantics;
59
61
  content: ContentSemantics;
60
62
  border: BorderSemantics;
@@ -67,6 +69,8 @@ export interface ThemeTokens {
67
69
  secondary: string;
68
70
  accent: string;
69
71
  highlight: string;
72
+ tertiary: string;
73
+ quaternary: string;
70
74
  background: string;
71
75
  surface: string;
72
76
  text: string;
@@ -75,6 +79,7 @@ export interface ThemeTokens {
75
79
  error: string;
76
80
  success: string;
77
81
  warning: string;
82
+ info: string;
78
83
  [key: string]: string;
79
84
  };
80
85
  swatches: GeneratedThemeSwatches;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,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AAC;YACjB,SAAS,EAAE,UAAU,CAAC;YACtB,KAAK,EAAE,UAAU,CAAC;SACnB,CAAC;QACF,KAAK,EAAE;YACL,wDAAwD;YACxD,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;YAC/C,wDAAwD;YACxD,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;SAChD,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,MAAM,EAAE,oBAAoB,CAAC;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GeneratedThemeSwatches } from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\n\nexport type {\n ColorHarmony,\n ColorSwatch,\n ColorSwatchStep,\n GeneratedColorRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nexport type { ThemeConfig, ThemeModeConfig } from '@ankhorage/contracts';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSolidText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n strong: string;\n focus: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n action: ActionSemantics;\n}\n\nexport type FontWeight =\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | 'bold'\n | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GeneratedThemeSwatches } from '@ankhorage/color-theory';\nimport type { ThemeConfig as ContractsThemeConfig } from '@ankhorage/contracts';\n\nexport type {\n ColorHarmony,\n ColorSwatch,\n ColorSwatchStep,\n GeneratedColorRole,\n GeneratedThemeModeColors,\n GeneratedThemeSwatches,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nexport type { ThemeConfig, ThemeModeConfig } from '@ankhorage/contracts';\n\nexport interface NeutralSemantics {\n bg: string;\n bgSubtle: string;\n surface: string;\n surfaceHover: string;\n surfaceActive: string;\n border: string;\n borderStrong: string;\n divider: string;\n text: string;\n textMuted: string;\n textSubtle: string;\n}\n\nexport interface RoleSemantics {\n base: string;\n hover: string;\n strong: string;\n softBg: string;\n softHover: string;\n softActive: string;\n outline: string;\n onSolidText: string;\n}\n\nexport interface SurfaceSemantics {\n default: string;\n subtle: string;\n raised: string;\n}\n\nexport interface ContentSemantics {\n default: string;\n muted: string;\n subtle: string;\n inverse: string;\n}\n\nexport interface BorderSemantics {\n default: string;\n strong: string;\n focus: string;\n}\n\nexport interface ActionSemantics {\n primary: RoleSemantics;\n neutral: RoleSemantics;\n danger: RoleSemantics;\n}\n\nexport interface ThemeSemantics {\n neutral: NeutralSemantics;\n brand: RoleSemantics;\n secondary: RoleSemantics;\n accent: RoleSemantics;\n highlight: RoleSemantics;\n danger: RoleSemantics;\n success: RoleSemantics;\n warning: RoleSemantics;\n error: RoleSemantics;\n info: RoleSemantics;\n surface: SurfaceSemantics;\n content: ContentSemantics;\n border: BorderSemantics;\n action: ActionSemantics;\n}\n\nexport type FontWeight =\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | 'bold'\n | 'normal';\n\nexport interface ThemeTokens {\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n highlight: string;\n tertiary: string;\n quaternary: string;\n background: string;\n surface: string;\n text: string;\n textSecondary: string;\n border: string;\n error: string;\n success: string;\n warning: string;\n info: string;\n [key: string]: string;\n };\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n spacing: {\n none: 0;\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n [key: string]: number;\n };\n radii: {\n none: 0;\n s: number;\n m: number;\n l: number;\n full: number;\n };\n typography: {\n headings: Record<\n 1 | 2 | 3 | 4 | 5 | 6,\n {\n size: number;\n lineHeight: number;\n weight: 'regular' | 'medium' | 'semiBold' | 'bold';\n }\n >;\n sizes: {\n xs: number;\n s: number;\n m: number;\n l: number;\n xl: number;\n xxl: number;\n '3xl': number;\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n [key: string]: number;\n };\n weights: {\n thin: FontWeight;\n extraLight: FontWeight;\n light: FontWeight;\n regular: FontWeight;\n medium: FontWeight;\n semiBold: FontWeight;\n bold: FontWeight;\n extraBold: FontWeight;\n black: FontWeight;\n };\n fonts: {\n /** Map of weight -> fontFamily name for normal style */\n normal: Record<FontWeight, string | undefined>;\n /** Map of weight -> fontFamily name for italic style */\n italic: Record<FontWeight, string | undefined>;\n };\n };\n shadows: {\n soft: number;\n medium: number;\n hard: number;\n [key: string]: number;\n };\n}\n\nexport interface SurfaceTheme extends ThemeTokens {\n config: ContractsThemeConfig;\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "2.0.1",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ankhorage/color-theory": "^0.0.7",
46
- "@ankhorage/contracts": "^1.3.1"
46
+ "@ankhorage/contracts": "^1.7.0"
47
47
  },
48
48
  "files": [
49
49
  "dist",
@@ -0,0 +1,121 @@
1
+ import React from 'react';
2
+ import { Pressable, View } from 'react-native';
3
+
4
+ import { FocusScope } from '../../internal/focus/FocusScope';
5
+ import { Portal } from '../../internal/overlay/Portal';
6
+ import { resolveOverlayAnimation } from '../../internal/resolvers';
7
+ import { Box, Stack, Surface } from '../../layout';
8
+ import { Text } from '../../primitives/text';
9
+ import { useTheme } from '../../theme/ThemeContext';
10
+ import { ActionSheetItem } from './ActionSheetItem';
11
+ import type { ActionSheetProps } from './types';
12
+
13
+ export function ActionSheet({
14
+ visible,
15
+ onDismiss,
16
+ title,
17
+ description,
18
+ children,
19
+ cancelLabel = 'Cancel',
20
+ closeOnBackdrop = true,
21
+ testID,
22
+ }: ActionSheetProps) {
23
+ const { theme } = useTheme();
24
+ const animation = resolveOverlayAnimation('modal');
25
+
26
+ if (!visible) {
27
+ return null;
28
+ }
29
+
30
+ return (
31
+ <Portal layer="modal" visible={visible}>
32
+ <View
33
+ pointerEvents="box-none"
34
+ style={{
35
+ bottom: 0,
36
+ left: 0,
37
+ position: 'absolute',
38
+ right: 0,
39
+ top: 0,
40
+ }}
41
+ >
42
+ <Pressable
43
+ onPress={closeOnBackdrop ? onDismiss : undefined}
44
+ style={{
45
+ backgroundColor: theme.semantics.neutral.text,
46
+ bottom: 0,
47
+ left: 0,
48
+ opacity: animation.backdropOpacity,
49
+ position: 'absolute',
50
+ right: 0,
51
+ top: 0,
52
+ }}
53
+ testID={testID ? `${testID}-backdrop` : undefined}
54
+ />
55
+ <FocusScope
56
+ active={visible}
57
+ onEscape={onDismiss}
58
+ testID={testID ? `${testID}-focus` : undefined}
59
+ >
60
+ <Box
61
+ pointerEvents="box-none"
62
+ style={{
63
+ flex: 1,
64
+ justifyContent: 'flex-end',
65
+ }}
66
+ >
67
+ <View
68
+ accessible
69
+ accessibilityViewIsModal
70
+ style={{
71
+ alignSelf: 'center',
72
+ maxWidth: 560,
73
+ padding: 16,
74
+ width: '100%',
75
+ }}
76
+ >
77
+ <Surface
78
+ p="m"
79
+ style={{
80
+ borderRadius: 24,
81
+ shadowOpacity: 0.16,
82
+ shadowRadius: 18,
83
+ shadowOffset: { width: 0, height: -8 },
84
+ }}
85
+ testID={testID}
86
+ variant="raised"
87
+ >
88
+ <Stack gap="s">
89
+ {title || description ? (
90
+ <Box px="m" py="s">
91
+ <Stack gap="xxs">
92
+ {title ? (
93
+ <Text align="center" variant="label" weight="semiBold">
94
+ {title}
95
+ </Text>
96
+ ) : null}
97
+ {description ? (
98
+ <Text align="center" emphasis="muted" variant="bodySmall">
99
+ {description}
100
+ </Text>
101
+ ) : null}
102
+ </Stack>
103
+ </Box>
104
+ ) : null}
105
+ <Stack gap="xxs">{children}</Stack>
106
+ {onDismiss ? (
107
+ <ActionSheetItem
108
+ label={cancelLabel}
109
+ onPress={onDismiss}
110
+ testID={testID ? `${testID}-cancel` : undefined}
111
+ />
112
+ ) : null}
113
+ </Stack>
114
+ </Surface>
115
+ </View>
116
+ </Box>
117
+ </FocusScope>
118
+ </View>
119
+ </Portal>
120
+ );
121
+ }
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+
3
+ import { Box, Inline, Stack } from '../../layout';
4
+ import { ButtonBase } from '../../primitives/button-base';
5
+ import { Text } from '../../primitives/text';
6
+ import type { ActionSheetItemProps } from './types';
7
+
8
+ export function ActionSheetItem({
9
+ label,
10
+ description,
11
+ leading,
12
+ trailing,
13
+ color,
14
+ disabled = false,
15
+ selected = false,
16
+ onPress,
17
+ testID,
18
+ }: ActionSheetItemProps) {
19
+ return (
20
+ <ButtonBase
21
+ accessibilityRole="button"
22
+ accessibilityState={{ disabled, selected }}
23
+ disabled={disabled}
24
+ onPress={onPress}
25
+ radius="m"
26
+ testID={testID}
27
+ >
28
+ {(state) => (
29
+ <Box
30
+ px="m"
31
+ py="m"
32
+ radius="m"
33
+ style={{
34
+ opacity: state.disabled ? 0.56 : 1,
35
+ }}
36
+ >
37
+ <Inline align="center" gap="m" justify="space-between" wrap="nowrap">
38
+ {leading ? <Box>{leading}</Box> : null}
39
+ <Box flex={1}>
40
+ <Stack gap="xxs">
41
+ <Text color={color} variant="body" weight={selected ? 'semiBold' : 'medium'}>
42
+ {label}
43
+ </Text>
44
+ {description ? (
45
+ <Text emphasis="muted" variant="bodySmall">
46
+ {description}
47
+ </Text>
48
+ ) : null}
49
+ </Stack>
50
+ </Box>
51
+ {trailing ? <Box>{trailing}</Box> : null}
52
+ </Inline>
53
+ </Box>
54
+ )}
55
+ </ButtonBase>
56
+ );
57
+ }
@@ -0,0 +1,3 @@
1
+ export { ActionSheet } from './ActionSheet';
2
+ export { ActionSheetItem } from './ActionSheetItem';
3
+ export type { ActionSheetItemProps, ActionSheetProps } from './types';
@@ -0,0 +1,26 @@
1
+ import type React from 'react';
2
+
3
+ import type { SurfaceColor } from '../../surfaceColor';
4
+
5
+ export interface ActionSheetProps {
6
+ visible: boolean;
7
+ onDismiss?: (() => void) | undefined;
8
+ title?: React.ReactNode;
9
+ description?: React.ReactNode;
10
+ children?: React.ReactNode;
11
+ cancelLabel?: React.ReactNode;
12
+ closeOnBackdrop?: boolean;
13
+ testID?: string;
14
+ }
15
+
16
+ export interface ActionSheetItemProps {
17
+ label: React.ReactNode;
18
+ description?: React.ReactNode;
19
+ leading?: React.ReactNode;
20
+ trailing?: React.ReactNode;
21
+ color?: SurfaceColor;
22
+ disabled?: boolean;
23
+ selected?: boolean;
24
+ onPress?: (() => void) | undefined;
25
+ testID?: string;
26
+ }
@@ -9,7 +9,7 @@ import type { BadgeProps } from './types';
9
9
  export function Badge({
10
10
  content,
11
11
  variant = 'soft',
12
- tone = 'primary',
12
+ color = 'primary',
13
13
  size = 's',
14
14
  testID,
15
15
  }: BadgeProps) {
@@ -17,7 +17,7 @@ export function Badge({
17
17
  const controlSize = resolveControlSize(theme, size);
18
18
  const colors = resolveButtonColors(theme, {
19
19
  variant,
20
- tone,
20
+ color,
21
21
  state: {
22
22
  disabled: false,
23
23
  focused: false,
@@ -39,7 +39,12 @@ export function Badge({
39
39
  }}
40
40
  testID={testID}
41
41
  >
42
- <Text color={colors.contentColor} variant="bodySmall" weight="medium">
42
+ <Text
43
+ color={color}
44
+ emphasis={variant === 'solid' ? 'inverse' : 'default'}
45
+ variant="bodySmall"
46
+ weight="medium"
47
+ >
43
48
  {content}
44
49
  </Text>
45
50
  </Box>
@@ -2,12 +2,12 @@ import type React from 'react';
2
2
 
3
3
  import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
4
4
  import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
5
- import type { ComponentTone } from '../../internal/resolvers/resolveTone';
5
+ import type { SurfaceColor } from '../../surfaceColor';
6
6
 
7
7
  export interface BadgeProps {
8
8
  content?: React.ReactNode;
9
9
  variant?: Extract<ButtonVariant, 'solid' | 'soft' | 'outline'>;
10
- tone?: Extract<ComponentTone, 'primary' | 'neutral' | 'danger' | 'success' | 'warning'>;
10
+ color?: SurfaceColor;
11
11
  size?: ControlSize;
12
12
  testID?: string;
13
13
  }
@@ -12,7 +12,7 @@ import type { ButtonProps } from './types';
12
12
  export function Button({
13
13
  children,
14
14
  variant = 'solid',
15
- tone = 'primary',
15
+ color = 'primary',
16
16
  size = 'm',
17
17
  disabled = false,
18
18
  loading = false,
@@ -41,9 +41,14 @@ export function Button({
41
41
  {(state) => {
42
42
  const colors = resolveButtonColors(theme, {
43
43
  variant,
44
- tone,
44
+ color,
45
45
  state,
46
46
  });
47
+ const textEmphasis =
48
+ colors.contentColor === theme.semantics.content.muted ? 'muted' : 'default';
49
+ const resolvedTextColor = textEmphasis === 'muted' ? undefined : color;
50
+ const resolvedTextEmphasis =
51
+ textEmphasis === 'muted' ? 'muted' : variant === 'solid' ? 'inverse' : 'default';
47
52
  const iconSize = resolveIconSize(theme, size);
48
53
 
49
54
  return (
@@ -78,7 +83,8 @@ export function Button({
78
83
  </View>
79
84
  ) : null}
80
85
  <Text
81
- color={colors.contentColor}
86
+ color={resolvedTextColor}
87
+ emphasis={resolvedTextEmphasis}
82
88
  variant={controlSize.textVariant}
83
89
  weight="semiBold"
84
90
  >
@@ -2,9 +2,9 @@ import type React from 'react';
2
2
 
3
3
  import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
4
4
  import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
5
- import type { ComponentTone } from '../../internal/resolvers/resolveTone';
6
5
  import type { ButtonBaseProps } from '../../primitives/button-base';
7
6
  import type { IconProps } from '../../primitives/icon';
7
+ import type { SurfaceColor } from '../../surfaceColor';
8
8
 
9
9
  export interface ButtonIconSpec {
10
10
  name: IconProps['name'];
@@ -17,7 +17,7 @@ export interface ButtonProps extends Omit<
17
17
  > {
18
18
  children?: React.ReactNode;
19
19
  variant?: ButtonVariant;
20
- tone?: ComponentTone;
20
+ color?: SurfaceColor;
21
21
  size?: ControlSize;
22
22
  loading?: boolean;
23
23
  leadingIcon?: ButtonIconSpec;
@@ -18,7 +18,7 @@ export function Checkbox({
18
18
  checked,
19
19
  defaultChecked = false,
20
20
  onCheckedChange,
21
- tone = 'primary',
21
+ color = 'primary',
22
22
  size = 'm',
23
23
  disabled = false,
24
24
  invalid = false,
@@ -69,8 +69,12 @@ export function Checkbox({
69
69
  fieldState,
70
70
  hovered: interactionState.hovered,
71
71
  pressed: interactionState.pressed,
72
- tone,
72
+ color,
73
73
  });
74
+ const labelEmphasis =
75
+ colors.labelColor === theme.semantics.content.muted ? 'muted' : 'default';
76
+ const indicatorColor = fieldState.invalid ? 'error' : color;
77
+ const indicatorEmphasis = disabled ? 'muted' : 'inverse';
74
78
 
75
79
  return (
76
80
  <Box
@@ -93,14 +97,19 @@ export function Checkbox({
93
97
  }}
94
98
  >
95
99
  {isChecked ? (
96
- <Text color={colors.indicatorColor} variant="caption" weight="bold">
100
+ <Text
101
+ color={disabled ? undefined : indicatorColor}
102
+ emphasis={indicatorEmphasis}
103
+ variant="caption"
104
+ weight="bold"
105
+ >
97
106
  ✓
98
107
  </Text>
99
108
  ) : null}
100
109
  </Box>
101
110
  {children ? (
102
111
  <Box ml="s">
103
- <Text color={colors.labelColor}>{children}</Text>
112
+ <Text emphasis={labelEmphasis}>{children}</Text>
104
113
  </Box>
105
114
  ) : null}
106
115
  </Box>
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
2
 
3
3
  import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
4
- import type { ComponentTone } from '../../internal/resolvers/resolveTone';
5
4
  import type { ButtonBaseProps } from '../../primitives/button-base';
5
+ import type { SurfaceColor } from '../../surfaceColor';
6
6
 
7
7
  export interface CheckboxProps extends Omit<
8
8
  ButtonBaseProps,
@@ -12,7 +12,7 @@ export interface CheckboxProps extends Omit<
12
12
  checked?: boolean;
13
13
  defaultChecked?: boolean;
14
14
  onCheckedChange?: ((checked: boolean) => void) | undefined;
15
- tone?: ComponentTone;
15
+ color?: SurfaceColor;
16
16
  size?: ControlSize;
17
17
  invalid?: boolean;
18
18
  readOnly?: boolean;
@@ -28,15 +28,23 @@ export function Field({
28
28
  return (
29
29
  <Stack gap="xs" testID={testID}>
30
30
  {label ? (
31
- <Label required={required} tone={presentation.labelTone}>
31
+ <Label
32
+ color={presentation.labelColor}
33
+ emphasis={presentation.labelEmphasis}
34
+ required={required}
35
+ >
32
36
  {label}
33
37
  </Label>
34
38
  ) : null}
35
39
  <Box>{children}</Box>
36
40
  {hasErrorText ? (
37
- <HelperText tone={presentation.helperTone}>{errorText}</HelperText>
41
+ <HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
42
+ {errorText}
43
+ </HelperText>
38
44
  ) : helperText ? (
39
- <HelperText tone={presentation.helperTone}>{helperText}</HelperText>
45
+ <HelperText color={presentation.helperColor} emphasis={presentation.helperEmphasis}>
46
+ {helperText}
47
+ </HelperText>
40
48
  ) : null}
41
49
  </Stack>
42
50
  );
@@ -3,9 +3,9 @@ import React from 'react';
3
3
  import { Text } from '../../primitives/text';
4
4
  import type { HelperTextProps } from './types';
5
5
 
6
- export function HelperText({ children, tone = 'muted', testID }: HelperTextProps) {
6
+ export function HelperText({ children, emphasis = 'muted', color, testID }: HelperTextProps) {
7
7
  return (
8
- <Text testID={testID} tone={tone} variant="caption">
8
+ <Text color={color} emphasis={emphasis} testID={testID} variant="caption">
9
9
  {children}
10
10
  </Text>
11
11
  );
@@ -1,9 +1,10 @@
1
1
  import type React from 'react';
2
2
 
3
- import type { TextTone } from '../../internal/resolvers/resolveTextColor';
3
+ import type { SurfaceColor, SurfaceEmphasis } from '../../surfaceColor';
4
4
 
5
5
  export interface HelperTextProps {
6
6
  children?: React.ReactNode;
7
- tone?: Extract<TextTone, 'default' | 'muted' | 'danger'>;
7
+ emphasis?: Extract<SurfaceEmphasis, 'default' | 'muted'>;
8
+ color?: Extract<SurfaceColor, 'error'>;
8
9
  testID?: string;
9
10
  }
@@ -11,7 +11,7 @@ export function IconButton({
11
11
  icon,
12
12
  accessibilityLabel,
13
13
  variant = 'ghost',
14
- tone = 'primary',
14
+ color = 'primary',
15
15
  size = 'm',
16
16
  disabled = false,
17
17
  onPress,
@@ -30,7 +30,7 @@ export function IconButton({
30
30
  testID={testID}
31
31
  >
32
32
  {(state) => {
33
- const colors = resolveButtonColors(theme, { state, tone, variant });
33
+ const colors = resolveButtonColors(theme, { color, state, variant });
34
34
 
35
35
  return (
36
36
  <Box
@@ -1,8 +1,8 @@
1
1
  import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
2
2
  import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
3
- import type { ComponentTone } from '../../internal/resolvers/resolveTone';
4
3
  import type { ButtonBaseProps } from '../../primitives/button-base';
5
4
  import type { IconProps } from '../../primitives/icon';
5
+ import type { SurfaceColor } from '../../surfaceColor';
6
6
 
7
7
  export interface IconButtonProps extends Omit<
8
8
  ButtonBaseProps,
@@ -14,6 +14,6 @@ export interface IconButtonProps extends Omit<
14
14
  };
15
15
  accessibilityLabel: string;
16
16
  variant?: ButtonVariant;
17
- tone?: ComponentTone;
17
+ color?: SurfaceColor;
18
18
  size?: ControlSize;
19
19
  }