@widergy/mobile-ui 1.47.0 → 1.48.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 (83) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/lib/components/CaptionLabel/README.md +30 -8
  4. package/lib/components/CaptionLabel/index.js +2 -1
  5. package/lib/components/CaptionLabel/propTypes.js +1 -0
  6. package/lib/components/Checkbox/README.md +93 -25
  7. package/lib/components/Checkbox/index.js +14 -1
  8. package/lib/components/Checkbox/propTypes.js +1 -0
  9. package/lib/components/Label/index.js +2 -1
  10. package/lib/components/Label/propTypes.js +1 -0
  11. package/lib/components/RadioGroup/components/RadioButton/index.js +29 -18
  12. package/lib/components/RadioGroup/index.js +19 -5
  13. package/lib/components/Touchable/index.js +3 -1
  14. package/lib/components/Touchable/propTypes.js +1 -0
  15. package/lib/components/UTBadge/index.js +3 -1
  16. package/lib/components/UTBaseInputField/README.md +41 -19
  17. package/lib/components/UTBaseInputField/components/ActionAdornment/index.js +10 -3
  18. package/lib/components/UTBaseInputField/components/BadgeAdornment/index.js +6 -1
  19. package/lib/components/UTBaseInputField/components/IconAdornment/index.js +8 -1
  20. package/lib/components/UTBaseInputField/components/PrefixAdornment/index.js +8 -2
  21. package/lib/components/UTBaseInputField/components/SuffixAdornment/index.js +6 -1
  22. package/lib/components/UTBaseInputField/components/TooltipAdornment/index.js +16 -3
  23. package/lib/components/UTBaseInputField/index.js +15 -4
  24. package/lib/components/UTBottomSheet/README.md +94 -23
  25. package/lib/components/UTBottomSheet/index.js +27 -4
  26. package/lib/components/UTButton/index.js +18 -4
  27. package/lib/components/UTButton/proptypes.js +1 -0
  28. package/lib/components/UTCheckBox/README.md +47 -0
  29. package/lib/components/UTCheckBox/index.js +24 -3
  30. package/lib/components/UTCheckBox/proptypes.js +1 -0
  31. package/lib/components/UTCheckList/README.MD +63 -0
  32. package/lib/components/UTCheckList/index.js +25 -2
  33. package/lib/components/UTCheckList/proptypes.js +1 -0
  34. package/lib/components/UTDetailDrawer/README.md +60 -10
  35. package/lib/components/UTDetailDrawer/index.js +11 -1
  36. package/lib/components/UTDetailDrawer/propTypes.js +1 -0
  37. package/lib/components/UTFieldLabel/README.md +99 -0
  38. package/lib/components/UTFieldLabel/index.js +19 -2
  39. package/lib/components/UTIcon/README.md +25 -2
  40. package/lib/components/UTIcon/index.js +3 -1
  41. package/lib/components/UTLabel/README.md +26 -0
  42. package/lib/components/UTLabel/constants.js +0 -10
  43. package/lib/components/UTLabel/index.js +2 -0
  44. package/lib/components/UTLabel/proptypes.js +1 -0
  45. package/lib/components/UTLabel/utils.js +4 -22
  46. package/lib/components/UTMenu/README.md +275 -0
  47. package/lib/components/UTMenu/components/ListView/index.js +5 -3
  48. package/lib/components/UTMenu/components/ListView/proptypes.js +2 -1
  49. package/lib/components/UTMenu/components/MenuOption/index.js +5 -3
  50. package/lib/components/UTMenu/index.js +18 -3
  51. package/lib/components/UTMenu/proptypes.js +2 -1
  52. package/lib/components/UTModal/README.md +193 -0
  53. package/lib/components/UTModal/index.js +22 -2
  54. package/lib/components/UTModal/proptypes.js +1 -0
  55. package/lib/components/UTPhoneInput/index.js +25 -2
  56. package/lib/components/UTRoundView/README.md +158 -0
  57. package/lib/components/UTRoundView/index.js +12 -1
  58. package/lib/components/UTRoundView/propTypes.js +4 -2
  59. package/lib/components/UTSearchField/README.md +64 -14
  60. package/lib/components/UTSearchField/index.js +3 -1
  61. package/lib/components/UTSearchField/proptypes.js +2 -1
  62. package/lib/components/UTSelect/versions/V0/README.md +216 -0
  63. package/lib/components/UTSelect/versions/V0/componentes/MultipleItem/index.js +4 -2
  64. package/lib/components/UTSelect/versions/V0/index.js +5 -2
  65. package/lib/components/UTSelect/versions/V0/proptypes.js +2 -1
  66. package/lib/components/UTSelect/versions/V1/README.md +94 -0
  67. package/lib/components/UTSelect/versions/V1/index.js +28 -6
  68. package/lib/components/UTSelect/versions/V1/proptypes.js +1 -0
  69. package/lib/components/UTSelectableCard/README.md +85 -0
  70. package/lib/components/UTSelectableCard/index.js +52 -4
  71. package/lib/components/UTTextInput/versions/V0/components/BaseInput/index.js +5 -1
  72. package/lib/components/UTTextInput/versions/V0/components/InputLabel/index.js +4 -1
  73. package/lib/components/UTTextInput/versions/V0/flavors/FilledInput/index.js +9 -1
  74. package/lib/components/UTTextInput/versions/V0/flavors/OutlinedInput/index.js +9 -1
  75. package/lib/components/UTTextInput/versions/V0/flavors/StandardInput/index.js +9 -1
  76. package/lib/components/UTTextInput/versions/V1/components/TextInputField/index.js +3 -0
  77. package/lib/components/UTTextInput/versions/V1/index.js +20 -3
  78. package/lib/components/UTTooltip/README.md +99 -0
  79. package/lib/components/UTTooltip/index.js +2 -0
  80. package/lib/components/UTTooltip/proptypes.js +2 -1
  81. package/lib/components/UTValidation/index.js +26 -4
  82. package/lib/constants/testIds.js +44 -0
  83. package/package.json +1 -1
@@ -10,6 +10,7 @@
10
10
  | ------------- | ------ | ------- | ------------------------------------------------------------------------------ |
11
11
  | value | bool | false | Indicates whether the checkbox is selected. |
12
12
  | onChange | func | | Function to call when the checkbox value changes. |
13
+ | dataTestId | string | | Test ID for automated testing. Enables hierarchical test ID structure. |
13
14
  | disabled | bool | false | Disables the checkbox, making it unclickable. |
14
15
  | indeterminate | bool | false | Indicates if the checkbox is in an indeterminate state. |
15
16
  | isSimple | bool | false | **Deprecated**: Avoid using simple checkboxes in favor of standard checkboxes. |
@@ -21,6 +22,26 @@
21
22
  | withMarkdown | bool | false | Enables Markdown rendering for the `title`. |
22
23
  | variant | string | | The variant to use for styling the checkbox. |
23
24
 
25
+ ## Test IDs
26
+
27
+ When `dataTestId` is provided, the component creates a hierarchical test ID structure:
28
+
29
+ | Element | Test ID | Condition |
30
+ | ------------------ | -------------------------- | --------------------------------- |
31
+ | Checkbox pressable | `${dataTestId}` | Always when `dataTestId` provided |
32
+ | Checkbox icon | `${dataTestId}.icon` | Always when `dataTestId` provided |
33
+ | Title | `${dataTestId}.title` | When `title` prop is provided |
34
+ | Validation | `${dataTestId}.validation` | When `error` prop is provided |
35
+
36
+ ### Test ID Structure Details
37
+
38
+ - **Checkbox pressable**: The main interactive element that users click to toggle the checkbox
39
+ - **Checkbox icon**: The visual indicator (checkmark, indeterminate line, or empty box)
40
+ - **Title**: The text/title displayed next to the checkbox (handled by UTFieldLabel)
41
+ - **Validation**: Error message displayed when validation fails
42
+
43
+ The checkbox icon test ID applies to both simple and standard variants, though the underlying implementation differs.
44
+
24
45
  ## Usage
25
46
 
26
47
  ### Basic Example
@@ -37,3 +58,29 @@ const Example = () => {
37
58
 
38
59
  export default Example;
39
60
  ```
61
+
62
+ ### With Test IDs
63
+
64
+ ```jsx
65
+ import React from 'react';
66
+ import UTCheckBox from './UTCheckBox';
67
+
68
+ const TestableExample = () => {
69
+ const [termsAccepted, setTermsAccepted] = React.useState(false);
70
+
71
+ return (
72
+ <UTCheckBox
73
+ dataTestId="termsCheckbox"
74
+ value={termsAccepted}
75
+ title="I accept the terms and conditions"
76
+ onChange={setTermsAccepted}
77
+ required={true}
78
+ />
79
+ );
80
+ };
81
+
82
+ // Generated test IDs:
83
+ // termsCheckbox (main pressable)
84
+ // termsCheckbox.icon (checkbox indicator)
85
+ // termsCheckbox.title (title text)
86
+ ```
@@ -6,12 +6,15 @@ import UTFieldLabel from '../UTFieldLabel';
6
6
  import UTIcon from '../UTIcon';
7
7
  import { formatErrorToValidation } from '../UTValidation/utils';
8
8
  import UTValidation from '../UTValidation';
9
+ import { TEST_ID_CONSTANTS } from '../../constants/testIds';
9
10
 
10
11
  import { BUTTON_VARIANT, CHECKED_ICON, INDETERMINATE_ICON } from './constants';
11
12
  import { propTypes, defaultProps } from './proptypes';
12
13
  import { retrieveStyle } from './theme';
13
14
  import styles from './styles';
14
15
 
16
+ const { icon, title: titleTestId, validation: validationTestId } = TEST_ID_CONSTANTS;
17
+
15
18
  const UTCheckBox = ({
16
19
  CustomTitleComponent,
17
20
  disabled,
@@ -26,7 +29,8 @@ const UTCheckBox = ({
26
29
  title,
27
30
  value,
28
31
  variant,
29
- withMarkdown
32
+ withMarkdown,
33
+ dataTestId
30
34
  }) => {
31
35
  const theme = useTheme();
32
36
  const [pressed, setPressed] = useState(false);
@@ -73,6 +77,7 @@ const UTCheckBox = ({
73
77
  onPress={handlePress}
74
78
  onPressIn={handlePressIn}
75
79
  onPressOut={handlePressOut}
80
+ testID={dataTestId}
76
81
  >
77
82
  <View style={styles.container}>
78
83
  <View style={containerStyles}>
@@ -82,11 +87,21 @@ const UTCheckBox = ({
82
87
  shade="04"
83
88
  colorTheme="accent"
84
89
  style={value ? undefined : styles.hidden}
90
+ dataTestId={dataTestId ? `${dataTestId}.${icon}` : undefined}
85
91
  />
86
92
  ) : (
87
93
  <View style={boxStyles}>
88
94
  <View style={iconContainerStyles}>
89
- <UTIcon colorTheme="light" name={iconName} size={16} />
95
+ <UTIcon
96
+ colorTheme="light"
97
+ name={iconName}
98
+ size={16}
99
+ {...(dataTestId
100
+ ? {
101
+ [!iconName ? 'testID' : 'dataTestId']: `${dataTestId}.${icon}`
102
+ }
103
+ : {})}
104
+ />
90
105
  </View>
91
106
  </View>
92
107
  )}
@@ -97,11 +112,17 @@ const UTCheckBox = ({
97
112
  required={required}
98
113
  style={titleStyles}
99
114
  withMarkdown={withMarkdown}
115
+ dataTestId={dataTestId ? `${dataTestId}.${titleTestId}` : undefined}
100
116
  >
101
117
  {title}
102
118
  </UTFieldLabel>
103
119
  </View>
104
- {validationData && <UTValidation validationData={validationData} />}
120
+ {validationData && (
121
+ <UTValidation
122
+ validationData={validationData}
123
+ dataTestId={dataTestId ? `${dataTestId}.${validationTestId}` : undefined}
124
+ />
125
+ )}
105
126
  </View>
106
127
  </Pressable>
107
128
  );
@@ -13,6 +13,7 @@ export const defaultProps = {
13
13
 
14
14
  export const propTypes = {
15
15
  checked: bool,
16
+ dataTestId: string,
16
17
  disabled: bool,
17
18
  error: string,
18
19
  indeterminate: bool,
@@ -8,6 +8,7 @@
8
8
 
9
9
  | Name | Type | Default | Description |
10
10
  | ----------------- | --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------- |
11
+ | dataTestId | string | | Test ID for automated testing. Enables hierarchical test ID structure. |
11
12
  | error | string | | Error message to display. |
12
13
  | horizontalSpacing | string | large | Spacing between the checkbox and the title horizontally. |
13
14
  | title | string | | Title for the checklist. |
@@ -22,6 +23,26 @@
22
23
  | variant | string | | Variant style for the checklist. |
23
24
  | verticalSpacing | string | medium | Spacing between the checkbox items vertically. |
24
25
 
26
+ ## Test IDs
27
+
28
+ When `dataTestId` is provided, the component creates a hierarchical test ID structure:
29
+
30
+ | Element | Test ID | Condition |
31
+ | ------------------- | ------------------------------- | ------------------------------------------- |
32
+ | Title | `${dataTestId}.title` | When `title` prop is provided |
33
+ | Validation | `${dataTestId}.validation` | When `error` prop is provided |
34
+ | Select All checkbox | `${dataTestId}.selectAll` | When `showSelectAll` is true and not simple |
35
+ | Option checkbox | `${dataTestId}.option.${index}` | For each option (index-based) |
36
+
37
+ ### Test ID Structure Details
38
+
39
+ - **Title**: The title text of the checklist (handled by UTFieldLabel)
40
+ - **Validation**: Error message displayed when validation fails
41
+ - **Select All checkbox**: The "Select All" checkbox (when enabled and not in simple mode)
42
+ - **Option checkbox**: Individual option checkboxes, identified by their index position
43
+
44
+ Each checkbox (both select all and individual options) follows the UTCheckBox test ID pattern with their own hierarchical structure (e.g., `${dataTestId}.selectAll.icon`, `${dataTestId}.option.0.title`).
45
+
25
46
  ### Option Object
26
47
 
27
48
  The `options` prop is an array of objects, each representing an option:
@@ -66,6 +87,48 @@ const Example = () => {
66
87
  export default Example;
67
88
  ```
68
89
 
90
+ ### With Test IDs
91
+
92
+ ```jsx
93
+ import React from 'react';
94
+ import UTCheckList from './UTCheckList';
95
+
96
+ const options = [
97
+ { label: 'Option 1', value: 'option1' },
98
+ { label: 'Option 2', value: 'option2' },
99
+ { label: 'Option 3', value: 'option3', disabled: true }
100
+ ];
101
+
102
+ const TestableExample = () => {
103
+ const [selectedOptions, setSelectedOptions] = React.useState([]);
104
+
105
+ return (
106
+ <UTCheckList
107
+ dataTestId="surveyQuestions"
108
+ title="Select your preferences"
109
+ onChange={setSelectedOptions}
110
+ options={options}
111
+ required
112
+ selectAllLabel="Select All Options"
113
+ value={selectedOptions}
114
+ />
115
+ );
116
+ };
117
+
118
+ // Generated test IDs:
119
+ // surveyQuestions.title (title text)
120
+ // surveyQuestions.selectAll (select all checkbox)
121
+ // surveyQuestions.selectAll.icon (select all checkbox icon)
122
+ // surveyQuestions.selectAll.title (select all checkbox title)
123
+ // surveyQuestions.option.0 (first option checkbox)
124
+ // surveyQuestions.option.0.icon (first option checkbox icon)
125
+ // surveyQuestions.option.0.title (first option checkbox title)
126
+ // surveyQuestions.option.1 (second option checkbox)
127
+ // surveyQuestions.option.2 (third option checkbox)
128
+
129
+ export default TestableExample;
130
+ ```
131
+
69
132
  ### Custom Styles Example
70
133
 
71
134
  ```jsx
@@ -6,13 +6,22 @@ import { formatErrorToValidation } from '../UTValidation/utils';
6
6
  import UTCheckBox from '../UTCheckBox';
7
7
  import UTFieldLabel from '../UTFieldLabel';
8
8
  import UTValidation from '../UTValidation';
9
+ import { TEST_ID_CONSTANTS } from '../../constants/testIds';
9
10
 
10
11
  import { keyExtractor, isChecked, convertIfIsString, getPropValueBasedOnVariant } from './utils';
11
12
  import styles from './styles';
12
13
  import { defaultProps, propTypes } from './proptypes';
13
14
  import { SPACING } from './constants';
14
15
 
16
+ const {
17
+ title: titleTestId,
18
+ validation: validationTestId,
19
+ selectAll: selectAllTestId,
20
+ option: optionTestId
21
+ } = TEST_ID_CONSTANTS;
22
+
15
23
  const UTCheckList = ({
24
+ dataTestId,
16
25
  error,
17
26
  horizontalSpacing,
18
27
  isSimple,
@@ -77,8 +86,20 @@ const UTCheckList = ({
77
86
  style={[styles.container, verticalSpacing === SPACING.SMALL && styles.smallVerticalSpacing, style.root]}
78
87
  >
79
88
  <View style={[styles.headerContainer, style.header]}>
80
- {title && <UTFieldLabel required={required}>{title}</UTFieldLabel>}
81
- {validationData && <UTValidation validationData={validationData} />}
89
+ {title && (
90
+ <UTFieldLabel
91
+ required={required}
92
+ dataTestId={dataTestId ? `${dataTestId}.${titleTestId}` : undefined}
93
+ >
94
+ {title}
95
+ </UTFieldLabel>
96
+ )}
97
+ {validationData && (
98
+ <UTValidation
99
+ validationData={validationData}
100
+ dataTestId={dataTestId ? `${dataTestId}.${validationTestId}` : undefined}
101
+ />
102
+ )}
82
103
  </View>
83
104
  <View
84
105
  style={[
@@ -98,6 +119,7 @@ const UTCheckList = ({
98
119
  spacing={horizontalSpacing}
99
120
  style={style.selectAll}
100
121
  variant={variant}
122
+ dataTestId={dataTestId ? `${dataTestId}.${selectAllTestId}` : undefined}
101
123
  />
102
124
  )}
103
125
  {options?.map((item, index) => (
@@ -112,6 +134,7 @@ const UTCheckList = ({
112
134
  spacing={horizontalSpacing}
113
135
  style={style.item}
114
136
  variant={variant}
137
+ dataTestId={dataTestId ? `${dataTestId}.${optionTestId}.${index}` : undefined}
115
138
  />
116
139
  ))}
117
140
  </View>
@@ -13,6 +13,7 @@ export const defaultProps = {
13
13
  };
14
14
 
15
15
  export const propTypes = {
16
+ dataTestId: string,
16
17
  error: string,
17
18
  horizontalSpacing: string,
18
19
  isSimple: bool,
@@ -6,17 +6,35 @@ Component to show detail of something as a drawer.
6
6
 
7
7
  ### Props
8
8
 
9
- | NAME | TYPE | REQUIRED | DESCRIPTION | DEFAULT VALUE |
10
- | --- | --- | --- | --- | --- |
11
- | onClose | func | Yes | Function to close the drawer | - |
12
- | visible | bool | Yes | Handles drawer visibility (if open or not) | - |
13
- | ModalProps | object | No | Props to pass to the Modal component (same as [react-native-modal](https://github.com/react-native-community/react-native-modal)) | - |
14
- | CloseButtonProps | object | No | Props to pass to the CloseButton component (same as IconButton) | - |
15
- | styles | object | No | Styles to pass to the drawer components | - |
16
- | width | string or number | No | Width of the drawer, could be a percentage or number | '70%' |
17
- | title | string | No | Title label | --- |
18
- | titleProps | object | No | props for the title label | {} |
9
+ | NAME | TYPE | REQUIRED | DESCRIPTION | DEFAULT VALUE |
10
+ | ---------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------- |
11
+ | onClose | func | Yes | Function to close the drawer | - |
12
+ | visible | bool | Yes | Handles drawer visibility (if open or not) | - |
13
+ | dataTestId | string | No | Test ID for automated testing. Enables hierarchical test ID structure. | - |
14
+ | ModalProps | object | No | Props to pass to the Modal component (same as [react-native-modal](https://github.com/react-native-community/react-native-modal)) | - |
15
+ | CloseButtonProps | object | No | Props to pass to the CloseButton component (same as IconButton) | - |
16
+ | styles | object | No | Styles to pass to the drawer components | - |
17
+ | width | string or number | No | Width of the drawer, could be a percentage or number | '70%' |
18
+ | title | string | No | Title label | --- |
19
+ | titleProps | object | No | props for the title label | {} |
19
20
 
21
+ ## Test IDs
22
+
23
+ When `dataTestId` is provided, the component creates a hierarchical test ID structure:
24
+
25
+ | Element | Test ID | Condition |
26
+ | ------------ | --------------------- | --------------------------------- |
27
+ | Modal | `${dataTestId}` | Always when `dataTestId` provided |
28
+ | Title | `${dataTestId}.title` | When `title` prop is provided |
29
+ | Close Button | `${dataTestId}.close` | Always when `dataTestId` provided |
30
+
31
+ ### Test ID Structure Details
32
+
33
+ - **Modal**: The main modal container that holds the drawer
34
+ - **Title**: The title label displayed in the header
35
+ - **Close Button**: The button used to close the drawer
36
+
37
+ The children content does not receive automatic test IDs. Developers should add test IDs directly to their children components as needed.
20
38
 
21
39
  Styles object:
22
40
 
@@ -55,3 +73,35 @@ const UTDetailDrawerExample = () => {
55
73
  );
56
74
  };
57
75
  ```
76
+
77
+ #### Example with Test IDs
78
+
79
+ ```js
80
+ const UTDetailDrawerTestExample = () => {
81
+ const [open, setOpen] = useState(false);
82
+
83
+ return (
84
+ <Layout>
85
+ <View>
86
+ <UTLabel big>This is a drawer example</UTLabel>
87
+ <Button title="Open Settings" onPress={() => setOpen(true)} />
88
+ </View>
89
+ <UTDetailDrawer
90
+ dataTestId="settingsDrawer"
91
+ title="Settings"
92
+ onClose={() => setOpen(false)}
93
+ visible={open}
94
+ >
95
+ <View>
96
+ <UTLabel>Settings content goes here</UTLabel>
97
+ </View>
98
+ </UTDetailDrawer>
99
+ </Layout>
100
+ );
101
+ };
102
+
103
+ // Generated test IDs:
104
+ // settingsDrawer (modal container)
105
+ // settingsDrawer.title (title label)
106
+ // settingsDrawer.close (close button)
107
+ ```
@@ -5,11 +5,15 @@ import { SafeAreaView, View, ScrollView } from 'react-native';
5
5
  import Label from '../Label';
6
6
  import { withTheme } from '../../theming';
7
7
  import UTButton from '../UTButton';
8
+ import { TEST_ID_CONSTANTS } from '../../constants/testIds';
8
9
 
9
10
  import propTypes, { UTDetailDrawerDefaultProps } from './propTypes';
10
11
  import mergeStyles from './styles';
11
12
 
13
+ const { title: titleTestId, close } = TEST_ID_CONSTANTS;
14
+
12
15
  const UTDetailDrawer = ({
16
+ dataTestId,
13
17
  onClose,
14
18
  visible,
15
19
  children,
@@ -39,6 +43,7 @@ const UTDetailDrawer = ({
39
43
 
40
44
  return (
41
45
  <Modal
46
+ testID={dataTestId}
42
47
  isVisible={visible}
43
48
  onBackdropPress={onClose}
44
49
  animationIn="slideInRight"
@@ -58,12 +63,17 @@ const UTDetailDrawer = ({
58
63
  ) : (
59
64
  <View style={mergedStyles.headerContainer}>
60
65
  {!!title && (
61
- <Label style={mergedStyles.title} {...titleProps}>
66
+ <Label
67
+ dataTestId={dataTestId ? `${dataTestId}.${titleTestId}` : undefined}
68
+ style={mergedStyles.title}
69
+ {...titleProps}
70
+ >
62
71
  {title}
63
72
  </Label>
64
73
  )}
65
74
  {iconButton && (
66
75
  <UTButton
76
+ dataTestId={dataTestId ? `${dataTestId}.${close}` : undefined}
67
77
  onPress={onClose}
68
78
  Icon="IconX"
69
79
  variant={CloseButtonProps.variant || 'text'}
@@ -7,6 +7,7 @@ export const UTDetailDrawerDefaultProps = {
7
7
  };
8
8
 
9
9
  export default {
10
+ dataTestId: string,
10
11
  onClose: func.isRequired,
11
12
  visible: bool.isRequired,
12
13
  ModalProps: shape(any),
@@ -0,0 +1,99 @@
1
+ # UTFieldLabel
2
+
3
+ ## Description
4
+
5
+ > ⚠️ **AI-GENERATED DOCUMENTATION**
6
+ > This documentation was entirely generated by an AI assistant and has NOT been reviewed by human developers. The test ID implementation details, patterns, examples, and usage instructions should be thoroughly verified before use in production. Please validate all functionality and testing approaches with your development team.
7
+
8
+ `UTFieldLabel` is a label component designed for form fields. It provides consistent styling and supports required field indicators with customizable appearance.
9
+
10
+ ## Props
11
+
12
+ | Name | Type | Default | Description |
13
+ | ---------- | ------ | ------- | ---------------------------------------------------------------------- |
14
+ | children | node | | The text content to display as the label. |
15
+ | dataTestId | string | | Test ID for automated testing. Enables hierarchical test ID structure. |
16
+ | required | bool | false | Whether to show a required indicator (asterisk) next to the label. |
17
+ | style | object | | Custom styles to apply to the label. |
18
+
19
+ ## Test IDs
20
+
21
+ When `dataTestId` is provided, the component creates a hierarchical test ID structure:
22
+
23
+ | Element | Test ID | Condition |
24
+ | ------------------ | ------------------------ | --------------------------------- |
25
+ | Label | `${dataTestId}` | Always when `dataTestId` provided |
26
+ | Required indicator | `${dataTestId}.required` | When `required` prop is true |
27
+
28
+ ### Test ID Structure Details
29
+
30
+ - **Label**: The main label text element
31
+ - **Required indicator**: The asterisk (\*) symbol shown when field is required
32
+
33
+ The UTFieldLabel component creates a hierarchical test ID structure that allows for precise testing of both the label content and the required indicator.
34
+
35
+ ## Usage
36
+
37
+ ### Basic Example
38
+
39
+ ```jsx
40
+ import React from 'react';
41
+ import UTFieldLabel from '@widergy/mobile-ui';
42
+
43
+ const BasicExample = () => {
44
+ return <UTFieldLabel>Email Address</UTFieldLabel>;
45
+ };
46
+
47
+ export default BasicExample;
48
+ ```
49
+
50
+ ### Required Field Example
51
+
52
+ ```jsx
53
+ import React from 'react';
54
+ import UTFieldLabel from '@widergy/mobile-ui';
55
+
56
+ const RequiredExample = () => {
57
+ return <UTFieldLabel required>Password</UTFieldLabel>;
58
+ };
59
+
60
+ export default RequiredExample;
61
+ ```
62
+
63
+ ### Example with Test IDs
64
+
65
+ ```jsx
66
+ import React from 'react';
67
+ import UTFieldLabel from '@widergy/mobile-ui';
68
+
69
+ const TestableExample = () => {
70
+ return (
71
+ <UTFieldLabel dataTestId="emailLabel" required>
72
+ Email Address
73
+ </UTFieldLabel>
74
+ );
75
+ };
76
+
77
+ // Generated test IDs:
78
+ // emailLabel (label text)
79
+ // emailLabel.required (required asterisk indicator)
80
+
81
+ export default TestableExample;
82
+ ```
83
+
84
+ ### Custom Styled Example
85
+
86
+ ```jsx
87
+ import React from 'react';
88
+ import UTFieldLabel from '@widergy/mobile-ui';
89
+
90
+ const StyledExample = () => {
91
+ return (
92
+ <UTFieldLabel style={{ fontSize: 16, fontWeight: 'bold', color: '#333' }} required>
93
+ Full Name
94
+ </UTFieldLabel>
95
+ );
96
+ };
97
+
98
+ export default StyledExample;
99
+ ```
@@ -3,14 +3,18 @@ import { bool, elementType, string } from 'prop-types';
3
3
  import { View } from 'react-native';
4
4
 
5
5
  import UTLabel from '../UTLabel';
6
+ import { TEST_ID_CONSTANTS } from '../../constants/testIds';
6
7
 
7
8
  import { REQUIRED_LABEL } from './constants';
8
9
  import styles from './styles';
9
10
 
11
+ const { required: requiredTestId } = TEST_ID_CONSTANTS;
12
+
10
13
  const UTFieldLabel = ({
11
14
  children,
12
15
  colorTheme,
13
16
  CustomTitleComponent,
17
+ dataTestId,
14
18
  required,
15
19
  style,
16
20
  variant,
@@ -21,12 +25,24 @@ const UTFieldLabel = ({
21
25
 
22
26
  return (
23
27
  <View style={[styles.label, style]}>
24
- <Title colorTheme={colorTheme} variant={variant} weight={weight} withMarkdown={withMarkdown}>
28
+ <Title
29
+ colorTheme={colorTheme}
30
+ dataTestId={dataTestId}
31
+ variant={variant}
32
+ weight={weight}
33
+ withMarkdown={withMarkdown}
34
+ >
25
35
  {children}
26
36
  </Title>
27
37
 
28
38
  {required && (
29
- <UTLabel colorTheme="error" shade="04" variant={variant} weight={weight}>
39
+ <UTLabel
40
+ colorTheme="error"
41
+ dataTestId={dataTestId ? `${dataTestId}.${requiredTestId}` : undefined}
42
+ shade="04"
43
+ variant={variant}
44
+ weight={weight}
45
+ >
30
46
  {REQUIRED_LABEL}
31
47
  </UTLabel>
32
48
  )}
@@ -37,6 +53,7 @@ const UTFieldLabel = ({
37
53
  UTFieldLabel.propTypes = {
38
54
  colorTheme: string,
39
55
  CustomTitleComponent: elementType,
56
+ dataTestId: string,
40
57
  required: bool,
41
58
  variant: string,
42
59
  weight: string,
@@ -13,11 +13,11 @@ For a comprehensive list of available icons and their design specifications, ref
13
13
 
14
14
  ## Props
15
15
 
16
-
17
16
  | Name | Type | Default | Description |
18
- | :----------- | --------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | :--------- | ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
19
18
  | area | boolean | false | Padding around the icon is added when it is true. |
20
19
  | colorTheme | string | 'dark' | The icon color, must be from the theme palette. |
20
+ | dataTestId | string | | Test ID for automated testing. |
21
21
  | fillTheme | string | | The internal fill color must be from the theme palette. |
22
22
  | name | string | | The name of the icon from the Tabler Icons library. |
23
23
  | shade | string | | The shade of the color theme to use. |
@@ -25,6 +25,20 @@ For a comprehensive list of available icons and their design specifications, ref
25
25
  | style | object | | Custom styles to apply to the icon. |
26
26
  | variant | string | 'default' | It depends on the `area` property and defines whether it should be displayed filled (`default`) or just with a border (`outlined`) around the icon. |
27
27
 
28
+ ## Test IDs
29
+
30
+ When `dataTestId` is provided, the component applies the test ID to its element:
31
+
32
+ | Element | Test ID | Condition |
33
+ | ------- | --------------- | --------------------------------- |
34
+ | Icon | `${dataTestId}` | Always when `dataTestId` provided |
35
+
36
+ ### Test ID Details
37
+
38
+ - **Icon**: The main icon element that renders the specified icon
39
+
40
+ The UTIcon component applies the test ID directly to its root icon element, making it easy to identify and interact with in automated tests.
41
+
28
42
  ## Icon Names
29
43
 
30
44
  Icon names must be in PascalCase. Typically, icon names are a conversion from Figma's or Zeroheight's snake_case to PascalCase, adding `Icon` as a prefix.
@@ -119,3 +133,12 @@ Clarifications:
119
133
  ```javascript
120
134
  <UTIcon colorTheme="primary" name="IconTruckDelivery" size={48} />
121
135
  ```
136
+
137
+ ### Example with Test IDs
138
+
139
+ ```javascript
140
+ <UTIcon dataTestId="deliveryIcon" colorTheme="primary" name="IconTruckDelivery" size={48} />
141
+
142
+ // Generated test IDs:
143
+ // deliveryIcon (icon element)
144
+ ```
@@ -13,6 +13,7 @@ const UTIcon = ({
13
13
  area,
14
14
  color,
15
15
  colorTheme = 'dark',
16
+ dataTestId,
16
17
  fillShade,
17
18
  fillTheme,
18
19
  iconStyles,
@@ -50,7 +51,7 @@ const UTIcon = ({
50
51
  style
51
52
  ]}
52
53
  >
53
- <IconComponent {...{ ...iconProps, ...iconStyles }} />
54
+ <IconComponent testID={dataTestId} {...{ ...iconProps, ...iconStyles }} />
54
55
  </View>
55
56
  );
56
57
  };
@@ -62,6 +63,7 @@ UTIcon.propTypes = {
62
63
  */
63
64
  color: string,
64
65
  colorTheme: string,
66
+ dataTestId: string,
65
67
  fillShade: string,
66
68
  fillTheme: string,
67
69
  iconStyles: object,