@aws-amplify/ui-react-core 3.6.1 → 3.6.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/dist/elements.js +3 -2
- package/dist/esm/Authenticator/context/AuthenticatorProvider.mjs +1 -1
- package/dist/esm/Authenticator/hooks/useAuthenticator/useAuthenticator.mjs +1 -1
- package/dist/esm/Authenticator/hooks/useAuthenticator/utils.mjs +1 -1
- package/dist/esm/elements/withBaseElementProps.mjs +3 -2
- package/dist/esm/hooks/useControlledReducer.mjs +1 -3
- package/dist/esm/utils/processDroppedItems.mjs +2 -1
- package/dist/index.js +4 -5
- package/dist/types/Authenticator/hooks/index.d.ts +1 -1
- package/dist/types/Authenticator/hooks/useAuthenticatorRoute/index.d.ts +1 -1
- package/dist/types/elements/index.d.ts +1 -1
- package/dist/types/elements/withBaseElementProps.d.ts +2 -2
- package/package.json +3 -3
- package/src/Authenticator/context/AuthenticatorProvider.tsx +1 -1
- package/src/Authenticator/hooks/index.ts +1 -1
- package/src/Authenticator/hooks/useAuthenticatorRoute/index.ts +1 -1
- package/src/elements/index.ts +1 -1
- package/src/elements/withBaseElementProps.tsx +3 -2
- package/src/hooks/useAsyncReducer.ts +1 -1
- package/src/hooks/useControlledReducer.ts +1 -3
- package/src/utils/processDroppedItems.ts +2 -1
package/dist/elements.js
CHANGED
|
@@ -197,6 +197,7 @@ function defineBaseElementWithRef(input) {
|
|
|
197
197
|
return Element;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
200
201
|
/**
|
|
201
202
|
* @internal @unstable
|
|
202
203
|
*
|
|
@@ -212,13 +213,13 @@ function defineBaseElementWithRef(input) {
|
|
|
212
213
|
* type InputElementPropKey = 'onChange' | 'type';
|
|
213
214
|
*
|
|
214
215
|
* // create `InputElement` base with `type` generic and extended `props` key
|
|
215
|
-
* export const InputElement =
|
|
216
|
+
* export const InputElement = withBaseElementProps<"input", InputElementPropKey>({
|
|
216
217
|
* type: "input",
|
|
217
218
|
* displayName: "Input",
|
|
218
219
|
* });
|
|
219
220
|
*
|
|
220
221
|
* // extend base `InputElement` with default input `type` of `checkbox`
|
|
221
|
-
* const CheckboxElement = withBaseElementProps(
|
|
222
|
+
* const CheckboxElement = withBaseElementProps(InputElement, {
|
|
222
223
|
* className: 'submit-toggle__checkbox',
|
|
223
224
|
* type: 'checkbox',
|
|
224
225
|
* });
|
|
@@ -32,7 +32,7 @@ function AuthenticatorProvider({ children, }) {
|
|
|
32
32
|
*/
|
|
33
33
|
const parentProviderVal = useContext(AuthenticatorContext);
|
|
34
34
|
const service = useInterpret(createAuthenticatorMachine);
|
|
35
|
-
const value = useMemo(() =>
|
|
35
|
+
const value = useMemo(() => parentProviderVal ?? { authStatus, service }, [authStatus, parentProviderVal, service]);
|
|
36
36
|
const { service: activeService } = value;
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
const onSignIn = () => {
|
|
@@ -4,7 +4,7 @@ import { getServiceFacade } from '@aws-amplify/ui';
|
|
|
4
4
|
import 'aws-amplify/auth';
|
|
5
5
|
import { AuthenticatorContext } from '../../context/AuthenticatorContext.mjs';
|
|
6
6
|
import { USE_AUTHENTICATOR_ERROR } from './constants.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { defaultComparator, getQRFields, getMachineFields, getComparator } from './utils.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* [📖 Docs](https://ui.docs.amplify.aws/react/connected-components/authenticator/headless#useauthenticator-hook)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getActorContext, getSortedFormFields,
|
|
1
|
+
import { getActorContext, getSortedFormFields, isString, authenticatorTextUtil, areEmptyArrays, areEmptyObjects } from '@aws-amplify/ui';
|
|
2
2
|
import { isComponentRouteKey } from '../utils.mjs';
|
|
3
3
|
|
|
4
4
|
const defaultComparator = () => false;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
3
4
|
/**
|
|
4
5
|
* @internal @unstable
|
|
5
6
|
*
|
|
@@ -15,13 +16,13 @@ import React__default from 'react';
|
|
|
15
16
|
* type InputElementPropKey = 'onChange' | 'type';
|
|
16
17
|
*
|
|
17
18
|
* // create `InputElement` base with `type` generic and extended `props` key
|
|
18
|
-
* export const InputElement =
|
|
19
|
+
* export const InputElement = withBaseElementProps<"input", InputElementPropKey>({
|
|
19
20
|
* type: "input",
|
|
20
21
|
* displayName: "Input",
|
|
21
22
|
* });
|
|
22
23
|
*
|
|
23
24
|
* // extend base `InputElement` with default input `type` of `checkbox`
|
|
24
|
-
* const CheckboxElement = withBaseElementProps(
|
|
25
|
+
* const CheckboxElement = withBaseElementProps(InputElement, {
|
|
25
26
|
* className: 'submit-toggle__checkbox',
|
|
26
27
|
* type: 'checkbox',
|
|
27
28
|
* });
|
|
@@ -17,9 +17,7 @@ function useControlledReducer(reducer, initialState, options) {
|
|
|
17
17
|
onStateChange?.(uncontrolledState);
|
|
18
18
|
}
|
|
19
19
|
}, [hasUncontrolledStateChanged, onStateChange, uncontrolledState]);
|
|
20
|
-
const state = controlledStateRef.current
|
|
21
|
-
? controlledStateRef.current
|
|
22
|
-
: uncontrolledState;
|
|
20
|
+
const state = controlledStateRef.current ?? uncontrolledState;
|
|
23
21
|
return React__default.useMemo(() => [state, dispatch], [state]);
|
|
24
22
|
}
|
|
25
23
|
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ function AuthenticatorProvider({ children, }) {
|
|
|
64
64
|
*/
|
|
65
65
|
const parentProviderVal = React.useContext(AuthenticatorContext);
|
|
66
66
|
const service = react.useInterpret(ui.createAuthenticatorMachine);
|
|
67
|
-
const value = React.useMemo(() =>
|
|
67
|
+
const value = React.useMemo(() => parentProviderVal ?? { authStatus, service }, [authStatus, parentProviderVal, service]);
|
|
68
68
|
const { service: activeService } = value;
|
|
69
69
|
React.useEffect(() => {
|
|
70
70
|
const onSignIn = () => {
|
|
@@ -652,9 +652,7 @@ function useControlledReducer(reducer, initialState, options) {
|
|
|
652
652
|
onStateChange?.(uncontrolledState);
|
|
653
653
|
}
|
|
654
654
|
}, [hasUncontrolledStateChanged, onStateChange, uncontrolledState]);
|
|
655
|
-
const state = controlledStateRef.current
|
|
656
|
-
? controlledStateRef.current
|
|
657
|
-
: uncontrolledState;
|
|
655
|
+
const state = controlledStateRef.current ?? uncontrolledState;
|
|
658
656
|
return React__namespace["default"].useMemo(() => [state, dispatch], [state]);
|
|
659
657
|
}
|
|
660
658
|
|
|
@@ -706,7 +704,8 @@ const readAllDirectoryEntries = async (dirReader) => {
|
|
|
706
704
|
try {
|
|
707
705
|
dirReader.readEntries(resolve, reject);
|
|
708
706
|
}
|
|
709
|
-
catch (
|
|
707
|
+
catch (e) {
|
|
708
|
+
const error = e;
|
|
710
709
|
reject(error);
|
|
711
710
|
}
|
|
712
711
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as useAuthenticatorRoute } from './useAuthenticatorRoute';
|
|
2
|
-
export * from './types';
|
|
2
|
+
export type * from './types';
|
|
@@ -3,4 +3,4 @@ export { defineBaseElement, defineBaseElementWithRef, } from './defineBaseElemen
|
|
|
3
3
|
export { default as withBaseElementProps } from './withBaseElementProps';
|
|
4
4
|
export { ElementsProvider } from './ElementsContext';
|
|
5
5
|
export { isComponent, isForwardRefExoticComponent } from './utils';
|
|
6
|
-
export * from './types';
|
|
6
|
+
export type * from './types';
|
|
@@ -15,13 +15,13 @@ import type { BaseElementWithRef, ElementRefType } from './types';
|
|
|
15
15
|
* type InputElementPropKey = 'onChange' | 'type';
|
|
16
16
|
*
|
|
17
17
|
* // create `InputElement` base with `type` generic and extended `props` key
|
|
18
|
-
* export const InputElement =
|
|
18
|
+
* export const InputElement = withBaseElementProps<"input", InputElementPropKey>({
|
|
19
19
|
* type: "input",
|
|
20
20
|
* displayName: "Input",
|
|
21
21
|
* });
|
|
22
22
|
*
|
|
23
23
|
* // extend base `InputElement` with default input `type` of `checkbox`
|
|
24
|
-
* const CheckboxElement = withBaseElementProps(
|
|
24
|
+
* const CheckboxElement = withBaseElementProps(InputElement, {
|
|
25
25
|
* className: 'submit-toggle__checkbox',
|
|
26
26
|
* type: 'checkbox',
|
|
27
27
|
* });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-core",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@aws-amplify/ui": "6.15.
|
|
43
|
+
"@aws-amplify/ui": "6.15.3",
|
|
44
44
|
"@xstate/react": "^3.2.2",
|
|
45
|
-
"lodash": "4.
|
|
45
|
+
"lodash": "4.18.1",
|
|
46
46
|
"react-hook-form": "7.53.2",
|
|
47
47
|
"xstate": "^4.33.6"
|
|
48
48
|
},
|
|
@@ -53,7 +53,7 @@ export default function AuthenticatorProvider({
|
|
|
53
53
|
const service = useInterpret(createAuthenticatorMachine);
|
|
54
54
|
|
|
55
55
|
const value = useMemo(
|
|
56
|
-
() =>
|
|
56
|
+
() => parentProviderVal ?? { authStatus, service },
|
|
57
57
|
[authStatus, parentProviderVal, service]
|
|
58
58
|
);
|
|
59
59
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as useAuthenticatorRoute } from './useAuthenticatorRoute';
|
|
2
|
-
export * from './types';
|
|
2
|
+
export type * from './types';
|
package/src/elements/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { BaseElementWithRef, ElementRefType } from './types';
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
4
5
|
/**
|
|
5
6
|
* @internal @unstable
|
|
6
7
|
*
|
|
@@ -16,13 +17,13 @@ import type { BaseElementWithRef, ElementRefType } from './types';
|
|
|
16
17
|
* type InputElementPropKey = 'onChange' | 'type';
|
|
17
18
|
*
|
|
18
19
|
* // create `InputElement` base with `type` generic and extended `props` key
|
|
19
|
-
* export const InputElement =
|
|
20
|
+
* export const InputElement = withBaseElementProps<"input", InputElementPropKey>({
|
|
20
21
|
* type: "input",
|
|
21
22
|
* displayName: "Input",
|
|
22
23
|
* });
|
|
23
24
|
*
|
|
24
25
|
* // extend base `InputElement` with default input `type` of `checkbox`
|
|
25
|
-
* const CheckboxElement = withBaseElementProps(
|
|
26
|
+
* const CheckboxElement = withBaseElementProps(InputElement, {
|
|
26
27
|
* className: 'submit-toggle__checkbox',
|
|
27
28
|
* type: 'checkbox',
|
|
28
29
|
* });
|
|
@@ -73,7 +73,7 @@ export default function useAsyncReducer<T, K>(
|
|
|
73
73
|
}));
|
|
74
74
|
|
|
75
75
|
const prevValue = React.useRef(initialValue);
|
|
76
|
-
const pendingId = React.useRef<
|
|
76
|
+
const pendingId = React.useRef<symbol | undefined>();
|
|
77
77
|
|
|
78
78
|
const { onSuccess, onError } = options ?? {};
|
|
79
79
|
|
|
@@ -38,9 +38,7 @@ export default function useControlledReducer<
|
|
|
38
38
|
}
|
|
39
39
|
}, [hasUncontrolledStateChanged, onStateChange, uncontrolledState]);
|
|
40
40
|
|
|
41
|
-
const state = controlledStateRef.current
|
|
42
|
-
? controlledStateRef.current
|
|
43
|
-
: uncontrolledState;
|
|
41
|
+
const state = controlledStateRef.current ?? uncontrolledState;
|
|
44
42
|
|
|
45
43
|
return React.useMemo(() => [state, dispatch], [state]);
|
|
46
44
|
}
|
|
@@ -16,7 +16,8 @@ const readAllDirectoryEntries = async (
|
|
|
16
16
|
readBatch = await new Promise<FileSystemEntry[]>((resolve, reject) => {
|
|
17
17
|
try {
|
|
18
18
|
dirReader.readEntries(resolve, reject);
|
|
19
|
-
} catch (
|
|
19
|
+
} catch (e) {
|
|
20
|
+
const error = e as Error;
|
|
20
21
|
reject(error);
|
|
21
22
|
}
|
|
22
23
|
});
|