@aws-amplify/ui-react-native 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/Authenticator/Authenticator.js +8 -0
  3. package/dist/Authenticator/common/DefaultContent/DefaultContent.js +1 -1
  4. package/dist/Authenticator/common/DefaultContent/styles.js +2 -1
  5. package/dist/Authenticator/common/DefaultContent/types.d.ts +2 -1
  6. package/dist/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +8 -7
  7. package/dist/hooks/index.d.ts +1 -0
  8. package/dist/hooks/index.js +1 -0
  9. package/dist/hooks/usePressableContainerStyles/index.d.ts +1 -0
  10. package/dist/hooks/usePressableContainerStyles/index.js +1 -0
  11. package/dist/hooks/usePressableContainerStyles/usePressableContainerStyles.d.ts +19 -0
  12. package/dist/hooks/usePressableContainerStyles/usePressableContainerStyles.js +14 -0
  13. package/dist/primitives/Button/Button.js +13 -12
  14. package/dist/primitives/ErrorMessage/ErrorMessage.d.ts +1 -1
  15. package/dist/primitives/ErrorMessage/ErrorMessage.js +2 -2
  16. package/dist/primitives/ErrorMessage/styles.js +4 -2
  17. package/dist/primitives/ErrorMessage/types.d.ts +2 -0
  18. package/dist/primitives/IconButton/IconButton.js +12 -11
  19. package/dist/primitives/Radio/Radio.js +12 -10
  20. package/dist/primitives/Radio/styles.js +4 -0
  21. package/dist/primitives/Radio/types.d.ts +1 -0
  22. package/dist/primitives/Tabs/Tab.js +13 -13
  23. package/dist/primitives/Tabs/styles.js +4 -0
  24. package/dist/primitives/Tabs/types.d.ts +1 -0
  25. package/dist/version.d.ts +1 -0
  26. package/dist/version.js +1 -0
  27. package/package.json +3 -3
  28. package/src/Authenticator/Authenticator.tsx +10 -0
  29. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +24 -37
  30. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +16 -23
  31. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +25 -41
  32. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +19 -32
  33. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +22 -38
  34. package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +16 -23
  35. package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +16 -23
  36. package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +24 -44
  37. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +34 -67
  38. package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +20 -23
  39. package/src/Authenticator/common/DefaultContainer/__tests__/__snapshots__/DefaultContainer.spec.tsx.snap +3 -6
  40. package/src/Authenticator/common/DefaultContent/DefaultContent.tsx +2 -1
  41. package/src/Authenticator/common/DefaultContent/styles.ts +2 -1
  42. package/src/Authenticator/common/DefaultContent/types.ts +2 -1
  43. package/src/Authenticator/common/DefaultFooter/__tests__/__snapshots__/DefaultFooter.spec.tsx.snap +3 -6
  44. package/src/Authenticator/common/FederatedProviderButton/FederatedProviderButton.tsx +8 -12
  45. package/src/Authenticator/common/FederatedProviderButton/__tests__/FederatedProviderButton.spec.tsx +34 -3
  46. package/src/Authenticator/common/FederatedProviderButton/__tests__/__snapshots__/FederatedProviderButton.spec.tsx.snap +94 -3
  47. package/src/Authenticator/common/FederatedProviderButtons/__tests__/__snapshots__/FederatedProviderButtons.spec.tsx.snap +4 -6
  48. package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +2 -4
  49. package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +1 -1
  50. package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +3 -6
  51. package/src/hooks/index.ts +1 -0
  52. package/src/hooks/usePressableContainerStyles/__tests__/usePressableContainerStyles.spec.ts +68 -0
  53. package/src/hooks/usePressableContainerStyles/index.ts +1 -0
  54. package/src/hooks/usePressableContainerStyles/usePressableContainerStyles.ts +51 -0
  55. package/src/primitives/Button/Button.tsx +16 -23
  56. package/src/primitives/Button/__tests__/__snapshots__/Button.spec.tsx.snap +9 -18
  57. package/src/primitives/ErrorMessage/ErrorMessage.tsx +6 -1
  58. package/src/primitives/ErrorMessage/__tests__/__snapshots__/ErrorMessage.spec.tsx.snap +18 -8
  59. package/src/primitives/ErrorMessage/styles.ts +4 -2
  60. package/src/primitives/ErrorMessage/types.ts +3 -0
  61. package/src/primitives/IconButton/IconButton.tsx +16 -19
  62. package/src/primitives/IconButton/__tests__/IconButton.spec.tsx +6 -6
  63. package/src/primitives/IconButton/__tests__/__snapshots__/IconButton.spec.tsx.snap +4 -8
  64. package/src/primitives/PasswordField/__tests__/__snapshots__/PasswordField.spec.tsx.snap +4 -8
  65. package/src/primitives/Radio/Radio.tsx +15 -16
  66. package/src/primitives/Radio/__tests__/Radio.spec.tsx +1 -0
  67. package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +9 -0
  68. package/src/primitives/Radio/styles.ts +4 -0
  69. package/src/primitives/Radio/types.ts +1 -0
  70. package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +24 -0
  71. package/src/primitives/Tabs/Tab.tsx +17 -18
  72. package/src/primitives/Tabs/__tests__/Tab.spec.tsx +20 -13
  73. package/src/primitives/Tabs/__tests__/__snapshots__/Tab.spec.tsx.snap +23 -43
  74. package/src/primitives/Tabs/__tests__/__snapshots__/Tabs.spec.tsx.snap +14 -26
  75. package/src/primitives/Tabs/styles.ts +4 -0
  76. package/src/primitives/Tabs/types.ts +1 -0
  77. package/src/version.ts +1 -0
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import { StyleSheet, Text, ViewStyle } from 'react-native';
2
+ import { StyleSheet, Text } from 'react-native';
3
3
  import { render, renderHook } from '@testing-library/react-native';
4
4
 
5
5
  import { useTheme } from '../../../theme';
6
6
  import { Tab } from '..';
7
7
  import { getThemedStyles } from '../styles';
8
+ import { getThemedStyles as getButtonThemedStyles } from '../../Button/styles';
8
9
 
9
10
  const customStyles = StyleSheet.create({
10
11
  tabStyle: {
@@ -35,14 +36,21 @@ describe('Tab', () => {
35
36
 
36
37
  const { result } = renderHook(() => useTheme());
37
38
  const themedStyle = getThemedStyles(result.current);
39
+ const buttonThemedStyle = getButtonThemedStyles(result.current);
38
40
 
39
41
  const tab = getByRole('tab');
40
- // select second index as `Button` applies its own style first
41
- expect((tab.props.style as ViewStyle[])[4]).toStrictEqual([
42
- themedStyle.tab,
43
- themedStyle.readonly,
44
- themedStyle.selected,
45
- null,
42
+ expect(tab.props.style).toStrictEqual([
43
+ { ...buttonThemedStyle.container, ...buttonThemedStyle.containerDefault },
44
+ undefined,
45
+ [
46
+ {
47
+ ...themedStyle.tab,
48
+ ...themedStyle.readonly,
49
+ ...themedStyle.selected,
50
+ },
51
+ undefined,
52
+ undefined,
53
+ ],
46
54
  ]);
47
55
  });
48
56
 
@@ -55,14 +63,13 @@ describe('Tab', () => {
55
63
 
56
64
  const { result } = renderHook(() => useTheme());
57
65
  const themedStyle = getThemedStyles(result.current);
66
+ const buttonThemedStyle = getButtonThemedStyles(result.current);
58
67
 
59
68
  const tab = getByRole('tab');
60
- // select second index as `Button` applies its own style first
61
- expect((tab.props.style as ViewStyle[])[4]).toStrictEqual([
62
- themedStyle.tab,
63
- null,
64
- null,
65
- customStyles.tabStyle,
69
+ expect(tab.props.style).toStrictEqual([
70
+ { ...buttonThemedStyle.container, ...buttonThemedStyle.containerDefault },
71
+ undefined,
72
+ [{ ...themedStyle.tab }, undefined, customStyles.tabStyle],
66
73
  ]);
67
74
  });
68
75
  });
@@ -20,17 +20,14 @@ exports[`Tab can apply custom styling 1`] = `
20
20
  Object {
21
21
  "alignItems": "center",
22
22
  "backgroundColor": "transparent",
23
+ "borderColor": "hsl(210, 10%, 58%)",
23
24
  "borderRadius": 4,
25
+ "borderWidth": 1,
24
26
  "justifyContent": "center",
25
27
  "paddingHorizontal": 16,
26
28
  "paddingVertical": 12,
27
29
  },
28
- Object {
29
- "borderColor": "hsl(210, 10%, 58%)",
30
- "borderWidth": 1,
31
- },
32
- null,
33
- null,
30
+ undefined,
34
31
  Array [
35
32
  Object {
36
33
  "backgroundColor": "transparent",
@@ -43,8 +40,7 @@ exports[`Tab can apply custom styling 1`] = `
43
40
  "paddingHorizontal": 16,
44
41
  "paddingVertical": 12,
45
42
  },
46
- null,
47
- null,
43
+ undefined,
48
44
  Object {
49
45
  "backgroundColor": "lavender",
50
46
  "borderTopColor": "rebeccapurple",
@@ -99,38 +95,30 @@ exports[`Tab renders as expected when Tab is selected 1`] = `
99
95
  Object {
100
96
  "alignItems": "center",
101
97
  "backgroundColor": "transparent",
98
+ "borderColor": "hsl(210, 10%, 58%)",
102
99
  "borderRadius": 4,
100
+ "borderWidth": 1,
103
101
  "justifyContent": "center",
104
102
  "paddingHorizontal": 16,
105
103
  "paddingVertical": 12,
106
104
  },
107
- Object {
108
- "borderColor": "hsl(210, 10%, 58%)",
109
- "borderWidth": 1,
110
- },
111
- null,
112
- null,
105
+ undefined,
113
106
  Array [
114
107
  Object {
115
- "backgroundColor": "transparent",
116
- "borderBottomColor": "hsl(210, 5%, 87%)",
108
+ "backgroundColor": "hsl(0, 0%, 100%)",
109
+ "borderBottomColor": "hsl(190, 95%, 30%)",
117
110
  "borderBottomWidth": 2,
118
111
  "borderRadius": 0,
119
112
  "borderWidth": 0,
113
+ "color": "hsl(190, 95%, 30%)",
120
114
  "flexBasis": 0,
121
115
  "flexGrow": 1,
116
+ "opacity": 1,
122
117
  "paddingHorizontal": 16,
123
118
  "paddingVertical": 12,
124
119
  },
125
- Object {
126
- "opacity": 1,
127
- },
128
- Object {
129
- "backgroundColor": "hsl(0, 0%, 100%)",
130
- "borderBottomColor": "hsl(190, 95%, 30%)",
131
- "color": "hsl(190, 95%, 30%)",
132
- },
133
- null,
120
+ undefined,
121
+ undefined,
134
122
  ],
135
123
  ]
136
124
  }
@@ -185,17 +173,14 @@ exports[`Tab renders as expected with a component passed as children 1`] = `
185
173
  Object {
186
174
  "alignItems": "center",
187
175
  "backgroundColor": "transparent",
176
+ "borderColor": "hsl(210, 10%, 58%)",
188
177
  "borderRadius": 4,
178
+ "borderWidth": 1,
189
179
  "justifyContent": "center",
190
180
  "paddingHorizontal": 16,
191
181
  "paddingVertical": 12,
192
182
  },
193
- Object {
194
- "borderColor": "hsl(210, 10%, 58%)",
195
- "borderWidth": 1,
196
- },
197
- null,
198
- null,
183
+ undefined,
199
184
  Array [
200
185
  Object {
201
186
  "backgroundColor": "transparent",
@@ -208,9 +193,8 @@ exports[`Tab renders as expected with a component passed as children 1`] = `
208
193
  "paddingHorizontal": 16,
209
194
  "paddingVertical": 12,
210
195
  },
211
- null,
212
- null,
213
- null,
196
+ undefined,
197
+ undefined,
214
198
  ],
215
199
  ]
216
200
  }
@@ -241,17 +225,14 @@ exports[`Tab renders default Tab as expected 1`] = `
241
225
  Object {
242
226
  "alignItems": "center",
243
227
  "backgroundColor": "transparent",
228
+ "borderColor": "hsl(210, 10%, 58%)",
244
229
  "borderRadius": 4,
230
+ "borderWidth": 1,
245
231
  "justifyContent": "center",
246
232
  "paddingHorizontal": 16,
247
233
  "paddingVertical": 12,
248
234
  },
249
- Object {
250
- "borderColor": "hsl(210, 10%, 58%)",
251
- "borderWidth": 1,
252
- },
253
- null,
254
- null,
235
+ undefined,
255
236
  Array [
256
237
  Object {
257
238
  "backgroundColor": "transparent",
@@ -264,9 +245,8 @@ exports[`Tab renders default Tab as expected 1`] = `
264
245
  "paddingHorizontal": 16,
265
246
  "paddingVertical": 12,
266
247
  },
267
- null,
268
- null,
269
- null,
248
+ undefined,
249
+ undefined,
270
250
  ],
271
251
  ]
272
252
  }
@@ -34,38 +34,30 @@ exports[`Tabs applies theme and custom styling 1`] = `
34
34
  Object {
35
35
  "alignItems": "center",
36
36
  "backgroundColor": "transparent",
37
+ "borderColor": "hsl(210, 10%, 58%)",
37
38
  "borderRadius": 4,
39
+ "borderWidth": 1,
38
40
  "justifyContent": "center",
39
41
  "paddingHorizontal": 16,
40
42
  "paddingVertical": 12,
41
43
  },
42
- Object {
43
- "borderColor": "hsl(210, 10%, 58%)",
44
- "borderWidth": 1,
45
- },
46
- null,
47
- null,
44
+ undefined,
48
45
  Array [
49
46
  Object {
50
- "backgroundColor": "transparent",
51
- "borderBottomColor": "hsl(210, 5%, 87%)",
47
+ "backgroundColor": "hsl(0, 0%, 100%)",
48
+ "borderBottomColor": "hsl(190, 95%, 30%)",
52
49
  "borderBottomWidth": 2,
53
50
  "borderRadius": 0,
54
51
  "borderWidth": 0,
52
+ "color": "hsl(190, 95%, 30%)",
55
53
  "flexBasis": 0,
56
54
  "flexGrow": 1,
55
+ "opacity": 1,
57
56
  "paddingHorizontal": 16,
58
57
  "paddingVertical": 12,
59
58
  },
60
- Object {
61
- "opacity": 1,
62
- },
63
- Object {
64
- "backgroundColor": "hsl(0, 0%, 100%)",
65
- "borderBottomColor": "hsl(190, 95%, 30%)",
66
- "color": "hsl(190, 95%, 30%)",
67
- },
68
- null,
59
+ undefined,
60
+ undefined,
69
61
  ],
70
62
  ]
71
63
  }
@@ -117,17 +109,14 @@ exports[`Tabs applies theme and custom styling 1`] = `
117
109
  Object {
118
110
  "alignItems": "center",
119
111
  "backgroundColor": "transparent",
112
+ "borderColor": "hsl(210, 10%, 58%)",
120
113
  "borderRadius": 4,
114
+ "borderWidth": 1,
121
115
  "justifyContent": "center",
122
116
  "paddingHorizontal": 16,
123
117
  "paddingVertical": 12,
124
118
  },
125
- Object {
126
- "borderColor": "hsl(210, 10%, 58%)",
127
- "borderWidth": 1,
128
- },
129
- null,
130
- null,
119
+ undefined,
131
120
  Array [
132
121
  Object {
133
122
  "backgroundColor": "transparent",
@@ -140,9 +129,8 @@ exports[`Tabs applies theme and custom styling 1`] = `
140
129
  "paddingHorizontal": 16,
141
130
  "paddingVertical": 12,
142
131
  },
143
- null,
144
- null,
145
- null,
132
+ undefined,
133
+ undefined,
146
134
  ],
147
135
  ]
148
136
  }
@@ -30,6 +30,10 @@ export const getThemedStyles = (
30
30
  opacity: opacities[100],
31
31
  ...components?.tabs?.readonly,
32
32
  },
33
+ pressed: {
34
+ opacity: opacities[60],
35
+ ...components?.tabs?.pressed,
36
+ },
33
37
  tabList: {
34
38
  flexDirection: 'row',
35
39
  width: '100%',
@@ -43,6 +43,7 @@ export interface TabProps extends ButtonProps {
43
43
  }
44
44
 
45
45
  export interface TabsStyles {
46
+ pressed?: ViewStyle;
46
47
  readonly?: ViewStyle;
47
48
  selected?: ViewStyle;
48
49
  tabList?: ViewStyle;
package/src/version.ts ADDED
@@ -0,0 +1 @@
1
+ export const VERSION = '1.2.0';