orn-ui 0.2.10 → 0.3.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 (552) hide show
  1. package/AGENTS.md +66 -51
  2. package/README.md +3 -7
  3. package/lib/commonjs/atoms/Avatar.js +77 -5
  4. package/lib/commonjs/atoms/Avatar.js.map +1 -1
  5. package/lib/commonjs/atoms/Badge.js +17 -8
  6. package/lib/commonjs/atoms/Badge.js.map +1 -1
  7. package/lib/commonjs/atoms/Button.js +108 -39
  8. package/lib/commonjs/atoms/Button.js.map +1 -1
  9. package/lib/commonjs/atoms/Card.js +24 -2
  10. package/lib/commonjs/atoms/Card.js.map +1 -1
  11. package/lib/commonjs/atoms/Checkbox.js +41 -10
  12. package/lib/commonjs/atoms/Checkbox.js.map +1 -1
  13. package/lib/commonjs/atoms/Divider.js +30 -5
  14. package/lib/commonjs/atoms/Divider.js.map +1 -1
  15. package/lib/commonjs/atoms/EmptyState.js +58 -20
  16. package/lib/commonjs/atoms/EmptyState.js.map +1 -1
  17. package/lib/commonjs/atoms/Fab.js +32 -12
  18. package/lib/commonjs/atoms/Fab.js.map +1 -1
  19. package/lib/commonjs/atoms/Gradient.js +102 -36
  20. package/lib/commonjs/atoms/Gradient.js.map +1 -1
  21. package/lib/commonjs/atoms/IconButton.js +25 -4
  22. package/lib/commonjs/atoms/IconButton.js.map +1 -1
  23. package/lib/commonjs/atoms/Image.js +61 -25
  24. package/lib/commonjs/atoms/Image.js.map +1 -1
  25. package/lib/commonjs/atoms/Input.js +105 -17
  26. package/lib/commonjs/atoms/Input.js.map +1 -1
  27. package/lib/commonjs/atoms/KeyValueRow.js +37 -9
  28. package/lib/commonjs/atoms/KeyValueRow.js.map +1 -1
  29. package/lib/commonjs/atoms/PressableScale.js +25 -5
  30. package/lib/commonjs/atoms/PressableScale.js.map +1 -1
  31. package/lib/commonjs/atoms/ShinyText.js +29 -29
  32. package/lib/commonjs/atoms/Skeleton.js +28 -13
  33. package/lib/commonjs/atoms/Skeleton.js.map +1 -1
  34. package/lib/commonjs/atoms/Spinner.js +81 -22
  35. package/lib/commonjs/atoms/Spinner.js.map +1 -1
  36. package/lib/commonjs/atoms/Text.js +56 -5
  37. package/lib/commonjs/atoms/Text.js.map +1 -1
  38. package/lib/commonjs/atoms/Transition.js +46 -43
  39. package/lib/commonjs/atoms/Transition.js.map +1 -1
  40. package/lib/commonjs/atoms/index.js +6 -0
  41. package/lib/commonjs/atoms/index.js.map +1 -1
  42. package/lib/commonjs/atoms/inputValidation.js +56 -0
  43. package/lib/commonjs/atoms/inputValidation.js.map +1 -0
  44. package/lib/commonjs/icons/Icon.js +4 -4
  45. package/lib/commonjs/icons/defaultIcons.js +576 -24
  46. package/lib/commonjs/icons/defaultIcons.js.map +1 -1
  47. package/lib/commonjs/icons/index.js +6 -0
  48. package/lib/commonjs/icons/index.js.map +1 -1
  49. package/lib/commonjs/molecules/AvatarHeader.js +47 -14
  50. package/lib/commonjs/molecules/AvatarHeader.js.map +1 -1
  51. package/lib/commonjs/molecules/FormActions.js +25 -9
  52. package/lib/commonjs/molecules/FormActions.js.map +1 -1
  53. package/lib/commonjs/molecules/InfoRow.js +30 -14
  54. package/lib/commonjs/molecules/InfoRow.js.map +1 -1
  55. package/lib/commonjs/molecules/OptionCard.js +37 -22
  56. package/lib/commonjs/molecules/OptionCard.js.map +1 -1
  57. package/lib/commonjs/molecules/SegmentedControl.js +103 -14
  58. package/lib/commonjs/molecules/SegmentedControl.js.map +1 -1
  59. package/lib/commonjs/molecules/Stepper.js +61 -16
  60. package/lib/commonjs/molecules/Stepper.js.map +1 -1
  61. package/lib/commonjs/molecules/Steps.js +105 -41
  62. package/lib/commonjs/molecules/Steps.js.map +1 -1
  63. package/lib/commonjs/molecules/SymmetricGrid.js +26 -18
  64. package/lib/commonjs/molecules/SymmetricGrid.js.map +1 -1
  65. package/lib/commonjs/organisms/Alert.js +49 -35
  66. package/lib/commonjs/organisms/Alert.js.map +1 -1
  67. package/lib/commonjs/organisms/AlertProvider.js +10 -10
  68. package/lib/commonjs/organisms/BottomSheet.js +137 -85
  69. package/lib/commonjs/organisms/BottomSheet.js.map +1 -1
  70. package/lib/commonjs/organisms/Chart.js +174 -154
  71. package/lib/commonjs/organisms/Chart.js.map +1 -1
  72. package/lib/commonjs/organisms/DateField.js +36 -20
  73. package/lib/commonjs/organisms/DateField.js.map +1 -1
  74. package/lib/commonjs/organisms/DatePicker.js +56 -33
  75. package/lib/commonjs/organisms/DatePicker.js.map +1 -1
  76. package/lib/commonjs/organisms/List.js +62 -34
  77. package/lib/commonjs/organisms/List.js.map +1 -1
  78. package/lib/commonjs/organisms/Modal.js +120 -82
  79. package/lib/commonjs/organisms/Modal.js.map +1 -1
  80. package/lib/commonjs/organisms/NavigationBar.js +63 -24
  81. package/lib/commonjs/organisms/NavigationBar.js.map +1 -1
  82. package/lib/commonjs/organisms/OptionWheel.js +64 -64
  83. package/lib/commonjs/organisms/OptionWheel.js.map +1 -1
  84. package/lib/commonjs/organisms/ReorderableList.js +48 -27
  85. package/lib/commonjs/organisms/ReorderableList.js.map +1 -1
  86. package/lib/commonjs/organisms/Screen.js +68 -35
  87. package/lib/commonjs/organisms/Screen.js.map +1 -1
  88. package/lib/commonjs/organisms/SearchList.js +56 -26
  89. package/lib/commonjs/organisms/SearchList.js.map +1 -1
  90. package/lib/commonjs/organisms/Select.js +45 -24
  91. package/lib/commonjs/organisms/Select.js.map +1 -1
  92. package/lib/commonjs/organisms/Slides.js +36 -23
  93. package/lib/commonjs/organisms/Slides.js.map +1 -1
  94. package/lib/commonjs/organisms/ThemeToggle.js +10 -9
  95. package/lib/commonjs/organisms/ThemeToggle.js.map +1 -1
  96. package/lib/commonjs/organisms/Timeline.js +73 -56
  97. package/lib/commonjs/organisms/Timeline.js.map +1 -1
  98. package/lib/commonjs/organisms/Toast.js +46 -15
  99. package/lib/commonjs/organisms/Toast.js.map +1 -1
  100. package/lib/commonjs/organisms/ToastProvider.js +14 -10
  101. package/lib/commonjs/organisms/ToastProvider.js.map +1 -1
  102. package/lib/commonjs/organisms/Wizard.js +40 -15
  103. package/lib/commonjs/organisms/Wizard.js.map +1 -1
  104. package/lib/commonjs/organisms/chart/frame.js +25 -25
  105. package/lib/commonjs/organisms/chart/frame.js.map +1 -1
  106. package/lib/commonjs/organisms/chart/marks.js +42 -42
  107. package/lib/commonjs/organisms/chart/math.js +84 -85
  108. package/lib/commonjs/organisms/chart/math.js.map +1 -1
  109. package/lib/commonjs/organisms/chart/palette.js +28 -28
  110. package/lib/commonjs/organisms/imperativeBridge.js +5 -5
  111. package/lib/commonjs/organisms/imperativeBridge.js.map +1 -1
  112. package/lib/commonjs/organisms/useSlides.js +53 -21
  113. package/lib/commonjs/organisms/useSlides.js.map +1 -1
  114. package/lib/commonjs/safe-area/SafeAreaUIProvider.js +9 -66
  115. package/lib/commonjs/safe-area/SafeAreaUIProvider.js.map +1 -1
  116. package/lib/commonjs/safe-area/index.js.map +1 -1
  117. package/lib/commonjs/theme/KeyboardAvoidance.js +206 -0
  118. package/lib/commonjs/theme/KeyboardAvoidance.js.map +1 -0
  119. package/lib/commonjs/theme/NativeOverlay.js +263 -0
  120. package/lib/commonjs/theme/NativeOverlay.js.map +1 -0
  121. package/lib/commonjs/theme/UIProvider.js +86 -33
  122. package/lib/commonjs/theme/UIProvider.js.map +1 -1
  123. package/lib/commonjs/theme/colors.js +17 -17
  124. package/lib/commonjs/theme/colors.js.map +1 -1
  125. package/lib/commonjs/theme/createStyles.js +19 -16
  126. package/lib/commonjs/theme/createStyles.js.map +1 -1
  127. package/lib/commonjs/theme/createTheme.js +6 -6
  128. package/lib/commonjs/theme/index.js +6 -0
  129. package/lib/commonjs/theme/index.js.map +1 -1
  130. package/lib/commonjs/theme/insets.js +1 -1
  131. package/lib/commonjs/theme/labels.js +29 -1
  132. package/lib/commonjs/theme/labels.js.map +1 -1
  133. package/lib/commonjs/theme/palettes.js +25 -23
  134. package/lib/commonjs/theme/palettes.js.map +1 -1
  135. package/lib/commonjs/theme/tokens.js +28 -14
  136. package/lib/commonjs/theme/tokens.js.map +1 -1
  137. package/lib/commonjs/theme/useKeyboardField.js +36 -0
  138. package/lib/commonjs/theme/useKeyboardField.js.map +1 -0
  139. package/lib/commonjs/theme/useReduceMotion.js +31 -0
  140. package/lib/commonjs/theme/useReduceMotion.js.map +1 -0
  141. package/lib/module/atoms/Avatar.js +79 -8
  142. package/lib/module/atoms/Avatar.js.map +1 -1
  143. package/lib/module/atoms/Badge.js +17 -8
  144. package/lib/module/atoms/Badge.js.map +1 -1
  145. package/lib/module/atoms/Button.js +110 -41
  146. package/lib/module/atoms/Button.js.map +1 -1
  147. package/lib/module/atoms/Card.js +24 -2
  148. package/lib/module/atoms/Card.js.map +1 -1
  149. package/lib/module/atoms/Checkbox.js +42 -11
  150. package/lib/module/atoms/Checkbox.js.map +1 -1
  151. package/lib/module/atoms/Divider.js +31 -6
  152. package/lib/module/atoms/Divider.js.map +1 -1
  153. package/lib/module/atoms/EmptyState.js +58 -20
  154. package/lib/module/atoms/EmptyState.js.map +1 -1
  155. package/lib/module/atoms/Fab.js +33 -13
  156. package/lib/module/atoms/Fab.js.map +1 -1
  157. package/lib/module/atoms/Gradient.js +103 -37
  158. package/lib/module/atoms/Gradient.js.map +1 -1
  159. package/lib/module/atoms/IconButton.js +25 -4
  160. package/lib/module/atoms/IconButton.js.map +1 -1
  161. package/lib/module/atoms/Image.js +61 -25
  162. package/lib/module/atoms/Image.js.map +1 -1
  163. package/lib/module/atoms/Input.js +108 -20
  164. package/lib/module/atoms/Input.js.map +1 -1
  165. package/lib/module/atoms/KeyValueRow.js +37 -9
  166. package/lib/module/atoms/KeyValueRow.js.map +1 -1
  167. package/lib/module/atoms/PressableScale.js +25 -5
  168. package/lib/module/atoms/PressableScale.js.map +1 -1
  169. package/lib/module/atoms/ShinyText.js +29 -29
  170. package/lib/module/atoms/Skeleton.js +30 -13
  171. package/lib/module/atoms/Skeleton.js.map +1 -1
  172. package/lib/module/atoms/Spinner.js +82 -23
  173. package/lib/module/atoms/Spinner.js.map +1 -1
  174. package/lib/module/atoms/Text.js +56 -5
  175. package/lib/module/atoms/Text.js.map +1 -1
  176. package/lib/module/atoms/Transition.js +41 -42
  177. package/lib/module/atoms/Transition.js.map +1 -1
  178. package/lib/module/atoms/index.js +1 -1
  179. package/lib/module/atoms/index.js.map +1 -1
  180. package/lib/module/atoms/inputValidation.js +52 -0
  181. package/lib/module/atoms/inputValidation.js.map +1 -0
  182. package/lib/module/icons/Icon.js +4 -4
  183. package/lib/module/icons/defaultIcons.js +574 -24
  184. package/lib/module/icons/defaultIcons.js.map +1 -1
  185. package/lib/module/icons/index.js +1 -1
  186. package/lib/module/icons/index.js.map +1 -1
  187. package/lib/module/molecules/AvatarHeader.js +47 -14
  188. package/lib/module/molecules/AvatarHeader.js.map +1 -1
  189. package/lib/module/molecules/FormActions.js +25 -9
  190. package/lib/module/molecules/FormActions.js.map +1 -1
  191. package/lib/module/molecules/InfoRow.js +30 -14
  192. package/lib/module/molecules/InfoRow.js.map +1 -1
  193. package/lib/module/molecules/OptionCard.js +37 -22
  194. package/lib/module/molecules/OptionCard.js.map +1 -1
  195. package/lib/module/molecules/SegmentedControl.js +107 -18
  196. package/lib/module/molecules/SegmentedControl.js.map +1 -1
  197. package/lib/module/molecules/Stepper.js +63 -18
  198. package/lib/module/molecules/Stepper.js.map +1 -1
  199. package/lib/module/molecules/Steps.js +107 -43
  200. package/lib/module/molecules/Steps.js.map +1 -1
  201. package/lib/module/molecules/SymmetricGrid.js +26 -18
  202. package/lib/module/molecules/SymmetricGrid.js.map +1 -1
  203. package/lib/module/organisms/Alert.js +51 -37
  204. package/lib/module/organisms/Alert.js.map +1 -1
  205. package/lib/module/organisms/AlertProvider.js +10 -10
  206. package/lib/module/organisms/BottomSheet.js +142 -88
  207. package/lib/module/organisms/BottomSheet.js.map +1 -1
  208. package/lib/module/organisms/Chart.js +176 -156
  209. package/lib/module/organisms/Chart.js.map +1 -1
  210. package/lib/module/organisms/DateField.js +36 -20
  211. package/lib/module/organisms/DateField.js.map +1 -1
  212. package/lib/module/organisms/DatePicker.js +56 -33
  213. package/lib/module/organisms/DatePicker.js.map +1 -1
  214. package/lib/module/organisms/List.js +62 -34
  215. package/lib/module/organisms/List.js.map +1 -1
  216. package/lib/module/organisms/Modal.js +122 -84
  217. package/lib/module/organisms/Modal.js.map +1 -1
  218. package/lib/module/organisms/NavigationBar.js +64 -25
  219. package/lib/module/organisms/NavigationBar.js.map +1 -1
  220. package/lib/module/organisms/OptionWheel.js +64 -64
  221. package/lib/module/organisms/OptionWheel.js.map +1 -1
  222. package/lib/module/organisms/ReorderableList.js +48 -27
  223. package/lib/module/organisms/ReorderableList.js.map +1 -1
  224. package/lib/module/organisms/Screen.js +70 -37
  225. package/lib/module/organisms/Screen.js.map +1 -1
  226. package/lib/module/organisms/SearchList.js +56 -26
  227. package/lib/module/organisms/SearchList.js.map +1 -1
  228. package/lib/module/organisms/Select.js +46 -25
  229. package/lib/module/organisms/Select.js.map +1 -1
  230. package/lib/module/organisms/Slides.js +37 -24
  231. package/lib/module/organisms/Slides.js.map +1 -1
  232. package/lib/module/organisms/ThemeToggle.js +11 -10
  233. package/lib/module/organisms/ThemeToggle.js.map +1 -1
  234. package/lib/module/organisms/Timeline.js +73 -56
  235. package/lib/module/organisms/Timeline.js.map +1 -1
  236. package/lib/module/organisms/Toast.js +47 -16
  237. package/lib/module/organisms/Toast.js.map +1 -1
  238. package/lib/module/organisms/ToastProvider.js +15 -11
  239. package/lib/module/organisms/ToastProvider.js.map +1 -1
  240. package/lib/module/organisms/Wizard.js +41 -16
  241. package/lib/module/organisms/Wizard.js.map +1 -1
  242. package/lib/module/organisms/chart/frame.js +25 -25
  243. package/lib/module/organisms/chart/frame.js.map +1 -1
  244. package/lib/module/organisms/chart/marks.js +42 -42
  245. package/lib/module/organisms/chart/math.js +84 -85
  246. package/lib/module/organisms/chart/math.js.map +1 -1
  247. package/lib/module/organisms/chart/palette.js +28 -28
  248. package/lib/module/organisms/imperativeBridge.js +5 -5
  249. package/lib/module/organisms/imperativeBridge.js.map +1 -1
  250. package/lib/module/organisms/useSlides.js +53 -21
  251. package/lib/module/organisms/useSlides.js.map +1 -1
  252. package/lib/module/safe-area/SafeAreaUIProvider.js +10 -65
  253. package/lib/module/safe-area/SafeAreaUIProvider.js.map +1 -1
  254. package/lib/module/safe-area/index.js +1 -0
  255. package/lib/module/safe-area/index.js.map +1 -1
  256. package/lib/module/theme/KeyboardAvoidance.js +198 -0
  257. package/lib/module/theme/KeyboardAvoidance.js.map +1 -0
  258. package/lib/module/theme/NativeOverlay.js +257 -0
  259. package/lib/module/theme/NativeOverlay.js.map +1 -0
  260. package/lib/module/theme/UIProvider.js +88 -35
  261. package/lib/module/theme/UIProvider.js.map +1 -1
  262. package/lib/module/theme/colors.js +17 -17
  263. package/lib/module/theme/colors.js.map +1 -1
  264. package/lib/module/theme/createStyles.js +20 -16
  265. package/lib/module/theme/createStyles.js.map +1 -1
  266. package/lib/module/theme/createTheme.js +6 -6
  267. package/lib/module/theme/index.js +1 -1
  268. package/lib/module/theme/index.js.map +1 -1
  269. package/lib/module/theme/insets.js +1 -1
  270. package/lib/module/theme/labels.js +29 -1
  271. package/lib/module/theme/labels.js.map +1 -1
  272. package/lib/module/theme/palettes.js +25 -23
  273. package/lib/module/theme/palettes.js.map +1 -1
  274. package/lib/module/theme/tokens.js +27 -13
  275. package/lib/module/theme/tokens.js.map +1 -1
  276. package/lib/module/theme/useKeyboardField.js +33 -0
  277. package/lib/module/theme/useKeyboardField.js.map +1 -0
  278. package/lib/module/theme/useReduceMotion.js +28 -0
  279. package/lib/module/theme/useReduceMotion.js.map +1 -0
  280. package/lib/typescript/atoms/Avatar.d.ts +35 -5
  281. package/lib/typescript/atoms/Avatar.d.ts.map +1 -1
  282. package/lib/typescript/atoms/Badge.d.ts +14 -3
  283. package/lib/typescript/atoms/Badge.d.ts.map +1 -1
  284. package/lib/typescript/atoms/Button.d.ts +34 -3
  285. package/lib/typescript/atoms/Button.d.ts.map +1 -1
  286. package/lib/typescript/atoms/Card.d.ts +13 -2
  287. package/lib/typescript/atoms/Card.d.ts.map +1 -1
  288. package/lib/typescript/atoms/Checkbox.d.ts +26 -1
  289. package/lib/typescript/atoms/Checkbox.d.ts.map +1 -1
  290. package/lib/typescript/atoms/Divider.d.ts +18 -1
  291. package/lib/typescript/atoms/Divider.d.ts.map +1 -1
  292. package/lib/typescript/atoms/EmptyState.d.ts +30 -3
  293. package/lib/typescript/atoms/EmptyState.d.ts.map +1 -1
  294. package/lib/typescript/atoms/Fab.d.ts +24 -4
  295. package/lib/typescript/atoms/Fab.d.ts.map +1 -1
  296. package/lib/typescript/atoms/Gradient.d.ts +21 -15
  297. package/lib/typescript/atoms/Gradient.d.ts.map +1 -1
  298. package/lib/typescript/atoms/IconButton.d.ts +18 -4
  299. package/lib/typescript/atoms/IconButton.d.ts.map +1 -1
  300. package/lib/typescript/atoms/Image.d.ts +39 -17
  301. package/lib/typescript/atoms/Image.d.ts.map +1 -1
  302. package/lib/typescript/atoms/Input.d.ts +57 -7
  303. package/lib/typescript/atoms/Input.d.ts.map +1 -1
  304. package/lib/typescript/atoms/KeyValueRow.d.ts +16 -4
  305. package/lib/typescript/atoms/KeyValueRow.d.ts.map +1 -1
  306. package/lib/typescript/atoms/PressableScale.d.ts +12 -5
  307. package/lib/typescript/atoms/PressableScale.d.ts.map +1 -1
  308. package/lib/typescript/atoms/ShinyText.d.ts +17 -17
  309. package/lib/typescript/atoms/ShinyText.d.ts.map +1 -1
  310. package/lib/typescript/atoms/Skeleton.d.ts +12 -7
  311. package/lib/typescript/atoms/Skeleton.d.ts.map +1 -1
  312. package/lib/typescript/atoms/Spinner.d.ts +29 -1
  313. package/lib/typescript/atoms/Spinner.d.ts.map +1 -1
  314. package/lib/typescript/atoms/Text.d.ts +46 -0
  315. package/lib/typescript/atoms/Text.d.ts.map +1 -1
  316. package/lib/typescript/atoms/Transition.d.ts +19 -15
  317. package/lib/typescript/atoms/Transition.d.ts.map +1 -1
  318. package/lib/typescript/atoms/index.d.ts +3 -3
  319. package/lib/typescript/atoms/index.d.ts.map +1 -1
  320. package/lib/typescript/atoms/inputValidation.d.ts +29 -0
  321. package/lib/typescript/atoms/inputValidation.d.ts.map +1 -0
  322. package/lib/typescript/icons/Icon.d.ts +4 -4
  323. package/lib/typescript/icons/defaultIcons.d.ts +19 -2
  324. package/lib/typescript/icons/defaultIcons.d.ts.map +1 -1
  325. package/lib/typescript/icons/index.d.ts +2 -2
  326. package/lib/typescript/icons/index.d.ts.map +1 -1
  327. package/lib/typescript/icons/types.d.ts +13 -3
  328. package/lib/typescript/icons/types.d.ts.map +1 -1
  329. package/lib/typescript/molecules/AvatarHeader.d.ts +23 -4
  330. package/lib/typescript/molecules/AvatarHeader.d.ts.map +1 -1
  331. package/lib/typescript/molecules/FormActions.d.ts +21 -4
  332. package/lib/typescript/molecules/FormActions.d.ts.map +1 -1
  333. package/lib/typescript/molecules/InfoRow.d.ts +17 -3
  334. package/lib/typescript/molecules/InfoRow.d.ts.map +1 -1
  335. package/lib/typescript/molecules/OptionCard.d.ts +20 -5
  336. package/lib/typescript/molecules/OptionCard.d.ts.map +1 -1
  337. package/lib/typescript/molecules/SegmentedControl.d.ts +18 -2
  338. package/lib/typescript/molecules/SegmentedControl.d.ts.map +1 -1
  339. package/lib/typescript/molecules/Stepper.d.ts +23 -7
  340. package/lib/typescript/molecules/Stepper.d.ts.map +1 -1
  341. package/lib/typescript/molecules/Steps.d.ts +18 -4
  342. package/lib/typescript/molecules/Steps.d.ts.map +1 -1
  343. package/lib/typescript/molecules/SymmetricGrid.d.ts +15 -5
  344. package/lib/typescript/molecules/SymmetricGrid.d.ts.map +1 -1
  345. package/lib/typescript/organisms/Alert.d.ts +28 -2
  346. package/lib/typescript/organisms/Alert.d.ts.map +1 -1
  347. package/lib/typescript/organisms/AlertProvider.d.ts +10 -10
  348. package/lib/typescript/organisms/AlertProvider.d.ts.map +1 -1
  349. package/lib/typescript/organisms/BottomSheet.d.ts +20 -5
  350. package/lib/typescript/organisms/BottomSheet.d.ts.map +1 -1
  351. package/lib/typescript/organisms/Chart.d.ts +86 -75
  352. package/lib/typescript/organisms/Chart.d.ts.map +1 -1
  353. package/lib/typescript/organisms/DateField.d.ts +17 -3
  354. package/lib/typescript/organisms/DateField.d.ts.map +1 -1
  355. package/lib/typescript/organisms/DatePicker.d.ts +7 -11
  356. package/lib/typescript/organisms/DatePicker.d.ts.map +1 -1
  357. package/lib/typescript/organisms/List.d.ts +30 -3
  358. package/lib/typescript/organisms/List.d.ts.map +1 -1
  359. package/lib/typescript/organisms/Modal.d.ts +30 -3
  360. package/lib/typescript/organisms/Modal.d.ts.map +1 -1
  361. package/lib/typescript/organisms/NavigationBar.d.ts +26 -7
  362. package/lib/typescript/organisms/NavigationBar.d.ts.map +1 -1
  363. package/lib/typescript/organisms/OptionWheel.d.ts +20 -16
  364. package/lib/typescript/organisms/OptionWheel.d.ts.map +1 -1
  365. package/lib/typescript/organisms/ReorderableList.d.ts +20 -11
  366. package/lib/typescript/organisms/ReorderableList.d.ts.map +1 -1
  367. package/lib/typescript/organisms/Screen.d.ts +27 -8
  368. package/lib/typescript/organisms/Screen.d.ts.map +1 -1
  369. package/lib/typescript/organisms/SearchList.d.ts +46 -3
  370. package/lib/typescript/organisms/SearchList.d.ts.map +1 -1
  371. package/lib/typescript/organisms/Select.d.ts +26 -6
  372. package/lib/typescript/organisms/Select.d.ts.map +1 -1
  373. package/lib/typescript/organisms/Slides.d.ts +44 -26
  374. package/lib/typescript/organisms/Slides.d.ts.map +1 -1
  375. package/lib/typescript/organisms/ThemeToggle.d.ts +6 -2
  376. package/lib/typescript/organisms/ThemeToggle.d.ts.map +1 -1
  377. package/lib/typescript/organisms/Timeline.d.ts +26 -9
  378. package/lib/typescript/organisms/Timeline.d.ts.map +1 -1
  379. package/lib/typescript/organisms/Toast.d.ts +19 -4
  380. package/lib/typescript/organisms/Toast.d.ts.map +1 -1
  381. package/lib/typescript/organisms/ToastProvider.d.ts +8 -8
  382. package/lib/typescript/organisms/ToastProvider.d.ts.map +1 -1
  383. package/lib/typescript/organisms/Wizard.d.ts +24 -6
  384. package/lib/typescript/organisms/Wizard.d.ts.map +1 -1
  385. package/lib/typescript/organisms/chart/frame.d.ts +21 -21
  386. package/lib/typescript/organisms/chart/frame.d.ts.map +1 -1
  387. package/lib/typescript/organisms/chart/marks.d.ts +28 -28
  388. package/lib/typescript/organisms/chart/marks.d.ts.map +1 -1
  389. package/lib/typescript/organisms/chart/math.d.ts +69 -70
  390. package/lib/typescript/organisms/chart/math.d.ts.map +1 -1
  391. package/lib/typescript/organisms/chart/palette.d.ts +2 -2
  392. package/lib/typescript/organisms/chart/palette.d.ts.map +1 -1
  393. package/lib/typescript/organisms/imperativeBridge.d.ts +4 -4
  394. package/lib/typescript/organisms/useSlides.d.ts +8 -16
  395. package/lib/typescript/organisms/useSlides.d.ts.map +1 -1
  396. package/lib/typescript/safe-area/SafeAreaUIProvider.d.ts +9 -7
  397. package/lib/typescript/safe-area/SafeAreaUIProvider.d.ts.map +1 -1
  398. package/lib/typescript/safe-area/index.d.ts.map +1 -1
  399. package/lib/typescript/theme/KeyboardAvoidance.d.ts +62 -0
  400. package/lib/typescript/theme/KeyboardAvoidance.d.ts.map +1 -0
  401. package/lib/typescript/theme/NativeOverlay.d.ts +43 -0
  402. package/lib/typescript/theme/NativeOverlay.d.ts.map +1 -0
  403. package/lib/typescript/theme/UIProvider.d.ts +38 -20
  404. package/lib/typescript/theme/UIProvider.d.ts.map +1 -1
  405. package/lib/typescript/theme/colors.d.ts +13 -13
  406. package/lib/typescript/theme/colors.d.ts.map +1 -1
  407. package/lib/typescript/theme/createStyles.d.ts +20 -14
  408. package/lib/typescript/theme/createStyles.d.ts.map +1 -1
  409. package/lib/typescript/theme/createTheme.d.ts +5 -5
  410. package/lib/typescript/theme/index.d.ts +1 -1
  411. package/lib/typescript/theme/index.d.ts.map +1 -1
  412. package/lib/typescript/theme/insets.d.ts +1 -1
  413. package/lib/typescript/theme/insets.d.ts.map +1 -1
  414. package/lib/typescript/theme/labels.d.ts +57 -2
  415. package/lib/typescript/theme/labels.d.ts.map +1 -1
  416. package/lib/typescript/theme/palettes.d.ts +25 -19
  417. package/lib/typescript/theme/palettes.d.ts.map +1 -1
  418. package/lib/typescript/theme/tokens.d.ts +15 -8
  419. package/lib/typescript/theme/tokens.d.ts.map +1 -1
  420. package/lib/typescript/theme/types.d.ts +7 -7
  421. package/lib/typescript/theme/types.d.ts.map +1 -1
  422. package/lib/typescript/theme/useKeyboardField.d.ts +17 -0
  423. package/lib/typescript/theme/useKeyboardField.d.ts.map +1 -0
  424. package/lib/typescript/theme/useReduceMotion.d.ts +7 -0
  425. package/lib/typescript/theme/useReduceMotion.d.ts.map +1 -0
  426. package/llms.txt +4 -4
  427. package/package.json +15 -14
  428. package/registry/alert-provider.json +4 -3
  429. package/registry/alert.json +3 -2
  430. package/registry/avatar-header.json +1 -1
  431. package/registry/avatar.json +3 -2
  432. package/registry/badge.json +1 -1
  433. package/registry/bottom-sheet.json +1 -1
  434. package/registry/button.json +3 -2
  435. package/registry/card.json +1 -1
  436. package/registry/chart.json +5 -5
  437. package/registry/checkbox.json +3 -2
  438. package/registry/core.json +31 -15
  439. package/registry/date-field.json +1 -1
  440. package/registry/date-picker.json +3 -2
  441. package/registry/divider.json +1 -1
  442. package/registry/empty-state.json +4 -2
  443. package/registry/fab.json +3 -2
  444. package/registry/form-actions.json +3 -2
  445. package/registry/gradient.json +1 -1
  446. package/registry/icon-button.json +3 -2
  447. package/registry/image.json +1 -1
  448. package/registry/index.json +79 -61
  449. package/registry/info-row.json +1 -1
  450. package/registry/input.json +5 -1
  451. package/registry/key-value-row.json +1 -1
  452. package/registry/list.json +3 -1
  453. package/registry/manifest.json +3 -1
  454. package/registry/modal.json +1 -1
  455. package/registry/navigation-bar.json +1 -1
  456. package/registry/option-card.json +3 -2
  457. package/registry/option-wheel.json +1 -1
  458. package/registry/pressable-scale.json +3 -2
  459. package/registry/reorderable-list.json +1 -1
  460. package/registry/screen.json +1 -1
  461. package/registry/search-list.json +7 -1
  462. package/registry/segmented-control.json +1 -1
  463. package/registry/select.json +1 -1
  464. package/registry/shiny-text.json +1 -1
  465. package/registry/skeleton.json +3 -2
  466. package/registry/slides.json +2 -2
  467. package/registry/spinner.json +1 -1
  468. package/registry/stepper.json +1 -1
  469. package/registry/steps.json +1 -1
  470. package/registry/symmetric-grid.json +1 -1
  471. package/registry/theme-toggle.json +1 -1
  472. package/registry/timeline.json +1 -1
  473. package/registry/title.json +1 -1
  474. package/registry/toast-provider.json +2 -2
  475. package/registry/toast.json +1 -1
  476. package/registry/transition.json +1 -1
  477. package/registry/wizard.json +1 -1
  478. package/src/atoms/Avatar.tsx +117 -26
  479. package/src/atoms/Badge.tsx +20 -9
  480. package/src/atoms/Button.tsx +102 -30
  481. package/src/atoms/Card.tsx +23 -3
  482. package/src/atoms/Checkbox.tsx +49 -12
  483. package/src/atoms/Divider.tsx +34 -4
  484. package/src/atoms/EmptyState.tsx +63 -16
  485. package/src/atoms/Fab.tsx +56 -9
  486. package/src/atoms/Gradient.tsx +92 -41
  487. package/src/atoms/IconButton.tsx +27 -4
  488. package/src/atoms/Image.tsx +74 -28
  489. package/src/atoms/Input.tsx +129 -19
  490. package/src/atoms/KeyValueRow.tsx +72 -28
  491. package/src/atoms/PressableScale.tsx +31 -7
  492. package/src/atoms/ShinyText.tsx +31 -31
  493. package/src/atoms/Skeleton.tsx +37 -17
  494. package/src/atoms/Spinner.tsx +87 -24
  495. package/src/atoms/Text.tsx +66 -6
  496. package/src/atoms/Transition.tsx +40 -44
  497. package/src/atoms/index.ts +3 -3
  498. package/src/atoms/inputValidation.ts +59 -0
  499. package/src/icons/Icon.tsx +4 -4
  500. package/src/icons/defaultIcons.tsx +445 -22
  501. package/src/icons/index.ts +2 -2
  502. package/src/icons/types.ts +26 -4
  503. package/src/molecules/AvatarHeader.tsx +88 -34
  504. package/src/molecules/FormActions.tsx +36 -6
  505. package/src/molecules/InfoRow.tsx +39 -12
  506. package/src/molecules/OptionCard.tsx +55 -20
  507. package/src/molecules/SegmentedControl.tsx +135 -15
  508. package/src/molecules/Stepper.tsx +73 -19
  509. package/src/molecules/Steps.tsx +121 -39
  510. package/src/molecules/SymmetricGrid.tsx +28 -12
  511. package/src/organisms/Alert.tsx +97 -26
  512. package/src/organisms/AlertProvider.tsx +13 -13
  513. package/src/organisms/BottomSheet.tsx +115 -43
  514. package/src/organisms/Chart.tsx +193 -164
  515. package/src/organisms/DateField.tsx +40 -15
  516. package/src/organisms/DatePicker.tsx +53 -32
  517. package/src/organisms/List.tsx +64 -15
  518. package/src/organisms/Modal.tsx +122 -63
  519. package/src/organisms/NavigationBar.tsx +73 -23
  520. package/src/organisms/OptionWheel.tsx +70 -66
  521. package/src/organisms/ReorderableList.tsx +49 -27
  522. package/src/organisms/Screen.tsx +79 -42
  523. package/src/organisms/SearchList.tsx +84 -20
  524. package/src/organisms/Select.tsx +63 -29
  525. package/src/organisms/Slides.tsx +63 -44
  526. package/src/organisms/ThemeToggle.tsx +15 -6
  527. package/src/organisms/Timeline.tsx +79 -62
  528. package/src/organisms/Toast.tsx +50 -15
  529. package/src/organisms/ToastProvider.tsx +17 -13
  530. package/src/organisms/Wizard.tsx +58 -21
  531. package/src/organisms/chart/frame.tsx +35 -35
  532. package/src/organisms/chart/marks.tsx +53 -53
  533. package/src/organisms/chart/math.ts +93 -94
  534. package/src/organisms/chart/palette.ts +28 -28
  535. package/src/organisms/imperativeBridge.ts +5 -5
  536. package/src/organisms/useSlides.ts +66 -31
  537. package/src/safe-area/SafeAreaUIProvider.tsx +9 -70
  538. package/src/safe-area/index.ts +1 -0
  539. package/src/theme/KeyboardAvoidance.tsx +216 -0
  540. package/src/theme/NativeOverlay.tsx +269 -0
  541. package/src/theme/UIProvider.tsx +109 -46
  542. package/src/theme/colors.ts +21 -21
  543. package/src/theme/createStyles.ts +23 -19
  544. package/src/theme/createTheme.ts +6 -6
  545. package/src/theme/index.ts +1 -1
  546. package/src/theme/insets.ts +1 -1
  547. package/src/theme/labels.ts +85 -2
  548. package/src/theme/palettes.ts +33 -25
  549. package/src/theme/tokens.ts +27 -13
  550. package/src/theme/types.ts +7 -7
  551. package/src/theme/useKeyboardField.ts +33 -0
  552. package/src/theme/useReduceMotion.ts +27 -0
@@ -1,4 +1,4 @@
1
- import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
1
+ import React, { createContext, memo, useCallback, useContext, useMemo, useRef, useState } from 'react';
2
2
  import {
3
3
  Pressable,
4
4
  Text,
@@ -11,6 +11,7 @@ import {
11
11
  import { contrast } from '../theme/colors';
12
12
  import { createStyles } from '../theme/createStyles';
13
13
  import { useAllowFontScaling, useLabels, useTheme } from '../theme/UIProvider';
14
+ import { useReduceMotion } from '../theme/useReduceMotion';
14
15
  import { SegmentedControl } from '../molecules/SegmentedControl';
15
16
  import { Bar, Dot, Polyline, Wedge } from './chart/marks';
16
17
  import { AxisLabels, CartesianGrid, Legend, RadarGrid, Tooltip, type LegendItem, type TooltipRow } from './chart/frame';
@@ -43,11 +44,11 @@ export type { ChartRow } from './chart/math';
43
44
  export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar';
44
45
 
45
46
  export interface ChartSeries {
46
- /** Columna de `data` que lee esta serie. */
47
+ /** Column of `data` this series reads. */
47
48
  key: string;
48
- /** Lo que dicen la leyenda y el tooltip. Por defecto, `key`. */
49
+ /** Text shown in the legend and tooltip. Defaults to `key`. */
49
50
  label?: string;
50
- /** Pisa el color derivado del theme. */
51
+ /** Overrides the color derived from the theme. */
51
52
  color?: string;
52
53
  }
53
54
 
@@ -57,9 +58,9 @@ export interface ChartFilterOption {
57
58
  }
58
59
 
59
60
  /**
60
- * Un filtro de la barra superior. Chart no filtra nada por su cuenta: muestra
61
- * el control y avisa. Quien tiene los datos decide qué significa "últimos 7
62
- * días", y eso no se puede adivinar desde acá.
61
+ * A filter in the top bar. Chart doesn't filter anything on its own: it shows
62
+ * the control and reports. Whoever has the data decides what "last 7 days"
63
+ * means, and that can't be guessed from here.
63
64
  */
64
65
  export interface ChartFilter {
65
66
  key: string;
@@ -70,130 +71,147 @@ export interface ChartFilter {
70
71
 
71
72
  export interface ChartSelection {
72
73
  /**
73
- * Identidad de la fila, estable a través de un `window` o un diezmado.
74
- * Sale de `selectBy`; sin él es el índice, y entonces no sobrevive a que
75
- * los datos corran.
74
+ * Row identity, stable across a `window` or decimation. Comes from
75
+ * `selectBy`; without it, it is the index, which does not survive the data
76
+ * shifting.
76
77
  */
77
78
  id: string;
78
79
  /**
79
- * Índice adentro de las filas **dibujadas**, no de `data`: con `window` o
80
- * con diezmado no son la misma lista. Para volver al dato está `row`.
80
+ * Index within the **drawn** rows, not `data`: with `window` or decimation
81
+ * they are not the same list. Use `row` to get back to the datum.
81
82
  */
82
83
  index: number;
83
- /** La fila entera, sin tener que resolver el índice contra nada. */
84
+ /** The whole row, without resolving the index against anything. */
84
85
  row: ChartRow;
85
- /** Valor de `xKey` en esa fila. */
86
+ /** Value of `xKey` in that row. */
86
87
  label: string;
87
- /** Serie tocada. En torta es la fila, que ahí es la categoría. */
88
+ /** Series that was touched. In a pie it is the row, which is the category there. */
88
89
  seriesKey: string;
89
90
  value: number;
90
91
  }
91
92
 
92
93
  interface ChartBaseProps {
94
+ /** Rows: one per category, with the label in `xKey` and one column per series. */
93
95
  data: ChartRow[];
94
96
  /**
95
- * Series a dibujar. En 'pie'/'donut' sólo se usa la primera: las categorías
96
- * de una torta son las filas, no las columnas.
97
+ * Series to draw. 'pie'/'donut' only use the first one: a pie's categories
98
+ * are the rows, not the columns.
97
99
  */
98
100
  series: ChartSeries[];
99
- /** Columna con la etiqueta de cada fila. @default 'x' */
101
+ /** Column holding each row's label. @default 'x' */
100
102
  xKey?: string;
101
103
  /**
102
- * Identidad estable de una fila. Sin esto la selección se guarda por índice,
103
- * y en una ventana deslizante el índice corre: el punto resaltado pasa a
104
- * señalar otro dato sin que nadie lo toque. Con esto el resaltado sigue al
105
- * dato, y desaparece solo cuando el dato sale de la ventana.
104
+ * Stable identity of a row. Without it the selection is stored by index,
105
+ * and in a sliding window the index shifts: the highlighted point ends up
106
+ * pointing at another datum without anyone touching it. With it the
107
+ * highlight follows the datum and disappears only when it leaves the window.
106
108
  */
107
109
  selectBy?: (row: ChartRow, index: number) => string;
108
110
  /**
109
- * Dibuja sólo las últimas N filas. Es la ventana deslizante de un chart en
110
- * vivo: quien empuja los datos no tiene que recortarlos en cada tick.
111
+ * Draws only the last N rows. It is the sliding window of a live chart: the
112
+ * code pushing data doesn't have to trim it on every tick.
111
113
  */
112
114
  window?: number;
113
- /** Alto del área de dibujo, sin contar filtros ni leyenda. @default 220 */
115
+ /** Height of the plot area, excluding filters and legend. @default 220 */
114
116
  height?: number;
115
117
  /**
116
- * 'toggle' convierte la leyenda en el filtro más barato que tiene un chart:
117
- * tocar una serie la apaga. @default 'auto' (toggle con 2+ series, none con una)
118
+ * 'toggle' turns the legend into the cheapest filter a chart has: tapping a
119
+ * series hides it. @default 'auto' (toggle with 2+ series, none with one)
118
120
  */
119
121
  legend?: 'auto' | 'none' | 'static' | 'toggle';
120
- /** Series apagadas, controlado. Sin esto, Chart se las acuerda solo. */
122
+ /** Hidden series (controlled). Without it, Chart tracks them itself. */
121
123
  hiddenKeys?: string[];
122
- /** @default [] */
124
+ /** Series hidden at first (uncontrolled). @default [] */
123
125
  defaultHiddenKeys?: string[];
126
+ /** Called when the legend shows or hides a series. */
124
127
  onHiddenKeysChange?: (keys: string[]) => void;
125
- /** Controles arriba del chart, uno por filtro. */
128
+ /** Controls above the chart, one per filter. */
126
129
  filters?: ChartFilter[];
127
- /** Punto resaltado, controlado. `null` es "ninguno". */
130
+ /** Highlighted point (controlled). `null` means none. */
128
131
  selected?: ChartSelection | null;
132
+ /** Called when a category is tapped, with `null` when it is released. */
129
133
  onSelect?: (selection: ChartSelection | null) => void;
130
- /** Globo con los valores de la categoría tocada. @default true */
134
+ /** Bubble with the values of the touched category. @default true */
131
135
  tooltip?: boolean;
132
- /** @default formato compacto: 1.2k, 3.4M */
136
+ /** Formats values on the axis, tooltip and slices. @default compact format: 1.2k, 3.4M */
133
137
  formatValue?: (value: number) => string;
134
- /** @default true */
138
+ /** Marks grow in on mount and morph on data changes (off with Reduce Motion). @default true */
135
139
  animate?: boolean;
136
- /** ms de la animación de las marcas. @default tokens.duration.slow * 2 */
140
+ /** Duration in ms of the marks' animation. @default tokens.duration.slow * 2 */
137
141
  duration?: number;
138
- /** Texto cuando no queda nada que dibujar. */
142
+ /** Text shown when there is nothing left to draw. */
139
143
  emptyText?: string;
140
- /** Obligatorio: un chart no tiene texto que lo describa. */
144
+ /** Required: a chart has no text that describes it. */
141
145
  accessibilityLabel: string;
146
+ /**
147
+ * Color behind the chart. The donut hole and the ring around points are
148
+ * painted with it, so they must match whatever the chart sits on.
149
+ * @default colors.surfaceRaised (a Chart usually lives in a Card)
150
+ */
151
+ surfaceColor?: string;
142
152
  style?: StyleProp<ViewStyle>;
143
153
  testID?: string;
144
154
  }
145
155
 
156
+ /** Background the marks paint "holes" with (donut center, point rings). */
157
+ const ChartSurfaceContext = createContext<string | undefined>(undefined);
158
+ function useChartSurface(): string {
159
+ const theme = useTheme();
160
+ return useContext(ChartSurfaceContext) ?? theme.colors.surfaceRaised;
161
+ }
162
+
146
163
  interface CartesianProps {
147
164
  /**
148
- * Fija el eje de valores. Por defecto se recalcula con cada dato, que es lo
149
- * correcto para un chart estático y lo peor para uno en vivo: llega un valor
150
- * más alto, la escala entera se reacomoda y la línea salta aunque el dato no
151
- * se haya movido.
165
+ * Fixes the value axis. By default it is recomputed with every datum, which
166
+ * is right for a static chart and worst for a live one: a higher value
167
+ * arrives, the whole scale shifts and the line jumps even though the data
168
+ * didn't move.
152
169
  *
153
- * - `[min, max]` — exacto, sin redondear a números lindos.
154
- * - `'sticky'` — arranca del dato y crece cuando algo no entra, pero no se
155
- * vuelve a achicar.
170
+ * - `[min, max]` — exact, not rounded to nice numbers.
171
+ * - `'sticky'` — starts from the data and grows when something doesn't fit,
172
+ * but never shrinks back.
156
173
  */
157
174
  domain?: [number, number] | 'sticky';
158
- /** Líneas de referencia del eje de valores. @default true */
175
+ /** Reference lines on the value axis. @default true */
159
176
  grid?: boolean;
160
- /** Ticks buscados en el eje de valores; el redondeo puede dar uno más o uno menos. @default 4 */
177
+ /** Target tick count on the value axis; rounding may yield one more or one fewer. @default 4 */
161
178
  ticks?: number;
162
- /** Etiquetas del eje horizontal. @default true */
179
+ /** Labels on the horizontal axis. @default true */
163
180
  xAxis?: boolean;
164
- /** Etiquetas del eje vertical. @default true */
181
+ /** Labels on the vertical axis. @default true */
165
182
  yAxis?: boolean;
166
183
  }
167
184
 
168
185
  interface BarChartProps extends CartesianProps {
186
+ /** Kind of chart. Props marked "Only with type" depend on it. */
169
187
  type: 'bar';
170
- /** 'horizontal' pone las categorías en el eje vertical. @default 'vertical' */
188
+ /** 'horizontal' puts the categories on the vertical axis. @default 'vertical' */
171
189
  orientation?: 'vertical' | 'horizontal';
172
- /** Apila las series en vez de ponerlas lado a lado. @default false */
190
+ /** Stacks the series instead of placing them side by side. @default false */
173
191
  stacked?: boolean;
174
- /** Radio del extremo libre de cada barra. @default radius.xs */
192
+ /** Radius of each bar's free end. @default radius.xs */
175
193
  barRadius?: number;
176
194
  }
177
195
 
178
196
  interface LineChartProps extends CartesianProps {
179
197
  type: 'line';
180
198
  /**
181
- * Cuántos puntos dibujar como mucho, eligiéndolos con LTTB. Por defecto sale
182
- * del ancho medido: más de un punto cada dos píxeles no se ve y sí se paga.
183
- * `false` los dibuja todos.
199
+ * Maximum number of points to draw, picked with LTTB. Defaults to a value
200
+ * derived from the measured width: more than one point every two pixels
201
+ * isn't visible but still costs. `false` draws them all.
184
202
  */
185
203
  decimate?: number | false;
186
- /** Catmull-Rom en vez de tramos rectos. @default false */
204
+ /** Catmull-Rom curves instead of straight segments. @default false */
187
205
  smooth?: boolean;
188
- /** @default 2 */
206
+ /** Line width in pt. @default 2 */
189
207
  thickness?: number;
190
- /** Punto en cada dato. @default true */
208
+ /** A dot on each datum. @default true */
191
209
  dots?: boolean;
192
210
  }
193
211
 
194
212
  interface AreaChartProps extends CartesianProps {
195
213
  type: 'area';
196
- /** Igual que en 'line'. */
214
+ /** Same as in 'line'. */
197
215
  decimate?: number | false;
198
216
  smooth?: boolean;
199
217
  thickness?: number;
@@ -201,20 +219,21 @@ interface AreaChartProps extends CartesianProps {
201
219
  dots?: boolean;
202
220
  /** @default false */
203
221
  stacked?: boolean;
204
- /** Opacidad del relleno bajo la línea. @default 0.22 */
222
+ /** Opacity of the fill under the line. @default 0.22 */
205
223
  fillOpacity?: number;
206
224
  }
207
225
 
208
226
  interface PieBaseProps {
209
- /** Agujero como fracción del radio, 0–0.9. @default 0 en 'pie', 0.6 en 'donut' */
227
+ /** Hole as a fraction of the radius, 0–0.9. @default 0 for 'pie', 0.6 for 'donut' */
210
228
  innerRadius?: number;
211
- /** Qué escribir sobre cada porción. @default 'percent' */
229
+ /** What to write on each slice. @default 'percent' */
212
230
  sliceLabels?: 'none' | 'percent' | 'value';
213
231
  }
214
232
 
215
- // 'pie' y 'donut' van separados aunque compartan todo: con un solo miembro
216
- // cuyo `type` fuera `'pie' | 'donut'`, TypeScript no saca ese miembro de la
217
- // unión al descartarlo, y el resto del componente deja de estrecharse.
233
+ // 'pie' and 'donut' are kept separate even though they share everything: with
234
+ // a single member whose `type` were `'pie' | 'donut'`, TypeScript doesn't drop
235
+ // that member from the union when ruling it out, and the rest of the component
236
+ // stops narrowing.
218
237
  interface PieChartProps extends PieBaseProps {
219
238
  type: 'pie';
220
239
  }
@@ -226,13 +245,13 @@ interface DonutChartProps extends PieBaseProps {
226
245
  interface RadarChartProps {
227
246
  type: 'radar';
228
247
  /**
229
- * Fija el alcance de los ejes. El radar mide desde el centro, así que el
230
- * mínimo es siempre 0 y de `[min, max]` sólo se usa `max`.
248
+ * Fixes the axes' range. A radar measures from the center, so the minimum is
249
+ * always 0 and only `max` of `[min, max]` is used.
231
250
  */
232
251
  domain?: [number, number] | 'sticky';
233
- /** Anillos de la telaraña. @default 4 */
252
+ /** Rings of the web. @default 4 */
234
253
  levels?: number;
235
- /** Rellena el polígono además de dibujar su contorno. @default true */
254
+ /** Fills the polygon in addition to drawing its outline. @default true */
236
255
  fill?: boolean;
237
256
  thickness?: number;
238
257
  /** @default true */
@@ -244,24 +263,24 @@ export type ChartProps = ChartBaseProps &
244
263
 
245
264
  const DEFAULT_HEIGHT = 220;
246
265
  const DEFAULT_TICKS = 4;
247
- /** Piso del canal de las etiquetas de valor, a la izquierda. */
266
+ /** Floor of the value-label gutter, on the left. */
248
267
  const VALUE_GUTTER = 38;
249
268
  /**
250
- * Ancho estimado de un caracter de etiqueta. React Native no mide texto sin
251
- * renderizarlo, y medir para decidir el layout haría aparecer el chart
252
- * corrido un frame; a `fontSize.xs` un dígito ronda 0.6em, y de más es mejor
253
- * que de menos — sobra aire, no se corta el número.
269
+ * Estimated width of a label character. React Native doesn't measure text
270
+ * without rendering it, and measuring to decide the layout would make the
271
+ * chart show up shifted for a frame; at `fontSize.xs` a digit is around
272
+ * 0.6em, and too much is better than too little — extra room, no clipped number.
254
273
  */
255
274
  const VALUE_CHAR = 6.5;
256
- /** Tope del canal: un eje ancho no puede comerse el plot. */
275
+ /** Gutter cap: a wide axis can't eat the plot. */
257
276
  const VALUE_GUTTER_MAX = 0.3;
258
- /** Canal de las categorías cuando van a la izquierda (barras horizontales). */
277
+ /** Category gutter when they go on the left (horizontal bars). */
259
278
  const CATEGORY_GUTTER = 64;
260
- /** Canal de las etiquetas de abajo. */
279
+ /** Gutter for the bottom labels. */
261
280
  const BOTTOM_GUTTER = 16;
262
- /** Fracción del ancho de banda que ocupan las barras; el resto es aire. */
281
+ /** Fraction of the band width taken by the bars; the rest is room. */
263
282
  const BAND_FILL = 0.7;
264
- /** Aire alrededor del radar para que entren las etiquetas de los ejes. */
283
+ /** Room around the radar so the axis labels fit. */
265
284
  const RADAR_INSET = 26;
266
285
  const DIM_OPACITY = 0.3;
267
286
 
@@ -293,7 +312,7 @@ const useStyles = createStyles((theme) => ({
293
312
  },
294
313
  }));
295
314
 
296
- /** Estado controlado o propio, con el mismo contrato en los dos casos. */
315
+ /** Controlled or own state, with the same contract in both cases. */
297
316
  function useControlled<T>(controlled: T | undefined, fallback: T): [T, (next: T) => void, boolean] {
298
317
  const [own, setOwn] = useState(fallback);
299
318
  const isControlled = controlled !== undefined;
@@ -301,10 +320,10 @@ function useControlled<T>(controlled: T | undefined, fallback: T): [T, (next: T)
301
320
  }
302
321
 
303
322
  /**
304
- * Resuelve el dominio del eje de valores a partir de lo que pidió el
305
- * consumidor. En 'sticky' la referencia vive en un ref: lo que importa no es
306
- * el dominio de este render sino el más ancho que se haya visto, y guardarlo
307
- * en estado dispararía un render de más por cada tick que ensancha el eje.
323
+ * Resolves the value axis domain from what the consumer asked for. In
324
+ * 'sticky' the reference lives in a ref: what matters isn't this render's
325
+ * domain but the widest one seen so far, and keeping it in state would fire
326
+ * an extra render for every tick that widens the axis.
308
327
  */
309
328
  function useDomain(measured: [number, number], domain: [number, number] | 'sticky' | undefined): [number, number] {
310
329
  const widest = useRef<[number, number] | null>(null);
@@ -318,19 +337,20 @@ function useDomain(measured: [number, number], domain: [number, number] | 'stick
318
337
 
319
338
  /**
320
339
  * Chart
321
- * Barras (verticales, horizontales, agrupadas, apiladas), línea, área, torta,
322
- * dona y radar en un solo componente, porque lo que cambia entre ellos es la
323
- * marca que se dibuja y no el resto: datos, escala, ejes, leyenda, tooltip,
324
- * selección y filtros son los mismos seis mecanismos en todos.
340
+ * Bars (vertical, horizontal, grouped, stacked), line, area, pie, donut and
341
+ * radar in a single component, because what changes between them is the mark
342
+ * being drawn and not the rest: data, scale, axes, legend, tooltip, selection
343
+ * and filters are the same six mechanisms in all of them.
325
344
  *
326
- * Se dibuja con `View`: React Native no trae lienzo vectorial y la librería no
327
- * puede agregar uno. Las tres primitivas están en `chart/marks.tsx` y la
328
- * geometría entera, sin React, en `chart/math.ts`.
345
+ * It is drawn with `View`: React Native ships no vector canvas and the library
346
+ * can't add one. The three primitives are in `chart/marks.tsx` and the whole
347
+ * geometry, without React, in `chart/math.ts`.
329
348
  *
330
- * Gestalt: destino común — al tocar una categoría, todo lo que no es ella baja
331
- * a {@link DIM_OPACITY} a la vez, así que lo resaltado se lee como un grupo y
332
- * no como una marca suelta. La leyenda usa similitud: el mismo color que la
333
- * serie, y por eso puede apagarla sin que haga falta explicar qué apaga.
349
+ * Gestalt: common fate — when you tap a category, everything that isn't it
350
+ * drops to {@link DIM_OPACITY} at once, so what is highlighted reads as a group
351
+ * and not as a loose mark. The legend uses similarity: the same color as the
352
+ * series, which is why it can turn it off without having to explain what it
353
+ * turns off.
334
354
  */
335
355
  export function Chart(props: ChartProps) {
336
356
  const {
@@ -349,10 +369,11 @@ export function Chart(props: ChartProps) {
349
369
  onSelect,
350
370
  tooltip = true,
351
371
  formatValue = formatNumber,
352
- animate = true,
372
+ animate: animateProp = true,
353
373
  duration,
354
374
  emptyText,
355
375
  accessibilityLabel,
376
+ surfaceColor,
356
377
  style,
357
378
  testID,
358
379
  } = props;
@@ -361,6 +382,9 @@ export function Chart(props: ChartProps) {
361
382
  const styles = useStyles();
362
383
  const allowFontScaling = useAllowFontScaling();
363
384
  const uiLabels = useLabels();
385
+ // Reduce Motion: the marks appear in their final shape instead of growing.
386
+ const reduceMotion = useReduceMotion();
387
+ const animate = animateProp && !reduceMotion;
364
388
  const [width, setWidth] = useState(0);
365
389
 
366
390
  const [hidden, setHidden, hiddenIsControlled] = useControlled(hiddenKeys, defaultHiddenKeys ?? []);
@@ -371,15 +395,15 @@ export function Chart(props: ChartProps) {
371
395
  const decimate = polyline ? props.decimate : false;
372
396
 
373
397
  /**
374
- * Lo que se dibuja: la ventana de `data`, y de ahí los puntos que caben.
375
- * El diezmado corre sobre la fila entera, elegida con la primera serie
376
- * visible: las series comparten eje x, así que quedarse con índices
377
- * distintos por serie rompería la alineación, la capa de toque y el tooltip.
398
+ * What gets drawn: the window of `data`, and from that the points that fit.
399
+ * Decimation runs over the whole row, chosen with the first visible series:
400
+ * the series share the x axis, so keeping different indexes per series would
401
+ * break the alignment, the touch layer and the tooltip.
378
402
  */
379
403
  const rows = useMemo(() => {
380
404
  const windowed = windowSize && windowSize > 0 ? data.slice(-windowSize) : data;
381
405
  if (!polyline || decimate === false || width === 0) return windowed;
382
- // Un punto cada dos píxeles: más no se ve y sí se paga.
406
+ // One point every two pixels: more can't be seen but still has to be paid for.
383
407
  const target = typeof decimate === 'number' ? decimate : Math.floor(width / 2);
384
408
  if (windowed.length <= target) return windowed;
385
409
  const lead = series.find((item) => !hidden.includes(item.key))?.key ?? series[0]?.key;
@@ -394,10 +418,10 @@ export function Chart(props: ChartProps) {
394
418
  );
395
419
 
396
420
  /**
397
- * La selección se guarda por `id` y se resuelve contra las filas de ahora:
398
- * si el dato se corrió, el resaltado lo sigue; si salió de la ventana,
399
- * desaparece. Reusar el índice a ciegas señalaría el dato que quedó en ese
400
- * lugar, que no es el que nadie eligió.
421
+ * The selection is stored by `id` and resolved against the current rows:
422
+ * if the datum shifted, the highlight follows it; if it left the window, it
423
+ * disappears. Blindly reusing the index would point at the datum that ended
424
+ * up in that spot, which isn't the one anyone picked.
401
425
  */
402
426
  const selection = useMemo(() => {
403
427
  if (!pick) return null;
@@ -413,8 +437,8 @@ export function Chart(props: ChartProps) {
413
437
  };
414
438
  }, [pick, ids, rows, labels]);
415
439
 
416
- // En torta las categorías son las filas; en el resto, las columnas. De eso
417
- // dependen el color, la leyenda y qué apaga un toque en ella.
440
+ // In a pie the categories are the rows; in the rest, the columns. The
441
+ // color, the legend and what a tap on it turns off depend on that.
418
442
  const palette = seriesPalette(theme, Math.max(1, isPie ? rows.length : series.length));
419
443
  const entries: LegendItem[] = useMemo(
420
444
  () =>
@@ -441,9 +465,9 @@ export function Chart(props: ChartProps) {
441
465
  );
442
466
 
443
467
  /**
444
- * Los plots avisan qué se tocó —fila y serie— y la selección entera se
445
- * arma acá: es el único lugar que conoce `selectBy`, las etiquetas y las
446
- * filas de verdad, y así los tres no repiten el armado.
468
+ * The plots report what was tapped —row and series— and the whole selection
469
+ * is built here: it is the only place that knows `selectBy`, the labels and
470
+ * the actual rows, so the three don't repeat the building.
447
471
  */
448
472
  const applySelection = useCallback(
449
473
  (hit: { index: number; seriesKey: string } | null) => {
@@ -459,9 +483,9 @@ export function Chart(props: ChartProps) {
459
483
  value: toNumber(row[hit.seriesKey]) ?? 0,
460
484
  }
461
485
  : null;
462
- // Tocar lo ya elegido lo suelta: sin eso no habría forma de volver al
463
- // chart entero sin tocar afuera, y "afuera" en una pantalla con scroll
464
- // no siempre existe.
486
+ // Tapping what is already selected releases it: without that there would
487
+ // be no way back to the whole chart without tapping outside, and
488
+ // "outside" doesn't always exist on a scrolling screen.
465
489
  const same = next && selection && next.id === selection.id && next.seriesKey === selection.seriesKey;
466
490
  const value = same ? null : next;
467
491
  if (!selectionIsControlled) setPick(value);
@@ -493,6 +517,7 @@ export function Chart(props: ChartProps) {
493
517
  };
494
518
 
495
519
  return (
520
+ <ChartSurfaceContext.Provider value={surfaceColor ?? theme.colors.surfaceRaised}>
496
521
  <View style={[styles.root, style]} testID={testID} accessible={false}>
497
522
  {filters && filters.length > 0 ? (
498
523
  <View style={styles.filters}>
@@ -565,19 +590,20 @@ export function Chart(props: ChartProps) {
565
590
  <Legend items={entries} hidden={hidden} onToggle={toggleable ? applyHidden : undefined} testID={testID && `${testID}-legend`} />
566
591
  ) : null}
567
592
  </View>
593
+ </ChartSurfaceContext.Provider>
568
594
  );
569
595
  }
570
596
 
571
597
  Chart.displayName = 'Chart';
572
598
 
573
- // ── lo que comparten los tres plots ────────────────────────────────────────
599
+ // ── what the three plots share ─────────────────────────────────────────────
574
600
 
575
601
  interface PlotProps {
576
602
  rows: ChartRow[];
577
603
  labels: string[];
578
- /** Todas las categorías, con su color: el color no cambia al apagar una. */
604
+ /** All categories, with their color: the color doesn't change when one is turned off. */
579
605
  entries: LegendItem[];
580
- /** Las que quedaron prendidas. */
606
+ /** The ones still turned on. */
581
607
  visible: LegendItem[];
582
608
  width: number;
583
609
  height: number;
@@ -585,13 +611,13 @@ interface PlotProps {
585
611
  animate: boolean;
586
612
  duration: number;
587
613
  selection: ChartSelection | null;
588
- /** Avisa qué se tocó; Chart arma la selección. `null` la suelta. */
614
+ /** Reports what was tapped; Chart builds the selection. `null` releases it. */
589
615
  onPick: (hit: { index: number; seriesKey: string } | null) => void;
590
616
  tooltip: boolean;
591
617
  testID?: string;
592
618
  }
593
619
 
594
- /** Filas del tooltip para una categoría del eje x. */
620
+ /** Tooltip rows for a category on the x axis. */
595
621
  function tooltipRowsAt(rows: ChartRow[], index: number, visible: LegendItem[], format: (value: number) => string): TooltipRow[] {
596
622
  const row = rows[index];
597
623
  if (!row) return [];
@@ -603,7 +629,7 @@ function tooltipRowsAt(rows: ChartRow[], index: number, visible: LegendItem[], f
603
629
  .filter((item): item is TooltipRow => item !== null);
604
630
  }
605
631
 
606
- // ── barras, línea y área ───────────────────────────────────────────────────
632
+ // ── bars, line and area ────────────────────────────────────────────────────
607
633
 
608
634
  interface CartesianPlotProps extends PlotProps {
609
635
  type: 'bar' | 'line' | 'area';
@@ -621,10 +647,10 @@ interface CartesianPlotProps extends PlotProps {
621
647
  yAxis: boolean;
622
648
  }
623
649
 
624
- /** Ancho de una tira del relleno de área, en píxeles. Más fino = más vistas. */
650
+ /** Width of one strip of the area fill, in pixels. Thinner = more views. */
625
651
  const STRIP_WIDTH = 4;
626
652
  const MAX_STRIPS = 140;
627
- /** Aire entre dos barras del mismo grupo. */
653
+ /** Room between two bars of the same group. */
628
654
  const GROUP_GAP = 2;
629
655
 
630
656
  const CartesianPlot = memo((props: CartesianPlotProps) => {
@@ -657,31 +683,32 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
657
683
  } = props;
658
684
 
659
685
  const theme = useTheme();
686
+ const surface = useChartSurface();
660
687
  const horizontal = type === 'bar' && orientation === 'horizontal';
661
688
  const keys = useMemo(() => visible.map((entry) => entry.key), [visible]);
662
689
 
663
690
  const bottomGutter = xAxis ? BOTTOM_GUTTER : 0;
664
691
 
665
- // La línea puede no tocar el cero (una temperatura, un ranking); una barra
666
- // sí tiene que hacerlo, porque su largo es el que dice el valor.
692
+ // The line may not touch zero (a temperature, a ranking); a bar does have
693
+ // to, because its length is what states the value.
667
694
  const measured = useMemo(
668
695
  () => extent(rows, keys, { stacked, includeZero: type !== 'line' }),
669
696
  [rows, keys, stacked, type]
670
697
  );
671
698
  const [low, high] = useDomain(measured, domain);
672
699
 
673
- // Un dominio a mano se respeta tal cual; uno medido (o 'sticky') se
674
- // redondea, que es lo que hace legible el eje.
700
+ // A hand-set domain is respected as is; a measured one (or 'sticky') is
701
+ // rounded, which is what makes the axis legible.
675
702
  const nice = useMemo(
676
703
  () => (Array.isArray(domain) ? exactTicks(low, high, tickCount) : niceScale(low, high, tickCount)),
677
704
  [domain, low, high, tickCount]
678
705
  );
679
706
 
680
707
  /**
681
- * El canal sale de la etiqueta más larga, no de una constante: con un
682
- * `formatValue` propio ("$3000", "1.250 ms") un ancho fijo corta el número
683
- * y el eje pasa a decir "$30…". Los ticks no dependen del ancho del plot,
684
- * así que se pueden medir antes de repartirlo.
708
+ * The gutter comes from the longest label, not from a constant: with a
709
+ * custom `formatValue` ("$3000", "1.250 ms") a fixed width clips the number
710
+ * and the axis ends up saying "$30…". The ticks don't depend on the plot's
711
+ * width, so they can be measured before splitting it up.
685
712
  */
686
713
  const leftGutter = useMemo(() => {
687
714
  if (!yAxis) return 0;
@@ -709,7 +736,7 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
709
736
 
710
737
  const stacks = useMemo(() => (stacked ? rows.map((row) => stackRow(row, keys)) : null), [stacked, rows, keys]);
711
738
 
712
- /** Puntos de una serie: `to` es el valor, `from` el piso desde donde se rellena. */
739
+ /** A series' points: `to` is the value, `from` the floor it is filled from. */
713
740
  const pointsFor = useCallback(
714
741
  (key: string, edge: 'to' | 'from'): Point[] => {
715
742
  const out: Point[] = [];
@@ -731,8 +758,8 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
731
758
 
732
759
  const pickAt = useCallback(
733
760
  (index: number, event: GestureResponderEvent) => {
734
- // Sobre qué serie cayó el dedo: la que tiene su marca más cerca del
735
- // toque en el eje de valores. Con una sola serie es siempre esa.
761
+ // Which series the finger landed on: the one whose mark is closest to
762
+ // the touch on the value axis. With a single series it is always that one.
736
763
  const touch = (horizontal ? event?.nativeEvent?.locationX : event?.nativeEvent?.locationY) ?? 0;
737
764
  let bestKey = keys[0] ?? '';
738
765
  let bestDistance = Infinity;
@@ -768,7 +795,7 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
768
795
 
769
796
  return (
770
797
  <>
771
- {/* Marco: grilla y etiquetas, por debajo de las marcas. */}
798
+ {/* Frame: grid and labels, beneath the marks. */}
772
799
  <View style={{ position: 'absolute', left: leftGutter, top: 0, width: plotW, height: plotH }}>
773
800
  {grid ? (
774
801
  <CartesianGrid
@@ -847,14 +874,14 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
847
874
 
848
875
  return (
849
876
  <View key={entry.key} style={{ position: 'absolute', left: 0, top: 0, width: plotW, height: plotH }}>
850
- {/* Área: sin `path` no hay relleno bajo una curva, así que se
851
- corta en tiras verticales y cada una pregunta su alto a la
852
- polilínea. A 4px por tira el borde ya se lee como continuo. */}
877
+ {/* Area: without `path` there is no fill under a curve, so it
878
+ is cut into vertical strips and each one asks the polyline
879
+ for its height. At 4px per strip the edge already reads as continuous. */}
853
880
  {type === 'area' ? (
854
- // La opacidad va en el grupo, no en cada tira: el medio
855
- // píxel de solape que tapa la costura del antialias se
856
- // compone dos veces y deja una raya vertical cada cuatro
857
- // píxeles. Atenuado el grupo entero, se pinta una sola vez.
881
+ // Opacity goes on the group, not on each strip: the half
882
+ // pixel of overlap that hides the antialias seam is
883
+ // composited twice and leaves a vertical stripe every four
884
+ // pixels. Dimming the whole group, it is painted only once.
858
885
  <View
859
886
  pointerEvents="none"
860
887
  style={{ position: 'absolute', left: 0, top: 0, width: plotW, height: plotH, opacity: fillOpacity }}
@@ -889,7 +916,7 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
889
916
  key={index}
890
917
  point={point}
891
918
  color={entry.color}
892
- ringColor={theme.colors.surface}
919
+ ringColor={surface}
893
920
  size={selection?.index === index ? 8 : 6}
894
921
  testID={testID && `${testID}-dot-${entry.key}-${index}`}
895
922
  />
@@ -899,8 +926,8 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
899
926
  );
900
927
  })}
901
928
 
902
- {/* Capa de toque: una banda entera por categoría. Tocar una línea de
903
- 2px es imposible; tocar su columna, no. */}
929
+ {/* Touch layer: a whole band per category. Tapping a 2px line is
930
+ impossible; tapping its column isn't. */}
904
931
  {rows.map((row, index) => (
905
932
  <Pressable
906
933
  key={index}
@@ -964,7 +991,7 @@ const CartesianPlot = memo((props: CartesianPlotProps) => {
964
991
  });
965
992
  CartesianPlot.displayName = 'CartesianPlot';
966
993
 
967
- // ── torta y dona ───────────────────────────────────────────────────────────
994
+ // ── pie and donut ──────────────────────────────────────────────────────────
968
995
 
969
996
  interface PiePlotProps extends PlotProps {
970
997
  donut: boolean;
@@ -974,12 +1001,12 @@ interface PiePlotProps extends PlotProps {
974
1001
  }
975
1002
 
976
1003
  const DONUT_RADIUS = 0.6;
977
- /** Cuánto sale la porción elegida, en píxeles. */
1004
+ /** How far the selected slice pops out, in pixels. */
978
1005
  const EXPLODE = 8;
979
- /** Dónde cae la etiqueta, como fracción entre el agujero y el borde. */
1006
+ /** Where the label falls, as a fraction between the hole and the edge. */
980
1007
  const LABEL_AT = 0.62;
981
1008
 
982
- /** Blanco o negro, el que se lea encima del color. Un color raro no rompe: cae en `text`. */
1009
+ /** White or black, whichever reads over the color. An odd color doesn't break: it falls back to `text`. */
983
1010
  function inkOn(background: string, theme: { colors: { white: string; black: string; text: string } }): string {
984
1011
  try {
985
1012
  return contrast(background, theme.colors.white) >= contrast(background, theme.colors.black)
@@ -993,6 +1020,7 @@ function inkOn(background: string, theme: { colors: { white: string; black: stri
993
1020
  const PiePlot = memo((props: PiePlotProps) => {
994
1021
  const { rows, labels, entries, visible, width, height, formatValue, selection, onPick, tooltip, testID, donut, innerRadius, sliceLabels, valueKey } = props;
995
1022
  const theme = useTheme();
1023
+ const surface = useChartSurface();
996
1024
  const styles = useStyles();
997
1025
  const allowFontScaling = useAllowFontScaling();
998
1026
 
@@ -1001,8 +1029,8 @@ const PiePlot = memo((props: PiePlotProps) => {
1001
1029
  const hole = clamp(innerRadius ?? (donut ? DONUT_RADIUS : 0), 0, 0.9) * radius;
1002
1030
 
1003
1031
  const arcs = useMemo(() => {
1004
- // Una categoría apagada vale 0: sale de la torta y el resto se reparte el
1005
- // 100%, que es lo que espera quien la apagó desde la leyenda.
1032
+ // A turned-off category is worth 0: it leaves the pie and the rest share
1033
+ // the 100%, which is what whoever turned it off from the legend expects.
1006
1034
  const values = rows.map((row, index) =>
1007
1035
  visible.some((entry) => entry.key === labels[index]) ? (toNumber(row[valueKey]) ?? 0) : 0
1008
1036
  );
@@ -1013,8 +1041,8 @@ const PiePlot = memo((props: PiePlotProps) => {
1013
1041
  (event: GestureResponderEvent) => {
1014
1042
  const point = { x: event?.nativeEvent?.locationX ?? 0, y: event?.nativeEvent?.locationY ?? 0 };
1015
1043
  const distance = Math.hypot(point.x - center.x, point.y - center.y);
1016
- // El agujero de una dona no es parte de ninguna porción, y afuera del
1017
- // círculo tampoco: los dos sueltan la selección.
1044
+ // A donut's hole isn't part of any slice, and neither is the area
1045
+ // outside the circle: both release the selection.
1018
1046
  if (distance > radius || distance < hole) return onPick(null);
1019
1047
  const index = arcAt(arcs, angleOf(center, point));
1020
1048
  if (index === -1) return onPick(null);
@@ -1054,7 +1082,7 @@ const PiePlot = memo((props: PiePlotProps) => {
1054
1082
  width: hole * 2,
1055
1083
  height: hole * 2,
1056
1084
  borderRadius: hole,
1057
- backgroundColor: theme.colors.surface,
1085
+ backgroundColor: surface,
1058
1086
  }}
1059
1087
  />
1060
1088
  ) : null}
@@ -1062,8 +1090,8 @@ const PiePlot = memo((props: PiePlotProps) => {
1062
1090
  {sliceLabels === 'none'
1063
1091
  ? null
1064
1092
  : arcs.map((arc) => {
1065
- // Una porción muy fina no tiene dónde escribir: la etiqueta se
1066
- // saldría encima de las vecinas y no se leería ninguna.
1093
+ // A very thin slice has nowhere to write: the label would spill
1094
+ // over its neighbors and none would be readable.
1067
1095
  if (arc.sweep < 18) return null;
1068
1096
  const at = polar(center, hole + (radius - hole) * LABEL_AT, arc.start + arc.sweep / 2);
1069
1097
  const color = entries[arc.index]?.color ?? theme.colors.primary;
@@ -1118,7 +1146,7 @@ interface RadarPlotProps extends PlotProps {
1118
1146
  dots: boolean;
1119
1147
  }
1120
1148
 
1121
- /** Tiras por lado del polígono cuando se rellena. Más = borde más limpio, más vistas. */
1149
+ /** Strips per side of the polygon when it is filled. More = cleaner edge, more views. */
1122
1150
  const RADAR_STEPS = 5;
1123
1151
  const RADAR_FILL_OPACITY = 0.18;
1124
1152
  const RADAR_LABEL_WIDTH = 56;
@@ -1126,6 +1154,7 @@ const RADAR_LABEL_WIDTH = 56;
1126
1154
  const RadarPlot = memo((props: RadarPlotProps) => {
1127
1155
  const { rows, labels, visible, width, height, formatValue, selection, onPick, tooltip, testID, domain, levels, fill, thickness, dots } = props;
1128
1156
  const theme = useTheme();
1157
+ const surface = useChartSurface();
1129
1158
  const styles = useStyles();
1130
1159
  const allowFontScaling = useAllowFontScaling();
1131
1160
 
@@ -1134,8 +1163,8 @@ const RadarPlot = memo((props: RadarPlotProps) => {
1134
1163
  const angles = useMemo(() => radarAngles(rows.length), [rows.length]);
1135
1164
  const keys = useMemo(() => visible.map((entry) => entry.key), [visible]);
1136
1165
 
1137
- // El radar mide desde el centro, y el centro es 0: un mínimo distinto de
1138
- // cero haría que dos valores parecidos se vean lejísimos.
1166
+ // The radar measures from the center, and the center is 0: a minimum other
1167
+ // than zero would make two similar values look miles apart.
1139
1168
  const measured = useMemo(() => [0, extent(rows, keys, { includeZero: true })[1]] as [number, number], [rows, keys]);
1140
1169
  const [, top] = useDomain(measured, domain);
1141
1170
 
@@ -1169,14 +1198,14 @@ const RadarPlot = memo((props: RadarPlotProps) => {
1169
1198
  const points = pointsOf(entry.key);
1170
1199
  return (
1171
1200
  <View key={entry.key} style={{ position: 'absolute', left: 0, top: 0, width, height }}>
1172
- {/* Relleno: el mismo sector que dibuja una torta, uno por tira del
1173
- polígono, con el radio que le toca a esa tira. */}
1201
+ {/* Fill: the same sector a pie draws, one per strip of the
1202
+ polygon, with the radius that strip gets. */}
1174
1203
  {fill ? (
1175
- // La opacidad va en el grupo, no en cada tira. Por tira, el
1176
- // solape de 0.4° que tapa la costura del antialias se compone
1177
- // dos veces y deja un radio más oscuro por corte: el relleno
1178
- // termina pareciendo una telaraña. Aplicada al grupo, las tiras
1179
- // se pintan opacas entre sí y el conjunto se atenúa una vez.
1204
+ // Opacity goes on the group, not on each strip. Per strip, the
1205
+ // 0.4° overlap that hides the antialias seam is composited
1206
+ // twice and leaves a darker radius at each cut: the fill ends
1207
+ // up looking like a spider web. Applied to the group, the strips
1208
+ // paint opaque against each other and the whole is dimmed once.
1180
1209
  <View
1181
1210
  pointerEvents="none"
1182
1211
  style={{ position: 'absolute', left: 0, top: 0, width, height, opacity: RADAR_FILL_OPACITY }}
@@ -1201,7 +1230,7 @@ const RadarPlot = memo((props: RadarPlotProps) => {
1201
1230
  key={index}
1202
1231
  point={point}
1203
1232
  color={entry.color}
1204
- ringColor={theme.colors.surface}
1233
+ ringColor={surface}
1205
1234
  size={selection?.index === index ? 8 : 6}
1206
1235
  />
1207
1236
  ))