@aws-amplify/ui-react-core 3.1.1 → 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.
@@ -1,7 +1,7 @@
1
1
  import { useRef, useEffect } from 'react';
2
2
 
3
3
  function usePreviousValue(value) {
4
- const previous = useRef();
4
+ const previous = useRef(undefined);
5
5
  // update ref post render
6
6
  useEffect(() => {
7
7
  previous.current = value;
package/dist/index.js CHANGED
@@ -638,7 +638,7 @@ function useGetUrl(input) {
638
638
  }
639
639
 
640
640
  function usePreviousValue(value) {
641
- const previous = React.useRef();
641
+ const previous = React.useRef(undefined);
642
642
  // update ref post render
643
643
  React.useEffect(() => {
644
644
  previous.current = value;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  export default function AuthenticatorProvider({ children, }: {
3
3
  children: ReactNode;
4
- }): JSX.Element;
4
+ }): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { AnyComponent, MergeProps } from '../../types';
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 MergeProps<FormProviderProps, ChildProps>>(Child: ChildComp): React.ForwardRefExoticComponent<React.PropsWithoutRef<Props> & React.RefAttributes<FormHandle>>;
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>>;
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Utility component for rendering nothing.
4
3
  */
5
- export default function RenderNothing<Props>(_: Props): JSX.Element | null;
4
+ export default function RenderNothing<Props>(_: Props): React.JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface DragEvents {
3
2
  onDragStart: (event: React.DragEvent<HTMLDivElement>) => void;
4
3
  onDragEnter: (event: React.DragEvent<HTMLDivElement>) => void;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  export type AnyComponent = React.ComponentType<any>;
3
2
  export type MergeProps<C, P> = C & Omit<P, keyof C>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-core",
3
- "version": "3.1.1",
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",
@@ -40,15 +40,15 @@
40
40
  "typecheck": "tsc --noEmit"
41
41
  },
42
42
  "dependencies": {
43
- "@aws-amplify/ui": "6.7.1",
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.43.5",
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.0 || ^17.0 || ^18.0"
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, MergeProps } from '../../types';
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 MergeProps<FormProviderProps, ChildProps>
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 defaultValues={defaultValues} mode={mode} ref={ref}>
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
  );
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Utility component for rendering nothing.
3
3
  */
4
- export default function RenderNothing<Props>(_: Props): JSX.Element | null {
4
+ export default function RenderNothing<Props>(
5
+ _: Props
6
+ ): React.JSX.Element | null {
5
7
  return null;
6
8
  }
@@ -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(() => {