@terreno/ui 57.21.0 → 58.0.0-beta.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 (219) hide show
  1. package/.ai/guidelines/core.md +1 -1
  2. package/CHANGELOG.md +43 -0
  3. package/dist/ActionSheet.d.ts +9 -9
  4. package/dist/ActionSheet.d.ts.map +1 -1
  5. package/dist/ActionSheet.js +11 -4
  6. package/dist/ActionSheet.js.map +1 -1
  7. package/dist/AnnouncementNavigator.d.ts +7 -1
  8. package/dist/AnnouncementNavigator.d.ts.map +1 -1
  9. package/dist/AnnouncementNavigator.js +15 -16
  10. package/dist/AnnouncementNavigator.js.map +1 -1
  11. package/dist/Avatar.d.ts.map +1 -1
  12. package/dist/Avatar.js +1 -1
  13. package/dist/Avatar.js.map +1 -1
  14. package/dist/Box.d.ts.map +1 -1
  15. package/dist/Box.js +3 -1
  16. package/dist/Box.js.map +1 -1
  17. package/dist/Common.d.ts +16 -12
  18. package/dist/Common.d.ts.map +1 -1
  19. package/dist/Common.js.map +1 -1
  20. package/dist/ConsentFormScreen.d.ts.map +1 -1
  21. package/dist/ConsentFormScreen.js.map +1 -1
  22. package/dist/ConsentNavigator.d.ts +5 -3
  23. package/dist/ConsentNavigator.d.ts.map +1 -1
  24. package/dist/ConsentNavigator.js +4 -4
  25. package/dist/ConsentNavigator.js.map +1 -1
  26. package/dist/CustomSelectField.js.map +1 -1
  27. package/dist/DataTable.d.ts.map +1 -1
  28. package/dist/DataTable.js +37 -12
  29. package/dist/DataTable.js.map +1 -1
  30. package/dist/DateTimeField.js.map +1 -1
  31. package/dist/DropdownPanel.d.ts +0 -5
  32. package/dist/DropdownPanel.d.ts.map +1 -1
  33. package/dist/DropdownPanel.js +0 -5
  34. package/dist/DropdownPanel.js.map +1 -1
  35. package/dist/FilterAccordion.d.ts.map +1 -1
  36. package/dist/FilterAccordion.js.map +1 -1
  37. package/dist/FilterBoolean.d.ts.map +1 -1
  38. package/dist/FilterBoolean.js.map +1 -1
  39. package/dist/FilterSelectMenu.js +1 -1
  40. package/dist/FilterSelectMenu.js.map +1 -1
  41. package/dist/GPTChat.d.ts.map +1 -1
  42. package/dist/GPTChat.js.map +1 -1
  43. package/dist/Heading.d.ts.map +1 -1
  44. package/dist/Heading.js +6 -12
  45. package/dist/Heading.js.map +1 -1
  46. package/dist/HeightField.d.ts.map +1 -1
  47. package/dist/HeightField.js +1 -1
  48. package/dist/HeightField.js.map +1 -1
  49. package/dist/Hyperlink.d.ts.map +1 -1
  50. package/dist/Hyperlink.js +6 -1
  51. package/dist/Hyperlink.js.map +1 -1
  52. package/dist/Image.d.ts +1 -1
  53. package/dist/MarkdownEditorField.d.ts.map +1 -1
  54. package/dist/MarkdownEditorField.js +1 -1
  55. package/dist/MarkdownEditorField.js.map +1 -1
  56. package/dist/OfflineBanner.d.ts +3 -2
  57. package/dist/OfflineBanner.d.ts.map +1 -1
  58. package/dist/OfflineBanner.js +3 -2
  59. package/dist/OfflineBanner.js.map +1 -1
  60. package/dist/OtpField.d.ts.map +1 -1
  61. package/dist/OtpField.js.map +1 -1
  62. package/dist/PickerSelect.d.ts +4 -4
  63. package/dist/PickerSelect.d.ts.map +1 -1
  64. package/dist/PickerSelect.js.map +1 -1
  65. package/dist/ProvisionalConsentSigner.d.ts +3 -2
  66. package/dist/ProvisionalConsentSigner.d.ts.map +1 -1
  67. package/dist/ProvisionalConsentSigner.js +2 -2
  68. package/dist/ProvisionalConsentSigner.js.map +1 -1
  69. package/dist/SidebarNavigation.js +2 -2
  70. package/dist/SidebarNavigation.js.map +1 -1
  71. package/dist/SidebarNavigation.native.js +2 -2
  72. package/dist/SidebarNavigation.native.js.map +1 -1
  73. package/dist/Skeleton.js.map +1 -1
  74. package/dist/Text.d.ts.map +1 -1
  75. package/dist/Text.js +27 -50
  76. package/dist/Text.js.map +1 -1
  77. package/dist/TextField.d.ts.map +1 -1
  78. package/dist/TextField.js.map +1 -1
  79. package/dist/ThumbsUpDownFeedback.d.ts.map +1 -1
  80. package/dist/ThumbsUpDownFeedback.js.map +1 -1
  81. package/dist/ToastNotifications.d.ts.map +1 -1
  82. package/dist/ToastNotifications.js.map +1 -1
  83. package/dist/Tooltip.d.ts.map +1 -1
  84. package/dist/Tooltip.js.map +1 -1
  85. package/dist/Unifier.d.ts +1 -1
  86. package/dist/WebAddressAutocomplete.js.map +1 -1
  87. package/dist/WebDropdownMenu.d.ts +3 -3
  88. package/dist/WebDropdownMenu.d.ts.map +1 -1
  89. package/dist/WebDropdownMenu.js +1 -1
  90. package/dist/WebDropdownMenu.js.map +1 -1
  91. package/dist/announcementPlatform.d.ts +5 -0
  92. package/dist/announcementPlatform.d.ts.map +1 -1
  93. package/dist/announcementPlatform.js +9 -0
  94. package/dist/announcementPlatform.js.map +1 -1
  95. package/dist/asks/AskCard.d.ts +2 -2
  96. package/dist/asks/AskCard.d.ts.map +1 -1
  97. package/dist/dataTableColumnWidths.d.ts +76 -0
  98. package/dist/dataTableColumnWidths.d.ts.map +1 -0
  99. package/dist/dataTableColumnWidths.js +181 -0
  100. package/dist/dataTableColumnWidths.js.map +1 -0
  101. package/dist/index.d.ts +2 -1
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js.map +1 -1
  104. package/dist/login/LoginScreen.js.map +1 -1
  105. package/dist/requestClient.d.ts +71 -0
  106. package/dist/requestClient.d.ts.map +1 -0
  107. package/dist/requestClient.js +139 -0
  108. package/dist/requestClient.js.map +1 -0
  109. package/dist/security/PasswordCard.d.ts.map +1 -1
  110. package/dist/security/PasswordCard.js.map +1 -1
  111. package/dist/security/TwoFactorSettingsCard.d.ts.map +1 -1
  112. package/dist/security/TwoFactorSettingsCard.js +1 -1
  113. package/dist/security/TwoFactorSettingsCard.js.map +1 -1
  114. package/dist/signUp/SignUpScreen.js.map +1 -1
  115. package/dist/table/Table.d.ts.map +1 -1
  116. package/dist/table/Table.js.map +1 -1
  117. package/dist/table/TableTitle.d.ts.map +1 -1
  118. package/dist/table/TableTitle.js +2 -1
  119. package/dist/table/TableTitle.js.map +1 -1
  120. package/dist/textFontSizes.d.ts +12 -0
  121. package/dist/textFontSizes.d.ts.map +1 -0
  122. package/dist/textFontSizes.js +21 -0
  123. package/dist/textFontSizes.js.map +1 -0
  124. package/dist/useAcknowledgeAnnouncement.d.ts +8 -63
  125. package/dist/useAcknowledgeAnnouncement.d.ts.map +1 -1
  126. package/dist/useAcknowledgeAnnouncement.js +31 -80
  127. package/dist/useAcknowledgeAnnouncement.js.map +1 -1
  128. package/dist/useAnnouncements.d.ts +14 -47
  129. package/dist/useAnnouncements.d.ts.map +1 -1
  130. package/dist/useAnnouncements.js +30 -57
  131. package/dist/useAnnouncements.js.map +1 -1
  132. package/dist/useConsentForms.d.ts +6 -38
  133. package/dist/useConsentForms.d.ts.map +1 -1
  134. package/dist/useConsentForms.js +25 -48
  135. package/dist/useConsentForms.js.map +1 -1
  136. package/dist/useProvisionalConsent.d.ts +7 -58
  137. package/dist/useProvisionalConsent.d.ts.map +1 -1
  138. package/dist/useProvisionalConsent.js +57 -67
  139. package/dist/useProvisionalConsent.js.map +1 -1
  140. package/dist/useSubmitConsent.d.ts +9 -39
  141. package/dist/useSubmitConsent.d.ts.map +1 -1
  142. package/dist/useSubmitConsent.js +10 -39
  143. package/dist/useSubmitConsent.js.map +1 -1
  144. package/package.json +38 -38
  145. package/src/ActionSheet.test.tsx +4 -4
  146. package/src/ActionSheet.tsx +18 -5
  147. package/src/AnnouncementNavigator.test.tsx +215 -315
  148. package/src/AnnouncementNavigator.tsx +25 -20
  149. package/src/Avatar.tsx +2 -9
  150. package/src/Box.test.tsx +3 -3
  151. package/src/Box.tsx +4 -2
  152. package/src/Common.ts +19 -15
  153. package/src/ConsentFormScreen.tsx +2 -1
  154. package/src/ConsentNavigator.test.tsx +166 -242
  155. package/src/ConsentNavigator.tsx +9 -13
  156. package/src/CustomSelectField.tsx +3 -3
  157. package/src/DataTable.test.tsx +69 -1
  158. package/src/DataTable.tsx +72 -19
  159. package/src/DateTimeField.tsx +4 -4
  160. package/src/DropdownPanel.tsx +0 -6
  161. package/src/FilterAccordion.tsx +3 -3
  162. package/src/FilterBoolean.tsx +3 -3
  163. package/src/FilterSelectMenu.tsx +1 -1
  164. package/src/GPTChat.tsx +10 -9
  165. package/src/Heading.tsx +7 -14
  166. package/src/HeightField.tsx +9 -2
  167. package/src/Hyperlink.tsx +6 -3
  168. package/src/Link.test.tsx +2 -2
  169. package/src/MarkdownEditorField.tsx +10 -2
  170. package/src/MarkdownView.test.tsx +10 -6
  171. package/src/Modal.test.tsx +3 -1
  172. package/src/ModalSheet.test.tsx +6 -6
  173. package/src/OfflineBanner.tsx +3 -2
  174. package/src/OtpField.tsx +2 -1
  175. package/src/PickerSelect.tsx +3 -2
  176. package/src/ProvisionalConsentSigner.test.tsx +140 -113
  177. package/src/ProvisionalConsentSigner.tsx +5 -4
  178. package/src/SidebarNavigation.native.tsx +2 -2
  179. package/src/SidebarNavigation.tsx +2 -2
  180. package/src/Skeleton.tsx +1 -1
  181. package/src/TapToEdit.test.tsx +2 -2
  182. package/src/Text.test.tsx +1 -1
  183. package/src/Text.tsx +25 -51
  184. package/src/TextField.tsx +2 -1
  185. package/src/ThumbsUpDownFeedback.tsx +3 -3
  186. package/src/ToastNotifications.tsx +3 -2
  187. package/src/ToastNotifications.webModal.test.tsx +4 -1
  188. package/src/Tooltip.tsx +2 -1
  189. package/src/UserInactivity.test.tsx +2 -3
  190. package/src/WebAddressAutocomplete.tsx +3 -3
  191. package/src/WebDropdownMenu.tsx +16 -5
  192. package/src/__snapshots__/DataTable.test.tsx.snap +13 -0
  193. package/src/announcementPlatform.ts +10 -0
  194. package/src/asks/AskCard.test.tsx +14 -12
  195. package/src/asks/AskCard.tsx +2 -2
  196. package/src/bunSetup.ts +42 -0
  197. package/src/dataTableColumnWidths.test.ts +266 -0
  198. package/src/dataTableColumnWidths.ts +272 -0
  199. package/src/index.tsx +9 -2
  200. package/src/login/LoginScreen.tsx +2 -2
  201. package/src/requestClient.test.ts +288 -0
  202. package/src/requestClient.ts +228 -0
  203. package/src/security/PasswordCard.tsx +7 -5
  204. package/src/security/TwoFactorSettingsCard.tsx +10 -3
  205. package/src/signUp/SignUpScreen.tsx +2 -2
  206. package/src/table/Table.tsx +1 -2
  207. package/src/table/TableTitle.tsx +2 -1
  208. package/src/test-utils.tsx +76 -0
  209. package/src/textFontSizes.ts +31 -0
  210. package/src/useAcknowledgeAnnouncement.test.ts +101 -193
  211. package/src/useAcknowledgeAnnouncement.ts +69 -147
  212. package/src/useAnnouncements.test.ts +122 -186
  213. package/src/useAnnouncements.ts +49 -105
  214. package/src/useConsentForms.test.ts +59 -112
  215. package/src/useConsentForms.ts +37 -87
  216. package/src/useProvisionalConsent.test.ts +74 -150
  217. package/src/useProvisionalConsent.ts +79 -125
  218. package/src/useSubmitConsent.test.ts +59 -85
  219. package/src/useSubmitConsent.ts +22 -77
package/src/Text.tsx CHANGED
@@ -1,31 +1,14 @@
1
1
  import React from "react";
2
- import {Text as NativeText, Platform, type TextStyle} from "react-native";
2
+ import {Text as NativeText, type TextStyle} from "react-native";
3
3
 
4
4
  import type {TextProps, TextSize} from "./Common";
5
5
  import {Hyperlink} from "./Hyperlink";
6
6
  import {useTerrenoFontsLoaded} from "./TerrenoFontProvider";
7
7
  import {useTheme} from "./Theme";
8
-
9
- const fontSizeAndWeightWeb = {
10
- "2xl": {size: 48, weight: "medium"},
11
- lg: {size: 18, weight: "medium"},
12
- md: {size: 16, weight: "regular"},
13
- sm: {size: 12, weight: "regular"},
14
- xl: {size: 20, weight: "medium"},
15
- };
16
-
17
- const fontSizeAndWeighMobile = {
18
- "2xl": {size: 40, weight: "medium"},
19
- lg: {size: 16, weight: "medium"},
20
- md: {size: 14, weight: "regular"},
21
- sm: {size: 10, weight: "regular"},
22
- xl: {size: 18, weight: "medium"},
23
- };
24
-
25
- const fontSizes = Platform.OS === "web" ? fontSizeAndWeightWeb : fontSizeAndWeighMobile;
8
+ import {textFontSizes} from "./textFontSizes";
26
9
 
27
10
  /** Font size in pixels that `Text` renders at `size` on the current platform. */
28
- export const getTextFontSize = (size: TextSize): number => fontSizes[size].size;
11
+ export const getTextFontSize = (size: TextSize): number => textFontSizes[size].size;
29
12
 
30
13
  const TextComponent = ({
31
14
  accessibilityRole,
@@ -45,49 +28,40 @@ const TextComponent = ({
45
28
  const {theme} = useTheme();
46
29
  useTerrenoFontsLoaded();
47
30
 
48
- const style: TextStyle = {};
49
-
50
- if (size === "sm" || size === "md") {
31
+ const isSmallOrMedium = size === "sm" || size === "md";
32
+ let fontFamily: string;
33
+ if (isSmallOrMedium) {
51
34
  if (bold && italic) {
52
- style.fontFamily = "text-bold-italic";
35
+ fontFamily = "text-bold-italic";
53
36
  } else if (italic) {
54
- style.fontFamily = "text-regular-italic";
37
+ fontFamily = "text-regular-italic";
55
38
  } else if (bold) {
56
- style.fontFamily = "text-bold";
39
+ fontFamily = "text-bold";
57
40
  } else {
58
- style.fontFamily = "text-regular";
41
+ fontFamily = "text-regular";
59
42
  }
43
+ } else if (bold && italic) {
44
+ fontFamily = "text-bold-italic";
45
+ } else if (italic) {
46
+ fontFamily = "text-medium-italic";
47
+ } else if (bold) {
48
+ fontFamily = "text-bold";
60
49
  } else {
61
- if (bold && italic) {
62
- style.fontFamily = "text-bold-italic";
63
- } else if (italic) {
64
- style.fontFamily = "text-medium-italic";
65
- } else if (bold) {
66
- style.fontFamily = "text-bold";
67
- } else {
68
- style.fontFamily = "text-medium";
69
- }
50
+ fontFamily = "text-medium";
70
51
  }
71
52
 
72
- style.fontSize = fontSizes[size].size;
73
- if (align) {
74
- style.textAlign = align;
75
- }
76
53
  if (!theme?.text) {
77
54
  throw new Error("Text component must be used within TerrenoProvider");
78
55
  }
79
- if (color) {
80
- style.color = theme.text[color];
81
- } else {
82
- style.color = theme.text.primary;
83
- }
84
56
 
85
- if (italic) {
86
- style.fontStyle = "italic";
87
- }
88
- if (underline) {
89
- style.textDecorationLine = "underline";
90
- }
57
+ const style: TextStyle = {
58
+ color: color ? theme.text[color] : theme.text.primary,
59
+ fontFamily,
60
+ fontSize: textFontSizes[size].size,
61
+ ...(align ? {textAlign: align} : {}),
62
+ ...(italic ? {fontStyle: "italic" as const} : {}),
63
+ ...(underline ? {textDecorationLine: "underline" as const} : {}),
64
+ };
91
65
  let lines = 0;
92
66
  if (numberOfLines && truncate && numberOfLines > 1) {
93
67
  console.error(`Cannot truncate Text and have ${numberOfLines} lines`);
package/src/TextField.tsx CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  type StyleProp,
9
9
  TextInput,
10
10
  type TextInputChangeEvent,
11
+ type TextInputInstance,
11
12
  type TextInputProps,
12
13
  View,
13
14
  } from "react-native";
@@ -162,7 +163,7 @@ export const TextField: FC<TextFieldProps> = ({
162
163
  const [focused, setFocused] = useState(false);
163
164
  const [height, setHeight] = useState(rows * 40);
164
165
  const [isValueRevealed, setIsValueRevealed] = useState(false);
165
- const textInputRef = useRef<TextInput | null>(null);
166
+ const textInputRef = useRef<TextInputInstance | null>(null);
166
167
 
167
168
  // Clear stale measured height so the next typed character starts at the default row height.
168
169
  useEffect(() => {
@@ -1,5 +1,5 @@
1
1
  import MaterialIcons from "@expo/vector-icons/MaterialIcons";
2
- import {type FC, useCallback} from "react";
2
+ import {type ComponentProps, type FC, useCallback} from "react";
3
3
  import {Pressable} from "react-native";
4
4
 
5
5
  import {Box} from "./Box";
@@ -25,7 +25,7 @@ const TAP_TARGET_SIZE = 32;
25
25
  * activation key for a checkbox). Not typed by react-native, so it is spread in separately.
26
26
  */
27
27
  interface WebKeyDownEvent {
28
- key: string;
28
+ key?: string;
29
29
  preventDefault: () => void;
30
30
  repeat?: boolean;
31
31
  }
@@ -86,7 +86,7 @@ export const ThumbsUpDownFeedback: FC<ThumbsUpDownFeedbackProps> = ({
86
86
 
87
87
  return (
88
88
  <Pressable
89
- {...webKeyDownProps}
89
+ {...(webKeyDownProps as Pick<ComponentProps<typeof Pressable>, "onKeyDown">)}
90
90
  accessibilityLabel={isPositive ? positiveAccessibilityLabel : negativeAccessibilityLabel}
91
91
  accessibilityRole="checkbox"
92
92
  accessibilityState={{checked: isSelected, disabled, selected: isSelected}}
@@ -54,6 +54,7 @@ import {
54
54
  type TextStyle,
55
55
  TouchableWithoutFeedback,
56
56
  View,
57
+ type ViewInstance,
57
58
  type ViewStyle,
58
59
  } from "react-native";
59
60
  import type {ToastProps as TerrenoToastPayload} from "./Common";
@@ -224,7 +225,7 @@ const ToastItem: FC<ToastProps> = (props) => {
224
225
  onPress,
225
226
  } = props;
226
227
 
227
- const containerRef = useRef<View>(null);
228
+ const containerRef = useRef<ViewInstance>(null);
228
229
  const [animation] = useState(new Animated.Value(0));
229
230
  const panResponderRef = useRef<PanResponderInstance | undefined>(undefined);
230
231
  const panResponderAnimRef = useRef<Animated.ValueXY | undefined>(undefined);
@@ -394,7 +395,7 @@ const ToastItem: FC<ToastProps> = (props) => {
394
395
 
395
396
  const animationStyle = {
396
397
  opacity: animation,
397
- transform: baseTransform as Animated.WithAnimatedObject<ViewStyle>["transform"],
398
+ transform: baseTransform as Animated.WithAnimatedValue<ViewStyle>["transform"],
398
399
  };
399
400
 
400
401
  return (
@@ -103,7 +103,10 @@ const restoreDocument = (): void => {
103
103
  };
104
104
 
105
105
  const flattenStyle = (style: unknown): {pointerEvents?: string; zIndex?: number} => {
106
- return StyleSheet.flatten(style) as {pointerEvents?: string; zIndex?: number};
106
+ return StyleSheet.flatten(style as Parameters<typeof StyleSheet.flatten>[0]) as {
107
+ pointerEvents?: string;
108
+ zIndex?: number;
109
+ };
107
110
  };
108
111
 
109
112
  const portalContainerFor = (node: ReactTestInstance): unknown => {
package/src/Tooltip.tsx CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  Platform,
7
7
  Pressable,
8
8
  View,
9
+ type ViewInstance,
9
10
  type ViewStyle,
10
11
  } from "react-native";
11
12
 
@@ -220,7 +221,7 @@ export const Tooltip: FC<TooltipProps> = ({text, children, idealPosition, includ
220
221
 
221
222
  const showTooltipTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
222
223
  const hideTooltipTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
223
- const childrenWrapperRef = useRef<View>(null);
224
+ const childrenWrapperRef = useRef<ViewInstance>(null);
224
225
  const touched = useRef(false);
225
226
  // Bumped on every hide so async measure callbacks from an earlier show are ignored.
226
227
  const showGeneration = useRef(0);
@@ -4,7 +4,6 @@ import {
4
4
  type EmitterSubscription,
5
5
  type GestureResponderEvent,
6
6
  Keyboard,
7
- type KeyboardEventListener,
8
7
  PanResponder,
9
8
  type PanResponderCallbacks,
10
9
  type PanResponderGestureState,
@@ -147,10 +146,10 @@ describe("UserInactivity", () => {
147
146
  const onAction = mock((_active: boolean) => {});
148
147
  let capturedHideCallback: (() => void) | undefined;
149
148
  const addListenerSpy = spyOn(Keyboard, "addListener").mockImplementation(
150
- (event: string, callback: KeyboardEventListener) => {
149
+ (event: string, callback: () => void) => {
151
150
  if (event === "keyboardDidHide") {
152
151
  // UserInactivity's keyboard handler ignores the event payload.
153
- capturedHideCallback = callback as () => void;
152
+ capturedHideCallback = callback;
154
153
  }
155
154
  return {remove: mock(() => {})} as unknown as EmitterSubscription;
156
155
  }
@@ -1,5 +1,5 @@
1
1
  import {type ReactElement, useEffect, useRef, useState} from "react";
2
- import type {TextInput} from "react-native";
2
+ import type {TextInputInstance} from "react-native";
3
3
 
4
4
  import type {AddressAutocompleteProps} from "./Common";
5
5
  import {GOOGLE_PLACES_API_RESTRICTIONS} from "./Constants";
@@ -37,7 +37,7 @@ export const WebAddressAutocomplete = ({
37
37
  handleAutoCompleteChange,
38
38
  }: AddressAutocompleteProps): ReactElement => {
39
39
  const [scriptLoaded, setScriptLoaded] = useState(true);
40
- const autocompleteInputRef = useRef<TextInput | null>(null);
40
+ const autocompleteInputRef = useRef<TextInputInstance | null>(null);
41
41
 
42
42
  // Load the Google Maps script and initialize the autocomplete.
43
43
  useEffect(() => {
@@ -83,7 +83,7 @@ export const WebAddressAutocomplete = ({
83
83
  disabled={disabled}
84
84
  inputRef={
85
85
  scriptLoaded
86
- ? (ref: TextInput | null): void => {
86
+ ? (ref: TextInputInstance | null): void => {
87
87
  autocompleteInputRef.current = ref;
88
88
  }
89
89
  : undefined
@@ -1,4 +1,12 @@
1
- import {type ReactElement, useCallback, useEffect, useMemo, useRef, useState} from "react";
1
+ import {
2
+ type ReactElement,
3
+ type RefObject,
4
+ useCallback,
5
+ useEffect,
6
+ useMemo,
7
+ useRef,
8
+ useState,
9
+ } from "react";
2
10
  import {
3
11
  Dimensions,
4
12
  type DimensionValue,
@@ -6,10 +14,13 @@ import {
6
14
  Platform,
7
15
  Pressable,
8
16
  ScrollView,
17
+ type ScrollViewInstance,
9
18
  Text,
10
19
  TextInput,
20
+ type TextInputInstance,
11
21
  type TextStyle,
12
22
  View,
23
+ type ViewInstance,
13
24
  type ViewStyle,
14
25
  } from "react-native";
15
26
 
@@ -136,8 +147,8 @@ export const WebDropdownMenu = ({
136
147
  const searchable = !disableSearch;
137
148
  const {theme} = useTheme();
138
149
  const [searchQuery, setSearchQuery] = useState("");
139
- const searchInputRef = useRef<TextInput>(null);
140
- const listScrollRef = useRef<ScrollView>(null);
150
+ const searchInputRef = useRef<TextInputInstance>(null);
151
+ const listScrollRef = useRef<ScrollViewInstance>(null);
141
152
  const listViewportHeightRef = useRef(0);
142
153
  const optionLayoutsRef = useRef<Array<{height: number; offset: number}>>([]);
143
154
 
@@ -509,12 +520,12 @@ export const WebDropdownMenu = ({
509
520
  * the menu lines up beneath it across browsers.
510
521
  */
511
522
  export const useWebDropdownAnchor = (): {
512
- triggerRef: React.RefObject<View | null>;
523
+ triggerRef: RefObject<ViewInstance | null>;
513
524
  anchor: WebDropdownAnchor;
514
525
  cancelPendingMeasurement: () => void;
515
526
  measure: (onMeasured: (anchor: WebDropdownAnchor) => void) => void;
516
527
  } => {
517
- const triggerRef = useRef<View>(null);
528
+ const triggerRef = useRef<ViewInstance>(null);
518
529
  const [anchor, setAnchor] = useState<WebDropdownAnchor>({height: 0, width: 0, x: 0, y: 0});
519
530
  const measurementRequestRef = useRef(0);
520
531
 
@@ -848,6 +848,7 @@ exports[`DataTable renders correctly with basic data 1`] = `
848
848
  },
849
849
  ],
850
850
  "props": {
851
+ "onLayout": [Function],
851
852
  "style": {
852
853
  "borderColor": "#CDCDCD",
853
854
  "borderWidth": 1,
@@ -1720,6 +1721,7 @@ exports[`DataTable renders with alternate row background (default) 1`] = `
1720
1721
  },
1721
1722
  ],
1722
1723
  "props": {
1724
+ "onLayout": [Function],
1723
1725
  "style": {
1724
1726
  "borderColor": "#CDCDCD",
1725
1727
  "borderWidth": 1,
@@ -2592,6 +2594,7 @@ exports[`DataTable renders without alternate row background 1`] = `
2592
2594
  },
2593
2595
  ],
2594
2596
  "props": {
2597
+ "onLayout": [Function],
2595
2598
  "style": {
2596
2599
  "borderColor": "#CDCDCD",
2597
2600
  "borderWidth": 1,
@@ -3596,6 +3599,7 @@ exports[`DataTable renders with pinned columns 1`] = `
3596
3599
  },
3597
3600
  ],
3598
3601
  "props": {
3602
+ "onLayout": [Function],
3599
3603
  "style": {
3600
3604
  "borderColor": "#CDCDCD",
3601
3605
  "borderWidth": 1,
@@ -4468,6 +4472,7 @@ exports[`DataTable renders with custom row height 1`] = `
4468
4472
  },
4469
4473
  ],
4470
4474
  "props": {
4475
+ "onLayout": [Function],
4471
4476
  "style": {
4472
4477
  "borderColor": "#CDCDCD",
4473
4478
  "borderWidth": 1,
@@ -5340,6 +5345,7 @@ exports[`DataTable renders with custom header height 1`] = `
5340
5345
  },
5341
5346
  ],
5342
5347
  "props": {
5348
+ "onLayout": [Function],
5343
5349
  "style": {
5344
5350
  "borderColor": "#CDCDCD",
5345
5351
  "borderWidth": 1,
@@ -6212,6 +6218,7 @@ exports[`DataTable renders with pagination 1`] = `
6212
6218
  },
6213
6219
  ],
6214
6220
  "props": {
6221
+ "onLayout": [Function],
6215
6222
  "style": {
6216
6223
  "borderColor": "#CDCDCD",
6217
6224
  "borderWidth": 1,
@@ -6969,6 +6976,7 @@ exports[`DataTable renders sortable columns 1`] = `
6969
6976
  },
6970
6977
  ],
6971
6978
  "props": {
6979
+ "onLayout": [Function],
6972
6980
  "style": {
6973
6981
  "borderColor": "#CDCDCD",
6974
6982
  "borderWidth": 1,
@@ -7287,6 +7295,7 @@ exports[`DataTable renders with sort indicator 1`] = `
7287
7295
  },
7288
7296
  ],
7289
7297
  "props": {
7298
+ "onLayout": [Function],
7290
7299
  "style": {
7291
7300
  "borderColor": "#CDCDCD",
7292
7301
  "borderWidth": 1,
@@ -8159,6 +8168,7 @@ exports[`DataTable renders with different text sizes 1`] = `
8159
8168
  },
8160
8169
  ],
8161
8170
  "props": {
8171
+ "onLayout": [Function],
8162
8172
  "style": {
8163
8173
  "borderColor": "#CDCDCD",
8164
8174
  "borderWidth": 1,
@@ -9219,6 +9229,7 @@ exports[`DataTable renders with more content component 1`] = `
9219
9229
  },
9220
9230
  ],
9221
9231
  "props": {
9232
+ "onLayout": [Function],
9222
9233
  "style": {
9223
9234
  "borderColor": "#CDCDCD",
9224
9235
  "borderWidth": 1,
@@ -9536,6 +9547,7 @@ exports[`DataTable renders boolean cells correctly 1`] = `
9536
9547
  },
9537
9548
  ],
9538
9549
  "props": {
9550
+ "onLayout": [Function],
9539
9551
  "style": {
9540
9552
  "borderColor": "#CDCDCD",
9541
9553
  "borderWidth": 1,
@@ -9870,6 +9882,7 @@ exports[`DataTable renders empty data 1`] = `
9870
9882
  },
9871
9883
  ],
9872
9884
  "props": {
9885
+ "onLayout": [Function],
9873
9886
  "style": {
9874
9887
  "borderColor": "#CDCDCD",
9875
9888
  "borderWidth": 1,
@@ -1,4 +1,5 @@
1
1
  import {Platform} from "react-native";
2
+ import {getAnnouncementBuildVersion} from "./announcementBuildVersion";
2
3
 
3
4
  export type AnnouncementPlatform = "android" | "ios" | "web";
4
5
 
@@ -11,3 +12,12 @@ export const getAnnouncementPlatform = (): AnnouncementPlatform => {
11
12
  }
12
13
  return "web";
13
14
  };
15
+
16
+ /** `platform` and `version` query params the announcement routes filter by. */
17
+ export const buildAnnouncementParams = (): {platform: AnnouncementPlatform; version?: number} => {
18
+ const version = getAnnouncementBuildVersion();
19
+ return {
20
+ platform: getAnnouncementPlatform(),
21
+ ...(version === undefined ? {} : {version}),
22
+ };
23
+ };
@@ -9,7 +9,7 @@ import {
9
9
  import {act, fireEvent, render, waitFor, within} from "@testing-library/react-native";
10
10
  import {assert} from "chai";
11
11
  import {createRef} from "react";
12
- import type {Text as NativeText, TextProps} from "react-native";
12
+ import type {TextInstance, TextProps} from "react-native";
13
13
  import {ThemeProvider} from "../Theme";
14
14
  import {TimezonePicker} from "../TimezonePicker";
15
15
  import {elementProps, findAllByHostType, renderWithTheme} from "../test-utils";
@@ -67,7 +67,7 @@ const ARCHIVE_INPUT: ConfirmAskInput = {
67
67
 
68
68
  const REPORT_INPUT: ConfirmAskInput = {prompt: "Send the weekly report to the team now?"};
69
69
 
70
- const pendingConfirm = (input: ConfirmAskInput, state: Partial<ChatAsk> = {}): ChatAsk =>
70
+ const pendingConfirm = (input: ConfirmAskInput, state: Partial<ChatAskState> = {}): ChatAsk =>
71
71
  ({input, kind: "confirm", status: "pending", toolCallId: "call_1", ...state}) as ChatAsk;
72
72
 
73
73
  const DRAFT = "# We're live\n\nToday we launched.";
@@ -82,7 +82,7 @@ const DRAFT_INPUT: MarkdownAskInput = {
82
82
  title: "Launch announcement",
83
83
  };
84
84
 
85
- const pendingMarkdown = (input: MarkdownAskInput, state: Partial<ChatAsk> = {}): ChatAsk =>
85
+ const pendingMarkdown = (input: MarkdownAskInput, state: Partial<ChatAskState> = {}): ChatAsk =>
86
86
  ({input, kind: "markdown", status: "pending", toolCallId: "call_1", ...state}) as ChatAsk;
87
87
 
88
88
  const INVOICE_INPUT: FormAskInput = {
@@ -145,7 +145,7 @@ const DEFAULTS_INPUT: FormAskInput = {
145
145
  prompt: "Check the details.",
146
146
  };
147
147
 
148
- const pendingForm = (input: FormAskInput, state: Partial<ChatAsk> = {}): ChatAsk =>
148
+ const pendingForm = (input: FormAskInput, state: Partial<ChatAskState> = {}): ChatAsk =>
149
149
  ({input, kind: "form", status: "pending", toolCallId: "call_1", ...state}) as ChatAsk;
150
150
 
151
151
  const renderCard = (props: Partial<AskCardProps> & Pick<AskCardProps, "ask">) =>
@@ -1010,12 +1010,14 @@ describe("AskCard", () => {
1010
1010
  assert.isNull(card.queryByText("Enter a complete time, or clear it."));
1011
1011
  assert.isNull(card.queryByText("Enter a complete date and time, or clear it."));
1012
1012
  await press(card.getByTestId("ask-card-submit"));
1013
- const response = onSubmit.mock.calls[0]?.[0]?.response;
1014
- const values = response?.action === "accept" ? response.content.values : undefined;
1015
- assert.deepInclude((values ?? {}) as Record<string, unknown>, {
1016
- meeting: "2026-10-01T09:30:00Z",
1017
- reminder: "10:30",
1018
- });
1013
+ assert.deepInclude(
1014
+ (
1015
+ onSubmit.mock.calls[0]?.[0]?.response as unknown as {
1016
+ content: {values: Record<string, unknown>};
1017
+ }
1018
+ )?.content?.values ?? {},
1019
+ {meeting: "2026-10-01T09:30:00Z", reminder: "10:30"}
1020
+ );
1019
1021
  });
1020
1022
 
1021
1023
  it("keeps Submit disabled when the hour of an on-the-hour time is cleared, and keeps the time", async () => {
@@ -1303,7 +1305,7 @@ describe("AskCard", () => {
1303
1305
  });
1304
1306
 
1305
1307
  it("shows the question as an accessible header the host can focus through promptRef", () => {
1306
- const promptRef = createRef<NativeText>();
1308
+ const promptRef = createRef<TextInstance>();
1307
1309
  const prompt = {focus: (): void => {}};
1308
1310
  const {getByRole} = render(
1309
1311
  <AskCard ask={pendingAsk(PLAN_INPUT)} onSubmit={async () => {}} promptRef={promptRef} />,
@@ -1315,7 +1317,7 @@ describe("AskCard", () => {
1315
1317
  );
1316
1318
 
1317
1319
  assert.isOk(getByRole("header", {name: "Which plan should I set up for your workspace?"}));
1318
- assert.strictEqual(promptRef.current, prompt as unknown as NativeText);
1320
+ assert.strictEqual(promptRef.current, prompt as unknown as TextInstance);
1319
1321
  });
1320
1322
 
1321
1323
  it("disables its controls when the host takes no answers", () => {
@@ -1,7 +1,7 @@
1
1
  import {type AskValidationError, validateAskInput} from "@terreno/blocks";
2
2
  import type React from "react";
3
3
  import {useCallback, useRef, useState} from "react";
4
- import type {Text as NativeText} from "react-native";
4
+ import type {TextInstance} from "react-native";
5
5
 
6
6
  import {Box} from "../Box";
7
7
  import type {IconName} from "../Common";
@@ -33,7 +33,7 @@ export interface AskCardProps {
33
33
  * The pending ask's question, an accessible header. Pass it to
34
34
  * `AccessibilityInfo.setAccessibilityFocus` to move screen reader focus to the ask.
35
35
  */
36
- promptRef?: React.Ref<NativeText>;
36
+ promptRef?: React.Ref<TextInstance>;
37
37
  /**
38
38
  * Turns the files picked for a `files` ask into the answer's refs on Submit: uploads
39
39
  * (`{fileId}`) or data URLs (`{url}`). Defaults to data URLs (`resolveAskFilesAsDataUrls`).
package/src/bunSetup.ts CHANGED
@@ -662,11 +662,53 @@ if (typeof globalThis.expo === "undefined") {
662
662
  EventEmitter: EventEmitterClass,
663
663
  NativeModule: class NativeModule {},
664
664
  SharedObject: class SharedObject {},
665
+ SharedRef: class SharedRef {},
665
666
  // noExplicitAny: globalThis.expo is typed by expo-modules-core with many native-only APIs
666
667
  // that aren't needed for these mocks, so we cast through unknown to satisfy the type.
667
668
  } as unknown as typeof globalThis.expo;
668
669
  }
669
670
 
671
+ // Expo 58's published expo-modules-core compiles the type-only SharedRef
672
+ // declaration to `export {}`. Real expo-router internals (Screen → useNavigation)
673
+ // require expo-constants, which then imports expo-modules-core and crashes bun.
674
+ // Mock both packages so tests never load that empty module.
675
+ const MockCodedError = class CodedError extends Error {
676
+ code: string;
677
+ constructor(code: string, message: string) {
678
+ super(message);
679
+ this.code = code;
680
+ }
681
+ };
682
+ const MockSharedRef = class SharedRef {};
683
+ mock.module("expo-constants", () => ({
684
+ default: {
685
+ executionEnvironment: "bare",
686
+ expoConfig: {extra: {router: {}}},
687
+ },
688
+ ExecutionEnvironment: {
689
+ Bare: "bare",
690
+ Standalone: "standalone",
691
+ StoreClient: "storeClient",
692
+ },
693
+ }));
694
+ mock.module("expo-modules-core", () => ({
695
+ CodedError: MockCodedError,
696
+ EventEmitter: class EventEmitter {},
697
+ NativeModule: class NativeModule {},
698
+ requireNativeModule: mock(() => ({})),
699
+ requireOptionalNativeModule: mock(() => null),
700
+ SharedObject: class SharedObject {},
701
+ SharedRef: MockSharedRef,
702
+ }));
703
+ mock.module("expo-modules-core/build/ts-declarations/SharedRef", () => ({
704
+ SharedRef: MockSharedRef,
705
+ }));
706
+ mock.module("expo-router/build/views/Screen", () => ({
707
+ isScreen: mock(() => false),
708
+ Screen: ({children, ...props}: MockComponentProps) =>
709
+ React.createElement("Screen", props, children),
710
+ }));
711
+
670
712
  // Mock expo-router
671
713
  const mockNavigationFonts = {
672
714
  bold: {fontFamily: "System", fontWeight: "600"},