@aws-amplify/ui-react 5.0.3 → 5.0.4

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,2 +1,2 @@
1
1
  import { BaseFieldGroupIconProps, ForwardRefPrimitive } from '../types';
2
- export declare const FieldGroupIcon: ForwardRefPrimitive<BaseFieldGroupIconProps, 'button' | 'div'>;
2
+ export declare const FieldGroupIcon: ForwardRefPrimitive<BaseFieldGroupIconProps, 'div'>;
@@ -2,4 +2,4 @@ import { BaseRadioGroupFieldProps, ForwardRefPrimitive } from '../types';
2
2
  /**
3
3
  * [📖 Docs](https://ui.docs.amplify.aws/react/components/radiogroupfield)
4
4
  */
5
- export declare const RadioGroupField: ForwardRefPrimitive<BaseRadioGroupFieldProps, 'div'>;
5
+ export declare const RadioGroupField: ForwardRefPrimitive<BaseRadioGroupFieldProps, 'fieldset'>;
@@ -16,7 +16,7 @@ interface UseStepper extends Required<Pick<StepperFieldProps, 'step' | 'value'>>
16
16
  shouldDisableDecreaseButton: boolean;
17
17
  shouldDisableIncreaseButton: boolean;
18
18
  }
19
- export declare const useStepper: ({ defaultValue, value: controlledValue, step, max, min, isDisabled, isReadOnly, onChange, onDecrease, onIncrease, onStepChange, }: Omit<import("..").PrimitivePropsWithAs<import("../types/stepperField").BaseStepperFieldProps, "input">, "ref"> & React.RefAttributes<HTMLInputElement> & Omit<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "as" | keyof React.RefAttributes<HTMLInputElement> | keyof import("../types/stepperField").BaseStepperFieldProps> & {
19
+ export declare const useStepper: ({ defaultValue, value: controlledValue, step, max, min, isDisabled, isReadOnly, onChange, onDecrease, onIncrease, onStepChange, }: Omit<import("..").PrimitivePropsWithAs<import("../types/stepperField").BaseStepperFieldProps, "input">, "ref"> & React.RefAttributes<HTMLInputElement> & Omit<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "as" | keyof React.RefAttributes<React.ComponentRef<Element_1>> | keyof import("../types/stepperField").BaseStepperFieldProps> & {
20
20
  onChange?: ChangeHandler | undefined;
21
21
  }) => UseStepper;
22
22
  export {};
@@ -19,4 +19,4 @@ export interface BaseRadioGroupFieldProps extends BaseFieldProps, FlexContainerS
19
19
  */
20
20
  labelPosition?: LabelPositions;
21
21
  }
22
- export type RadioGroupFieldProps<Element extends ElementType = 'input'> = PrimitiveProps<BaseRadioGroupFieldProps, Element>;
22
+ export type RadioGroupFieldProps<Element extends ElementType = 'fieldset'> = PrimitiveProps<BaseRadioGroupFieldProps, Element>;
@@ -72,4 +72,4 @@ export interface BaseSwitchFieldProps extends BaseInputProps, BaseFieldProps, Ba
72
72
  */
73
73
  value?: string | number;
74
74
  }
75
- export type SwitchFieldProps<Element extends ElementType = 'input'> = PrimitiveProps<BaseSwitchFieldProps, Element>;
75
+ export type SwitchFieldProps<Element extends ElementType = 'div'> = PrimitiveProps<BaseSwitchFieldProps, Element>;
@@ -12,8 +12,15 @@ type AsProp<Element extends ElementType> = {
12
12
  as?: Element;
13
13
  };
14
14
  export type PrimitivePropsWithAs<Props extends BaseViewProps, Element extends ElementType> = Omit<Props, 'as'> & AsProp<Element>;
15
- type PrimitivePropsWithRef<Props extends BaseViewProps, Element extends ElementType> = Omit<Props, 'ref'> & (IsAny<Element> extends false ? React.RefAttributes<React.ComponentRef<Element>> : React.RefAttributes<any>);
16
- export type PrimitivePropsWithHTMLAttributes<Props extends BaseViewProps, Element extends ElementType> = MergeProps<PrimitivePropsWithRef<Props, Element>, React.ComponentPropsWithoutRef<Element>>;
15
+ type PrimitivePropsWithRef<Props extends BaseViewProps, Element extends ElementType> = Omit<Props, 'ref'> & React.RefAttributes<React.ComponentRef<Element>>;
16
+ export type PrimitivePropsWithHTMLAttributes<Props extends BaseViewProps, Element extends ElementType> =
17
+ /**
18
+ * Doing an IsAny<Element> conditional check here makes sure typescript infers the type of `Element`.
19
+ * Without this check Typescript won't do an additional inference phase for the generics `Element`,
20
+ * and simply treat it as any, which in turn affects other the inference for other types.
21
+ * e.g. In an event handler, onChange((event) => { console.log(event)}), event will be implicitly inferred as any without the check
22
+ */
23
+ IsAny<Element> extends false ? MergeProps<PrimitivePropsWithRef<Props, Element>, React.ComponentPropsWithoutRef<Element>> : any;
17
24
  export type PrimitiveProps<Props extends BaseViewProps, Element extends ElementType> = PrimitivePropsWithHTMLAttributes<PrimitivePropsWithAs<Props, Element>, Element>;
18
25
  export type Primitive<Props extends BaseViewProps, Element extends ElementType> = React.ForwardRefRenderFunction<React.ComponentRef<Element>, Props>;
19
26
  export interface ForwardRefPrimitive<Props extends BaseViewProps, DefaultElement extends ElementType> extends React.ForwardRefExoticComponent<Props> {
@@ -1 +1 @@
1
- export declare const VERSION = "5.0.3";
1
+ export declare const VERSION = "5.0.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -86,7 +86,7 @@
86
86
  "@types/react": "^17.0.2",
87
87
  "@types/testing-library__jest-dom": "^5.14.1",
88
88
  "esbuild-register": "^3.3.3",
89
- "eslint": "^8.13.0",
89
+ "eslint": "^8.44.0",
90
90
  "jest": "^27.0.4",
91
91
  "jest-matchmedia-mock": "^1.1.0",
92
92
  "react": "^17.0.2",