react-native-terra-ui 0.5.0 → 0.6.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 (357) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/lib/module/components/avatar/Avatar.js +60 -60
  3. package/lib/module/components/avatar/Avatar.js.map +1 -1
  4. package/lib/module/components/box/Box.js +2 -2
  5. package/lib/module/components/box/Box.js.map +1 -1
  6. package/lib/module/components/box/utils.js +19 -19
  7. package/lib/module/components/box/utils.js.map +1 -1
  8. package/lib/module/components/button/Button.js +54 -48
  9. package/lib/module/components/button/Button.js.map +1 -1
  10. package/lib/module/components/chip/Chip.js +94 -94
  11. package/lib/module/components/chip/Chip.js.map +1 -1
  12. package/lib/module/components/chip/utils.js +3 -3
  13. package/lib/module/components/empty-state/EmptyState.js +40 -40
  14. package/lib/module/components/empty-state/EmptyState.js.map +1 -1
  15. package/lib/module/components/header/header-buttons.js +5 -5
  16. package/lib/module/components/header/header-buttons.js.map +1 -1
  17. package/lib/module/components/header/parts/HeaderGradientOverlay.js +2 -2
  18. package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
  19. package/lib/module/components/header/variants/LargeTitleHeader/index.js +58 -58
  20. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
  21. package/lib/module/components/header/variants/TitleHeader/index.js +27 -27
  22. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
  23. package/lib/module/components/icon/Icon.js +6 -6
  24. package/lib/module/components/icon/Icon.js.map +1 -1
  25. package/lib/module/components/image/Image.js +11 -6
  26. package/lib/module/components/image/Image.js.map +1 -1
  27. package/lib/module/components/page-indicator/PageIndicator.js +1 -1
  28. package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -1
  29. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +8 -8
  30. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -1
  31. package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -1
  32. package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +6 -6
  33. package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -1
  34. package/lib/module/components/page-indicator/utils.js +8 -8
  35. package/lib/module/components/page-indicator/utils.js.map +1 -1
  36. package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +2 -2
  37. package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -1
  38. package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +9 -9
  39. package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -1
  40. package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +2 -2
  41. package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -1
  42. package/lib/module/components/page-indicator/variants/DotIndicator/index.js +3 -3
  43. package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
  44. package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +1 -1
  45. package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -1
  46. package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +1 -1
  47. package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -1
  48. package/lib/module/components/page-indicator/variants/PillIndicator/index.js +5 -5
  49. package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
  50. package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +3 -3
  51. package/lib/module/components/portal/Portal.js +1 -1
  52. package/lib/module/components/portal/PortalContext.js +1 -1
  53. package/lib/module/components/portal/PortalHost.js +1 -1
  54. package/lib/module/components/portal/PortalProvider.js +1 -1
  55. package/lib/module/components/portal/PortalProvider.js.map +1 -1
  56. package/lib/module/components/screen/Screen.js +8 -8
  57. package/lib/module/components/screen/Screen.js.map +1 -1
  58. package/lib/module/components/screen/ScreenContext.js +6 -6
  59. package/lib/module/components/screen/ScreenContext.js.map +1 -1
  60. package/lib/module/components/screen/ScreenFlatList.js +3 -3
  61. package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
  62. package/lib/module/components/screen/ScreenList.js +5 -5
  63. package/lib/module/components/screen/ScreenList.js.map +1 -1
  64. package/lib/module/components/screen/ScreenScrollView.js +6 -6
  65. package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
  66. package/lib/module/components/screen/parts/BottomSafeArea.js +1 -1
  67. package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -1
  68. package/lib/module/components/screen/parts/ScreenPlaceholder.js +3 -3
  69. package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
  70. package/lib/module/components/screen/utils.js +3 -3
  71. package/lib/module/components/screen/utils.js.map +1 -1
  72. package/lib/module/components/slot/Slot.js +2 -2
  73. package/lib/module/components/slot/Slot.js.map +1 -1
  74. package/lib/module/components/slot/utils.js +3 -3
  75. package/lib/module/components/slot/utils.js.map +1 -1
  76. package/lib/module/components/spinner/Spinner.js +10 -10
  77. package/lib/module/components/spinner/Spinner.js.map +1 -1
  78. package/lib/module/components/surface/Surface.js +14 -14
  79. package/lib/module/components/surface/Surface.js.map +1 -1
  80. package/lib/module/components/text/Text.js +13 -13
  81. package/lib/module/components/text/Text.js.map +1 -1
  82. package/lib/module/components/toast/Toast.js +46 -46
  83. package/lib/module/components/toast/Toast.js.map +1 -1
  84. package/lib/module/components/toast/ToastProvider.js +32 -32
  85. package/lib/module/components/toast/ToastProvider.js.map +1 -1
  86. package/lib/module/components/toast/parts/ToastAnimatedItem.js +10 -10
  87. package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -1
  88. package/lib/module/components/toast/utils/controller.js +2 -2
  89. package/lib/module/components/toast/utils/controller.js.map +1 -1
  90. package/lib/module/components/toolbar/Toolbar.js +25 -25
  91. package/lib/module/components/toolbar/Toolbar.js.map +1 -1
  92. package/lib/module/context/ThemeProvider.js +5 -5
  93. package/lib/module/context/ThemeProvider.js.map +1 -1
  94. package/lib/module/theme/breakpoints.js.map +1 -1
  95. package/lib/module/theme/defaults/icons.js +11 -11
  96. package/lib/module/theme/defaults/icons.js.map +1 -1
  97. package/lib/module/theme/defaults/image.js +7 -7
  98. package/lib/module/theme/defaults/image.js.map +1 -1
  99. package/lib/module/theme/registry.js +11 -11
  100. package/lib/module/theme/registry.js.map +1 -1
  101. package/lib/module/theme/runtime.js +3 -3
  102. package/lib/module/theme/runtime.js.map +1 -1
  103. package/lib/module/theme/theme.js +9 -9
  104. package/lib/module/theme/theme.js.map +1 -1
  105. package/lib/module/theme/tokens/dark.js +67 -67
  106. package/lib/module/theme/tokens/light.js +67 -67
  107. package/lib/module/theme/tokens/primitives.js +417 -417
  108. package/lib/module/utils/accent-utils.js +16 -16
  109. package/lib/module/utils/accent-utils.js.map +1 -1
  110. package/lib/module/utils/color-utils.js +3 -3
  111. package/lib/module/utils/deep-merge.js +1 -1
  112. package/lib/module/utils/resolve-theme-color.js +2 -2
  113. package/lib/module/utils/resolve-theme-color.js.map +1 -1
  114. package/lib/module/utils/typography.js +5 -5
  115. package/lib/module/utils/typography.js.map +1 -1
  116. package/lib/module/utils/unflatten.js +2 -2
  117. package/lib/typescript/src/components/avatar/Avatar.d.ts +1 -1
  118. package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
  119. package/lib/typescript/src/components/avatar/index.d.ts +2 -2
  120. package/lib/typescript/src/components/avatar/types.d.ts +7 -7
  121. package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
  122. package/lib/typescript/src/components/box/Box.d.ts +2 -2
  123. package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
  124. package/lib/typescript/src/components/box/index.d.ts +3 -3
  125. package/lib/typescript/src/components/box/utils.d.ts +7 -7
  126. package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
  127. package/lib/typescript/src/components/button/Button.d.ts +15 -8
  128. package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
  129. package/lib/typescript/src/components/button/index.d.ts +2 -2
  130. package/lib/typescript/src/components/chip/Chip.d.ts +5 -5
  131. package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -1
  132. package/lib/typescript/src/components/chip/index.d.ts +3 -3
  133. package/lib/typescript/src/components/chip/types.d.ts +3 -3
  134. package/lib/typescript/src/components/chip/utils.d.ts +1 -1
  135. package/lib/typescript/src/components/empty-state/EmptyState.d.ts +5 -5
  136. package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -1
  137. package/lib/typescript/src/components/empty-state/index.d.ts +3 -3
  138. package/lib/typescript/src/components/empty-state/types.d.ts +1 -1
  139. package/lib/typescript/src/components/header/Header.d.ts +2 -2
  140. package/lib/typescript/src/components/header/header-buttons.d.ts +3 -3
  141. package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
  142. package/lib/typescript/src/components/header/index.d.ts +6 -6
  143. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -1
  144. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
  145. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
  146. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +4 -4
  147. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
  148. package/lib/typescript/src/components/icon/Icon.d.ts +3 -3
  149. package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
  150. package/lib/typescript/src/components/icon/index.d.ts +2 -2
  151. package/lib/typescript/src/components/image/Image.d.ts +2 -2
  152. package/lib/typescript/src/components/image/Image.d.ts.map +1 -1
  153. package/lib/typescript/src/components/image/index.d.ts +2 -2
  154. package/lib/typescript/src/components/image/types.d.ts +1 -1
  155. package/lib/typescript/src/components/index.d.ts +17 -17
  156. package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +10 -10
  157. package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +2 -2
  158. package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -1
  159. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +1 -1
  160. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -1
  161. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +3 -3
  162. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -1
  163. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +2 -2
  164. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -1
  165. package/lib/typescript/src/components/page-indicator/index.d.ts +3 -3
  166. package/lib/typescript/src/components/page-indicator/utils.d.ts +2 -2
  167. package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -1
  168. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +1 -1
  169. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -1
  170. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +2 -2
  171. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -1
  172. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +2 -2
  173. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -1
  174. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +3 -3
  175. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -1
  176. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -1
  177. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +2 -2
  178. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -1
  179. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +3 -3
  180. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -1
  181. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +1 -1
  182. package/lib/typescript/src/components/portal/Portal.d.ts +3 -3
  183. package/lib/typescript/src/components/portal/PortalContext.d.ts +1 -1
  184. package/lib/typescript/src/components/portal/PortalHost.d.ts +2 -2
  185. package/lib/typescript/src/components/portal/PortalProvider.d.ts +1 -1
  186. package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
  187. package/lib/typescript/src/components/portal/index.d.ts +7 -7
  188. package/lib/typescript/src/components/screen/Screen.d.ts +10 -10
  189. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
  190. package/lib/typescript/src/components/screen/ScreenContext.d.ts +3 -3
  191. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
  192. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +3 -3
  193. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
  194. package/lib/typescript/src/components/screen/ScreenList.d.ts +5 -5
  195. package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
  196. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +5 -5
  197. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
  198. package/lib/typescript/src/components/screen/index.d.ts +11 -11
  199. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -1
  200. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +3 -3
  201. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
  202. package/lib/typescript/src/components/screen/types.d.ts +2 -2
  203. package/lib/typescript/src/components/screen/utils.d.ts +2 -2
  204. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
  205. package/lib/typescript/src/components/slot/Slot.d.ts +2 -2
  206. package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -1
  207. package/lib/typescript/src/components/slot/index.d.ts +3 -3
  208. package/lib/typescript/src/components/slot/utils.d.ts +1 -1
  209. package/lib/typescript/src/components/slot/utils.d.ts.map +1 -1
  210. package/lib/typescript/src/components/spinner/Spinner.d.ts +2 -2
  211. package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -1
  212. package/lib/typescript/src/components/spinner/index.d.ts +2 -2
  213. package/lib/typescript/src/components/surface/Surface.d.ts +4 -4
  214. package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
  215. package/lib/typescript/src/components/surface/index.d.ts +2 -2
  216. package/lib/typescript/src/components/text/Text.d.ts +4 -4
  217. package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
  218. package/lib/typescript/src/components/text/index.d.ts +2 -2
  219. package/lib/typescript/src/components/toast/Toast.d.ts +18 -18
  220. package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -1
  221. package/lib/typescript/src/components/toast/ToastProvider.d.ts +1 -1
  222. package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -1
  223. package/lib/typescript/src/components/toast/index.d.ts +4 -4
  224. package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +3 -3
  225. package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -1
  226. package/lib/typescript/src/components/toast/types.d.ts +10 -10
  227. package/lib/typescript/src/components/toast/types.d.ts.map +1 -1
  228. package/lib/typescript/src/components/toast/utils/controller.d.ts +2 -2
  229. package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -1
  230. package/lib/typescript/src/components/toolbar/Toolbar.d.ts +5 -5
  231. package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -1
  232. package/lib/typescript/src/components/toolbar/index.d.ts +2 -2
  233. package/lib/typescript/src/context/ThemeProvider.d.ts +3 -3
  234. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  235. package/lib/typescript/src/context/index.d.ts +2 -2
  236. package/lib/typescript/src/index.d.ts +3 -3
  237. package/lib/typescript/src/theme/breakpoints.d.ts +2 -2
  238. package/lib/typescript/src/theme/breakpoints.d.ts.map +1 -1
  239. package/lib/typescript/src/theme/defaults/icons.d.ts +1 -1
  240. package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -1
  241. package/lib/typescript/src/theme/defaults/image.d.ts +1 -1
  242. package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -1
  243. package/lib/typescript/src/theme/index.d.ts +14 -14
  244. package/lib/typescript/src/theme/registry.d.ts +2 -2
  245. package/lib/typescript/src/theme/registry.d.ts.map +1 -1
  246. package/lib/typescript/src/theme/runtime.d.ts +1 -1
  247. package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
  248. package/lib/typescript/src/theme/screen-margin.d.ts +2 -2
  249. package/lib/typescript/src/theme/theme.d.ts +2 -2
  250. package/lib/typescript/src/theme/theme.d.ts.map +1 -1
  251. package/lib/typescript/src/theme/tokens/dark.d.ts +67 -67
  252. package/lib/typescript/src/theme/tokens/light.d.ts +67 -67
  253. package/lib/typescript/src/theme/tokens/primitives.d.ts +417 -417
  254. package/lib/typescript/src/theme/types.d.ts +99 -84
  255. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  256. package/lib/typescript/src/utils/accent-utils.d.ts +1 -1
  257. package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
  258. package/lib/typescript/src/utils/resolve-theme-color.d.ts +1 -1
  259. package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -1
  260. package/lib/typescript/src/utils/typography.d.ts +2 -2
  261. package/lib/typescript/src/utils/typography.d.ts.map +1 -1
  262. package/package.json +1 -1
  263. package/src/components/avatar/Avatar.tsx +66 -71
  264. package/src/components/avatar/index.ts +2 -2
  265. package/src/components/avatar/types.ts +7 -12
  266. package/src/components/box/Box.tsx +7 -18
  267. package/src/components/box/index.ts +3 -3
  268. package/src/components/box/utils.ts +59 -81
  269. package/src/components/button/Button.tsx +119 -144
  270. package/src/components/button/index.ts +2 -2
  271. package/src/components/chip/Chip.tsx +107 -143
  272. package/src/components/chip/index.ts +3 -3
  273. package/src/components/chip/types.ts +7 -7
  274. package/src/components/chip/utils.ts +5 -5
  275. package/src/components/empty-state/EmptyState.tsx +44 -60
  276. package/src/components/empty-state/index.ts +3 -3
  277. package/src/components/empty-state/types.ts +1 -1
  278. package/src/components/header/Header.ts +2 -2
  279. package/src/components/header/header-buttons.tsx +10 -18
  280. package/src/components/header/index.ts +6 -6
  281. package/src/components/header/parts/HeaderGradientOverlay.tsx +3 -7
  282. package/src/components/header/variants/LargeTitleHeader/index.tsx +75 -139
  283. package/src/components/header/variants/TitleHeader/index.tsx +40 -62
  284. package/src/components/icon/Icon.tsx +31 -39
  285. package/src/components/icon/index.ts +2 -2
  286. package/src/components/image/Image.tsx +22 -11
  287. package/src/components/image/index.ts +2 -2
  288. package/src/components/image/types.ts +1 -1
  289. package/src/components/index.ts +17 -17
  290. package/src/components/page-indicator/PageIndicator.tsx +14 -14
  291. package/src/components/page-indicator/PageIndicatorRoot.tsx +4 -12
  292. package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +17 -35
  293. package/src/components/page-indicator/hooks/use-page-indicator-core.ts +6 -8
  294. package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +10 -30
  295. package/src/components/page-indicator/index.ts +3 -3
  296. package/src/components/page-indicator/utils.ts +20 -48
  297. package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +5 -16
  298. package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +21 -63
  299. package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +6 -16
  300. package/src/components/page-indicator/variants/DotIndicator/index.tsx +20 -38
  301. package/src/components/page-indicator/variants/DotIndicator/utils.ts +2 -6
  302. package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +12 -50
  303. package/src/components/page-indicator/variants/PillIndicator/index.tsx +19 -41
  304. package/src/components/page-indicator/variants/PillIndicator/utils.ts +4 -4
  305. package/src/components/portal/Portal.tsx +4 -4
  306. package/src/components/portal/PortalContext.tsx +1 -1
  307. package/src/components/portal/PortalHost.tsx +4 -4
  308. package/src/components/portal/PortalProvider.tsx +24 -35
  309. package/src/components/portal/index.ts +7 -7
  310. package/src/components/screen/Screen.tsx +45 -52
  311. package/src/components/screen/ScreenContext.tsx +8 -17
  312. package/src/components/screen/ScreenFlatList.tsx +17 -36
  313. package/src/components/screen/ScreenList.tsx +31 -63
  314. package/src/components/screen/ScreenScrollView.tsx +17 -30
  315. package/src/components/screen/index.ts +11 -11
  316. package/src/components/screen/parts/BottomSafeArea.tsx +5 -6
  317. package/src/components/screen/parts/ScreenPlaceholder.tsx +9 -14
  318. package/src/components/screen/types.ts +2 -2
  319. package/src/components/screen/utils.ts +6 -19
  320. package/src/components/slot/Slot.tsx +5 -20
  321. package/src/components/slot/index.ts +3 -3
  322. package/src/components/slot/utils.ts +5 -8
  323. package/src/components/spinner/Spinner.tsx +19 -52
  324. package/src/components/spinner/index.ts +2 -2
  325. package/src/components/surface/Surface.tsx +34 -43
  326. package/src/components/surface/index.ts +2 -2
  327. package/src/components/text/Text.tsx +75 -85
  328. package/src/components/text/index.ts +2 -2
  329. package/src/components/toast/Toast.tsx +195 -251
  330. package/src/components/toast/ToastProvider.tsx +61 -136
  331. package/src/components/toast/index.ts +4 -4
  332. package/src/components/toast/parts/ToastAnimatedItem.tsx +14 -22
  333. package/src/components/toast/types.ts +11 -14
  334. package/src/components/toast/utils/controller.ts +4 -6
  335. package/src/components/toolbar/Toolbar.tsx +42 -61
  336. package/src/components/toolbar/index.ts +2 -2
  337. package/src/context/ThemeProvider.tsx +13 -28
  338. package/src/context/index.ts +2 -2
  339. package/src/index.tsx +3 -3
  340. package/src/theme/breakpoints.ts +3 -5
  341. package/src/theme/defaults/icons.tsx +15 -30
  342. package/src/theme/defaults/image.tsx +9 -14
  343. package/src/theme/index.ts +14 -14
  344. package/src/theme/registry.ts +30 -49
  345. package/src/theme/runtime.ts +6 -7
  346. package/src/theme/screen-margin.ts +3 -3
  347. package/src/theme/theme.ts +39 -60
  348. package/src/theme/tokens/dark.ts +67 -67
  349. package/src/theme/tokens/light.ts +67 -67
  350. package/src/theme/tokens/primitives.ts +417 -417
  351. package/src/theme/types.ts +138 -135
  352. package/src/utils/accent-utils.ts +21 -30
  353. package/src/utils/color-utils.ts +3 -3
  354. package/src/utils/deep-merge.ts +1 -1
  355. package/src/utils/resolve-theme-color.ts +8 -11
  356. package/src/utils/typography.ts +7 -10
  357. package/src/utils/unflatten.ts +2 -2
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactNode } from "react";
2
2
 
3
3
  /**
4
4
  * Which axes of the `layout.screen.margin` token a scroll container pads its
@@ -8,7 +8,7 @@ import type { ReactNode } from 'react';
8
8
  * structural insets — the header height and the safe area — which apply
9
9
  * whether or not margins are on.
10
10
  */
11
- export type ScreenMargins = 'all' | 'x' | 'y' | 'none';
11
+ export type ScreenMargins = "all" | "x" | "y" | "none";
12
12
 
13
13
  /**
14
14
  * Props shared by `Screen.ScrollView`, `Screen.FlatList` and `Screen.List`, so
@@ -1,31 +1,18 @@
1
- import {
2
- type ComponentType,
3
- createElement,
4
- isValidElement,
5
- type ReactElement,
6
- } from 'react';
1
+ import { type ComponentType, createElement, isValidElement, type ReactElement } from "react";
7
2
 
8
- import type { ScreenMargins } from './types';
3
+ import type { ScreenMargins } from "./types";
9
4
 
10
- export type ListHeaderComponent =
11
- | ComponentType
12
- | ReactElement
13
- | null
14
- | undefined;
5
+ export type ListHeaderComponent = ComponentType | ReactElement | null | undefined;
15
6
 
16
7
  /** Renders a `ListHeaderComponent`-shaped prop (element, component, or nullish) into an element. */
17
- export function renderListHeader(
18
- ListHeaderComponent: ListHeaderComponent
19
- ): ReactElement | null {
8
+ export function renderListHeader(ListHeaderComponent: ListHeaderComponent): ReactElement | null {
20
9
  if (!ListHeaderComponent) return null;
21
10
  if (isValidElement(ListHeaderComponent)) return ListHeaderComponent;
22
11
  return createElement(ListHeaderComponent);
23
12
  }
24
13
 
25
14
  /** Whether `margins` pads the horizontal axis. */
26
- export const hasXMargin = (margins: ScreenMargins): boolean =>
27
- margins === 'all' || margins === 'x';
15
+ export const hasXMargin = (margins: ScreenMargins): boolean => margins === "all" || margins === "x";
28
16
 
29
17
  /** Whether `margins` pads the vertical axis (the bottom of the content area). */
30
- export const hasYMargin = (margins: ScreenMargins): boolean =>
31
- margins === 'all' || margins === 'y';
18
+ export const hasYMargin = (margins: ScreenMargins): boolean => margins === "all" || margins === "y";
@@ -1,12 +1,6 @@
1
- import {
2
- cloneElement,
3
- isValidElement,
4
- type ReactElement,
5
- type ReactNode,
6
- type Ref,
7
- } from 'react';
1
+ import { cloneElement, isValidElement, type ReactElement, type ReactNode, type Ref } from "react";
8
2
 
9
- import { composeRefs, mergeProps } from './utils';
3
+ import { composeRefs, mergeProps } from "./utils";
10
4
 
11
5
  type AnyProps = Record<string, unknown>;
12
6
 
@@ -23,16 +17,10 @@ export interface SlotProps {
23
17
  * rendering a wrapper. Composes `on*` handlers (child first), `style`
24
18
  * (`[slotStyle, childStyle]`), and refs.
25
19
  */
26
- export function Slot({
27
- slotProps,
28
- ownerName = 'Component',
29
- children,
30
- }: SlotProps): ReactElement | null {
20
+ export function Slot({ slotProps, ownerName = "Component", children }: SlotProps): ReactElement | null {
31
21
  if (!isValidElement(children)) {
32
22
  if (__DEV__ && children != null) {
33
- console.error(
34
- `[${ownerName}] \`asChild\` expects exactly one React element child.`
35
- );
23
+ console.error(`[${ownerName}] \`asChild\` expects exactly one React element child.`);
36
24
  }
37
25
  return null;
38
26
  }
@@ -44,10 +32,7 @@ export function Slot({
44
32
  const { ref: childRef, ...restChildProps } = childProps;
45
33
 
46
34
  const merged = mergeProps(restSlotProps, restChildProps);
47
- const composedRef = composeRefs(
48
- slotRef as Ref<unknown> | undefined,
49
- childRef as Ref<unknown> | undefined
50
- );
35
+ const composedRef = composeRefs(slotRef as Ref<unknown> | undefined, childRef as Ref<unknown> | undefined);
51
36
 
52
37
  return cloneElement(child, {
53
38
  ...merged,
@@ -3,6 +3,6 @@
3
3
  * `asChild` patterns). Most apps should use component APIs directly.
4
4
  */
5
5
 
6
- export type { SlotProps } from './Slot';
7
- export { Slot } from './Slot';
8
- export { composeRefs, mergeProps } from './utils';
6
+ export type { SlotProps } from "./Slot";
7
+ export { Slot } from "./Slot";
8
+ export { composeRefs, mergeProps } from "./utils";
@@ -1,7 +1,7 @@
1
- import type { MutableRefObject, Ref } from 'react';
1
+ import type { MutableRefObject, Ref } from "react";
2
2
 
3
3
  function assignRef<T>(ref: Ref<T> | undefined, value: T | null): void {
4
- if (typeof ref === 'function') {
4
+ if (typeof ref === "function") {
5
5
  ref(value);
6
6
  } else if (ref != null) {
7
7
  (ref as MutableRefObject<T | null>).current = value;
@@ -31,10 +31,7 @@ const isEventHandler = (key: string): boolean => /^on[A-Z]/.test(key);
31
31
  * `ref`/`style` are intentionally not handled here — the caller composes refs
32
32
  * and passes a pre-merged `style` via `slotProps`.
33
33
  */
34
- export function mergeProps(
35
- slotProps: AnyProps,
36
- childProps: AnyProps
37
- ): AnyProps {
34
+ export function mergeProps(slotProps: AnyProps, childProps: AnyProps): AnyProps {
38
35
  const merged: AnyProps = { ...slotProps };
39
36
 
40
37
  for (const key of Object.keys(childProps)) {
@@ -42,7 +39,7 @@ export function mergeProps(
42
39
  const childValue = childProps[key];
43
40
 
44
41
  if (isEventHandler(key)) {
45
- if (typeof slotValue === 'function' && typeof childValue === 'function') {
42
+ if (typeof slotValue === "function" && typeof childValue === "function") {
46
43
  merged[key] = (...args: unknown[]) => {
47
44
  (childValue as (...a: unknown[]) => void)(...args);
48
45
  (slotValue as (...a: unknown[]) => void)(...args);
@@ -50,7 +47,7 @@ export function mergeProps(
50
47
  } else {
51
48
  merged[key] = childValue ?? slotValue;
52
49
  }
53
- } else if (key === 'style') {
50
+ } else if (key === "style") {
54
51
  merged.style = [slotValue, childValue].filter(Boolean);
55
52
  } else {
56
53
  merged[key] = childValue;
@@ -1,4 +1,4 @@
1
- import { memo, useEffect, useId } from 'react';
1
+ import { memo, useEffect, useId } from "react";
2
2
 
3
3
  import Animated, {
4
4
  cancelAnimation,
@@ -7,15 +7,14 @@ import Animated, {
7
7
  useSharedValue,
8
8
  withRepeat,
9
9
  withTiming,
10
- } from 'react-native-reanimated';
11
- import Svg, { Defs, G, LinearGradient, Path, Stop } from 'react-native-svg';
10
+ } from "react-native-reanimated";
11
+ import Svg, { Defs, G, LinearGradient, Path, Stop } from "react-native-svg";
12
+ import { useUnistyles } from "react-native-unistyles";
12
13
 
13
- import { useUnistyles } from 'react-native-unistyles';
14
+ import type { ColorToken } from "#theme/types";
15
+ import { resolveThemeColor } from "#utils/resolve-theme-color";
14
16
 
15
- import type { ColorToken } from '#theme/types';
16
- import { resolveThemeColor } from '#utils/resolve-theme-color';
17
-
18
- export type SpinnerSize = 'sm' | 'md' | 'lg';
17
+ export type SpinnerSize = "sm" | "md" | "lg";
19
18
 
20
19
  export interface SpinnerProps {
21
20
  /** Spinner diameter preset. Defaults to `'md'`. */
@@ -30,10 +29,10 @@ const ROTATION_DURATION = 900;
30
29
 
31
30
  // HeroUI spinner arcs — two gradient-filled segments in a 24×24 viewBox.
32
31
  const LEFT_ARC =
33
- 'M8.749.021a1.5 1.5 0 0 1 .497 2.958A7.5 7.5 0 0 0 3 10.375a7.5 7.5 0 0 0 7.5 7.5v3c-5.799 0-10.5-4.7-10.5-10.5C0 5.23 3.726.865 8.749.021';
32
+ "M8.749.021a1.5 1.5 0 0 1 .497 2.958A7.5 7.5 0 0 0 3 10.375a7.5 7.5 0 0 0 7.5 7.5v3c-5.799 0-10.5-4.7-10.5-10.5C0 5.23 3.726.865 8.749.021";
34
33
  const RIGHT_ARC =
35
- 'M15.392 2.673a1.5 1.5 0 0 1 2.119-.115A10.48 10.48 0 0 1 21 10.375c0 5.8-4.701 10.5-10.5 10.5v-3a7.5 7.5 0 0 0 5.007-13.084a1.5 1.5 0 0 1-.115-2.118';
36
- const ARC_TRANSFORM = 'translate(1.5 1.625)';
34
+ "M15.392 2.673a1.5 1.5 0 0 1 2.119-.115A10.48 10.48 0 0 1 21 10.375c0 5.8-4.701 10.5-10.5 10.5v-3a7.5 7.5 0 0 0 5.007-13.084a1.5 1.5 0 0 1-.115-2.118";
35
+ const ARC_TRANSFORM = "translate(1.5 1.625)";
37
36
 
38
37
  interface SpinnerIconProps {
39
38
  size: number;
@@ -42,47 +41,22 @@ interface SpinnerIconProps {
42
41
  gradientId2: string;
43
42
  }
44
43
 
45
- const SpinnerIcon = memo(function SpinnerIcon({
46
- size,
47
- color,
48
- gradientId1,
49
- gradientId2,
50
- }: SpinnerIconProps) {
44
+ const SpinnerIcon = memo(function SpinnerIcon({ size, color, gradientId1, gradientId2 }: SpinnerIconProps) {
51
45
  return (
52
46
  <Svg width={size} height={size} viewBox="0 0 24 24">
53
47
  <Defs>
54
- <LinearGradient
55
- id={gradientId1}
56
- x1="50%"
57
- x2="50%"
58
- y1="5.271%"
59
- y2="91.793%"
60
- >
48
+ <LinearGradient id={gradientId1} x1="50%" x2="50%" y1="5.271%" y2="91.793%">
61
49
  <Stop offset="0%" stopColor={color} />
62
50
  <Stop offset="100%" stopColor={color} stopOpacity={0.55} />
63
51
  </LinearGradient>
64
- <LinearGradient
65
- id={gradientId2}
66
- x1="50%"
67
- x2="50%"
68
- y1="15.24%"
69
- y2="87.15%"
70
- >
52
+ <LinearGradient id={gradientId2} x1="50%" x2="50%" y1="15.24%" y2="87.15%">
71
53
  <Stop offset="0%" stopColor={color} stopOpacity={0} />
72
54
  <Stop offset="100%" stopColor={color} stopOpacity={0.55} />
73
55
  </LinearGradient>
74
56
  </Defs>
75
57
  <G fill="none">
76
- <Path
77
- d={LEFT_ARC}
78
- fill={`url(#${gradientId1})`}
79
- transform={ARC_TRANSFORM}
80
- />
81
- <Path
82
- d={RIGHT_ARC}
83
- fill={`url(#${gradientId2})`}
84
- transform={ARC_TRANSFORM}
85
- />
58
+ <Path d={LEFT_ARC} fill={`url(#${gradientId1})`} transform={ARC_TRANSFORM} />
59
+ <Path d={RIGHT_ARC} fill={`url(#${gradientId2})`} transform={ARC_TRANSFORM} />
86
60
  </G>
87
61
  </Svg>
88
62
  );
@@ -96,17 +70,15 @@ const SpinnerIcon = memo(function SpinnerIcon({
96
70
  * <Spinner size="md" color="content.accent" />
97
71
  * ```
98
72
  */
99
- export function Spinner({ size = 'md', color = 'text.accent' }: SpinnerProps) {
73
+ export function Spinner({ size = "md", color = "text.accent" }: SpinnerProps) {
100
74
  const { theme } = useUnistyles();
101
75
  const id = useId();
102
76
  const gradientId1 = `spinner-def-1-${id}`;
103
77
  const gradientId2 = `spinner-def-2-${id}`;
104
78
  const resolvedColor =
105
79
  resolveThemeColor(color, theme) ??
106
- (theme.color as unknown as Record<string, string | undefined>)[
107
- 'text.accent'
108
- ] ??
109
- '';
80
+ (theme.color as unknown as Record<string, string | undefined>)["text.accent"] ??
81
+ "";
110
82
 
111
83
  const dim = DIMENSION[size];
112
84
  const rotation = useSharedValue(0);
@@ -142,12 +114,7 @@ export function Spinner({ size = 'md', color = 'text.accent' }: SpinnerProps) {
142
114
  collapsable={false}
143
115
  style={[{ width: dim, height: dim }, animStyle]}
144
116
  >
145
- <SpinnerIcon
146
- size={dim}
147
- color={resolvedColor}
148
- gradientId1={gradientId1}
149
- gradientId2={gradientId2}
150
- />
117
+ <SpinnerIcon size={dim} color={resolvedColor} gradientId1={gradientId1} gradientId2={gradientId2} />
151
118
  </Animated.View>
152
119
  );
153
120
  }
@@ -1,2 +1,2 @@
1
- export type { SpinnerProps, SpinnerSize } from './Spinner';
2
- export { Spinner } from './Spinner';
1
+ export type { SpinnerProps, SpinnerSize } from "./Spinner";
2
+ export { Spinner } from "./Spinner";
@@ -1,15 +1,14 @@
1
- import { type ComponentRef, forwardRef } from 'react';
2
- import type { View } from 'react-native';
1
+ import { type ComponentRef, forwardRef } from "react";
2
+ import type { View } from "react-native";
3
3
 
4
- import { getDefaultRadius, getSurfaceElevation } from '#theme/registry';
5
- import type { ColorToken, ElevationKey } from '#theme/types';
6
-
7
- import { type BorderWidthInput, Box, type BoxProps } from '../box';
4
+ import { getDefaultRadius, getSurfaceElevation } from "#theme/registry";
5
+ import type { ColorToken, ElevationKey } from "#theme/types";
6
+ import { type BorderWidthInput, Box, type BoxProps } from "../box";
8
7
 
9
8
  /** Background level of a {@link Surface}. */
10
- export type SurfaceVariant = 'base' | 'raised' | 'sunken' | 'transparent';
9
+ export type SurfaceVariant = "base" | "raised" | "sunken" | "transparent";
11
10
 
12
- export interface SurfaceProps extends Omit<BoxProps, 'bg'> {
11
+ export interface SurfaceProps extends Omit<BoxProps, "background"> {
13
12
  /** Background surface level. Defaults to `'base'`. */
14
13
  variant?: SurfaceVariant;
15
14
  /**
@@ -23,20 +22,17 @@ export interface SurfaceProps extends Omit<BoxProps, 'bg'> {
23
22
  }
24
23
 
25
24
  const VARIANT_BG: Record<SurfaceVariant, ColorToken> = {
26
- base: 'surface.default',
27
- raised: 'surface.raised',
28
- sunken: 'surface.sunken',
29
- transparent: 'transparent',
25
+ base: "surface.default",
26
+ raised: "surface.raised",
27
+ sunken: "surface.sunken",
28
+ transparent: "transparent",
30
29
  };
31
30
 
32
31
  /** Variant-aware hairline borders improve edge definition when fills are close. */
33
- const VARIANT_BORDER: Record<
34
- SurfaceVariant,
35
- { borderWidth?: BorderWidthInput; borderColor?: ColorToken }
36
- > = {
32
+ const VARIANT_BORDER: Record<SurfaceVariant, { borderWidth?: BorderWidthInput; borderColor?: ColorToken }> = {
37
33
  base: {},
38
- raised: { borderWidth: 'hairline', borderColor: 'border.subtle' },
39
- sunken: { borderWidth: 'hairline', borderColor: 'border.default' },
34
+ raised: { borderWidth: "hairline", borderColor: "border.subtle" },
35
+ sunken: { borderWidth: "hairline", borderColor: "border.default" },
40
36
  transparent: {},
41
37
  };
42
38
 
@@ -45,13 +41,10 @@ const VARIANT_BORDER: Record<
45
41
  * theme-independent. `transparent` collapses to `'none'` because a shadow needs
46
42
  * an opaque fill behind it to render.
47
43
  */
48
- const resolveElevation = (
49
- variant: SurfaceVariant,
50
- elevation?: ElevationKey
51
- ): ElevationKey => {
52
- if (variant === 'transparent') return 'none';
44
+ const resolveElevation = (variant: SurfaceVariant, elevation?: ElevationKey): ElevationKey => {
45
+ if (variant === "transparent") return "none";
53
46
  if (elevation !== undefined) return elevation;
54
- if (variant === 'raised') return 'sm';
47
+ if (variant === "raised") return "sm";
55
48
  return getSurfaceElevation();
56
49
  };
57
50
 
@@ -75,23 +68,21 @@ const resolveElevation = (
75
68
  * </Surface>
76
69
  * ```
77
70
  */
78
- export const Surface = forwardRef<ComponentRef<typeof View>, SurfaceProps>(
79
- function Surface(
80
- { variant = 'base', elevation, radius, borderWidth, borderColor, ...rest },
81
- ref
82
- ) {
83
- const variantBorder = VARIANT_BORDER[variant];
71
+ export const Surface = forwardRef<ComponentRef<typeof View>, SurfaceProps>(function Surface(
72
+ { variant = "base", elevation, radius, borderWidth, borderColor, ...rest },
73
+ ref
74
+ ) {
75
+ const variantBorder = VARIANT_BORDER[variant];
84
76
 
85
- return (
86
- <Box
87
- ref={ref}
88
- bg={VARIANT_BG[variant]}
89
- radius={radius ?? getDefaultRadius('surface')}
90
- borderWidth={borderWidth ?? variantBorder.borderWidth}
91
- borderColor={borderColor ?? variantBorder.borderColor}
92
- elevation={resolveElevation(variant, elevation)}
93
- {...rest}
94
- />
95
- );
96
- }
97
- );
77
+ return (
78
+ <Box
79
+ ref={ref}
80
+ background={VARIANT_BG[variant]}
81
+ radius={radius ?? getDefaultRadius("surface")}
82
+ borderWidth={borderWidth ?? variantBorder.borderWidth}
83
+ borderColor={borderColor ?? variantBorder.borderColor}
84
+ elevation={resolveElevation(variant, elevation)}
85
+ {...rest}
86
+ />
87
+ );
88
+ });
@@ -1,2 +1,2 @@
1
- export type { SurfaceProps, SurfaceVariant } from './Surface';
2
- export { Surface } from './Surface';
1
+ export type { SurfaceProps, SurfaceVariant } from "./Surface";
2
+ export { Surface } from "./Surface";
@@ -1,31 +1,28 @@
1
- import { type ComponentRef, forwardRef } from 'react';
2
- import {
3
- Text as RNText,
4
- type TextProps as RNTextProps,
5
- type TextStyle,
6
- } from 'react-native';
1
+ import { type ComponentRef, forwardRef } from "react";
2
+ import { Text as RNText, type TextProps as RNTextProps, type TextStyle } from "react-native";
3
+
4
+ import { StyleSheet, useUnistyles } from "react-native-unistyles";
7
5
 
8
- import { StyleSheet, useUnistyles } from 'react-native-unistyles';
9
6
  import type {
10
7
  ColorToken,
11
8
  FontWeightToken,
12
9
  HeadingTextVariant,
13
10
  RoleTextVariant,
14
11
  TextVariant,
15
- } from '#theme/types';
16
- import type { Mutable } from '#types';
17
- import { resolveThemeColor } from '#utils/resolve-theme-color';
18
- import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from '#utils/typography';
12
+ } from "#theme/types";
13
+ import type { Mutable } from "#types";
14
+ import { resolveThemeColor } from "#utils/resolve-theme-color";
15
+ import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from "#utils/typography";
19
16
 
20
- export type TextAlign = 'left' | 'center' | 'right' | 'justify';
17
+ export type TextAlign = "left" | "center" | "right" | "justify";
21
18
 
22
19
  const HEADING_VARIANT_ALIAS: Record<HeadingTextVariant, RoleTextVariant> = {
23
- h1: 'headline-lg',
24
- h2: 'headline-md',
25
- h3: 'title-lg',
26
- h4: 'title-md',
27
- h5: 'title-sm',
28
- h6: 'label-lg',
20
+ h1: "headline-lg",
21
+ h2: "headline-md",
22
+ h3: "title-lg",
23
+ h4: "title-md",
24
+ h5: "title-sm",
25
+ h6: "label-lg",
29
26
  };
30
27
 
31
28
  function resolveTextVariant(variant: TextVariant): RoleTextVariant {
@@ -44,7 +41,7 @@ export interface TextProps extends RNTextProps {
44
41
  align?: TextAlign;
45
42
  italic?: boolean;
46
43
  underline?: boolean;
47
- transform?: 'uppercase' | 'lowercase' | 'capitalize';
44
+ transform?: "uppercase" | "lowercase" | "capitalize";
48
45
  strikeThrough?: boolean;
49
46
  /** Truncate to a single line with a trailing ellipsis. */
50
47
  isTruncated?: boolean;
@@ -54,75 +51,68 @@ export interface TextProps extends RNTextProps {
54
51
  * Themed text primitive. Reads its scale from `theme.typography` and resolves
55
52
  * fonts by weight, honoring Dynamic Type with a per-variant scaling cap.
56
53
  */
57
- export const Text = forwardRef<ComponentRef<typeof RNText>, TextProps>(
58
- function Text(
59
- {
60
- variant = 'body-md',
61
- color,
62
- weight,
63
- align,
64
- italic,
65
- underline,
66
- transform,
67
- strikeThrough,
68
- isTruncated,
69
- style,
70
- numberOfLines,
71
- ellipsizeMode,
72
- maxFontSizeMultiplier,
73
- ...rest
74
- },
75
- ref
76
- ) {
77
- const { theme } = useUnistyles();
78
- const resolvedVariant = resolveTextVariant(variant);
79
- const v = theme.typography.variants[resolvedVariant];
80
- const effectiveWeight: FontWeightToken = weight ?? v.fontWeight;
81
- const fontFamily = theme.typography.fonts[effectiveWeight];
82
- const italicFamily = italic
83
- ? theme.typography.fontsItalic?.[effectiveWeight]
84
- : undefined;
85
- const resolvedFamily = italicFamily ?? fontFamily;
86
- const isSystemFont = resolvedFamily === SYSTEM_FONT;
54
+ export const Text = forwardRef<ComponentRef<typeof RNText>, TextProps>(function Text(
55
+ {
56
+ variant = "body-md",
57
+ color,
58
+ weight,
59
+ align,
60
+ italic,
61
+ underline,
62
+ transform,
63
+ strikeThrough,
64
+ isTruncated,
65
+ style,
66
+ numberOfLines,
67
+ ellipsizeMode,
68
+ maxFontSizeMultiplier,
69
+ ...rest
70
+ },
71
+ ref
72
+ ) {
73
+ const { theme } = useUnistyles();
74
+ const resolvedVariant = resolveTextVariant(variant);
75
+ const v = theme.typography.variants[resolvedVariant];
76
+ const effectiveWeight: FontWeightToken = weight ?? v.fontWeight;
77
+ const fontFamily = theme.typography.fonts[effectiveWeight];
78
+ const italicFamily = italic ? theme.typography.fontsItalic?.[effectiveWeight] : undefined;
79
+ const resolvedFamily = italicFamily ?? fontFamily;
80
+ const isSystemFont = resolvedFamily === SYSTEM_FONT;
87
81
 
88
- const base: Mutable<TextStyle> = {
89
- fontSize: v.fontSize,
90
- lineHeight: v.lineHeight,
91
- letterSpacing: v.letterSpacing,
92
- color:
93
- resolveThemeColor(color, theme) ??
94
- (theme.color as unknown as Record<string, string | undefined>)[
95
- 'text.default'
96
- ] ??
97
- '',
98
- };
99
- // System font: apply numeric weight. Custom font: family encodes the weight.
100
- if (isSystemFont) base.fontWeight = FONT_WEIGHT_VALUE[effectiveWeight];
101
- else base.fontFamily = resolvedFamily;
82
+ const base: Mutable<TextStyle> = {
83
+ fontSize: v.fontSize,
84
+ lineHeight: v.lineHeight,
85
+ letterSpacing: v.letterSpacing,
86
+ color:
87
+ resolveThemeColor(color, theme) ??
88
+ (theme.color as unknown as Record<string, string | undefined>)["text.default"] ??
89
+ "",
90
+ };
91
+ // System font: apply numeric weight. Custom font: family encodes the weight.
92
+ if (isSystemFont) base.fontWeight = FONT_WEIGHT_VALUE[effectiveWeight];
93
+ else base.fontFamily = resolvedFamily;
102
94
 
103
- if (align) base.textAlign = align;
104
- // A dedicated italic family already renders slanted; `fontStyle` is only
105
- // needed (and only works) for the system font or as a best-effort
106
- // fallback when no italic family is configured for this weight.
107
- if (italic && !italicFamily) base.fontStyle = 'italic';
108
- if (underline && strikeThrough)
109
- base.textDecorationLine = 'underline line-through';
110
- else if (underline) base.textDecorationLine = 'underline';
111
- else if (strikeThrough) base.textDecorationLine = 'line-through';
112
- if (transform) base.textTransform = transform;
95
+ if (align) base.textAlign = align;
96
+ // A dedicated italic family already renders slanted; `fontStyle` is only
97
+ // needed (and only works) for the system font or as a best-effort
98
+ // fallback when no italic family is configured for this weight.
99
+ if (italic && !italicFamily) base.fontStyle = "italic";
100
+ if (underline && strikeThrough) base.textDecorationLine = "underline line-through";
101
+ else if (underline) base.textDecorationLine = "underline";
102
+ else if (strikeThrough) base.textDecorationLine = "line-through";
103
+ if (transform) base.textTransform = transform;
113
104
 
114
- return (
115
- <RNText
116
- ref={ref}
117
- style={[styles.root, base, style]}
118
- maxFontSizeMultiplier={maxFontSizeMultiplier ?? v.maxFontSizeMultiplier}
119
- numberOfLines={isTruncated ? 1 : numberOfLines}
120
- ellipsizeMode={isTruncated ? 'tail' : ellipsizeMode}
121
- {...rest}
122
- />
123
- );
124
- }
125
- );
105
+ return (
106
+ <RNText
107
+ ref={ref}
108
+ style={[styles.root, base, style]}
109
+ maxFontSizeMultiplier={maxFontSizeMultiplier ?? v.maxFontSizeMultiplier}
110
+ numberOfLines={isTruncated ? 1 : numberOfLines}
111
+ ellipsizeMode={isTruncated ? "tail" : ellipsizeMode}
112
+ {...rest}
113
+ />
114
+ );
115
+ });
126
116
 
127
117
  // ─── Styles ───────────────────────────────────────────────────────────────────
128
118
  //
@@ -1,2 +1,2 @@
1
- export type { TextAlign, TextProps } from './Text';
2
- export { Text } from './Text';
1
+ export type { TextAlign, TextProps } from "./Text";
2
+ export { Text } from "./Text";