@aws-amplify/ui-react-native 1.2.18 → 1.2.19

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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/Authenticator/Authenticator.d.ts +6 -12
  3. package/dist/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.js +15 -4
  4. package/dist/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.js +13 -3
  5. package/dist/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.js +13 -3
  6. package/dist/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.js +13 -3
  7. package/dist/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.js +15 -4
  8. package/dist/Authenticator/Defaults/ResetPassword/ResetPassword.js +13 -3
  9. package/dist/Authenticator/Defaults/SetupTOTP/SetupTOTP.js +13 -3
  10. package/dist/Authenticator/Defaults/SignIn/SignIn.js +3 -2
  11. package/dist/Authenticator/Defaults/SignUp/SignUp.js +9 -3
  12. package/dist/Authenticator/Defaults/VerifyUser/VerifyUser.js +3 -3
  13. package/dist/Authenticator/common/DefaultContent/DefaultContent.js +2 -2
  14. package/dist/primitives/Radio/styles.js +2 -1
  15. package/dist/version.d.ts +1 -1
  16. package/dist/version.js +1 -1
  17. package/package.json +4 -4
  18. package/src/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.tsx +19 -3
  19. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/ConfirmResetPassword.spec.tsx +1 -0
  20. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +13 -0
  21. package/src/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.tsx +17 -3
  22. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +13 -0
  23. package/src/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.tsx +17 -3
  24. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +19 -0
  25. package/src/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.tsx +17 -3
  26. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +19 -0
  27. package/src/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.tsx +19 -3
  28. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/ForceNewPassword.spec.tsx +1 -0
  29. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +19 -0
  30. package/src/Authenticator/Defaults/ResetPassword/ResetPassword.tsx +17 -3
  31. package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +13 -0
  32. package/src/Authenticator/Defaults/SetupTOTP/SetupTOTP.tsx +17 -3
  33. package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +13 -0
  34. package/src/Authenticator/Defaults/SignIn/SignIn.tsx +7 -2
  35. package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +19 -0
  36. package/src/Authenticator/Defaults/SignUp/SignUp.tsx +13 -2
  37. package/src/Authenticator/Defaults/SignUp/__tests__/SignUp.spec.tsx +1 -0
  38. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +31 -0
  39. package/src/Authenticator/Defaults/VerifyUser/VerifyUser.tsx +7 -3
  40. package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +19 -0
  41. package/src/Authenticator/common/DefaultContent/DefaultContent.tsx +2 -0
  42. package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +9 -0
  43. package/src/primitives/Radio/styles.ts +2 -1
  44. package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +24 -0
  45. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @aws-amplify/ui-react-native
2
2
 
3
+ ## 1.2.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4111](https://github.com/aws-amplify/amplify-ui/pull/4111) [`6f4b296fd`](https://github.com/aws-amplify/amplify-ui/commit/6f4b296fdbe73e1b8a37bede2e85d1ea8d819a54) Thanks [@calebpollman](https://github.com/calebpollman)! - fix(react-native): add spacing between Radio icon and label
8
+
9
+ - [#4013](https://github.com/aws-amplify/amplify-ui/pull/4013) [`23180b470`](https://github.com/aws-amplify/amplify-ui/commit/23180b470c7b3b78a5970d00f8c2dc5ce8773eff) Thanks [@calebpollman](https://github.com/calebpollman)! - chore(ui-react-native): disable Authenticator submit button on invalid form
10
+
11
+ - Updated dependencies [[`23180b470`](https://github.com/aws-amplify/amplify-ui/commit/23180b470c7b3b78a5970d00f8c2dc5ce8773eff), [`3cecd0765`](https://github.com/aws-amplify/amplify-ui/commit/3cecd0765b46c77c49af24fae7cfb9054ebe2cdb)]:
12
+ - @aws-amplify/ui-react-core@2.1.24
13
+ - @aws-amplify/ui@5.6.5
14
+ - @aws-amplify/ui-react-core-notifications@1.0.1
15
+
3
16
  ## 1.2.18
4
17
 
5
18
  ### Patch Changes
@@ -8,15 +8,13 @@ declare namespace Authenticator {
8
8
  var Provider: typeof import("@aws-amplify/ui-react-core").AuthenticatorProvider;
9
9
  var ConfirmResetPassword: (React.ComponentClass<import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ComponentSlots<import("./hooks").TextFieldOptionsType> & {
10
10
  resendCode: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
11
- validationErrors?: import("@aws-amplify/ui").ValidationError | undefined;
12
- } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & {
11
+ } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ValidationProps & {
13
12
  fields: import("./hooks").TextFieldOptionsType[];
14
13
  } & {
15
14
  style?: import("./Defaults/types").ConfirmResetPasswordStyle | undefined;
16
15
  }, any> | React.FunctionComponent<import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ComponentSlots<import("./hooks").TextFieldOptionsType> & {
17
16
  resendCode: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
18
- validationErrors?: import("@aws-amplify/ui").ValidationError | undefined;
19
- } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & {
17
+ } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ValidationProps & {
20
18
  fields: import("./hooks").TextFieldOptionsType[];
21
19
  } & {
22
20
  style?: import("./Defaults/types").ConfirmResetPasswordStyle | undefined;
@@ -66,15 +64,13 @@ declare namespace Authenticator {
66
64
  }>) & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ComponentSlots<import("./hooks").TextFieldOptionsType>;
67
65
  var ForceNewPassword: (React.ComponentClass<import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ComponentSlots<import("./hooks").TextFieldOptionsType> & {
68
66
  toSignIn: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
69
- validationErrors?: import("@aws-amplify/ui").ValidationError | undefined;
70
- } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & {
67
+ } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ValidationProps & {
71
68
  fields: import("./hooks").TextFieldOptionsType[];
72
69
  } & {
73
70
  style?: import("./Defaults/types").ForceNewPasswordStyle | undefined;
74
71
  }, any> | React.FunctionComponent<import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ComponentSlots<import("./hooks").TextFieldOptionsType> & {
75
72
  toSignIn: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
76
- validationErrors?: import("@aws-amplify/ui").ValidationError | undefined;
77
- } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & {
73
+ } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ValidationProps & {
78
74
  fields: import("./hooks").TextFieldOptionsType[];
79
75
  } & {
80
76
  style?: import("./Defaults/types").ForceNewPasswordStyle | undefined;
@@ -130,8 +126,7 @@ declare namespace Authenticator {
130
126
  hideSignIn?: boolean | undefined;
131
127
  toFederatedSignIn: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
132
128
  toSignIn: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
133
- validationErrors?: import("@aws-amplify/ui").ValidationError | undefined;
134
- } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & {
129
+ } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ValidationProps & {
135
130
  fields: import("./hooks").TextFieldOptionsType[];
136
131
  } & {
137
132
  style?: import("./Defaults/types").SignUpStyle | undefined;
@@ -139,8 +134,7 @@ declare namespace Authenticator {
139
134
  hideSignIn?: boolean | undefined;
140
135
  toFederatedSignIn: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
141
136
  toSignIn: (data?: import("@aws-amplify/ui").AuthEventData | undefined) => void;
142
- validationErrors?: import("@aws-amplify/ui").ValidationError | undefined;
143
- } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & {
137
+ } & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").CommonRouteProps & import("@aws-amplify/ui-react-core/dist/types/Authenticator/hooks").ValidationProps & {
144
138
  fields: import("./hooks").TextFieldOptionsType[];
145
139
  } & {
146
140
  style?: import("./Defaults/types").SignUpStyle | undefined;
@@ -4,21 +4,32 @@ import { DefaultContent, DefaultFooter, DefaultTextFormFields, DefaultHeader, }
4
4
  import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'ConfirmResetPassword';
6
6
  const { getResetYourPasswordText, getSubmitText, getSubmittingText, getResendCodeText, } = authenticatorTextUtil;
7
- const ConfirmResetPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPending, resendCode, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
7
+ const ConfirmResetPassword = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationErrors, isPending, resendCode, ...rest }) => {
8
+ const { disableFormSubmit, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
12
12
  handleChange,
13
13
  handleSubmit,
14
14
  });
15
+ const disabled = hasValidationErrors || disableFormSubmit;
15
16
  const headerText = getResetYourPasswordText();
16
17
  const primaryButtonText = isPending ? getSubmittingText() : getSubmitText();
17
18
  const secondaryButtonText = getResendCodeText();
18
19
  const buttons = useMemo(() => ({
19
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
20
+ primary: {
21
+ children: primaryButtonText,
22
+ disabled,
23
+ onPress: handleFormSubmit,
24
+ },
20
25
  secondary: { children: secondaryButtonText, onPress: resendCode },
21
- }), [handleFormSubmit, primaryButtonText, resendCode, secondaryButtonText]);
26
+ }), [
27
+ disabled,
28
+ handleFormSubmit,
29
+ primaryButtonText,
30
+ resendCode,
31
+ secondaryButtonText,
32
+ ]);
22
33
  return (<DefaultContent {...rest} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
23
34
  };
24
35
  ConfirmResetPassword.Footer = DefaultFooter;
@@ -5,7 +5,7 @@ import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'ConfirmSignIn';
6
6
  const { getBackToSignInText, getChallengeText, getConfirmText, getConfirmingText, } = authenticatorTextUtil;
7
7
  const ConfirmSignIn = ({ challengeName, fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
8
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
@@ -16,9 +16,19 @@ const ConfirmSignIn = ({ challengeName, fields, handleBlur, handleChange, handle
16
16
  const primaryButtonText = isPending ? getConfirmingText() : getConfirmText();
17
17
  const secondaryButtonText = getBackToSignInText();
18
18
  const buttons = useMemo(() => ({
19
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
19
+ primary: {
20
+ children: primaryButtonText,
21
+ disabled,
22
+ onPress: handleFormSubmit,
23
+ },
20
24
  links: [{ children: secondaryButtonText, onPress: toSignIn }],
21
- }), [handleFormSubmit, primaryButtonText, secondaryButtonText, toSignIn]);
25
+ }), [
26
+ disabled,
27
+ handleFormSubmit,
28
+ primaryButtonText,
29
+ secondaryButtonText,
30
+ toSignIn,
31
+ ]);
22
32
  return (<DefaultContent {...rest} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
23
33
  };
24
34
  ConfirmSignIn.Footer = DefaultFooter;
@@ -5,7 +5,7 @@ import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'ConfirmSignUp';
6
6
  const { getDeliveryMethodText, getDeliveryMessageText, getConfirmingText, getConfirmText, getResendCodeText, } = authenticatorTextUtil;
7
7
  const ConfirmSignUp = ({ codeDeliveryDetails, fields, handleBlur, handleChange, handleSubmit, isPending, resendCode, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
8
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
@@ -17,9 +17,19 @@ const ConfirmSignUp = ({ codeDeliveryDetails, fields, handleBlur, handleChange,
17
17
  const primaryButtonText = isPending ? getConfirmingText() : getConfirmText();
18
18
  const secondaryButtonText = getResendCodeText();
19
19
  const buttons = useMemo(() => ({
20
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
20
+ primary: {
21
+ children: primaryButtonText,
22
+ disabled,
23
+ onPress: handleFormSubmit,
24
+ },
21
25
  secondary: { children: secondaryButtonText, onPress: resendCode },
22
- }), [handleFormSubmit, primaryButtonText, resendCode, secondaryButtonText]);
26
+ }), [
27
+ disabled,
28
+ handleFormSubmit,
29
+ primaryButtonText,
30
+ resendCode,
31
+ secondaryButtonText,
32
+ ]);
23
33
  return (<DefaultContent {...rest} body={bodyText} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
24
34
  };
25
35
  ConfirmSignUp.FormFields = DefaultTextFormFields;
@@ -5,7 +5,7 @@ import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'ConfirmVerifyUser';
6
6
  const { getAccountRecoveryInfoText, getSkipText, getSubmitText, getSubmittingText, } = authenticatorTextUtil;
7
7
  const ConfirmVerifyUser = ({ fields, handleBlur, handleChange, handleSubmit, isPending, skipVerification, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
8
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
@@ -16,9 +16,19 @@ const ConfirmVerifyUser = ({ fields, handleBlur, handleChange, handleSubmit, isP
16
16
  const primaryButtonText = isPending ? getSubmittingText() : getSubmitText();
17
17
  const secondaryButtonText = getSkipText();
18
18
  const buttons = useMemo(() => ({
19
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
19
+ primary: {
20
+ children: primaryButtonText,
21
+ disabled,
22
+ onPress: handleFormSubmit,
23
+ },
20
24
  links: [{ children: secondaryButtonText, onPress: skipVerification }],
21
- }), [handleFormSubmit, primaryButtonText, skipVerification, secondaryButtonText]);
25
+ }), [
26
+ disabled,
27
+ handleFormSubmit,
28
+ primaryButtonText,
29
+ skipVerification,
30
+ secondaryButtonText,
31
+ ]);
22
32
  return (<DefaultContent {...rest} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
23
33
  };
24
34
  ConfirmVerifyUser.Footer = DefaultFooter;
@@ -4,23 +4,34 @@ import { DefaultContent, DefaultFooter, DefaultTextFormFields, DefaultHeader, }
4
4
  import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'ForceNewPassword';
6
6
  const { getChangePasswordText, getChangingText, getBackToSignInText } = authenticatorTextUtil;
7
- const ForceNewPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
7
+ const ForceNewPassword = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationErrors, isPending, toSignIn, ...rest }) => {
8
+ const { disableFormSubmit, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
12
12
  handleChange,
13
13
  handleSubmit,
14
14
  });
15
+ const disabled = hasValidationErrors || disableFormSubmit;
15
16
  const headerText = getChangePasswordText();
16
17
  const primaryButtonText = isPending
17
18
  ? getChangingText()
18
19
  : getChangePasswordText();
19
20
  const secondaryButtonText = getBackToSignInText();
20
21
  const buttons = useMemo(() => ({
21
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
22
+ primary: {
23
+ children: primaryButtonText,
24
+ disabled,
25
+ onPress: handleFormSubmit,
26
+ },
22
27
  links: [{ children: secondaryButtonText, onPress: toSignIn }],
23
- }), [handleFormSubmit, primaryButtonText, secondaryButtonText, toSignIn]);
28
+ }), [
29
+ disabled,
30
+ handleFormSubmit,
31
+ primaryButtonText,
32
+ secondaryButtonText,
33
+ toSignIn,
34
+ ]);
24
35
  return (<DefaultContent {...rest} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
25
36
  };
26
37
  ForceNewPassword.Footer = DefaultFooter;
@@ -5,7 +5,7 @@ import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'ResetPassword';
6
6
  const { getResetYourPasswordText, getSendCodeText, getSendingText, getBackToSignInText, } = authenticatorTextUtil;
7
7
  const ResetPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
8
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
@@ -16,9 +16,19 @@ const ResetPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPendi
16
16
  const primaryButtonText = isPending ? getSendingText() : getSendCodeText();
17
17
  const secondaryButtonText = getBackToSignInText();
18
18
  const buttons = useMemo(() => ({
19
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
19
+ primary: {
20
+ children: primaryButtonText,
21
+ disabled,
22
+ onPress: handleFormSubmit,
23
+ },
20
24
  links: [{ children: secondaryButtonText, onPress: toSignIn }],
21
- }), [handleFormSubmit, primaryButtonText, secondaryButtonText, toSignIn]);
25
+ }), [
26
+ disabled,
27
+ handleFormSubmit,
28
+ primaryButtonText,
29
+ secondaryButtonText,
30
+ toSignIn,
31
+ ]);
22
32
  return (<DefaultContent {...rest} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
23
33
  };
24
34
  ResetPassword.Footer = DefaultFooter;
@@ -7,7 +7,7 @@ import { styles } from './styles';
7
7
  const COMPONENT_NAME = 'SetupTOTP';
8
8
  const { getBackToSignInText, getConfirmingText, getConfirmText, getSetupTOTPText, getSetupTOTPInstructionsText, } = authenticatorTextUtil;
9
9
  const SetupTOTP = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, totpSecretCode, ...rest }) => {
10
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
10
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
11
11
  componentName: COMPONENT_NAME,
12
12
  fields,
13
13
  handleBlur,
@@ -26,9 +26,19 @@ const SetupTOTP = ({ fields, handleBlur, handleChange, handleSubmit, isPending,
26
26
  </Label>
27
27
  </>);
28
28
  const buttons = useMemo(() => ({
29
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
29
+ primary: {
30
+ children: primaryButtonText,
31
+ disabled,
32
+ onPress: handleFormSubmit,
33
+ },
30
34
  links: [{ children: secondaryButtonText, onPress: toSignIn }],
31
- }), [handleFormSubmit, primaryButtonText, secondaryButtonText, toSignIn]);
35
+ }), [
36
+ disabled,
37
+ handleFormSubmit,
38
+ primaryButtonText,
39
+ secondaryButtonText,
40
+ toSignIn,
41
+ ]);
32
42
  return (<DefaultContent {...rest} body={body} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending}/>);
33
43
  };
34
44
  SetupTOTP.Footer = DefaultFooter;
@@ -5,7 +5,7 @@ import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'SignIn';
6
6
  const SignIn = ({ fields, handleBlur, handleChange, handleSubmit, hideSignUp, toResetPassword, toSignUp, ...rest }) => {
7
7
  const { getSignInTabText, getSignInText, getSignUpTabText, getForgotPasswordText, } = authenticatorTextUtil;
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
8
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
@@ -22,12 +22,13 @@ const SignIn = ({ fields, handleBlur, handleChange, handleSubmit, hideSignUp, to
22
22
  onPress: toResetPassword,
23
23
  };
24
24
  return {
25
- primary: { children: signInText, onPress: handleFormSubmit },
25
+ primary: { children: signInText, disabled, onPress: handleFormSubmit },
26
26
  links: hideSignUp
27
27
  ? [forgotPassword]
28
28
  : [forgotPassword, { children: signUpText, onPress: toSignUp }],
29
29
  };
30
30
  }, [
31
+ disabled,
31
32
  forgotPasswordText,
32
33
  handleFormSubmit,
33
34
  hideSignUp,
@@ -4,25 +4,31 @@ import { DefaultContent, DefaultFooter, DefaultTextFormFields, DefaultHeader, }
4
4
  import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'SignUp';
6
6
  const { getCreateAccountText, getCreatingAccountText, getSignInTabText, getSignUpTabText, } = authenticatorTextUtil;
7
- const SignUp = ({ fields, handleBlur, handleChange, handleSubmit, hideSignIn, isPending, toSignIn, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
7
+ const SignUp = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationErrors, hideSignIn, isPending, toSignIn, ...rest }) => {
8
+ const { disableFormSubmit, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
12
12
  handleChange,
13
13
  handleSubmit,
14
14
  });
15
+ const disabled = hasValidationErrors || disableFormSubmit;
15
16
  const headerText = getSignUpTabText();
16
17
  const primaryButtonText = isPending
17
18
  ? getCreatingAccountText()
18
19
  : getCreateAccountText();
19
20
  const secondaryButtonText = getSignInTabText();
20
21
  const buttons = useMemo(() => ({
21
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
22
+ primary: {
23
+ children: primaryButtonText,
24
+ disabled,
25
+ onPress: handleFormSubmit,
26
+ },
22
27
  links: hideSignIn
23
28
  ? undefined
24
29
  : [{ children: secondaryButtonText, onPress: toSignIn }],
25
30
  }), [
31
+ disabled,
26
32
  handleFormSubmit,
27
33
  hideSignIn,
28
34
  primaryButtonText,
@@ -5,7 +5,7 @@ import { useFieldValues } from '../../hooks';
5
5
  const COMPONENT_NAME = 'VerifyUser';
6
6
  const { getSkipText, getVerifyContactText, getVerifyText, getAccountRecoveryInfoText, } = authenticatorTextUtil;
7
7
  const VerifyUser = ({ fields, handleBlur, handleChange, handleSubmit, skipVerification, ...rest }) => {
8
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
8
+ const { disableFormSubmit: disabled, fields: fieldsWithHandlers, handleFormSubmit, } = useFieldValues({
9
9
  componentName: COMPONENT_NAME,
10
10
  fields,
11
11
  handleBlur,
@@ -17,9 +17,9 @@ const VerifyUser = ({ fields, handleBlur, handleChange, handleSubmit, skipVerifi
17
17
  const verifyText = getVerifyText();
18
18
  const bodyText = getAccountRecoveryInfoText();
19
19
  const buttons = useMemo(() => ({
20
- primary: { children: verifyText, onPress: handleFormSubmit },
20
+ primary: { children: verifyText, disabled, onPress: handleFormSubmit },
21
21
  links: [{ children: skipText, onPress: skipVerification }],
22
- }), [handleFormSubmit, skipText, skipVerification, verifyText]);
22
+ }), [disabled, handleFormSubmit, skipText, skipVerification, verifyText]);
23
23
  return (<DefaultContent {...rest} body={bodyText} buttons={buttons} fields={fieldsWithHandlers} headerText={headerText}/>);
24
24
  };
25
25
  VerifyUser.Footer = DefaultFooter;
@@ -18,10 +18,10 @@ export default function DefaultContent({ body, buttons: { primary, links, second
18
18
  <Header style={themedStyles.header}>{headerText}</Header>
19
19
  {body ? (typeof body === 'string' ? (<Label style={themedStyles.body}>{body}</Label>) : (body)) : null}
20
20
  <FormFields fieldContainerStyle={themedStyles.fieldContainer} fieldErrorsContainer={themedStyles.fieldErrorsContainer} fieldErrorStyle={themedStyles.fieldError} fieldLabelStyle={themedStyles.fieldLabel} fieldStyle={themedStyles.fieldStyle} fields={fields} isPending={isPending} validationErrors={validationErrors} style={themedStyles.formFields}/>
21
- {error ? (<ErrorMessage iconStyle={themedStyles.errorMessageIcon} labelStyle={themedStyles.errorMessageLabel} style={themedStyles.errorMessage}>
21
+ {error ? (<ErrorMessage iconStyle={themedStyles.errorMessageIcon} labelStyle={themedStyles.errorMessageLabel} style={themedStyles.errorMessage} testID="amplify__error-message">
22
22
  {error}
23
23
  </ErrorMessage>) : null}
24
- <Button {...primary} variant="primary" textStyle={themedStyles.buttonPrimaryLabel} style={themedStyles.buttonPrimary}/>
24
+ <Button {...primary} variant="primary" textStyle={themedStyles.buttonPrimaryLabel} style={themedStyles.buttonPrimary} testID="amplify__button"/>
25
25
  {secondary ? (<Button {...secondary} textStyle={themedStyles.buttonSecondaryLabel} style={themedStyles.buttonSecondary}/>) : null}
26
26
  {linkButtons}
27
27
  <Footer style={themedStyles.footer}/>
@@ -2,7 +2,7 @@ import { StyleSheet } from 'react-native';
2
2
  import { RADIO_DOT_PROPORTION } from './getRadioDimensions';
3
3
  const ROUNDED_BORDER_RADIUS = 999;
4
4
  export const getThemedStyles = (theme) => {
5
- const { components, tokens: { colors, fontSizes, opacities, borderWidths }, } = theme;
5
+ const { components, tokens: { colors, fontSizes, opacities, borderWidths, space }, } = theme;
6
6
  return StyleSheet.create({
7
7
  container: {
8
8
  alignItems: 'center',
@@ -22,6 +22,7 @@ export const getThemedStyles = (theme) => {
22
22
  borderRadius: ROUNDED_BORDER_RADIUS,
23
23
  borderWidth: borderWidths.medium,
24
24
  justifyContent: 'center',
25
+ margin: space.xxs,
25
26
  ...components?.radio?.radioContainer,
26
27
  },
27
28
  radioDot: {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.18";
1
+ export declare const VERSION = "1.2.19";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.18';
1
+ export const VERSION = '1.2.19';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-native",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,9 +37,9 @@
37
37
  "rimraf": "^3.0.2"
38
38
  },
39
39
  "dependencies": {
40
- "@aws-amplify/ui": "5.6.4",
41
- "@aws-amplify/ui-react-core": "2.1.23",
42
- "@aws-amplify/ui-react-core-notifications": "1.0.0"
40
+ "@aws-amplify/ui": "5.6.5",
41
+ "@aws-amplify/ui-react-core": "2.1.24",
42
+ "@aws-amplify/ui-react-core-notifications": "1.0.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "aws-amplify": ">= 5.0.1",
@@ -25,11 +25,16 @@ const ConfirmResetPassword: DefaultConfirmResetPasswordComponent = ({
25
25
  handleBlur,
26
26
  handleChange,
27
27
  handleSubmit,
28
+ hasValidationErrors,
28
29
  isPending,
29
30
  resendCode,
30
31
  ...rest
31
32
  }) => {
32
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
33
+ const {
34
+ disableFormSubmit,
35
+ fields: fieldsWithHandlers,
36
+ handleFormSubmit,
37
+ } = useFieldValues({
33
38
  componentName: COMPONENT_NAME,
34
39
  fields,
35
40
  handleBlur,
@@ -37,16 +42,27 @@ const ConfirmResetPassword: DefaultConfirmResetPasswordComponent = ({
37
42
  handleSubmit,
38
43
  });
39
44
 
45
+ const disabled = hasValidationErrors || disableFormSubmit;
40
46
  const headerText = getResetYourPasswordText();
41
47
  const primaryButtonText = isPending ? getSubmittingText() : getSubmitText();
42
48
  const secondaryButtonText = getResendCodeText();
43
49
 
44
50
  const buttons = useMemo(
45
51
  () => ({
46
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
52
+ primary: {
53
+ children: primaryButtonText,
54
+ disabled,
55
+ onPress: handleFormSubmit,
56
+ },
47
57
  secondary: { children: secondaryButtonText, onPress: resendCode },
48
58
  }),
49
- [handleFormSubmit, primaryButtonText, resendCode, secondaryButtonText]
59
+ [
60
+ disabled,
61
+ handleFormSubmit,
62
+ primaryButtonText,
63
+ resendCode,
64
+ secondaryButtonText,
65
+ ]
50
66
  );
51
67
 
52
68
  return (
@@ -34,6 +34,7 @@ const props = {
34
34
  handleBlur: jest.fn(),
35
35
  handleChange: jest.fn(),
36
36
  handleSubmit: jest.fn(),
37
+ hasValidationErrors: false,
37
38
  Header: ConfirmResetPassword.Header,
38
39
  isPending: false,
39
40
  resendCode: jest.fn(),
@@ -423,6 +423,7 @@ Array [
423
423
  },
424
424
  ]
425
425
  }
426
+ testID="amplify__error-message"
426
427
  >
427
428
  <Image
428
429
  accessibilityRole="image"
@@ -467,6 +468,11 @@ Array [
467
468
  </View>,
468
469
  <View
469
470
  accessibilityRole="button"
471
+ accessibilityState={
472
+ Object {
473
+ "disabled": false,
474
+ }
475
+ }
470
476
  accessible={true}
471
477
  collapsable={false}
472
478
  focusable={true}
@@ -496,6 +502,7 @@ Array [
496
502
  },
497
503
  ]
498
504
  }
505
+ testID="amplify__button"
499
506
  >
500
507
  <Text
501
508
  style={
@@ -974,6 +981,11 @@ Array [
974
981
  </View>,
975
982
  <View
976
983
  accessibilityRole="button"
984
+ accessibilityState={
985
+ Object {
986
+ "disabled": false,
987
+ }
988
+ }
977
989
  accessible={true}
978
990
  collapsable={false}
979
991
  focusable={true}
@@ -1003,6 +1015,7 @@ Array [
1003
1015
  },
1004
1016
  ]
1005
1017
  }
1018
+ testID="amplify__button"
1006
1019
  >
1007
1020
  <Text
1008
1021
  style={
@@ -30,7 +30,11 @@ const ConfirmSignIn: DefaultConfirmSignInComponent = ({
30
30
  toSignIn,
31
31
  ...rest
32
32
  }) => {
33
- const { fields: fieldsWithHandlers, handleFormSubmit } = useFieldValues({
33
+ const {
34
+ disableFormSubmit: disabled,
35
+ fields: fieldsWithHandlers,
36
+ handleFormSubmit,
37
+ } = useFieldValues({
34
38
  componentName: COMPONENT_NAME,
35
39
  fields,
36
40
  handleBlur,
@@ -44,10 +48,20 @@ const ConfirmSignIn: DefaultConfirmSignInComponent = ({
44
48
 
45
49
  const buttons = useMemo(
46
50
  () => ({
47
- primary: { children: primaryButtonText, onPress: handleFormSubmit },
51
+ primary: {
52
+ children: primaryButtonText,
53
+ disabled,
54
+ onPress: handleFormSubmit,
55
+ },
48
56
  links: [{ children: secondaryButtonText, onPress: toSignIn }],
49
57
  }),
50
- [handleFormSubmit, primaryButtonText, secondaryButtonText, toSignIn]
58
+ [
59
+ disabled,
60
+ handleFormSubmit,
61
+ primaryButtonText,
62
+ secondaryButtonText,
63
+ toSignIn,
64
+ ]
51
65
  );
52
66
 
53
67
  return (
@@ -127,6 +127,7 @@ Array [
127
127
  },
128
128
  ]
129
129
  }
130
+ testID="amplify__error-message"
130
131
  >
131
132
  <Image
132
133
  accessibilityRole="image"
@@ -171,6 +172,11 @@ Array [
171
172
  </View>,
172
173
  <View
173
174
  accessibilityRole="button"
175
+ accessibilityState={
176
+ Object {
177
+ "disabled": false,
178
+ }
179
+ }
174
180
  accessible={true}
175
181
  collapsable={false}
176
182
  focusable={true}
@@ -200,6 +206,7 @@ Array [
200
206
  },
201
207
  ]
202
208
  }
209
+ testID="amplify__button"
203
210
  >
204
211
  <Text
205
212
  style={
@@ -391,6 +398,11 @@ Array [
391
398
  </View>,
392
399
  <View
393
400
  accessibilityRole="button"
401
+ accessibilityState={
402
+ Object {
403
+ "disabled": false,
404
+ }
405
+ }
394
406
  accessible={true}
395
407
  collapsable={false}
396
408
  focusable={true}
@@ -420,6 +432,7 @@ Array [
420
432
  },
421
433
  ]
422
434
  }
435
+ testID="amplify__button"
423
436
  >
424
437
  <Text
425
438
  style={