@utilitywarehouse/hearth-react-native 0.27.2-testid-fix-1 → 0.27.2-testid-fix-3
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.
- package/.turbo/turbo-build.log +1 -1
- package/build/components/Select/Select.d.ts +1 -1
- package/build/components/Select/Select.js +5 -4
- package/build/components/Select/Select.props.d.ts +4 -0
- package/build/components/Select/SelectOption.d.ts +1 -1
- package/build/components/Select/SelectOption.js +2 -2
- package/build/components/VerificationInput/VerificationInput.js +1 -1
- package/package.json +3 -3
- package/src/components/Select/Select.props.ts +4 -0
- package/src/components/Select/Select.tsx +6 -1
- package/src/components/Select/SelectOption.tsx +2 -0
- package/src/components/VerificationInput/VerificationInput.tsx +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @utilitywarehouse/hearth-react-native@0.27.2-testid-fix-
|
|
3
|
+
> @utilitywarehouse/hearth-react-native@0.27.2-testid-fix-3 build /Users/filmondaniels/Projects/Work/hearth/packages/react-native
|
|
4
4
|
> tsc
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SelectProps from './Select.props';
|
|
2
2
|
declare const Select: {
|
|
3
|
-
({ options, value, onValueChange, label, labelVariant, placeholder, disabled, leadingIcon: LeadingIcon, validationStatus, helperText, helperIcon, invalidText, validText, required, children, bottomSheetProps, menuHeading, readonly, emptyText, listProps, searchable, searchPlaceholder, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ options, value, onValueChange, label, labelVariant, placeholder, disabled, leadingIcon: LeadingIcon, validationStatus, helperText, helperIcon, invalidText, validText, required, children, bottomSheetProps, menuHeading, readonly, emptyText, listProps, searchable, searchPlaceholder, testID, ...rest }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Select;
|
|
@@ -11,7 +11,7 @@ import { Icon } from '../Icon';
|
|
|
11
11
|
import { Input } from '../Input';
|
|
12
12
|
import { SelectContext } from './Select.context';
|
|
13
13
|
import SelectOption from './SelectOption';
|
|
14
|
-
const Select = ({ options = [], value, onValueChange, label, labelVariant = 'body', placeholder = 'Select an option', disabled = false, leadingIcon: LeadingIcon, validationStatus = 'initial', helperText, helperIcon, invalidText, validText, required = true, children, bottomSheetProps, menuHeading, readonly = false, emptyText = 'No options available', listProps, searchable = false, searchPlaceholder = 'Search', ...rest }) => {
|
|
14
|
+
const Select = ({ options = [], value, onValueChange, label, labelVariant = 'body', placeholder = 'Select an option', disabled = false, leadingIcon: LeadingIcon, validationStatus = 'initial', helperText, helperIcon, invalidText, validText, required = true, children, bottomSheetProps, menuHeading, readonly = false, emptyText = 'No options available', listProps, searchable = false, searchPlaceholder = 'Search', testID, ...rest }) => {
|
|
15
15
|
const formFieldContext = useFormFieldContext();
|
|
16
16
|
const validationStatusFromContext = formFieldContext?.validationStatus ?? validationStatus;
|
|
17
17
|
const isRequired = formFieldContext?.required ?? required;
|
|
@@ -64,9 +64,10 @@ const Select = ({ options = [], value, onValueChange, label, labelVariant = 'bod
|
|
|
64
64
|
setIsOpen(false);
|
|
65
65
|
setSearch('');
|
|
66
66
|
}, []);
|
|
67
|
-
const renderSelectOption = useCallback(({ item }) => (_jsx(SelectOption, { label: item.label, value: item.value, disabled: item.disabled, leadingIcon: item.leadingIcon, trailingIcon: item.trailingIcon })), []
|
|
67
|
+
const renderSelectOption = useCallback(({ item }) => (_jsx(SelectOption, { label: item.label, value: item.value, disabled: item.disabled, leadingIcon: item.leadingIcon, trailingIcon: item.trailingIcon, testID: testID ? `${testID}-option-${item.label}` : undefined })), [testID] // ← added testID dependency
|
|
68
|
+
);
|
|
68
69
|
const renderEmptyComponent = useCallback(() => (_jsx(BottomSheetView, { style: styles.emptyContainer, children: _jsx(DetailText, { children: emptyText }) })), [emptyText]);
|
|
69
|
-
return (_jsxs(View, { ...rest, style: [styles.container, rest.style], children: [_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatusFromContext, required: isRequired, disabled: isDisabled, readonly: isReadonly, invalidText: invalidText, validText: validText, children: _jsxs(Pressable, { onPress: openBottomSheet, disabled: isDisabled || isReadonly, style: ({ pressed }) => [
|
|
70
|
+
return (_jsxs(View, { ...rest, style: [styles.container, rest.style], children: [_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatusFromContext, required: isRequired, disabled: isDisabled, readonly: isReadonly, invalidText: invalidText, validText: validText, children: _jsxs(Pressable, { onPress: openBottomSheet, disabled: isDisabled || isReadonly, testID: testID, style: ({ pressed }) => [
|
|
70
71
|
styles.selectContainer,
|
|
71
72
|
styles.pressedContainer(pressed || isOpen),
|
|
72
73
|
], children: [!!LeadingIcon && (_jsx(View, { children: (() => {
|
|
@@ -76,7 +77,7 @@ const Select = ({ options = [], value, onValueChange, label, labelVariant = 'bod
|
|
|
76
77
|
selectedValue: value,
|
|
77
78
|
onValueChange,
|
|
78
79
|
close: closeBottomSheet,
|
|
79
|
-
}, children: [menuHeading && (_jsx(View, { style: styles.headingContainer, children: _jsx(DetailText, { size: "lg", children: menuHeading }) })), searchable && (_jsx(View, { style: styles.searchContainer, children: _jsx(Input, { placeholder: searchPlaceholder, value: search, inBottomSheet: true, onChangeText: setSearch, type: "search" }) })), children ? (_jsx(BottomSheetScrollView, { children: children })) : (_jsx(BottomSheetFlatList, { data: filteredOptions, keyExtractor: (option) => option.value, renderItem: renderSelectOption, ListEmptyComponent: renderEmptyComponent, ...listProps }))] }) })] }));
|
|
80
|
+
}, children: [menuHeading && (_jsx(View, { style: styles.headingContainer, children: _jsx(DetailText, { size: "lg", children: menuHeading }) })), searchable && (_jsx(View, { style: styles.searchContainer, children: _jsx(Input, { placeholder: searchPlaceholder, value: search, inBottomSheet: true, onChangeText: setSearch, type: "search", testID: testID ? `${testID}-search` : undefined }) })), children ? (_jsx(BottomSheetScrollView, { children: children })) : (_jsx(BottomSheetFlatList, { data: filteredOptions, keyExtractor: (option) => option.value, renderItem: renderSelectOption, ListEmptyComponent: renderEmptyComponent, testID: testID ? `${testID}-options` : undefined, ...listProps }))] }) })] }));
|
|
80
81
|
};
|
|
81
82
|
const styles = StyleSheet.create(theme => ({
|
|
82
83
|
container: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectOptionProps } from './Select.props';
|
|
2
2
|
declare const SelectOption: {
|
|
3
|
-
({ label, value, leadingIcon: LeftIcon, trailingIcon: RightIcon, selected, disabled, onPress, }: SelectOptionProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ label, value, leadingIcon: LeftIcon, trailingIcon: RightIcon, selected, disabled, onPress, testID, }: SelectOptionProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default SelectOption;
|
|
@@ -5,7 +5,7 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
5
5
|
import { BodyText } from '../BodyText';
|
|
6
6
|
import { Icon } from '../Icon';
|
|
7
7
|
import { useSelectContext } from './Select.context';
|
|
8
|
-
const SelectOption = ({ label, value, leadingIcon: LeftIcon, trailingIcon: RightIcon, selected, disabled, onPress, }) => {
|
|
8
|
+
const SelectOption = ({ label, value, leadingIcon: LeftIcon, trailingIcon: RightIcon, selected, disabled, onPress, testID, }) => {
|
|
9
9
|
const { selectedValue, onValueChange, close } = useSelectContext();
|
|
10
10
|
const isSelected = selected !== undefined ? selected : selectedValue === value;
|
|
11
11
|
styles.useVariants({ disabled });
|
|
@@ -22,7 +22,7 @@ const SelectOption = ({ label, value, leadingIcon: LeftIcon, trailingIcon: Right
|
|
|
22
22
|
close();
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
return (_jsxs(Pressable, { onPress: handlePress, disabled: disabled, style: ({ pressed }) => [styles.container, pressed && styles.pressed], children: [!!LeftIcon && (_jsx(View, { children: _jsx(Icon, { as: LeftIcon, style: styles.icon }) })), _jsx(View, { style: styles.labelContainer, children: _jsx(BodyText, { children: label }) }), isSelected && (_jsx(View, { children: _jsx(Icon, { as: TickSmallIcon, style: styles.icon }) })), !!RightIcon && !isSelected && (_jsx(View, { children: _jsx(Icon, { as: RightIcon, style: styles.icon }) }))] }));
|
|
25
|
+
return (_jsxs(Pressable, { onPress: handlePress, disabled: disabled, testID: testID, style: ({ pressed }) => [styles.container, pressed && styles.pressed], children: [!!LeftIcon && (_jsx(View, { children: _jsx(Icon, { as: LeftIcon, style: styles.icon }) })), _jsx(View, { style: styles.labelContainer, children: _jsx(BodyText, { children: label }) }), isSelected && (_jsx(View, { children: _jsx(Icon, { as: TickSmallIcon, style: styles.icon }) })), !!RightIcon && !isSelected && (_jsx(View, { children: _jsx(Icon, { as: RightIcon, style: styles.icon }) }))] }));
|
|
26
26
|
};
|
|
27
27
|
const styles = StyleSheet.create(theme => ({
|
|
28
28
|
container: {
|
|
@@ -168,7 +168,7 @@ const VerificationInput = forwardRef(({ value = '', onChangeText, label, labelVa
|
|
|
168
168
|
pendingFocusIndexRef.current = index;
|
|
169
169
|
inputRef.current?.focus();
|
|
170
170
|
setSelectionIndex(index);
|
|
171
|
-
} }, index));
|
|
171
|
+
}, testID: testID ? `${testID}-${index}` : undefined }, index));
|
|
172
172
|
})] }) }));
|
|
173
173
|
});
|
|
174
174
|
const styles = StyleSheet.create(theme => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilitywarehouse/hearth-react-native",
|
|
3
|
-
"version": "0.27.2-testid-fix-
|
|
3
|
+
"version": "0.27.2-testid-fix-3",
|
|
4
4
|
"description": "Utility Warehouse React Native UI library",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"vite": "^7.1.3",
|
|
57
57
|
"vite-plugin-svgr": "^4.5.0",
|
|
58
58
|
"vitest": "^3.2.4",
|
|
59
|
-
"@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
|
|
60
59
|
"@utilitywarehouse/hearth-tokens": "^0.2.4",
|
|
61
60
|
"@utilitywarehouse/hearth-fonts": "^0.0.4",
|
|
62
61
|
"@utilitywarehouse/hearth-react-icons": "^0.8.0",
|
|
63
|
-
"@utilitywarehouse/hearth-svg-assets": "^0.5.0"
|
|
62
|
+
"@utilitywarehouse/hearth-svg-assets": "^0.5.0",
|
|
63
|
+
"@utilitywarehouse/hearth-react-native-icons": "^0.8.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
@@ -40,6 +40,7 @@ const Select = ({
|
|
|
40
40
|
listProps,
|
|
41
41
|
searchable = false,
|
|
42
42
|
searchPlaceholder = 'Search',
|
|
43
|
+
testID,
|
|
43
44
|
...rest
|
|
44
45
|
}: SelectProps) => {
|
|
45
46
|
const formFieldContext = useFormFieldContext();
|
|
@@ -109,9 +110,10 @@ const Select = ({
|
|
|
109
110
|
disabled={item.disabled}
|
|
110
111
|
leadingIcon={item.leadingIcon}
|
|
111
112
|
trailingIcon={item.trailingIcon}
|
|
113
|
+
testID={testID ? `${testID}-option-${item.label}` : undefined} // ← restored
|
|
112
114
|
/>
|
|
113
115
|
),
|
|
114
|
-
[]
|
|
116
|
+
[testID] // ← added testID dependency
|
|
115
117
|
);
|
|
116
118
|
|
|
117
119
|
const renderEmptyComponent = useCallback(
|
|
@@ -140,6 +142,7 @@ const Select = ({
|
|
|
140
142
|
<Pressable
|
|
141
143
|
onPress={openBottomSheet}
|
|
142
144
|
disabled={isDisabled || isReadonly}
|
|
145
|
+
testID={testID}
|
|
143
146
|
style={({ pressed }) => [
|
|
144
147
|
styles.selectContainer,
|
|
145
148
|
styles.pressedContainer(pressed || isOpen),
|
|
@@ -192,6 +195,7 @@ const Select = ({
|
|
|
192
195
|
inBottomSheet
|
|
193
196
|
onChangeText={setSearch}
|
|
194
197
|
type="search"
|
|
198
|
+
testID={testID ? `${testID}-search` : undefined}
|
|
195
199
|
/>
|
|
196
200
|
</View>
|
|
197
201
|
)}
|
|
@@ -204,6 +208,7 @@ const Select = ({
|
|
|
204
208
|
keyExtractor={(option: any) => option.value}
|
|
205
209
|
renderItem={renderSelectOption}
|
|
206
210
|
ListEmptyComponent={renderEmptyComponent}
|
|
211
|
+
testID={testID ? `${testID}-options` : undefined}
|
|
207
212
|
{...listProps}
|
|
208
213
|
/>
|
|
209
214
|
)}
|
|
@@ -14,6 +14,7 @@ const SelectOption = ({
|
|
|
14
14
|
selected,
|
|
15
15
|
disabled,
|
|
16
16
|
onPress,
|
|
17
|
+
testID,
|
|
17
18
|
}: SelectOptionProps) => {
|
|
18
19
|
const { selectedValue, onValueChange, close } = useSelectContext();
|
|
19
20
|
const isSelected = selected !== undefined ? selected : selectedValue === value;
|
|
@@ -38,6 +39,7 @@ const SelectOption = ({
|
|
|
38
39
|
<Pressable
|
|
39
40
|
onPress={handlePress}
|
|
40
41
|
disabled={disabled}
|
|
42
|
+
testID={testID}
|
|
41
43
|
style={({ pressed }) => [styles.container, pressed && styles.pressed]}
|
|
42
44
|
>
|
|
43
45
|
{!!LeftIcon && (
|