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

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 (60) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/Authenticator/Authenticator.d.ts +6 -12
  3. package/dist/Authenticator/Authenticator.js +5 -0
  4. package/dist/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.js +15 -4
  5. package/dist/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.js +13 -3
  6. package/dist/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.js +13 -3
  7. package/dist/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.js +13 -3
  8. package/dist/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.js +15 -4
  9. package/dist/Authenticator/Defaults/ResetPassword/ResetPassword.js +13 -3
  10. package/dist/Authenticator/Defaults/SetupTOTP/SetupTOTP.js +13 -3
  11. package/dist/Authenticator/Defaults/SignIn/SignIn.js +3 -2
  12. package/dist/Authenticator/Defaults/SignUp/SignUp.js +9 -3
  13. package/dist/Authenticator/Defaults/VerifyUser/VerifyUser.js +3 -3
  14. package/dist/Authenticator/common/DefaultContent/DefaultContent.js +2 -2
  15. package/dist/hooks/index.d.ts +1 -0
  16. package/dist/hooks/index.js +1 -0
  17. package/dist/hooks/useDeprecationWarning/index.d.ts +1 -0
  18. package/dist/hooks/useDeprecationWarning/index.js +1 -0
  19. package/dist/hooks/useDeprecationWarning/useDeprecationWarning.d.ts +6 -0
  20. package/dist/hooks/useDeprecationWarning/useDeprecationWarning.js +11 -0
  21. package/dist/primitives/Radio/styles.js +2 -1
  22. package/dist/utils/platform.d.ts +5 -0
  23. package/dist/utils/platform.js +2 -0
  24. package/dist/version.d.ts +1 -1
  25. package/dist/version.js +1 -1
  26. package/package.json +5 -4
  27. package/src/Authenticator/Authenticator.tsx +7 -0
  28. package/src/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.tsx +19 -3
  29. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/ConfirmResetPassword.spec.tsx +1 -0
  30. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +13 -0
  31. package/src/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.tsx +17 -3
  32. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +13 -0
  33. package/src/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.tsx +17 -3
  34. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +19 -0
  35. package/src/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.tsx +17 -3
  36. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +19 -0
  37. package/src/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.tsx +19 -3
  38. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/ForceNewPassword.spec.tsx +1 -0
  39. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +19 -0
  40. package/src/Authenticator/Defaults/ResetPassword/ResetPassword.tsx +17 -3
  41. package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +13 -0
  42. package/src/Authenticator/Defaults/SetupTOTP/SetupTOTP.tsx +17 -3
  43. package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +13 -0
  44. package/src/Authenticator/Defaults/SignIn/SignIn.tsx +7 -2
  45. package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +19 -0
  46. package/src/Authenticator/Defaults/SignUp/SignUp.tsx +13 -2
  47. package/src/Authenticator/Defaults/SignUp/__tests__/SignUp.spec.tsx +1 -0
  48. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +31 -0
  49. package/src/Authenticator/Defaults/VerifyUser/VerifyUser.tsx +7 -3
  50. package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +19 -0
  51. package/src/Authenticator/common/DefaultContent/DefaultContent.tsx +2 -0
  52. package/src/hooks/index.ts +1 -0
  53. package/src/hooks/useDeprecationWarning/__tests__/useDeprecationWarning.spec.ts +42 -0
  54. package/src/hooks/useDeprecationWarning/index.ts +1 -0
  55. package/src/hooks/useDeprecationWarning/useDeprecationWarning.ts +21 -0
  56. package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +9 -0
  57. package/src/primitives/Radio/styles.ts +2 -1
  58. package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +24 -0
  59. package/src/utils/platform.ts +2 -0
  60. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @aws-amplify/ui-react-native
2
2
 
3
+ ## 1.2.20
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4168](https://github.com/aws-amplify/amplify-ui/pull/4168) [`d930e2ed1`](https://github.com/aws-amplify/amplify-ui/commit/d930e2ed17f3e638e2b62699ba2dd164b32f8118) Thanks [@calebpollman](https://github.com/calebpollman)! - chore(RWA/RNA): deprecate passwordSettings prop
8
+
9
+ - Updated dependencies [[`b0e16e78c`](https://github.com/aws-amplify/amplify-ui/commit/b0e16e78c6a41945aa79f3e14fa3f9e6cb0e5e76), [`d930e2ed1`](https://github.com/aws-amplify/amplify-ui/commit/d930e2ed17f3e638e2b62699ba2dd164b32f8118)]:
10
+ - @aws-amplify/ui@5.6.6
11
+ - @aws-amplify/ui-react-core@2.1.25
12
+ - @aws-amplify/ui-react-core-notifications@1.0.2
13
+
14
+ ## 1.2.19
15
+
16
+ ### Patch Changes
17
+
18
+ - [#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
19
+
20
+ - [#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
21
+
22
+ - Updated dependencies [[`23180b470`](https://github.com/aws-amplify/amplify-ui/commit/23180b470c7b3b78a5970d00f8c2dc5ce8773eff), [`3cecd0765`](https://github.com/aws-amplify/amplify-ui/commit/3cecd0765b46c77c49af24fae7cfb9054ebe2cdb)]:
23
+ - @aws-amplify/ui-react-core@2.1.24
24
+ - @aws-amplify/ui@5.6.5
25
+ - @aws-amplify/ui-react-core-notifications@1.0.1
26
+
3
27
  ## 1.2.18
4
28
 
5
29
  ### 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;
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import { SafeAreaProvider } from 'react-native-safe-area-context';
3
3
  import { AuthenticatorProvider as Provider, resolveAuthenticatorComponents, useAuthenticator, useAuthenticatorRoute, useAuthenticatorInitMachine, } from '@aws-amplify/ui-react-core';
4
4
  import { configureComponent } from '@aws-amplify/ui';
5
+ import { useDeprecationWarning } from '../hooks';
5
6
  import { DefaultContainer, InnerContainer } from './common';
6
7
  import { getRouteTypedFields } from './hooks';
7
8
  import { VERSION } from '../version';
@@ -23,6 +24,10 @@ const routePropSelector = ({ route, }) => [
23
24
  route,
24
25
  ];
25
26
  function Authenticator({ children, components: overrides, Container = DefaultContainer, Footer, Header, ...options }) {
27
+ useDeprecationWarning({
28
+ message: 'The `passwordSettings` prop has been deprecated and will be removed in a future major version of Amplify UI.',
29
+ shouldWarn: !!options?.passwordSettings,
30
+ });
26
31
  React.useEffect(() => {
27
32
  configureComponent({
28
33
  packageName: '@aws-amplify/ui-react-native',
@@ -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}/>
@@ -1,2 +1,3 @@
1
+ export { useDeprecationWarning } from './useDeprecationWarning';
1
2
  export { DeviceOrientation, useDeviceOrientation, } from './useDeviceOrientation';
2
3
  export { usePressableContainerStyles } from './usePressableContainerStyles';
@@ -1,2 +1,3 @@
1
+ export { useDeprecationWarning } from './useDeprecationWarning';
1
2
  export { useDeviceOrientation, } from './useDeviceOrientation';
2
3
  export { usePressableContainerStyles } from './usePressableContainerStyles';
@@ -0,0 +1 @@
1
+ export { default as useDeprecationWarning } from './useDeprecationWarning';
@@ -0,0 +1 @@
1
+ export { default as useDeprecationWarning } from './useDeprecationWarning';
@@ -0,0 +1,6 @@
1
+ import { UseDeprecationWarning } from '@aws-amplify/ui-react-core';
2
+ /**
3
+ * Logs a deprecation warning `message` to the console.
4
+ */
5
+ declare const useDeprecationWarning: UseDeprecationWarning;
6
+ export default useDeprecationWarning;
@@ -0,0 +1,11 @@
1
+ import { useDeprecationWarning as useDeprecationWarningBase, } from '@aws-amplify/ui-react-core';
2
+ import { platform } from '../../utils';
3
+ /**
4
+ * Logs a deprecation warning `message` to the console.
5
+ */
6
+ const useDeprecationWarning = ({ message, shouldWarn: _shouldWarn, }) => {
7
+ // only log warnings in dev
8
+ const shouldWarn = _shouldWarn && platform.IS_DEV;
9
+ useDeprecationWarningBase({ message, shouldWarn });
10
+ };
11
+ export default useDeprecationWarning;
@@ -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: {
@@ -1,5 +1,6 @@
1
1
  declare const _default: {
2
2
  IS_ANDROID: boolean;
3
+ IS_DEV: boolean;
3
4
  IS_IOS: boolean;
4
5
  PLATFORM_TOUCH_TARGET: number | undefined;
5
6
  constants: import("react-native").PlatformConstants & {
@@ -41,6 +42,7 @@ declare const _default: {
41
42
  }): T_1 | undefined;
42
43
  } | {
43
44
  IS_ANDROID: boolean;
45
+ IS_DEV: boolean;
44
46
  IS_IOS: boolean;
45
47
  PLATFORM_TOUCH_TARGET: number | undefined;
46
48
  constants: import("react-native").PlatformConstants & {
@@ -85,6 +87,7 @@ declare const _default: {
85
87
  }): T_1 | undefined;
86
88
  } | {
87
89
  IS_ANDROID: boolean;
90
+ IS_DEV: boolean;
88
91
  IS_IOS: boolean;
89
92
  PLATFORM_TOUCH_TARGET: number | undefined;
90
93
  OS: "windows";
@@ -121,6 +124,7 @@ declare const _default: {
121
124
  }): T_1 | undefined;
122
125
  } | {
123
126
  IS_ANDROID: boolean;
127
+ IS_DEV: boolean;
124
128
  IS_IOS: boolean;
125
129
  PLATFORM_TOUCH_TARGET: number | undefined;
126
130
  OS: "macos";
@@ -157,6 +161,7 @@ declare const _default: {
157
161
  }): T_1 | undefined;
158
162
  } | {
159
163
  IS_ANDROID: boolean;
164
+ IS_DEV: boolean;
160
165
  IS_IOS: boolean;
161
166
  PLATFORM_TOUCH_TARGET: number | undefined;
162
167
  OS: "web";
@@ -1,4 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
+ const IS_DEV = __DEV__;
2
3
  const IS_ANDROID = Platform.OS === 'android';
3
4
  const IS_IOS = Platform.OS === 'ios';
4
5
  // https://material.io/design/layout/spacing-methods.html#touch-targets
@@ -12,6 +13,7 @@ const PLATFORM_TOUCH_TARGET = Platform.select({
12
13
  export default {
13
14
  ...Platform,
14
15
  IS_ANDROID,
16
+ IS_DEV,
15
17
  IS_IOS,
16
18
  PLATFORM_TOUCH_TARGET,
17
19
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.18";
1
+ export declare const VERSION = "1.2.20";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.18';
1
+ export const VERSION = '1.2.20';
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.20",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,6 +29,7 @@
29
29
  "@types/react-test-renderer": "^17.0.1",
30
30
  "babel-jest": "^28.0.3",
31
31
  "eslint": "^8.14.0",
32
+ "jest": "^27.0.4",
32
33
  "metro-react-native-babel-preset": "^0.70.2",
33
34
  "react": "^17.0.2",
34
35
  "react-native": "^0.68.1",
@@ -37,9 +38,9 @@
37
38
  "rimraf": "^3.0.2"
38
39
  },
39
40
  "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"
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"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "aws-amplify": ">= 5.0.1",
@@ -13,6 +13,7 @@ import {
13
13
 
14
14
  import { configureComponent } from '@aws-amplify/ui';
15
15
 
16
+ import { useDeprecationWarning } from '../hooks';
16
17
  import { DefaultContainer, InnerContainer } from './common';
17
18
  import { TypedField, getRouteTypedFields } from './hooks';
18
19
  import { AuthenticatorProps } from './types';
@@ -61,6 +62,12 @@ function Authenticator({
61
62
  Header,
62
63
  ...options
63
64
  }: AuthenticatorProps): JSX.Element | null {
65
+ useDeprecationWarning({
66
+ message:
67
+ 'The `passwordSettings` prop has been deprecated and will be removed in a future major version of Amplify UI.',
68
+ shouldWarn: !!options?.passwordSettings,
69
+ });
70
+
64
71
  React.useEffect(() => {
65
72
  configureComponent({
66
73
  packageName: '@aws-amplify/ui-react-native',