@amboss/design-system 1.7.3 → 1.8.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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/src/components/Button/Button.d.ts +3 -6
- package/build/src/components/Link/Link.d.ts +2 -2
- package/build/src/components/PictogramButton/PictogramButton.d.ts +4 -5
- package/build/src/types/index.d.ts +5 -3
- package/package.json +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { AriaAttributes } from "react";
|
|
2
2
|
import { IconName } from "../Icon/Icon";
|
|
3
|
-
import { BaseVariations, ButtonSize, HorizontalAlignment, TextVariations,
|
|
3
|
+
import { BaseVariations, ButtonSize, HorizontalAlignment, TextVariations, PolymorphicComponentPropsWithRef } from "../../types";
|
|
4
4
|
declare type ButtonPrivateProps = {
|
|
5
5
|
squareCorners?: boolean | ("TopLeft" | "TopRight" | "BottomLeft" | "BottomRight")[];
|
|
6
6
|
alignItems?: HorizontalAlignment;
|
|
7
7
|
rightIconVariant?: TextVariations;
|
|
8
8
|
};
|
|
9
9
|
export declare type ButtonProps = {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
10
|
variant?: BaseVariations;
|
|
12
11
|
size?: ButtonSize;
|
|
13
12
|
/** Type is ignored if "a" is provided to "as" property. Note that you can explicetly pass null. */
|
|
@@ -27,8 +26,6 @@ export declare type ButtonProps = {
|
|
|
27
26
|
*/
|
|
28
27
|
ariaAttributes?: AriaAttributes;
|
|
29
28
|
};
|
|
30
|
-
|
|
31
|
-
export declare
|
|
32
|
-
var defaultProps: Partial<ButtonProps> & AsProp<"button">;
|
|
33
|
-
}
|
|
29
|
+
declare type ButtonComponent = <C extends React.ElementType = "button">(props: PolymorphicComponentPropsWithRef<C, ButtonProps>) => React.ReactElement | null;
|
|
30
|
+
export declare const Button: ButtonComponent;
|
|
34
31
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { LinkVariations, LinkTextSize,
|
|
2
|
+
import { LinkVariations, LinkTextSize, PolymorphicComponentProps, AsProp } from "../../types";
|
|
3
3
|
declare type LinkProps = {
|
|
4
4
|
size?: LinkTextSize;
|
|
5
5
|
weight?: "normal" | "bold" | "inherit";
|
|
@@ -7,7 +7,7 @@ declare type LinkProps = {
|
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
"data-e2e-test-id"?: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function Link<C extends React.ElementType = "a">({ children, size, weight, variant, "data-e2e-test-id": dataE2eTestId, ...rest }:
|
|
10
|
+
export declare function Link<C extends React.ElementType = "a">({ children, size, weight, variant, "data-e2e-test-id": dataE2eTestId, ...rest }: PolymorphicComponentProps<C, LinkProps>): React.ReactElement;
|
|
11
11
|
export declare namespace Link {
|
|
12
12
|
var defaultProps: Partial<LinkProps> & AsProp<"a">;
|
|
13
13
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IconName } from "../Icon/Icon";
|
|
3
3
|
import { ButtonProps } from "../Button/Button";
|
|
4
|
-
import {
|
|
4
|
+
import { PolymorphicComponentPropsWithRef } from "../../types";
|
|
5
5
|
export declare type PictogramButtonProps = Pick<ButtonProps, "variant" | "type" | "disabled" | "onClick" | "onFocus" | "onBlur" | "data-e2e-test-id"> & {
|
|
6
6
|
/** The centered icon to be displayed. */
|
|
7
7
|
icon: IconName;
|
|
8
8
|
/** If true, the button has square corners. */
|
|
9
9
|
squareCorners?: boolean;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
}
|
|
11
|
+
declare type PictogramButtonComponent = <C extends React.ElementType = "button">(props: PolymorphicComponentPropsWithRef<C, PictogramButtonProps>) => React.ReactElement | null;
|
|
12
|
+
export declare const PictogramButton: PictogramButtonComponent;
|
|
13
|
+
export {};
|
|
@@ -39,7 +39,9 @@ export declare type AsProp<C extends React.ElementType> = {
|
|
|
39
39
|
as?: C;
|
|
40
40
|
};
|
|
41
41
|
declare type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
|
|
42
|
-
export declare type
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
export declare type PolymorphicComponentProps<C extends React.ElementType, Props> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
43
|
+
export declare type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>["ref"];
|
|
44
|
+
export declare type PolymorphicComponentPropsWithRef<C extends React.ElementType, Props> = PolymorphicComponentProps<C, Props> & {
|
|
45
|
+
ref?: PolymorphicRef<C>;
|
|
46
|
+
};
|
|
45
47
|
export {};
|