@terreno/ui 0.26.0 → 0.28.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 (83) hide show
  1. package/dist/ActionSheet.js.map +1 -1
  2. package/dist/Box.js +2 -0
  3. package/dist/Box.js.map +1 -1
  4. package/dist/Common.d.ts +8 -7
  5. package/dist/Common.js.map +1 -1
  6. package/dist/ConsentNavigator.js.map +1 -1
  7. package/dist/CustomSelectField.js +2 -2
  8. package/dist/CustomSelectField.js.map +1 -1
  9. package/dist/DateTimeField.js +1 -0
  10. package/dist/DateTimeField.js.map +1 -1
  11. package/dist/EmailField.js +1 -1
  12. package/dist/EmailField.js.map +1 -1
  13. package/dist/Modal.js +7 -2
  14. package/dist/Modal.js.map +1 -1
  15. package/dist/Page.js +1 -0
  16. package/dist/Page.js.map +1 -1
  17. package/dist/PickerSelect.d.ts +4 -5
  18. package/dist/PickerSelect.js +4 -3
  19. package/dist/PickerSelect.js.map +1 -1
  20. package/dist/SelectBadge.js +1 -1
  21. package/dist/SelectBadge.js.map +1 -1
  22. package/dist/SelectField.js +3 -3
  23. package/dist/SelectField.js.map +1 -1
  24. package/dist/SplitPage.js +3 -0
  25. package/dist/SplitPage.js.map +1 -1
  26. package/dist/SplitPage.native.js +2 -0
  27. package/dist/SplitPage.native.js.map +1 -1
  28. package/dist/TapToEdit.js +1 -0
  29. package/dist/TapToEdit.js.map +1 -1
  30. package/dist/ToastNotifications.js.map +1 -1
  31. package/dist/Unifier.js.map +1 -1
  32. package/dist/WebDropdownMenu.d.ts +7 -8
  33. package/dist/WebDropdownMenu.js +4 -3
  34. package/dist/WebDropdownMenu.js.map +1 -1
  35. package/dist/useSubmitConsent.d.ts +1 -1
  36. package/dist/useSubmitConsent.js +1 -1
  37. package/dist/useSubmitConsent.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/ActionSheet.test.tsx +1 -0
  40. package/src/ActionSheet.tsx +2 -0
  41. package/src/Box.test.tsx +56 -0
  42. package/src/Box.tsx +4 -0
  43. package/src/Button.test.tsx +34 -0
  44. package/src/Common.ts +31 -7
  45. package/src/ConsentNavigator.test.tsx +1 -0
  46. package/src/ConsentNavigator.tsx +1 -0
  47. package/src/CustomSelectField.test.tsx +3 -8
  48. package/src/CustomSelectField.tsx +2 -2
  49. package/src/DataTable.test.tsx +1 -0
  50. package/src/DateTimeField.test.tsx +1 -0
  51. package/src/DateTimeField.tsx +1 -0
  52. package/src/EmailField.tsx +1 -1
  53. package/src/Modal.test.tsx +261 -66
  54. package/src/Modal.tsx +7 -2
  55. package/src/ModalSheet.test.tsx +7 -6
  56. package/src/Page.tsx +1 -0
  57. package/src/PickerSelect.test.tsx +23 -18
  58. package/src/PickerSelect.tsx +6 -6
  59. package/src/SelectBadge.test.tsx +1 -2
  60. package/src/SelectBadge.tsx +1 -1
  61. package/src/SelectField.tsx +2 -2
  62. package/src/SplitPage.native.tsx +2 -0
  63. package/src/SplitPage.test.tsx +6 -4
  64. package/src/SplitPage.tsx +3 -0
  65. package/src/TapToEdit.test.tsx +1 -0
  66. package/src/TapToEdit.tsx +2 -0
  67. package/src/Text.test.tsx +29 -0
  68. package/src/TextField.test.tsx +57 -1
  69. package/src/ToastNotifications.test.tsx +1 -0
  70. package/src/ToastNotifications.tsx +1 -0
  71. package/src/Tooltip.test.tsx +1 -1
  72. package/src/Unifier.ts +1 -0
  73. package/src/UpgradeRequiredScreen.test.tsx +40 -0
  74. package/src/UserInactivity.test.tsx +44 -1
  75. package/src/WebDropdownMenu.test.tsx +14 -19
  76. package/src/WebDropdownMenu.tsx +8 -8
  77. package/src/__snapshots__/DataTable.test.tsx.snap +0 -148
  78. package/src/__snapshots__/InfoModalIcon.test.tsx.snap +255 -1088
  79. package/src/__snapshots__/Modal.test.tsx.snap +950 -1108
  80. package/src/bunSetup.ts +24 -0
  81. package/src/types/react-native-swiper-flatlist.d.ts +1 -0
  82. package/src/useSubmitConsent.test.ts +2 -1
  83. package/src/useSubmitConsent.ts +2 -2
@@ -227,12 +227,12 @@ export const SelectBadge = ({
227
227
  return (
228
228
  <WebDropdownMenu
229
229
  anchor={webAnchor}
230
+ disableSearch
230
231
  minWidth={160}
231
232
  onClose={() => setShowPicker(false)}
232
233
  onSelect={(val) => handleOnChange(val)}
233
234
  options={webMenuOptions}
234
235
  optionTextStyle={{fontFamily: "text", fontSize: 12}}
235
- searchable={false}
236
236
  selectedValue={value}
237
237
  testIDPrefix="web_badge"
238
238
  visible={showPicker}
@@ -15,7 +15,7 @@ export const SelectField: FC<SelectFieldProps> = ({
15
15
  options,
16
16
  requireValue = false,
17
17
  placeholder = "Please select an option.",
18
- searchable = true,
18
+ disableSearch = false,
19
19
  title,
20
20
  value,
21
21
  onChange,
@@ -32,6 +32,7 @@ export const SelectField: FC<SelectFieldProps> = ({
32
32
  <View style={{alignSelf: "stretch", minWidth: 0, width: "100%"}}>
33
33
  <RNPickerSelect
34
34
  disabled={disabled}
35
+ disableSearch={disableSearch}
35
36
  items={options}
36
37
  onValueChange={(v) => {
37
38
  if (v === undefined || v === null || v === "") {
@@ -41,7 +42,6 @@ export const SelectField: FC<SelectFieldProps> = ({
41
42
  }
42
43
  }}
43
44
  placeholder={!requireValue ? clearOption : {}}
44
- searchable={searchable}
45
45
  textInputProps={{testID: fieldTestIDs.input}}
46
46
  value={value ?? ""}
47
47
  />
@@ -34,6 +34,7 @@ export const SplitPage = ({
34
34
  const {width} = Dimensions.get("window");
35
35
 
36
36
  const onItemSelect = useCallback(
37
+ // noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
37
38
  // biome-ignore lint/suspicious/noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
38
39
  async (item: ListRenderItemInfo<any>) => {
39
40
  setSelectedId(item.index);
@@ -59,6 +60,7 @@ export const SplitPage = ({
59
60
  return null;
60
61
  }
61
62
 
63
+ // noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
62
64
  // biome-ignore lint/suspicious/noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
63
65
  const renderItem = (itemInfo: ListRenderItemInfo<any>) => {
64
66
  return (
@@ -1,7 +1,7 @@
1
- // biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
2
1
  import {afterAll, afterEach, beforeEach, describe, expect, it, mock} from "bun:test";
3
2
  import {act} from "@testing-library/react-native";
4
3
  import {View} from "react-native";
4
+ import type {ReactTestInstance} from "react-test-renderer";
5
5
 
6
6
  import {SplitPage} from "./SplitPage";
7
7
  import {renderWithTheme} from "./test-utils";
@@ -353,7 +353,7 @@ describe("SplitPage", () => {
353
353
  fireEvent.press(boxes[0]);
354
354
  });
355
355
  const iconButtons = UNSAFE_root.findAll(
356
- (n: any) => n.props?.onClick && n.props?.iconName === "xmark"
356
+ (n: ReactTestInstance) => n.props?.onClick && n.props?.iconName === "xmark"
357
357
  );
358
358
  if (iconButtons.length > 0) {
359
359
  await act(async () => {
@@ -362,7 +362,7 @@ describe("SplitPage", () => {
362
362
  expect(onSelectionChange).toHaveBeenCalledWith(undefined);
363
363
  } else {
364
364
  const closeButtons = UNSAFE_root.findAll(
365
- (n: any) => n.props?.accessibilityLabel === "close"
365
+ (n: ReactTestInstance) => n.props?.accessibilityLabel === "close"
366
366
  );
367
367
  if (closeButtons.length > 0) {
368
368
  await act(async () => {
@@ -449,7 +449,9 @@ describe("SplitPage", () => {
449
449
  <View testID="child-c" />
450
450
  </SplitPage>
451
451
  );
452
- const segmented = UNSAFE_root.findAll((n: any) => n.props?.onChange && n.props?.items);
452
+ const segmented = UNSAFE_root.findAll(
453
+ (n: ReactTestInstance) => n.props?.onChange && n.props?.items
454
+ );
453
455
  if (segmented.length > 0) {
454
456
  await act(async () => {
455
457
  segmented[0].props.onChange(2);
package/src/SplitPage.tsx CHANGED
@@ -40,6 +40,7 @@ export const SplitPage = ({
40
40
  const elementArray = Children.toArray(children).filter((c) => c !== null);
41
41
 
42
42
  const onItemSelect = useCallback(
43
+ // noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
43
44
  // biome-ignore lint/suspicious/noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
44
45
  async (item: ListRenderItemInfo<any>): Promise<void> => {
45
46
  setSelectedId(item.index);
@@ -70,6 +71,7 @@ export const SplitPage = ({
70
71
  return null;
71
72
  }
72
73
 
74
+ // noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
73
75
  // biome-ignore lint/suspicious/noExplicitAny: SplitPage accepts heterogeneous list item shapes from consumers; the generic propagates from listViewData
74
76
  const renderItem = (itemInfo: ListRenderItemInfo<any>) => {
75
77
  return (
@@ -300,6 +302,7 @@ export const SplitPage = ({
300
302
  width="100%"
301
303
  >
302
304
  {loading === true && (
305
+ // noExplicitAny: Spinner color is a token enum but the legacy code passes theme.text.primary (a resolved hex string); preserving original behavior
303
306
  // biome-ignore lint/suspicious/noExplicitAny: Spinner color is a token enum but the legacy code passes theme.text.primary (a resolved hex string); preserving original behavior
304
307
  <Spinner color={theme.text.primary as any} size="md" />
305
308
  )}
@@ -1,3 +1,4 @@
1
+ // noExplicitAny: test mock typing
1
2
  // biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
2
3
  import {describe, expect, it, mock} from "bun:test";
3
4
  import {act, fireEvent} from "@testing-library/react-native";
package/src/TapToEdit.tsx CHANGED
@@ -84,6 +84,7 @@ export const TapToEdit: FC<TapToEditProps> = ({
84
84
  const helperText: string | undefined = propsHelperText;
85
85
 
86
86
  // TODO: Auto focus on input when editing for field types other than text for accessibility
87
+ // noExplicitAny: inputRef references various RN input components (TextInput, etc.) depending on the field type
87
88
  // biome-ignore lint/suspicious/noExplicitAny: inputRef references various RN input components (TextInput, etc.) depending on the field type
88
89
  const inputRef = useRef<any>(null);
89
90
 
@@ -120,6 +121,7 @@ export const TapToEdit: FC<TapToEditProps> = ({
120
121
  row={fieldProps?.type === "textarea" ? 5 : undefined}
121
122
  type={(fieldProps?.type ?? "text") as NonNullable<FieldProps["type"]>}
122
123
  value={value}
124
+ // noExplicitAny: fieldProps is a discriminated union (FieldProps) but the spread loses narrowing; type-checking each variant individually is impractical here
123
125
  // biome-ignore lint/suspicious/noExplicitAny: fieldProps is a discriminated union (FieldProps) but the spread loses narrowing; type-checking each variant individually is impractical here
124
126
  {...(fieldProps as any)}
125
127
  />
package/src/Text.test.tsx CHANGED
@@ -60,6 +60,35 @@ describe("Text", () => {
60
60
  expect(toJSON()).toMatchSnapshot();
61
61
  });
62
62
 
63
+ it("uses the medium-italic font family for larger italic text", () => {
64
+ const {getByText} = renderWithTheme(
65
+ <Text italic size="lg">
66
+ Large italic
67
+ </Text>
68
+ );
69
+ expect((getByText("Large italic").props.style as {fontFamily?: string}).fontFamily).toBe(
70
+ "text-medium-italic"
71
+ );
72
+ });
73
+
74
+ it("uses the bold-italic font family for larger bold italic text", () => {
75
+ const {getByText} = renderWithTheme(
76
+ <Text bold italic size="xl">
77
+ Large bold italic
78
+ </Text>
79
+ );
80
+ expect((getByText("Large bold italic").props.style as {fontFamily?: string}).fontFamily).toBe(
81
+ "text-bold-italic"
82
+ );
83
+ });
84
+
85
+ it("uses the medium font family for larger plain text", () => {
86
+ const {getByText} = renderWithTheme(<Text size="2xl">Extra large plain</Text>);
87
+ expect((getByText("Extra large plain").props.style as {fontFamily?: string}).fontFamily).toBe(
88
+ "text-medium"
89
+ );
90
+ });
91
+
63
92
  it("renders underlined text", () => {
64
93
  const {toJSON} = renderWithTheme(<Text underline>Underlined text</Text>);
65
94
  expect(toJSON()).toMatchSnapshot();
@@ -1,4 +1,4 @@
1
- import {afterEach, beforeEach, describe, expect, it, mock} from "bun:test";
1
+ import {afterEach, beforeEach, describe, expect, it, mock, spyOn} from "bun:test";
2
2
  import {act, fireEvent, userEvent} from "@testing-library/react-native";
3
3
  import {TextField} from "./TextField";
4
4
  import {renderWithTheme} from "./test-utils";
@@ -484,4 +484,60 @@ describe("TextField", () => {
484
484
  expect(component.toJSON()).toMatchSnapshot();
485
485
  });
486
486
  });
487
+
488
+ describe("platform, unsupported types, and content sizing", () => {
489
+ const PlatformModule = require("react-native").Platform;
490
+
491
+ it("renders with the web outline style when running on web", () => {
492
+ const savedOS = PlatformModule.OS;
493
+ try {
494
+ PlatformModule.OS = "web";
495
+ const {getByDisplayValue} = renderWithTheme(
496
+ <TextField onChange={mockOnChange} value="web value" />
497
+ );
498
+ expect(getByDisplayValue("web value")).toBeTruthy();
499
+ } finally {
500
+ PlatformModule.OS = savedOS;
501
+ }
502
+ });
503
+
504
+ it("warns for not-yet-supported field types", () => {
505
+ const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
506
+ try {
507
+ renderWithTheme(<TextField onChange={mockOnChange} type="numberRange" value="" />);
508
+ expect(warnSpy).toHaveBeenCalledWith("numberRange is not yet supported");
509
+ } finally {
510
+ warnSpy.mockRestore();
511
+ }
512
+ });
513
+
514
+ it("ignores content size changes when grow is disabled", () => {
515
+ const {getByDisplayValue} = renderWithTheme(
516
+ <TextField multiline onChange={mockOnChange} value="" />
517
+ );
518
+ const input = getByDisplayValue("");
519
+ // Without `grow`, onContentSizeChange returns early and must not throw.
520
+ expect(() =>
521
+ fireEvent(input, "contentSizeChange", {nativeEvent: {contentSize: {height: 999}}})
522
+ ).not.toThrow();
523
+ });
524
+
525
+ it("grows to the reported content height when grow is enabled", () => {
526
+ const {getByDisplayValue} = renderWithTheme(
527
+ <TextField grow multiline onChange={mockOnChange} value="" />
528
+ );
529
+ const input = getByDisplayValue("");
530
+ expect(() =>
531
+ fireEvent(input, "contentSizeChange", {nativeEvent: {contentSize: {height: 120}}})
532
+ ).not.toThrow();
533
+ });
534
+
535
+ it("invokes the onFocus callback when the input is focused", () => {
536
+ const {getByDisplayValue} = renderWithTheme(
537
+ <TextField onChange={mockOnChange} onFocus={mockOnFocus} value="" />
538
+ );
539
+ fireEvent(getByDisplayValue(""), "focus");
540
+ expect(mockOnFocus).toHaveBeenCalledTimes(1);
541
+ });
542
+ });
487
543
  });
@@ -1200,6 +1200,7 @@ describe("ToastNotifications", () => {
1200
1200
  });
1201
1201
 
1202
1202
  describe("Toast with swipe and pan responder interaction", () => {
1203
+ // noExplicitAny: capturing PanResponder internals for test
1203
1204
  // biome-ignore lint/suspicious/noExplicitAny: capturing PanResponder internals for test
1204
1205
  type PanConfig = any;
1205
1206
  let capturedPanConfigs: PanConfig[] = [];
@@ -177,6 +177,7 @@ export interface ToastOptions {
177
177
  /**
178
178
  * Payload data for custom toasts. You can pass whatever you want
179
179
  */
180
+ // noExplicitAny: This is the public API of a vendored 3rd-party library (react-native-toast-notifications); the data field is an opaque user-provided payload. Tightening to unknown breaks downstream consumers that spread data into Toast (e.g. TerrenoProvider) without refactor.
180
181
  // biome-ignore lint/suspicious/noExplicitAny: This is the public API of a vendored 3rd-party library (react-native-toast-notifications); the data field is an opaque user-provided payload. Tightening to unknown breaks downstream consumers that spread data into Toast (e.g. TerrenoProvider) without refactor.
181
182
  data?: any;
182
183
 
@@ -776,7 +776,7 @@ describe("Tooltip", () => {
776
776
  (c: TestNode) => c.props && (c.props as {hitSlop?: object}).hitSlop !== undefined
777
777
  ) as TestNode | undefined;
778
778
  await act(async () => {
779
- (wrapper?.props as {onPress?: () => void}).onPress?.();
779
+ (wrapper?.props as {onPress?: () => void} | undefined)?.onPress?.();
780
780
  });
781
781
  expect(queryByTestId("tooltip-container")).toBeNull();
782
782
  });
package/src/Unifier.ts CHANGED
@@ -8,6 +8,7 @@ import {requestPermissions} from "./Permissions";
8
8
 
9
9
  declare global {
10
10
  interface Window {
11
+ // noExplicitAny: Google Maps JS SDK global type is loaded dynamically and not bundled as a typed dependency
11
12
  // biome-ignore lint/suspicious/noExplicitAny: Google Maps JS SDK global type is loaded dynamically and not bundled as a typed dependency
12
13
  google: any;
13
14
  }
@@ -0,0 +1,40 @@
1
+ import {describe, expect, it, mock} from "bun:test";
2
+ import {fireEvent, waitFor} from "@testing-library/react-native";
3
+
4
+ import {renderWithTheme} from "./test-utils";
5
+ import {UpgradeRequiredScreen} from "./UpgradeRequiredScreen";
6
+
7
+ describe("UpgradeRequiredScreen", () => {
8
+ it("renders the heading, message, and update button by default", () => {
9
+ const {getByText} = renderWithTheme(
10
+ <UpgradeRequiredScreen message="A new version is available" onUpdate={() => {}} />
11
+ );
12
+
13
+ expect(getByText("Update Required")).toBeTruthy();
14
+ expect(getByText("A new version is available")).toBeTruthy();
15
+ expect(getByText("Update")).toBeTruthy();
16
+ });
17
+
18
+ it("invokes onUpdate when the update button is pressed", async () => {
19
+ const onUpdate = mock(() => {});
20
+ const {getByText} = renderWithTheme(
21
+ <UpgradeRequiredScreen canUpdate message="Please update now" onUpdate={onUpdate} />
22
+ );
23
+
24
+ fireEvent.press(getByText("Update"));
25
+
26
+ await waitFor(() => {
27
+ expect(onUpdate).toHaveBeenCalledTimes(1);
28
+ });
29
+ });
30
+
31
+ it("shows contact-support text instead of the button when canUpdate is false", () => {
32
+ const {getByText, queryByText} = renderWithTheme(
33
+ <UpgradeRequiredScreen canUpdate={false} message="No update path" onUpdate={() => {}} />
34
+ );
35
+
36
+ expect(getByText("No update path")).toBeTruthy();
37
+ expect(getByText("Please contact support or check your app store for an update.")).toBeTruthy();
38
+ expect(queryByText("Update")).toBeNull();
39
+ });
40
+ });
@@ -1,6 +1,14 @@
1
1
  import {describe, expect, it, mock, spyOn} from "bun:test";
2
2
  import {act} from "@testing-library/react-native";
3
- import {type EmitterSubscription, Keyboard} from "react-native";
3
+ import {
4
+ type EmitterSubscription,
5
+ type GestureResponderEvent,
6
+ Keyboard,
7
+ PanResponder,
8
+ type PanResponderCallbacks,
9
+ type PanResponderGestureState,
10
+ type PanResponderInstance,
11
+ } from "react-native";
4
12
 
5
13
  import {Text} from "./Text";
6
14
  import {renderWithTheme} from "./test-utils";
@@ -165,4 +173,39 @@ describe("UserInactivity", () => {
165
173
  expect(onAction).toHaveBeenCalledWith(true);
166
174
  addListenerSpy.mockRestore();
167
175
  });
176
+
177
+ it("resets the inactivity timer when a pan responder capture handler fires", () => {
178
+ const onAction = mock((_active: boolean) => {});
179
+ let capturedConfig: PanResponderCallbacks | undefined;
180
+ const originalCreate = PanResponder.create;
181
+ PanResponder.create = (config: PanResponderCallbacks): PanResponderInstance => {
182
+ capturedConfig = config;
183
+ return originalCreate(config);
184
+ };
185
+
186
+ try {
187
+ const {unmount} = renderWithTheme(
188
+ <UserInactivity onAction={onAction} skipKeyboard={true}>
189
+ <Text>Test Content</Text>
190
+ </UserInactivity>
191
+ );
192
+
193
+ expect(capturedConfig).toBeDefined();
194
+
195
+ let shouldSet: boolean | undefined;
196
+ act(() => {
197
+ shouldSet = capturedConfig?.onStartShouldSetPanResponderCapture?.(
198
+ {} as unknown as GestureResponderEvent,
199
+ {} as unknown as PanResponderGestureState
200
+ );
201
+ });
202
+
203
+ expect(shouldSet).toBe(false);
204
+ act(() => {
205
+ unmount();
206
+ });
207
+ } finally {
208
+ PanResponder.create = originalCreate;
209
+ }
210
+ });
168
211
  });
@@ -175,10 +175,10 @@ describe("WebDropdownMenu", () => {
175
175
  const {getByText} = renderWithTheme(
176
176
  <WebDropdownMenu
177
177
  anchor={anchor}
178
+ disableSearch
178
179
  onClose={() => {}}
179
180
  onSelect={() => {}}
180
181
  options={optsWithHelper}
181
- searchable={false}
182
182
  visible
183
183
  />
184
184
  );
@@ -221,10 +221,10 @@ describe("WebDropdownMenu positioning", () => {
221
221
  const {getByTestId} = renderWithTheme(
222
222
  <WebDropdownMenu
223
223
  anchor={bottomAnchor}
224
+ disableSearch
224
225
  onClose={() => {}}
225
226
  onSelect={() => {}}
226
227
  options={options}
227
- searchable={false}
228
228
  visible
229
229
  />
230
230
  );
@@ -242,10 +242,10 @@ describe("WebDropdownMenu positioning", () => {
242
242
  const {getByTestId} = renderWithTheme(
243
243
  <WebDropdownMenu
244
244
  anchor={topAnchor}
245
+ disableSearch
245
246
  onClose={() => {}}
246
247
  onSelect={() => {}}
247
248
  options={options}
248
- searchable={false}
249
249
  visible
250
250
  />
251
251
  );
@@ -268,10 +268,10 @@ describe("WebDropdownMenu positioning", () => {
268
268
  const {getByTestId} = renderWithTheme(
269
269
  <WebDropdownMenu
270
270
  anchor={midAnchor}
271
+ disableSearch
271
272
  onClose={() => {}}
272
273
  onSelect={() => {}}
273
274
  options={options}
274
- searchable={false}
275
275
  visible
276
276
  />
277
277
  );
@@ -288,7 +288,7 @@ describe("WebDropdownMenu positioning", () => {
288
288
  });
289
289
  });
290
290
 
291
- describe("WebDropdownMenu searchable", () => {
291
+ describe("WebDropdownMenu disableSearch", () => {
292
292
  const anchor = {height: 40, width: 200, x: 16, y: 32};
293
293
  const options = [
294
294
  {label: "Apple", value: "apple"},
@@ -297,7 +297,7 @@ describe("WebDropdownMenu searchable", () => {
297
297
  {label: "Avocado", value: "avocado"},
298
298
  ];
299
299
 
300
- it("renders a search input by default (searchable defaults to true)", () => {
300
+ it("renders a search input by default (search is enabled when disableSearch is omitted)", () => {
301
301
  const {getByTestId} = renderWithTheme(
302
302
  <WebDropdownMenu
303
303
  anchor={anchor}
@@ -310,14 +310,14 @@ describe("WebDropdownMenu searchable", () => {
310
310
  expect(getByTestId("web_dropdown_search")).toBeTruthy();
311
311
  });
312
312
 
313
- it("does not render a search input when searchable is false", () => {
313
+ it("does not render a search input when disableSearch is true", () => {
314
314
  const {queryByTestId} = renderWithTheme(
315
315
  <WebDropdownMenu
316
316
  anchor={anchor}
317
+ disableSearch
317
318
  onClose={() => {}}
318
319
  onSelect={() => {}}
319
320
  options={options}
320
- searchable={false}
321
321
  visible
322
322
  />
323
323
  );
@@ -331,7 +331,6 @@ describe("WebDropdownMenu searchable", () => {
331
331
  onClose={() => {}}
332
332
  onSelect={() => {}}
333
333
  options={options}
334
- searchable
335
334
  visible
336
335
  />
337
336
  );
@@ -350,7 +349,6 @@ describe("WebDropdownMenu searchable", () => {
350
349
  onClose={() => {}}
351
350
  onSelect={() => {}}
352
351
  options={options}
353
- searchable
354
352
  visible
355
353
  />
356
354
  );
@@ -368,7 +366,6 @@ describe("WebDropdownMenu searchable", () => {
368
366
  onClose={() => {}}
369
367
  onSelect={onSelect}
370
368
  options={options}
371
- searchable
372
369
  visible
373
370
  />
374
371
  );
@@ -386,7 +383,6 @@ describe("WebDropdownMenu searchable", () => {
386
383
  onClose={() => {}}
387
384
  onSelect={() => {}}
388
385
  options={options}
389
- searchable
390
386
  visible
391
387
  />
392
388
  );
@@ -403,7 +399,6 @@ describe("WebDropdownMenu searchable", () => {
403
399
  onClose={() => {}}
404
400
  onSelect={() => {}}
405
401
  options={options}
406
- searchable
407
402
  visible
408
403
  />
409
404
  );
@@ -420,10 +415,10 @@ describe("WebDropdownMenu searchable", () => {
420
415
  const {getByTestId, queryByTestId} = renderWithTheme(
421
416
  <WebDropdownMenu
422
417
  anchor={anchor}
418
+ disableSearch
423
419
  onClose={() => {}}
424
420
  onSelect={() => {}}
425
421
  options={[]}
426
- searchable={false}
427
422
  showEmptyStateWhenNoOptions
428
423
  visible
429
424
  />
@@ -499,11 +494,11 @@ describe("WebDropdownMenu keepTriggerFocus portal overlay", () => {
499
494
  return renderWithTheme(
500
495
  <WebDropdownMenu
501
496
  anchor={anchor}
497
+ disableSearch
502
498
  keepTriggerFocus
503
499
  onClose={() => {}}
504
500
  onSelect={() => {}}
505
501
  options={options}
506
- searchable={false}
507
502
  visible
508
503
  {...props}
509
504
  />
@@ -596,11 +591,11 @@ describe("WebDropdownMenu centered presentation", () => {
596
591
  const {getByTestId} = renderWithTheme(
597
592
  <WebDropdownMenu
598
593
  anchor={anchor}
594
+ disableSearch
599
595
  onClose={() => {}}
600
596
  onSelect={() => {}}
601
597
  options={options}
602
598
  presentation="centered"
603
- searchable={false}
604
599
  visible
605
600
  />
606
601
  );
@@ -730,10 +725,10 @@ describe("WebDropdownMenu layout callbacks", () => {
730
725
  const {root} = renderWithTheme(
731
726
  <WebDropdownMenu
732
727
  anchor={anchor}
728
+ disableSearch
733
729
  onClose={() => {}}
734
730
  onSelect={() => {}}
735
731
  options={options}
736
- searchable={false}
737
732
  selectedIndex={1}
738
733
  visible
739
734
  />
@@ -752,10 +747,10 @@ describe("WebDropdownMenu layout callbacks", () => {
752
747
  const {getByTestId} = renderWithTheme(
753
748
  <WebDropdownMenu
754
749
  anchor={anchor}
750
+ disableSearch
755
751
  onClose={() => {}}
756
752
  onSelect={() => {}}
757
753
  options={options}
758
- searchable={false}
759
754
  selectedIndex={1}
760
755
  visible
761
756
  />
@@ -776,10 +771,10 @@ describe("WebDropdownMenu layout callbacks", () => {
776
771
  const {getByTestId} = renderWithTheme(
777
772
  <WebDropdownMenu
778
773
  anchor={anchor}
774
+ disableSearch
779
775
  onClose={() => {}}
780
776
  onSelect={() => {}}
781
777
  options={options}
782
- searchable={false}
783
778
  visible
784
779
  />
785
780
  );
@@ -69,12 +69,11 @@ export interface WebDropdownMenuProps {
69
69
  /** Prefix for the testIDs on the menu / backdrop / option nodes. */
70
70
  testIDPrefix?: string;
71
71
  /**
72
- * When true, renders a search input at the top of the dropdown that
73
- * filters options by label as the user types. The filter resets each
74
- * time the menu opens.
75
- * @default true
72
+ * When true, hides the type-to-filter search input at the top of the dropdown.
73
+ * The filter resets each time the menu opens. Search is enabled by default.
74
+ * @default false
76
75
  */
77
- searchable?: boolean;
76
+ disableSearch?: boolean;
78
77
  /**
79
78
  * When true and `options` is empty, shows a "No matching options" message.
80
79
  * Used when the parent filters options externally (e.g. search in the trigger).
@@ -105,10 +104,10 @@ interface PressableWebState {
105
104
  * via `useWebDropdownAnchor` (or an equivalent measurement) when using anchored
106
105
  * presentation.
107
106
  *
108
- * When `searchable` is true a text input appears at the top of the menu so
107
+ * When search is enabled a text input appears at the top of the menu so
109
108
  * the user can type to filter options by label. `RNPickerSelect` handles
110
109
  * search in the trigger field on web instead and passes pre-filtered options
111
- * with `searchable={false}`.
110
+ * with `disableSearch={true}`.
112
111
  */
113
112
  export const WebDropdownMenu = ({
114
113
  visible,
@@ -122,11 +121,12 @@ export const WebDropdownMenu = ({
122
121
  minWidth,
123
122
  optionTextStyle,
124
123
  testIDPrefix = "web_dropdown",
125
- searchable = true,
124
+ disableSearch = false,
126
125
  showEmptyStateWhenNoOptions = false,
127
126
  keepTriggerFocus = false,
128
127
  presentation = "anchored",
129
128
  }: WebDropdownMenuProps): ReactElement => {
129
+ const searchable = !disableSearch;
130
130
  const {theme} = useTheme();
131
131
  const [searchQuery, setSearchQuery] = useState("");
132
132
  const searchInputRef = useRef<TextInput>(null);