@aws-amplify/ui-react-core 3.1.2 → 3.2.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.
- package/dist/esm/hooks/usePreviousValue.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/Authenticator/context/AuthenticatorProvider.d.ts +2 -2
- package/dist/types/components/FormCore/withFormProvider.d.ts +2 -2
- package/dist/types/components/RenderNothing/RenderNothing.d.ts +1 -2
- package/dist/types/hooks/useDropZone.d.ts +0 -1
- package/dist/types/types/types.d.ts +0 -1
- package/package.json +3 -3
- package/src/Authenticator/context/AuthenticatorProvider.tsx +1 -1
- package/src/components/FormCore/withFormProvider.tsx +7 -3
- package/src/components/RenderNothing/RenderNothing.tsx +3 -1
- package/src/hooks/usePreviousValue.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AnyComponent
|
|
2
|
+
import { AnyComponent } from '../../types';
|
|
3
3
|
import { 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
|
|
7
7
|
*/
|
|
8
|
-
export default function withFormProvider<ChildComp extends AnyComponent, ChildProps extends React.ComponentPropsWithRef<ChildComp>, Props extends
|
|
8
|
+
export default function withFormProvider<ChildComp extends AnyComponent, ChildProps extends React.ComponentPropsWithRef<ChildComp>, Props extends ChildProps & FormProviderProps>(Child: ChildComp): React.ForwardRefExoticComponent<React.PropsWithoutRef<Props> & React.RefAttributes<FormHandle>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@aws-amplify/ui": "6.7.2",
|
|
44
44
|
"@xstate/react": "^3.2.2",
|
|
45
45
|
"lodash": "4.17.21",
|
|
46
|
-
"react-hook-form": "^7.
|
|
46
|
+
"react-hook-form": "^7.53.2",
|
|
47
47
|
"xstate": "^4.33.6"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"aws-amplify": "^6.9.0",
|
|
51
|
-
"react": "^16.14
|
|
51
|
+
"react": "^16.14 || ^17 || ^18 || ^19"
|
|
52
52
|
},
|
|
53
53
|
"sideEffects": false
|
|
54
54
|
}
|
|
@@ -24,7 +24,7 @@ export default function AuthenticatorProvider({
|
|
|
24
24
|
children,
|
|
25
25
|
}: {
|
|
26
26
|
children: ReactNode;
|
|
27
|
-
}): JSX.Element {
|
|
27
|
+
}): React.JSX.Element {
|
|
28
28
|
// `authStatus` is exposed by `useAuthenticator` but should not be derived directly from the
|
|
29
29
|
// state machine as the machine only updates on `Authenticator` initiated events, which
|
|
30
30
|
// leads to scenarios where the state machine `authStatus` gets "stuck". For exmample,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { AnyComponent
|
|
3
|
+
import { AnyComponent } from '../../types';
|
|
4
4
|
|
|
5
5
|
import FormProvider from './FormProvider';
|
|
6
6
|
import { FormHandle, FormProviderProps } from './types';
|
|
@@ -12,7 +12,7 @@ import { FormHandle, FormProviderProps } from './types';
|
|
|
12
12
|
export default function withFormProvider<
|
|
13
13
|
ChildComp extends AnyComponent,
|
|
14
14
|
ChildProps extends React.ComponentPropsWithRef<ChildComp>,
|
|
15
|
-
Props extends
|
|
15
|
+
Props extends ChildProps & FormProviderProps,
|
|
16
16
|
>(
|
|
17
17
|
Child: ChildComp
|
|
18
18
|
): React.ForwardRefExoticComponent<
|
|
@@ -23,7 +23,11 @@ export default function withFormProvider<
|
|
|
23
23
|
ref
|
|
24
24
|
) {
|
|
25
25
|
return (
|
|
26
|
-
<FormProvider
|
|
26
|
+
<FormProvider
|
|
27
|
+
defaultValues={defaultValues as Props['defaultValues']}
|
|
28
|
+
mode={mode as Props['mode']}
|
|
29
|
+
ref={ref}
|
|
30
|
+
>
|
|
27
31
|
<Child {...(props as ChildProps)} />
|
|
28
32
|
</FormProvider>
|
|
29
33
|
);
|
|
@@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react';
|
|
|
3
3
|
export default function usePreviousValue<Value>(
|
|
4
4
|
value: Value
|
|
5
5
|
): Value | undefined {
|
|
6
|
-
const previous = useRef<Value>();
|
|
6
|
+
const previous = useRef<Value | undefined>(undefined);
|
|
7
7
|
|
|
8
8
|
// update ref post render
|
|
9
9
|
useEffect(() => {
|