@cdx-ui/components 0.3.5 → 0.3.6

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 (278) hide show
  1. package/README.md +1 -1
  2. package/coverage.svg +1 -1
  3. package/docs/components/bar-chart/content.md +703 -0
  4. package/docs/components/content.md +9 -1
  5. package/docs/components/line-chart/content.md +567 -0
  6. package/docs/components/pie-chart/content.md +493 -0
  7. package/docs/components/progress-segmented/content.md +1 -1
  8. package/docs/components/stepper/content.md +599 -0
  9. package/docs/components/system-alert/content.md +533 -0
  10. package/docs/foundations/styles/tokens/all-tokens/content.md +2 -1
  11. package/docs/llms.txt +9 -0
  12. package/docs/patterns/content.md +1 -0
  13. package/docs/patterns/dashboard/content.md +423 -19
  14. package/docs/patterns/insights/content.md +590 -0
  15. package/docs/resources/release-notes/0.3.5/content.md +7 -0
  16. package/docs/resources/release-notes/content.md +1 -0
  17. package/lib/commonjs/components/BarChart/geometry.js +1130 -0
  18. package/lib/commonjs/components/BarChart/geometry.js.map +1 -0
  19. package/lib/commonjs/components/BarChart/index.js +942 -0
  20. package/lib/commonjs/components/BarChart/index.js.map +1 -0
  21. package/lib/commonjs/components/BarChart/styles.js +26 -0
  22. package/lib/commonjs/components/BarChart/styles.js.map +1 -0
  23. package/lib/commonjs/components/Button/index.js +2 -2
  24. package/lib/commonjs/components/Button/index.js.map +1 -1
  25. package/lib/commonjs/components/LineChart/geometry.js +698 -0
  26. package/lib/commonjs/components/LineChart/geometry.js.map +1 -0
  27. package/lib/commonjs/components/LineChart/index.js +747 -0
  28. package/lib/commonjs/components/LineChart/index.js.map +1 -0
  29. package/lib/commonjs/components/LineChart/styles.js +25 -0
  30. package/lib/commonjs/components/LineChart/styles.js.map +1 -0
  31. package/lib/commonjs/components/PieChart/geometry.js +216 -0
  32. package/lib/commonjs/components/PieChart/geometry.js.map +1 -0
  33. package/lib/commonjs/components/PieChart/index.js +476 -0
  34. package/lib/commonjs/components/PieChart/index.js.map +1 -0
  35. package/lib/commonjs/components/PieChart/styles.js +88 -0
  36. package/lib/commonjs/components/PieChart/styles.js.map +1 -0
  37. package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js +9 -31
  38. package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
  39. package/lib/commonjs/components/ProgressCircle/ProgressRing.js +52 -0
  40. package/lib/commonjs/components/ProgressCircle/ProgressRing.js.map +1 -0
  41. package/lib/commonjs/components/ScrollShadow/useScrollShadow.js +8 -7
  42. package/lib/commonjs/components/ScrollShadow/useScrollShadow.js.map +1 -1
  43. package/lib/commonjs/components/Stepper/index.js +369 -0
  44. package/lib/commonjs/components/Stepper/index.js.map +1 -0
  45. package/lib/commonjs/components/Stepper/styles.js +211 -0
  46. package/lib/commonjs/components/Stepper/styles.js.map +1 -0
  47. package/lib/commonjs/components/Stepper/useStepperLabelFit.js +22 -0
  48. package/lib/commonjs/components/Stepper/useStepperLabelFit.js.map +1 -0
  49. package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js +52 -0
  50. package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js.map +1 -0
  51. package/lib/commonjs/components/Stepper/useStepperRingColors.js +31 -0
  52. package/lib/commonjs/components/Stepper/useStepperRingColors.js.map +1 -0
  53. package/lib/commonjs/components/SystemAlert/animation.js +218 -0
  54. package/lib/commonjs/components/SystemAlert/animation.js.map +1 -0
  55. package/lib/commonjs/components/SystemAlert/index.js +525 -0
  56. package/lib/commonjs/components/SystemAlert/index.js.map +1 -0
  57. package/lib/commonjs/components/SystemAlert/styles.js +178 -0
  58. package/lib/commonjs/components/SystemAlert/styles.js.map +1 -0
  59. package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js +53 -0
  60. package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
  61. package/lib/commonjs/components/Tabs/index.js +4 -0
  62. package/lib/commonjs/components/Tabs/index.js.map +1 -1
  63. package/lib/commonjs/components/Tabs/styles.js +1 -1
  64. package/lib/commonjs/components/Tabs/styles.js.map +1 -1
  65. package/lib/commonjs/components/chart/ChartInspector.js +610 -0
  66. package/lib/commonjs/components/chart/ChartInspector.js.map +1 -0
  67. package/lib/commonjs/components/chart/format.js +93 -0
  68. package/lib/commonjs/components/chart/format.js.map +1 -0
  69. package/lib/commonjs/components/chart/index.js +2 -0
  70. package/lib/commonjs/components/chart/index.js.map +1 -0
  71. package/lib/commonjs/components/chart/motion.js +97 -0
  72. package/lib/commonjs/components/chart/motion.js.map +1 -0
  73. package/lib/commonjs/components/chart/palette.js +178 -0
  74. package/lib/commonjs/components/chart/palette.js.map +1 -0
  75. package/lib/commonjs/components/chart/size.js +34 -0
  76. package/lib/commonjs/components/chart/size.js.map +1 -0
  77. package/lib/commonjs/components/chart/ticks.js +59 -0
  78. package/lib/commonjs/components/chart/ticks.js.map +1 -0
  79. package/lib/commonjs/components/chart/types.js +6 -0
  80. package/lib/commonjs/components/chart/types.js.map +1 -0
  81. package/lib/commonjs/components/chart/useChartHostWidth.js +27 -0
  82. package/lib/commonjs/components/chart/useChartHostWidth.js.map +1 -0
  83. package/lib/commonjs/components/index.js +60 -0
  84. package/lib/commonjs/components/index.js.map +1 -1
  85. package/lib/commonjs/figma/SystemAlert.Button.figma.js +28 -0
  86. package/lib/commonjs/figma/SystemAlert.Button.figma.js.map +1 -0
  87. package/lib/commonjs/figma/SystemAlert.Close.figma.js +22 -0
  88. package/lib/commonjs/figma/SystemAlert.Close.figma.js.map +1 -0
  89. package/lib/commonjs/figma/SystemAlert.Description.figma.js +20 -0
  90. package/lib/commonjs/figma/SystemAlert.Description.figma.js.map +1 -0
  91. package/lib/commonjs/figma/SystemAlert.IconButton.figma.js +31 -0
  92. package/lib/commonjs/figma/SystemAlert.IconButton.figma.js.map +1 -0
  93. package/lib/commonjs/figma/SystemAlert.figma.js +48 -0
  94. package/lib/commonjs/figma/SystemAlert.figma.js.map +1 -0
  95. package/lib/module/components/BarChart/geometry.js +1110 -0
  96. package/lib/module/components/BarChart/geometry.js.map +1 -0
  97. package/lib/module/components/BarChart/index.js +936 -0
  98. package/lib/module/components/BarChart/index.js.map +1 -0
  99. package/lib/module/components/BarChart/styles.js +22 -0
  100. package/lib/module/components/BarChart/styles.js.map +1 -0
  101. package/lib/module/components/Button/index.js +2 -2
  102. package/lib/module/components/Button/index.js.map +1 -1
  103. package/lib/module/components/LineChart/geometry.js +685 -0
  104. package/lib/module/components/LineChart/geometry.js.map +1 -0
  105. package/lib/module/components/LineChart/index.js +741 -0
  106. package/lib/module/components/LineChart/index.js.map +1 -0
  107. package/lib/module/components/LineChart/styles.js +21 -0
  108. package/lib/module/components/LineChart/styles.js.map +1 -0
  109. package/lib/module/components/PieChart/geometry.js +209 -0
  110. package/lib/module/components/PieChart/geometry.js.map +1 -0
  111. package/lib/module/components/PieChart/index.js +471 -0
  112. package/lib/module/components/PieChart/index.js.map +1 -0
  113. package/lib/module/components/PieChart/styles.js +84 -0
  114. package/lib/module/components/PieChart/styles.js.map +1 -0
  115. package/lib/module/components/ProgressCircle/ProgressCircleRing.js +10 -32
  116. package/lib/module/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
  117. package/lib/module/components/ProgressCircle/ProgressRing.js +48 -0
  118. package/lib/module/components/ProgressCircle/ProgressRing.js.map +1 -0
  119. package/lib/module/components/ScrollShadow/useScrollShadow.js +8 -7
  120. package/lib/module/components/ScrollShadow/useScrollShadow.js.map +1 -1
  121. package/lib/module/components/Stepper/index.js +360 -0
  122. package/lib/module/components/Stepper/index.js.map +1 -0
  123. package/lib/module/components/Stepper/styles.js +206 -0
  124. package/lib/module/components/Stepper/styles.js.map +1 -0
  125. package/lib/module/components/Stepper/useStepperLabelFit.js +18 -0
  126. package/lib/module/components/Stepper/useStepperLabelFit.js.map +1 -0
  127. package/lib/module/components/Stepper/useStepperLabelFit.web.js +48 -0
  128. package/lib/module/components/Stepper/useStepperLabelFit.web.js.map +1 -0
  129. package/lib/module/components/Stepper/useStepperRingColors.js +28 -0
  130. package/lib/module/components/Stepper/useStepperRingColors.js.map +1 -0
  131. package/lib/module/components/SystemAlert/animation.js +213 -0
  132. package/lib/module/components/SystemAlert/animation.js.map +1 -0
  133. package/lib/module/components/SystemAlert/index.js +515 -0
  134. package/lib/module/components/SystemAlert/index.js.map +1 -0
  135. package/lib/module/components/SystemAlert/styles.js +174 -0
  136. package/lib/module/components/SystemAlert/styles.js.map +1 -0
  137. package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js +49 -0
  138. package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
  139. package/lib/module/components/Tabs/index.js +4 -0
  140. package/lib/module/components/Tabs/index.js.map +1 -1
  141. package/lib/module/components/Tabs/styles.js +1 -1
  142. package/lib/module/components/Tabs/styles.js.map +1 -1
  143. package/lib/module/components/chart/ChartInspector.js +600 -0
  144. package/lib/module/components/chart/ChartInspector.js.map +1 -0
  145. package/lib/module/components/chart/format.js +84 -0
  146. package/lib/module/components/chart/format.js.map +1 -0
  147. package/lib/module/components/chart/index.js +2 -0
  148. package/lib/module/components/chart/index.js.map +1 -0
  149. package/lib/module/components/chart/motion.js +89 -0
  150. package/lib/module/components/chart/motion.js.map +1 -0
  151. package/lib/module/components/chart/palette.js +168 -0
  152. package/lib/module/components/chart/palette.js.map +1 -0
  153. package/lib/module/components/chart/size.js +29 -0
  154. package/lib/module/components/chart/size.js.map +1 -0
  155. package/lib/module/components/chart/ticks.js +55 -0
  156. package/lib/module/components/chart/ticks.js.map +1 -0
  157. package/lib/module/components/chart/types.js +4 -0
  158. package/lib/module/components/chart/types.js.map +1 -0
  159. package/lib/module/components/chart/useChartHostWidth.js +23 -0
  160. package/lib/module/components/chart/useChartHostWidth.js.map +1 -0
  161. package/lib/module/components/index.js +5 -0
  162. package/lib/module/components/index.js.map +1 -1
  163. package/lib/module/figma/SystemAlert.Button.figma.js +22 -0
  164. package/lib/module/figma/SystemAlert.Button.figma.js.map +1 -0
  165. package/lib/module/figma/SystemAlert.Close.figma.js +18 -0
  166. package/lib/module/figma/SystemAlert.Close.figma.js.map +1 -0
  167. package/lib/module/figma/SystemAlert.Description.figma.js +14 -0
  168. package/lib/module/figma/SystemAlert.Description.figma.js.map +1 -0
  169. package/lib/module/figma/SystemAlert.IconButton.figma.js +25 -0
  170. package/lib/module/figma/SystemAlert.IconButton.figma.js.map +1 -0
  171. package/lib/module/figma/SystemAlert.figma.js +42 -0
  172. package/lib/module/figma/SystemAlert.figma.js.map +1 -0
  173. package/lib/typescript/components/BarChart/geometry.d.ts +236 -0
  174. package/lib/typescript/components/BarChart/geometry.d.ts.map +1 -0
  175. package/lib/typescript/components/BarChart/index.d.ts +193 -0
  176. package/lib/typescript/components/BarChart/index.d.ts.map +1 -0
  177. package/lib/typescript/components/BarChart/styles.d.ts +32 -0
  178. package/lib/typescript/components/BarChart/styles.d.ts.map +1 -0
  179. package/lib/typescript/components/LineChart/geometry.d.ts +248 -0
  180. package/lib/typescript/components/LineChart/geometry.d.ts.map +1 -0
  181. package/lib/typescript/components/LineChart/index.d.ts +105 -0
  182. package/lib/typescript/components/LineChart/index.d.ts.map +1 -0
  183. package/lib/typescript/components/LineChart/styles.d.ts +12 -0
  184. package/lib/typescript/components/LineChart/styles.d.ts.map +1 -0
  185. package/lib/typescript/components/PieChart/geometry.d.ts +43 -0
  186. package/lib/typescript/components/PieChart/geometry.d.ts.map +1 -0
  187. package/lib/typescript/components/PieChart/index.d.ts +147 -0
  188. package/lib/typescript/components/PieChart/index.d.ts.map +1 -0
  189. package/lib/typescript/components/PieChart/styles.d.ts +27 -0
  190. package/lib/typescript/components/PieChart/styles.d.ts.map +1 -0
  191. package/lib/typescript/components/ProgressCircle/ProgressCircleRing.d.ts.map +1 -1
  192. package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts +17 -0
  193. package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts.map +1 -0
  194. package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts.map +1 -1
  195. package/lib/typescript/components/Stepper/index.d.ts +68 -0
  196. package/lib/typescript/components/Stepper/index.d.ts.map +1 -0
  197. package/lib/typescript/components/Stepper/styles.d.ts +46 -0
  198. package/lib/typescript/components/Stepper/styles.d.ts.map +1 -0
  199. package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts +15 -0
  200. package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts.map +1 -0
  201. package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts +10 -0
  202. package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts.map +1 -0
  203. package/lib/typescript/components/Stepper/useStepperRingColors.d.ts +6 -0
  204. package/lib/typescript/components/Stepper/useStepperRingColors.d.ts.map +1 -0
  205. package/lib/typescript/components/SystemAlert/animation.d.ts +56 -0
  206. package/lib/typescript/components/SystemAlert/animation.d.ts.map +1 -0
  207. package/lib/typescript/components/SystemAlert/index.d.ts +110 -0
  208. package/lib/typescript/components/SystemAlert/index.d.ts.map +1 -0
  209. package/lib/typescript/components/SystemAlert/styles.d.ts +38 -0
  210. package/lib/typescript/components/SystemAlert/styles.d.ts.map +1 -0
  211. package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts +14 -0
  212. package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts.map +1 -0
  213. package/lib/typescript/components/Tabs/index.d.ts.map +1 -1
  214. package/lib/typescript/components/chart/ChartInspector.d.ts +101 -0
  215. package/lib/typescript/components/chart/ChartInspector.d.ts.map +1 -0
  216. package/lib/typescript/components/chart/format.d.ts +16 -0
  217. package/lib/typescript/components/chart/format.d.ts.map +1 -0
  218. package/lib/typescript/components/chart/index.d.ts +3 -0
  219. package/lib/typescript/components/chart/index.d.ts.map +1 -0
  220. package/lib/typescript/components/chart/motion.d.ts +27 -0
  221. package/lib/typescript/components/chart/motion.d.ts.map +1 -0
  222. package/lib/typescript/components/chart/palette.d.ts +44 -0
  223. package/lib/typescript/components/chart/palette.d.ts.map +1 -0
  224. package/lib/typescript/components/chart/size.d.ts +25 -0
  225. package/lib/typescript/components/chart/size.d.ts.map +1 -0
  226. package/lib/typescript/components/chart/ticks.d.ts +3 -0
  227. package/lib/typescript/components/chart/ticks.d.ts.map +1 -0
  228. package/lib/typescript/components/chart/types.d.ts +163 -0
  229. package/lib/typescript/components/chart/types.d.ts.map +1 -0
  230. package/lib/typescript/components/chart/useChartHostWidth.d.ts +9 -0
  231. package/lib/typescript/components/chart/useChartHostWidth.d.ts.map +1 -0
  232. package/lib/typescript/components/index.d.ts +5 -0
  233. package/lib/typescript/components/index.d.ts.map +1 -1
  234. package/lib/typescript/figma/SystemAlert.Button.figma.d.ts +11 -0
  235. package/lib/typescript/figma/SystemAlert.Button.figma.d.ts.map +1 -0
  236. package/lib/typescript/figma/SystemAlert.Close.figma.d.ts +11 -0
  237. package/lib/typescript/figma/SystemAlert.Close.figma.d.ts.map +1 -0
  238. package/lib/typescript/figma/SystemAlert.Description.figma.d.ts +8 -0
  239. package/lib/typescript/figma/SystemAlert.Description.figma.d.ts.map +1 -0
  240. package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts +11 -0
  241. package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts.map +1 -0
  242. package/lib/typescript/figma/SystemAlert.figma.d.ts +8 -0
  243. package/lib/typescript/figma/SystemAlert.figma.d.ts.map +1 -0
  244. package/package.json +5 -5
  245. package/src/components/BarChart/geometry.ts +1469 -0
  246. package/src/components/BarChart/index.tsx +1424 -0
  247. package/src/components/BarChart/styles.ts +31 -0
  248. package/src/components/Button/index.tsx +1 -1
  249. package/src/components/LineChart/geometry.ts +957 -0
  250. package/src/components/LineChart/index.tsx +1109 -0
  251. package/src/components/LineChart/styles.ts +26 -0
  252. package/src/components/PieChart/geometry.ts +295 -0
  253. package/src/components/PieChart/index.tsx +715 -0
  254. package/src/components/PieChart/styles.ts +101 -0
  255. package/src/components/ProgressCircle/ProgressCircleRing.tsx +10 -39
  256. package/src/components/ProgressCircle/ProgressRing.tsx +60 -0
  257. package/src/components/ScrollShadow/useScrollShadow.ts +12 -11
  258. package/src/components/Stepper/index.tsx +452 -0
  259. package/src/components/Stepper/styles.ts +234 -0
  260. package/src/components/Stepper/useStepperLabelFit.ts +21 -0
  261. package/src/components/Stepper/useStepperLabelFit.web.ts +53 -0
  262. package/src/components/Stepper/useStepperRingColors.ts +29 -0
  263. package/src/components/SystemAlert/animation.ts +252 -0
  264. package/src/components/SystemAlert/index.tsx +684 -0
  265. package/src/components/SystemAlert/styles.ts +212 -0
  266. package/src/components/SystemAlert/useSystemAlertStatusBarStyle.ts +57 -0
  267. package/src/components/Tabs/index.tsx +4 -0
  268. package/src/components/Tabs/styles.ts +1 -1
  269. package/src/components/chart/ChartInspector.tsx +726 -0
  270. package/src/components/chart/format.ts +95 -0
  271. package/src/components/chart/index.ts +24 -0
  272. package/src/components/chart/motion.ts +98 -0
  273. package/src/components/chart/palette.tsx +247 -0
  274. package/src/components/chart/size.ts +21 -0
  275. package/src/components/chart/ticks.ts +53 -0
  276. package/src/components/chart/types.ts +183 -0
  277. package/src/components/chart/useChartHostWidth.ts +26 -0
  278. package/src/components/index.ts +5 -0
@@ -0,0 +1,212 @@
1
+ import { Platform } from 'react-native';
2
+ import { cva, type VariantProps } from '@cdx-ui/utils';
3
+
4
+ export type SystemAlertColor = 'danger' | 'warning' | 'success' | 'info' | 'brand';
5
+
6
+ // Button and IconButton have no on-strong ghost colour (and no `brand`), so the
7
+ // controls are restyled here, following Toast's neutral stand-in.
8
+ const ON_STRONG_INTERACTION: Record<SystemAlertColor, string | undefined> = {
9
+ danger: Platform.select({
10
+ default: 'data-[active=true]:bg-surface-danger-strong-active',
11
+ web: [
12
+ 'data-[hover=true]:bg-surface-danger-strong-hover',
13
+ 'data-[active=true]:data-[hover=true]:bg-surface-danger-strong-active',
14
+ 'web:data-[focus-visible=true]:ring-offset-surface-danger-strong',
15
+ ].join(' '),
16
+ }),
17
+ warning: Platform.select({
18
+ default: 'data-[active=true]:bg-surface-warning-strong-active',
19
+ web: [
20
+ 'data-[hover=true]:bg-surface-warning-strong-hover',
21
+ 'data-[active=true]:data-[hover=true]:bg-surface-warning-strong-active',
22
+ 'web:data-[focus-visible=true]:ring-offset-surface-warning-strong',
23
+ ].join(' '),
24
+ }),
25
+ success: Platform.select({
26
+ default: 'data-[active=true]:bg-surface-success-strong-active',
27
+ web: [
28
+ 'data-[hover=true]:bg-surface-success-strong-hover',
29
+ 'data-[active=true]:data-[hover=true]:bg-surface-success-strong-active',
30
+ 'web:data-[focus-visible=true]:ring-offset-surface-success-strong',
31
+ ].join(' '),
32
+ }),
33
+ info: Platform.select({
34
+ default: 'data-[active=true]:bg-surface-info-strong-active',
35
+ web: [
36
+ 'data-[hover=true]:bg-surface-info-strong-hover',
37
+ 'data-[active=true]:data-[hover=true]:bg-surface-info-strong-active',
38
+ 'web:data-[focus-visible=true]:ring-offset-surface-info-strong',
39
+ ].join(' '),
40
+ }),
41
+ brand: Platform.select({
42
+ default: 'data-[active=true]:bg-surface-brand-strong-active',
43
+ web: [
44
+ 'data-[hover=true]:bg-surface-brand-strong-hover',
45
+ 'data-[active=true]:data-[hover=true]:bg-surface-brand-strong-active',
46
+ 'web:data-[focus-visible=true]:ring-offset-surface-brand-strong',
47
+ ].join(' '),
48
+ }),
49
+ };
50
+
51
+ const ON_STRONG_CONTENT: Record<SystemAlertColor, string> = {
52
+ danger: 'text-content-danger-on-strong',
53
+ warning: 'text-content-warning-on-strong',
54
+ success: 'text-content-success-on-strong',
55
+ info: 'text-content-info-on-strong',
56
+ brand: 'text-content-brand-on-strong',
57
+ };
58
+
59
+ // ── Root ─────────────────────────────────────────────────────────────────────
60
+
61
+ export const systemAlertRootVariants = cva(['w-full'], {
62
+ variants: {
63
+ color: {
64
+ danger: 'bg-surface-danger-strong',
65
+ warning: 'bg-surface-warning-strong',
66
+ success: 'bg-surface-success-strong',
67
+ info: 'bg-surface-info-strong',
68
+ brand: 'bg-surface-brand-strong',
69
+ },
70
+ },
71
+ defaultVariants: {
72
+ color: 'info',
73
+ },
74
+ });
75
+
76
+ // ── Presence (internal clip wrapper and the surface inside it, `isOpen` only) ─
77
+
78
+ // Web: inline px heights transition on the wrapper and on the clip inside it, with the same
79
+ // timing. The wrapper's `minHeight` is the reserved inset, so the page moves only once the
80
+ // surface leaves the strip. The clip has no minimum and `justify-end` pins the surface's bottom
81
+ // edge to it, so the surface slides through the strip and `translateY = b − H` falls out of
82
+ // layout. A translate transition is composited and starts a frame before a height one in
83
+ // Chromium, which opens a gap. The timings mirror `SYSTEM_ALERT_ENTER_MS` /
84
+ // `SYSTEM_ALERT_EXIT_MS` in `./animation`. Native overrides the overflow inline; see
85
+ // `NATIVE_WRAPPER_STYLE` in `./index`.
86
+ const WEB_HEIGHT_TRANSITION = [
87
+ 'web:transition-[height] web:duration-300 web:ease-[cubic-bezier(0.32,0.72,0,1)]',
88
+ 'web:data-[state=closed]:duration-[220ms] web:data-[state=closed]:ease-[cubic-bezier(0.4,0,1,1)]',
89
+ 'web:motion-reduce:transition-none web:motion-reduce:duration-0',
90
+ ];
91
+
92
+ export const systemAlertPresenceVariants = cva([
93
+ 'w-full overflow-hidden',
94
+ ...WEB_HEIGHT_TRANSITION,
95
+ ]);
96
+
97
+ export const systemAlertPresenceClipVariants = cva([
98
+ 'w-full overflow-hidden justify-end',
99
+ ...WEB_HEIGHT_TRANSITION,
100
+ ]);
101
+
102
+ // The surface stays in flow so a settled wrapper sizes to it (`height: auto`); `shrink-0`
103
+ // keeps its natural height while the wrapper's animated height is smaller.
104
+ export const systemAlertPresenceSurfaceVariants = cva(['shrink-0']);
105
+
106
+ // ── Body (internal row below the safe-area padding) ──────────────────────────
107
+
108
+ export const systemAlertBodyVariants = cva(['flex-row items-start min-h-11 ps-3 pe-3']);
109
+
110
+ // ── Icon ─────────────────────────────────────────────────────────────────────
111
+
112
+ // `mt-3` centres the 20px glyph on the first 20px text line of the 44px row.
113
+ export const systemAlertIconVariants = cva(['size-5 shrink-0 mt-3 me-3'], {
114
+ variants: {
115
+ color: ON_STRONG_CONTENT,
116
+ },
117
+ defaultVariants: {
118
+ color: 'info',
119
+ },
120
+ });
121
+
122
+ // ── Description ──────────────────────────────────────────────────────────────
123
+
124
+ export const systemAlertDescriptionVariants = cva(['flex-1 min-w-0 py-3 body-md font-medium'], {
125
+ variants: {
126
+ color: ON_STRONG_CONTENT,
127
+ },
128
+ defaultVariants: {
129
+ color: 'info',
130
+ },
131
+ });
132
+
133
+ // ── Actions ──────────────────────────────────────────────────────────────────
134
+
135
+ // The `-me-1.5` end offset optically aligns the last ghost control with the row
136
+ // padding. When the root renders a close button, the close button carries it.
137
+ export const systemAlertActionsVariants = cva(['shrink-0 flex-row items-center gap-0.5 py-1.5'], {
138
+ variants: {
139
+ hasClose: {
140
+ true: '',
141
+ false: '-me-1.5',
142
+ },
143
+ },
144
+ defaultVariants: {
145
+ hasClose: false,
146
+ },
147
+ });
148
+
149
+ // ── Action (ghost small Button) ──────────────────────────────────────────────
150
+
151
+ export const systemAlertActionVariants = cva([], {
152
+ variants: {
153
+ color: ON_STRONG_INTERACTION,
154
+ },
155
+ defaultVariants: {
156
+ color: 'info',
157
+ },
158
+ });
159
+
160
+ export const systemAlertActionLabelVariants = cva([], {
161
+ variants: {
162
+ color: ON_STRONG_CONTENT,
163
+ },
164
+ defaultVariants: {
165
+ color: 'info',
166
+ },
167
+ });
168
+
169
+ // ── IconAction (ghost small IconButton) ──────────────────────────────────────
170
+
171
+ export const systemAlertIconActionVariants = cva([], {
172
+ variants: {
173
+ color: ON_STRONG_INTERACTION,
174
+ },
175
+ defaultVariants: {
176
+ color: 'info',
177
+ },
178
+ });
179
+
180
+ export const systemAlertIconActionIconVariants = cva([], {
181
+ variants: {
182
+ color: ON_STRONG_CONTENT,
183
+ },
184
+ defaultVariants: {
185
+ color: 'info',
186
+ },
187
+ });
188
+
189
+ // ── Close (ghost small IconButton rendered by the root) ──────────────────────
190
+
191
+ // `my-1.5` matches the actions row's vertical padding; `ms-0.5` matches its gap.
192
+ export const systemAlertCloseVariants = cva(['my-1.5 ms-0.5 -me-1.5'], {
193
+ variants: {
194
+ color: ON_STRONG_INTERACTION,
195
+ },
196
+ defaultVariants: {
197
+ color: 'info',
198
+ },
199
+ });
200
+
201
+ export const systemAlertCloseIconVariants = cva([], {
202
+ variants: {
203
+ color: ON_STRONG_CONTENT,
204
+ },
205
+ defaultVariants: {
206
+ color: 'info',
207
+ },
208
+ });
209
+
210
+ // ── Types ────────────────────────────────────────────────────────────────────
211
+
212
+ export type SystemAlertVariantProps = VariantProps<typeof systemAlertRootVariants>;
@@ -0,0 +1,57 @@
1
+ import { useCSSVariable } from 'uniwind';
2
+ import type { SystemAlertColor } from './styles';
3
+
4
+ export type SystemAlertStatusBarStyle = 'light' | 'dark';
5
+
6
+ // Light-theme glyphs, used when the token cannot be read (no Uniwind runtime, e.g. Jest).
7
+ const FALLBACKS: Record<SystemAlertColor, SystemAlertStatusBarStyle> = {
8
+ danger: 'light',
9
+ warning: 'dark',
10
+ success: 'light',
11
+ info: 'light',
12
+ brand: 'light',
13
+ };
14
+
15
+ // Above this relative luminance, black contrasts more than white (the two ratios meet at ~0.179).
16
+ const LIGHT_LUMINANCE = 0.179;
17
+
18
+ function relativeLuminance(value: string): number | undefined {
19
+ const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})(?:[0-9a-f]{2})?$/i.exec(value.trim());
20
+ let channels: number[] | undefined;
21
+ if (hex) {
22
+ const digits =
23
+ hex[1].length === 3
24
+ ? hex[1]
25
+ .split('')
26
+ .map((digit) => digit + digit)
27
+ .join('')
28
+ : hex[1];
29
+ channels = [0, 2, 4].map((start) => Number.parseInt(digits.slice(start, start + 2), 16));
30
+ } else {
31
+ const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(value.trim());
32
+ if (rgb) channels = rgb.slice(1, 4).map(Number);
33
+ }
34
+ if (!channels || channels.some((channel) => !Number.isFinite(channel))) return undefined;
35
+ const [r, g, b] = channels.map((channel) => {
36
+ const c = channel / 255;
37
+ return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
38
+ });
39
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
40
+ }
41
+
42
+ /**
43
+ * The status-bar glyph style that matches a SystemAlert's text on its strong surface, for a
44
+ * banner that paints behind the status bar. Read from the active theme's
45
+ * `content-{color}-on-strong` token, so it follows FI themes and light and dark mode.
46
+ *
47
+ * SystemAlert never sets the status bar. Pass the result to whatever owns it in your app,
48
+ * such as `expo-status-bar`'s `style`, React Native `StatusBar`'s `barStyle`
49
+ * (`'light-content'` / `'dark-content'`), or your navigator's status-bar option, and apply it
50
+ * only while the banner is open and its screen is focused.
51
+ */
52
+ export function useSystemAlertStatusBarStyle(color: SystemAlertColor): SystemAlertStatusBarStyle {
53
+ const textColor = useCSSVariable(`--color-content-${color}-on-strong`);
54
+ const luminance = typeof textColor === 'string' ? relativeLuminance(textColor) : undefined;
55
+ if (luminance === undefined) return FALLBACKS[color];
56
+ return luminance > LIGHT_LUMINANCE ? 'light' : 'dark';
57
+ }
@@ -71,6 +71,9 @@ interface TabLayout {
71
71
  height: number;
72
72
  }
73
73
 
74
+ /** Ignore subpixel web layout drift when deciding whether an overflow control is needed. */
75
+ const SCROLL_EDGE_TOLERANCE = 1;
76
+
74
77
  /** Minimum horizontal scroll offset so `layout` is fully inside the viewport. */
75
78
  function scrollXToRevealTab(
76
79
  layout: TabLayout,
@@ -481,6 +484,7 @@ const TabsList = forwardRef<ComponentRef<typeof View>, TabsListProps>(
481
484
  orientation="horizontal"
482
485
  surface={isSolidHorizontalScroll ? 'secondary' : 'background'}
483
486
  size={isSolidHorizontalScroll ? 'default' : 'small'}
487
+ offset={SCROLL_EDGE_TOLERANCE}
484
488
  edgeClassName={isSolidHorizontalScroll ? undefined : 'opacity-85'}
485
489
  onCapabilityChange={setScrollCapability}
486
490
  >
@@ -307,7 +307,7 @@ export const tabsPanelVariants = cva(['data-[state=inactive]:hidden'], {
307
307
  defaultVariants: { orientation: 'horizontal' },
308
308
  });
309
309
 
310
- export const tabsTabLabelVariants = cva('body-md', {
310
+ export const tabsTabLabelVariants = cva('body-md text-center', {
311
311
  variants: {
312
312
  state: {
313
313
  // Selection state is a CVA input (not a `data-[]` selector) so inactive/active