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

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 (88) hide show
  1. package/CHANGELOG.md +46 -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/types.d.ts +1 -1
  26. package/dist/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.d.ts +7 -3
  27. package/dist/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.js +4 -3
  28. package/dist/Authenticator/common/DefaultFormFields/DefaultTextFormFields.d.ts +6 -2
  29. package/dist/Authenticator/common/DefaultFormFields/DefaultTextFormFields.js +3 -3
  30. package/dist/Authenticator/common/DefaultFormFields/types.d.ts +12 -3
  31. package/dist/Authenticator/hooks/types.d.ts +3 -2
  32. package/dist/Authenticator/hooks/useFieldValues/types.d.ts +4 -1
  33. package/dist/Authenticator/hooks/useFieldValues/useFieldValues.d.ts +1 -1
  34. package/dist/Authenticator/hooks/useFieldValues/useFieldValues.js +21 -3
  35. package/dist/Authenticator/hooks/useFieldValues/utils.d.ts +10 -1
  36. package/dist/Authenticator/hooks/useFieldValues/utils.js +32 -2
  37. package/dist/primitives/TextField/TextField.js +2 -1
  38. package/dist/primitives/TextField/styles.js +3 -0
  39. package/dist/primitives/TextField/types.d.ts +1 -0
  40. package/dist/theme/createTheme.js +24 -18
  41. package/dist/theme/types.d.ts +1 -1
  42. package/dist/version.d.ts +1 -1
  43. package/dist/version.js +1 -1
  44. package/jest.config.js +1 -0
  45. package/package.json +5 -5
  46. package/src/Authenticator/Authenticator.tsx +2 -6
  47. package/src/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.tsx +7 -3
  48. package/src/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.tsx +7 -3
  49. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/ConfirmSignIn.spec.tsx +1 -0
  50. package/src/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.tsx +7 -3
  51. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/ConfirmSignUp.spec.tsx +1 -0
  52. package/src/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.tsx +7 -3
  53. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/ConfirmVerifyUser.spec.tsx +1 -0
  54. package/src/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.tsx +7 -3
  55. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +1 -1
  56. package/src/Authenticator/Defaults/ResetPassword/ResetPassword.tsx +7 -3
  57. package/src/Authenticator/Defaults/ResetPassword/__tests__/ResetPassword.spec.tsx +1 -0
  58. package/src/Authenticator/Defaults/SetupTOTP/SetupTOTP.tsx +7 -3
  59. package/src/Authenticator/Defaults/SetupTOTP/__tests__/SetupTOTP.spec.tsx +1 -0
  60. package/src/Authenticator/Defaults/SignIn/SignIn.tsx +7 -3
  61. package/src/Authenticator/Defaults/SignIn/__tests__/SignIn.spec.tsx +1 -0
  62. package/src/Authenticator/Defaults/SignUp/SignUp.tsx +7 -3
  63. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +1 -1
  64. package/src/Authenticator/Defaults/VerifyUser/VerifyUser.tsx +7 -3
  65. package/src/Authenticator/Defaults/VerifyUser/__tests__/VerifyUser.spec.tsx +1 -0
  66. package/src/Authenticator/Defaults/types.ts +63 -49
  67. package/src/Authenticator/__tests__/Authenticator.spec.tsx +16 -19
  68. package/src/Authenticator/__tests__/__snapshots__/Authenticator.spec.tsx.snap +1 -9
  69. package/src/Authenticator/__tests__/withAuthenticator.spec.tsx +1 -1
  70. package/src/Authenticator/common/DefaultContent/types.ts +1 -4
  71. package/src/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.tsx +8 -6
  72. package/src/Authenticator/common/DefaultFormFields/DefaultTextFormFields.tsx +10 -7
  73. package/src/Authenticator/common/DefaultFormFields/types.ts +15 -5
  74. package/src/Authenticator/hooks/types.ts +3 -0
  75. package/src/Authenticator/hooks/useFieldValues/__tests__/useFieldValues.spec.ts +75 -2
  76. package/src/Authenticator/hooks/useFieldValues/__tests__/utils.spec.ts +67 -1
  77. package/src/Authenticator/hooks/useFieldValues/types.ts +5 -0
  78. package/src/Authenticator/hooks/useFieldValues/useFieldValues.ts +26 -1
  79. package/src/Authenticator/hooks/useFieldValues/utils.ts +44 -1
  80. package/src/primitives/TextField/TextField.tsx +2 -1
  81. package/src/primitives/TextField/__tests__/TextField.spec.tsx +57 -8
  82. package/src/primitives/TextField/__tests__/__snapshots__/TextField.spec.tsx.snap +31 -31
  83. package/src/primitives/TextField/styles.ts +3 -0
  84. package/src/primitives/TextField/types.ts +1 -0
  85. package/src/theme/__tests__/createTheme.spec.ts +48 -0
  86. package/src/theme/createTheme.ts +44 -21
  87. package/src/theme/types.ts +17 -16
  88. package/src/version.ts +1 -1
@@ -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.21";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.20';
1
+ export const VERSION = '1.2.21';
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.21",
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.7",
42
+ "@aws-amplify/ui-react-core": "2.1.26",
43
+ "@aws-amplify/ui-react-core-notifications": "1.0.3"
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
  };
@@ -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(),
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultConfirmSignUpComponent } from '../types';
12
+ import { DefaultConfirmSignUpProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'ConfirmSignUp';
15
15
 
@@ -21,7 +21,7 @@ const {
21
21
  getResendCodeText,
22
22
  } = authenticatorTextUtil;
23
23
 
24
- const ConfirmSignUp: DefaultConfirmSignUpComponent = ({
24
+ const ConfirmSignUp = ({
25
25
  codeDeliveryDetails,
26
26
  fields,
27
27
  handleBlur,
@@ -29,11 +29,13 @@ const ConfirmSignUp: DefaultConfirmSignUpComponent = ({
29
29
  handleSubmit,
30
30
  isPending,
31
31
  resendCode,
32
+ validationErrors,
32
33
  ...rest
33
- }) => {
34
+ }: DefaultConfirmSignUpProps): JSX.Element => {
34
35
  const {
35
36
  disableFormSubmit: disabled,
36
37
  fields: fieldsWithHandlers,
38
+ fieldValidationErrors,
37
39
  handleFormSubmit,
38
40
  } = useFieldValues({
39
41
  componentName: COMPONENT_NAME,
@@ -41,6 +43,7 @@ const ConfirmSignUp: DefaultConfirmSignUpComponent = ({
41
43
  handleBlur,
42
44
  handleChange,
43
45
  handleSubmit,
46
+ validationErrors,
44
47
  });
45
48
 
46
49
  const headerText = getDeliveryMethodText(codeDeliveryDetails);
@@ -74,6 +77,7 @@ const ConfirmSignUp: DefaultConfirmSignUpComponent = ({
74
77
  headerText={headerText}
75
78
  fields={fieldsWithHandlers}
76
79
  isPending={isPending}
80
+ validationErrors={fieldValidationErrors}
77
81
  />
78
82
  );
79
83
  };
@@ -16,6 +16,7 @@ const props = {
16
16
  handleBlur: jest.fn(),
17
17
  handleChange: jest.fn(),
18
18
  handleSubmit: jest.fn(),
19
+ hasValidationErrors: false,
19
20
  Header: ConfirmSignUp.Header,
20
21
  isPending: false,
21
22
  resendCode: jest.fn(),
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultConfirmVerifyUserComponent } from '../types';
12
+ import { DefaultConfirmVerifyUserProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'ConfirmVerifyUser';
15
15
 
@@ -20,18 +20,20 @@ const {
20
20
  getSubmittingText,
21
21
  } = authenticatorTextUtil;
22
22
 
23
- const ConfirmVerifyUser: DefaultConfirmVerifyUserComponent = ({
23
+ const ConfirmVerifyUser = ({
24
24
  fields,
25
25
  handleBlur,
26
26
  handleChange,
27
27
  handleSubmit,
28
28
  isPending,
29
29
  skipVerification,
30
+ validationErrors,
30
31
  ...rest
31
- }) => {
32
+ }: DefaultConfirmVerifyUserProps): JSX.Element => {
32
33
  const {
33
34
  disableFormSubmit: disabled,
34
35
  fields: fieldsWithHandlers,
36
+ fieldValidationErrors,
35
37
  handleFormSubmit,
36
38
  } = useFieldValues({
37
39
  componentName: COMPONENT_NAME,
@@ -39,6 +41,7 @@ const ConfirmVerifyUser: DefaultConfirmVerifyUserComponent = ({
39
41
  handleBlur,
40
42
  handleChange,
41
43
  handleSubmit,
44
+ validationErrors,
42
45
  });
43
46
 
44
47
  const headerText = getAccountRecoveryInfoText();
@@ -70,6 +73,7 @@ const ConfirmVerifyUser: DefaultConfirmVerifyUserComponent = ({
70
73
  headerText={headerText}
71
74
  fields={fieldsWithHandlers}
72
75
  isPending={isPending}
76
+ validationErrors={fieldValidationErrors}
73
77
  />
74
78
  );
75
79
  };
@@ -18,6 +18,7 @@ const props = {
18
18
  handleBlur: jest.fn(),
19
19
  handleChange: jest.fn(),
20
20
  handleSubmit: jest.fn(),
21
+ hasValidationErrors: false,
21
22
  Header: ConfirmVerifyUser.Header,
22
23
  isPending: false,
23
24
  skipVerification: jest.fn(),
@@ -9,14 +9,14 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultForceNewPasswordComponent } from '../types';
12
+ import { DefaultForceNewPasswordProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'ForceNewPassword';
15
15
 
16
16
  const { getChangePasswordText, getChangingText, getBackToSignInText } =
17
17
  authenticatorTextUtil;
18
18
 
19
- const ForceNewPassword: DefaultForceNewPasswordComponent = ({
19
+ const ForceNewPassword = ({
20
20
  fields,
21
21
  handleBlur,
22
22
  handleChange,
@@ -24,11 +24,13 @@ const ForceNewPassword: DefaultForceNewPasswordComponent = ({
24
24
  hasValidationErrors,
25
25
  isPending,
26
26
  toSignIn,
27
+ validationErrors,
27
28
  ...rest
28
- }) => {
29
+ }: DefaultForceNewPasswordProps): JSX.Element => {
29
30
  const {
30
31
  disableFormSubmit,
31
32
  fields: fieldsWithHandlers,
33
+ fieldValidationErrors,
32
34
  handleFormSubmit,
33
35
  } = useFieldValues({
34
36
  componentName: COMPONENT_NAME,
@@ -36,6 +38,7 @@ const ForceNewPassword: DefaultForceNewPasswordComponent = ({
36
38
  handleBlur,
37
39
  handleChange,
38
40
  handleSubmit,
41
+ validationErrors,
39
42
  });
40
43
 
41
44
  const disabled = hasValidationErrors || disableFormSubmit;
@@ -70,6 +73,7 @@ const ForceNewPassword: DefaultForceNewPasswordComponent = ({
70
73
  headerText={headerText}
71
74
  fields={fieldsWithHandlers}
72
75
  isPending={isPending}
76
+ validationErrors={fieldValidationErrors}
73
77
  />
74
78
  );
75
79
  };
@@ -644,7 +644,7 @@ Array [
644
644
  style={
645
645
  Object {
646
646
  "alignItems": "center",
647
- "borderColor": "hsl(210, 10%, 58%)",
647
+ "borderColor": "hsl(0, 95%, 30%)",
648
648
  "borderRadius": 4,
649
649
  "borderWidth": 1,
650
650
  "flexDirection": "row",
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultResetPasswordComponent } from '../types';
12
+ import { DefaultResetPasswordProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'ResetPassword';
15
15
  const {
@@ -19,18 +19,20 @@ const {
19
19
  getBackToSignInText,
20
20
  } = authenticatorTextUtil;
21
21
 
22
- const ResetPassword: DefaultResetPasswordComponent = ({
22
+ const ResetPassword = ({
23
23
  fields,
24
24
  handleBlur,
25
25
  handleChange,
26
26
  handleSubmit,
27
27
  isPending,
28
28
  toSignIn,
29
+ validationErrors,
29
30
  ...rest
30
- }) => {
31
+ }: DefaultResetPasswordProps): JSX.Element => {
31
32
  const {
32
33
  disableFormSubmit: disabled,
33
34
  fields: fieldsWithHandlers,
35
+ fieldValidationErrors,
34
36
  handleFormSubmit,
35
37
  } = useFieldValues({
36
38
  componentName: COMPONENT_NAME,
@@ -38,6 +40,7 @@ const ResetPassword: DefaultResetPasswordComponent = ({
38
40
  handleBlur,
39
41
  handleChange,
40
42
  handleSubmit,
43
+ validationErrors,
41
44
  });
42
45
 
43
46
  const headerText = getResetYourPasswordText();
@@ -69,6 +72,7 @@ const ResetPassword: DefaultResetPasswordComponent = ({
69
72
  headerText={headerText}
70
73
  fields={fieldsWithHandlers}
71
74
  isPending={isPending}
75
+ validationErrors={fieldValidationErrors}
72
76
  />
73
77
  );
74
78
  };
@@ -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: ResetPassword.Header,
25
26
  isPending: false,
26
27
  toSignIn: jest.fn(),
@@ -12,7 +12,7 @@ import {
12
12
  } from '../../common';
13
13
  import { useFieldValues } from '../../hooks';
14
14
 
15
- import { DefaultSetupTOTPComponent } from '../types';
15
+ import { DefaultSetupTOTPProps } from '../types';
16
16
  import { styles } from './styles';
17
17
 
18
18
  const COMPONENT_NAME = 'SetupTOTP';
@@ -25,7 +25,7 @@ const {
25
25
  getSetupTOTPInstructionsText,
26
26
  } = authenticatorTextUtil;
27
27
 
28
- const SetupTOTP: DefaultSetupTOTPComponent = ({
28
+ const SetupTOTP = ({
29
29
  fields,
30
30
  handleBlur,
31
31
  handleChange,
@@ -33,11 +33,13 @@ const SetupTOTP: DefaultSetupTOTPComponent = ({
33
33
  isPending,
34
34
  toSignIn,
35
35
  totpSecretCode,
36
+ validationErrors,
36
37
  ...rest
37
- }) => {
38
+ }: DefaultSetupTOTPProps): JSX.Element => {
38
39
  const {
39
40
  disableFormSubmit: disabled,
40
41
  fields: fieldsWithHandlers,
42
+ fieldValidationErrors,
41
43
  handleFormSubmit,
42
44
  } = useFieldValues({
43
45
  componentName: COMPONENT_NAME,
@@ -45,6 +47,7 @@ const SetupTOTP: DefaultSetupTOTPComponent = ({
45
47
  handleBlur,
46
48
  handleChange,
47
49
  handleSubmit,
50
+ validationErrors,
48
51
  });
49
52
 
50
53
  const headerText = getSetupTOTPText();
@@ -88,6 +91,7 @@ const SetupTOTP: DefaultSetupTOTPComponent = ({
88
91
  headerText={headerText}
89
92
  fields={fieldsWithHandlers}
90
93
  isPending={isPending}
94
+ validationErrors={fieldValidationErrors}
91
95
  />
92
96
  );
93
97
  };
@@ -22,6 +22,7 @@ const props = {
22
22
  handleBlur: jest.fn(),
23
23
  handleChange: jest.fn(),
24
24
  handleSubmit: jest.fn(),
25
+ hasValidationErrors: false,
25
26
  isPending: false,
26
27
  toSignIn,
27
28
  totpSecretCode: "Let's keep it hush hush",
@@ -9,11 +9,11 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultSignInComponent } from '../types';
12
+ import { DefaultSignInProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'SignIn';
15
15
 
16
- const SignIn: DefaultSignInComponent = ({
16
+ const SignIn = ({
17
17
  fields,
18
18
  handleBlur,
19
19
  handleChange,
@@ -21,8 +21,9 @@ const SignIn: DefaultSignInComponent = ({
21
21
  hideSignUp,
22
22
  toResetPassword,
23
23
  toSignUp,
24
+ validationErrors,
24
25
  ...rest
25
- }) => {
26
+ }: DefaultSignInProps): JSX.Element => {
26
27
  const {
27
28
  getSignInTabText,
28
29
  getSignInText,
@@ -33,6 +34,7 @@ const SignIn: DefaultSignInComponent = ({
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 SignIn: DefaultSignInComponent = ({
40
42
  handleBlur,
41
43
  handleChange,
42
44
  handleSubmit,
45
+ validationErrors,
43
46
  });
44
47
 
45
48
  const headerText = getSignInTabText();
@@ -75,6 +78,7 @@ const SignIn: DefaultSignInComponent = ({
75
78
  buttons={buttons}
76
79
  fields={fieldsWithHandlers}
77
80
  headerText={headerText}
81
+ validationErrors={fieldValidationErrors}
78
82
  />
79
83
  );
80
84
  };
@@ -29,6 +29,7 @@ const props = {
29
29
  handleBlur: jest.fn(),
30
30
  handleChange: jest.fn(),
31
31
  handleSubmit: jest.fn(),
32
+ hasValidationErrors: false,
32
33
  Header: SignIn.Header,
33
34
  isPending: false,
34
35
  socialProviders: undefined,
@@ -9,7 +9,7 @@ import {
9
9
  } from '../../common';
10
10
  import { useFieldValues } from '../../hooks';
11
11
 
12
- import { DefaultSignUpComponent } from '../types';
12
+ import { DefaultSignUpProps } from '../types';
13
13
 
14
14
  const COMPONENT_NAME = 'SignUp';
15
15
 
@@ -20,7 +20,7 @@ const {
20
20
  getSignUpTabText,
21
21
  } = authenticatorTextUtil;
22
22
 
23
- const SignUp: DefaultSignUpComponent = ({
23
+ const SignUp = ({
24
24
  fields,
25
25
  handleBlur,
26
26
  handleChange,
@@ -29,11 +29,13 @@ const SignUp: DefaultSignUpComponent = ({
29
29
  hideSignIn,
30
30
  isPending,
31
31
  toSignIn,
32
+ validationErrors,
32
33
  ...rest
33
- }) => {
34
+ }: DefaultSignUpProps): JSX.Element => {
34
35
  const {
35
36
  disableFormSubmit,
36
37
  fields: fieldsWithHandlers,
38
+ fieldValidationErrors,
37
39
  handleFormSubmit,
38
40
  } = useFieldValues({
39
41
  componentName: COMPONENT_NAME,
@@ -41,6 +43,7 @@ const SignUp: DefaultSignUpComponent = ({
41
43
  handleBlur,
42
44
  handleChange,
43
45
  handleSubmit,
46
+ validationErrors,
44
47
  });
45
48
 
46
49
  const disabled = hasValidationErrors || disableFormSubmit;
@@ -78,6 +81,7 @@ const SignUp: DefaultSignUpComponent = ({
78
81
  fields={fieldsWithHandlers}
79
82
  headerText={headerText}
80
83
  isPending={isPending}
84
+ validationErrors={fieldValidationErrors}
81
85
  />
82
86
  );
83
87
  };
@@ -2531,7 +2531,7 @@ Array [
2531
2531
  style={
2532
2532
  Object {
2533
2533
  "alignItems": "center",
2534
- "borderColor": "hsl(210, 10%, 58%)",
2534
+ "borderColor": "hsl(0, 95%, 30%)",
2535
2535
  "borderRadius": 4,
2536
2536
  "borderWidth": 1,
2537
2537
  "flexDirection": "row",