@aws-amplify/ui-react 2.15.6 → 2.16.0

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 (39) hide show
  1. package/dist/esm/components/Authenticator/Authenticator.js +1 -1
  2. package/dist/esm/components/Authenticator/ConfirmSignIn/ConfirmSignIn.js +1 -1
  3. package/dist/esm/components/Authenticator/ConfirmSignUp/ConfirmSignUp.js +1 -1
  4. package/dist/esm/components/Authenticator/ForceNewPassword/ForceNewPassword.js +1 -1
  5. package/dist/esm/components/Authenticator/ResetPassword/ConfirmResetPassword.js +1 -1
  6. package/dist/esm/components/Authenticator/ResetPassword/ResetPassword.js +1 -1
  7. package/dist/esm/components/Authenticator/RouteContainer/RouteContainer.js +1 -0
  8. package/dist/esm/components/Authenticator/Router/Router.js +1 -0
  9. package/dist/esm/components/Authenticator/SetupTOTP/SetupTOTP.js +1 -1
  10. package/dist/esm/components/Authenticator/SignIn/SignIn.js +1 -1
  11. package/dist/esm/components/Authenticator/SignUp/SignUp.js +1 -1
  12. package/dist/esm/components/Authenticator/VerifyUser/ConfirmVerifyUser.js +1 -1
  13. package/dist/esm/components/Authenticator/VerifyUser/VerifyUser.js +1 -1
  14. package/dist/esm/components/Authenticator/hooks/useAuthenticator/index.js +1 -1
  15. package/dist/esm/components/Authenticator/hooks/useCustomComponents/index.js +1 -1
  16. package/dist/esm/components/Authenticator/shared/SignInSignUpTabs.js +1 -1
  17. package/dist/esm/components/Authenticator/utils.js +1 -0
  18. package/dist/index.js +1 -1
  19. package/dist/styles.css +18 -1
  20. package/dist/types/components/Authenticator/Authenticator.d.ts +8 -10
  21. package/dist/types/components/Authenticator/ConfirmSignIn/ConfirmSignIn.d.ts +2 -1
  22. package/dist/types/components/Authenticator/ConfirmSignUp/ConfirmSignUp.d.ts +2 -1
  23. package/dist/types/components/Authenticator/ForceNewPassword/ForceNewPassword.d.ts +2 -1
  24. package/dist/types/components/Authenticator/ResetPassword/ConfirmResetPassword.d.ts +2 -1
  25. package/dist/types/components/Authenticator/ResetPassword/ResetPassword.d.ts +2 -1
  26. package/dist/types/components/Authenticator/RouteContainer/RouteContainer.d.ts +3 -0
  27. package/dist/types/components/Authenticator/RouteContainer/index.d.ts +2 -0
  28. package/dist/types/components/Authenticator/RouteContainer/types.d.ts +8 -0
  29. package/dist/types/components/Authenticator/Router/Router.d.ts +4 -0
  30. package/dist/types/components/Authenticator/Router/index.d.ts +3 -15
  31. package/dist/types/components/Authenticator/Router/types.d.ts +11 -0
  32. package/dist/types/components/Authenticator/SetupTOTP/SetupTOTP.d.ts +3 -1
  33. package/dist/types/components/Authenticator/VerifyUser/ConfirmVerifyUser.d.ts +2 -1
  34. package/dist/types/components/Authenticator/VerifyUser/VerifyUser.d.ts +2 -1
  35. package/dist/types/components/Authenticator/hooks/useAuthenticator/index.d.ts +5 -6
  36. package/dist/types/components/Authenticator/shared/SignInSignUpTabs.d.ts +3 -2
  37. package/dist/types/components/Authenticator/utils.d.ts +1 -0
  38. package/package.json +16 -8
  39. package/dist/esm/components/Authenticator/Router/index.js +0 -1
package/dist/styles.css CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Tue, 26 Apr 2022 22:04:22 GMT
7
+ * Generated on Tue, 03 May 2022 22:09:05 GMT
8
8
  */
9
9
 
10
10
  :root, [data-amplify-theme] {
@@ -1676,6 +1676,23 @@ h6.amplify-heading {
1676
1676
  }
1677
1677
  }
1678
1678
 
1679
+ .amplify-authenticator__column {
1680
+ display: flex;
1681
+ flex-direction: column;
1682
+ }
1683
+
1684
+ .amplify-authenticator__subtitle {
1685
+ margin-bottom: var(--amplify-space-medium);
1686
+ }
1687
+
1688
+ .amplify-authenticator__heading {
1689
+ font-size: var(--amplify-font-sizes-xl);
1690
+ }
1691
+
1692
+ .amplify-authenticator__federated-text {
1693
+ align-self: center;
1694
+ }
1695
+
1679
1696
  .amplify-card {
1680
1697
  background-color: var(--amplify-components-card-background-color);
1681
1698
  border-radius: var(--amplify-components-card-border-radius);
@@ -1,29 +1,27 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { AuthenticatorMachineOptions } from '@aws-amplify/ui';
3
- import { RouterProps } from './Router';
4
3
  import { ComponentsProviderProps } from './hooks/useCustomComponents';
5
- export interface ComponentsProp {
6
- }
7
- export declare type AuthenticatorProps = AuthenticatorMachineOptions & RouterProps & ComponentsProviderProps;
8
- export declare function Authenticator({ children, className, components: customComponents, initialState, loginMechanisms, services, signUpAttributes, socialProviders, variation, hideSignUp, formFields, }: AuthenticatorProps): JSX.Element;
4
+ import { RouterProps } from './Router';
5
+ export declare type AuthenticatorProps = Partial<AuthenticatorMachineOptions & ComponentsProviderProps & RouterProps>;
6
+ export declare function Authenticator({ children, className, components: customComponents, formFields, hideSignUp, initialState, loginMechanisms, signUpAttributes, services, socialProviders, variation, }: AuthenticatorProps): JSX.Element;
9
7
  export declare namespace Authenticator {
10
8
  var Provider: ({ children }: {
11
- children: any;
9
+ children: React.ReactNode;
12
10
  }) => JSX.Element;
13
11
  var ResetPassword: {
14
- (): JSX.Element;
12
+ ({ className, variation, }: import("./RouteContainer").RouteProps): JSX.Element;
15
13
  Header(): JSX.Element;
16
14
  Footer(): JSX.Element;
17
15
  };
18
16
  var SetupTOTP: {
19
- (): JSX.Element;
17
+ ({ className, variation, }: import("./RouteContainer").RouteProps): JSX.Element;
20
18
  Header(): JSX.Element;
21
19
  Footer(): JSX.Element;
22
20
  };
23
21
  var SignIn: typeof import("./SignIn").SignIn;
24
22
  var SignUp: typeof import("./SignUp").SignUp;
25
23
  var ForceNewPassword: {
26
- (): JSX.Element;
24
+ ({ className, variation, }: import("./RouteContainer").RouteProps): JSX.Element;
27
25
  FormFields(): JSX.Element;
28
26
  };
29
27
  }
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const ConfirmSignIn: {
3
- (): JSX.Element;
4
+ ({ className, variation, }: RouteProps): JSX.Element;
4
5
  Header: typeof Header;
5
6
  Footer(): JSX.Element;
6
7
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare function ConfirmSignUp(): JSX.Element;
2
+ import { RouteProps } from '../RouteContainer';
3
+ export declare function ConfirmSignUp({ className, variation }: RouteProps): JSX.Element;
3
4
  export declare namespace ConfirmSignUp {
4
5
  var Header: () => JSX.Element;
5
6
  var Footer: () => JSX.Element;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const ForceNewPassword: {
3
- (): JSX.Element;
4
+ ({ className, variation, }: RouteProps): JSX.Element;
4
5
  FormFields(): JSX.Element;
5
6
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const ConfirmResetPassword: {
3
- (): JSX.Element;
4
+ ({ className, variation, }: RouteProps): JSX.Element;
4
5
  Header(): JSX.Element;
5
6
  Footer(): JSX.Element;
6
7
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const ResetPassword: {
3
- (): JSX.Element;
4
+ ({ className, variation, }: RouteProps): JSX.Element;
4
5
  Header(): JSX.Element;
5
6
  Footer(): JSX.Element;
6
7
  };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { RouteContainerProps } from './types';
3
+ export declare function RouteContainer({ children, className, variation, }: RouteContainerProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { RouteContainer } from './RouteContainer';
2
+ export { RouteContainerProps, RouteProps } from './types';
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare type RouteProps = {
3
+ className: string;
4
+ variation: 'default' | 'modal';
5
+ };
6
+ export declare type RouteContainerProps = {
7
+ children: React.ReactNode;
8
+ } & RouteProps;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { RouterProps } from './types';
3
+ export declare function useRouterChildren(children: RouterProps['children']): (props?: Omit<RouterProps, 'children'>) => JSX.Element;
4
+ export declare function Router({ children, className, hideSignUp, variation, }: RouterProps): JSX.Element;
@@ -1,15 +1,3 @@
1
- import * as React from 'react';
2
- import { CognitoUserAmplify } from '@aws-amplify/ui';
3
- import { useAuthenticator } from '../hooks/useAuthenticator';
4
- declare type AuthenticatorChildren = React.ReactNode | (({ signOut, user, }: {
5
- signOut?: ReturnType<typeof useAuthenticator>['signOut'];
6
- user?: CognitoUserAmplify;
7
- }) => React.ReactNode);
8
- export declare type RouterProps = {
9
- className?: string;
10
- children?: AuthenticatorChildren;
11
- variation?: 'default' | 'modal';
12
- hideSignUp?: boolean;
13
- };
14
- export declare function Router({ children, className, variation, hideSignUp, }: RouterProps): JSX.Element;
15
- export {};
1
+ export { RouteContainer } from '../RouteContainer/RouteContainer';
2
+ export { Router } from './Router';
3
+ export { RouterProps } from './types';
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { CognitoUserAmplify } from '@aws-amplify/ui';
3
+ import { RouteProps } from '../RouteContainer';
4
+ import { UseAuthenticator } from '../hooks/useAuthenticator';
5
+ export declare type RouterProps = {
6
+ children: React.ReactNode | ((props?: {
7
+ signOut?: UseAuthenticator['signOut'];
8
+ user?: CognitoUserAmplify;
9
+ }) => React.ReactNode);
10
+ hideSignUp: boolean;
11
+ } & RouteProps;
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
3
+ export declare const getTotpCode: (issuer: string, username: string, secret: string) => string;
2
4
  export declare const SetupTOTP: {
3
- (): JSX.Element;
5
+ ({ className, variation, }: RouteProps): JSX.Element;
4
6
  Header(): JSX.Element;
5
7
  Footer(): JSX.Element;
6
8
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const ConfirmVerifyUser: {
3
- (): JSX.Element;
4
+ ({ className, variation, }: RouteProps): JSX.Element;
4
5
  Header(): JSX.Element;
5
6
  Footer(): JSX.Element;
6
7
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const VerifyUser: {
3
- (): JSX.Element;
4
+ ({ className, variation, }: RouteProps): JSX.Element;
4
5
  Header(): JSX.Element;
5
6
  Footer(): JSX.Element;
6
7
  };
@@ -11,7 +11,7 @@ export declare type AuthenticatorContextValue = {
11
11
  */
12
12
  export declare const AuthenticatorContext: React.Context<AuthenticatorContextValue>;
13
13
  export declare const Provider: ({ children }: {
14
- children: any;
14
+ children: React.ReactNode;
15
15
  }) => JSX.Element;
16
16
  /**
17
17
  * These are the "facades" that we provide, which contains contexts respective
@@ -36,16 +36,14 @@ export declare type InternalAuthenticatorContext = {
36
36
  export declare type Selector = (context: AuthenticatorContext) => Array<any>;
37
37
  export declare const useAuthenticator: (selector?: Selector) => {
38
38
  /** @deprecated For internal use only */
39
- _state: AuthMachineState;
39
+ _state: import("xstate").State<import("@aws-amplify/ui").AuthContext, import("@aws-amplify/ui").AuthEvent, any, any, any>;
40
40
  /** @deprecated For internal use only */
41
- _send: (event: import("xstate").SCXML.Event<import("@aws-amplify/ui").AuthEvent> | import("xstate").SingleOrArray<import("xstate").Event<import("@aws-amplify/ui").AuthEvent>>, payload?: import("xstate").EventData) => import("xstate").State<import("@aws-amplify/ui").AuthContext, import("@aws-amplify/ui").AuthEvent, any, {
42
- value: any;
43
- context: import("@aws-amplify/ui").AuthContext;
44
- }, import("xstate").TypegenDisabled>;
41
+ _send: (event: import("xstate").SingleOrArray<import("xstate").Event<import("@aws-amplify/ui").AuthEvent>> | import("xstate").SCXML.Event<import("@aws-amplify/ui").AuthEvent>, payload?: import("xstate").EventData) => import("xstate").State<import("@aws-amplify/ui").AuthContext, import("@aws-amplify/ui").AuthEvent, any, any, any>;
45
42
  error: string;
46
43
  hasValidationErrors: boolean;
47
44
  isPending: boolean;
48
45
  route: string;
46
+ authStatus: string;
49
47
  user: import("@aws-amplify/ui").CognitoUserAmplify;
50
48
  validationErrors: {
51
49
  [x: string]: string | string[];
@@ -62,3 +60,4 @@ export declare const useAuthenticator: (selector?: Selector) => {
62
60
  toSignUp: (data?: import("@aws-amplify/ui").AuthEventData) => void;
63
61
  skipVerification: (data?: import("@aws-amplify/ui").AuthEventData) => void;
64
62
  };
63
+ export declare type UseAuthenticator = ReturnType<typeof useAuthenticator>;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const SignInSignUpTabs: ({ hideSignUp, }: {
2
+ import { RouteProps } from '../RouteContainer';
3
+ export declare const SignInSignUpTabs: ({ className, hideSignUp, variation, }: {
3
4
  hideSignUp: boolean;
4
- }) => JSX.Element;
5
+ } & RouteProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const isSignInOrSignUpRoute: (route: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react",
3
- "version": "2.15.6",
3
+ "version": "2.16.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "exports": {
@@ -50,20 +50,20 @@
50
50
  "build:icons": "yarn run clean:icons && node scripts/generateIcons.js",
51
51
  "clean": "rimraf dist node_modules",
52
52
  "clean:icons": "rimraf ./src/primitives/Icon/icons",
53
- "lint": "tsc --noEmit && yarn eslint ./src --ext .js,.ts,.tsx",
53
+ "lint": "tsc --noEmit --project tsconfig.dev.json && yarn eslint ./src --ext .js,.ts,.tsx",
54
54
  "test": "yarn test:unit",
55
55
  "test:watch": "yarn test:unit:watch",
56
56
  "test:unit": "jest",
57
57
  "test:unit:watch": "jest --watch"
58
58
  },
59
59
  "dependencies": {
60
- "@aws-amplify/ui": "3.6.6",
60
+ "@aws-amplify/ui": "3.7.0",
61
61
  "@aws-amplify/ui-react-v1": "npm:@aws-amplify/ui-react@1.2.9",
62
62
  "@radix-ui/react-accordion": "0.1.6",
63
63
  "@radix-ui/react-dropdown-menu": "0.1.6",
64
64
  "@radix-ui/react-slider": "0.1.4",
65
65
  "@radix-ui/react-tabs": "0.1.5",
66
- "@xstate/react": "1.6.3",
66
+ "@xstate/react": "3.0.0",
67
67
  "classnames": "2.3.1",
68
68
  "deepmerge": "4.2.2",
69
69
  "lodash": "4.17.21",
@@ -94,11 +94,19 @@
94
94
  "@types/jest": "^26.0.23",
95
95
  "@types/qrcode": "^1.4.2",
96
96
  "@types/testing-library__jest-dom": "^5.14.1",
97
- "@typescript-eslint/eslint-plugin": "^5.6.0",
98
- "@typescript-eslint/parser": "^5.6.0",
97
+ "@typescript-eslint/eslint-plugin": "^5.20.0",
98
+ "@typescript-eslint/parser": "^5.20.0",
99
99
  "degit": "^2.8.4",
100
- "eslint": "^8.4.1",
101
- "eslint-plugin-react-hooks": "^4.3.0",
100
+ "eslint": "^8.13.0",
101
+ "eslint-config-airbnb": "^19.0.4",
102
+ "eslint-config-airbnb-typescript": "^17.0.0",
103
+ "eslint-config-prettier": "^8.5.0",
104
+ "eslint-plugin-import": "^2.26.0",
105
+ "eslint-plugin-jest": "^26.1.4",
106
+ "eslint-plugin-jsx-a11y": "^6.5.1",
107
+ "eslint-plugin-prettier": "^4.0.0",
108
+ "eslint-plugin-react": "^7.29.4",
109
+ "eslint-plugin-react-hooks": "^4.4.0",
102
110
  "jest": "^27.0.4",
103
111
  "jest-matchmedia-mock": "^1.1.0",
104
112
  "react-router-dom": "^6.2.1",
@@ -1 +0,0 @@
1
- import{jsx as r,Fragment as e,jsxs as i}from"react/jsx-runtime";import{useAuthenticator as s}from"../hooks/useAuthenticator/index.js";import{View as t}from"../../../primitives/View/View.js";import{ConfirmSignUp as n}from"../ConfirmSignUp/ConfirmSignUp.js";import{ForceNewPassword as o}from"../ForceNewPassword/ForceNewPassword.js";import{useCustomComponents as a}from"../hooks/useCustomComponents/index.js";import{SetupTOTP as m}from"../SetupTOTP/SetupTOTP.js";import"@aws-amplify/ui";import"../../../primitives/TextField/TextField.js";import"../../../primitives/Button/Button.js";import"../../../primitives/Flex/Flex.js";import"../../../primitives/Alert/Alert.js";import{SignInSignUpTabs as u}from"../shared/SignInSignUpTabs.js";import{ConfirmVerifyUser as p}from"../VerifyUser/ConfirmVerifyUser.js";import{VerifyUser as c}from"../VerifyUser/VerifyUser.js";import{ConfirmSignIn as f}from"../ConfirmSignIn/ConfirmSignIn.js";import{ConfirmResetPassword as d}from"../ResetPassword/ConfirmResetPassword.js";import{ResetPassword as l}from"../ResetPassword/ResetPassword.js";const g=r=>"signIn"===r||"signUp";function j({children:j,className:h,variation:w="default",hideSignUp:U}){const{route:y,signOut:P,user:S}=s((r=>[r.route,r.signOut,r.user])),{components:{Header:O,Footer:v}}=a();return["authenticated","signOut"].includes(y)?j?r(e,{children:"function"==typeof j?j({signOut:P,user:S}):j}):null:r(e,{children:r(t,Object.assign({className:h,"data-amplify-authenticator":"","data-variation":w},{children:i(t,Object.assign({"data-amplify-container":""},{children:[r(O,{}),r(t,Object.assign({"data-amplify-router":"","data-amplify-router-content":g(y)?void 0:""},{children:(()=>{switch(y){case"idle":case"setup":return null;case"confirmSignUp":return r(n,{});case"confirmSignIn":return r(f,{});case"setupTOTP":return r(m,{});case"signIn":case"signUp":return r(u,{hideSignUp:U});case"forceNewPassword":return r(o,{});case"resetPassword":return r(l,{});case"confirmResetPassword":return r(d,{});case"verifyUser":return r(c,{});case"confirmVerifyUser":return r(p,{});default:return console.warn("Unhandled Authenicator route – please open an issue: ",y),null}})()})),r(v,{})]}))}))})}export{j as Router};