@aws-amplify/ui-react 2.15.7 → 2.16.1

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 (43) 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/FormField.js +1 -1
  17. package/dist/esm/components/Authenticator/shared/FormFields.js +1 -1
  18. package/dist/esm/components/Authenticator/shared/SignInSignUpTabs.js +1 -1
  19. package/dist/esm/components/Authenticator/utils.js +1 -0
  20. package/dist/index.js +1 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/types/components/Authenticator/Authenticator.d.ts +8 -10
  23. package/dist/types/components/Authenticator/ConfirmSignIn/ConfirmSignIn.d.ts +2 -1
  24. package/dist/types/components/Authenticator/ConfirmSignUp/ConfirmSignUp.d.ts +2 -1
  25. package/dist/types/components/Authenticator/ForceNewPassword/ForceNewPassword.d.ts +2 -1
  26. package/dist/types/components/Authenticator/ResetPassword/ConfirmResetPassword.d.ts +2 -1
  27. package/dist/types/components/Authenticator/ResetPassword/ResetPassword.d.ts +2 -1
  28. package/dist/types/components/Authenticator/RouteContainer/RouteContainer.d.ts +3 -0
  29. package/dist/types/components/Authenticator/RouteContainer/index.d.ts +2 -0
  30. package/dist/types/components/Authenticator/RouteContainer/types.d.ts +8 -0
  31. package/dist/types/components/Authenticator/Router/Router.d.ts +4 -0
  32. package/dist/types/components/Authenticator/Router/index.d.ts +3 -15
  33. package/dist/types/components/Authenticator/Router/types.d.ts +11 -0
  34. package/dist/types/components/Authenticator/SetupTOTP/SetupTOTP.d.ts +2 -1
  35. package/dist/types/components/Authenticator/VerifyUser/ConfirmVerifyUser.d.ts +2 -1
  36. package/dist/types/components/Authenticator/VerifyUser/VerifyUser.d.ts +2 -1
  37. package/dist/types/components/Authenticator/hooks/useAuthenticator/index.d.ts +5 -6
  38. package/dist/types/components/Authenticator/shared/FormField.d.ts +3 -3
  39. package/dist/types/components/Authenticator/shared/FormFields.d.ts +1 -5
  40. package/dist/types/components/Authenticator/shared/SignInSignUpTabs.d.ts +3 -2
  41. package/dist/types/components/Authenticator/utils.d.ts +1 -0
  42. package/package.json +25 -9
  43. 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 Thu, 28 Apr 2022 21:06:32 GMT
7
+ * Generated on Thu, 05 May 2022 22:04:53 GMT
8
8
  */
9
9
 
10
10
  :root, [data-amplify-theme] {
@@ -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,7 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from '../RouteContainer';
2
3
  export declare const getTotpCode: (issuer: string, username: string, secret: string) => string;
3
4
  export declare const SetupTOTP: {
4
- (): JSX.Element;
5
+ ({ className, variation, }: RouteProps): JSX.Element;
5
6
  Header(): JSX.Element;
6
7
  Footer(): JSX.Element;
7
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,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { FormFieldOptions } from '@aws-amplify/ui';
3
- export interface FormFieldProps {
3
+ export interface FormFieldProps extends Omit<FormFieldOptions, 'label'> {
4
+ label: string;
4
5
  name: string;
5
- formFieldOptions: FormFieldOptions;
6
6
  }
7
- export declare function FormField({ name, formFieldOptions }: FormFieldProps): JSX.Element;
7
+ export declare function FormField({ autocomplete: autoComplete, dialCode, name, type, ...props }: FormFieldProps): JSX.Element;
@@ -1,6 +1,2 @@
1
1
  /// <reference types="react" />
2
- import { FormFieldComponents } from '@aws-amplify/ui';
3
- export interface BaseFormFieldsProps {
4
- route: FormFieldComponents;
5
- }
6
- export declare function FormFields({ route }: BaseFormFieldsProps): JSX.Element;
2
+ export declare function FormFields(): JSX.Element;
@@ -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.7",
3
+ "version": "2.16.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "exports": {
@@ -50,20 +50,21 @@
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
- "test:unit:watch": "jest --watch"
57
+ "test:unit:watch": "jest --watch",
58
+ "size": "yarn run size-limit"
58
59
  },
59
60
  "dependencies": {
60
- "@aws-amplify/ui": "3.6.7",
61
+ "@aws-amplify/ui": "3.8.0",
61
62
  "@aws-amplify/ui-react-v1": "npm:@aws-amplify/ui-react@1.2.9",
62
63
  "@radix-ui/react-accordion": "0.1.6",
63
64
  "@radix-ui/react-dropdown-menu": "0.1.6",
64
65
  "@radix-ui/react-slider": "0.1.4",
65
66
  "@radix-ui/react-tabs": "0.1.5",
66
- "@xstate/react": "1.6.3",
67
+ "@xstate/react": "3.0.0",
67
68
  "classnames": "2.3.1",
68
69
  "deepmerge": "4.2.2",
69
70
  "lodash": "4.17.21",
@@ -86,6 +87,7 @@
86
87
  },
87
88
  "devDependencies": {
88
89
  "@rollup/plugin-typescript": "^8.3.1",
90
+ "@size-limit/preset-big-lib": "^7.0.8",
89
91
  "@svgr/core": "^5.5.0",
90
92
  "@testing-library/jest-dom": "^5.14.1",
91
93
  "@testing-library/react": "^12.0.0",
@@ -94,11 +96,17 @@
94
96
  "@types/jest": "^26.0.23",
95
97
  "@types/qrcode": "^1.4.2",
96
98
  "@types/testing-library__jest-dom": "^5.14.1",
97
- "@typescript-eslint/eslint-plugin": "^5.6.0",
98
- "@typescript-eslint/parser": "^5.6.0",
99
+ "@typescript-eslint/eslint-plugin": "^5.20.0",
100
+ "@typescript-eslint/parser": "^5.20.0",
99
101
  "degit": "^2.8.4",
100
- "eslint": "^8.4.1",
101
- "eslint-plugin-react-hooks": "^4.3.0",
102
+ "eslint": "^8.13.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",
@@ -106,11 +114,19 @@
106
114
  "rollup": "^2.70.0",
107
115
  "rollup-plugin-styles": "^4.0.0",
108
116
  "rollup-plugin-terser": "^7.0.2",
117
+ "size-limit": "^7.0.8",
109
118
  "ts-jest": "^27.0.3",
110
119
  "ts-morph": "^12.0.0",
111
120
  "ts-node": "^10.2.1"
112
121
  },
113
122
  "sideEffects": [
114
123
  "dist/**/*.css"
124
+ ],
125
+ "size-limit": [
126
+ {
127
+ "path": "dist/esm/index.js",
128
+ "import": "{ Authenticator }",
129
+ "limit": "100 kB"
130
+ }
115
131
  ]
116
132
  }
@@ -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};