@terreno/ui 0.27.0 → 0.29.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 (49) hide show
  1. package/dist/Common.d.ts +97 -7
  2. package/dist/Common.js.map +1 -1
  3. package/dist/CustomSelectField.js +2 -2
  4. package/dist/CustomSelectField.js.map +1 -1
  5. package/dist/PickerSelect.d.ts +4 -5
  6. package/dist/PickerSelect.js +4 -3
  7. package/dist/PickerSelect.js.map +1 -1
  8. package/dist/SelectBadge.js +1 -1
  9. package/dist/SelectBadge.js.map +1 -1
  10. package/dist/SelectField.js +3 -3
  11. package/dist/SelectField.js.map +1 -1
  12. package/dist/Signature.d.ts +3 -1
  13. package/dist/Signature.js +4 -3
  14. package/dist/Signature.js.map +1 -1
  15. package/dist/Signature.native.d.ts +2 -0
  16. package/dist/Signature.native.js +2 -2
  17. package/dist/Signature.native.js.map +1 -1
  18. package/dist/SignatureCaptureField.d.ts +13 -0
  19. package/dist/SignatureCaptureField.js +69 -0
  20. package/dist/SignatureCaptureField.js.map +1 -0
  21. package/dist/TypedSignatureField.d.ts +18 -0
  22. package/dist/TypedSignatureField.js +102 -0
  23. package/dist/TypedSignatureField.js.map +1 -0
  24. package/dist/WebDropdownMenu.d.ts +7 -8
  25. package/dist/WebDropdownMenu.js +4 -3
  26. package/dist/WebDropdownMenu.js.map +1 -1
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +2 -0
  29. package/dist/index.js.map +1 -1
  30. package/package.json +5 -1
  31. package/src/Common.ts +105 -7
  32. package/src/CustomSelectField.test.tsx +3 -8
  33. package/src/CustomSelectField.tsx +2 -2
  34. package/src/PickerSelect.test.tsx +22 -18
  35. package/src/PickerSelect.tsx +6 -6
  36. package/src/SelectBadge.tsx +1 -1
  37. package/src/SelectField.tsx +2 -2
  38. package/src/Signature.native.tsx +10 -2
  39. package/src/Signature.tsx +5 -0
  40. package/src/SignatureCaptureField.test.tsx +135 -0
  41. package/src/SignatureCaptureField.tsx +172 -0
  42. package/src/TypedSignatureField.test.tsx +113 -0
  43. package/src/TypedSignatureField.tsx +181 -0
  44. package/src/WebDropdownMenu.test.tsx +14 -19
  45. package/src/WebDropdownMenu.tsx +8 -8
  46. package/src/__snapshots__/SignatureCaptureField.test.tsx.snap +51 -0
  47. package/src/__snapshots__/TypedSignatureField.test.tsx.snap +372 -0
  48. package/src/bunSetup.ts +28 -0
  49. package/src/index.tsx +2 -0
@@ -0,0 +1,113 @@
1
+ import {describe, expect, it, mock} from "bun:test";
2
+ import {fireEvent} from "@testing-library/react-native";
3
+
4
+ import type {TypedSignatureValue} from "./Common";
5
+ import {DEFAULT_SIGNATURE_FONTS, TypedSignatureField} from "./TypedSignatureField";
6
+ import {renderWithTheme} from "./test-utils";
7
+
8
+ describe("TypedSignatureField", () => {
9
+ const defaultProps = {
10
+ onChange: () => {},
11
+ };
12
+
13
+ it("component is defined", () => {
14
+ expect(TypedSignatureField).toBeDefined();
15
+ expect(typeof TypedSignatureField).toBe("function");
16
+ });
17
+
18
+ it("exposes a non-empty set of default fonts", () => {
19
+ expect(DEFAULT_SIGNATURE_FONTS.length).toBeGreaterThan(0);
20
+ for (const font of DEFAULT_SIGNATURE_FONTS) {
21
+ expect(font.key).toBeTruthy();
22
+ expect(font.label).toBeTruthy();
23
+ expect(font.fontFamily).toBeTruthy();
24
+ }
25
+ });
26
+
27
+ it("renders correctly with default props", () => {
28
+ const {toJSON} = renderWithTheme(<TypedSignatureField {...defaultProps} />);
29
+ expect(toJSON()).toMatchSnapshot();
30
+ });
31
+
32
+ it("renders the default title and a preview of the typed name", () => {
33
+ const {getByText, getAllByText} = renderWithTheme(
34
+ <TypedSignatureField {...defaultProps} value={{fontKey: "caveat", typedName: "Jane Doe"}} />
35
+ );
36
+ expect(getByText("Signature")).toBeTruthy();
37
+ // Name appears in both the input value and the live preview.
38
+ expect(getAllByText("Jane Doe").length).toBeGreaterThan(0);
39
+ });
40
+
41
+ it("renders each font option as a pressable label", () => {
42
+ const {getByText} = renderWithTheme(<TypedSignatureField {...defaultProps} />);
43
+ for (const font of DEFAULT_SIGNATURE_FONTS) {
44
+ expect(getByText(font.label)).toBeTruthy();
45
+ }
46
+ });
47
+
48
+ it("emits the typed name with the current font key when the name changes", () => {
49
+ const onChange = mock((_v: TypedSignatureValue) => {});
50
+ const {UNSAFE_getAllByProps} = renderWithTheme(
51
+ <TypedSignatureField onChange={onChange} value={{fontKey: "great-vibes", typedName: ""}} />
52
+ );
53
+
54
+ const inputs = UNSAFE_getAllByProps({}).filter(
55
+ (el) => typeof el.props?.onChangeText === "function"
56
+ );
57
+ expect(inputs.length).toBeGreaterThan(0);
58
+ inputs[0].props.onChangeText("Sam Smith");
59
+
60
+ expect(onChange).toHaveBeenCalledWith({fontKey: "great-vibes", typedName: "Sam Smith"});
61
+ });
62
+
63
+ it("emits the selected font key while preserving the typed name", () => {
64
+ const onChange = mock((_v: TypedSignatureValue) => {});
65
+ const {getByText} = renderWithTheme(
66
+ <TypedSignatureField onChange={onChange} value={{fontKey: "caveat", typedName: "Jane Doe"}} />
67
+ );
68
+
69
+ fireEvent.press(getByText("Great Vibes"));
70
+
71
+ expect(onChange).toHaveBeenCalledWith({fontKey: "great-vibes", typedName: "Jane Doe"});
72
+ });
73
+
74
+ it("falls back to the first font when the stored font key is unknown", () => {
75
+ const onChange = mock((_v: TypedSignatureValue) => {});
76
+ const {UNSAFE_getAllByProps} = renderWithTheme(
77
+ <TypedSignatureField onChange={onChange} value={{fontKey: "does-not-exist", typedName: ""}} />
78
+ );
79
+
80
+ const inputs = UNSAFE_getAllByProps({}).filter(
81
+ (el) => typeof el.props?.onChangeText === "function"
82
+ );
83
+ inputs[0].props.onChangeText("Ann Lee");
84
+
85
+ expect(onChange).toHaveBeenCalledWith({
86
+ fontKey: DEFAULT_SIGNATURE_FONTS[0].key,
87
+ typedName: "Ann Lee",
88
+ });
89
+ });
90
+
91
+ it("falls back to the bundled fonts when an empty list is supplied", () => {
92
+ const onChange = mock((_v: TypedSignatureValue) => {});
93
+ // An empty `fonts` list must not crash — the field falls back to the bundled defaults.
94
+ const {getByText} = renderWithTheme(<TypedSignatureField fonts={[]} onChange={onChange} />);
95
+
96
+ for (const font of DEFAULT_SIGNATURE_FONTS) {
97
+ expect(getByText(font.label)).toBeTruthy();
98
+ }
99
+
100
+ fireEvent.press(getByText(DEFAULT_SIGNATURE_FONTS[0].label));
101
+ expect(onChange).toHaveBeenCalledWith({
102
+ fontKey: DEFAULT_SIGNATURE_FONTS[0].key,
103
+ typedName: "",
104
+ });
105
+ });
106
+
107
+ it("renders an error message when errorText is provided", () => {
108
+ const {getByText} = renderWithTheme(
109
+ <TypedSignatureField {...defaultProps} errorText="Signature is required" />
110
+ );
111
+ expect(getByText("Signature is required")).toBeTruthy();
112
+ });
113
+ });
@@ -0,0 +1,181 @@
1
+ import {Caveat_400Regular} from "@expo-google-fonts/caveat";
2
+ import {DancingScript_400Regular} from "@expo-google-fonts/dancing-script";
3
+ import {GreatVibes_400Regular} from "@expo-google-fonts/great-vibes";
4
+ import {Sacramento_400Regular} from "@expo-google-fonts/sacramento";
5
+ import {useFonts} from "expo-font";
6
+ import type {ReactElement} from "react";
7
+ import {Text as NativeText, Pressable, View} from "react-native";
8
+
9
+ import type {SignatureFont, TypedSignatureFieldProps, TypedSignatureValue} from "./Common";
10
+ import {FieldError} from "./fieldElements/FieldError";
11
+ import {FieldHelperText} from "./fieldElements/FieldHelperText";
12
+ import {FieldTitle} from "./fieldElements/FieldTitle";
13
+ import {TextField} from "./TextField";
14
+ import {useTheme} from "./Theme";
15
+ import {resolveFieldTestIDsFromProps} from "./testing/resolveTestId";
16
+
17
+ /**
18
+ * Font families registered by this component via expo-font. Prefixed with "signature-" to
19
+ * avoid colliding with the app's text/heading font families.
20
+ */
21
+ const SIGNATURE_FONT_MODULES = {
22
+ "signature-caveat": Caveat_400Regular,
23
+ "signature-dancing-script": DancingScript_400Regular,
24
+ "signature-great-vibes": GreatVibes_400Regular,
25
+ "signature-sacramento": Sacramento_400Regular,
26
+ } as const;
27
+
28
+ /**
29
+ * The default set of signature typefaces bundled with the library. Consumers persist the
30
+ * `key`; the `fontFamily` values match the families loaded by this component.
31
+ */
32
+ export const DEFAULT_SIGNATURE_FONTS: SignatureFont[] = [
33
+ {fontFamily: "signature-dancing-script", key: "dancing-script", label: "Dancing Script"},
34
+ {fontFamily: "signature-great-vibes", key: "great-vibes", label: "Great Vibes"},
35
+ {fontFamily: "signature-sacramento", key: "sacramento", label: "Sacramento"},
36
+ {fontFamily: "signature-caveat", key: "caveat", label: "Caveat"},
37
+ ];
38
+
39
+ /**
40
+ * Resolves the currently selected font from the value, falling back to the first font when
41
+ * the stored `fontKey` is unknown (e.g. a font was removed) or no value is set yet.
42
+ */
43
+ const resolveSelectedFont = (
44
+ fonts: SignatureFont[],
45
+ fontKey: string | undefined
46
+ ): SignatureFont => {
47
+ return fonts.find((font) => font.key === fontKey) ?? fonts[0];
48
+ };
49
+
50
+ /**
51
+ * A cross-platform typed signature field. The signer types their name and picks a font from a
52
+ * live-previewing picker; the same UI and output are produced on web and native. Emits a
53
+ * {@link TypedSignatureValue} (typed name + font key) on every change so parents can gate
54
+ * "signature required" and persist the result directly.
55
+ *
56
+ * Font fidelity depends on the chosen font families being loaded. The bundled default fonts
57
+ * are loaded by this component; when a custom `fonts` list is supplied the consumer must load
58
+ * those families themselves.
59
+ */
60
+ export const TypedSignatureField = ({
61
+ title = "Signature",
62
+ value,
63
+ onChange,
64
+ fonts = DEFAULT_SIGNATURE_FONTS,
65
+ nameLabel = "Full name",
66
+ placeholder = "Type your full name",
67
+ helperText,
68
+ errorText,
69
+ disabled = false,
70
+ testID,
71
+ testIDs,
72
+ }: TypedSignatureFieldProps): ReactElement => {
73
+ const {theme} = useTheme();
74
+ // Load the bundled signature fonts. Rendering is not blocked on load — previews fall back to
75
+ // the system font briefly, then re-render once the families are available.
76
+ useFonts(SIGNATURE_FONT_MODULES);
77
+
78
+ const fieldTestIDs = resolveFieldTestIDsFromProps({testID, testIDs});
79
+
80
+ // Guard against an empty `fonts` list: `fonts` is a public prop, so a caller can legitimately
81
+ // pass `[]`. Fall back to the bundled defaults so the field always has a usable font rather
82
+ // than dereferencing `undefined` on the first render.
83
+ const resolvedFonts = fonts.length > 0 ? fonts : DEFAULT_SIGNATURE_FONTS;
84
+
85
+ const typedName = value?.typedName ?? "";
86
+ const selectedFont = resolveSelectedFont(resolvedFonts, value?.fontKey);
87
+ const hasName = typedName.trim().length > 0;
88
+
89
+ const emitChange = (next: Partial<TypedSignatureValue>): void => {
90
+ onChange({
91
+ fontKey: next.fontKey ?? selectedFont.key,
92
+ typedName: next.typedName ?? typedName,
93
+ });
94
+ };
95
+
96
+ return (
97
+ <View style={{flexDirection: "column", width: "100%"}} {...(testID ? {testID} : {})}>
98
+ {Boolean(title) && <FieldTitle testID={fieldTestIDs.label} text={title} />}
99
+ {Boolean(errorText) && <FieldError testID={fieldTestIDs.error} text={errorText!} />}
100
+
101
+ <View style={{marginTop: 8}}>
102
+ <TextField
103
+ disabled={disabled}
104
+ onChange={(nextName) => emitChange({typedName: nextName})}
105
+ placeholder={placeholder}
106
+ testID={fieldTestIDs.input}
107
+ title={nameLabel}
108
+ type="text"
109
+ value={typedName}
110
+ />
111
+ </View>
112
+
113
+ {/* Font picker: each option renders its own label in its own typeface so the signer can
114
+ compare styles before selecting. */}
115
+ <View style={{flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 12}}>
116
+ {resolvedFonts.map((font) => {
117
+ const isSelected = font.key === selectedFont.key;
118
+ return (
119
+ <Pressable
120
+ accessibilityHint="Sets the style of your signature"
121
+ accessibilityLabel={`Signature font ${font.label}`}
122
+ accessibilityState={{disabled, selected: isSelected}}
123
+ aria-role="button"
124
+ disabled={disabled}
125
+ hitSlop={8}
126
+ key={font.key}
127
+ onPress={() => emitChange({fontKey: font.key})}
128
+ style={{
129
+ backgroundColor: isSelected ? theme.surface.neutralLight : theme.surface.base,
130
+ borderColor: isSelected ? theme.border.activeAccent : theme.border.default,
131
+ borderRadius: 8,
132
+ borderWidth: isSelected ? 2 : 1,
133
+ minWidth: 96,
134
+ opacity: disabled ? 0.5 : 1,
135
+ paddingHorizontal: 12,
136
+ paddingVertical: 8,
137
+ }}
138
+ >
139
+ <NativeText
140
+ numberOfLines={1}
141
+ style={{color: theme.text.primary, fontFamily: font.fontFamily, fontSize: 22}}
142
+ >
143
+ {font.label}
144
+ </NativeText>
145
+ </Pressable>
146
+ );
147
+ })}
148
+ </View>
149
+
150
+ {/* Live preview of the finished signature in the selected font. */}
151
+ <View
152
+ style={{
153
+ alignItems: "center",
154
+ backgroundColor: theme.surface.base,
155
+ borderColor: theme.border.dark,
156
+ borderRadius: 4,
157
+ borderWidth: 1,
158
+ justifyContent: "center",
159
+ marginTop: 12,
160
+ minHeight: 96,
161
+ paddingHorizontal: 16,
162
+ paddingVertical: 12,
163
+ }}
164
+ testID={fieldTestIDs.helper ? `${fieldTestIDs.helper}-preview` : undefined}
165
+ >
166
+ <NativeText
167
+ numberOfLines={1}
168
+ style={{
169
+ color: hasName ? theme.text.primary : theme.text.secondaryLight,
170
+ fontFamily: selectedFont.fontFamily,
171
+ fontSize: 40,
172
+ }}
173
+ >
174
+ {hasName ? typedName : placeholder}
175
+ </NativeText>
176
+ </View>
177
+
178
+ {Boolean(helperText) && <FieldHelperText testID={fieldTestIDs.helper} text={helperText!} />}
179
+ </View>
180
+ );
181
+ };
@@ -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);
@@ -0,0 +1,51 @@
1
+ // Bun Snapshot v1, https://bun.sh/docs/test/snapshots
2
+
3
+ exports[`SignatureCaptureField renders a read-only drawn image when disabled with a drawn value 1`] = `
4
+ {
5
+ "$$typeof": Symbol(react.test.json),
6
+ "children": [
7
+ {
8
+ "$$typeof": Symbol(react.test.json),
9
+ "children": [
10
+ "Signature",
11
+ ],
12
+ "props": {
13
+ "style": {
14
+ "color": "#1C1C1C",
15
+ "fontSize": 14,
16
+ "fontWeight": 600,
17
+ "lineHeight": 22.4,
18
+ },
19
+ },
20
+ "type": "Text",
21
+ },
22
+ {
23
+ "$$typeof": Symbol(react.test.json),
24
+ "children": null,
25
+ "props": {
26
+ "accessibilityIgnoresInvertColors": false,
27
+ "resizeMode": "contain",
28
+ "source": {
29
+ "uri": "data:image/png;base64,xyz",
30
+ },
31
+ "style": {
32
+ "borderColor": "#9A9A9A",
33
+ "borderWidth": 1,
34
+ "height": 80,
35
+ "marginVertical": 8,
36
+ "width": 300,
37
+ },
38
+ },
39
+ "type": "Image",
40
+ },
41
+ ],
42
+ "props": {
43
+ "style": {
44
+ "flexDirection": "column",
45
+ "width": "100%",
46
+ },
47
+ "testID": undefined,
48
+ },
49
+ "type": "View",
50
+ }
51
+ `;