@aws-amplify/ui-react-core 3.4.2 → 3.4.3
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.
- package/README.md +39 -0
- package/dist/types/Authenticator/context/AuthenticatorContext.d.ts +1 -1
- package/dist/types/Authenticator/context/AuthenticatorProvider.d.ts +2 -1
- package/dist/types/Authenticator/hooks/constants.d.ts +1 -1
- package/dist/types/Authenticator/hooks/types.d.ts +3 -3
- package/dist/types/Authenticator/hooks/useAuthenticator/__mock__/useAuthenticator.d.ts +2 -2
- package/dist/types/Authenticator/hooks/useAuthenticator/index.d.ts +1 -1
- package/dist/types/Authenticator/hooks/useAuthenticator/types.d.ts +1 -1
- package/dist/types/Authenticator/hooks/useAuthenticator/useAuthenticator.d.ts +1 -1
- package/dist/types/Authenticator/hooks/useAuthenticator/utils.d.ts +3 -3
- package/dist/types/Authenticator/hooks/useAuthenticatorInitMachine/useAuthenticatorInitMachine.d.ts +2 -2
- package/dist/types/Authenticator/hooks/useAuthenticatorRoute/constants.d.ts +2 -2
- package/dist/types/Authenticator/hooks/useAuthenticatorRoute/types.d.ts +1 -1
- package/dist/types/Authenticator/hooks/useAuthenticatorRoute/useAuthenticatorRoute.d.ts +1 -1
- package/dist/types/Authenticator/hooks/useAuthenticatorRoute/utils.d.ts +4 -4
- package/dist/types/Authenticator/hooks/utils.d.ts +2 -2
- package/dist/types/Authenticator/index.d.ts +4 -2
- package/dist/types/components/FormCore/FormProvider.d.ts +1 -1
- package/dist/types/components/FormCore/index.d.ts +1 -1
- package/dist/types/components/FormCore/types.d.ts +2 -2
- package/dist/types/components/FormCore/useControlledField.d.ts +1 -1
- package/dist/types/components/FormCore/useField.d.ts +1 -1
- package/dist/types/components/FormCore/useForm.d.ts +1 -1
- package/dist/types/components/FormCore/withFormProvider.d.ts +2 -2
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/elements/ElementsContext.d.ts +1 -1
- package/dist/types/elements/defineBaseElement.d.ts +1 -1
- package/dist/types/elements/types.d.ts +1 -1
- package/dist/types/elements/utils.d.ts +1 -1
- package/dist/types/elements/withBaseElementProps.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +6 -3
- package/dist/types/hooks/useGetUrl.d.ts +1 -1
- package/dist/types/hooks/useSetUserAgent.d.ts +1 -1
- package/dist/types/index.d.ts +7 -4
- package/dist/types/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/Authenticator/context/AuthenticatorContext.tsx +1 -1
- package/src/Authenticator/context/AuthenticatorProvider.tsx +3 -3
- package/src/Authenticator/hooks/constants.ts +1 -1
- package/src/Authenticator/hooks/types.ts +3 -3
- package/src/Authenticator/hooks/useAuthenticator/__mock__/useAuthenticator.ts +2 -2
- package/src/Authenticator/hooks/useAuthenticator/index.ts +1 -1
- package/src/Authenticator/hooks/useAuthenticator/types.ts +1 -1
- package/src/Authenticator/hooks/useAuthenticator/useAuthenticator.ts +3 -2
- package/src/Authenticator/hooks/useAuthenticator/utils.ts +12 -7
- package/src/Authenticator/hooks/useAuthenticatorInitMachine/useAuthenticatorInitMachine.tsx +3 -5
- package/src/Authenticator/hooks/useAuthenticatorRoute/constants.ts +2 -2
- package/src/Authenticator/hooks/useAuthenticatorRoute/types.ts +1 -1
- package/src/Authenticator/hooks/useAuthenticatorRoute/useAuthenticatorRoute.ts +1 -1
- package/src/Authenticator/hooks/useAuthenticatorRoute/utils.ts +4 -4
- package/src/Authenticator/hooks/utils.ts +6 -2
- package/src/Authenticator/index.ts +3 -4
- package/src/components/FormCore/FormProvider.tsx +1 -1
- package/src/components/FormCore/index.ts +1 -1
- package/src/components/FormCore/types.ts +5 -5
- package/src/components/FormCore/useControlledField.ts +1 -1
- package/src/components/FormCore/useField.ts +7 -2
- package/src/components/FormCore/useForm.ts +2 -2
- package/src/components/FormCore/withFormProvider.tsx +2 -2
- package/src/components/index.ts +2 -5
- package/src/elements/ElementsContext.tsx +1 -1
- package/src/elements/defineBaseElement.tsx +1 -1
- package/src/elements/types.ts +1 -1
- package/src/elements/utils.ts +1 -1
- package/src/elements/withBaseElementProps.tsx +1 -1
- package/src/hooks/index.ts +6 -10
- package/src/hooks/useGetUrl.ts +2 -2
- package/src/hooks/useSetUserAgent.ts +2 -1
- package/src/index.ts +19 -13
- package/src/types/index.ts +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
1
|
# Amplify UI React Core
|
|
2
2
|
|
|
3
3
|
`@aws-amplify/ui-react-core` is a React platform agnostic utility library for Amplify UI internal usage in `@aws-amplify/ui-react*` and `@aws-amplify/ui-react-native*` namespaced packages.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
### Authenticator
|
|
8
|
+
|
|
9
|
+
- `AuthenticatorProvider` - Provider component for Authenticator context
|
|
10
|
+
- `useAuthenticator` - Hook for accessing Authenticator functionality
|
|
11
|
+
- `useAuthenticatorRoute` - Hook for accessing Authenticator route information
|
|
12
|
+
- `useAuthenticatorInitMachine` - Hook for initializing Authenticator state machine
|
|
13
|
+
- `isAuthenticatorComponentRouteKey` - Utility function for checking route keys
|
|
14
|
+
- `resolveAuthenticatorComponents` - Utility function for resolving Authenticator components
|
|
15
|
+
|
|
16
|
+
### Form Components and Hooks
|
|
17
|
+
|
|
18
|
+
- `FormProvider` - Provider component for form context
|
|
19
|
+
- `useField` - Hook for accessing form field functionality
|
|
20
|
+
- `useForm` - Hook for accessing form functionality
|
|
21
|
+
- `withFormProvider` - Higher-order component for adding form provider capabilities
|
|
22
|
+
- `RenderNothing` - Utility component for rendering nothing
|
|
23
|
+
|
|
24
|
+
### Utility Hooks
|
|
25
|
+
|
|
26
|
+
- `useAsyncReducer` - Hook for async state management
|
|
27
|
+
- `useControlledReducer` - Hook for controlled state management
|
|
28
|
+
- `useDeprecationWarning` - Hook for displaying deprecation warnings
|
|
29
|
+
- `useDropZone` - Hook for drag and drop functionality
|
|
30
|
+
- `useGetUrl` - Hook for getting URLs
|
|
31
|
+
- `useHasValueUpdated` - Hook for checking if a value has updated
|
|
32
|
+
- `usePreviousValue` - Hook for accessing previous value
|
|
33
|
+
- `useSetUserAgent` - Hook for setting user agent
|
|
34
|
+
- `useTimeout` - Hook for timeout functionality
|
|
35
|
+
|
|
36
|
+
### Utility Functions
|
|
37
|
+
|
|
38
|
+
- `createContextUtilities` - Utility function for creating context utilities
|
|
39
|
+
|
|
40
|
+
### Type Definitions
|
|
41
|
+
|
|
42
|
+
- Various type definitions for Authenticator, Form, and utility components
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AuthenticatorRouteComponentKey, AuthenticatorRouteComponentName } from './types';
|
|
1
|
+
import type { AuthenticatorRouteComponentKey, AuthenticatorRouteComponentName } from './types';
|
|
2
2
|
export declare const COMPONENT_ROUTE_KEYS: AuthenticatorRouteComponentKey[];
|
|
3
3
|
export declare const COMPONENT_ROUTE_NAMES: AuthenticatorRouteComponentName[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ChallengeName, AuthenticatorServiceFacade, LegacyFormFieldOptions } from '@aws-amplify/ui';
|
|
3
|
-
import { UseAuthenticator } from './useAuthenticator';
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ChallengeName, AuthenticatorServiceFacade, LegacyFormFieldOptions } from '@aws-amplify/ui';
|
|
3
|
+
import type { UseAuthenticator } from './useAuthenticator';
|
|
4
4
|
export type AuthenticatorRouteComponentKey = 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'forceNewPassword' | 'forgotPassword' | 'selectMfaType' | 'setupEmail' | 'setupTotp' | 'signIn' | 'signUp' | 'verifyUser';
|
|
5
5
|
export type AuthenticatorLegacyField = LegacyFormFieldOptions;
|
|
6
6
|
export type AuthenticatorLegacyFields = AuthenticatorLegacyField[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticatorMachineContext } from '../../types';
|
|
2
|
-
import { UseAuthenticator } from '../types';
|
|
1
|
+
import type { AuthenticatorMachineContext } from '../../types';
|
|
2
|
+
import type { UseAuthenticator } from '../types';
|
|
3
3
|
export declare const mockMachineContext: AuthenticatorMachineContext;
|
|
4
4
|
export declare const mockUseAuthenticatorOutput: UseAuthenticator;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as useAuthenticator } from './useAuthenticator';
|
|
2
|
-
export { UseAuthenticator, UseAuthenticatorSelector } from './types';
|
|
2
|
+
export type { UseAuthenticator, UseAuthenticatorSelector } from './types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticatorServiceFacade, LegacyFormFieldOptions } from '@aws-amplify/ui';
|
|
1
|
+
import type { AuthenticatorServiceFacade, LegacyFormFieldOptions } from '@aws-amplify/ui';
|
|
2
2
|
/**
|
|
3
3
|
* These are the "facades" that we provide, which contains contexts respective
|
|
4
4
|
* to current authenticator state.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthenticatorRoute, AuthMachineState } from '@aws-amplify/ui';
|
|
2
|
-
import { AuthenticatorLegacyFields } from '../types';
|
|
3
|
-
import { Comparator, UseAuthenticatorSelector } from './types';
|
|
1
|
+
import type { AuthenticatorRoute, AuthMachineState } from '@aws-amplify/ui';
|
|
2
|
+
import type { AuthenticatorLegacyFields } from '../types';
|
|
3
|
+
import type { Comparator, UseAuthenticatorSelector } from './types';
|
|
4
4
|
export declare const defaultComparator: () => false;
|
|
5
5
|
/**
|
|
6
6
|
* Does an ordering and shallow comparison of each array value,
|
package/dist/types/Authenticator/hooks/useAuthenticatorInitMachine/useAuthenticatorInitMachine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticatorMachineOptions } from '@aws-amplify/ui';
|
|
2
|
-
import { UseAuthenticatorSelector } from '../useAuthenticator';
|
|
1
|
+
import type { AuthenticatorMachineOptions } from '@aws-amplify/ui';
|
|
2
|
+
import type { UseAuthenticatorSelector } from '../useAuthenticator';
|
|
3
3
|
export declare const routeSelector: UseAuthenticatorSelector;
|
|
4
4
|
export default function useAuthenticatorInitMachine(data: AuthenticatorMachineOptions): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticatorMachineContextKey, AuthenticatorRouteComponentKey } from '../types';
|
|
2
|
-
import { FormEventHandlerMachineKey, FormEventHandlerPropKey } from './types';
|
|
1
|
+
import type { AuthenticatorMachineContextKey, AuthenticatorRouteComponentKey } from '../types';
|
|
2
|
+
import type { FormEventHandlerMachineKey, FormEventHandlerPropKey } from './types';
|
|
3
3
|
export declare const EVENT_HANDLER_KEY_MAP: Record<FormEventHandlerMachineKey, FormEventHandlerPropKey>;
|
|
4
4
|
export declare const MACHINE_PROP_KEYS: Record<AuthenticatorRouteComponentKey, AuthenticatorMachineContextKey[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticatorMachineContext, AuthenticatorMachineContextKey, AuthenticatorRouteComponentName, CommonRouteProps, ConfirmResetPasswordBaseProps, ConfirmSignInBaseProps, ConfirmSignUpBaseProps, Defaults, DefaultProps, ForceResetPasswordBaseProps, ResetPasswordBaseProps, SelectMfaTypeBaseProps, SetupEmailBaseProps, SetupTotpBaseProps, SignInBaseProps, SignUpBaseProps, VerifyUserProps, ConfirmVerifyUserProps } from '../types';
|
|
1
|
+
import type { AuthenticatorMachineContext, AuthenticatorMachineContextKey, AuthenticatorRouteComponentName, CommonRouteProps, ConfirmResetPasswordBaseProps, ConfirmSignInBaseProps, ConfirmSignUpBaseProps, Defaults, DefaultProps, ForceResetPasswordBaseProps, ResetPasswordBaseProps, SelectMfaTypeBaseProps, SetupEmailBaseProps, SetupTotpBaseProps, SignInBaseProps, SignUpBaseProps, VerifyUserProps, ConfirmVerifyUserProps } from '../types';
|
|
2
2
|
export type UseAuthenticatorRouteParams<FieldType> = {
|
|
3
3
|
components: Defaults<FieldType>;
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseAuthenticatorRoute, UseAuthenticatorRouteParams } from './types';
|
|
1
|
+
import type { UseAuthenticatorRoute, UseAuthenticatorRouteParams } from './types';
|
|
2
2
|
export default function useAuthenticatorRoute<FieldType>(params: UseAuthenticatorRouteParams<FieldType>): UseAuthenticatorRoute<'ConfirmResetPassword'>;
|
|
3
3
|
export default function useAuthenticatorRoute<FieldType>(params: UseAuthenticatorRouteParams<FieldType>): UseAuthenticatorRoute<'ConfirmSignIn'>;
|
|
4
4
|
export default function useAuthenticatorRoute<FieldType>(params: UseAuthenticatorRouteParams<FieldType>): UseAuthenticatorRoute<'ConfirmSignUp'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
2
|
-
import { Defaults } from '../types';
|
|
3
|
-
import { UseAuthenticator, UseAuthenticatorSelector } from '../useAuthenticator';
|
|
4
|
-
import { UseAuthenticatorRoute, UseAuthenticatorRouteDefault } from './types';
|
|
1
|
+
import type { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
2
|
+
import type { Defaults } from '../types';
|
|
3
|
+
import type { UseAuthenticator, UseAuthenticatorSelector } from '../useAuthenticator';
|
|
4
|
+
import type { UseAuthenticatorRoute, UseAuthenticatorRouteDefault } from './types';
|
|
5
5
|
export declare const routeSelector: UseAuthenticatorSelector;
|
|
6
6
|
export declare const getRouteMachineSelector: (route: AuthenticatorRoute) => UseAuthenticatorSelector;
|
|
7
7
|
export declare function resolveConfirmResetPasswordRoute<FieldType = {}>(Component: Defaults<FieldType>['ConfirmResetPassword'], props: UseAuthenticator): UseAuthenticatorRoute<'ConfirmResetPassword', FieldType>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
2
|
-
import { AuthenticatorRouteComponentKey, Defaults, Overrides } from './types';
|
|
1
|
+
import type { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
2
|
+
import type { AuthenticatorRouteComponentKey, Defaults, Overrides } from './types';
|
|
3
3
|
export declare const isComponentRouteKey: (route: AuthenticatorRoute) => route is AuthenticatorRouteComponentKey;
|
|
4
4
|
export declare function resolveAuthenticatorComponents<FieldType>(defaults: Defaults<FieldType>, overrides?: Overrides<FieldType>): Defaults<FieldType>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { AuthenticatorProvider, AuthenticatorContext } from './context';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export type { UseAuthenticator, UseAuthenticatorRoute } from './hooks';
|
|
3
|
+
export { resolveAuthenticatorComponents, useAuthenticator, useAuthenticatorRoute, useAuthenticatorInitMachine, } from './hooks';
|
|
4
|
+
export type { Overrides as AuthenticatorComponentOverrides, Defaults as AuthenticatorComponentDefaults, DefaultProps as AuthenticatorComponentDefaultProps, FooterComponent as AuthenticatorFooterComponent, FormFieldsComponent as AuthenticatorFormFieldsComponent, HeaderComponent as AuthenticatorHeaderComponent, AuthenticatorRouteComponentKey, AuthenticatorRouteComponentName, AuthenticatorLegacyField, AuthenticatorMachineContext, FormFieldsComponent, } from './hooks';
|
|
5
|
+
export { isComponentRouteKey as isAuthenticatorComponentRouteKey } from './hooks';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FormValues, FormHandle, FormProviderProps } from './types';
|
|
2
|
+
import type { FormValues, FormHandle, FormProviderProps } from './types';
|
|
3
3
|
declare const FormProvider: React.ForwardRefExoticComponent<FormProviderProps<FormValues> & React.RefAttributes<FormHandle>>;
|
|
4
4
|
export default FormProvider;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FormProviderProps, FormValues, FormHandle, SubmitHandler, UseForm, Validate, Validator, } from './types';
|
|
1
|
+
export type { FormProviderProps, FormValues, FormHandle, SubmitHandler, UseForm, Validate, Validator, } from './types';
|
|
2
2
|
export { default as useField } from './useField';
|
|
3
3
|
export { default as useForm } from './useForm';
|
|
4
4
|
export { default as FormProvider } from './FormProvider';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FocusHandler, UseControlledField, UseControlledFieldParams } from './types';
|
|
1
|
+
import type { FocusHandler, UseControlledField, UseControlledFieldParams } from './types';
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "`useControlledField` must be used within a `FormProvider`";
|
|
3
3
|
/**
|
|
4
4
|
* `Field` integration hook for usage with React Native `Field` components
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeHandler, FocusHandler, UseField, UseFieldParams } from './types';
|
|
1
|
+
import type { ChangeHandler, FocusHandler, UseField, UseFieldParams } from './types';
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "`useField` must be used within a `FormProvider`";
|
|
3
3
|
/**
|
|
4
4
|
* `Field` integration hook for usage with React `Field` components.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormValues, SubmitHandler, UseForm, UseFormParams } from './types';
|
|
1
|
+
import type { FormValues, SubmitHandler, UseForm, UseFormParams } from './types';
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "`useForm` must be called inside a `FormProvider`";
|
|
3
3
|
/**
|
|
4
4
|
* Utility hook corresponding to `FormProvider`, must be used within a `FormProvider`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnyComponent } from '../../types';
|
|
3
|
-
import { FormHandle, FormProviderProps } from './types';
|
|
2
|
+
import type { AnyComponent } from '../../types';
|
|
3
|
+
import type { FormHandle, FormProviderProps } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* @param Child `Form` base component wrapped inside `FormProvider`
|
|
6
6
|
* @returns Composed `Form` component exposing `FormContext` values to descendents
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { FormProviderProps, FormValues, FormHandle, SubmitHandler, UseForm, Validate, Validator, } from './FormCore';
|
|
2
|
+
export { FormProvider, useField, useForm, withFormProvider } from './FormCore';
|
|
2
3
|
export { RenderNothing } from './RenderNothing';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseElement, BaseElementProps, BaseElementWithRef, BaseElementWithRefProps, ElementDisplayName, ElementRefType, ReactElementProps, ReactElementType } from './types';
|
|
1
|
+
import type { BaseElement, BaseElementProps, BaseElementWithRef, BaseElementWithRefProps, ElementDisplayName, ElementRefType, ReactElementProps, ReactElementType } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal @unstable
|
|
4
4
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
export declare function isComponent<T>(component?: React.ComponentType<T> | React.ForwardRefExoticComponent<T>): component is React.ComponentType<T>;
|
|
3
3
|
export declare function isForwardRefExoticComponent<T>(component: React.ComponentType<T> | React.ForwardRefExoticComponent<T>): component is React.ForwardRefExoticComponent<T>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { default as useControlledReducer } from './useControlledReducer';
|
|
2
|
-
export {
|
|
3
|
-
export { default as
|
|
4
|
-
export {
|
|
2
|
+
export type { UseDropZoneParams } from './useDropZone';
|
|
3
|
+
export { default as useDropZone } from './useDropZone';
|
|
4
|
+
export type { AsyncReducer, AsyncReducerState } from './useAsyncReducer';
|
|
5
|
+
export { default as useAsyncReducer } from './useAsyncReducer';
|
|
6
|
+
export type { UseDeprecationWarning } from './useDeprecationWarning';
|
|
7
|
+
export { default as useDeprecationWarning } from './useDeprecationWarning';
|
|
5
8
|
export { default as useGetUrl } from './useGetUrl';
|
|
6
9
|
export { default as useHasValueUpdated } from './useHasValueUpdated';
|
|
7
10
|
export { default as usePreviousValue } from './usePreviousValue';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SetUserAgentOptions } from '@aws-amplify/ui';
|
|
1
|
+
import type { SetUserAgentOptions } from '@aws-amplify/ui';
|
|
2
2
|
export default function useSetUserAgent({ componentName, packageName, version, }: SetUserAgentOptions): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export { AuthenticatorComponentDefaults, AuthenticatorComponentDefaultProps, AuthenticatorComponentOverrides, AuthenticatorFooterComponent, AuthenticatorFormFieldsComponent, AuthenticatorHeaderComponent, AuthenticatorLegacyField, AuthenticatorMachineContext,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export type { AuthenticatorComponentDefaults, AuthenticatorComponentDefaultProps, AuthenticatorComponentOverrides, AuthenticatorFooterComponent, AuthenticatorFormFieldsComponent, AuthenticatorHeaderComponent, AuthenticatorLegacyField, AuthenticatorMachineContext, AuthenticatorRouteComponentKey, AuthenticatorRouteComponentName, UseAuthenticator, UseAuthenticatorRoute, } from './Authenticator';
|
|
2
|
+
export { AuthenticatorProvider, isAuthenticatorComponentRouteKey, resolveAuthenticatorComponents, useAuthenticator, useAuthenticatorRoute, useAuthenticatorInitMachine, } from './Authenticator';
|
|
3
|
+
export type { FormProviderProps, FormValues, FormHandle, UseForm, Validate, Validator, } from './components';
|
|
4
|
+
export { FormProvider, RenderNothing, useField, useForm, withFormProvider, } from './components';
|
|
5
|
+
export type { AsyncReducer, AsyncReducerState, UseDeprecationWarning, UseDropZoneParams, } from './hooks';
|
|
6
|
+
export { useAsyncReducer, useControlledReducer, useDeprecationWarning, useDropZone, useGetUrl, useHasValueUpdated, usePreviousValue, useSetUserAgent, useTimeout, } from './hooks';
|
|
7
|
+
export type { MergeProps } from './types';
|
|
5
8
|
export { createContextUtilities } from './utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AnyComponent, MergeProps } from './types';
|
|
1
|
+
export type { AnyComponent, MergeProps } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-core",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@aws-amplify/ui": "6.10.
|
|
43
|
+
"@aws-amplify/ui": "6.10.3",
|
|
44
44
|
"@xstate/react": "^3.2.2",
|
|
45
45
|
"lodash": "4.17.21",
|
|
46
46
|
"react-hook-form": "^7.53.2",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import React, { useContext, useEffect, useMemo } from 'react';
|
|
2
3
|
import { useInterpret } from '@xstate/react';
|
|
3
4
|
|
|
4
5
|
import { getCurrentUser } from 'aws-amplify/auth';
|
|
6
|
+
import type { AuthStatus, AuthMachineHubHandler } from '@aws-amplify/ui';
|
|
5
7
|
import {
|
|
6
|
-
AuthStatus,
|
|
7
|
-
AuthMachineHubHandler,
|
|
8
8
|
createAuthenticatorMachine,
|
|
9
9
|
defaultAuthHubHandler,
|
|
10
10
|
listenToAuthHub,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
ChallengeName,
|
|
5
5
|
AuthenticatorServiceFacade,
|
|
6
6
|
LegacyFormFieldOptions,
|
|
7
7
|
} from '@aws-amplify/ui';
|
|
8
8
|
|
|
9
|
-
import { UseAuthenticator } from './useAuthenticator';
|
|
9
|
+
import type { UseAuthenticator } from './useAuthenticator';
|
|
10
10
|
|
|
11
11
|
export type AuthenticatorRouteComponentKey =
|
|
12
12
|
| 'confirmResetPassword'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as useAuthenticator } from './useAuthenticator';
|
|
2
|
-
export { UseAuthenticator, UseAuthenticatorSelector } from './types';
|
|
2
|
+
export type { UseAuthenticator, UseAuthenticatorSelector } from './types';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useSelector } from '@xstate/react';
|
|
3
|
-
import { AuthMachineState
|
|
3
|
+
import type { AuthMachineState } from '@aws-amplify/ui';
|
|
4
|
+
import { getServiceFacade } from '@aws-amplify/ui';
|
|
4
5
|
|
|
5
6
|
import { AuthenticatorContext } from '../../context';
|
|
6
7
|
|
|
7
8
|
import { USE_AUTHENTICATOR_ERROR } from './constants';
|
|
8
|
-
import { UseAuthenticatorSelector, UseAuthenticator } from './types';
|
|
9
|
+
import type { UseAuthenticatorSelector, UseAuthenticator } from './types';
|
|
9
10
|
import {
|
|
10
11
|
defaultComparator,
|
|
11
12
|
getComparator,
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
areEmptyArrays,
|
|
3
|
-
areEmptyObjects,
|
|
1
|
+
import type {
|
|
4
2
|
AuthenticatorRoute,
|
|
5
3
|
AuthMachineState,
|
|
6
4
|
FormFieldsArray,
|
|
7
|
-
getSortedFormFields,
|
|
8
5
|
UnverifiedUserAttributes,
|
|
6
|
+
AuthMFAType,
|
|
7
|
+
} from '@aws-amplify/ui';
|
|
8
|
+
import {
|
|
9
|
+
areEmptyArrays,
|
|
10
|
+
areEmptyObjects,
|
|
11
|
+
getSortedFormFields,
|
|
9
12
|
getActorContext,
|
|
10
13
|
isString,
|
|
11
|
-
AuthMFAType,
|
|
12
14
|
authenticatorTextUtil,
|
|
13
15
|
} from '@aws-amplify/ui';
|
|
14
16
|
|
|
15
|
-
import {
|
|
17
|
+
import type {
|
|
18
|
+
AuthenticatorLegacyField,
|
|
19
|
+
AuthenticatorLegacyFields,
|
|
20
|
+
} from '../types';
|
|
16
21
|
import { isComponentRouteKey } from '../utils';
|
|
17
22
|
|
|
18
|
-
import { Comparator, UseAuthenticatorSelector } from './types';
|
|
23
|
+
import type { Comparator, UseAuthenticatorSelector } from './types';
|
|
19
24
|
|
|
20
25
|
export const defaultComparator = (): false => false;
|
|
21
26
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AuthenticatorMachineOptions } from '@aws-amplify/ui';
|
|
2
|
+
import type { AuthenticatorMachineOptions } from '@aws-amplify/ui';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
UseAuthenticatorSelector,
|
|
7
|
-
} from '../useAuthenticator';
|
|
4
|
+
import type { UseAuthenticatorSelector } from '../useAuthenticator';
|
|
5
|
+
import { useAuthenticator } from '../useAuthenticator';
|
|
8
6
|
|
|
9
7
|
// only select `route` from machine context
|
|
10
8
|
export const routeSelector: UseAuthenticatorSelector = ({ route }) => [route];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
1
|
+
import type { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
2
2
|
|
|
3
3
|
import { RenderNothing } from '../../../components';
|
|
4
|
-
import {
|
|
4
|
+
import type {
|
|
5
5
|
AuthenticatorMachineContext,
|
|
6
6
|
AuthenticatorMachineContextKey,
|
|
7
7
|
AuthenticatorRouteComponentKey,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
Defaults,
|
|
11
11
|
} from '../types';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import type {
|
|
14
14
|
UseAuthenticator,
|
|
15
15
|
UseAuthenticatorSelector,
|
|
16
16
|
} from '../useAuthenticator';
|
|
17
17
|
import { isComponentRouteKey } from '../utils';
|
|
18
18
|
import { MACHINE_PROP_KEYS, EVENT_HANDLER_KEY_MAP } from './constants';
|
|
19
|
-
import {
|
|
19
|
+
import type {
|
|
20
20
|
ConvertedMachineProps,
|
|
21
21
|
FormEventHandlerMachineKey,
|
|
22
22
|
FormEventHandlerPropKey,
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
1
|
+
import type { AuthenticatorRoute } from '@aws-amplify/ui';
|
|
2
2
|
|
|
3
3
|
import { COMPONENT_ROUTE_KEYS, COMPONENT_ROUTE_NAMES } from './constants';
|
|
4
|
-
import {
|
|
4
|
+
import type {
|
|
5
|
+
AuthenticatorRouteComponentKey,
|
|
6
|
+
Defaults,
|
|
7
|
+
Overrides,
|
|
8
|
+
} from './types';
|
|
5
9
|
|
|
6
10
|
export const isComponentRouteKey = (
|
|
7
11
|
route: AuthenticatorRoute
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
export { AuthenticatorProvider, AuthenticatorContext } from './context';
|
|
2
|
+
export type { UseAuthenticator, UseAuthenticatorRoute } from './hooks';
|
|
2
3
|
export {
|
|
3
4
|
resolveAuthenticatorComponents,
|
|
4
5
|
useAuthenticator,
|
|
5
6
|
useAuthenticatorRoute,
|
|
6
|
-
UseAuthenticator,
|
|
7
7
|
useAuthenticatorInitMachine,
|
|
8
|
-
UseAuthenticatorRoute,
|
|
9
8
|
} from './hooks';
|
|
10
|
-
export {
|
|
9
|
+
export type {
|
|
11
10
|
Overrides as AuthenticatorComponentOverrides,
|
|
12
11
|
Defaults as AuthenticatorComponentDefaults,
|
|
13
12
|
DefaultProps as AuthenticatorComponentDefaultProps,
|
|
14
13
|
FooterComponent as AuthenticatorFooterComponent,
|
|
15
14
|
FormFieldsComponent as AuthenticatorFormFieldsComponent,
|
|
16
15
|
HeaderComponent as AuthenticatorHeaderComponent,
|
|
17
|
-
isComponentRouteKey as isAuthenticatorComponentRouteKey,
|
|
18
16
|
AuthenticatorRouteComponentKey,
|
|
19
17
|
AuthenticatorRouteComponentName,
|
|
20
18
|
AuthenticatorLegacyField,
|
|
21
19
|
AuthenticatorMachineContext,
|
|
22
20
|
FormFieldsComponent,
|
|
23
21
|
} from './hooks';
|
|
22
|
+
export { isComponentRouteKey as isAuthenticatorComponentRouteKey } from './hooks';
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
FormProvider as ReactHookFormProvider,
|
|
5
5
|
} from 'react-hook-form';
|
|
6
6
|
|
|
7
|
-
import { FormValues, FormHandle, FormProviderProps } from './types';
|
|
7
|
+
import type { FormValues, FormHandle, FormProviderProps } from './types';
|
|
8
8
|
|
|
9
9
|
const DEFAULT_MODE = 'onTouched';
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DefaultValues } from 'react-hook-form';
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { DefaultValues } from 'react-hook-form';
|
|
3
3
|
|
|
4
4
|
export interface FormValues {
|
|
5
5
|
[k: string]: string;
|
|
@@ -63,7 +63,7 @@ export interface RegisterFieldParams<Values extends FormValues = FormValues> {
|
|
|
63
63
|
|
|
64
64
|
export interface UseFormParams<
|
|
65
65
|
Values extends FormValues = FormValues,
|
|
66
|
-
OnSubmit extends SubmitHandler<Values> = SubmitHandler<Values
|
|
66
|
+
OnSubmit extends SubmitHandler<Values> = SubmitHandler<Values>,
|
|
67
67
|
> {
|
|
68
68
|
/**
|
|
69
69
|
* Custom error message provided to `Error` on call to `useForm` outside `FormProvider`
|
|
@@ -193,7 +193,7 @@ export interface UseField<Name extends string = string>
|
|
|
193
193
|
export interface UseFieldParams<
|
|
194
194
|
OnBlur extends FocusHandler | undefined,
|
|
195
195
|
OnChange extends ChangeHandler | undefined,
|
|
196
|
-
Values extends FormValues = FormValues
|
|
196
|
+
Values extends FormValues = FormValues,
|
|
197
197
|
> {
|
|
198
198
|
/**
|
|
199
199
|
* Controlled `disabled` state
|
|
@@ -252,7 +252,7 @@ export interface UseFieldParams<
|
|
|
252
252
|
*/
|
|
253
253
|
export interface UseControlledFieldParams<
|
|
254
254
|
OnBlur extends FocusHandler | undefined,
|
|
255
|
-
Values extends FormValues = FormValues
|
|
255
|
+
Values extends FormValues = FormValues,
|
|
256
256
|
> extends Omit<UseFieldParams<OnBlur, undefined, Values>, 'onChange'> {
|
|
257
257
|
/**
|
|
258
258
|
* Controlled text change event handler
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import useForm from './useForm';
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
|
+
ChangeHandler,
|
|
4
|
+
FocusHandler,
|
|
5
|
+
UseField,
|
|
6
|
+
UseFieldParams,
|
|
7
|
+
} from './types';
|
|
3
8
|
|
|
4
9
|
export const DEFAULT_ERROR_MESSAGE =
|
|
5
10
|
'`useField` must be used within a `FormProvider`';
|
|
@@ -12,7 +17,7 @@ export const DEFAULT_ERROR_MESSAGE =
|
|
|
12
17
|
*/
|
|
13
18
|
export default function useField<
|
|
14
19
|
OnBlur extends FocusHandler,
|
|
15
|
-
OnChange extends ChangeHandler
|
|
20
|
+
OnChange extends ChangeHandler,
|
|
16
21
|
>(params: UseFieldParams<OnBlur, OnChange>): UseField {
|
|
17
22
|
const { getFieldState, registerField } = useForm({
|
|
18
23
|
errorMessage: DEFAULT_ERROR_MESSAGE,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { useFormContext } from 'react-hook-form';
|
|
3
3
|
import { noop } from '@aws-amplify/ui';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
FormValues,
|
|
7
7
|
RegisterFieldParams,
|
|
8
8
|
SetFormValueParams,
|
|
@@ -25,7 +25,7 @@ export const DEFAULT_ERROR_MESSAGE =
|
|
|
25
25
|
*/
|
|
26
26
|
export default function useForm<
|
|
27
27
|
Values extends FormValues = FormValues,
|
|
28
|
-
OnSubmit extends SubmitHandler = SubmitHandler
|
|
28
|
+
OnSubmit extends SubmitHandler = SubmitHandler,
|
|
29
29
|
>(options: UseFormParams<Values, OnSubmit> = {}): UseForm<Values> {
|
|
30
30
|
const formContext = useFormContext();
|
|
31
31
|
const { errorMessage, onSubmit: _onSubmit } = options;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { AnyComponent } from '../../types';
|
|
3
|
+
import type { AnyComponent } from '../../types';
|
|
4
4
|
|
|
5
5
|
import FormProvider from './FormProvider';
|
|
6
|
-
import { FormHandle, FormProviderProps } from './types';
|
|
6
|
+
import type { FormHandle, FormProviderProps } from './types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param Child `Form` base component wrapped inside `FormProvider`
|
package/src/components/index.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
FormProvider,
|
|
1
|
+
export type {
|
|
3
2
|
FormProviderProps,
|
|
4
3
|
FormValues,
|
|
5
4
|
FormHandle,
|
|
6
5
|
SubmitHandler,
|
|
7
|
-
useField,
|
|
8
|
-
useForm,
|
|
9
6
|
UseForm,
|
|
10
7
|
Validate,
|
|
11
8
|
Validator,
|
|
12
|
-
withFormProvider,
|
|
13
9
|
} from './FormCore';
|
|
10
|
+
export { FormProvider, useField, useForm, withFormProvider } from './FormCore';
|
|
14
11
|
|
|
15
12
|
export { RenderNothing } from './RenderNothing';
|
package/src/elements/types.ts
CHANGED
package/src/elements/utils.ts
CHANGED
package/src/hooks/index.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
export { default as useControlledReducer } from './useControlledReducer';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from './
|
|
8
|
-
export {
|
|
9
|
-
default as useDeprecationWarning,
|
|
10
|
-
UseDeprecationWarning,
|
|
11
|
-
} from './useDeprecationWarning';
|
|
2
|
+
export type { UseDropZoneParams } from './useDropZone';
|
|
3
|
+
export { default as useDropZone } from './useDropZone';
|
|
4
|
+
export type { AsyncReducer, AsyncReducerState } from './useAsyncReducer';
|
|
5
|
+
export { default as useAsyncReducer } from './useAsyncReducer';
|
|
6
|
+
export type { UseDeprecationWarning } from './useDeprecationWarning';
|
|
7
|
+
export { default as useDeprecationWarning } from './useDeprecationWarning';
|
|
12
8
|
export { default as useGetUrl } from './useGetUrl';
|
|
13
9
|
export { default as useHasValueUpdated } from './useHasValueUpdated';
|
|
14
10
|
export { default as usePreviousValue } from './usePreviousValue';
|
package/src/hooks/useGetUrl.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
getUrl,
|
|
3
|
+
import type {
|
|
5
4
|
GetUrlInput,
|
|
6
5
|
GetUrlOutput,
|
|
7
6
|
GetUrlWithPathInput,
|
|
8
7
|
} from 'aws-amplify/storage';
|
|
8
|
+
import { getUrl } from 'aws-amplify/storage';
|
|
9
9
|
|
|
10
10
|
import { isFunction } from '@aws-amplify/ui';
|
|
11
11
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { SetUserAgentOptions } from '@aws-amplify/ui';
|
|
3
|
+
import { setUserAgent } from '@aws-amplify/ui';
|
|
3
4
|
|
|
4
5
|
export default function useSetUserAgent({
|
|
5
6
|
componentName,
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// features
|
|
2
|
-
export {
|
|
2
|
+
export type {
|
|
3
3
|
AuthenticatorComponentDefaults,
|
|
4
4
|
AuthenticatorComponentDefaultProps,
|
|
5
5
|
AuthenticatorComponentOverrides,
|
|
@@ -8,41 +8,47 @@ export {
|
|
|
8
8
|
AuthenticatorHeaderComponent,
|
|
9
9
|
AuthenticatorLegacyField,
|
|
10
10
|
AuthenticatorMachineContext,
|
|
11
|
-
AuthenticatorProvider,
|
|
12
11
|
AuthenticatorRouteComponentKey,
|
|
13
12
|
AuthenticatorRouteComponentName,
|
|
13
|
+
UseAuthenticator,
|
|
14
|
+
UseAuthenticatorRoute,
|
|
15
|
+
} from './Authenticator';
|
|
16
|
+
export {
|
|
17
|
+
AuthenticatorProvider,
|
|
14
18
|
isAuthenticatorComponentRouteKey,
|
|
15
19
|
resolveAuthenticatorComponents,
|
|
16
20
|
useAuthenticator,
|
|
17
21
|
useAuthenticatorRoute,
|
|
18
|
-
UseAuthenticator,
|
|
19
22
|
useAuthenticatorInitMachine,
|
|
20
|
-
UseAuthenticatorRoute,
|
|
21
23
|
} from './Authenticator';
|
|
22
24
|
|
|
23
|
-
export {
|
|
24
|
-
FormProvider,
|
|
25
|
+
export type {
|
|
25
26
|
FormProviderProps,
|
|
26
|
-
RenderNothing,
|
|
27
27
|
FormValues,
|
|
28
28
|
FormHandle,
|
|
29
|
-
useField,
|
|
30
|
-
useForm,
|
|
31
29
|
UseForm,
|
|
32
30
|
Validate,
|
|
33
31
|
Validator,
|
|
32
|
+
} from './components';
|
|
33
|
+
export {
|
|
34
|
+
FormProvider,
|
|
35
|
+
RenderNothing,
|
|
36
|
+
useField,
|
|
37
|
+
useForm,
|
|
34
38
|
withFormProvider,
|
|
35
39
|
} from './components';
|
|
36
40
|
|
|
37
|
-
export {
|
|
41
|
+
export type {
|
|
38
42
|
AsyncReducer,
|
|
39
43
|
AsyncReducerState,
|
|
44
|
+
UseDeprecationWarning,
|
|
45
|
+
UseDropZoneParams,
|
|
46
|
+
} from './hooks';
|
|
47
|
+
export {
|
|
40
48
|
useAsyncReducer,
|
|
41
49
|
useControlledReducer,
|
|
42
50
|
useDeprecationWarning,
|
|
43
|
-
UseDeprecationWarning,
|
|
44
51
|
useDropZone,
|
|
45
|
-
UseDropZoneParams,
|
|
46
52
|
useGetUrl,
|
|
47
53
|
useHasValueUpdated,
|
|
48
54
|
usePreviousValue,
|
|
@@ -50,6 +56,6 @@ export {
|
|
|
50
56
|
useTimeout,
|
|
51
57
|
} from './hooks';
|
|
52
58
|
|
|
53
|
-
export { MergeProps } from './types';
|
|
59
|
+
export type { MergeProps } from './types';
|
|
54
60
|
|
|
55
61
|
export { createContextUtilities } from './utils';
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AnyComponent, MergeProps } from './types';
|
|
1
|
+
export type { AnyComponent, MergeProps } from './types';
|