react-native-terra-ui 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/lib/module/components/avatar/Avatar.js +118 -35
  3. package/lib/module/components/avatar/Avatar.js.map +1 -1
  4. package/lib/module/components/box/Box.js +15 -2
  5. package/lib/module/components/box/Box.js.map +1 -1
  6. package/lib/module/components/box/utils.js +4 -1
  7. package/lib/module/components/box/utils.js.map +1 -1
  8. package/lib/module/components/button/Button.js +7 -14
  9. package/lib/module/components/button/Button.js.map +1 -1
  10. package/lib/module/components/chip/Chip.js +372 -0
  11. package/lib/module/components/chip/Chip.js.map +1 -0
  12. package/lib/module/components/chip/index.js +4 -0
  13. package/lib/module/components/chip/index.js.map +1 -0
  14. package/lib/module/components/chip/types.js +2 -0
  15. package/lib/module/components/chip/types.js.map +1 -0
  16. package/lib/module/components/chip/utils.js +36 -0
  17. package/lib/module/components/chip/utils.js.map +1 -0
  18. package/lib/module/components/empty-state/EmptyState.js +200 -0
  19. package/lib/module/components/empty-state/EmptyState.js.map +1 -0
  20. package/lib/module/components/empty-state/index.js +4 -0
  21. package/lib/module/components/empty-state/index.js.map +1 -0
  22. package/lib/module/components/empty-state/types.js +2 -0
  23. package/lib/module/components/empty-state/types.js.map +1 -0
  24. package/lib/module/components/header/header-buttons.js +31 -36
  25. package/lib/module/components/header/header-buttons.js.map +1 -1
  26. package/lib/module/components/header/index.js +1 -1
  27. package/lib/module/components/header/index.js.map +1 -1
  28. package/lib/module/components/header/parts/HeaderGradientOverlay.js +38 -0
  29. package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -0
  30. package/lib/module/components/header/variants/LargeTitleHeader/index.js +69 -99
  31. package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
  32. package/lib/module/components/header/variants/TitleHeader/index.js +32 -63
  33. package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
  34. package/lib/module/components/icon/Icon.js +20 -8
  35. package/lib/module/components/icon/Icon.js.map +1 -1
  36. package/lib/module/components/image/Image.js +54 -0
  37. package/lib/module/components/image/Image.js.map +1 -0
  38. package/lib/module/components/image/index.js +4 -0
  39. package/lib/module/components/image/index.js.map +1 -0
  40. package/lib/module/components/image/types.js +4 -0
  41. package/lib/module/components/image/types.js.map +1 -0
  42. package/lib/module/components/index.js +4 -0
  43. package/lib/module/components/index.js.map +1 -1
  44. package/lib/module/components/portal/Portal.js +42 -0
  45. package/lib/module/components/portal/Portal.js.map +1 -0
  46. package/lib/module/components/portal/PortalContext.js +1 -16
  47. package/lib/module/components/portal/PortalContext.js.map +1 -1
  48. package/lib/module/components/portal/PortalHost.js +16 -14
  49. package/lib/module/components/portal/PortalHost.js.map +1 -1
  50. package/lib/module/components/portal/PortalProvider.js +51 -19
  51. package/lib/module/components/portal/PortalProvider.js.map +1 -1
  52. package/lib/module/components/portal/index.js +1 -1
  53. package/lib/module/components/portal/index.js.map +1 -1
  54. package/lib/module/components/screen/Screen.js +25 -28
  55. package/lib/module/components/screen/Screen.js.map +1 -1
  56. package/lib/module/components/screen/ScreenContext.js +7 -5
  57. package/lib/module/components/screen/ScreenContext.js.map +1 -1
  58. package/lib/module/components/screen/ScreenFlashList.js +144 -0
  59. package/lib/module/components/screen/ScreenFlashList.js.map +1 -0
  60. package/lib/module/components/screen/ScreenFlatList.js +88 -27
  61. package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
  62. package/lib/module/components/screen/ScreenScrollView.js +101 -34
  63. package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
  64. package/lib/module/components/screen/index.js +1 -0
  65. package/lib/module/components/screen/index.js.map +1 -1
  66. package/lib/module/components/screen/parts/BottomSafeArea.js +62 -0
  67. package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -0
  68. package/lib/module/components/screen/parts/ScreenPlaceholder.js +50 -0
  69. package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -0
  70. package/lib/module/components/screen/types.js +4 -0
  71. package/lib/module/components/screen/types.js.map +1 -0
  72. package/lib/module/components/screen/utils.js +12 -9
  73. package/lib/module/components/screen/utils.js.map +1 -1
  74. package/lib/module/components/surface/Surface.js +16 -9
  75. package/lib/module/components/surface/Surface.js.map +1 -1
  76. package/lib/module/components/text/Text.js +23 -5
  77. package/lib/module/components/text/Text.js.map +1 -1
  78. package/lib/module/components/toast/Toast.js +8 -8
  79. package/lib/module/components/toast/Toast.js.map +1 -1
  80. package/lib/module/components/toolbar/Toolbar.js +268 -0
  81. package/lib/module/components/toolbar/Toolbar.js.map +1 -0
  82. package/lib/module/components/toolbar/index.js +4 -0
  83. package/lib/module/components/toolbar/index.js.map +1 -0
  84. package/lib/module/context/ThemeProvider.js +5 -2
  85. package/lib/module/context/ThemeProvider.js.map +1 -1
  86. package/lib/module/{components/icon/utils.js → theme/defaults/icons.js} +1 -1
  87. package/lib/module/theme/defaults/icons.js.map +1 -0
  88. package/lib/module/theme/defaults/image.js +30 -0
  89. package/lib/module/theme/defaults/image.js.map +1 -0
  90. package/lib/module/theme/index.js +1 -1
  91. package/lib/module/theme/{configure.js → registry.js} +21 -28
  92. package/lib/module/theme/registry.js.map +1 -0
  93. package/lib/module/theme/runtime.js +1 -1
  94. package/lib/module/theme/theme.js +91 -10
  95. package/lib/module/theme/theme.js.map +1 -1
  96. package/lib/module/theme/tokens/dark.js +59 -68
  97. package/lib/module/theme/tokens/dark.js.map +1 -1
  98. package/lib/module/theme/tokens/light.js +49 -67
  99. package/lib/module/theme/tokens/light.js.map +1 -1
  100. package/lib/module/theme/tokens/primitives.js +241 -20
  101. package/lib/module/theme/tokens/primitives.js.map +1 -1
  102. package/lib/module/utils/accent-utils.js +4 -4
  103. package/lib/module/utils/accent-utils.js.map +1 -1
  104. package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
  105. package/lib/typescript/src/components/avatar/types.d.ts +4 -4
  106. package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
  107. package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
  108. package/lib/typescript/src/components/box/utils.d.ts +6 -1
  109. package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
  110. package/lib/typescript/src/components/button/Button.d.ts +1 -1
  111. package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
  112. package/lib/typescript/src/components/chip/Chip.d.ts +24 -0
  113. package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -0
  114. package/lib/typescript/src/components/chip/index.d.ts +4 -0
  115. package/lib/typescript/src/components/chip/index.d.ts.map +1 -0
  116. package/lib/typescript/src/components/chip/types.d.ts +8 -0
  117. package/lib/typescript/src/components/chip/types.d.ts.map +1 -0
  118. package/lib/typescript/src/components/chip/utils.d.ts +8 -0
  119. package/lib/typescript/src/components/chip/utils.d.ts.map +1 -0
  120. package/lib/typescript/src/components/empty-state/EmptyState.d.ts +45 -0
  121. package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -0
  122. package/lib/typescript/src/components/empty-state/index.d.ts +4 -0
  123. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -0
  124. package/lib/typescript/src/components/empty-state/types.d.ts +6 -0
  125. package/lib/typescript/src/components/empty-state/types.d.ts.map +1 -0
  126. package/lib/typescript/src/components/header/header-buttons.d.ts +27 -0
  127. package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
  128. package/lib/typescript/src/components/header/index.d.ts +1 -1
  129. package/lib/typescript/src/components/header/index.d.ts.map +1 -1
  130. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts +7 -0
  131. package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -0
  132. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
  133. package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
  134. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +18 -7
  135. package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
  136. package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
  137. package/lib/typescript/src/components/image/Image.d.ts +16 -0
  138. package/lib/typescript/src/components/image/Image.d.ts.map +1 -0
  139. package/lib/typescript/src/components/image/index.d.ts +3 -0
  140. package/lib/typescript/src/components/image/index.d.ts.map +1 -0
  141. package/lib/typescript/src/components/image/types.d.ts +7 -0
  142. package/lib/typescript/src/components/image/types.d.ts.map +1 -0
  143. package/lib/typescript/src/components/index.d.ts +4 -0
  144. package/lib/typescript/src/components/index.d.ts.map +1 -1
  145. package/lib/typescript/src/components/portal/Portal.d.ts +26 -0
  146. package/lib/typescript/src/components/portal/Portal.d.ts.map +1 -0
  147. package/lib/typescript/src/components/portal/PortalContext.d.ts +11 -14
  148. package/lib/typescript/src/components/portal/PortalContext.d.ts.map +1 -1
  149. package/lib/typescript/src/components/portal/PortalHost.d.ts +9 -4
  150. package/lib/typescript/src/components/portal/PortalHost.d.ts.map +1 -1
  151. package/lib/typescript/src/components/portal/PortalProvider.d.ts +3 -3
  152. package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
  153. package/lib/typescript/src/components/portal/index.d.ts +4 -2
  154. package/lib/typescript/src/components/portal/index.d.ts.map +1 -1
  155. package/lib/typescript/src/components/screen/Screen.d.ts +18 -13
  156. package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
  157. package/lib/typescript/src/components/screen/ScreenContext.d.ts +12 -9
  158. package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
  159. package/lib/typescript/src/components/screen/ScreenFlashList.d.ts +43 -0
  160. package/lib/typescript/src/components/screen/ScreenFlashList.d.ts.map +1 -0
  161. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +17 -7
  162. package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
  163. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +51 -16
  164. package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
  165. package/lib/typescript/src/components/screen/index.d.ts +3 -0
  166. package/lib/typescript/src/components/screen/index.d.ts.map +1 -1
  167. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts +30 -0
  168. package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -0
  169. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +22 -0
  170. package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -0
  171. package/lib/typescript/src/components/screen/types.d.ts +42 -0
  172. package/lib/typescript/src/components/screen/types.d.ts.map +1 -0
  173. package/lib/typescript/src/components/screen/utils.d.ts +9 -9
  174. package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
  175. package/lib/typescript/src/components/surface/Surface.d.ts +7 -0
  176. package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
  177. package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
  178. package/lib/typescript/src/components/toolbar/Toolbar.d.ts +115 -0
  179. package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -0
  180. package/lib/typescript/src/components/toolbar/index.d.ts +3 -0
  181. package/lib/typescript/src/components/toolbar/index.d.ts.map +1 -0
  182. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  183. package/lib/typescript/src/{components/icon/utils.d.ts → theme/defaults/icons.d.ts} +2 -2
  184. package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -0
  185. package/lib/typescript/src/theme/defaults/image.d.ts +4 -0
  186. package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -0
  187. package/lib/typescript/src/theme/index.d.ts +1 -1
  188. package/lib/typescript/src/theme/index.d.ts.map +1 -1
  189. package/lib/typescript/src/theme/{configure.d.ts → registry.d.ts} +1 -1
  190. package/lib/typescript/src/theme/registry.d.ts.map +1 -0
  191. package/lib/typescript/src/theme/theme.d.ts +21 -1
  192. package/lib/typescript/src/theme/theme.d.ts.map +1 -1
  193. package/lib/typescript/src/theme/tokens/dark.d.ts +41 -64
  194. package/lib/typescript/src/theme/tokens/dark.d.ts.map +1 -1
  195. package/lib/typescript/src/theme/tokens/light.d.ts +44 -65
  196. package/lib/typescript/src/theme/tokens/light.d.ts.map +1 -1
  197. package/lib/typescript/src/theme/tokens/primitives.d.ts +228 -17
  198. package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
  199. package/lib/typescript/src/theme/types.d.ts +65 -35
  200. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  201. package/package.json +24 -12
  202. package/skills/terra-ui/SKILL.md +193 -0
  203. package/skills/terra-ui/references/recipes.md +198 -0
  204. package/skills/terra-ui/references/troubleshooting.md +112 -0
  205. package/src/components/avatar/Avatar.tsx +128 -38
  206. package/src/components/avatar/types.ts +5 -5
  207. package/src/components/box/Box.tsx +13 -1
  208. package/src/components/box/utils.ts +10 -0
  209. package/src/components/button/Button.tsx +7 -15
  210. package/src/components/chip/Chip.tsx +444 -0
  211. package/src/components/chip/index.ts +3 -0
  212. package/src/components/chip/types.ts +15 -0
  213. package/src/components/chip/utils.ts +34 -0
  214. package/src/components/empty-state/EmptyState.tsx +209 -0
  215. package/src/components/empty-state/index.ts +3 -0
  216. package/src/components/empty-state/types.ts +5 -0
  217. package/src/components/header/header-buttons.tsx +33 -45
  218. package/src/components/header/index.ts +2 -0
  219. package/src/components/header/parts/HeaderGradientOverlay.tsx +29 -0
  220. package/src/components/header/variants/LargeTitleHeader/index.tsx +68 -102
  221. package/src/components/header/variants/TitleHeader/index.tsx +47 -56
  222. package/src/components/icon/Icon.tsx +20 -15
  223. package/src/components/image/Image.tsx +48 -0
  224. package/src/components/image/index.ts +2 -0
  225. package/src/components/image/types.ts +7 -0
  226. package/src/components/index.ts +4 -0
  227. package/src/components/portal/Portal.tsx +55 -0
  228. package/src/components/portal/PortalContext.tsx +14 -22
  229. package/src/components/portal/PortalHost.tsx +17 -10
  230. package/src/components/portal/PortalProvider.tsx +58 -21
  231. package/src/components/portal/index.ts +4 -2
  232. package/src/components/screen/Screen.tsx +45 -59
  233. package/src/components/screen/ScreenContext.tsx +19 -12
  234. package/src/components/screen/ScreenFlashList.tsx +196 -0
  235. package/src/components/screen/ScreenFlatList.tsx +100 -39
  236. package/src/components/screen/ScreenScrollView.tsx +114 -53
  237. package/src/components/screen/index.ts +3 -0
  238. package/src/components/screen/parts/BottomSafeArea.tsx +60 -0
  239. package/src/components/screen/parts/ScreenPlaceholder.tsx +55 -0
  240. package/src/components/screen/types.ts +43 -0
  241. package/src/components/screen/utils.ts +29 -15
  242. package/src/components/surface/Surface.tsx +17 -20
  243. package/src/components/text/Text.tsx +23 -5
  244. package/src/components/toast/Toast.tsx +8 -8
  245. package/src/components/toolbar/Toolbar.tsx +353 -0
  246. package/src/components/toolbar/index.ts +6 -0
  247. package/src/context/ThemeProvider.tsx +5 -4
  248. package/src/{components/icon/utils.tsx → theme/defaults/icons.tsx} +1 -1
  249. package/src/theme/defaults/image.tsx +34 -0
  250. package/src/theme/index.ts +1 -1
  251. package/src/theme/{configure.ts → registry.ts} +19 -34
  252. package/src/theme/runtime.ts +1 -1
  253. package/src/theme/theme.ts +127 -13
  254. package/src/theme/tokens/dark.ts +60 -69
  255. package/src/theme/tokens/light.ts +50 -68
  256. package/src/theme/tokens/primitives.ts +248 -20
  257. package/src/theme/types.ts +67 -35
  258. package/src/utils/accent-utils.ts +4 -4
  259. package/lib/module/components/icon/utils.js.map +0 -1
  260. package/lib/module/theme/configure.js.map +0 -1
  261. package/lib/typescript/src/components/icon/utils.d.ts.map +0 -1
  262. package/lib/typescript/src/theme/configure.d.ts.map +0 -1
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import { useId } from 'react';
4
3
  import { Text, View } from 'react-native';
5
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
- import Svg, { Defs, Rect, Stop, LinearGradient as SvgLinearGradient } from 'react-native-svg';
7
4
  import { StyleSheet, useUnistyles } from 'react-native-unistyles';
8
5
  import { resolveThemeColor } from "../../../../utils/resolve-theme-color.js";
9
6
  import { FONT_WEIGHT_VALUE } from "../../../../utils/typography.js";
7
+ import { Toolbar } from "../../../toolbar/index.js";
10
8
  import { HeaderDismissButton } from "../../header-buttons.js";
9
+ import { HeaderGradientOverlay } from "../../parts/HeaderGradientOverlay.js";
11
10
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
12
11
  /**
13
12
  * Compact title bar (leading slot · title · trailing slot) with a top safe-area
@@ -17,14 +16,19 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
17
16
  * @example
18
17
  * ```tsx
19
18
  * <Screen.Header>
20
- * <Header.Title title="Stats" RightComponent={<Button>Edit</Button>} />
19
+ * <Header.Title
20
+ * title="Stats"
21
+ * RightToolbar={
22
+ * <Toolbar.Button icon="add" accessibilityLabel="Add" onPress={add} />
23
+ * }
24
+ * />
21
25
  * </Screen.Header>
22
26
  * ```
23
27
  */
24
28
  export function TitleHeader({
25
29
  title,
26
- LeftComponent,
27
- RightComponent,
30
+ LeftToolbar,
31
+ RightToolbar,
28
32
  dismissAction = 'none',
29
33
  navigation,
30
34
  onDismiss,
@@ -34,11 +38,7 @@ export function TitleHeader({
34
38
  const {
35
39
  theme
36
40
  } = useUnistyles();
37
- const {
38
- top
39
- } = useSafeAreaInsets();
40
- const gradientId = useId();
41
- const bgColor = resolveThemeColor(bg, theme);
41
+ const bgColor = resolveThemeColor(bg, theme) ?? theme.color['surface.default'] ?? '';
42
42
  const isTransparent = bgColor === 'transparent';
43
43
  const gradientColor = isTransparent ? theme.color['surface.default'] : bgColor;
44
44
  styles.useVariants({
@@ -49,55 +49,28 @@ export function TitleHeader({
49
49
  dismissAction: dismissAction,
50
50
  navigation: navigation,
51
51
  onDismiss: onDismiss
52
- }), LeftComponent]
53
- }) : LeftComponent;
52
+ }), LeftToolbar]
53
+ }) : LeftToolbar;
54
54
  const trailing = dismissAction === 'close' ? /*#__PURE__*/_jsxs(_Fragment, {
55
- children: [RightComponent, /*#__PURE__*/_jsx(HeaderDismissButton, {
55
+ children: [RightToolbar, /*#__PURE__*/_jsx(HeaderDismissButton, {
56
56
  dismissAction: dismissAction,
57
57
  navigation: navigation,
58
58
  onDismiss: onDismiss
59
59
  })]
60
- }) : RightComponent;
60
+ }) : RightToolbar;
61
61
  return /*#__PURE__*/_jsxs(View, {
62
- style: styles.safeArea,
62
+ style: styles.container,
63
63
  children: [/*#__PURE__*/_jsx(View, {
64
- style: {
65
- height: top,
66
- backgroundColor: isTransparent ? 'transparent' : bgColor
67
- }
64
+ style: styles.safeArea(isTransparent, bgColor)
68
65
  }), /*#__PURE__*/_jsxs(View, {
69
66
  style: styles.bar,
70
67
  children: [/*#__PURE__*/_jsx(View, {
71
68
  style: styles.gradient,
72
69
  pointerEvents: "none",
73
- children: /*#__PURE__*/_jsxs(Svg, {
74
- height: "100%",
75
- width: "100%",
76
- children: [/*#__PURE__*/_jsx(Defs, {
77
- children: /*#__PURE__*/_jsxs(SvgLinearGradient, {
78
- id: gradientId,
79
- x1: "0",
80
- y1: "0.4",
81
- x2: "0",
82
- y2: "1",
83
- children: [/*#__PURE__*/_jsx(Stop, {
84
- offset: "0",
85
- stopColor: gradientColor,
86
- stopOpacity: "0.9"
87
- }), /*#__PURE__*/_jsx(Stop, {
88
- offset: "0.9",
89
- stopColor: gradientColor,
90
- stopOpacity: "0.1"
91
- })]
92
- })
93
- }), /*#__PURE__*/_jsx(Rect, {
94
- width: "100%",
95
- height: "100%",
96
- fill: `url(#${gradientId})`
97
- })]
70
+ children: /*#__PURE__*/_jsx(HeaderGradientOverlay, {
71
+ color: gradientColor
98
72
  })
99
- }), leading != null && /*#__PURE__*/_jsx(View, {
100
- style: styles.slot,
73
+ }), leading != null && /*#__PURE__*/_jsx(Toolbar, {
101
74
  children: leading
102
75
  }), /*#__PURE__*/_jsx(View, {
103
76
  style: styles.titleContainer,
@@ -106,21 +79,25 @@ export function TitleHeader({
106
79
  style: styles.title,
107
80
  children: title
108
81
  })
109
- }), trailing != null && /*#__PURE__*/_jsx(View, {
110
- style: styles.slotEnd,
82
+ }), trailing != null && /*#__PURE__*/_jsx(Toolbar, {
83
+ style: styles.trailing,
111
84
  children: trailing
112
85
  })]
113
86
  })]
114
87
  });
115
88
  }
116
- const styles = StyleSheet.create(theme => ({
117
- safeArea: {
89
+ const styles = StyleSheet.create((theme, runtime) => ({
90
+ container: {
118
91
  position: 'absolute',
119
92
  top: 0,
120
93
  left: 0,
121
94
  right: 0,
122
95
  zIndex: 1000
123
96
  },
97
+ safeArea: (isTransparent, bgColor) => ({
98
+ height: runtime.insets.top,
99
+ backgroundColor: isTransparent ? 'transparent' : bgColor
100
+ }),
124
101
  gradient: {
125
102
  position: 'absolute',
126
103
  top: 0,
@@ -132,20 +109,12 @@ const styles = StyleSheet.create(theme => ({
132
109
  height: theme.layout.header.height,
133
110
  flexDirection: 'row',
134
111
  alignItems: 'center',
135
- justifyContent: 'space-between',
136
112
  paddingHorizontal: theme.layout.screen.margin.x,
137
- gap: theme.spacing['3']
113
+ gap: theme.spacing['3'],
114
+ justifyContent: 'space-between'
138
115
  },
139
- slot: {
140
- flexDirection: 'row',
141
- alignItems: 'center',
142
- gap: theme.spacing['2']
143
- },
144
- slotEnd: {
145
- flexDirection: 'row',
146
- alignItems: 'center',
147
- justifyContent: 'flex-end',
148
- gap: theme.spacing['2']
116
+ trailing: {
117
+ justifyContent: 'flex-end'
149
118
  },
150
119
  titleContainer: {
151
120
  variants: {
@@ -1 +1 @@
1
- {"version":3,"names":["useId","Text","View","useSafeAreaInsets","Svg","Defs","Rect","Stop","LinearGradient","SvgLinearGradient","StyleSheet","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","HeaderDismissButton","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TitleHeader","title","LeftComponent","RightComponent","dismissAction","navigation","onDismiss","titleAlignment","bg","theme","top","gradientId","bgColor","isTransparent","gradientColor","color","styles","useVariants","leading","children","trailing","style","safeArea","height","backgroundColor","bar","gradient","pointerEvents","width","id","x1","y1","x2","y2","offset","stopColor","stopOpacity","fill","slot","titleContainer","slotEnd","create","position","left","right","zIndex","bottom","layout","header","flexDirection","alignItems","justifyContent","paddingHorizontal","screen","margin","x","gap","spacing","variants","center","flex","fontSize","typography","lineHeight","letterSpacing","fontWeight","textAlign"],"sourceRoot":"../../../../../../src","sources":["components/header/variants/TitleHeader/index.tsx"],"mappings":";;AAAA,SAAyBA,KAAK,QAAQ,OAAO;AAC7C,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,OAAOC,GAAG,IACRC,IAAI,EACJC,IAAI,EACJC,IAAI,EACJC,cAAc,IAAIC,iBAAiB,QAC9B,kBAAkB;AACzB,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAE1B,SACEC,mBAAmB;AAES,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAc9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,aAAa;EACbC,cAAc;EACdC,aAAa,GAAG,MAAM;EACtBC,UAAU;EACVC,SAAS;EACTC,cAAc,GAAG,QAAQ;EACzBC,EAAE,GAAG;AACW,CAAC,EAAE;EACnB,MAAM;IAAEC;EAAM,CAAC,GAAGnB,YAAY,CAAC,CAAC;EAChC,MAAM;IAAEoB;EAAI,CAAC,GAAG5B,iBAAiB,CAAC,CAAC;EACnC,MAAM6B,UAAU,GAAGhC,KAAK,CAAC,CAAC;EAC1B,MAAMiC,OAAO,GAAGrB,iBAAiB,CAACiB,EAAE,EAAEC,KAAK,CAAW;EACtD,MAAMI,aAAa,GAAGD,OAAO,KAAK,aAAa;EAC/C,MAAME,aAAa,GAAGD,aAAa,GAC/BJ,KAAK,CA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AAC,UAAU,CAAC,CAACK,UAAU;IAC5DC,aAAa,EAAEvD,KAAK,CAACqD,UAAU,CAACJ,QAAQ,CAAC,UAAU,CAAC,CAACM,aAAa;IAClEC,UAAU,EACRzE,iBAAiB,CAACiB,KAAK,CAACqD,UAAU,CAACJ,QAAQ,CAAC,UAAU,CAAC,CAACO,UAAU,CAAC;IACrElD,KAAK,EACFN,KAAK,CAACM,KAAK,CACV,cAAc,CACf,IAAI,EAAE;IACT2C,QAAQ,EAAE;MACRnD,cAAc,EAAE;QACdoD,MAAM,EAAE;UAAEO,SAAS,EAAE;QAAS,CAAC;QAC/BvB,IAAI,EAAE;UAAEuB,SAAS,EAAE;QAAO;MAC5B;IACF;EACF;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Text","View","StyleSheet","useUnistyles","resolveThemeColor","FONT_WEIGHT_VALUE","Toolbar","HeaderDismissButton","HeaderGradientOverlay","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TitleHeader","title","LeftToolbar","RightToolbar","dismissAction","navigation","onDismiss","titleAlignment","bg","theme","bgColor","color","isTransparent","gradientColor","styles","useVariants","leading","children","trailing","style","container","safeArea","bar","gradient","pointerEvents","titleContainer","create","runtime","position","top","left","right","zIndex","height","insets","backgroundColor","bottom","layout","header","flexDirection","alignItems","paddingHorizontal","screen","margin","x","gap","spacing","justifyContent","variants","center","flex","fontSize","typography","lineHeight","letterSpacing","fontWeight","textAlign"],"sourceRoot":"../../../../../../src","sources":["components/header/variants/TitleHeader/index.tsx"],"mappings":";;AACA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAGjE,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAE1B,SAASC,OAAO;AAChB,SACEC,mBAAmB;AAGrB,SAASC,qBAAqB;AAA4C,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAA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rE5C,KAAK,EACFF,KAAK,CAACE,KAAK,CACV,cAAc,CACf,IAAI,EAAE;IACTqC,QAAQ,EAAE;MACRzC,cAAc,EAAE;QACd0C,MAAM,EAAE;UAAEO,SAAS,EAAE;QAAS,CAAC;QAC/B1B,IAAI,EAAE;UAAE0B,SAAS,EAAE;QAAO;MAC5B;IACF;EACF;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { forwardRef } from 'react';
4
4
  import { View } from 'react-native';
5
- import { useUnistyles } from 'react-native-unistyles';
6
- import { getIcon } from "../../theme/configure.js";
5
+ import { StyleSheet, useUnistyles } from 'react-native-unistyles';
6
+ import { getIcon } from "../../theme/registry.js";
7
7
  import { resolveThemeColor } from "../../utils/resolve-theme-color.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  /**
@@ -36,12 +36,7 @@ export const Icon = /*#__PURE__*/forwardRef(function Icon({
36
36
  const resolvedColor = resolveThemeColor(color, theme) ?? theme.color['text.default'] ?? '';
37
37
  return /*#__PURE__*/_jsx(View, {
38
38
  ref: ref,
39
- style: [{
40
- width: size,
41
- height: size,
42
- alignItems: 'center',
43
- justifyContent: 'center'
44
- }, style],
39
+ style: [styles.container(size), style],
45
40
  ...rest,
46
41
  children: /*#__PURE__*/_jsx(IconComponent, {
47
42
  color: resolvedColor,
@@ -50,4 +45,21 @@ export const Icon = /*#__PURE__*/forwardRef(function Icon({
50
45
  })
51
46
  });
52
47
  });
48
+
49
+ // ─── Styles ───────────────────────────────────────────────────────────────────
50
+ //
51
+ // This stylesheet is also what makes the Unistyles Babel plugin swap the `View`
52
+ // imported above for its Unistyles-aware counterpart, which registers the
53
+ // ShadowNode natively. Without it, a Unistyles style passed in through `style`
54
+ // would freeze at whichever theme was active when it was created — `Icon` does
55
+ // not re-render on theme change unless something it reads from the theme
56
+ // happens to change.
57
+ const styles = StyleSheet.create(() => ({
58
+ container: size => ({
59
+ width: size,
60
+ height: size,
61
+ alignItems: 'center',
62
+ justifyContent: 'center'
63
+ })
64
+ }));
53
65
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","View","useUnistyles","getIcon","resolveThemeColor","jsx","_jsx","Icon","name","size","color","strokeWidth","style","rest","ref","theme","IconComponent","__DEV__","console","warn","resolvedColor","width","height","alignItems","justifyContent","children"],"sourceRoot":"../../../../src","sources":["components/icon/Icon.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,QAAwB,cAAc;AAEnD,SAASC,YAAY,QAAQ,wBAAwB;AAErD,SAASC,OAAO;AAEhB,SAASC,iBAAiB;AAAqC,SAAAC,GAAA,IAAAC,IAAA;AAY/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,gBAAGP,UAAU,CAC5B,SAASO,IAAIA,CACX;EAAEC,IAAI;EAAEC,IAAI,GAAG,EAAE;EAAEC,KAAK,GAAG,cAAc;EAAEC,WAAW;EAAEC,KAAK;EAAE,GAAGC;AAAK,CAAC,EACxEC,GAAG,EACH;EACA,MAAM;IAAEC;EAAM,CAAC,GAAGb,YAAY,CAAC,CAAC;EAChC,MAAMc,aAAa,GAAGb,OAAO,CAACK,IAAI,CAAC;EAEnC,IAAI,CAACQ,aAAa,EAAE;IAClB,IAAIC,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CAAC,yCAAyCX,IAAI,IAAI,CAAC;IACjE;IACA,OAAO,IAAI;EACb;EAEA,MAAMY,aAAa,GACjBhB,iBAAiB,CAACM,KAAK,EAAEK,KAAK,CAAC,IAC9BA,KAAK,CAACL,KAAK,CACV,cAAc,CACf,IACD,EAAE;EAEJ,oBACEJ,IAAA,CAACL,IAAI;IACHa,GAAG,EAAEA,GAAI;IACTF,KAAK,EAAE,CACL;MACES,KAAK,EAAEZ,IAAI;MACXa,MAAM,EAAEb,IAAI;MACZc,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE;IAClB,CAAC,EACDZ,KAAK,CACL;IAAA,GACEC,IAAI;IAAAY,QAAA,eAERnB,IAAA,CAACU,aAAa;MACZN,KAAK,EAAEU,aAAc;MACrBX,IAAI,EAAEA,IAAK;MACXE,WAAW,EAAEA;IAAY,CAC1B;EAAC,CACE,CAAC;AAEX,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","View","StyleSheet","useUnistyles","getIcon","resolveThemeColor","jsx","_jsx","Icon","name","size","color","strokeWidth","style","rest","ref","theme","IconComponent","__DEV__","console","warn","resolvedColor","styles","container","children","create","width","height","alignItems","justifyContent"],"sourceRoot":"../../../../src","sources":["components/icon/Icon.tsx"],"mappings":";;AACA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,QAAwB,cAAc;AAEnD,SAASC,UAAU,EAAEC,YAAY,QAAQ,wBAAwB;AAEjE,SAASC,OAAO;AAEhB,SAASC,iBAAiB;AAAqC,SAAAC,GAAA,IAAAC,IAAA;AAY/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,gBAAGR,UAAU,CAC5B,SAASQ,IAAIA,CACX;EAAEC,IAAI;EAAEC,IAAI,GAAG,EAAE;EAAEC,KAAK,GAAG,cAAc;EAAEC,WAAW;EAAEC,KAAK;EAAE,GAAGC;AAAK,CAAC,EACxEC,GAAG,EACH;EACA,MAAM;IAAEC;EAAM,CAAC,GAAGb,YAAY,CAAC,CAAC;EAChC,MAAMc,aAAa,GAAGb,OAAO,CAACK,IAAI,CAAC;EAEnC,IAAI,CAACQ,aAAa,EAAE;IAClB,IAAIC,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CAAC,yCAAyCX,IAAI,IAAI,CAAC;IACjE;IACA,OAAO,IAAI;EACb;EAEA,MAAMY,aAAa,GACjBhB,iBAAiB,CAACM,KAAK,EAAEK,KAAK,CAAC,IAC9BA,KAAK,CAACL,KAAK,CACV,cAAc,CACf,IACD,EAAE;EAEJ,oBACEJ,IAAA,CAACN,IAAI;IAACc,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAE,CAACS,MAAM,CAACC,SAAS,CAACb,IAAI,CAAC,EAAEG,KAAK,CAAE;IAAA,GAAKC,IAAI;IAAAU,QAAA,eAC9DjB,IAAA,CAACU,aAAa;MACZN,KAAK,EAAEU,aAAc;MACrBX,IAAI,EAAEA,IAAK;MACXE,WAAW,EAAEA;IAAY,CAC1B;EAAC,CACE,CAAC;AAEX,CACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,MAAM,GAAGpB,UAAU,CAACuB,MAAM,CAAC,OAAO;EACtCF,SAAS,EAAGb,IAAY,KAAM;IAC5BgB,KAAK,EAAEhB,IAAI;IACXiB,MAAM,EAAEjB,IAAI;IACZkB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;AACH,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ import { View } from 'react-native';
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { getImageComponent } from "../../theme/registry.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * Renders the image implementation configured via
9
+ * `configureTerraUI({ image })` (defaults to React Native's `Image`).
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <Image
14
+ * source={{ uri: 'https://example.com/photo.jpg' }}
15
+ * contentFit="cover"
16
+ * style={{ width: 40, height: 40 }}
17
+ * />
18
+ * ```
19
+ */
20
+ export function Image({
21
+ contentFit = 'cover',
22
+ width,
23
+ height,
24
+ radius = 'none',
25
+ style,
26
+ ...rest
27
+ }) {
28
+ const ImageComponent = getImageComponent();
29
+ return /*#__PURE__*/_jsx(View, {
30
+ style: [styles.container(width, height, radius), style],
31
+ children: /*#__PURE__*/_jsx(ImageComponent, {
32
+ contentFit: contentFit,
33
+ style: styles.image,
34
+ ...rest
35
+ })
36
+ });
37
+ }
38
+ const styles = StyleSheet.create(_theme => ({
39
+ container: (w, h, r) => ({
40
+ ...(w ? {
41
+ width: w
42
+ } : {}),
43
+ ...(h ? {
44
+ height: h
45
+ } : {}),
46
+ borderRadius: _theme.radius[r],
47
+ overflow: 'hidden'
48
+ }),
49
+ image: {
50
+ width: '100%',
51
+ height: '100%'
52
+ }
53
+ }));
54
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","StyleSheet","getImageComponent","jsx","_jsx","Image","contentFit","width","height","radius","style","rest","ImageComponent","styles","container","children","image","create","_theme","w","h","r","borderRadius","overflow"],"sourceRoot":"../../../../src","sources":["components/image/Image.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,iBAAiB;AAA0B,SAAAC,GAAA,IAAAC,IAAA;AAIpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAAC;EACpBC,UAAU,GAAG,OAAO;EACpBC,KAAK;EACLC,MAAM;EACNC,MAAM,GAAG,MAAM;EACfC,KAAK;EACL,GAAGC;AACO,CAAC,EAAE;EACb,MAAMC,cAAc,GAAGV,iBAAiB,CAAC,CAAC;EAE1C,oBACEE,IAAA,CAACJ,IAAI;IAACU,KAAK,EAAE,CAACG,MAAM,CAACC,SAAS,CAACP,KAAK,EAAEC,MAAM,EAAEC,MAAM,CAAC,EAAEC,KAAK,CAAE;IAAAK,QAAA,eAC5DX,IAAA,CAACQ,cAAc;MAACN,UAAU,EAAEA,UAAW;MAACI,KAAK,EAAEG,MAAM,CAACG,KAAM;MAAA,GAAKL;IAAI,CAAG;EAAC,CACrE,CAAC;AAEX;AAEA,MAAME,MAAM,GAAGZ,UAAU,CAACgB,MAAM,CAAEC,MAAM,KAAM;EAC5CJ,SAAS,EAAEA,CAACK,CAAqB,EAAEC,CAAqB,EAAEC,CAAY,MAAM;IAC1E,IAAIF,CAAC,GAAG;MAAEZ,KAAK,EAAEY;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,IAAIC,CAAC,GAAG;MAAEZ,MAAM,EAAEY;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3BE,YAAY,EAAEJ,MAAM,CAACT,MAAM,CAACY,CAAC,CAAC;IAC9BE,QAAQ,EAAE;EACZ,CAAC,CAAC;EACFP,KAAK,EAAE;IACLT,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { Image } from "./Image.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Image"],"sourceRoot":"../../../../src","sources":["components/image/index.ts"],"mappings":";;AAAA,SAASA,KAAK","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/image/types.ts"],"mappings":"","ignoreList":[]}
@@ -3,8 +3,11 @@
3
3
  export * from "./avatar/index.js";
4
4
  export * from "./box/index.js";
5
5
  export * from "./button/index.js";
6
+ export * from "./chip/index.js";
7
+ export * from "./empty-state/index.js";
6
8
  export * from "./header/index.js";
7
9
  export * from "./icon/index.js";
10
+ export * from "./image/index.js";
8
11
  export * from "./page-indicator/index.js";
9
12
  export * from "./portal/index.js";
10
13
  export * from "./screen/index.js";
@@ -13,4 +16,5 @@ export * from "./spinner/index.js";
13
16
  export * from "./surface/index.js";
14
17
  export * from "./text/index.js";
15
18
  export * from "./toast/index.js";
19
+ export * from "./toolbar/index.js";
16
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ import { useContext, useEffect, useRef } from 'react';
4
+ import { PortalContext } from "./PortalContext.js";
5
+ import { PortalHost } from "./PortalHost.js";
6
+ import { PortalProvider } from "./PortalProvider.js";
7
+ let nextPortalKey = 1;
8
+ const PortalComponent = ({
9
+ hostName,
10
+ children
11
+ }) => {
12
+ const context = useContext(PortalContext);
13
+ const upsertPortal = context?.upsertPortal;
14
+ const removePortal = context?.removePortal;
15
+ const portalKeyRef = useRef(nextPortalKey++);
16
+ useEffect(() => {
17
+ if (!upsertPortal || !removePortal) {
18
+ return;
19
+ }
20
+ upsertPortal(hostName, portalKeyRef.current, children ?? null);
21
+ return () => {
22
+ removePortal(hostName, portalKeyRef.current);
23
+ };
24
+ }, [children, hostName, removePortal, upsertPortal]);
25
+ return null;
26
+ };
27
+ /**
28
+ * Declaratively teleports `children` into the `PortalHost` named `hostName`,
29
+ * for as long as this component stays mounted.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * <Portal hostName="screen-header">
34
+ * <LargeTitle />
35
+ * </Portal>
36
+ * ```
37
+ */
38
+ export const Portal = Object.assign(PortalComponent, {
39
+ Provider: PortalProvider,
40
+ Host: PortalHost
41
+ });
42
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","useEffect","useRef","PortalContext","PortalHost","PortalProvider","nextPortalKey","PortalComponent","hostName","children","context","upsertPortal","removePortal","portalKeyRef","current","Portal","Object","assign","Provider","Host"],"sourceRoot":"../../../../src","sources":["components/portal/Portal.tsx"],"mappings":";;AAAA,SAAkCA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAE9E,SAASC,aAAa;AACtB,SAASC,UAAU;AACnB,SAASC,cAAc;AAEvB,IAAIC,aAAa,GAAG,CAAC;AAQrB,MAAMC,eAAgC,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAK;EACnE,MAAMC,OAAO,GAAGV,UAAU,CAACG,aAAa,CAAC;EACzC,MAAMQ,YAAY,GAAGD,OAAO,EAAEC,YAAY;EAC1C,MAAMC,YAAY,GAAGF,OAAO,EAAEE,YAAY;EAC1C,MAAMC,YAAY,GAAGX,MAAM,CAASI,aAAa,EAAE,CAAC;EAEpDL,SAAS,CAAC,MAAM;IACd,IAAI,CAACU,YAAY,IAAI,CAACC,YAAY,EAAE;MAClC;IACF;IAEAD,YAAY,CAACH,QAAQ,EAAEK,YAAY,CAACC,OAAO,EAAEL,QAAQ,IAAI,IAAI,CAAC;IAE9D,OAAO,MAAM;MACXG,YAAY,CAACJ,QAAQ,EAAEK,YAAY,CAACC,OAAO,CAAC;IAC9C,CAAC;EACH,CAAC,EAAE,CAACL,QAAQ,EAAED,QAAQ,EAAEI,YAAY,EAAED,YAAY,CAAC,CAAC;EAEpD,OAAO,IAAI;AACb,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACV,eAAe,EAAE;EACnDW,QAAQ,EAAEb,cAAc;EACxBc,IAAI,EAAEf;AACR,CAAC,CAAwB","ignoreList":[]}
@@ -1,20 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import { createContext, useContext } from 'react';
3
+ import { createContext } from 'react';
4
4
  export const PortalContext = /*#__PURE__*/createContext(null);
5
-
6
- /**
7
- * Access the nearest {@link PortalProvider}. Used by components that need to
8
- * teleport content into a `PortalHost` rendered elsewhere in the tree (e.g. the
9
- * large-title header injecting its title into the scroll content).
10
- *
11
- * @throws if called outside a `PortalProvider`.
12
- */
13
- export function usePortal() {
14
- const context = useContext(PortalContext);
15
- if (!context) {
16
- throw new Error('usePortal must be used within a PortalProvider');
17
- }
18
- return context;
19
- }
20
5
  //# sourceMappingURL=PortalContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","PortalContext","usePortal","context","Error"],"sourceRoot":"../../../../src","sources":["components/portal/PortalContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,OAAO;AAWjE,OAAO,MAAMC,aAAa,gBAAGF,aAAa,CAA4B,IAAI,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGH,UAAU,CAACC,aAAa,CAAC;EACzC,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOD,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["createContext","PortalContext"],"sourceRoot":"../../../../src","sources":["components/portal/PortalContext.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAwB,OAAO;AAkBrD,OAAO,MAAMC,aAAa,gBAAGD,aAAa,CAA4B,IAAI,CAAC","ignoreList":[]}
@@ -1,23 +1,25 @@
1
1
  "use strict";
2
2
 
3
+ import { Fragment, useContext } from 'react';
3
4
  import { View } from 'react-native';
4
- import { usePortal } from "./PortalContext.js";
5
-
5
+ import { PortalContext } from "./PortalContext.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
6
7
  /**
7
- * Renders every node currently registered with the nearest
8
- * {@link PortalProvider}, in insertion order. Place it where teleported content
9
- * should appear (e.g. at the top of a `Screen.ScrollView`).
8
+ * Renders every entry currently registered under `name` on the nearest
9
+ * {@link PortalProvider}. Place it where teleported content should appear
10
+ * (e.g. at the top of a `Screen.ScrollView`).
10
11
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- export function PortalHost() {
13
- const {
14
- contents
15
- } = usePortal();
12
+ export function PortalHost({
13
+ name,
14
+ ...viewProps
15
+ }) {
16
+ const context = useContext(PortalContext);
17
+ const hostPortals = context?.portals[name] ?? [];
16
18
  return /*#__PURE__*/_jsx(View, {
17
- collapsable: false,
18
- children: Array.from(contents.entries()).map(([id, content]) => /*#__PURE__*/_jsx(View, {
19
- children: content
20
- }, id))
19
+ ...viewProps,
20
+ children: hostPortals.map(entry => /*#__PURE__*/_jsx(Fragment, {
21
+ children: entry.node
22
+ }, entry.key))
21
23
  });
22
24
  }
23
25
  //# sourceMappingURL=PortalHost.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["View","usePortal","jsx","_jsx","PortalHost","contents","collapsable","children","Array","from","entries","map","id","content"],"sourceRoot":"../../../../src","sources":["components/portal/PortalHost.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AAEnC,SAASC,SAAS;;AAElB;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAGJ,SAAS,CAAC,CAAC;EAEhC,oBACEE,IAAA,CAACH,IAAI;IAACM,WAAW,EAAE,KAAM;IAAAC,QAAA,EACtBC,KAAK,CAACC,IAAI,CAACJ,QAAQ,CAACK,OAAO,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,OAAO,CAAC,kBAChDV,IAAA,CAACH,IAAI;MAAAO,QAAA,EAAWM;IAAO,GAAZD,EAAmB,CAC/B;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["Fragment","useContext","View","PortalContext","jsx","_jsx","PortalHost","name","viewProps","context","hostPortals","portals","children","map","entry","node","key"],"sourceRoot":"../../../../src","sources":["components/portal/PortalHost.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,OAAO;AAC5C,SAASC,IAAI,QAAwB,cAAc;AAEnD,SAASC,aAAa;AAA0B,SAAAC,GAAA,IAAAC,IAAA;AAOhD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,IAAI;EAAE,GAAGC;AAA2B,CAAC,EAAE;EAClE,MAAMC,OAAO,GAAGR,UAAU,CAACE,aAAa,CAAC;EACzC,MAAMO,WAAW,GAAGD,OAAO,EAAEE,OAAO,CAACJ,IAAI,CAAC,IAAI,EAAE;EAEhD,oBACEF,IAAA,CAACH,IAAI;IAAA,GAAKM,SAAS;IAAAI,QAAA,EAChBF,WAAW,CAACG,GAAG,CAAEC,KAAK,iBACrBT,IAAA,CAACL,QAAQ;MAAAY,QAAA,EAAkBE,KAAK,CAACC;IAAI,GAAtBD,KAAK,CAACE,GAA2B,CACjD;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
@@ -4,34 +4,66 @@ import { useCallback, useMemo, useState } from 'react';
4
4
  import { PortalContext } from "./PortalContext.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  /**
7
- * Holds a registry of teleported content. Children register/unregister nodes by
8
- * id (see {@link usePortal}); a `PortalHost` placed anywhere below renders them.
9
- * Context-only no animation dependency.
7
+ * Holds a registry of teleported content, keyed by host name. Descendant
8
+ * `Portal` components register/unregister entries; a `PortalHost` placed
9
+ * anywhere below renders the entries for its `name`.
10
10
  */
11
11
  export function PortalProvider({
12
12
  children
13
13
  }) {
14
- const [contents, setContents] = useState(() => new Map());
15
- const registerContent = useCallback((id, content) => {
16
- setContents(prev => {
17
- const next = new Map(prev);
18
- next.set(id, content);
19
- return next;
14
+ const [portals, setPortals] = useState({});
15
+ const upsertPortal = useCallback((hostName, key, node) => {
16
+ setPortals(prev => {
17
+ const hostPortals = prev[hostName] ?? [];
18
+ const existingIndex = hostPortals.findIndex(entry => entry.key === key);
19
+ if (existingIndex === -1) {
20
+ return {
21
+ ...prev,
22
+ [hostName]: [...hostPortals, {
23
+ key,
24
+ node
25
+ }]
26
+ };
27
+ }
28
+ if (hostPortals[existingIndex]?.node === node) {
29
+ return prev;
30
+ }
31
+ const nextHostPortals = [...hostPortals];
32
+ nextHostPortals[existingIndex] = {
33
+ key,
34
+ node
35
+ };
36
+ return {
37
+ ...prev,
38
+ [hostName]: nextHostPortals
39
+ };
20
40
  });
21
41
  }, []);
22
- const unregisterContent = useCallback(id => {
23
- setContents(prev => {
24
- if (!prev.has(id)) return prev;
25
- const next = new Map(prev);
26
- next.delete(id);
27
- return next;
42
+ const removePortal = useCallback((hostName, key) => {
43
+ setPortals(prev => {
44
+ const hostPortals = prev[hostName] ?? [];
45
+ const nextHostPortals = hostPortals.filter(entry => entry.key !== key);
46
+ if (nextHostPortals.length === hostPortals.length) {
47
+ return prev;
48
+ }
49
+ if (nextHostPortals.length === 0) {
50
+ const {
51
+ [hostName]: _removed,
52
+ ...rest
53
+ } = prev;
54
+ return rest;
55
+ }
56
+ return {
57
+ ...prev,
58
+ [hostName]: nextHostPortals
59
+ };
28
60
  });
29
61
  }, []);
30
62
  const value = useMemo(() => ({
31
- registerContent,
32
- unregisterContent,
33
- contents
34
- }), [registerContent, unregisterContent, contents]);
63
+ portals,
64
+ upsertPortal,
65
+ removePortal
66
+ }), [portals, removePortal, upsertPortal]);
35
67
  return /*#__PURE__*/_jsx(PortalContext.Provider, {
36
68
  value: value,
37
69
  children: children
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","contents","setContents","Map","registerContent","id","content","prev","next","set","unregisterContent","has","delete","value","Provider"],"sourceRoot":"../../../../src","sources":["components/portal/PortalProvider.tsx"],"mappings":";;AAAA,SAAyBA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEtE,SAASC,aAAa;AAAmD,SAAAC,GAAA,IAAAC,IAAA;AAMzE;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EAChE,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGP,QAAQ,CACtC,MAAM,IAAIQ,GAAG,CAAC,CAChB,CAAC;EAED,MAAMC,eAAe,GAAGX,WAAW,CAAC,CAACY,EAAU,EAAEC,OAAkB,KAAK;IACtEJ,WAAW,CAAEK,IAAI,IAAK;MACpB,MAAMC,IAAI,GAAG,IAAIL,GAAG,CAACI,IAAI,CAAC;MAC1BC,IAAI,CAACC,GAAG,CAACJ,EAAE,EAAEC,OAAO,CAAC;MACrB,OAAOE,IAAI;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,iBAAiB,GAAGjB,WAAW,CAAEY,EAAU,IAAK;IACpDH,WAAW,CAAEK,IAAI,IAAK;MACpB,IAAI,CAACA,IAAI,CAACI,GAAG,CAACN,EAAE,CAAC,EAAE,OAAOE,IAAI;MAC9B,MAAMC,IAAI,GAAG,IAAIL,GAAG,CAACI,IAAI,CAAC;MAC1BC,IAAI,CAACI,MAAM,CAACP,EAAE,CAAC;MACf,OAAOG,IAAI;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMK,KAAK,GAAGnB,OAAO,CACnB,OAAO;IAAEU,eAAe;IAAEM,iBAAiB;IAAET;EAAS,CAAC,CAAC,EACxD,CAACG,eAAe,EAAEM,iBAAiB,EAAET,QAAQ,CAC/C,CAAC;EAED,oBACEH,IAAA,CAACF,aAAa,CAACkB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAb,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useMemo","useState","PortalContext","jsx","_jsx","PortalProvider","children","portals","setPortals","upsertPortal","hostName","key","node","prev","hostPortals","existingIndex","findIndex","entry","nextHostPortals","removePortal","filter","length","_removed","rest","value","Provider"],"sourceRoot":"../../../../src","sources":["components/portal/PortalProvider.tsx"],"mappings":";;AAAA,SAAyBA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAA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AAK,IAAKA,KAAK,CAACN,GAAG,KAAKA,GAAG,CAAC;MAExE,IAAIO,eAAe,CAACG,MAAM,KAAKP,WAAW,CAACO,MAAM,EAAE;QACjD,OAAOR,IAAI;MACb;MAEA,IAAIK,eAAe,CAACG,MAAM,KAAK,CAAC,EAAE;QAChC,MAAM;UAAE,CAACX,QAAQ,GAAGY,QAAQ;UAAE,GAAGC;QAAK,CAAC,GAAGV,IAAI;QAC9C,OAAOU,IAAI;MACb;MAEA,OAAO;QACL,GAAGV,IAAI;QACP,CAACH,QAAQ,GAAGQ;MACd,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMM,KAAK,GAAGxB,OAAO,CACnB,OAAO;IAAEO,OAAO;IAAEE,YAAY;IAAEU;EAAa,CAAC,CAAC,EAC/C,CAACZ,OAAO,EAAEY,YAAY,EAAEV,YAAY,CACtC,CAAC;EAED,oBACEL,IAAA,CAACF,aAAa,CAACuB,QAAQ;IAACD,KAAK,EAAEA,KAAM;IAAAlB,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE7E","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- export { usePortal } from "./PortalContext.js";
3
+ export { Portal } from "./Portal.js";
4
4
  export { PortalHost } from "./PortalHost.js";
5
5
  export { PortalProvider } from "./PortalProvider.js";
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["usePortal","PortalHost","PortalProvider"],"sourceRoot":"../../../../src","sources":["components/portal/index.ts"],"mappings":";;AACA,SAASA,SAAS;AAClB,SAASC,UAAU;AAEnB,SAASC,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["Portal","PortalHost","PortalProvider"],"sourceRoot":"../../../../src","sources":["components/portal/index.ts"],"mappings":";;AACA,SAASA,MAAM;AAGf,SAASC,UAAU;AAEnB,SAASC,cAAc","ignoreList":[]}