@aws-amplify/ui-react-native 1.2.20 → 1.2.22

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 (113) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/Authenticator/Authenticator.d.ts +101 -148
  3. package/dist/Authenticator/Authenticator.js +2 -3
  4. package/dist/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.d.ts +13 -2
  5. package/dist/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.js +4 -3
  6. package/dist/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.d.ts +13 -2
  7. package/dist/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.js +4 -3
  8. package/dist/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.d.ts +13 -2
  9. package/dist/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.js +4 -3
  10. package/dist/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.d.ts +13 -2
  11. package/dist/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.js +4 -3
  12. package/dist/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.d.ts +13 -2
  13. package/dist/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.js +4 -3
  14. package/dist/Authenticator/Defaults/ResetPassword/ResetPassword.d.ts +13 -2
  15. package/dist/Authenticator/Defaults/ResetPassword/ResetPassword.js +4 -3
  16. package/dist/Authenticator/Defaults/SetupTOTP/SetupTOTP.d.ts +13 -2
  17. package/dist/Authenticator/Defaults/SetupTOTP/SetupTOTP.js +4 -3
  18. package/dist/Authenticator/Defaults/SignIn/SignIn.d.ts +13 -2
  19. package/dist/Authenticator/Defaults/SignIn/SignIn.js +4 -3
  20. package/dist/Authenticator/Defaults/SignUp/SignUp.d.ts +13 -2
  21. package/dist/Authenticator/Defaults/SignUp/SignUp.js +4 -3
  22. package/dist/Authenticator/Defaults/VerifyUser/VerifyUser.d.ts +13 -2
  23. package/dist/Authenticator/Defaults/VerifyUser/VerifyUser.js +4 -3
  24. package/dist/Authenticator/Defaults/types.d.ts +21 -20
  25. package/dist/Authenticator/common/DefaultContent/styles.js +1 -2
  26. package/dist/Authenticator/common/DefaultContent/types.d.ts +1 -1
  27. package/dist/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.d.ts +7 -3
  28. package/dist/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.js +4 -3
  29. package/dist/Authenticator/common/DefaultFormFields/DefaultTextFormFields.d.ts +6 -2
  30. package/dist/Authenticator/common/DefaultFormFields/DefaultTextFormFields.js +3 -3
  31. package/dist/Authenticator/common/DefaultFormFields/types.d.ts +12 -3
  32. package/dist/Authenticator/hooks/types.d.ts +3 -2
  33. package/dist/Authenticator/hooks/useFieldValues/types.d.ts +4 -1
  34. package/dist/Authenticator/hooks/useFieldValues/useFieldValues.d.ts +1 -1
  35. package/dist/Authenticator/hooks/useFieldValues/useFieldValues.js +21 -3
  36. package/dist/Authenticator/hooks/useFieldValues/utils.d.ts +10 -1
  37. package/dist/Authenticator/hooks/useFieldValues/utils.js +32 -2
  38. package/dist/primitives/Heading/styles.js +5 -5
  39. package/dist/primitives/Label/styles.js +2 -2
  40. package/dist/primitives/TextField/TextField.js +2 -1
  41. package/dist/primitives/TextField/styles.js +6 -3
  42. package/dist/primitives/TextField/types.d.ts +1 -0
  43. package/dist/theme/createTheme.js +24 -18
  44. package/dist/theme/types.d.ts +1 -1
  45. package/dist/version.d.ts +1 -1
  46. package/dist/version.js +1 -1
  47. package/jest.config.js +1 -0
  48. package/package.json +5 -5
  49. package/src/Authenticator/Authenticator.tsx +2 -6
  50. package/src/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.tsx +7 -3
  51. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +34 -30
  52. package/src/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.tsx +7 -3
  53. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/ConfirmSignIn.spec.tsx +1 -0
  54. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +14 -14
  55. package/src/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.tsx +7 -3
  56. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/ConfirmSignUp.spec.tsx +1 -0
  57. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +12 -15
  58. package/src/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.tsx +7 -3
  59. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/ConfirmVerifyUser.spec.tsx +1 -0
  60. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +6 -9
  61. package/src/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.tsx +7 -3
  62. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +13 -10
  63. package/src/Authenticator/Defaults/ResetPassword/ResetPassword.tsx +7 -3
  64. package/src/Authenticator/Defaults/ResetPassword/__tests__/ResetPassword.spec.tsx +1 -0
  65. package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +14 -14
  66. package/src/Authenticator/Defaults/SetupTOTP/SetupTOTP.tsx +7 -3
  67. package/src/Authenticator/Defaults/SetupTOTP/__tests__/SetupTOTP.spec.tsx +1 -0
  68. package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +22 -22
  69. package/src/Authenticator/Defaults/SignIn/SignIn.tsx +7 -3
  70. package/src/Authenticator/Defaults/SignIn/__tests__/SignIn.spec.tsx +1 -0
  71. package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +36 -33
  72. package/src/Authenticator/Defaults/SignUp/SignUp.tsx +7 -3
  73. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +111 -96
  74. package/src/Authenticator/Defaults/VerifyUser/VerifyUser.tsx +7 -3
  75. package/src/Authenticator/Defaults/VerifyUser/__tests__/VerifyUser.spec.tsx +1 -0
  76. package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +16 -18
  77. package/src/Authenticator/Defaults/types.ts +63 -49
  78. package/src/Authenticator/__tests__/Authenticator.spec.tsx +16 -19
  79. package/src/Authenticator/__tests__/__snapshots__/Authenticator.spec.tsx.snap +1 -9
  80. package/src/Authenticator/__tests__/withAuthenticator.spec.tsx +1 -1
  81. package/src/Authenticator/common/DefaultContent/styles.ts +1 -2
  82. package/src/Authenticator/common/DefaultContent/types.ts +1 -4
  83. package/src/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.tsx +8 -6
  84. package/src/Authenticator/common/DefaultFormFields/DefaultTextFormFields.tsx +10 -7
  85. package/src/Authenticator/common/DefaultFormFields/types.ts +15 -5
  86. package/src/Authenticator/common/DefaultHeader/__tests__/__snapshots__/DefaultHeader.spec.tsx.snap +1 -1
  87. package/src/Authenticator/common/FederatedProviderButton/__tests__/__snapshots__/FederatedProviderButton.spec.tsx.snap +4 -4
  88. package/src/Authenticator/common/FederatedProviderButtons/__tests__/__snapshots__/FederatedProviderButtons.spec.tsx.snap +4 -4
  89. package/src/Authenticator/hooks/types.ts +3 -0
  90. package/src/Authenticator/hooks/useFieldValues/__tests__/useFieldValues.spec.ts +75 -2
  91. package/src/Authenticator/hooks/useFieldValues/__tests__/utils.spec.ts +67 -1
  92. package/src/Authenticator/hooks/useFieldValues/types.ts +5 -0
  93. package/src/Authenticator/hooks/useFieldValues/useFieldValues.ts +26 -1
  94. package/src/Authenticator/hooks/useFieldValues/utils.ts +44 -1
  95. package/src/primitives/Checkbox/__tests__/__snapshots__/Checkbox.spec.tsx.snap +14 -14
  96. package/src/primitives/Divider/__tests__/__snapshots__/Divider.spec.tsx.snap +4 -4
  97. package/src/primitives/Heading/__tests__/__snapshots__/Heading.spec.tsx.snap +7 -7
  98. package/src/primitives/Heading/styles.ts +5 -5
  99. package/src/primitives/Label/__tests__/__snapshots__/Label.spec.tsx.snap +8 -8
  100. package/src/primitives/Label/styles.ts +2 -2
  101. package/src/primitives/PasswordField/__tests__/__snapshots__/PasswordField.spec.tsx.snap +25 -20
  102. package/src/primitives/PhoneNumberField/__tests__/__snapshots__/PhoneNumberField.spec.tsx.snap +6 -0
  103. package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +14 -14
  104. package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +48 -48
  105. package/src/primitives/TextField/TextField.tsx +2 -1
  106. package/src/primitives/TextField/__tests__/TextField.spec.tsx +57 -8
  107. package/src/primitives/TextField/__tests__/__snapshots__/TextField.spec.tsx.snap +61 -55
  108. package/src/primitives/TextField/styles.ts +6 -3
  109. package/src/primitives/TextField/types.ts +1 -0
  110. package/src/theme/__tests__/createTheme.spec.ts +48 -0
  111. package/src/theme/createTheme.ts +44 -21
  112. package/src/theme/types.ts +17 -16
  113. package/src/version.ts +1 -1
@@ -8,7 +8,7 @@ import {
8
8
  DefaultRadioFormFields,
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
- import { DefaultVerifyUserComponent } from '../types';
11
+ import { DefaultVerifyUserProps } from '../types';
12
12
 
13
13
  const COMPONENT_NAME = 'VerifyUser';
14
14
 
@@ -19,17 +19,19 @@ const {
19
19
  getAccountRecoveryInfoText,
20
20
  } = authenticatorTextUtil;
21
21
 
22
- const VerifyUser: DefaultVerifyUserComponent = ({
22
+ const VerifyUser = ({
23
23
  fields,
24
24
  handleBlur,
25
25
  handleChange,
26
26
  handleSubmit,
27
27
  skipVerification,
28
+ validationErrors,
28
29
  ...rest
29
- }) => {
30
+ }: DefaultVerifyUserProps): JSX.Element => {
30
31
  const {
31
32
  disableFormSubmit: disabled,
32
33
  fields: fieldsWithHandlers,
34
+ fieldValidationErrors,
33
35
  handleFormSubmit,
34
36
  } = useFieldValues({
35
37
  componentName: COMPONENT_NAME,
@@ -37,6 +39,7 @@ const VerifyUser: DefaultVerifyUserComponent = ({
37
39
  handleBlur,
38
40
  handleChange,
39
41
  handleSubmit,
42
+ validationErrors,
40
43
  });
41
44
 
42
45
  const headerText = getVerifyContactText();
@@ -59,6 +62,7 @@ const VerifyUser: DefaultVerifyUserComponent = ({
59
62
  buttons={buttons}
60
63
  fields={fieldsWithHandlers}
61
64
  headerText={headerText}
65
+ validationErrors={fieldValidationErrors}
62
66
  />
63
67
  );
64
68
  };
@@ -44,6 +44,7 @@ const props = {
44
44
  handleBlur: jest.fn(),
45
45
  handleChange: jest.fn(),
46
46
  handleSubmit,
47
+ hasValidationErrors: false,
47
48
  Header: VerifyUser.Header,
48
49
  isPending: false,
49
50
  skipVerification: jest.fn(),
@@ -11,7 +11,7 @@ Array [
11
11
  },
12
12
  Object {
13
13
  "fontSize": 24,
14
- "fontWeight": "300",
14
+ "fontWeight": "500",
15
15
  "lineHeight": 36,
16
16
  },
17
17
  Object {
@@ -28,9 +28,9 @@ Array [
28
28
  style={
29
29
  Array [
30
30
  Object {
31
- "fontSize": 14,
31
+ "fontSize": 16,
32
32
  "fontWeight": "400",
33
- "lineHeight": 21,
33
+ "lineHeight": 24,
34
34
  },
35
35
  Object {
36
36
  "color": "hsl(210, 50%, 10%)",
@@ -118,9 +118,9 @@ Array [
118
118
  style={
119
119
  Array [
120
120
  Object {
121
- "fontSize": 14,
121
+ "fontSize": 16,
122
122
  "fontWeight": "400",
123
- "lineHeight": 21,
123
+ "lineHeight": 24,
124
124
  },
125
125
  Object {
126
126
  "color": "hsl(210, 50%, 10%)",
@@ -185,9 +185,9 @@ Array [
185
185
  style={
186
186
  Array [
187
187
  Object {
188
- "fontSize": 14,
188
+ "fontSize": 16,
189
189
  "fontWeight": "400",
190
- "lineHeight": 21,
190
+ "lineHeight": 24,
191
191
  },
192
192
  Object {
193
193
  "color": "hsl(210, 50%, 10%)",
@@ -233,8 +233,7 @@ Array [
233
233
  },
234
234
  undefined,
235
235
  Object {
236
- "marginHorizontal": 16,
237
- "marginVertical": 12,
236
+ "margin": 12,
238
237
  },
239
238
  ]
240
239
  }
@@ -328,7 +327,7 @@ Array [
328
327
  },
329
328
  Object {
330
329
  "fontSize": 24,
331
- "fontWeight": "300",
330
+ "fontWeight": "500",
332
331
  "lineHeight": 36,
333
332
  },
334
333
  Object {
@@ -345,9 +344,9 @@ Array [
345
344
  style={
346
345
  Array [
347
346
  Object {
348
- "fontSize": 14,
347
+ "fontSize": 16,
349
348
  "fontWeight": "400",
350
- "lineHeight": 21,
349
+ "lineHeight": 24,
351
350
  },
352
351
  Object {
353
352
  "color": "hsl(210, 50%, 10%)",
@@ -435,9 +434,9 @@ Array [
435
434
  style={
436
435
  Array [
437
436
  Object {
438
- "fontSize": 14,
437
+ "fontSize": 16,
439
438
  "fontWeight": "400",
440
- "lineHeight": 21,
439
+ "lineHeight": 24,
441
440
  },
442
441
  Object {
443
442
  "color": "hsl(210, 50%, 10%)",
@@ -502,9 +501,9 @@ Array [
502
501
  style={
503
502
  Array [
504
503
  Object {
505
- "fontSize": 14,
504
+ "fontSize": 16,
506
505
  "fontWeight": "400",
507
- "lineHeight": 21,
506
+ "lineHeight": 24,
508
507
  },
509
508
  Object {
510
509
  "color": "hsl(210, 50%, 10%)",
@@ -609,8 +608,7 @@ Array [
609
608
  },
610
609
  undefined,
611
610
  Object {
612
- "marginHorizontal": 16,
613
- "marginVertical": 12,
611
+ "margin": 12,
614
612
  },
615
613
  ]
616
614
  }
@@ -21,55 +21,69 @@ export type DefaultComponents<
21
21
  Props = {}
22
22
  > = AuthenticatorComponentDefaults<FieldType, Props>;
23
23
 
24
- export type DefaultConfirmResetPasswordComponent = DefaultComponents<
25
- TextFieldOptionsType,
26
- { style?: ConfirmResetPasswordStyle }
27
- >['ConfirmResetPassword'];
28
-
29
- export type DefaultConfirmSignInComponent = DefaultComponents<
30
- TextFieldOptionsType,
31
- { style?: ConfirmSignInStyle }
32
- >['ConfirmSignIn'];
33
-
34
- export type DefaultConfirmSignUpComponent = DefaultComponents<
35
- TextFieldOptionsType,
36
- { style?: ConfirmSignUpStyle }
37
- >['ConfirmSignUp'];
38
-
39
- export type DefaultConfirmVerifyUserComponent = DefaultComponents<
40
- TextFieldOptionsType,
41
- { style?: ConfirmVerifyUserStyle }
42
- >['ConfirmVerifyUser'];
43
-
44
- export type DefaultForceNewPasswordComponent = DefaultComponents<
45
- TextFieldOptionsType,
46
- { style?: ForceNewPasswordStyle }
47
- >['ForceNewPassword'];
48
-
49
- export type DefaultResetPasswordComponent = DefaultComponents<
50
- TextFieldOptionsType,
51
- { style?: ResetPasswordStyle }
52
- >['ResetPassword'];
53
-
54
- export type DefaultSetupTOTPComponent = DefaultComponents<
55
- TextFieldOptionsType,
56
- { style?: SetupTOTPStyle }
57
- >['SetupTOTP'];
58
-
59
- export type DefaultSignInComponent = DefaultComponents<
60
- TextFieldOptionsType,
61
- { style?: SignInStyle }
62
- >['SignIn'];
63
-
64
- export type DefaultSignUpComponent = DefaultComponents<
65
- TextFieldOptionsType,
66
- { style?: SignUpStyle }
67
- >['SignUp'];
68
-
69
- export type DefaultVerifyUserComponent = DefaultComponents<
70
- RadioFieldOptions,
71
- { style?: VerifyUserStyle }
72
- >['VerifyUser'];
24
+ export type DefaultConfirmResetPasswordProps = React.ComponentPropsWithoutRef<
25
+ DefaultComponents<
26
+ TextFieldOptionsType,
27
+ { style?: ConfirmResetPasswordStyle }
28
+ >['ConfirmResetPassword']
29
+ >;
30
+
31
+ export type DefaultConfirmSignInProps = React.ComponentPropsWithoutRef<
32
+ DefaultComponents<
33
+ TextFieldOptionsType,
34
+ { style?: ConfirmSignInStyle }
35
+ >['ConfirmSignIn']
36
+ >;
37
+
38
+ export type DefaultConfirmSignUpProps = React.ComponentPropsWithoutRef<
39
+ DefaultComponents<
40
+ TextFieldOptionsType,
41
+ { style?: ConfirmSignUpStyle }
42
+ >['ConfirmSignUp']
43
+ >;
44
+
45
+ export type DefaultConfirmVerifyUserProps = React.ComponentPropsWithoutRef<
46
+ DefaultComponents<
47
+ TextFieldOptionsType,
48
+ { style?: ConfirmVerifyUserStyle }
49
+ >['ConfirmVerifyUser']
50
+ >;
51
+
52
+ export type DefaultForceNewPasswordProps = React.ComponentPropsWithoutRef<
53
+ DefaultComponents<
54
+ TextFieldOptionsType,
55
+ { style?: ForceNewPasswordStyle }
56
+ >['ForceNewPassword']
57
+ >;
58
+
59
+ export type DefaultResetPasswordProps = React.ComponentPropsWithoutRef<
60
+ DefaultComponents<
61
+ TextFieldOptionsType,
62
+ { style?: ResetPasswordStyle }
63
+ >['ResetPassword']
64
+ >;
65
+
66
+ export type DefaultSetupTOTPProps = React.ComponentPropsWithoutRef<
67
+ DefaultComponents<
68
+ TextFieldOptionsType,
69
+ { style?: SetupTOTPStyle }
70
+ >['SetupTOTP']
71
+ >;
72
+
73
+ export type DefaultSignInProps = React.ComponentPropsWithoutRef<
74
+ DefaultComponents<TextFieldOptionsType, { style?: SignInStyle }>['SignIn']
75
+ >;
76
+
77
+ export type DefaultSignUpProps = React.ComponentPropsWithoutRef<
78
+ DefaultComponents<TextFieldOptionsType, { style?: SignUpStyle }>['SignUp']
79
+ >;
80
+
81
+ export type DefaultVerifyUserProps = React.ComponentPropsWithoutRef<
82
+ DefaultComponents<
83
+ RadioFieldOptions,
84
+ { style?: VerifyUserStyle }
85
+ >['VerifyUser']
86
+ >;
73
87
 
74
88
  /**
75
89
  * Custom Authenticator components
@@ -81,30 +81,27 @@ describe('Authenticator', () => {
81
81
  expect(toJSON()).toMatchSnapshot();
82
82
  });
83
83
 
84
- it.each(['authenticated', 'signOut'])(
85
- 'handles the %s route as expected with children',
86
- (route) => {
87
- useAuthenticatorSpy.mockImplementation(
88
- () => ({ route } as unknown as UseAuthenticator)
89
- );
84
+ it('handles `authStatus` of authenticated as expected', () => {
85
+ useAuthenticatorSpy.mockImplementation(
86
+ () => ({ authStatus: 'authenticated' } as unknown as UseAuthenticator)
87
+ );
90
88
 
91
- const { getByTestId, toJSON } = render(
92
- <Authenticator>
93
- <TestChildren />
94
- </Authenticator>
95
- );
89
+ const { getByTestId, toJSON } = render(
90
+ <Authenticator>
91
+ <TestChildren />
92
+ </Authenticator>
93
+ );
96
94
 
97
- const children = getByTestId(CHILD_TEST_ID);
95
+ const children = getByTestId(CHILD_TEST_ID);
98
96
 
99
- expect(children.type).toBe('Text');
100
- expect(children.props.children).toBe(CHILD_CONTENT);
97
+ expect(children.type).toBe('Text');
98
+ expect(children.props.children).toBe(CHILD_CONTENT);
101
99
 
102
- expect(toJSON()).toMatchSnapshot();
103
- }
104
- );
100
+ expect(toJSON()).toMatchSnapshot();
101
+ });
105
102
 
106
- it.each(['authenticated', 'signOut'])(
107
- 'handles the %s route as expected without children',
103
+ it.each(['unauthenticated', 'configuring'])(
104
+ 'handles an authStatus of %s as expected',
108
105
  (route) => {
109
106
  useAuthenticatorSpy.mockImplementation(
110
107
  () => ({ route } as unknown as UseAuthenticator)
@@ -59,15 +59,7 @@ exports[`Authenticator behaves as expected in the happy path 1`] = `
59
59
  </SafeAreaProvider>
60
60
  `;
61
61
 
62
- exports[`Authenticator handles the authenticated route as expected with children 1`] = `
63
- <Text
64
- testID="child-test-id"
65
- >
66
- Test Children
67
- </Text>
68
- `;
69
-
70
- exports[`Authenticator handles the signOut route as expected with children 1`] = `
62
+ exports[`Authenticator handles \`authStatus\` of authenticated as expected 1`] = `
71
63
  <Text
72
64
  testID="child-test-id"
73
65
  >
@@ -61,7 +61,7 @@ describe('withAuthenticator', () => {
61
61
  useAuthenticatorSpy.mockImplementation(
62
62
  () =>
63
63
  ({
64
- route: 'authenticated',
64
+ authStatus: 'authenticated',
65
65
  } as unknown as UIReactCoreModule.UseAuthenticator)
66
66
  );
67
67
 
@@ -12,8 +12,7 @@ export const getDefaultStyle = ({
12
12
  paddingHorizontal: space.small,
13
13
  },
14
14
  buttonPrimary: {
15
- marginHorizontal: space.medium,
16
- marginVertical: space.small,
15
+ margin: space.small,
17
16
  },
18
17
  buttonPrimaryLabel: {}, // themed value only
19
18
  buttonSecondary: {
@@ -60,10 +60,7 @@ export type DefaultContentProps<
60
60
  | TextFieldOptionsType
61
61
  | RadioFieldOptions
62
62
  | unknown = unknown
63
- > = Pick<
64
- DefaultComponentProps<FieldsType>,
65
- 'error' | 'Footer' | 'isPending'
66
- > & {
63
+ > = Pick<DefaultComponentProps<FieldsType>, 'error' | 'isPending'> & {
67
64
  buttons: DefaultButtons;
68
65
  body?: React.ReactNode;
69
66
  fields: FieldsType[];
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { censorAllButFirstAndLast, censorPhoneNumber } from '@aws-amplify/ui';
3
3
 
4
4
  import { Radio, RadioGroup } from '../../../primitives';
5
- import { DefaultRadioFormFieldsComponent } from './types';
5
+ import { DefaultRadioFormFieldsProps } from './types';
6
6
 
7
7
  const censorContactInformation = (name: string, value: string): string => {
8
8
  let censoredVal = value;
@@ -17,16 +17,16 @@ const censorContactInformation = (name: string, value: string): string => {
17
17
  return censoredVal;
18
18
  };
19
19
 
20
- const DefaultFormFields: DefaultRadioFormFieldsComponent = ({
20
+ const DefaultRadioFormFields = ({
21
21
  fields,
22
- isPending,
23
22
  fieldContainerStyle,
24
23
  fieldLabelStyle,
24
+ isPending,
25
25
  style,
26
- }) => {
26
+ }: DefaultRadioFormFieldsProps): JSX.Element => {
27
27
  return (
28
28
  <RadioGroup disabled={isPending} style={style}>
29
- {fields.map(({ name, value, ...props }) => (
29
+ {(fields ?? []).map(({ name, value, ...props }) => (
30
30
  <Radio
31
31
  {...props}
32
32
  key={value}
@@ -42,4 +42,6 @@ const DefaultFormFields: DefaultRadioFormFieldsComponent = ({
42
42
  );
43
43
  };
44
44
 
45
- export default DefaultFormFields;
45
+ DefaultRadioFormFields.displayName = 'FormFields';
46
+
47
+ export default DefaultRadioFormFields;
@@ -5,19 +5,22 @@ import { getErrors } from '@aws-amplify/ui';
5
5
 
6
6
  import Field from './Field';
7
7
  import { FieldErrors } from './FieldErrors';
8
- import { DefaultTextFormFieldsComponent } from './types';
8
+ import {
9
+ // DefaultTextFormFieldsComponent,
10
+ DefaultTextFormFieldsProps,
11
+ } from './types';
9
12
 
10
- const DefaultTextFormFields: DefaultTextFormFieldsComponent = ({
13
+ const DefaultTextFormFields = ({
11
14
  fieldContainerStyle,
12
15
  fieldErrorsContainer,
13
16
  fieldErrorStyle,
14
17
  fieldStyle,
15
- fields = [],
16
- isPending,
18
+ fields,
19
+ isPending = false,
17
20
  style,
18
21
  validationErrors,
19
- }) => {
20
- const formFields = fields.map(({ name, type, ...field }) => {
22
+ }: DefaultTextFormFieldsProps): JSX.Element => {
23
+ const formFields = (fields ?? []).map(({ name, type, ...field }) => {
21
24
  const errors = validationErrors ? getErrors(validationErrors?.[name]) : [];
22
25
 
23
26
  const hasError = errors?.length > 0;
@@ -44,6 +47,6 @@ const DefaultTextFormFields: DefaultTextFormFieldsComponent = ({
44
47
  return <View style={style}>{formFields}</View>;
45
48
  };
46
49
 
47
- DefaultTextFormFields.displayName = 'DefaultTextFormFields';
50
+ DefaultTextFormFields.displayName = 'FormFields';
48
51
 
49
52
  export default DefaultTextFormFields;
@@ -1,5 +1,8 @@
1
1
  import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
- import { AuthenticatorFormFieldsComponent } from '@aws-amplify/ui-react-core';
2
+ import {
3
+ AuthenticatorFormFieldsComponent,
4
+ UseAuthenticator,
5
+ } from '@aws-amplify/ui-react-core';
3
6
 
4
7
  import { RadioFieldOptions, TextFieldOptionsType } from '../../hooks';
5
8
 
@@ -25,8 +28,15 @@ export interface DefaultFormFieldsStyle {
25
28
  export type DefaultFormFieldsComponent<FieldsType> =
26
29
  AuthenticatorFormFieldsComponent<FieldsType, DefaultFormFieldsStyle>;
27
30
 
28
- export type DefaultTextFormFieldsComponent =
29
- DefaultFormFieldsComponent<TextFieldOptionsType>;
31
+ interface FormFieldsProps extends DefaultFormFieldsStyle {
32
+ isPending?: UseAuthenticator['isPending'];
33
+ validationErrors?: UseAuthenticator['validationErrors'];
34
+ }
35
+
36
+ export interface DefaultTextFormFieldsProps extends FormFieldsProps {
37
+ fields?: TextFieldOptionsType[];
38
+ }
30
39
 
31
- export type DefaultRadioFormFieldsComponent =
32
- DefaultFormFieldsComponent<RadioFieldOptions>;
40
+ export interface DefaultRadioFormFieldsProps extends FormFieldsProps {
41
+ fields?: RadioFieldOptions[];
42
+ }
@@ -10,7 +10,7 @@ exports[`DefaultHeader renders as expected with children 1`] = `
10
10
  },
11
11
  Object {
12
12
  "fontSize": 24,
13
- "fontWeight": "300",
13
+ "fontWeight": "500",
14
14
  "lineHeight": 36,
15
15
  },
16
16
  undefined,
@@ -72,9 +72,9 @@ exports[`FederatedProviderButton applies style props 1`] = `
72
72
  style={
73
73
  Array [
74
74
  Object {
75
- "fontSize": 14,
75
+ "fontSize": 16,
76
76
  "fontWeight": "400",
77
- "lineHeight": 21,
77
+ "lineHeight": 24,
78
78
  },
79
79
  Object {
80
80
  "color": "hsl(210, 50%, 10%)",
@@ -163,9 +163,9 @@ exports[`FederatedProviderButton renders default button as expected 1`] = `
163
163
  style={
164
164
  Array [
165
165
  Object {
166
- "fontSize": 14,
166
+ "fontSize": 16,
167
167
  "fontWeight": "400",
168
- "lineHeight": 21,
168
+ "lineHeight": 24,
169
169
  },
170
170
  Object {
171
171
  "color": "hsl(210, 50%, 10%)",
@@ -79,9 +79,9 @@ exports[`FederatedProviderButtons renders as expected 1`] = `
79
79
  style={
80
80
  Array [
81
81
  Object {
82
- "fontSize": 14,
82
+ "fontSize": 16,
83
83
  "fontWeight": "400",
84
- "lineHeight": 21,
84
+ "lineHeight": 24,
85
85
  },
86
86
  Object {
87
87
  "color": "hsl(210, 50%, 10%)",
@@ -127,9 +127,9 @@ exports[`FederatedProviderButtons renders as expected 1`] = `
127
127
  style={
128
128
  Array [
129
129
  Object {
130
- "fontSize": 14,
130
+ "fontSize": 16,
131
131
  "fontWeight": "400",
132
- "lineHeight": 21,
132
+ "lineHeight": 24,
133
133
  },
134
134
  Object {
135
135
  "color": "hsl(210, 50%, 10%)",
@@ -7,6 +7,7 @@ import {
7
7
 
8
8
  export type MachineFieldTypeKey = 'password' | 'tel';
9
9
  export type AuthenticatorFieldTypeKey =
10
+ | 'email'
10
11
  | 'password'
11
12
  | 'phone'
12
13
  | 'default'
@@ -23,10 +24,12 @@ type FieldOptions<FieldProps, Type extends AuthenticatorFieldTypeKey> = {
23
24
  type: Type;
24
25
  } & Omit<FieldProps, 'disabled' | 'onBlur'>;
25
26
 
27
+ type EmailFieldOptions = FieldOptions<PhoneNumberFieldProps, 'email'>;
26
28
  type PasswordFieldOptions = FieldOptions<PasswordFieldProps, 'password'>;
27
29
  type PhoneFieldOptions = FieldOptions<PhoneNumberFieldProps, 'phone'>;
28
30
  type DefaultFieldOptions = FieldOptions<TextFieldProps, 'default'>;
29
31
  export type TextFieldOptionsType = (
32
+ | EmailFieldOptions
30
33
  | PasswordFieldOptions
31
34
  | PhoneFieldOptions
32
35
  | DefaultFieldOptions