@terreno/ui 0.22.2 → 0.23.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 (115) hide show
  1. package/README.md +27 -0
  2. package/dist/Accordion.js +3 -3
  3. package/dist/Accordion.js.map +1 -1
  4. package/dist/BooleanField.js +6 -4
  5. package/dist/BooleanField.js.map +1 -1
  6. package/dist/Box.js +3 -2
  7. package/dist/Box.js.map +1 -1
  8. package/dist/Button.js +4 -3
  9. package/dist/Button.js.map +1 -1
  10. package/dist/CheckBox.js +2 -2
  11. package/dist/CheckBox.js.map +1 -1
  12. package/dist/Common.d.ts +44 -56
  13. package/dist/Common.js +1 -0
  14. package/dist/Common.js.map +1 -1
  15. package/dist/CustomSelectField.js +5 -3
  16. package/dist/CustomSelectField.js.map +1 -1
  17. package/dist/DataTable.js +18 -12
  18. package/dist/DataTable.js.map +1 -1
  19. package/dist/DateTimeField.js +5 -3
  20. package/dist/DateTimeField.js.map +1 -1
  21. package/dist/IconButton.js +8 -4
  22. package/dist/IconButton.js.map +1 -1
  23. package/dist/Link.js +2 -2
  24. package/dist/Link.js.map +1 -1
  25. package/dist/MarkdownEditor.js +14 -2
  26. package/dist/MarkdownEditor.js.map +1 -1
  27. package/dist/MarkdownEditorField.js +18 -4
  28. package/dist/MarkdownEditorField.js.map +1 -1
  29. package/dist/Modal.js +10 -6
  30. package/dist/Modal.js.map +1 -1
  31. package/dist/MultiselectField.js +5 -3
  32. package/dist/MultiselectField.js.map +1 -1
  33. package/dist/Page.js +1 -1
  34. package/dist/Page.js.map +1 -1
  35. package/dist/Pagination.js +2 -2
  36. package/dist/Pagination.js.map +1 -1
  37. package/dist/SegmentedControl.js +5 -3
  38. package/dist/SegmentedControl.js.map +1 -1
  39. package/dist/SelectField.js +5 -3
  40. package/dist/SelectField.js.map +1 -1
  41. package/dist/SocialLoginButton.js +2 -1
  42. package/dist/SocialLoginButton.js.map +1 -1
  43. package/dist/Spinner.js +3 -2
  44. package/dist/Spinner.js.map +1 -1
  45. package/dist/TextField.js +6 -4
  46. package/dist/TextField.js.map +1 -1
  47. package/dist/fieldElements/FieldError.d.ts +1 -0
  48. package/dist/fieldElements/FieldError.js +3 -2
  49. package/dist/fieldElements/FieldError.js.map +1 -1
  50. package/dist/fieldElements/FieldHelperText.d.ts +1 -0
  51. package/dist/fieldElements/FieldHelperText.js +3 -2
  52. package/dist/fieldElements/FieldHelperText.js.map +1 -1
  53. package/dist/fieldElements/FieldTitle.d.ts +1 -0
  54. package/dist/fieldElements/FieldTitle.js +4 -3
  55. package/dist/fieldElements/FieldTitle.js.map +1 -1
  56. package/dist/testing/index.d.ts +2 -0
  57. package/dist/testing/index.js +3 -0
  58. package/dist/testing/index.js.map +1 -0
  59. package/dist/testing/resolveTestId.d.ts +39 -0
  60. package/dist/testing/resolveTestId.js +97 -0
  61. package/dist/testing/resolveTestId.js.map +1 -0
  62. package/dist/testing/types.d.ts +59 -0
  63. package/dist/testing/types.js +2 -0
  64. package/dist/testing/types.js.map +1 -0
  65. package/package.json +2 -2
  66. package/src/Accordion.tsx +3 -1
  67. package/src/BooleanField.tsx +13 -3
  68. package/src/Box.tsx +3 -2
  69. package/src/Button.test.tsx +31 -1
  70. package/src/Button.tsx +5 -4
  71. package/src/CheckBox.tsx +7 -1
  72. package/src/Common.ts +66 -58
  73. package/src/CustomSelectField.tsx +8 -1
  74. package/src/DataTable.tsx +40 -3
  75. package/src/DateTimeField.tsx +10 -3
  76. package/src/ErrorBoundary.test.tsx +3 -4
  77. package/src/IconButton.test.tsx +14 -0
  78. package/src/IconButton.tsx +9 -4
  79. package/src/Link.tsx +2 -1
  80. package/src/MarkdownEditor.tsx +52 -27
  81. package/src/MarkdownEditorField.tsx +37 -16
  82. package/src/Modal.tsx +13 -0
  83. package/src/MultiselectField.tsx +8 -3
  84. package/src/Page.tsx +1 -0
  85. package/src/Pagination.tsx +2 -1
  86. package/src/SegmentedControl.tsx +15 -2
  87. package/src/SelectField.tsx +8 -3
  88. package/src/SocialLoginButton.tsx +2 -1
  89. package/src/Spinner.tsx +3 -2
  90. package/src/TextField.tsx +8 -5
  91. package/src/__snapshots__/AddressField.test.tsx.snap +4 -0
  92. package/src/__snapshots__/BooleanField.test.tsx.snap +4 -0
  93. package/src/__snapshots__/Button.test.tsx.snap +18 -1
  94. package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +2 -0
  95. package/src/__snapshots__/ErrorPage.test.tsx.snap +1 -0
  96. package/src/__snapshots__/Field.test.tsx.snap +8 -0
  97. package/src/__snapshots__/HeightActionSheet.test.tsx.snap +2 -0
  98. package/src/__snapshots__/HeightField.test.tsx.snap +5 -0
  99. package/src/__snapshots__/IconButton.test.tsx.snap +4 -0
  100. package/src/__snapshots__/InfoModalIcon.test.tsx.snap +4 -0
  101. package/src/__snapshots__/Link.test.tsx.snap +1 -0
  102. package/src/__snapshots__/Modal.test.tsx.snap +3 -0
  103. package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +2 -0
  104. package/src/__snapshots__/Page.test.tsx.snap +22 -0
  105. package/src/__snapshots__/SegmentedControl.test.tsx.snap +4 -0
  106. package/src/__snapshots__/UnifiedAddressAutoComplete.test.tsx.snap +1 -0
  107. package/src/fieldElements/FieldError.tsx +7 -2
  108. package/src/fieldElements/FieldHelperText.tsx +4 -2
  109. package/src/fieldElements/FieldTitle.tsx +4 -1
  110. package/src/login/__snapshots__/LoginScreen.test.tsx.snap +7 -0
  111. package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +7 -0
  112. package/src/testing/index.ts +2 -0
  113. package/src/testing/resolveTestId.test.ts +231 -0
  114. package/src/testing/resolveTestId.ts +142 -0
  115. package/src/testing/types.ts +67 -0
@@ -5,6 +5,7 @@ import type {BooleanFieldProps} from "./Common";
5
5
  import {FieldHelperText, FieldTitle} from "./fieldElements";
6
6
  import {Text} from "./Text";
7
7
  import {useTheme} from "./Theme";
8
+ import {resolveFieldTestIDsFromProps} from "./testing/resolveTestId";
8
9
 
9
10
  const TOUCHABLE_SIZE = 20;
10
11
  const OFFSET = 10;
@@ -19,8 +20,11 @@ export const BooleanField: FC<BooleanFieldProps> = ({
19
20
  disabled,
20
21
  disabledHelperText,
21
22
  helperText,
23
+ testID,
24
+ testIDs,
22
25
  }) => {
23
26
  const {theme} = useTheme();
27
+ const fieldTestIDs = resolveFieldTestIDsFromProps({testID, testIDs});
24
28
  const backgroundColor = useRef(
25
29
  new Animated.Value(value ? WIDTH_WITH_OFFSET : -1 * WIDTH_WITH_OFFSET)
26
30
  ).current;
@@ -83,6 +87,7 @@ export const BooleanField: FC<BooleanFieldProps> = ({
83
87
  alignItems: "flex-start",
84
88
  flexDirection: "column",
85
89
  }}
90
+ testID={fieldTestIDs.input}
86
91
  >
87
92
  <View
88
93
  style={{
@@ -91,11 +96,12 @@ export const BooleanField: FC<BooleanFieldProps> = ({
91
96
  justifyContent: variant === "title" ? "flex-start" : "center",
92
97
  }}
93
98
  >
94
- {Boolean(title) && <FieldTitle text={title!} />}
99
+ {Boolean(title) && <FieldTitle testID={fieldTestIDs.label} text={title!} />}
95
100
  <Pressable
96
101
  aria-role="button"
97
102
  onPress={handleSwitch}
98
103
  style={{alignItems: "center", flexDirection: "row", justifyContent: "center"}}
104
+ testID={fieldTestIDs.input ? `${fieldTestIDs.input}.switch` : undefined}
99
105
  >
100
106
  <Animated.View
101
107
  style={{
@@ -136,8 +142,12 @@ export const BooleanField: FC<BooleanFieldProps> = ({
136
142
  {variant === "title" && <Text size="md">{value ? "Yes" : "No"}</Text>}
137
143
  </Pressable>
138
144
  </View>
139
- {disabled && disabledHelperText && <FieldHelperText text={disabledHelperText} />}
140
- {Boolean(helperText) && <FieldHelperText text={helperText as string} />}
145
+ {disabled && disabledHelperText && (
146
+ <FieldHelperText testID={fieldTestIDs.helper} text={disabledHelperText} />
147
+ )}
148
+ {Boolean(helperText) && (
149
+ <FieldHelperText testID={fieldTestIDs.helper} text={helperText as string} />
150
+ )}
141
151
  </View>
142
152
  );
143
153
  };
package/src/Box.tsx CHANGED
@@ -62,6 +62,7 @@ const isValidWidthHeight = (value: number | string): boolean => {
62
62
 
63
63
  export const Box = React.forwardRef((props: BoxProps, ref) => {
64
64
  const {theme} = useTheme();
65
+ const resolvedTestID = props.testID;
65
66
 
66
67
  useImperativeHandle(ref, () => ({
67
68
  scrollTo: (y: number) => {
@@ -316,7 +317,7 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
316
317
  await props.onClick?.();
317
318
  }}
318
319
  style={propsToStyle()}
319
- testID={props.testID ? `${props.testID}-clickable` : undefined}
320
+ testID={resolvedTestID ? `${resolvedTestID}-clickable` : undefined}
320
321
  >
321
322
  {props.children}
322
323
  </Pressable>
@@ -327,7 +328,7 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
327
328
  onPointerEnter={onHoverIn}
328
329
  onPointerLeave={onHoverOut}
329
330
  style={propsToStyle()}
330
- testID={props.testID}
331
+ testID={resolvedTestID}
331
332
  >
332
333
  {props.children}
333
334
  </View>
@@ -1,8 +1,10 @@
1
- import {describe, expect, it, mock} from "bun:test";
1
+ import {describe, expect, it, mock, spyOn} from "bun:test";
2
2
  import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
3
3
 
4
4
  import {Button} from "./Button";
5
+ import {isMobileDevice} from "./MediaQuery";
5
6
  import {renderWithIcons, renderWithTheme, TEST_CUSTOM_ICON_TEST_ID} from "./test-utils";
7
+ import * as Utilities from "./Utilities";
6
8
 
7
9
  describe("Button", () => {
8
10
  it("renders correctly with default props", () => {
@@ -334,4 +336,32 @@ describe("Button", () => {
334
336
  const tree = renderWithTheme(<Button onClick={() => {}} size="sm" text="Small" />).toJSON();
335
337
  expect(tree).toBeTruthy();
336
338
  });
339
+
340
+ it("does not render tooltip wrapper when isMobileDevice is true", () => {
341
+ const nativeSpy = spyOn(Utilities, "isNative").mockReturnValue(false);
342
+ (isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => true);
343
+
344
+ const {getByText, toJSON} = renderWithTheme(
345
+ <Button onClick={() => {}} text="No Tooltip" tooltipText="Should not wrap" />
346
+ );
347
+
348
+ expect(getByText("No Tooltip")).toBeTruthy();
349
+ const tree = JSON.stringify(toJSON());
350
+ expect(tree).not.toContain("Should not wrap");
351
+ nativeSpy.mockRestore();
352
+ (isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => false);
353
+ });
354
+
355
+ it("renders tooltip wrapper when tooltipText is provided and not native", () => {
356
+ const nativeSpy = spyOn(Utilities, "isNative").mockReturnValue(false);
357
+ (isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => false);
358
+
359
+ const {getByText} = renderWithTheme(
360
+ <Button onClick={() => {}} text="With Tooltip" tooltipText="Helpful tip" />
361
+ );
362
+
363
+ expect(getByText("With Tooltip")).toBeTruthy();
364
+ nativeSpy.mockRestore();
365
+ (isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => false);
366
+ });
337
367
  });
package/src/Button.tsx CHANGED
@@ -81,7 +81,7 @@ const ButtonComponent: React.FC<ButtonProps> = ({
81
81
  } else if (variant === "destructive") {
82
82
  bgColor = theme.surface.error;
83
83
  } else if (variant === "ghost") {
84
- bgColor = theme.surface.base;
84
+ bgColor = "transparent";
85
85
  textColor = theme.surface.secondaryDark;
86
86
  }
87
87
 
@@ -146,9 +146,10 @@ const ButtonComponent: React.FC<ButtonProps> = ({
146
146
  borderRadius: theme.radius.rounded,
147
147
  borderWidth,
148
148
  flexDirection: "column",
149
+ height: size === "sm" ? 28 : undefined,
149
150
  justifyContent: "center",
150
151
  paddingHorizontal: size === "sm" ? 16 : 20,
151
- paddingVertical: 8 - (borderWidth ?? 0),
152
+ paddingVertical: size === "sm" ? 0 : 8 - (borderWidth ?? 0),
152
153
  width: fullWidth ? "100%" : "auto",
153
154
  }}
154
155
  testID={testID}
@@ -164,9 +165,9 @@ const ButtonComponent: React.FC<ButtonProps> = ({
164
165
  }}
165
166
  >
166
167
  {CustomIcon ? (
167
- <CustomIcon color={color ?? theme.text.inverted} size={16} />
168
+ <CustomIcon color={color ?? theme.text.inverted} size={size === "sm" ? 12 : 16} />
168
169
  ) : (
169
- <FontAwesome6 color={color} name={iconName} size={16} solid />
170
+ <FontAwesome6 color={color} name={iconName} size={size === "sm" ? 12 : 16} solid />
170
171
  )}
171
172
  </View>
172
173
  )}
package/src/CheckBox.tsx CHANGED
@@ -5,7 +5,12 @@ import {View} from "react-native";
5
5
  import type {CheckBoxProps} from "./Common";
6
6
  import {useTheme} from "./Theme";
7
7
 
8
- export const CheckBox: FC<CheckBoxProps> = ({selected, size = "md", bgColor = "default"}) => {
8
+ export const CheckBox: FC<CheckBoxProps> = ({
9
+ selected,
10
+ size = "md",
11
+ bgColor = "default",
12
+ testID,
13
+ }) => {
9
14
  const {theme} = useTheme();
10
15
  const px = {
11
16
  lg: {container: 24, icon: 16},
@@ -30,6 +35,7 @@ export const CheckBox: FC<CheckBoxProps> = ({selected, size = "md", bgColor = "d
30
35
  justifyContent: "center",
31
36
  width: px[size].container,
32
37
  }}
38
+ testID={testID}
33
39
  >
34
40
  {selected ? (
35
41
  <FontAwesome6
package/src/Common.ts CHANGED
@@ -19,12 +19,37 @@ import type {
19
19
  FontAwesome6RegularNames,
20
20
  FontAwesome6SolidNames,
21
21
  } from "./CommonIconTypes";
22
+ import type {
23
+ DataTableTestIDs,
24
+ FieldTestIDs,
25
+ ModalTestIDs,
26
+ SegmentedControlTestIDs,
27
+ WithTestID,
28
+ } from "./testing/types";
29
+
30
+ export {
31
+ resolveDataTableRowTestID,
32
+ resolveDataTableTestIDsFromProps,
33
+ resolveFieldTestIDsFromProps,
34
+ resolveModalTestIDsFromProps,
35
+ resolveTestID,
36
+ toDomTestProps,
37
+ toPlatformTestProps,
38
+ toTestProps,
39
+ } from "./testing";
40
+ export type {
41
+ DataTableTestIDs,
42
+ FieldTestIDs,
43
+ ModalTestIDs,
44
+ SegmentedControlTestIDs,
45
+ WithTestID,
46
+ } from "./testing/types";
22
47
 
23
48
  export type PercentageString = `${number}%`;
24
49
 
25
50
  export type NumberOrPercentage = number | PercentageString | string;
26
51
 
27
- export interface InfoModalIconProps {
52
+ export interface InfoModalIconProps extends WithTestID {
28
53
  /**
29
54
  * The content of the information modal.
30
55
  */
@@ -384,12 +409,11 @@ export type IconName =
384
409
  | CustomIconName;
385
410
 
386
411
  /** Props passed to a custom icon component when it is rendered. */
387
- export interface CustomIconProps {
412
+ export interface CustomIconProps extends WithTestID {
388
413
  /** Resolved color string, already mapped from the active theme. */
389
414
  color: string;
390
415
  /** Resolved icon size in pixels. */
391
416
  size: number;
392
- testID?: string;
393
417
  }
394
418
 
395
419
  /** A component that renders a custom (non-FontAwesome) icon. */
@@ -494,7 +518,7 @@ export interface AccessibilityProps {
494
518
  accessibilityHint: string;
495
519
  }
496
520
 
497
- export interface BoxPropsBase {
521
+ export interface BoxPropsBase extends WithTestID {
498
522
  alignContent?: AlignContent;
499
523
  alignItems?: AlignItems;
500
524
  alignSelf?: AlignSelf;
@@ -596,7 +620,6 @@ export interface BoxPropsBase {
596
620
  scrollRef?: React.RefObject<ScrollView | null>;
597
621
  onScroll?: (offsetY: number) => void;
598
622
  onLayout?: (event: LayoutChangeEvent) => void;
599
- testID?: string;
600
623
  }
601
624
 
602
625
  // If onClick is provided, add accessibility props.
@@ -666,7 +689,7 @@ export interface ErrorBoundaryProps {
666
689
  children?: ReactNode;
667
690
  }
668
691
 
669
- export interface IconProps {
692
+ export interface IconProps extends WithTestID {
670
693
  iconName: IconName;
671
694
  type?:
672
695
  | "regular"
@@ -680,7 +703,6 @@ export interface IconProps {
680
703
  | "sharp";
681
704
  color?: IconColor;
682
705
  size?: IconSize;
683
- testID?: string;
684
706
  }
685
707
 
686
708
  export type TooltipPosition = "top" | "bottom" | "left" | "right";
@@ -692,7 +714,8 @@ export interface SegmentedControlBadgeConfig {
692
714
  status?: "info" | "error" | "warning" | "success" | "neutral";
693
715
  }
694
716
 
695
- export interface SegmentedControlProps {
717
+ export interface SegmentedControlProps extends WithTestID {
718
+ testIDs?: SegmentedControlTestIDs;
696
719
  items: string[];
697
720
  size?: "md" | "lg"; // default "md"
698
721
  onChange: (activeIndex: number) => void;
@@ -713,9 +736,9 @@ export interface TextStyleWithOutline extends TextStyle {
713
736
  outline?: string;
714
737
  }
715
738
 
716
- interface BaseFieldProps {
739
+ interface BaseFieldProps extends WithTestID {
717
740
  id?: string;
718
- testID?: string;
741
+ testIDs?: FieldTestIDs;
719
742
  title?: string;
720
743
  placeholder?: string;
721
744
  iconName?: IconName;
@@ -856,14 +879,13 @@ export const getRounding = (rounding: Rounding) => {
856
879
  return ROUNDING_MAP[rounding];
857
880
  };
858
881
 
859
- export interface HeadingProps {
882
+ export interface HeadingProps extends WithTestID {
860
883
  align?: "left" | "right" | "center" | "justify"; // default "left"
861
884
  children?: React.ReactNode;
862
885
  color?: TextColor;
863
886
  overflow?: "normal" | "breakWord"; // default "breakWord"
864
887
  size?: "sm" | "md" | "lg" | "xl" | "2xl"; // default "sm"
865
888
  truncate?: boolean; // default false
866
- testID?: string;
867
889
  }
868
890
 
869
891
  export interface MetaProps {
@@ -897,7 +919,8 @@ export interface BackButtonInterface {
897
919
  onBack: () => void;
898
920
  }
899
921
 
900
- export interface BooleanFieldProps extends HelperTextProps, ErrorTextProps {
922
+ export interface BooleanFieldProps extends WithTestID, HelperTextProps, ErrorTextProps {
923
+ testIDs?: FieldTestIDs;
901
924
  title?: string;
902
925
  variant?: "simple" | "title"; // default "simple"
903
926
  disabled?: boolean;
@@ -906,7 +929,7 @@ export interface BooleanFieldProps extends HelperTextProps, ErrorTextProps {
906
929
  onChange: (value: boolean) => void;
907
930
  }
908
931
 
909
- export interface CheckBoxProps {
932
+ export interface CheckBoxProps extends WithTestID {
910
933
  /**
911
934
  * The background color of the checkbox.
912
935
  * @default "default"
@@ -1017,7 +1040,7 @@ export type ReactChild = ReactNode;
1017
1040
  export type ReactChildren = ReactNode;
1018
1041
  export type WithChildren<P> = P & {children?: ReactNode};
1019
1042
 
1020
- export interface AddressAutocompleteProps {
1043
+ export interface AddressAutocompleteProps extends WithTestID {
1021
1044
  disabled?: boolean;
1022
1045
  googleMapsApiKey?: string;
1023
1046
  includeCounty?: boolean;
@@ -1026,10 +1049,9 @@ export interface AddressAutocompleteProps {
1026
1049
  handleAddressChange: OnChangeCallback;
1027
1050
  handleAutoCompleteChange: (value: AddressInterface) => void;
1028
1051
  googlePlacesMobileStyles?: Styles;
1029
- testID?: string;
1030
1052
  }
1031
1053
 
1032
- export interface ActionSheetProps {
1054
+ export interface ActionSheetProps extends WithTestID {
1033
1055
  children?: React.ReactNode;
1034
1056
  ref?: React.MutableRefObject<{
1035
1057
  /**
@@ -1350,11 +1372,6 @@ export interface ActionSheetProps {
1350
1372
 
1351
1373
  keyboardMode?: "padding" | "position";
1352
1374
 
1353
- /**
1354
- * Test ID for unit testing
1355
- */
1356
- testID?: string;
1357
-
1358
1375
  /**
1359
1376
  *
1360
1377
  Event called when the ActionSheet closes.
@@ -1399,7 +1416,7 @@ export interface CustomSvgProps extends SvgProps {
1399
1416
  doNotDisturb?: boolean;
1400
1417
  }
1401
1418
 
1402
- export interface AvatarProps {
1419
+ export interface AvatarProps extends WithTestID {
1403
1420
  /**
1404
1421
  * The name of the user. This is used for the placeholder treatment if an image is not available.
1405
1422
  */
@@ -1432,13 +1449,9 @@ export interface AvatarProps {
1432
1449
  * Accessibility label for the avatar image.
1433
1450
  */
1434
1451
  accessibilityLabel?: string;
1435
- /**
1436
- * Test ID for unit testing
1437
- */
1438
- testID?: string;
1439
1452
  }
1440
1453
 
1441
- export interface BadgeProps {
1454
+ export interface BadgeProps extends WithTestID {
1442
1455
  /**
1443
1456
  * When status is "custom", determines the badge's background color.
1444
1457
  */
@@ -1485,11 +1498,6 @@ export interface BadgeProps {
1485
1498
  */
1486
1499
  status?: "info" | "error" | "warning" | "success" | "neutral" | "custom";
1487
1500
 
1488
- /**
1489
- * Test ID for unit testing
1490
- */
1491
- testID?: string;
1492
-
1493
1501
  /**
1494
1502
  * The text or number to display inside the badge.
1495
1503
  */
@@ -1602,7 +1610,7 @@ export interface BodyProps {
1602
1610
 
1603
1611
  export type ButtonPressAnimation = "scale" | "opacity" | "none";
1604
1612
 
1605
- export interface ButtonProps {
1613
+ export interface ButtonProps extends WithTestID {
1606
1614
  /**
1607
1615
  * The text content of the confirmation modal.
1608
1616
  * @default "Are you sure you want to continue?"
@@ -1645,10 +1653,6 @@ export interface ButtonProps {
1645
1653
  * @default "scale"
1646
1654
  */
1647
1655
  pressAnimation?: ButtonPressAnimation;
1648
- /**
1649
- * The test ID for the button, used for testing purposes.
1650
- */
1651
- testID?: string;
1652
1656
  /**
1653
1657
  * The text content of the button.
1654
1658
  */
@@ -1690,7 +1694,7 @@ export interface ButtonProps {
1690
1694
  * Props for the SocialLoginButton component.
1691
1695
  * Used for OAuth social login buttons (Google, GitHub, Apple).
1692
1696
  */
1693
- export interface SocialLoginButtonProps {
1697
+ export interface SocialLoginButtonProps extends WithTestID {
1694
1698
  /**
1695
1699
  * The OAuth provider for the social login.
1696
1700
  */
@@ -1731,14 +1735,10 @@ export interface SocialLoginButtonProps {
1731
1735
  * Custom text for the button. Defaults to "Continue with {Provider}".
1732
1736
  */
1733
1737
  text?: string;
1734
-
1735
- /**
1736
- * Test ID for testing purposes.
1737
- */
1738
- testID?: string;
1739
1738
  }
1740
1739
 
1741
- export interface CustomSelectFieldProps {
1740
+ export interface CustomSelectFieldProps extends WithTestID {
1741
+ testIDs?: FieldTestIDs;
1742
1742
  /**
1743
1743
  * The current value of the custom select field.
1744
1744
  */
@@ -1885,7 +1885,7 @@ export interface HyperlinkProps {
1885
1885
  style?: StyleProp<any>;
1886
1886
  }
1887
1887
 
1888
- export interface IconButtonProps {
1888
+ export interface IconButtonProps extends WithTestID {
1889
1889
  /**
1890
1890
  * The accessibility hint describes the results of performing an action on a control or view.
1891
1891
  * It should be a very brief description of the result of interacting with the button.
@@ -1938,9 +1938,10 @@ export interface IconButtonProps {
1938
1938
  loading?: boolean;
1939
1939
 
1940
1940
  /**
1941
- * The test ID for the button, used for testing purposes.
1941
+ * The size of the button.
1942
+ * @default "default"
1942
1943
  */
1943
- testID?: string;
1944
+ size?: "default" | "sm";
1944
1945
 
1945
1946
  /**
1946
1947
  * The ideal position of the tooltip.
@@ -1962,7 +1963,7 @@ export interface IconButtonProps {
1962
1963
  * The variant of the button, which determines its style.
1963
1964
  * @default "primary"
1964
1965
  */
1965
- variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation";
1966
+ variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation" | "ghost";
1966
1967
 
1967
1968
  /**
1968
1969
  * If true, a confirmation modal will be shown before the onClick action.
@@ -1981,7 +1982,8 @@ export interface InfoTooltipButtonProps {
1981
1982
  size?: IconSize;
1982
1983
  }
1983
1984
 
1984
- export interface ModalProps {
1985
+ export interface ModalProps extends WithTestID {
1986
+ testIDs?: ModalTestIDs;
1985
1987
  /**
1986
1988
  * The content of the modal.
1987
1989
  */
@@ -2049,7 +2051,7 @@ export interface NumberPickerActionSheetProps {
2049
2051
  actionSheetRef: React.RefObject<any>;
2050
2052
  }
2051
2053
 
2052
- export interface PageProps {
2054
+ export interface PageProps extends WithTestID {
2053
2055
  // biome-ignore lint/suspicious/noExplicitAny: React Navigation type varies by navigation stack configuration
2054
2056
  navigation?: any;
2055
2057
  scroll?: boolean;
@@ -2124,7 +2126,7 @@ export interface SideDrawerProps {
2124
2126
  drawerStyles?: StyleProp<ViewStyle>;
2125
2127
  }
2126
2128
 
2127
- export interface SpinnerProps {
2129
+ export interface SpinnerProps extends WithTestID {
2128
2130
  size?: "sm" | "md";
2129
2131
  color?: "light" | "dark" | "accent" | "secondary";
2130
2132
  }
@@ -2200,7 +2202,7 @@ export interface TableProps {
2200
2202
  extraControls?: React.ReactElement;
2201
2203
  }
2202
2204
 
2203
- export interface PaginationProps {
2205
+ export interface PaginationProps extends WithTestID {
2204
2206
  page: number;
2205
2207
  setPage: (page: number) => void;
2206
2208
  totalPages: number;
@@ -2228,7 +2230,8 @@ export interface DataTableColumn {
2228
2230
  infoModalText?: string;
2229
2231
  }
2230
2232
 
2231
- export interface DataTableProps {
2233
+ export interface DataTableProps extends WithTestID {
2234
+ testIDs?: DataTableTestIDs;
2232
2235
  data: DataTableCellData[][];
2233
2236
  columns: DataTableColumn[];
2234
2237
  alternateRowBackground?: boolean;
@@ -2255,6 +2258,10 @@ export interface DataTableProps {
2255
2258
  moreContentExtraData?: Record<string, unknown>[];
2256
2259
  // Allows handling of custom column types.
2257
2260
  customColumnComponentMap?: DataTableCustomComponentMap;
2261
+ /**
2262
+ * Returns a stable key for row test ids. Defaults to row index when omitted.
2263
+ */
2264
+ getRowTestID?: (row: DataTableCellData[], rowIndex: number) => string | number;
2258
2265
  }
2259
2266
 
2260
2267
  export interface DataTableCellProps {
@@ -2361,7 +2368,7 @@ export interface TableContextProviderProps extends TableContextType {
2361
2368
  children: React.ReactNode;
2362
2369
  }
2363
2370
 
2364
- export interface TextProps {
2371
+ export interface TextProps extends WithTestID {
2365
2372
  align?: "left" | "right" | "center" | "justify"; // default "left"
2366
2373
  children?: React.ReactNode;
2367
2374
  bold?: boolean; // default false
@@ -2372,7 +2379,6 @@ export interface TextProps {
2372
2379
  underline?: boolean;
2373
2380
  numberOfLines?: number;
2374
2381
  skipLinking?: boolean;
2375
- testID?: string;
2376
2382
  }
2377
2383
 
2378
2384
  export interface TextFieldPickerActionSheetProps {
@@ -2654,7 +2660,8 @@ export interface ModelAdminCustomComponentProps extends Omit<FieldProps, "name">
2654
2660
  editing: boolean; // Allow for inline editing of the field.
2655
2661
  }
2656
2662
 
2657
- export interface MultiselectFieldProps extends HelperTextProps, ErrorTextProps {
2663
+ export interface MultiselectFieldProps extends WithTestID, HelperTextProps, ErrorTextProps {
2664
+ testIDs?: FieldTestIDs;
2658
2665
  /**
2659
2666
  * The available options for the multiselect field.
2660
2667
  */
@@ -2775,7 +2782,8 @@ export interface FieldOption {
2775
2782
  }
2776
2783
 
2777
2784
  // Split up SelectField so if value is passed as a string,
2778
- export interface SelectFieldPropsBase {
2785
+ export interface SelectFieldPropsBase extends WithTestID {
2786
+ testIDs?: FieldTestIDs;
2779
2787
  /**
2780
2788
  * If true, the select field will be disabled.
2781
2789
  * @default false
@@ -5,6 +5,7 @@ import type {CustomSelectFieldProps} from "./Common";
5
5
  import {FieldHelperText} from "./fieldElements";
6
6
  import {SelectField} from "./SelectField";
7
7
  import {TextField} from "./TextField";
8
+ import {resolveFieldTestIDsFromProps, resolveTestID} from "./testing/resolveTestId";
8
9
 
9
10
  export const CustomSelectField: FC<CustomSelectFieldProps> = ({
10
11
  value,
@@ -15,10 +16,13 @@ export const CustomSelectField: FC<CustomSelectFieldProps> = ({
15
16
  title,
16
17
  errorText,
17
18
  helperText,
19
+ testID,
20
+ testIDs,
18
21
  }) => {
19
22
  const [currentValue, setCurrentValue] = useState(value);
20
23
  const [showCustomInput, setShowCustomInput] = useState(false);
21
24
  const textInputRef = useRef<TextInput | null>(null);
25
+ const fieldTestIDs = resolveFieldTestIDsFromProps({testID, testIDs});
22
26
 
23
27
  // Boolean that checks if currentValue is a value from the
24
28
  // options prop or if it is a true custom value
@@ -86,6 +90,8 @@ export const CustomSelectField: FC<CustomSelectFieldProps> = ({
86
90
  onChange={handleCustomSelectListChange}
87
91
  options={[...options, {label: "Custom", value: "custom"}]}
88
92
  placeholder={placeholder}
93
+ testID={fieldTestIDs.input}
94
+ testIDs={testIDs}
89
95
  title={title}
90
96
  value={isValueCustom ? "custom" : currentValue}
91
97
  />
@@ -106,12 +112,13 @@ export const CustomSelectField: FC<CustomSelectFieldProps> = ({
106
112
  }}
107
113
  onChange={onChange}
108
114
  placeholder="None selected"
115
+ testID={resolveTestID(fieldTestIDs.input, "custom")}
109
116
  type="text"
110
117
  value={value}
111
118
  />
112
119
  </View>
113
120
  )}
114
- {Boolean(helperText) && <FieldHelperText text={helperText!} />}
121
+ {Boolean(helperText) && <FieldHelperText testID={fieldTestIDs.helper} text={helperText!} />}
115
122
  </View>
116
123
  );
117
124
  };