@hero-design/rn 7.10.1 → 7.10.2-rc.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.
- package/.turbo/turbo-build.log +8 -8
- package/es/index.js +7 -5
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +7 -5
- package/package.json +2 -2
- package/src/components/TextInput/__tests__/.log/ti-10343.log +62 -0
- package/src/components/TextInput/__tests__/.log/tsserver.log +6983 -0
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +489 -6
- package/src/components/TextInput/__tests__/index.spec.tsx +44 -0
- package/src/components/TextInput/index.tsx +6 -3
- package/types/components/Alert/StyledAlert.d.ts +0 -0
- package/types/components/Alert/__tests__/index.spec.d.ts +0 -0
- package/types/components/Alert/index.d.ts +0 -0
- package/types/components/Avatar/StyledAvatar.d.ts +0 -0
- package/types/components/Avatar/__tests__/StyledAvatar.spec.d.ts +0 -0
- package/types/components/Avatar/__tests__/index.spec.d.ts +0 -0
- package/types/components/Avatar/index.d.ts +0 -0
- package/types/components/Badge/Status.d.ts +0 -0
- package/types/components/Badge/StyledBadge.d.ts +0 -0
- package/types/components/Badge/__tests__/Badge.spec.d.ts +0 -0
- package/types/components/Badge/__tests__/Status.spec.d.ts +0 -0
- package/types/components/Badge/index.d.ts +0 -0
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
- package/types/components/BottomNavigation/__tests__/index.spec.d.ts +0 -0
- package/types/components/BottomNavigation/index.d.ts +0 -0
- package/types/components/BottomSheet/Footer.d.ts +0 -0
- package/types/components/BottomSheet/Header.d.ts +0 -0
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
- package/types/components/BottomSheet/__tests__/index.spec.d.ts +0 -0
- package/types/components/BottomSheet/index.d.ts +0 -0
- package/types/components/Button/Button.d.ts +0 -0
- package/types/components/Button/IconButton.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
- package/types/components/Button/StyledButton.d.ts +0 -0
- package/types/components/Button/UtilityButton/__tests__/index.spec.d.ts +0 -0
- package/types/components/Button/UtilityButton/index.d.ts +0 -0
- package/types/components/Button/UtilityButton/styled.d.ts +0 -0
- package/types/components/Button/__tests__/Button.spec.d.ts +0 -0
- package/types/components/Button/__tests__/IconButton.spec.d.ts +0 -0
- package/types/components/Button/__tests__/StyledButton.spec.d.ts +0 -0
- package/types/components/Button/index.d.ts +0 -0
- package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
- package/types/components/Card/DataCard/__tests__/StyledDataCard.spec.d.ts +0 -0
- package/types/components/Card/DataCard/__tests__/index.spec.d.ts +0 -0
- package/types/components/Card/DataCard/index.d.ts +0 -0
- package/types/components/Card/StyledCard.d.ts +0 -0
- package/types/components/Card/__tests__/StyledCard.spec.d.ts +0 -0
- package/types/components/Card/__tests__/index.spec.d.ts +0 -0
- package/types/components/Card/index.d.ts +0 -0
- package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
- package/types/components/Checkbox/__tests__/StyledCheckbox.spec.d.ts +0 -0
- package/types/components/Checkbox/__tests__/index.spec.d.ts +0 -0
- package/types/components/Checkbox/index.d.ts +0 -0
- package/types/components/Collapse/StyledCollapse.d.ts +0 -0
- package/types/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -0
- package/types/components/Collapse/__tests__/index.spec.d.ts +0 -0
- package/types/components/Collapse/index.d.ts +0 -0
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
- package/types/components/ContentNavigator/__tests__/StyledContentNavigator.spec.d.ts +0 -0
- package/types/components/ContentNavigator/__tests__/index.spec.d.ts +0 -0
- package/types/components/ContentNavigator/index.d.ts +0 -0
- package/types/components/Divider/StyledDivider.d.ts +0 -0
- package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -0
- package/types/components/Divider/index.d.ts +0 -0
- package/types/components/Drawer/StyledDrawer.d.ts +0 -0
- package/types/components/Drawer/__tests__/index.spec.d.ts +0 -0
- package/types/components/Drawer/index.d.ts +0 -0
- package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -0
- package/types/components/FAB/ActionGroup/index.d.ts +0 -0
- package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
- package/types/components/FAB/FAB.d.ts +0 -0
- package/types/components/FAB/StyledFAB.d.ts +0 -0
- package/types/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -0
- package/types/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -0
- package/types/components/FAB/__tests__/index.spec.d.ts +0 -0
- package/types/components/FAB/index.d.ts +0 -0
- package/types/components/Icon/HeroIcon/index.d.ts +0 -0
- package/types/components/Icon/IconList.d.ts +0 -0
- package/types/components/Icon/__tests__/index.spec.d.ts +0 -0
- package/types/components/Icon/index.d.ts +0 -0
- package/types/components/Icon/utils.d.ts +0 -0
- package/types/components/List/BasicListItem.d.ts +0 -0
- package/types/components/List/ListItem.d.ts +0 -0
- package/types/components/List/StyledBasicListItem.d.ts +0 -0
- package/types/components/List/StyledListItem.d.ts +0 -0
- package/types/components/List/__tests__/BasicListItem.spec.d.ts +0 -0
- package/types/components/List/__tests__/ListItem.spec.d.ts +0 -0
- package/types/components/List/__tests__/StyledBasicListItem.spec.d.ts +0 -0
- package/types/components/List/__tests__/StyledListItem.spec.d.ts +0 -0
- package/types/components/List/index.d.ts +0 -0
- package/types/components/Progress/ProgressBar.d.ts +0 -0
- package/types/components/Progress/ProgressCircle.d.ts +0 -0
- package/types/components/Progress/StyledProgressBar.d.ts +0 -0
- package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
- package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
- package/types/components/Progress/index.d.ts +0 -0
- package/types/components/Progress/types.d.ts +0 -0
- package/types/components/Radio/Radio.d.ts +0 -0
- package/types/components/Radio/RadioGroup.d.ts +0 -0
- package/types/components/Radio/StyledRadio.d.ts +0 -0
- package/types/components/Radio/__tests__/Radio.spec.d.ts +0 -0
- package/types/components/Radio/__tests__/RadioGroup.spec.d.ts +0 -0
- package/types/components/Radio/__tests__/StyledRadio.spec.d.ts +0 -0
- package/types/components/Radio/index.d.ts +0 -0
- package/types/components/Radio/types.d.ts +0 -0
- package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
- package/types/components/SectionHeading/__tests__/StyledHeading.spec.d.ts +0 -0
- package/types/components/SectionHeading/__tests__/index.spec.d.ts +0 -0
- package/types/components/SectionHeading/index.d.ts +0 -0
- package/types/components/Select/Footer.d.ts +0 -0
- package/types/components/Select/MultiSelect/Option.d.ts +0 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/Option.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/OptionList.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/index.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/index.d.ts +0 -0
- package/types/components/Select/SingleSelect/Option.d.ts +0 -0
- package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
- package/types/components/Select/SingleSelect/__tests__/Option.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/__tests__/OptionList.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/__tests__/index.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/index.d.ts +0 -0
- package/types/components/Select/StyledSelect.d.ts +0 -0
- package/types/components/Select/__tests__/StyledSelect.spec.d.ts +0 -0
- package/types/components/Select/helpers.d.ts +0 -0
- package/types/components/Select/index.d.ts +0 -0
- package/types/components/Select/types.d.ts +0 -0
- package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
- package/types/components/Spinner/StyledSpinner.d.ts +0 -0
- package/types/components/Spinner/__tests__/AnimatedSpinner.spec.d.ts +0 -0
- package/types/components/Spinner/__tests__/StyledSpinner.spec.d.ts +0 -0
- package/types/components/Spinner/__tests__/index.spec.d.ts +0 -0
- package/types/components/Spinner/index.d.ts +0 -0
- package/types/components/Switch/StyledSwitch.d.ts +0 -0
- package/types/components/Switch/__tests__/StyledHeading.spec.d.ts +0 -0
- package/types/components/Switch/__tests__/index.spec.d.ts +0 -0
- package/types/components/Switch/index.d.ts +0 -0
- package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
- package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledTabs.d.ts +0 -0
- package/types/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -0
- package/types/components/Tabs/__tests__/index.spec.d.ts +0 -0
- package/types/components/Tabs/index.d.ts +0 -0
- package/types/components/Tabs/utils.d.ts +0 -0
- package/types/components/Tag/StyledTag.d.ts +0 -0
- package/types/components/Tag/__tests__/Tag.spec.d.ts +0 -0
- package/types/components/Tag/index.d.ts +0 -0
- package/types/components/TextInput/StyledTextInput.d.ts +0 -0
- package/types/components/TextInput/__tests__/StyledTextInput.spec.d.ts +0 -0
- package/types/components/TextInput/__tests__/index.spec.d.ts +0 -0
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/components/Toast/StyledToast.d.ts +0 -0
- package/types/components/Toast/Toast.d.ts +0 -0
- package/types/components/Toast/ToastContainer.d.ts +0 -0
- package/types/components/Toast/ToastContext.d.ts +0 -0
- package/types/components/Toast/ToastProvider.d.ts +0 -0
- package/types/components/Toast/__tests__/Toast.spec.d.ts +0 -0
- package/types/components/Toast/__tests__/ToastContainer.spec.d.ts +0 -0
- package/types/components/Toast/index.d.ts +0 -0
- package/types/components/Toast/types.d.ts +0 -0
- package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
- package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
- package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
- package/types/components/Toolbar/__tests__/ToolbarGroup.spec.d.ts +0 -0
- package/types/components/Toolbar/__tests__/ToolbarItem.spec.d.ts +0 -0
- package/types/components/Toolbar/index.d.ts +0 -0
- package/types/components/Typography/Text/StyledText.d.ts +0 -0
- package/types/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -0
- package/types/components/Typography/Text/__tests__/index.spec.d.ts +0 -0
- package/types/components/Typography/Text/index.d.ts +0 -0
- package/types/components/Typography/index.d.ts +0 -0
- package/types/index.d.ts +0 -0
- package/types/testHelpers/renderWithTheme.d.ts +0 -0
- package/types/theme/__tests__/index.spec.d.ts +0 -0
- package/types/theme/components/alert.d.ts +0 -0
- package/types/theme/components/avatar.d.ts +0 -0
- package/types/theme/components/badge.d.ts +0 -0
- package/types/theme/components/bottomNavigation.d.ts +0 -0
- package/types/theme/components/bottomSheet.d.ts +0 -0
- package/types/theme/components/button.d.ts +0 -0
- package/types/theme/components/card.d.ts +0 -0
- package/types/theme/components/checkbox.d.ts +0 -0
- package/types/theme/components/contentNavigator.d.ts +0 -0
- package/types/theme/components/divider.d.ts +0 -0
- package/types/theme/components/drawer.d.ts +0 -0
- package/types/theme/components/fab.d.ts +0 -0
- package/types/theme/components/icon.d.ts +0 -0
- package/types/theme/components/list.d.ts +0 -0
- package/types/theme/components/progress.d.ts +0 -0
- package/types/theme/components/radio.d.ts +0 -0
- package/types/theme/components/sectionHeading.d.ts +0 -0
- package/types/theme/components/select.d.ts +0 -0
- package/types/theme/components/spinner.d.ts +0 -0
- package/types/theme/components/switch.d.ts +0 -0
- package/types/theme/components/tabs.d.ts +0 -0
- package/types/theme/components/tag.d.ts +0 -0
- package/types/theme/components/textInput.d.ts +0 -0
- package/types/theme/components/toast.d.ts +0 -0
- package/types/theme/components/toolbar.d.ts +0 -0
- package/types/theme/components/typography.d.ts +0 -0
- package/types/theme/global/borders.d.ts +0 -0
- package/types/theme/global/colors.d.ts +0 -0
- package/types/theme/global/index.d.ts +0 -0
- package/types/theme/global/scale.d.ts +0 -0
- package/types/theme/global/space.d.ts +0 -0
- package/types/theme/global/typography.d.ts +0 -0
- package/types/theme/index.d.ts +0 -0
- package/types/types.d.ts +0 -0
- package/types/utils/__tests__/scale.spec.d.ts +0 -0
- package/types/utils/helpers.d.ts +0 -0
- package/types/utils/hooks.d.ts +0 -0
- package/types/utils/scale.d.ts +0 -0
|
@@ -1,5 +1,494 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`TextInput defaultValue TextInput is idle renders correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
pointerEvents="auto"
|
|
6
|
+
style={
|
|
7
|
+
Array [
|
|
8
|
+
Object {
|
|
9
|
+
"marginVertical": 8,
|
|
10
|
+
"width": "100%",
|
|
11
|
+
},
|
|
12
|
+
undefined,
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
>
|
|
16
|
+
<View
|
|
17
|
+
style={
|
|
18
|
+
Array [
|
|
19
|
+
Object {
|
|
20
|
+
"alignItems": "center",
|
|
21
|
+
"flexDirection": "row",
|
|
22
|
+
"padding": 16,
|
|
23
|
+
},
|
|
24
|
+
undefined,
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
<View
|
|
29
|
+
style={
|
|
30
|
+
Array [
|
|
31
|
+
Object {
|
|
32
|
+
"borderColor": "#292a2b",
|
|
33
|
+
"borderRadius": 8,
|
|
34
|
+
"borderWidth": 1,
|
|
35
|
+
"bottom": 0,
|
|
36
|
+
"left": 0,
|
|
37
|
+
"position": "absolute",
|
|
38
|
+
"right": 0,
|
|
39
|
+
"top": 0,
|
|
40
|
+
},
|
|
41
|
+
undefined,
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
themeVariant="filled"
|
|
45
|
+
/>
|
|
46
|
+
<View
|
|
47
|
+
pointerEvents="none"
|
|
48
|
+
style={
|
|
49
|
+
Array [
|
|
50
|
+
Object {
|
|
51
|
+
"backgroundColor": "#ffffff",
|
|
52
|
+
"flexDirection": "row",
|
|
53
|
+
"left": 16,
|
|
54
|
+
"paddingHorizontal": 4,
|
|
55
|
+
"position": "absolute",
|
|
56
|
+
"top": -10,
|
|
57
|
+
"zIndex": 1,
|
|
58
|
+
},
|
|
59
|
+
undefined,
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
>
|
|
63
|
+
<Text
|
|
64
|
+
style={
|
|
65
|
+
Array [
|
|
66
|
+
Object {
|
|
67
|
+
"color": "#292a2b",
|
|
68
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
69
|
+
"fontSize": 12,
|
|
70
|
+
"letterSpacing": 0.36,
|
|
71
|
+
"lineHeight": 20,
|
|
72
|
+
},
|
|
73
|
+
Array [
|
|
74
|
+
Object {
|
|
75
|
+
"color": "#de350b",
|
|
76
|
+
},
|
|
77
|
+
undefined,
|
|
78
|
+
],
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
themeFontSize="small"
|
|
82
|
+
themeFontWeight="regular"
|
|
83
|
+
themeIntent="body"
|
|
84
|
+
themeVariant="filled"
|
|
85
|
+
>
|
|
86
|
+
*
|
|
87
|
+
</Text>
|
|
88
|
+
<Text
|
|
89
|
+
style={
|
|
90
|
+
Array [
|
|
91
|
+
Object {
|
|
92
|
+
"color": "#292a2b",
|
|
93
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
94
|
+
"fontSize": 12,
|
|
95
|
+
"letterSpacing": 0.36,
|
|
96
|
+
"lineHeight": 20,
|
|
97
|
+
},
|
|
98
|
+
Array [
|
|
99
|
+
Object {
|
|
100
|
+
"color": "#292a2b",
|
|
101
|
+
},
|
|
102
|
+
undefined,
|
|
103
|
+
],
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
testID="input-label"
|
|
107
|
+
themeFontSize="small"
|
|
108
|
+
themeFontWeight="regular"
|
|
109
|
+
themeIntent="body"
|
|
110
|
+
themeVariant="filled"
|
|
111
|
+
>
|
|
112
|
+
Amount (AUD)
|
|
113
|
+
</Text>
|
|
114
|
+
</View>
|
|
115
|
+
<HeroIcon
|
|
116
|
+
name="dollar-sign"
|
|
117
|
+
style={
|
|
118
|
+
Array [
|
|
119
|
+
Object {
|
|
120
|
+
"color": "#292a2b",
|
|
121
|
+
"fontSize": 16,
|
|
122
|
+
},
|
|
123
|
+
undefined,
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
testID="input-prefix"
|
|
127
|
+
themeIntent="text"
|
|
128
|
+
themeSize="xsmall"
|
|
129
|
+
/>
|
|
130
|
+
<View
|
|
131
|
+
style={
|
|
132
|
+
Array [
|
|
133
|
+
Object {
|
|
134
|
+
"alignItems": "center",
|
|
135
|
+
"alignSelf": "stretch",
|
|
136
|
+
"flexDirection": "row",
|
|
137
|
+
"flexGrow": 2,
|
|
138
|
+
},
|
|
139
|
+
undefined,
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
<TextInput
|
|
144
|
+
accessibilityState={
|
|
145
|
+
Object {
|
|
146
|
+
"disabled": false,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
defaultValue="1000"
|
|
150
|
+
editable={true}
|
|
151
|
+
maxLength={255}
|
|
152
|
+
onBlur={[Function]}
|
|
153
|
+
onChangeText={[Function]}
|
|
154
|
+
onFocus={[Function]}
|
|
155
|
+
style={
|
|
156
|
+
Array [
|
|
157
|
+
Object {
|
|
158
|
+
"alignSelf": "stretch",
|
|
159
|
+
"flexGrow": 2,
|
|
160
|
+
"fontSize": 14,
|
|
161
|
+
"marginHorizontal": 8,
|
|
162
|
+
"textAlignVertical": "center",
|
|
163
|
+
},
|
|
164
|
+
Object {
|
|
165
|
+
"color": "#292a2b",
|
|
166
|
+
},
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
testID="text-input"
|
|
170
|
+
/>
|
|
171
|
+
</View>
|
|
172
|
+
</View>
|
|
173
|
+
<View
|
|
174
|
+
style={
|
|
175
|
+
Array [
|
|
176
|
+
Object {
|
|
177
|
+
"flex": 1,
|
|
178
|
+
"flexDirection": "row",
|
|
179
|
+
"justifyContent": "space-between",
|
|
180
|
+
},
|
|
181
|
+
undefined,
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
<Text
|
|
186
|
+
style={
|
|
187
|
+
Array [
|
|
188
|
+
Object {
|
|
189
|
+
"color": "#292a2b",
|
|
190
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
191
|
+
"fontSize": 12,
|
|
192
|
+
"letterSpacing": 0.36,
|
|
193
|
+
"lineHeight": 20,
|
|
194
|
+
},
|
|
195
|
+
Array [
|
|
196
|
+
Object {
|
|
197
|
+
"alignSelf": "flex-end",
|
|
198
|
+
"color": "#292a2b",
|
|
199
|
+
"flex": 1,
|
|
200
|
+
"flexGrow": 1,
|
|
201
|
+
"fontSize": 12,
|
|
202
|
+
"marginRight": 4,
|
|
203
|
+
"textAlign": "right",
|
|
204
|
+
},
|
|
205
|
+
undefined,
|
|
206
|
+
],
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
themeFontSize="small"
|
|
210
|
+
themeFontWeight="regular"
|
|
211
|
+
themeIntent="body"
|
|
212
|
+
themeVariant="filled"
|
|
213
|
+
>
|
|
214
|
+
4
|
|
215
|
+
/
|
|
216
|
+
255
|
|
217
|
+
</Text>
|
|
218
|
+
<Text
|
|
219
|
+
style={
|
|
220
|
+
Array [
|
|
221
|
+
Object {
|
|
222
|
+
"color": "#292a2b",
|
|
223
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
224
|
+
"fontSize": 14,
|
|
225
|
+
"letterSpacing": 0.42,
|
|
226
|
+
"lineHeight": 22,
|
|
227
|
+
},
|
|
228
|
+
Array [
|
|
229
|
+
Object {
|
|
230
|
+
"fontSize": 12,
|
|
231
|
+
"marginLeft": 4,
|
|
232
|
+
},
|
|
233
|
+
undefined,
|
|
234
|
+
],
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
themeFontSize="medium"
|
|
238
|
+
themeFontWeight="regular"
|
|
239
|
+
themeIntent="body"
|
|
240
|
+
>
|
|
241
|
+
This is helper text
|
|
242
|
+
</Text>
|
|
243
|
+
</View>
|
|
244
|
+
</View>
|
|
245
|
+
`;
|
|
246
|
+
|
|
247
|
+
exports[`TextInput defaultValue default Value and Value renders correctly with 2000 1`] = `
|
|
248
|
+
<View
|
|
249
|
+
pointerEvents="auto"
|
|
250
|
+
style={
|
|
251
|
+
Array [
|
|
252
|
+
Object {
|
|
253
|
+
"marginVertical": 8,
|
|
254
|
+
"width": "100%",
|
|
255
|
+
},
|
|
256
|
+
undefined,
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
>
|
|
260
|
+
<View
|
|
261
|
+
style={
|
|
262
|
+
Array [
|
|
263
|
+
Object {
|
|
264
|
+
"alignItems": "center",
|
|
265
|
+
"flexDirection": "row",
|
|
266
|
+
"padding": 16,
|
|
267
|
+
},
|
|
268
|
+
undefined,
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
>
|
|
272
|
+
<View
|
|
273
|
+
style={
|
|
274
|
+
Array [
|
|
275
|
+
Object {
|
|
276
|
+
"borderColor": "#292a2b",
|
|
277
|
+
"borderRadius": 8,
|
|
278
|
+
"borderWidth": 1,
|
|
279
|
+
"bottom": 0,
|
|
280
|
+
"left": 0,
|
|
281
|
+
"position": "absolute",
|
|
282
|
+
"right": 0,
|
|
283
|
+
"top": 0,
|
|
284
|
+
},
|
|
285
|
+
undefined,
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
themeVariant="filled"
|
|
289
|
+
/>
|
|
290
|
+
<View
|
|
291
|
+
pointerEvents="none"
|
|
292
|
+
style={
|
|
293
|
+
Array [
|
|
294
|
+
Object {
|
|
295
|
+
"backgroundColor": "#ffffff",
|
|
296
|
+
"flexDirection": "row",
|
|
297
|
+
"left": 16,
|
|
298
|
+
"paddingHorizontal": 4,
|
|
299
|
+
"position": "absolute",
|
|
300
|
+
"top": -10,
|
|
301
|
+
"zIndex": 1,
|
|
302
|
+
},
|
|
303
|
+
undefined,
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
>
|
|
307
|
+
<Text
|
|
308
|
+
style={
|
|
309
|
+
Array [
|
|
310
|
+
Object {
|
|
311
|
+
"color": "#292a2b",
|
|
312
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
313
|
+
"fontSize": 12,
|
|
314
|
+
"letterSpacing": 0.36,
|
|
315
|
+
"lineHeight": 20,
|
|
316
|
+
},
|
|
317
|
+
Array [
|
|
318
|
+
Object {
|
|
319
|
+
"color": "#de350b",
|
|
320
|
+
},
|
|
321
|
+
undefined,
|
|
322
|
+
],
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
themeFontSize="small"
|
|
326
|
+
themeFontWeight="regular"
|
|
327
|
+
themeIntent="body"
|
|
328
|
+
themeVariant="filled"
|
|
329
|
+
>
|
|
330
|
+
*
|
|
331
|
+
</Text>
|
|
332
|
+
<Text
|
|
333
|
+
style={
|
|
334
|
+
Array [
|
|
335
|
+
Object {
|
|
336
|
+
"color": "#292a2b",
|
|
337
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
338
|
+
"fontSize": 12,
|
|
339
|
+
"letterSpacing": 0.36,
|
|
340
|
+
"lineHeight": 20,
|
|
341
|
+
},
|
|
342
|
+
Array [
|
|
343
|
+
Object {
|
|
344
|
+
"color": "#292a2b",
|
|
345
|
+
},
|
|
346
|
+
undefined,
|
|
347
|
+
],
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
testID="input-label"
|
|
351
|
+
themeFontSize="small"
|
|
352
|
+
themeFontWeight="regular"
|
|
353
|
+
themeIntent="body"
|
|
354
|
+
themeVariant="filled"
|
|
355
|
+
>
|
|
356
|
+
Amount (AUD)
|
|
357
|
+
</Text>
|
|
358
|
+
</View>
|
|
359
|
+
<HeroIcon
|
|
360
|
+
name="dollar-sign"
|
|
361
|
+
style={
|
|
362
|
+
Array [
|
|
363
|
+
Object {
|
|
364
|
+
"color": "#292a2b",
|
|
365
|
+
"fontSize": 16,
|
|
366
|
+
},
|
|
367
|
+
undefined,
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
testID="input-prefix"
|
|
371
|
+
themeIntent="text"
|
|
372
|
+
themeSize="xsmall"
|
|
373
|
+
/>
|
|
374
|
+
<View
|
|
375
|
+
style={
|
|
376
|
+
Array [
|
|
377
|
+
Object {
|
|
378
|
+
"alignItems": "center",
|
|
379
|
+
"alignSelf": "stretch",
|
|
380
|
+
"flexDirection": "row",
|
|
381
|
+
"flexGrow": 2,
|
|
382
|
+
},
|
|
383
|
+
undefined,
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
>
|
|
387
|
+
<TextInput
|
|
388
|
+
accessibilityState={
|
|
389
|
+
Object {
|
|
390
|
+
"disabled": false,
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
defaultValue="1000"
|
|
394
|
+
editable={true}
|
|
395
|
+
maxLength={255}
|
|
396
|
+
onBlur={[Function]}
|
|
397
|
+
onChangeText={[Function]}
|
|
398
|
+
onFocus={[Function]}
|
|
399
|
+
style={
|
|
400
|
+
Array [
|
|
401
|
+
Object {
|
|
402
|
+
"alignSelf": "stretch",
|
|
403
|
+
"flexGrow": 2,
|
|
404
|
+
"fontSize": 14,
|
|
405
|
+
"marginHorizontal": 8,
|
|
406
|
+
"textAlignVertical": "center",
|
|
407
|
+
},
|
|
408
|
+
Object {
|
|
409
|
+
"color": "#292a2b",
|
|
410
|
+
},
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
testID="text-input"
|
|
414
|
+
value="2000"
|
|
415
|
+
/>
|
|
416
|
+
</View>
|
|
417
|
+
</View>
|
|
418
|
+
<View
|
|
419
|
+
style={
|
|
420
|
+
Array [
|
|
421
|
+
Object {
|
|
422
|
+
"flex": 1,
|
|
423
|
+
"flexDirection": "row",
|
|
424
|
+
"justifyContent": "space-between",
|
|
425
|
+
},
|
|
426
|
+
undefined,
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
>
|
|
430
|
+
<Text
|
|
431
|
+
style={
|
|
432
|
+
Array [
|
|
433
|
+
Object {
|
|
434
|
+
"color": "#292a2b",
|
|
435
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
436
|
+
"fontSize": 12,
|
|
437
|
+
"letterSpacing": 0.36,
|
|
438
|
+
"lineHeight": 20,
|
|
439
|
+
},
|
|
440
|
+
Array [
|
|
441
|
+
Object {
|
|
442
|
+
"alignSelf": "flex-end",
|
|
443
|
+
"color": "#292a2b",
|
|
444
|
+
"flex": 1,
|
|
445
|
+
"flexGrow": 1,
|
|
446
|
+
"fontSize": 12,
|
|
447
|
+
"marginRight": 4,
|
|
448
|
+
"textAlign": "right",
|
|
449
|
+
},
|
|
450
|
+
undefined,
|
|
451
|
+
],
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
themeFontSize="small"
|
|
455
|
+
themeFontWeight="regular"
|
|
456
|
+
themeIntent="body"
|
|
457
|
+
themeVariant="filled"
|
|
458
|
+
>
|
|
459
|
+
4
|
|
460
|
+
/
|
|
461
|
+
255
|
|
462
|
+
</Text>
|
|
463
|
+
<Text
|
|
464
|
+
style={
|
|
465
|
+
Array [
|
|
466
|
+
Object {
|
|
467
|
+
"color": "#292a2b",
|
|
468
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
469
|
+
"fontSize": 14,
|
|
470
|
+
"letterSpacing": 0.42,
|
|
471
|
+
"lineHeight": 22,
|
|
472
|
+
},
|
|
473
|
+
Array [
|
|
474
|
+
Object {
|
|
475
|
+
"fontSize": 12,
|
|
476
|
+
"marginLeft": 4,
|
|
477
|
+
},
|
|
478
|
+
undefined,
|
|
479
|
+
],
|
|
480
|
+
]
|
|
481
|
+
}
|
|
482
|
+
themeFontSize="medium"
|
|
483
|
+
themeFontWeight="regular"
|
|
484
|
+
themeIntent="body"
|
|
485
|
+
>
|
|
486
|
+
This is helper text
|
|
487
|
+
</Text>
|
|
488
|
+
</View>
|
|
489
|
+
</View>
|
|
490
|
+
`;
|
|
491
|
+
|
|
3
492
|
exports[`TextInput disabled renders correctly 1`] = `
|
|
4
493
|
<View
|
|
5
494
|
pointerEvents="none"
|
|
@@ -341,7 +830,6 @@ exports[`TextInput error renders correctly 1`] = `
|
|
|
341
830
|
]
|
|
342
831
|
}
|
|
343
832
|
testID="text-input"
|
|
344
|
-
value=""
|
|
345
833
|
/>
|
|
346
834
|
</View>
|
|
347
835
|
</View>
|
|
@@ -764,7 +1252,6 @@ exports[`TextInput helper text renders correctly 1`] = `
|
|
|
764
1252
|
]
|
|
765
1253
|
}
|
|
766
1254
|
testID="text-input"
|
|
767
|
-
value=""
|
|
768
1255
|
/>
|
|
769
1256
|
</View>
|
|
770
1257
|
</View>
|
|
@@ -955,7 +1442,6 @@ exports[`TextInput idle renders correctly 1`] = `
|
|
|
955
1442
|
]
|
|
956
1443
|
}
|
|
957
1444
|
testID="text-input"
|
|
958
|
-
value=""
|
|
959
1445
|
/>
|
|
960
1446
|
</View>
|
|
961
1447
|
<HeroIcon
|
|
@@ -1160,7 +1646,6 @@ exports[`TextInput idle with suffix and prefix are React Element renders correct
|
|
|
1160
1646
|
]
|
|
1161
1647
|
}
|
|
1162
1648
|
testID="text-input"
|
|
1163
|
-
value=""
|
|
1164
1649
|
/>
|
|
1165
1650
|
</View>
|
|
1166
1651
|
<HeroIcon
|
|
@@ -1628,7 +2113,6 @@ exports[`TextInput placeholder TextInput is idle renders correctly 1`] = `
|
|
|
1628
2113
|
]
|
|
1629
2114
|
}
|
|
1630
2115
|
testID="text-input"
|
|
1631
|
-
value=""
|
|
1632
2116
|
/>
|
|
1633
2117
|
</View>
|
|
1634
2118
|
</View>
|
|
@@ -2043,7 +2527,6 @@ exports[`TextInput required renders correctly 1`] = `
|
|
|
2043
2527
|
]
|
|
2044
2528
|
}
|
|
2045
2529
|
testID="text-input"
|
|
2046
|
-
value=""
|
|
2047
2530
|
/>
|
|
2048
2531
|
</View>
|
|
2049
2532
|
<HeroIcon
|
|
@@ -305,4 +305,48 @@ describe('TextInput', () => {
|
|
|
305
305
|
});
|
|
306
306
|
});
|
|
307
307
|
});
|
|
308
|
+
|
|
309
|
+
describe('defaultValue', () => {
|
|
310
|
+
describe('TextInput is idle', () => {
|
|
311
|
+
it('renders correctly', () => {
|
|
312
|
+
const wrapper = renderWithTheme(
|
|
313
|
+
<TextInput
|
|
314
|
+
label="Amount (AUD)"
|
|
315
|
+
prefix="dollar-sign"
|
|
316
|
+
required
|
|
317
|
+
helpText="This is helper text"
|
|
318
|
+
placeholder="Enter Amount"
|
|
319
|
+
defaultValue="1000"
|
|
320
|
+
maxLength={255}
|
|
321
|
+
/>
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
325
|
+
expect(wrapper.queryByDisplayValue('1000')).toBeTruthy();
|
|
326
|
+
expect(wrapper.queryByText('4/255')).toBeTruthy();
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
describe('default Value and Value', () => {
|
|
331
|
+
it('renders correctly with 2000', () => {
|
|
332
|
+
const wrapper = renderWithTheme(
|
|
333
|
+
<TextInput
|
|
334
|
+
label="Amount (AUD)"
|
|
335
|
+
prefix="dollar-sign"
|
|
336
|
+
required
|
|
337
|
+
helpText="This is helper text"
|
|
338
|
+
placeholder="Enter Amount"
|
|
339
|
+
defaultValue="1000"
|
|
340
|
+
value="2000"
|
|
341
|
+
maxLength={255}
|
|
342
|
+
/>
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
346
|
+
expect(wrapper.queryByDisplayValue('2000')).toBeTruthy();
|
|
347
|
+
expect(wrapper.queryByDisplayValue('1000')).toBeFalsy();
|
|
348
|
+
expect(wrapper.queryByText('4/255')).toBeTruthy();
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
});
|
|
308
352
|
});
|
|
@@ -134,12 +134,14 @@ const TextInput = ({
|
|
|
134
134
|
disabled = false,
|
|
135
135
|
maxLength,
|
|
136
136
|
helpText,
|
|
137
|
-
value
|
|
137
|
+
value,
|
|
138
|
+
defaultValue,
|
|
138
139
|
...nativeProps
|
|
139
140
|
}: TextInputProps): JSX.Element => {
|
|
140
141
|
const textInputReference = useRef<RNTextInput | null>(null);
|
|
142
|
+
const displayText = value || defaultValue || '';
|
|
141
143
|
|
|
142
|
-
const isEmptyValue =
|
|
144
|
+
const isEmptyValue = displayText.length === 0;
|
|
143
145
|
|
|
144
146
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
145
147
|
|
|
@@ -235,6 +237,7 @@ const TextInput = ({
|
|
|
235
237
|
onChangeText={text => {
|
|
236
238
|
nativeProps.onChangeText?.(text);
|
|
237
239
|
}}
|
|
240
|
+
defaultValue={defaultValue}
|
|
238
241
|
placeholder={
|
|
239
242
|
variant === 'focused' ? nativeProps.placeholder : undefined
|
|
240
243
|
}
|
|
@@ -266,7 +269,7 @@ const TextInput = ({
|
|
|
266
269
|
)}
|
|
267
270
|
{shouldShowMaxLength && (
|
|
268
271
|
<StyledMaxLengthMessage themeVariant={variant} fontSize="small">
|
|
269
|
-
{
|
|
272
|
+
{displayText.length}/{maxLength}
|
|
270
273
|
</StyledMaxLengthMessage>
|
|
271
274
|
)}
|
|
272
275
|
{helpText && <StyledHelperText>{helpText}</StyledHelperText>}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|