react-native-terra-ui 0.1.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 (379) hide show
  1. package/README.md +70 -0
  2. package/lib/module/components/avatar/Avatar.js +121 -0
  3. package/lib/module/components/avatar/Avatar.js.map +1 -0
  4. package/lib/module/components/avatar/index.js +4 -0
  5. package/lib/module/components/avatar/index.js.map +1 -0
  6. package/lib/module/components/avatar/types.js +4 -0
  7. package/lib/module/components/avatar/types.js.map +1 -0
  8. package/lib/module/components/box/Box.js +49 -0
  9. package/lib/module/components/box/Box.js.map +1 -0
  10. package/lib/module/components/box/index.js +4 -0
  11. package/lib/module/components/box/index.js.map +1 -0
  12. package/lib/module/components/box/utils.js +95 -0
  13. package/lib/module/components/box/utils.js.map +1 -0
  14. package/lib/module/components/button/Button.js +281 -0
  15. package/lib/module/components/button/Button.js.map +1 -0
  16. package/lib/module/components/button/index.js +4 -0
  17. package/lib/module/components/button/index.js.map +1 -0
  18. package/lib/module/components/header/Header.js +25 -0
  19. package/lib/module/components/header/Header.js.map +1 -0
  20. package/lib/module/components/header/header-buttons.js +65 -0
  21. package/lib/module/components/header/header-buttons.js.map +1 -0
  22. package/lib/module/components/header/index.js +7 -0
  23. package/lib/module/components/header/index.js.map +1 -0
  24. package/lib/module/components/header/variants/LargeTitleHeader/index.js +335 -0
  25. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -0
  26. package/lib/module/components/header/variants/TitleHeader/index.js +184 -0
  27. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -0
  28. package/lib/module/components/icon/Icon.js +53 -0
  29. package/lib/module/components/icon/Icon.js.map +1 -0
  30. package/lib/module/components/icon/index.js +4 -0
  31. package/lib/module/components/icon/index.js.map +1 -0
  32. package/lib/module/components/icon/utils.js +188 -0
  33. package/lib/module/components/icon/utils.js.map +1 -0
  34. package/lib/module/components/index.js +16 -0
  35. package/lib/module/components/index.js.map +1 -0
  36. package/lib/module/components/page-indicator/PageIndicator.js +49 -0
  37. package/lib/module/components/page-indicator/PageIndicator.js.map +1 -0
  38. package/lib/module/components/page-indicator/PageIndicatorRoot.js +24 -0
  39. package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -0
  40. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +24 -0
  41. package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -0
  42. package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js +20 -0
  43. package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -0
  44. package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +68 -0
  45. package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -0
  46. package/lib/module/components/page-indicator/index.js +5 -0
  47. package/lib/module/components/page-indicator/index.js.map +1 -0
  48. package/lib/module/components/page-indicator/utils.js +127 -0
  49. package/lib/module/components/page-indicator/utils.js.map +1 -0
  50. package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +50 -0
  51. package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -0
  52. package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +165 -0
  53. package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -0
  54. package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +60 -0
  55. package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -0
  56. package/lib/module/components/page-indicator/variants/DotIndicator/index.js +87 -0
  57. package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -0
  58. package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +28 -0
  59. package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -0
  60. package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +53 -0
  61. package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -0
  62. package/lib/module/components/page-indicator/variants/PillIndicator/index.js +76 -0
  63. package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -0
  64. package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +47 -0
  65. package/lib/module/components/page-indicator/variants/PillIndicator/utils.js.map +1 -0
  66. package/lib/module/components/portal/PortalContext.js +20 -0
  67. package/lib/module/components/portal/PortalContext.js.map +1 -0
  68. package/lib/module/components/portal/PortalHost.js +23 -0
  69. package/lib/module/components/portal/PortalHost.js.map +1 -0
  70. package/lib/module/components/portal/PortalProvider.js +40 -0
  71. package/lib/module/components/portal/PortalProvider.js.map +1 -0
  72. package/lib/module/components/portal/index.js +6 -0
  73. package/lib/module/components/portal/index.js.map +1 -0
  74. package/lib/module/components/screen/Screen.js +100 -0
  75. package/lib/module/components/screen/Screen.js.map +1 -0
  76. package/lib/module/components/screen/ScreenContext.js +66 -0
  77. package/lib/module/components/screen/ScreenContext.js.map +1 -0
  78. package/lib/module/components/screen/ScreenFlatList.js +75 -0
  79. package/lib/module/components/screen/ScreenFlatList.js.map +1 -0
  80. package/lib/module/components/screen/ScreenScrollView.js +82 -0
  81. package/lib/module/components/screen/ScreenScrollView.js.map +1 -0
  82. package/lib/module/components/screen/index.js +7 -0
  83. package/lib/module/components/screen/index.js.map +1 -0
  84. package/lib/module/components/screen/utils.js +13 -0
  85. package/lib/module/components/screen/utils.js.map +1 -0
  86. package/lib/module/components/slot/Slot.js +38 -0
  87. package/lib/module/components/slot/Slot.js.map +1 -0
  88. package/lib/module/components/slot/index.js +10 -0
  89. package/lib/module/components/slot/index.js.map +1 -0
  90. package/lib/module/components/slot/utils.js +55 -0
  91. package/lib/module/components/slot/utils.js.map +1 -0
  92. package/lib/module/components/spinner/Spinner.js +132 -0
  93. package/lib/module/components/spinner/Spinner.js.map +1 -0
  94. package/lib/module/components/spinner/index.js +4 -0
  95. package/lib/module/components/spinner/index.js.map +1 -0
  96. package/lib/module/components/surface/Surface.js +74 -0
  97. package/lib/module/components/surface/Surface.js.map +1 -0
  98. package/lib/module/components/surface/index.js +4 -0
  99. package/lib/module/components/surface/index.js.map +1 -0
  100. package/lib/module/components/text/Text.js +67 -0
  101. package/lib/module/components/text/Text.js.map +1 -0
  102. package/lib/module/components/text/index.js +4 -0
  103. package/lib/module/components/text/index.js.map +1 -0
  104. package/lib/module/components/toast/Toast.js +350 -0
  105. package/lib/module/components/toast/Toast.js.map +1 -0
  106. package/lib/module/components/toast/ToastProvider.js +272 -0
  107. package/lib/module/components/toast/ToastProvider.js.map +1 -0
  108. package/lib/module/components/toast/index.js +5 -0
  109. package/lib/module/components/toast/index.js.map +1 -0
  110. package/lib/module/components/toast/parts/ToastAnimatedItem.js +168 -0
  111. package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -0
  112. package/lib/module/components/toast/types.js +4 -0
  113. package/lib/module/components/toast/types.js.map +1 -0
  114. package/lib/module/components/toast/utils/controller.js +19 -0
  115. package/lib/module/components/toast/utils/controller.js.map +1 -0
  116. package/lib/module/context/ThemeProvider.js +66 -0
  117. package/lib/module/context/ThemeProvider.js.map +1 -0
  118. package/lib/module/context/index.js +4 -0
  119. package/lib/module/context/index.js.map +1 -0
  120. package/lib/module/index.js +8 -0
  121. package/lib/module/index.js.map +1 -0
  122. package/lib/module/package.json +1 -0
  123. package/lib/module/theme/configure.js +152 -0
  124. package/lib/module/theme/configure.js.map +1 -0
  125. package/lib/module/theme/index.js +22 -0
  126. package/lib/module/theme/index.js.map +1 -0
  127. package/lib/module/theme/runtime.js +25 -0
  128. package/lib/module/theme/runtime.js.map +1 -0
  129. package/lib/module/theme/theme.js +121 -0
  130. package/lib/module/theme/theme.js.map +1 -0
  131. package/lib/module/theme/tokens/dark.js +109 -0
  132. package/lib/module/theme/tokens/dark.js.map +1 -0
  133. package/lib/module/theme/tokens/light.js +115 -0
  134. package/lib/module/theme/tokens/light.js.map +1 -0
  135. package/lib/module/theme/tokens/primitives.js +228 -0
  136. package/lib/module/theme/tokens/primitives.js.map +1 -0
  137. package/lib/module/theme/types.js +4 -0
  138. package/lib/module/theme/types.js.map +1 -0
  139. package/lib/module/types.js +2 -0
  140. package/lib/module/types.js.map +1 -0
  141. package/lib/module/utils/accent-utils.js +52 -0
  142. package/lib/module/utils/accent-utils.js.map +1 -0
  143. package/lib/module/utils/color-utils.js +53 -0
  144. package/lib/module/utils/color-utils.js.map +1 -0
  145. package/lib/module/utils/deep-merge.js +28 -0
  146. package/lib/module/utils/deep-merge.js.map +1 -0
  147. package/lib/module/utils/resolve-theme-color.js +20 -0
  148. package/lib/module/utils/resolve-theme-color.js.map +1 -0
  149. package/lib/module/utils/typography.js +13 -0
  150. package/lib/module/utils/typography.js.map +1 -0
  151. package/lib/module/utils/unflatten.js +35 -0
  152. package/lib/module/utils/unflatten.js.map +1 -0
  153. package/lib/typescript/package.json +1 -0
  154. package/lib/typescript/src/components/avatar/Avatar.d.ts +3 -0
  155. package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -0
  156. package/lib/typescript/src/components/avatar/index.d.ts +3 -0
  157. package/lib/typescript/src/components/avatar/index.d.ts.map +1 -0
  158. package/lib/typescript/src/components/avatar/types.d.ts +30 -0
  159. package/lib/typescript/src/components/avatar/types.d.ts.map +1 -0
  160. package/lib/typescript/src/components/box/Box.d.ts +12 -0
  161. package/lib/typescript/src/components/box/Box.d.ts.map +1 -0
  162. package/lib/typescript/src/components/box/index.d.ts +4 -0
  163. package/lib/typescript/src/components/box/index.d.ts.map +1 -0
  164. package/lib/typescript/src/components/box/utils.d.ts +39 -0
  165. package/lib/typescript/src/components/box/utils.d.ts.map +1 -0
  166. package/lib/typescript/src/components/button/Button.d.ts +46 -0
  167. package/lib/typescript/src/components/button/Button.d.ts.map +1 -0
  168. package/lib/typescript/src/components/button/index.d.ts +3 -0
  169. package/lib/typescript/src/components/button/index.d.ts.map +1 -0
  170. package/lib/typescript/src/components/header/Header.d.ts +22 -0
  171. package/lib/typescript/src/components/header/Header.d.ts.map +1 -0
  172. package/lib/typescript/src/components/header/header-buttons.d.ts +16 -0
  173. package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -0
  174. package/lib/typescript/src/components/header/index.d.ts +7 -0
  175. package/lib/typescript/src/components/header/index.d.ts.map +1 -0
  176. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +25 -0
  177. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -0
  178. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +28 -0
  179. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -0
  180. package/lib/typescript/src/components/icon/Icon.d.ts +22 -0
  181. package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -0
  182. package/lib/typescript/src/components/icon/index.d.ts +3 -0
  183. package/lib/typescript/src/components/icon/index.d.ts.map +1 -0
  184. package/lib/typescript/src/components/icon/utils.d.ts +4 -0
  185. package/lib/typescript/src/components/icon/utils.d.ts.map +1 -0
  186. package/lib/typescript/src/components/index.d.ts +14 -0
  187. package/lib/typescript/src/components/index.d.ts.map +1 -0
  188. package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +48 -0
  189. package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts.map +1 -0
  190. package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +13 -0
  191. package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -0
  192. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +14 -0
  193. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -0
  194. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +11 -0
  195. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -0
  196. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +19 -0
  197. package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -0
  198. package/lib/typescript/src/components/page-indicator/index.d.ts +4 -0
  199. package/lib/typescript/src/components/page-indicator/index.d.ts.map +1 -0
  200. package/lib/typescript/src/components/page-indicator/utils.d.ts +36 -0
  201. package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -0
  202. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +14 -0
  203. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -0
  204. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +11 -0
  205. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -0
  206. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +15 -0
  207. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -0
  208. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +32 -0
  209. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -0
  210. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts +14 -0
  211. package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -0
  212. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +16 -0
  213. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -0
  214. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +28 -0
  215. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -0
  216. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +21 -0
  217. package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts.map +1 -0
  218. package/lib/typescript/src/components/portal/PortalContext.d.ts +19 -0
  219. package/lib/typescript/src/components/portal/PortalContext.d.ts.map +1 -0
  220. package/lib/typescript/src/components/portal/PortalHost.d.ts +7 -0
  221. package/lib/typescript/src/components/portal/PortalHost.d.ts.map +1 -0
  222. package/lib/typescript/src/components/portal/PortalProvider.d.ts +11 -0
  223. package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -0
  224. package/lib/typescript/src/components/portal/index.d.ts +6 -0
  225. package/lib/typescript/src/components/portal/index.d.ts.map +1 -0
  226. package/lib/typescript/src/components/screen/Screen.d.ts +53 -0
  227. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -0
  228. package/lib/typescript/src/components/screen/ScreenContext.d.ts +64 -0
  229. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -0
  230. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +26 -0
  231. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -0
  232. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +36 -0
  233. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -0
  234. package/lib/typescript/src/components/screen/index.d.ts +9 -0
  235. package/lib/typescript/src/components/screen/index.d.ts.map +1 -0
  236. package/lib/typescript/src/components/screen/utils.d.ts +10 -0
  237. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -0
  238. package/lib/typescript/src/components/slot/Slot.d.ts +17 -0
  239. package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -0
  240. package/lib/typescript/src/components/slot/index.d.ts +8 -0
  241. package/lib/typescript/src/components/slot/index.d.ts.map +1 -0
  242. package/lib/typescript/src/components/slot/utils.d.ts +17 -0
  243. package/lib/typescript/src/components/slot/utils.d.ts.map +1 -0
  244. package/lib/typescript/src/components/spinner/Spinner.d.ts +18 -0
  245. package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -0
  246. package/lib/typescript/src/components/spinner/index.d.ts +3 -0
  247. package/lib/typescript/src/components/spinner/index.d.ts.map +1 -0
  248. package/lib/typescript/src/components/surface/Surface.d.ts +31 -0
  249. package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -0
  250. package/lib/typescript/src/components/surface/index.d.ts +3 -0
  251. package/lib/typescript/src/components/surface/index.d.ts.map +1 -0
  252. package/lib/typescript/src/components/text/Text.d.ts +23 -0
  253. package/lib/typescript/src/components/text/Text.d.ts.map +1 -0
  254. package/lib/typescript/src/components/text/index.d.ts +3 -0
  255. package/lib/typescript/src/components/text/index.d.ts.map +1 -0
  256. package/lib/typescript/src/components/toast/Toast.d.ts +71 -0
  257. package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -0
  258. package/lib/typescript/src/components/toast/ToastProvider.d.ts +4 -0
  259. package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -0
  260. package/lib/typescript/src/components/toast/index.d.ts +5 -0
  261. package/lib/typescript/src/components/toast/index.d.ts.map +1 -0
  262. package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +18 -0
  263. package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -0
  264. package/lib/typescript/src/components/toast/types.d.ts +62 -0
  265. package/lib/typescript/src/components/toast/types.d.ts.map +1 -0
  266. package/lib/typescript/src/components/toast/utils/controller.d.ts +5 -0
  267. package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -0
  268. package/lib/typescript/src/context/ThemeProvider.d.ts +29 -0
  269. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -0
  270. package/lib/typescript/src/context/index.d.ts +3 -0
  271. package/lib/typescript/src/context/index.d.ts.map +1 -0
  272. package/lib/typescript/src/index.d.ts +4 -0
  273. package/lib/typescript/src/index.d.ts.map +1 -0
  274. package/lib/typescript/src/theme/configure.d.ts +47 -0
  275. package/lib/typescript/src/theme/configure.d.ts.map +1 -0
  276. package/lib/typescript/src/theme/index.d.ts +11 -0
  277. package/lib/typescript/src/theme/index.d.ts.map +1 -0
  278. package/lib/typescript/src/theme/runtime.d.ts +7 -0
  279. package/lib/typescript/src/theme/runtime.d.ts.map +1 -0
  280. package/lib/typescript/src/theme/theme.d.ts +22 -0
  281. package/lib/typescript/src/theme/theme.d.ts.map +1 -0
  282. package/lib/typescript/src/theme/tokens/dark.d.ts +100 -0
  283. package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -0
  284. package/lib/typescript/src/theme/tokens/light.d.ts +106 -0
  285. package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -0
  286. package/lib/typescript/src/theme/tokens/primitives.d.ts +212 -0
  287. package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -0
  288. package/lib/typescript/src/theme/types.d.ts +273 -0
  289. package/lib/typescript/src/theme/types.d.ts.map +1 -0
  290. package/lib/typescript/src/types.d.ts +4 -0
  291. package/lib/typescript/src/types.d.ts.map +1 -0
  292. package/lib/typescript/src/utils/accent-utils.d.ts +4 -0
  293. package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -0
  294. package/lib/typescript/src/utils/color-utils.d.ts +11 -0
  295. package/lib/typescript/src/utils/color-utils.d.ts.map +1 -0
  296. package/lib/typescript/src/utils/deep-merge.d.ts +11 -0
  297. package/lib/typescript/src/utils/deep-merge.d.ts.map +1 -0
  298. package/lib/typescript/src/utils/resolve-theme-color.d.ts +12 -0
  299. package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -0
  300. package/lib/typescript/src/utils/typography.d.ts +6 -0
  301. package/lib/typescript/src/utils/typography.d.ts.map +1 -0
  302. package/lib/typescript/src/utils/unflatten.d.ts +12 -0
  303. package/lib/typescript/src/utils/unflatten.d.ts.map +1 -0
  304. package/package.json +137 -0
  305. package/src/components/avatar/Avatar.tsx +146 -0
  306. package/src/components/avatar/index.ts +8 -0
  307. package/src/components/avatar/types.ts +35 -0
  308. package/src/components/box/Box.tsx +59 -0
  309. package/src/components/box/index.ts +8 -0
  310. package/src/components/box/utils.ts +181 -0
  311. package/src/components/button/Button.tsx +313 -0
  312. package/src/components/button/index.ts +8 -0
  313. package/src/components/header/Header.ts +22 -0
  314. package/src/components/header/header-buttons.tsx +103 -0
  315. package/src/components/header/index.ts +11 -0
  316. package/src/components/header/variants/LargeTitleHeader/index.tsx +390 -0
  317. package/src/components/header/variants/TitleHeader/index.tsx +194 -0
  318. package/src/components/icon/Icon.tsx +74 -0
  319. package/src/components/icon/index.ts +2 -0
  320. package/src/components/icon/utils.tsx +147 -0
  321. package/src/components/index.ts +13 -0
  322. package/src/components/page-indicator/PageIndicator.tsx +100 -0
  323. package/src/components/page-indicator/PageIndicatorRoot.tsx +41 -0
  324. package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +65 -0
  325. package/src/components/page-indicator/hooks/use-page-indicator-core.ts +34 -0
  326. package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +122 -0
  327. package/src/components/page-indicator/index.ts +13 -0
  328. package/src/components/page-indicator/utils.ts +208 -0
  329. package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +70 -0
  330. package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +201 -0
  331. package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +80 -0
  332. package/src/components/page-indicator/variants/DotIndicator/index.tsx +145 -0
  333. package/src/components/page-indicator/variants/DotIndicator/utils.ts +28 -0
  334. package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +107 -0
  335. package/src/components/page-indicator/variants/PillIndicator/index.tsx +149 -0
  336. package/src/components/page-indicator/variants/PillIndicator/utils.ts +63 -0
  337. package/src/components/portal/PortalContext.tsx +27 -0
  338. package/src/components/portal/PortalHost.tsx +20 -0
  339. package/src/components/portal/PortalProvider.tsx +44 -0
  340. package/src/components/portal/index.ts +5 -0
  341. package/src/components/screen/Screen.tsx +163 -0
  342. package/src/components/screen/ScreenContext.tsx +144 -0
  343. package/src/components/screen/ScreenFlatList.tsx +121 -0
  344. package/src/components/screen/ScreenScrollView.tsx +130 -0
  345. package/src/components/screen/index.ts +8 -0
  346. package/src/components/screen/utils.ts +17 -0
  347. package/src/components/slot/Slot.tsx +56 -0
  348. package/src/components/slot/index.ts +8 -0
  349. package/src/components/slot/utils.ts +61 -0
  350. package/src/components/spinner/Spinner.tsx +153 -0
  351. package/src/components/spinner/index.ts +2 -0
  352. package/src/components/surface/Surface.tsx +100 -0
  353. package/src/components/surface/index.ts +2 -0
  354. package/src/components/text/Text.tsx +115 -0
  355. package/src/components/text/index.ts +2 -0
  356. package/src/components/toast/Toast.tsx +477 -0
  357. package/src/components/toast/ToastProvider.tsx +403 -0
  358. package/src/components/toast/index.ts +26 -0
  359. package/src/components/toast/parts/ToastAnimatedItem.tsx +184 -0
  360. package/src/components/toast/types.ts +75 -0
  361. package/src/components/toast/utils/controller.ts +23 -0
  362. package/src/context/ThemeProvider.tsx +97 -0
  363. package/src/context/index.ts +2 -0
  364. package/src/index.tsx +6 -0
  365. package/src/theme/configure.ts +215 -0
  366. package/src/theme/index.ts +72 -0
  367. package/src/theme/runtime.ts +27 -0
  368. package/src/theme/theme.ts +152 -0
  369. package/src/theme/tokens/dark.ts +117 -0
  370. package/src/theme/tokens/light.ts +123 -0
  371. package/src/theme/tokens/primitives.ts +232 -0
  372. package/src/theme/types.ts +384 -0
  373. package/src/types.ts +1 -0
  374. package/src/utils/accent-utils.ts +58 -0
  375. package/src/utils/color-utils.ts +51 -0
  376. package/src/utils/deep-merge.ts +36 -0
  377. package/src/utils/resolve-theme-color.ts +27 -0
  378. package/src/utils/typography.ts +15 -0
  379. package/src/utils/unflatten.ts +36 -0
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet, View } from 'react-native';
4
+ import Animated, { Easing, Extrapolation, interpolate, Keyframe, useAnimatedStyle, withSpring, withTiming } from 'react-native-reanimated';
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export const enteringTop = new Keyframe({
7
+ 0: {
8
+ opacity: 1,
9
+ transform: [{
10
+ translateY: -100
11
+ }]
12
+ },
13
+ 100: {
14
+ opacity: 1,
15
+ transform: [{
16
+ translateY: 0
17
+ }],
18
+ easing: Easing.out(Easing.cubic)
19
+ }
20
+ }).duration(260);
21
+ export const exitingTop = new Keyframe({
22
+ 0: {
23
+ opacity: 1,
24
+ transform: [{
25
+ translateY: 0
26
+ }, {
27
+ scale: 1
28
+ }]
29
+ },
30
+ 100: {
31
+ opacity: 0.5,
32
+ transform: [{
33
+ translateY: -100
34
+ }, {
35
+ scale: 0.97
36
+ }],
37
+ easing: Easing.bezier(0.4, 0, 1, 1)
38
+ }
39
+ }).duration(150);
40
+ export const enteringBottom = new Keyframe({
41
+ 0: {
42
+ opacity: 1,
43
+ transform: [{
44
+ translateY: 100
45
+ }]
46
+ },
47
+ 100: {
48
+ opacity: 1,
49
+ transform: [{
50
+ translateY: 0
51
+ }],
52
+ easing: Easing.out(Easing.cubic)
53
+ }
54
+ }).duration(260);
55
+ export const exitingBottom = new Keyframe({
56
+ 0: {
57
+ opacity: 1,
58
+ transform: [{
59
+ translateY: 0
60
+ }, {
61
+ scale: 1
62
+ }]
63
+ },
64
+ 100: {
65
+ opacity: 0.5,
66
+ transform: [{
67
+ translateY: 100
68
+ }, {
69
+ scale: 0.97
70
+ }],
71
+ easing: Easing.bezier(0.4, 0, 1, 1)
72
+ }
73
+ }).duration(150);
74
+ const opacityValue = [1, 0];
75
+ const opacityTimingConfig = {
76
+ duration: 300
77
+ };
78
+ const translateYValue = [0, 10];
79
+ const translateYTimingConfig = {
80
+ duration: 300
81
+ };
82
+ const scaleValue = [1, 0.97];
83
+ const scaleTimingConfig = {
84
+ duration: 300
85
+ };
86
+ export function ToastAnimatedItem({
87
+ children,
88
+ heights,
89
+ id,
90
+ index,
91
+ maxVisibleToasts,
92
+ placement,
93
+ total
94
+ }) {
95
+ const containerStyle = useAnimatedStyle(() => {
96
+ const heightEntries = Object.entries(heights.value);
97
+ const lastToastId = heightEntries[heightEntries.length - 1]?.[0];
98
+ const lastToastHeight = lastToastId ? heights.value[lastToastId] : undefined;
99
+ const totalValue = total.value;
100
+ const sign = placement === 'top' ? 1 : -1;
101
+ const inputRange = [totalValue - 1, totalValue - 2];
102
+ const opacityInputRange = [totalValue - maxVisibleToasts, totalValue - maxVisibleToasts - 1];
103
+ const opacity = interpolate(index, opacityInputRange, opacityValue);
104
+ const translateY = interpolate(index, inputRange, [translateYValue[0], translateYValue[1] * sign], Extrapolation.CLAMP);
105
+ const scale = interpolate(index, inputRange, scaleValue, {
106
+ extrapolateLeft: Extrapolation.CLAMP
107
+ });
108
+ return {
109
+ height: lastToastHeight ? withSpring(lastToastHeight, {
110
+ damping: 100,
111
+ stiffness: 1200,
112
+ mass: 3
113
+ }) : undefined,
114
+ pointerEvents: opacity === 0 ? 'none' : 'auto',
115
+ opacity: withTiming(opacity, opacityTimingConfig),
116
+ transform: [{
117
+ translateY: withTiming(translateY, translateYTimingConfig)
118
+ }, {
119
+ scale: withTiming(scale, scaleTimingConfig)
120
+ }],
121
+ zIndex: 1000 + index
122
+ };
123
+ });
124
+ return /*#__PURE__*/_jsxs(Animated.View, {
125
+ entering: placement === 'top' ? enteringTop : enteringBottom,
126
+ exiting: placement === 'top' ? exitingTop : exitingBottom,
127
+ pointerEvents: "box-none",
128
+ style: [styles.position, placement === 'top' ? styles.top : styles.bottom],
129
+ children: [/*#__PURE__*/_jsx(Animated.View, {
130
+ style: containerStyle,
131
+ children: children
132
+ }), /*#__PURE__*/_jsx(View, {
133
+ pointerEvents: "none",
134
+ "aria-hidden": true,
135
+ importantForAccessibility: "no-hide-descendants",
136
+ accessibilityElementsHidden: true,
137
+ style: styles.measurement,
138
+ onLayout: event => {
139
+ const measuredHeight = event.nativeEvent.layout.height;
140
+ heights.value = {
141
+ ...heights.value,
142
+ [id]: measuredHeight
143
+ };
144
+ },
145
+ children: process.env.NODE_ENV === 'test' ? null : children
146
+ })]
147
+ });
148
+ }
149
+ const styles = StyleSheet.create({
150
+ position: {
151
+ position: 'absolute',
152
+ left: 0,
153
+ right: 0
154
+ },
155
+ top: {
156
+ top: 0
157
+ },
158
+ bottom: {
159
+ bottom: 0
160
+ },
161
+ measurement: {
162
+ position: 'absolute',
163
+ left: 0,
164
+ right: 0,
165
+ opacity: 0
166
+ }
167
+ });
168
+ //# sourceMappingURL=ToastAnimatedItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","View","Animated","Easing","Extrapolation","interpolate","Keyframe","useAnimatedStyle","withSpring","withTiming","jsx","_jsx","jsxs","_jsxs","enteringTop","opacity","transform","translateY","easing","out","cubic","duration","exitingTop","scale","bezier","enteringBottom","exitingBottom","opacityValue","opacityTimingConfig","translateYValue","translateYTimingConfig","scaleValue","scaleTimingConfig","ToastAnimatedItem","children","heights","id","index","maxVisibleToasts","placement","total","containerStyle","heightEntries","Object","entries","value","lastToastId","length","lastToastHeight","undefined","totalValue","sign","inputRange","opacityInputRange","CLAMP","extrapolateLeft","height","damping","stiffness","mass","pointerEvents","zIndex","entering","exiting","style","styles","position","top","bottom","importantForAccessibility","accessibilityElementsHidden","measurement","onLayout","event","measuredHeight","nativeEvent","layout","process","env","NODE_ENV","create","left","right"],"sourceRoot":"../../../../../src","sources":["components/toast/parts/ToastAnimatedItem.tsx"],"mappings":";;AACA,SAASA,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,OAAOC,QAAQ,IACbC,MAAM,EACNC,aAAa,EACbC,WAAW,EACXC,QAAQ,EAERC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAcjC,OAAO,MAAMC,WAAW,GAAG,IAAIR,QAAQ,CAAC;EACtC,CAAC,EAAE;IACDS,OAAO,EAAE,CAAC;IACVC,SAAS,EAAE,CAAC;MAAEC,UAAU,EAAE,CAAC;IAAI,CAAC;EAClC,CAAC;EACD,GAAG,EAAE;IACHF,OAAO,EAAE,CAAC;IACVC,SAAS,EAAE,CAAC;MAAEC,UAAU,EAAE;IAAE,CAAC,CAAC;IAC9BC,MAAM,EAAEf,MAAM,CAACgB,GAAG,CAAChB,MAAM,CAACiB,KAAK;EACjC;AACF,CAAC,CAAC,CAACC,QAAQ,CAAC,GAAG,CAAC;AAEhB,OAAO,MAAMC,UAAU,GAAG,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ChD;IAAAlC,QAAA,gBAEFvB,IAAA,CAACT,QAAQ,CAACD,IAAI;MAAC+D,KAAK,EAAEvB,cAAe;MAAAP,QAAA,EAAEA;IAAQ,CAAgB,CAAC,eAChEvB,IAAA,CAACV,IAAI;MACH2D,aAAa,EAAC,MAAM;MACpB,mBAAW;MACXS,yBAAyB,EAAC,qBAAqB;MAC/CC,2BAA2B;MAC3BN,KAAK,EAAEC,MAAM,CAACM,WAAY;MAC1BC,QAAQ,EAAGC,KAAK,IAAK;QACnB,MAAMC,cAAc,GAAGD,KAAK,CAACE,WAAW,CAACC,MAAM,CAACpB,MAAM;QACtDrB,OAAO,CAACU,KAAK,GAAG;UACd,GAAGV,OAAO,CAACU,KAAK;UAChB,CAACT,EAAE,GAAGsC;QACR,CAAC;MACH,CAAE;MAAAxC,QAAA,EAED2C,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,GAAG,IAAI,GAAG7C;IAAQ,CAC9C,CAAC;EAAA,CACM,CAAC;AAEpB;AAEA,MAAM+B,MAAM,GAAGjE,UAAU,CAACgF,MAAM,CAAC;EAC/Bd,QAAQ,EAAE;IACRA,QAAQ,EAAE,UAAU;IACpBe,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT,CAAC;EACDf,GAAG,EAAE;IACHA,GAAG,EAAE;EACP,CAAC;EACDC,MAAM,EAAE;IACNA,MAAM,EAAE;EACV,CAAC;EACDG,WAAW,EAAE;IACXL,QAAQ,EAAE,UAAU;IACpBe,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRnE,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/toast/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ let activeManager = null;
4
+ export function setToastManager(manager) {
5
+ activeManager = manager;
6
+ }
7
+ export function showToast(options) {
8
+ if (!activeManager) {
9
+ if (__DEV__) {
10
+ console.warn('[react-native-terra-ui] Toast.show() called before <TerraUIProvider> mounted.');
11
+ }
12
+ return '';
13
+ }
14
+ return activeManager.show(options);
15
+ }
16
+ export function hideToast(id) {
17
+ activeManager?.hide(id);
18
+ }
19
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["activeManager","setToastManager","manager","showToast","options","__DEV__","console","warn","show","hideToast","id","hide"],"sourceRoot":"../../../../../src","sources":["components/toast/utils/controller.ts"],"mappings":";;AAEA,IAAIA,aAAkC,GAAG,IAAI;AAE7C,OAAO,SAASC,eAAeA,CAACC,OAA4B,EAAQ;EAClEF,aAAa,GAAGE,OAAO;AACzB;AAEA,OAAO,SAASC,SAASA,CAACC,OAAyB,EAAW;EAC5D,IAAI,CAACJ,aAAa,EAAE;IAClB,IAAIK,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CACV,+EACF,CAAC;IACH;IACA,OAAO,EAAE;EACX;EACA,OAAOP,aAAa,CAACQ,IAAI,CAACJ,OAAO,CAAC;AACpC;AAEA,OAAO,SAASK,SAASA,CAACC,EAAgC,EAAQ;EAChEV,aAAa,EAAEW,IAAI,CAACD,EAAE,CAAC;AACzB","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ import { createContext, useCallback, useContext, useMemo, useState } from 'react';
4
+ import { useUnistyles } from 'react-native-unistyles';
5
+ import { configureTerraUI, getIsConfigured } from "../theme/configure.js";
6
+ import { applyAccent, applyScheme, getCurrentAccent } from "../theme/runtime.js";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ // Ensure the default theme is registered on first import, unless the app already
9
+ // configured a custom one (e.g. via `react-native-terra-ui/theme` at entry).
10
+ if (!getIsConfigured()) {
11
+ configureTerraUI();
12
+ }
13
+ const ThemeContext = /*#__PURE__*/createContext(null);
14
+
15
+ /**
16
+ * Root provider for Terra UI. Wrap your app once near the root.
17
+ *
18
+ * @example
19
+ * <TerraUIProvider>
20
+ * <RootNavigator />
21
+ * </TerraUIProvider>
22
+ */
23
+ export const TerraUIProvider = ({
24
+ children
25
+ }) => {
26
+ const [accent, setAccentState] = useState(() => getCurrentAccent());
27
+ const setAccent = useCallback(name => {
28
+ applyAccent(name);
29
+ setAccentState(name);
30
+ }, []);
31
+ const value = useMemo(() => ({
32
+ accent,
33
+ setAccent
34
+ }), [accent, setAccent]);
35
+ return /*#__PURE__*/_jsx(ThemeContext.Provider, {
36
+ value: value,
37
+ children: children
38
+ });
39
+ };
40
+ /**
41
+ * Access the active theme and switch scheme / accent / radius.
42
+ * Must be used under {@link TerraUIProvider}.
43
+ */
44
+ export function useTheme() {
45
+ const {
46
+ theme,
47
+ rt
48
+ } = useUnistyles();
49
+ const ctx = useContext(ThemeContext);
50
+ const setScheme = useCallback(scheme => {
51
+ applyScheme(scheme);
52
+ }, []);
53
+ return {
54
+ theme,
55
+ scheme: rt.themeName ?? 'light',
56
+ setScheme,
57
+ accent: ctx?.accent,
58
+ setAccent: ctx?.setAccent ?? noopSetAccent
59
+ };
60
+ }
61
+ const noopSetAccent = _name => {
62
+ if (__DEV__) {
63
+ console.warn('[react-native-terra-ui] setAccent called outside <TerraUIProvider>.');
64
+ }
65
+ };
66
+ //# sourceMappingURL=ThemeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","useCallback","useContext","useMemo","useState","useUnistyles","configureTerraUI","getIsConfigured","applyAccent","applyScheme","getCurrentAccent","jsx","_jsx","ThemeContext","TerraUIProvider","children","accent","setAccentState","setAccent","name","value","Provider","useTheme","theme","rt","ctx","setScheme","scheme","themeName","noopSetAccent","_name","__DEV__","console","warn"],"sourceRoot":"../../../src","sources":["context/ThemeProvider.tsx"],"mappings":";;AAAA,SACEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,QAAQ,QACH,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EN,OAAO;IACLJ,KAAK;IACLI,MAAM,EAAGH,EAAE,CAACI,SAAS,IAAI,OAAkB;IAC3CF,SAAS;IACTV,MAAM,EAAES,GAAG,EAAET,MAAM;IACnBE,SAAS,EAAEO,GAAG,EAAEP,SAAS,IAAIW;EAC/B,CAAC;AACH;AAEA,MAAMA,aAAa,GAAIC,KAAa,IAAW;EAC7C,IAAIC,OAAO,EAAE;IACXC,OAAO,CAACC,IAAI,CACV,qEACF,CAAC;EACH;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { TerraUIProvider, useTheme } from "./ThemeProvider.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TerraUIProvider","useTheme"],"sourceRoot":"../../../src","sources":["context/index.ts"],"mappings":";;AACA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,oBAAiB","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ // biome-ignore-all assist/source/organizeImports: ./context must be first so it
4
+ // configures the default theme before any StyleSheet.create runs.
5
+ export * from "./context/index.js";
6
+ export * from "./components/index.js";
7
+ export * from "./theme/index.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA,cAAc,oBAAW;AAEzB,cAAc,uBAAc;AAC5B,cAAc,kBAAS","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ import { createElement } from 'react';
4
+ import { Image } from 'react-native';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ import { defaultIcons } from '#components/icon/utils';
7
+ import { normalizeAccent } from '#utils/accent-utils';
8
+ import { deepMerge } from '#utils/deep-merge';
9
+ import { buildRadiusScale, defaultDarkTheme, defaultLightTheme } from "./theme.js";
10
+ // ─── Default image component ──────────────────────────────────────────────────
11
+
12
+ const CONTENT_FIT_MAP = {
13
+ cover: 'cover',
14
+ contain: 'contain',
15
+ fill: 'stretch'
16
+ };
17
+ const DefaultImage = ({
18
+ contentFit = 'cover',
19
+ source,
20
+ style,
21
+ accessibilityLabel,
22
+ onError
23
+ }) => /*#__PURE__*/createElement(Image, {
24
+ source,
25
+ style,
26
+ accessibilityLabel,
27
+ resizeMode: CONTENT_FIT_MAP[contentFit],
28
+ onError: onError ? () => onError() : undefined
29
+ });
30
+
31
+ // ─── Radius / elevation defaults ─────────────────────────────────────────────
32
+
33
+ /** Fallback when a component's radius is not configured. */
34
+ const DEFAULT_RADIUS = 'md';
35
+ /** Fallback when the surface elevation is not configured. */
36
+ const DEFAULT_ELEVATION = 'none';
37
+ /** Resolves each component's default radius from the `components` config. */
38
+ const resolveDefaultRadius = components => ({
39
+ button: components?.button?.radius ?? DEFAULT_RADIUS,
40
+ surface: components?.surface?.radius ?? DEFAULT_RADIUS
41
+ });
42
+
43
+ // ─── Unistyles module augmentation ────────────────────────────────────────────
44
+
45
+ const registry = {
46
+ baseLight: defaultLightTheme,
47
+ baseDark: defaultDarkTheme,
48
+ accents: {},
49
+ currentAccent: undefined,
50
+ defaultRadius: resolveDefaultRadius(),
51
+ surfaceElevation: DEFAULT_ELEVATION,
52
+ icons: {},
53
+ imageComponent: DefaultImage,
54
+ configured: false
55
+ };
56
+
57
+ /** @internal */
58
+ export const getRegistry = () => registry;
59
+ export const getIsConfigured = () => registry.configured;
60
+ export const getAccentNames = () => Object.keys(registry.accents);
61
+ export const getImageComponent = () => registry.imageComponent;
62
+ export const getIcon = name => registry.icons[name] ?? defaultIcons[name];
63
+ export const getRequiredIcon = name => registry.icons[name] ?? defaultIcons[name];
64
+
65
+ /**
66
+ * The configured default corner radius for a component (Button, Surface).
67
+ * Set via {@link configureTerraUI}; defaults to `'md'`.
68
+ */
69
+ export const getDefaultRadius = component => registry.defaultRadius[component];
70
+
71
+ /**
72
+ * The configured default drop-shadow depth for Surface (`'none'` = no shadow).
73
+ * Set via {@link configureTerraUI}; defaults to `'none'`.
74
+ */
75
+ export const getSurfaceElevation = () => registry.surfaceElevation;
76
+
77
+ /** Resolves a scheme's theme = base ⊕ the named accent's partial override. */
78
+ export function resolveTheme(scheme, accentName) {
79
+ const base = scheme === 'light' ? registry.baseLight : registry.baseDark;
80
+ const accent = accentName ? registry.accents[accentName] : undefined;
81
+ return deepMerge(base, accent ? accent[scheme] : undefined);
82
+ }
83
+ const mergeThemeOverride = (theme, override) => {
84
+ if (!override) return theme;
85
+ const {
86
+ radius,
87
+ ...rest
88
+ } = override;
89
+ let next = deepMerge(theme, rest);
90
+ if (radius) {
91
+ const {
92
+ base,
93
+ ...radiusTokens
94
+ } = radius;
95
+ if (base != null) {
96
+ next = deepMerge(next, {
97
+ radius: buildRadiusScale(base)
98
+ });
99
+ }
100
+ next = deepMerge(next, {
101
+ radius: radiusTokens
102
+ });
103
+ }
104
+ return next;
105
+ };
106
+
107
+ /**
108
+ * Configure Terra UI's themes. Call ONCE, as early as possible — before any
109
+ * component renders (e.g. top of the app entry, imported from
110
+ * `react-native-terra-ui/theme`). With no arguments it registers the default
111
+ * theme; `<TerraUIProvider>` calls it for you if you haven't.
112
+ */
113
+ export function configureTerraUI(config = {}) {
114
+ if (registry.configured) {
115
+ if (__DEV__ && Object.keys(config).length > 0) {
116
+ console.warn('[react-native-terra-ui] configureTerraUI() was called more than once; the later call was ignored.');
117
+ }
118
+ return;
119
+ }
120
+ registry.configured = true;
121
+ registry.baseLight = mergeThemeOverride(mergeThemeOverride(defaultLightTheme, config.shared), config.schemes?.light);
122
+ registry.baseDark = mergeThemeOverride(mergeThemeOverride(defaultDarkTheme, config.shared), config.schemes?.dark);
123
+ registry.defaultRadius = resolveDefaultRadius(config.components);
124
+ registry.surfaceElevation = config.components?.surface?.elevation ?? DEFAULT_ELEVATION;
125
+ registry.icons = config.icons ?? {};
126
+ registry.imageComponent = config.image ?? DefaultImage;
127
+ registry.accents = {};
128
+ for (const [name, accent] of Object.entries(config.accents ?? {})) {
129
+ registry.accents[name] = normalizeAccent(accent);
130
+ }
131
+ const {
132
+ defaultAccent
133
+ } = config;
134
+ registry.currentAccent = defaultAccent && registry.accents[defaultAccent] ? defaultAccent : undefined;
135
+ const themes = {
136
+ light: resolveTheme('light', registry.currentAccent),
137
+ dark: resolveTheme('dark', registry.currentAccent)
138
+ };
139
+ const adaptive = config.adaptiveThemes ?? true;
140
+ const settings = config.initialScheme ? {
141
+ initialTheme: config.initialScheme
142
+ } : adaptive ? {
143
+ adaptiveThemes: true
144
+ } : {
145
+ initialTheme: 'light'
146
+ };
147
+ StyleSheet.configure({
148
+ themes,
149
+ settings
150
+ });
151
+ }
152
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createElement","Image","StyleSheet","defaultIcons","normalizeAccent","deepMerge","buildRadiusScale","defaultDarkTheme","defaultLightTheme","CONTENT_FIT_MAP","cover","contain","fill","DefaultImage","contentFit","source","style","accessibilityLabel","onError","resizeMode","undefined","DEFAULT_RADIUS","DEFAULT_ELEVATION","resolveDefaultRadius","components","button","radius","surface","registry","baseLight","baseDark","accents","currentAccent","defaultRadius","surfaceElevation","icons","imageComponent","configured","getRegistry","getIsConfigured","getAccentNames","Object","keys","getImageComponent","getIcon","name","getRequiredIcon","getDefaultRadius","component","getSurfaceElevation","resolveTheme","scheme","accentName","base","accent","mergeThemeOverride","theme","override","rest","next","radiusTokens","configureTerraUI","config","__DEV__","length","console","warn","shared","schemes","light","dark","elevation","image","entries","defaultAccent","themes","adaptive","adaptiveThemes","settings","initialScheme","initialTheme","configure"],"sourceRoot":"../../../src","sources":["theme/configure.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,OAAO;AACrC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,SAAS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IAAI,CAAC,CAAC;EACnCP,QAAQ,CAACQ,cAAc,GAAG0B,MAAM,CAACU,KAAK,IAAI3D,YAAY;EAEtDe,QAAQ,CAACG,OAAO,GAAG,CAAC,CAAC;EACrB,KAAK,MAAM,CAACc,IAAI,EAAES,MAAM,CAAC,IAAIb,MAAM,CAACgC,OAAO,CAACX,MAAM,CAAC/B,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE;IACjEH,QAAQ,CAACG,OAAO,CAACc,IAAI,CAAC,GAAGzC,eAAe,CAACkD,MAAM,CAAC;EAClD;EACA,MAAM;IAAEoB;EAAc,CAAC,GAAGZ,MAAM;EAChClC,QAAQ,CAACI,aAAa,GACpB0C,aAAa,IAAI9C,QAAQ,CAACG,OAAO,CAAC2C,aAAa,CAAC,GAC5CA,aAAa,GACbtD,SAAS;EAEf,MAAMuD,MAAM,GAAG;IACbN,KAAK,EAAEnB,YAAY,CAAC,OAAO,EAAEtB,QAAQ,CAACI,aAAa,CAAC;IACpDsC,IAAI,EAAEpB,YAAY,CAAC,MAAM,EAAEtB,QAAQ,CAACI,aAAa;EACnD,CAAC;EAED,MAAM4C,QAAQ,GAAGd,MAAM,CAACe,cAAc,IAAI,IAAI;EAC9C,MAAMC,QAAQ,GAAGhB,MAAM,CAACiB,aAAa,GACjC;IAAEC,YAAY,EAAElB,MAAM,CAACiB;EAAc,CAAC,GACtCH,QAAQ,GACN;IAAEC,cAAc,EAAE;EAAc,CAAC,GACjC;IAAEG,YAAY,EAAE;EAAiB,CAAC;EAExC9E,UAAU,CAAC+E,SAAS,CAAC;IAAEN,MAAM;IAAEG;EAAS,CAAC,CAAC;AAC5C","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ // Public theme API for `react-native-terra-ui` / `react-native-terra-ui/theme`.
4
+ //
5
+ // Token DATA lives in ./tokens/*.ts (flat, Figma-style, untyped); TYPES live in
6
+ // ./types; pure helpers live in #/utils. Raw primitive data (palette, spacing,
7
+ // radius, elevation scales, typography) is intentionally NOT re-exported — the
8
+ // resolved `defaultLightTheme` / `defaultDarkTheme` are the public surface.
9
+
10
+ // ─── Utilities (color resolution + accent/merge/typography helpers) ──────────
11
+ export { normalizeAccent } from '#utils/accent-utils';
12
+ export { readableOn, shade, withAlpha } from '#utils/color-utils';
13
+ export { deepMerge } from '#utils/deep-merge';
14
+ export { resolveThemeColor } from '#utils/resolve-theme-color';
15
+ export { FONT_WEIGHT_VALUE, SYSTEM_FONT } from '#utils/typography';
16
+ // ─── Config + runtime ───────────────────────────────────────────────────────
17
+ export { configureTerraUI, getAccentNames, getDefaultRadius, getIcon, getImageComponent, getIsConfigured, getRequiredIcon, getSurfaceElevation, resolveTheme } from "./configure.js";
18
+ export { applyAccent, applyScheme, getCurrentAccent } from "./runtime.js";
19
+ // ─── Default themes ───────────────────────────────────────────────────────────
20
+ export { defaultDarkTheme, defaultLightTheme } from "./theme.js";
21
+ // ─── Types ────────────────────────────────────────────────────────────────────
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeAccent","readableOn","shade","withAlpha","deepMerge","resolveThemeColor","FONT_WEIGHT_VALUE","SYSTEM_FONT","configureTerraUI","getAccentNames","getDefaultRadius","getIcon","getImageComponent","getIsConfigured","getRequiredIcon","getSurfaceElevation","resolveTheme","applyAccent","applyScheme","getCurrentAccent","defaultDarkTheme","defaultLightTheme"],"sourceRoot":"../../../src","sources":["theme/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,eAAe,QAAQ,qBAAqB;AACrD,SAASC,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,oBAAoB;AAEjE,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,iBAAiB,EAAEC,WAAW,QAAQ,mBAAmB;AAClE;AACA,SACEC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,OAAO,EACPC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,mBAAmB,EACnBC,YAAY,QACP,gBAAa;AACpB,SAASC,WAAW,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,cAAW;AACtE;AACA,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,YAAS;AAC7D","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ import { UnistylesRuntime } from 'react-native-unistyles';
4
+ import { getRegistry, resolveTheme } from "./configure.js";
5
+ /** Apply a named accent at runtime by updating both registered themes. */
6
+ export function applyAccent(name) {
7
+ const registry = getRegistry();
8
+ if (!registry.accents[name]) {
9
+ if (__DEV__) {
10
+ console.warn(`[react-native-terra-ui] Unknown accent "${name}".`);
11
+ }
12
+ return;
13
+ }
14
+ registry.currentAccent = name;
15
+ UnistylesRuntime.updateTheme('light', () => resolveTheme('light', name));
16
+ UnistylesRuntime.updateTheme('dark', () => resolveTheme('dark', name));
17
+ }
18
+ export const getCurrentAccent = () => getRegistry().currentAccent;
19
+
20
+ /** Switch the active color scheme, disabling adaptive (system) theming. */
21
+ export function applyScheme(scheme) {
22
+ UnistylesRuntime.setAdaptiveThemes(false);
23
+ UnistylesRuntime.setTheme(scheme);
24
+ }
25
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesRuntime","getRegistry","resolveTheme","applyAccent","name","registry","accents","__DEV__","console","warn","currentAccent","updateTheme","getCurrentAccent","applyScheme","scheme","setAdaptiveThemes","setTheme"],"sourceRoot":"../../../src","sources":["theme/runtime.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,wBAAwB;AAEzD,SAASC,WAAW,EAAEC,YAAY,QAAQ,gBAAa;AAGvD;AACA,OAAO,SAASC,WAAWA,CAACC,IAAY,EAAQ;EAC9C,MAAMC,QAAQ,GAAGJ,WAAW,CAAC,CAAC;EAC9B,IAAI,CAACI,QAAQ,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE;IAC3B,IAAIG,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CAAC,2CAA2CL,IAAI,IAAI,CAAC;IACnE;IACA;EACF;EACAC,QAAQ,CAACK,aAAa,GAAGN,IAAI;EAC7BJ,gBAAgB,CAACW,WAAW,CAAC,OAAO,EAAE,MAAMT,YAAY,CAAC,OAAO,EAAEE,IAAI,CAAC,CAAC;EACxEJ,gBAAgB,CAACW,WAAW,CAAC,MAAM,EAAE,MAAMT,YAAY,CAAC,MAAM,EAAEE,IAAI,CAAC,CAAC;AACxE;AAEA,OAAO,MAAMQ,gBAAgB,GAAGA,CAAA,KAC9BX,WAAW,CAAC,CAAC,CAACS,aAAa;;AAE7B;AACA,OAAO,SAASG,WAAWA,CAACC,MAAc,EAAQ;EAChDd,gBAAgB,CAACe,iBAAiB,CAAC,KAAK,CAAC;EACzCf,gBAAgB,CAACgB,QAAQ,CAACF,MAAM,CAAC;AACnC","ignoreList":[]}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ import { unflatten } from '#utils/unflatten';
4
+ import { dark } from "./tokens/dark.js";
5
+ import { light } from "./tokens/light.js";
6
+ import { primitives } from "./tokens/primitives.js";
7
+ /**
8
+ * Resolves {palette.key} reference notation against a source flat-token map.
9
+ * Non-reference values pass through unchanged.
10
+ */
11
+ function resolveRefs(flat, source) {
12
+ const out = {};
13
+ for (const [k, v] of Object.entries(flat)) {
14
+ out[k] = typeof v === 'string' && v.startsWith('{') && v.endsWith('}') ? source[v.slice(1, -1)] ?? v : v;
15
+ }
16
+ return out;
17
+ }
18
+
19
+ /**
20
+ * Splits a flat dotted-key token map into a one-level-deep object keyed by
21
+ * the first path segment (the category). The category prefix is stripped from
22
+ * each key, leaving a flat map per category.
23
+ *
24
+ * Example:
25
+ * { 'color.surface.default': '#fff', 'color.action.bg.primary': '#009966' }
26
+ * → { color: { 'surface.default': '#fff', 'action.bg.primary': '#009966' } }
27
+ */
28
+ function flattenByCategory(tokens) {
29
+ const out = {};
30
+ for (const [key, value] of Object.entries(tokens)) {
31
+ const sep = key.indexOf('.');
32
+ const cat = sep === -1 ? key : key.slice(0, sep);
33
+ const rest = sep === -1 ? '' : key.slice(sep + 1);
34
+ if (out[cat] === undefined) {
35
+ out[cat] = {};
36
+ }
37
+ out[cat][rest] = value;
38
+ }
39
+ return out;
40
+ }
41
+
42
+ /**
43
+ * Scheme-agnostic primitives, rebuilt once from the flat token data. Shared by
44
+ * both default themes (matching the previous behavior where spacing / radius /
45
+ * typography were singleton constants). `palette` is present at runtime for
46
+ * Figma parity but is not part of {@link TerraTheme}. Only the radius BASE is
47
+ * authored here (`radius.base`); the full scale is derived via
48
+ * {@link buildRadiusScale}.
49
+ */
50
+ const prim = unflatten(primitives);
51
+
52
+ /**
53
+ * Default base corner radius (dp) — the `lg` (×1) step — taken from the
54
+ * `radius.base` primitive. The rest of the scale is derived from it via
55
+ * {@link RADIUS_MULTIPLIERS}; override at runtime with
56
+ * `configureTerraUI({ shared: { radius: { base } } })`, or change the
57
+ * `radius.base` token.
58
+ */
59
+ export const DEFAULT_RADIUS_BASE = prim.radius.base;
60
+
61
+ /**
62
+ * Per-token multipliers applied to the base radius (DaisyUI-style). `none` (0)
63
+ * and `full` (9999) are fixed and not scaled.
64
+ */
65
+ export const RADIUS_MULTIPLIERS = {
66
+ xs: 0.25,
67
+ sm: 0.5,
68
+ md: 0.75,
69
+ lg: 1,
70
+ xl: 1.5,
71
+ '2xl': 2,
72
+ '3xl': 3
73
+ };
74
+
75
+ /**
76
+ * Builds the full radius scale from a single base value. Derived steps keep
77
+ * their exact (possibly fractional) dp; `none`/`full` are constant.
78
+ */
79
+ export function buildRadiusScale(base = DEFAULT_RADIUS_BASE) {
80
+ const scale = {
81
+ none: 0,
82
+ full: 9999
83
+ };
84
+ for (const key of Object.keys(RADIUS_MULTIPLIERS)) {
85
+ scale[key] = base * RADIUS_MULTIPLIERS[key];
86
+ }
87
+ return scale;
88
+ }
89
+ const defaultRadius = buildRadiusScale();
90
+ const lightByCategory = flattenByCategory(resolveRefs(light, primitives));
91
+ const darkByCategory = flattenByCategory(resolveRefs(dark, primitives));
92
+
93
+ // color: flat map — accessed as theme.color['action.bg.primary.hover']
94
+ // elevation: re-unflattened for structured access — theme.elevation.sm.shadowRadius
95
+ const lightTokens = {
96
+ color: lightByCategory.color,
97
+ elevation: unflatten(lightByCategory.elevation ?? {})
98
+ };
99
+ const darkTokens = {
100
+ color: darkByCategory.color,
101
+ elevation: unflatten(darkByCategory.elevation ?? {})
102
+ };
103
+ export const defaultLightTheme = {
104
+ color: lightTokens.color,
105
+ elevation: lightTokens.elevation,
106
+ spacing: prim.spacing,
107
+ radius: defaultRadius,
108
+ typography: prim.typography,
109
+ opacity: prim.opacity,
110
+ layout: prim.layout
111
+ };
112
+ export const defaultDarkTheme = {
113
+ color: darkTokens.color,
114
+ elevation: darkTokens.elevation,
115
+ spacing: prim.spacing,
116
+ radius: defaultRadius,
117
+ typography: prim.typography,
118
+ opacity: prim.opacity,
119
+ layout: prim.layout
120
+ };
121
+ //# sourceMappingURL=theme.js.map