@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
@@ -1,16 +1,19 @@
1
1
  import { Platform, StyleSheet } from 'react-native';
2
- import { getLineHeight } from '../../utils';
3
2
  export const getThemedStyles = (theme) => {
4
3
  const { components, tokens: { colors, fontSizes, opacities, space, radii, borderWidths }, } = theme;
5
4
  return StyleSheet.create({
6
5
  container: {
7
6
  alignItems: 'flex-start',
7
+ marginBottom: space.xs,
8
8
  ...components?.textField?.container,
9
9
  },
10
10
  disabled: {
11
11
  opacity: opacities[60],
12
12
  ...components?.textField?.disabled,
13
13
  },
14
+ error: {
15
+ borderColor: colors.border.error,
16
+ },
14
17
  fieldContainer: {
15
18
  alignItems: 'center',
16
19
  borderColor: colors.border.primary,
@@ -25,14 +28,14 @@ export const getThemedStyles = (theme) => {
25
28
  fontSize: fontSizes.medium,
26
29
  flexGrow: 1,
27
30
  paddingVertical: space.small,
31
+ paddingHorizontal: space.xxs,
28
32
  // this is needed because of extra padding inside the input - in Android only
29
33
  ...(Platform.OS === 'android' && { padding: 0 }),
30
34
  ...components?.textField?.field,
31
35
  },
32
36
  label: {
33
37
  color: colors.font.secondary,
34
- lineHeight: getLineHeight(fontSizes.small),
35
- padding: space.xxs,
38
+ paddingVertical: space.xs,
36
39
  ...components?.textField?.label,
37
40
  },
38
41
  });
@@ -51,6 +51,7 @@ export interface TextFieldProps extends Omit<TextInputProps, 'editable'> {
51
51
  export interface TextFieldStyles {
52
52
  container?: ViewStyle;
53
53
  disabled?: ViewStyle;
54
+ error?: ViewStyle;
54
55
  field?: TextStyle;
55
56
  fieldContainer?: ViewStyle;
56
57
  label?: TextStyle;
@@ -7,7 +7,7 @@ import { defaultTheme } from './defaultTheme';
7
7
  // calling the component theme function with the already resolved base tokens
8
8
  // OR
9
9
  // resolving the component theme object
10
- const setupComponents = ({ components, tokens }) => {
10
+ const setupComponents = ({ components, tokens, }) => {
11
11
  const output = components
12
12
  ? Object.entries(components).reduce((acc, [key, value]) => ({
13
13
  ...acc,
@@ -19,28 +19,34 @@ const setupComponents = ({ components, tokens }) => {
19
19
  components: output,
20
20
  }).components;
21
21
  };
22
+ const shouldParseFloatValue = (pathKey) => [
23
+ 'space',
24
+ 'borderWidths',
25
+ 'opacities',
26
+ 'fontSizes',
27
+ 'lineHeights',
28
+ 'radii',
29
+ ].includes(pathKey);
22
30
  const setupToken = ({ token, path = [], spaceModifier, }) => {
23
31
  const { value } = token;
24
32
  if (typeof value === 'string') {
25
- // Perform transforms
26
- if (path[0] === 'space') {
27
- if (value.includes('rem')) {
28
- return Math.floor(parseFloat(value) * 16 * spaceModifier);
29
- }
30
- }
31
- if (value.includes('rem')) {
32
- return Math.floor(parseFloat(value) * 16);
33
- }
34
- if (value.includes('px')) {
35
- return parseInt(value, 10);
36
- }
37
- if (path[0] === 'opacities') {
38
- return parseFloat(value);
39
- }
40
33
  // Remove .value from references if there is a reference
34
+ // this needs to come first so we don't get NaNs for references
41
35
  if (usesReference(value)) {
42
36
  return value.replace('.value', '');
43
37
  }
38
+ if (shouldParseFloatValue(path[0])) {
39
+ if (value.includes('rem')) {
40
+ if (path[0] === 'space') {
41
+ return Math.floor(parseFloat(value) * 16 * spaceModifier);
42
+ }
43
+ return Math.floor(parseFloat(value) * 16);
44
+ }
45
+ if (value.includes('px')) {
46
+ return parseInt(value, 10);
47
+ }
48
+ return parseFloat(value);
49
+ }
44
50
  return value;
45
51
  }
46
52
  // Font Weights in RN are strings
@@ -90,11 +96,11 @@ export const createTheme = (theme, colorMode) => {
90
96
  return setupToken({ token, path, spaceModifier });
91
97
  },
92
98
  }));
93
- let { components } = mergedTheme;
99
+ let components;
94
100
  // Resolve component token references too
95
101
  if (mergedTheme.components) {
96
102
  components = setupComponents({
97
- ...mergedTheme,
103
+ components: mergedTheme.components,
98
104
  tokens,
99
105
  });
100
106
  }
@@ -1,7 +1,7 @@
1
1
  import { ReactNativeTokens } from '@aws-amplify/ui';
2
2
  import { ButtonStyles, CheckboxStyles, DividerStyles, ErrorMessageStyles, HeadingStyles, IconStyles, IconButtonStyles, LabelStyles, PasswordFieldStyles, PhoneNumberFieldStyles, RadioStyles, RadioGroupStyles, TabsStyles, TextFieldStyles } from '../primitives';
3
3
  type ComponentTheme<ComponentType, Output> = Output extends 'output' ? ComponentType : ((tokens: StrictTheme['tokens']) => ComponentType) | ComponentType;
4
- export type Components<Output> = Record<string, object> & {
4
+ export type Components<Output extends 'input' | 'output' | unknown = unknown> = {
5
5
  button?: ComponentTheme<ButtonStyles, Output>;
6
6
  checkbox?: ComponentTheme<CheckboxStyles, Output>;
7
7
  divider?: ComponentTheme<DividerStyles, Output>;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.20";
1
+ export declare const VERSION = "1.2.22";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.20';
1
+ export const VERSION = '1.2.22';
package/jest.config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  module.exports = {
2
2
  preset: 'react-native',
3
3
  modulePathIgnorePatterns: ['<rootDir>/dist/'],
4
+ collectCoverage: true,
4
5
  collectCoverageFrom: [
5
6
  '<rootDir>/src/**/*.{js,jsx,ts,tsx}',
6
7
  '!<rootDir>/src/**/*{c,C}onstants.ts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-native",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@types/react-native": "^0.67.6",
29
29
  "@types/react-test-renderer": "^17.0.1",
30
30
  "babel-jest": "^28.0.3",
31
- "eslint": "^8.14.0",
31
+ "eslint": "^8.44.0",
32
32
  "jest": "^27.0.4",
33
33
  "metro-react-native-babel-preset": "^0.70.2",
34
34
  "react": "^17.0.2",
@@ -38,9 +38,9 @@
38
38
  "rimraf": "^3.0.2"
39
39
  },
40
40
  "dependencies": {
41
- "@aws-amplify/ui": "5.6.6",
42
- "@aws-amplify/ui-react-core": "2.1.25",
43
- "@aws-amplify/ui-react-core-notifications": "1.0.2"
41
+ "@aws-amplify/ui": "5.6.8",
42
+ "@aws-amplify/ui-react-core": "2.1.27",
43
+ "@aws-amplify/ui-react-core-notifications": "1.0.4"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "aws-amplify": ">= 5.0.1",
@@ -8,7 +8,6 @@ import {
8
8
  useAuthenticator,
9
9
  useAuthenticatorRoute,
10
10
  useAuthenticatorInitMachine,
11
- UseAuthenticator,
12
11
  } from '@aws-amplify/ui-react-core';
13
12
 
14
13
  import { configureComponent } from '@aws-amplify/ui';
@@ -45,9 +44,6 @@ const DEFAULTS = {
45
44
  VerifyUser,
46
45
  };
47
46
 
48
- const isAuthenticatedRoute = (route: UseAuthenticator['route']) =>
49
- route === 'authenticated' || route === 'signOut';
50
-
51
47
  const routePropSelector = ({
52
48
  route,
53
49
  }: AuthenticatorMachineContext): AuthenticatorMachineContext['route'][] => [
@@ -77,7 +73,7 @@ function Authenticator({
77
73
 
78
74
  useAuthenticatorInitMachine(options);
79
75
 
80
- const { fields, route } = useAuthenticator(routePropSelector);
76
+ const { authStatus, fields, route } = useAuthenticator(routePropSelector);
81
77
 
82
78
  const components = useMemo(
83
79
  // allow any to prevent TS from assuming that all fields are of type `TextFieldOptions`
@@ -89,7 +85,7 @@ function Authenticator({
89
85
 
90
86
  const typedFields = getRouteTypedFields({ fields, route });
91
87
 
92
- if (isAuthenticatedRoute(route)) {
88
+ if (authStatus === 'authenticated') {
93
89
  return children ? <>{children}</> : null;
94
90
  }
95
91
 
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultConfirmResetPasswordComponent } from '../types';
12
+ import { DefaultConfirmResetPasswordProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'ConfirmResetPassword';
15
15
 
@@ -20,7 +20,7 @@ const {
20
20
  getResendCodeText,
21
21
  } = authenticatorTextUtil;
22
22
 
23
- const ConfirmResetPassword: DefaultConfirmResetPasswordComponent = ({
23
+ const ConfirmResetPassword = ({
24
24
  fields,
25
25
  handleBlur,
26
26
  handleChange,
@@ -28,11 +28,13 @@ const ConfirmResetPassword: DefaultConfirmResetPasswordComponent = ({
28
28
  hasValidationErrors,
29
29
  isPending,
30
30
  resendCode,
31
+ validationErrors,
31
32
  ...rest
32
- }) => {
33
+ }: DefaultConfirmResetPasswordProps): JSX.Element => {
33
34
  const {
34
35
  disableFormSubmit,
35
36
  fields: fieldsWithHandlers,
37
+ fieldValidationErrors,
36
38
  handleFormSubmit,
37
39
  } = useFieldValues({
38
40
  componentName: COMPONENT_NAME,
@@ -40,6 +42,7 @@ const ConfirmResetPassword: DefaultConfirmResetPasswordComponent = ({
40
42
  handleBlur,
41
43
  handleChange,
42
44
  handleSubmit,
45
+ validationErrors,
43
46
  });
44
47
 
45
48
  const disabled = hasValidationErrors || disableFormSubmit;
@@ -72,6 +75,7 @@ const ConfirmResetPassword: DefaultConfirmResetPasswordComponent = ({
72
75
  headerText={headerText}
73
76
  fields={fieldsWithHandlers}
74
77
  isPending={isPending}
78
+ validationErrors={fieldValidationErrors}
75
79
  />
76
80
  );
77
81
  };
@@ -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 {
@@ -35,6 +35,7 @@ Array [
35
35
  Array [
36
36
  Object {
37
37
  "alignItems": "flex-start",
38
+ "marginBottom": 8,
38
39
  },
39
40
  Object {
40
41
  "paddingHorizontal": 12,
@@ -49,9 +50,9 @@ Array [
49
50
  style={
50
51
  Array [
51
52
  Object {
52
- "fontSize": 14,
53
+ "fontSize": 16,
53
54
  "fontWeight": "400",
54
- "lineHeight": 21,
55
+ "lineHeight": 24,
55
56
  },
56
57
  Object {
57
58
  "color": "hsl(210, 50%, 10%)",
@@ -59,8 +60,7 @@ Array [
59
60
  Array [
60
61
  Object {
61
62
  "color": "hsl(210, 25%, 25%)",
62
- "lineHeight": 21,
63
- "padding": 4,
63
+ "paddingVertical": 8,
64
64
  },
65
65
  undefined,
66
66
  ],
@@ -102,6 +102,7 @@ Array [
102
102
  "color": "hsl(210, 50%, 10%)",
103
103
  "flexGrow": 1,
104
104
  "fontSize": 16,
105
+ "paddingHorizontal": 4,
105
106
  "paddingVertical": 12,
106
107
  },
107
108
  Object {},
@@ -115,6 +116,7 @@ Array [
115
116
  Array [
116
117
  Object {
117
118
  "alignItems": "flex-start",
119
+ "marginBottom": 8,
118
120
  },
119
121
  Array [
120
122
  Object {},
@@ -132,9 +134,9 @@ Array [
132
134
  style={
133
135
  Array [
134
136
  Object {
135
- "fontSize": 14,
137
+ "fontSize": 16,
136
138
  "fontWeight": "400",
137
- "lineHeight": 21,
139
+ "lineHeight": 24,
138
140
  },
139
141
  Object {
140
142
  "color": "hsl(210, 50%, 10%)",
@@ -142,8 +144,7 @@ Array [
142
144
  Array [
143
145
  Object {
144
146
  "color": "hsl(210, 25%, 25%)",
145
- "lineHeight": 21,
146
- "padding": 4,
147
+ "paddingVertical": 8,
147
148
  },
148
149
  undefined,
149
150
  ],
@@ -186,6 +187,7 @@ Array [
186
187
  "color": "hsl(210, 50%, 10%)",
187
188
  "flexGrow": 1,
188
189
  "fontSize": 16,
190
+ "paddingHorizontal": 4,
189
191
  "paddingVertical": 12,
190
192
  },
191
193
  Object {},
@@ -263,6 +265,7 @@ Array [
263
265
  Array [
264
266
  Object {
265
267
  "alignItems": "flex-start",
268
+ "marginBottom": 8,
266
269
  },
267
270
  Array [
268
271
  Object {},
@@ -280,9 +283,9 @@ Array [
280
283
  style={
281
284
  Array [
282
285
  Object {
283
- "fontSize": 14,
286
+ "fontSize": 16,
284
287
  "fontWeight": "400",
285
- "lineHeight": 21,
288
+ "lineHeight": 24,
286
289
  },
287
290
  Object {
288
291
  "color": "hsl(210, 50%, 10%)",
@@ -290,8 +293,7 @@ Array [
290
293
  Array [
291
294
  Object {
292
295
  "color": "hsl(210, 25%, 25%)",
293
- "lineHeight": 21,
294
- "padding": 4,
296
+ "paddingVertical": 8,
295
297
  },
296
298
  undefined,
297
299
  ],
@@ -334,6 +336,7 @@ Array [
334
336
  "color": "hsl(210, 50%, 10%)",
335
337
  "flexGrow": 1,
336
338
  "fontSize": 16,
339
+ "paddingHorizontal": 4,
337
340
  "paddingVertical": 12,
338
341
  },
339
342
  Object {},
@@ -497,8 +500,7 @@ Array [
497
500
  },
498
501
  undefined,
499
502
  Object {
500
- "marginHorizontal": 16,
501
- "marginVertical": 12,
503
+ "margin": 12,
502
504
  },
503
505
  ]
504
506
  }
@@ -583,7 +585,7 @@ Array [
583
585
  },
584
586
  Object {
585
587
  "fontSize": 24,
586
- "fontWeight": "300",
588
+ "fontWeight": "500",
587
589
  "lineHeight": 36,
588
590
  },
589
591
  Object {
@@ -607,6 +609,7 @@ Array [
607
609
  Array [
608
610
  Object {
609
611
  "alignItems": "flex-start",
612
+ "marginBottom": 8,
610
613
  },
611
614
  Object {
612
615
  "paddingHorizontal": 12,
@@ -621,9 +624,9 @@ Array [
621
624
  style={
622
625
  Array [
623
626
  Object {
624
- "fontSize": 14,
627
+ "fontSize": 16,
625
628
  "fontWeight": "400",
626
- "lineHeight": 21,
629
+ "lineHeight": 24,
627
630
  },
628
631
  Object {
629
632
  "color": "hsl(210, 50%, 10%)",
@@ -631,8 +634,7 @@ Array [
631
634
  Array [
632
635
  Object {
633
636
  "color": "hsl(210, 25%, 25%)",
634
- "lineHeight": 21,
635
- "padding": 4,
637
+ "paddingVertical": 8,
636
638
  },
637
639
  undefined,
638
640
  ],
@@ -674,6 +676,7 @@ Array [
674
676
  "color": "hsl(210, 50%, 10%)",
675
677
  "flexGrow": 1,
676
678
  "fontSize": 16,
679
+ "paddingHorizontal": 4,
677
680
  "paddingVertical": 12,
678
681
  },
679
682
  Object {},
@@ -687,6 +690,7 @@ Array [
687
690
  Array [
688
691
  Object {
689
692
  "alignItems": "flex-start",
693
+ "marginBottom": 8,
690
694
  },
691
695
  Array [
692
696
  Object {},
@@ -704,9 +708,9 @@ Array [
704
708
  style={
705
709
  Array [
706
710
  Object {
707
- "fontSize": 14,
711
+ "fontSize": 16,
708
712
  "fontWeight": "400",
709
- "lineHeight": 21,
713
+ "lineHeight": 24,
710
714
  },
711
715
  Object {
712
716
  "color": "hsl(210, 50%, 10%)",
@@ -714,8 +718,7 @@ Array [
714
718
  Array [
715
719
  Object {
716
720
  "color": "hsl(210, 25%, 25%)",
717
- "lineHeight": 21,
718
- "padding": 4,
721
+ "paddingVertical": 8,
719
722
  },
720
723
  undefined,
721
724
  ],
@@ -758,6 +761,7 @@ Array [
758
761
  "color": "hsl(210, 50%, 10%)",
759
762
  "flexGrow": 1,
760
763
  "fontSize": 16,
764
+ "paddingHorizontal": 4,
761
765
  "paddingVertical": 12,
762
766
  },
763
767
  Object {},
@@ -835,6 +839,7 @@ Array [
835
839
  Array [
836
840
  Object {
837
841
  "alignItems": "flex-start",
842
+ "marginBottom": 8,
838
843
  },
839
844
  Array [
840
845
  Object {},
@@ -852,9 +857,9 @@ Array [
852
857
  style={
853
858
  Array [
854
859
  Object {
855
- "fontSize": 14,
860
+ "fontSize": 16,
856
861
  "fontWeight": "400",
857
- "lineHeight": 21,
862
+ "lineHeight": 24,
858
863
  },
859
864
  Object {
860
865
  "color": "hsl(210, 50%, 10%)",
@@ -862,8 +867,7 @@ Array [
862
867
  Array [
863
868
  Object {
864
869
  "color": "hsl(210, 25%, 25%)",
865
- "lineHeight": 21,
866
- "padding": 4,
870
+ "paddingVertical": 8,
867
871
  },
868
872
  undefined,
869
873
  ],
@@ -906,6 +910,7 @@ Array [
906
910
  "color": "hsl(210, 50%, 10%)",
907
911
  "flexGrow": 1,
908
912
  "fontSize": 16,
913
+ "paddingHorizontal": 4,
909
914
  "paddingVertical": 12,
910
915
  },
911
916
  Object {},
@@ -1010,8 +1015,7 @@ Array [
1010
1015
  },
1011
1016
  undefined,
1012
1017
  Object {
1013
- "marginHorizontal": 16,
1014
- "marginVertical": 12,
1018
+ "margin": 12,
1015
1019
  },
1016
1020
  ]
1017
1021
  }
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultConfirmSignInComponent } from '../types';
12
+ import { DefaultConfirmSignInProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'ConfirmSignIn';
15
15
 
@@ -20,7 +20,7 @@ const {
20
20
  getConfirmingText,
21
21
  } = authenticatorTextUtil;
22
22
 
23
- const ConfirmSignIn: DefaultConfirmSignInComponent = ({
23
+ const ConfirmSignIn = ({
24
24
  challengeName,
25
25
  fields,
26
26
  handleBlur,
@@ -28,11 +28,13 @@ const ConfirmSignIn: DefaultConfirmSignInComponent = ({
28
28
  handleSubmit,
29
29
  isPending,
30
30
  toSignIn,
31
+ validationErrors,
31
32
  ...rest
32
- }) => {
33
+ }: DefaultConfirmSignInProps): JSX.Element => {
33
34
  const {
34
35
  disableFormSubmit: disabled,
35
36
  fields: fieldsWithHandlers,
37
+ fieldValidationErrors,
36
38
  handleFormSubmit,
37
39
  } = useFieldValues({
38
40
  componentName: COMPONENT_NAME,
@@ -40,6 +42,7 @@ const ConfirmSignIn: DefaultConfirmSignInComponent = ({
40
42
  handleBlur,
41
43
  handleChange,
42
44
  handleSubmit,
45
+ validationErrors,
43
46
  });
44
47
 
45
48
  const headerText = getChallengeText(challengeName);
@@ -71,6 +74,7 @@ const ConfirmSignIn: DefaultConfirmSignInComponent = ({
71
74
  headerText={headerText}
72
75
  fields={fieldsWithHandlers}
73
76
  isPending={isPending}
77
+ validationErrors={fieldValidationErrors}
74
78
  />
75
79
  );
76
80
  };
@@ -21,6 +21,7 @@ const props = {
21
21
  handleBlur: jest.fn(),
22
22
  handleChange: jest.fn(),
23
23
  handleSubmit: jest.fn(),
24
+ hasValidationErrors: false,
24
25
  Header: ConfirmSignIn.Header,
25
26
  isPending: false,
26
27
  toSignIn: 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 {
@@ -35,6 +35,7 @@ Array [
35
35
  Array [
36
36
  Object {
37
37
  "alignItems": "flex-start",
38
+ "marginBottom": 8,
38
39
  },
39
40
  Object {
40
41
  "paddingHorizontal": 12,
@@ -49,9 +50,9 @@ Array [
49
50
  style={
50
51
  Array [
51
52
  Object {
52
- "fontSize": 14,
53
+ "fontSize": 16,
53
54
  "fontWeight": "400",
54
- "lineHeight": 21,
55
+ "lineHeight": 24,
55
56
  },
56
57
  Object {
57
58
  "color": "hsl(210, 50%, 10%)",
@@ -59,8 +60,7 @@ Array [
59
60
  Array [
60
61
  Object {
61
62
  "color": "hsl(210, 25%, 25%)",
62
- "lineHeight": 21,
63
- "padding": 4,
63
+ "paddingVertical": 8,
64
64
  },
65
65
  undefined,
66
66
  ],
@@ -102,6 +102,7 @@ Array [
102
102
  "color": "hsl(210, 50%, 10%)",
103
103
  "flexGrow": 1,
104
104
  "fontSize": 16,
105
+ "paddingHorizontal": 4,
105
106
  "paddingVertical": 12,
106
107
  },
107
108
  Object {},
@@ -201,8 +202,7 @@ Array [
201
202
  },
202
203
  undefined,
203
204
  Object {
204
- "marginHorizontal": 16,
205
- "marginVertical": 12,
205
+ "margin": 12,
206
206
  },
207
207
  ]
208
208
  }
@@ -296,7 +296,7 @@ Array [
296
296
  },
297
297
  Object {
298
298
  "fontSize": 24,
299
- "fontWeight": "300",
299
+ "fontWeight": "500",
300
300
  "lineHeight": 36,
301
301
  },
302
302
  Object {
@@ -320,6 +320,7 @@ Array [
320
320
  Array [
321
321
  Object {
322
322
  "alignItems": "flex-start",
323
+ "marginBottom": 8,
323
324
  },
324
325
  Object {
325
326
  "paddingHorizontal": 12,
@@ -334,9 +335,9 @@ Array [
334
335
  style={
335
336
  Array [
336
337
  Object {
337
- "fontSize": 14,
338
+ "fontSize": 16,
338
339
  "fontWeight": "400",
339
- "lineHeight": 21,
340
+ "lineHeight": 24,
340
341
  },
341
342
  Object {
342
343
  "color": "hsl(210, 50%, 10%)",
@@ -344,8 +345,7 @@ Array [
344
345
  Array [
345
346
  Object {
346
347
  "color": "hsl(210, 25%, 25%)",
347
- "lineHeight": 21,
348
- "padding": 4,
348
+ "paddingVertical": 8,
349
349
  },
350
350
  undefined,
351
351
  ],
@@ -387,6 +387,7 @@ Array [
387
387
  "color": "hsl(210, 50%, 10%)",
388
388
  "flexGrow": 1,
389
389
  "fontSize": 16,
390
+ "paddingHorizontal": 4,
390
391
  "paddingVertical": 12,
391
392
  },
392
393
  Object {},
@@ -427,8 +428,7 @@ Array [
427
428
  },
428
429
  undefined,
429
430
  Object {
430
- "marginHorizontal": 16,
431
- "marginVertical": 12,
431
+ "margin": 12,
432
432
  },
433
433
  ]
434
434
  }