@amboss/design-system 1.7.0 → 1.7.2
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 +4 -5
- package/build/src/components/Link/Link.d.ts +7 -58
- package/build/src/components/PictogramButton/PictogramButton.d.ts +4 -3
- package/build/src/components/RoundButton/RoundButton.d.ts +4 -3
- package/build/src/types/index.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { AriaAttributes } from "react";
|
|
2
2
|
import { IconName } from "../Icon/Icon";
|
|
3
|
-
import { BaseVariations, ButtonSize, HorizontalAlignment, TextVariations } from "../../types";
|
|
3
|
+
import { BaseVariations, ButtonSize, HorizontalAlignment, TextVariations, PolymorphicComponentProp, AsProp } 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
|
-
export declare type ButtonProps =
|
|
9
|
+
export declare type ButtonProps = {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
variant?: BaseVariations;
|
|
12
12
|
size?: ButtonSize;
|
|
@@ -18,7 +18,6 @@ export declare type ButtonProps = Record<string, unknown> & {
|
|
|
18
18
|
onClick?: (e: React.MouseEvent) => void;
|
|
19
19
|
onFocus?: (e: React.FocusEvent) => void;
|
|
20
20
|
onBlur?: (e: React.FocusEvent) => void;
|
|
21
|
-
as?: "a" | "button" | React.ComponentType;
|
|
22
21
|
leftIcon?: IconName;
|
|
23
22
|
rightIcon?: IconName;
|
|
24
23
|
fullWidth?: boolean;
|
|
@@ -28,8 +27,8 @@ export declare type ButtonProps = Record<string, unknown> & {
|
|
|
28
27
|
*/
|
|
29
28
|
ariaAttributes?: AriaAttributes;
|
|
30
29
|
};
|
|
31
|
-
export declare function Button({ "data-e2e-test-id": dataE2eTestId, ariaAttributes, as, children, disabled, fullWidth, leftIcon, loading, onBlur, onClick, onFocus, privateProps: { squareCorners, alignItems, rightIconVariant }, rightIcon, size, type, variant, ...rest }: ButtonProps): React.ReactElement;
|
|
30
|
+
export declare function Button<C extends React.ElementType = "button">({ "data-e2e-test-id": dataE2eTestId, ariaAttributes, as, children, disabled, fullWidth, leftIcon, loading, onBlur, onClick, onFocus, privateProps: { squareCorners, alignItems, rightIconVariant }, rightIcon, size, type, variant, ...rest }: PolymorphicComponentProp<C, ButtonProps>): React.ReactElement;
|
|
32
31
|
export declare namespace Button {
|
|
33
|
-
var defaultProps: Partial<ButtonProps>;
|
|
32
|
+
var defaultProps: Partial<ButtonProps> & AsProp<"button">;
|
|
34
33
|
}
|
|
35
34
|
export {};
|
|
@@ -1,65 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { LinkVariations, LinkTextSize } from "../../types";
|
|
3
|
-
declare type
|
|
4
|
-
declare type NoTargetNoRel = {
|
|
5
|
-
target?: never;
|
|
6
|
-
rel?: never;
|
|
7
|
-
};
|
|
8
|
-
declare type LinkPropsExtended = {
|
|
9
|
-
as?: "a";
|
|
10
|
-
href: string;
|
|
11
|
-
onClick?: never;
|
|
12
|
-
to?: never;
|
|
13
|
-
} & ({
|
|
14
|
-
target: "_blank";
|
|
15
|
-
rel: "noopener noreferrer";
|
|
16
|
-
} | NoTargetNoRel);
|
|
17
|
-
declare type LinkAsButtonProps = {
|
|
18
|
-
as: "button";
|
|
19
|
-
onClick: (e: React.MouseEvent) => void;
|
|
20
|
-
href?: never;
|
|
21
|
-
to?: never;
|
|
22
|
-
} & NoTargetNoRel;
|
|
23
|
-
declare type RouterLinkProps = {
|
|
24
|
-
as: React.ComponentType;
|
|
25
|
-
to: string;
|
|
26
|
-
onClick?: never;
|
|
27
|
-
href?: never;
|
|
28
|
-
} & NoTargetNoRel;
|
|
29
|
-
declare type LinkProps = Record<string, unknown> & {
|
|
30
|
-
children: string;
|
|
2
|
+
import { LinkVariations, LinkTextSize, PolymorphicComponentProp, AsProp } from "../../types";
|
|
3
|
+
declare type LinkProps = {
|
|
31
4
|
size?: LinkTextSize;
|
|
32
|
-
weight?:
|
|
5
|
+
weight?: "normal" | "bold" | "inherit";
|
|
33
6
|
variant?: LinkVariations;
|
|
7
|
+
onClick?: () => void;
|
|
34
8
|
"data-e2e-test-id"?: string;
|
|
35
|
-
}
|
|
36
|
-
export declare function Link({ children, size, weight, variant, "data-e2e-test-id": dataE2eTestId, ...rest }: LinkProps): React.ReactElement;
|
|
9
|
+
};
|
|
10
|
+
export declare function Link<C extends React.ElementType = "a">({ children, size, weight, variant, "data-e2e-test-id": dataE2eTestId, ...rest }: PolymorphicComponentProp<C, LinkProps>): React.ReactElement;
|
|
37
11
|
export declare namespace Link {
|
|
38
|
-
var defaultProps: Partial<
|
|
39
|
-
children: string;
|
|
40
|
-
size?: "xs" | "s" | "m" | "l";
|
|
41
|
-
weight?: FontWeight;
|
|
42
|
-
variant?: "primary" | "secondary" | "tertiary";
|
|
43
|
-
"data-e2e-test-id"?: string;
|
|
44
|
-
} & {
|
|
45
|
-
as?: "a";
|
|
46
|
-
href: string;
|
|
47
|
-
onClick?: never;
|
|
48
|
-
to?: never;
|
|
49
|
-
} & NoTargetNoRel> | Partial<Record<string, unknown> & {
|
|
50
|
-
children: string;
|
|
51
|
-
size?: "xs" | "s" | "m" | "l";
|
|
52
|
-
weight?: FontWeight;
|
|
53
|
-
variant?: "primary" | "secondary" | "tertiary";
|
|
54
|
-
"data-e2e-test-id"?: string;
|
|
55
|
-
} & {
|
|
56
|
-
as?: "a";
|
|
57
|
-
href: string;
|
|
58
|
-
onClick?: never;
|
|
59
|
-
to?: never;
|
|
60
|
-
} & {
|
|
61
|
-
target: "_blank";
|
|
62
|
-
rel: "noopener noreferrer";
|
|
63
|
-
}>;
|
|
12
|
+
var defaultProps: Partial<LinkProps> & AsProp<"a">;
|
|
64
13
|
}
|
|
65
14
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IconName } from "../Icon/Icon";
|
|
3
3
|
import { ButtonProps } from "../Button/Button";
|
|
4
|
-
|
|
4
|
+
import { AsProp } from "../../types";
|
|
5
|
+
export declare type PictogramButtonProps = Pick<ButtonProps, "variant" | "type" | "disabled" | "onClick" | "onFocus" | "onBlur" | "data-e2e-test-id"> & {
|
|
5
6
|
/** The centered icon to be displayed. */
|
|
6
7
|
icon: IconName;
|
|
7
8
|
/** If true, the button has square corners. */
|
|
8
9
|
squareCorners?: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare function PictogramButton({ onClick, onFocus, onBlur, type, disabled, as, icon, "data-e2e-test-id": dataE2eTestId, ...rest }: PictogramButtonProps): React.ReactElement;
|
|
11
|
+
export declare function PictogramButton<C extends React.ElementType = "button">({ onClick, onFocus, onBlur, type, disabled, as, icon, "data-e2e-test-id": dataE2eTestId, ...rest }: PictogramButtonProps & AsProp<C>): React.ReactElement;
|
|
11
12
|
export declare namespace PictogramButton {
|
|
12
|
-
var defaultProps: Partial<PictogramButtonProps>;
|
|
13
|
+
var defaultProps: Partial<PictogramButtonProps> & AsProp<"button">;
|
|
13
14
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IconName } from "../Icon/Icon";
|
|
3
3
|
import { ButtonProps } from "../Button/Button";
|
|
4
|
-
|
|
4
|
+
import { AsProp } from "../../types";
|
|
5
|
+
export declare type RoundButtonProps = Pick<ButtonProps, "variant" | "type" | "disabled" | "onClick" | "onFocus" | "onBlur" | "data-e2e-test-id"> & {
|
|
5
6
|
/** The centered icon to be displayed. */
|
|
6
7
|
icon: IconName;
|
|
7
8
|
};
|
|
8
|
-
export declare function RoundButton({ onClick, onFocus, onBlur, type, disabled, as, icon, "data-e2e-test-id": dataE2eTestId, ...rest }: RoundButtonProps): React.ReactElement;
|
|
9
|
+
export declare function RoundButton<C extends React.ElementType = "button">({ onClick, onFocus, onBlur, type, disabled, as, icon, "data-e2e-test-id": dataE2eTestId, ...rest }: RoundButtonProps & AsProp<C>): React.ReactElement;
|
|
9
10
|
export declare namespace RoundButton {
|
|
10
|
-
var defaultProps: Partial<RoundButtonProps>;
|
|
11
|
+
var defaultProps: Partial<RoundButtonProps> & AsProp<"button">;
|
|
11
12
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Literal, Union, Static } from "runtypes";
|
|
2
3
|
export declare const LinkTextSizeRuntype: Union<[Literal<"xs">, Literal<"s">, Literal<"m">, Literal<"l">]>;
|
|
3
4
|
export declare type LinkTextSize = Static<typeof LinkTextSizeRuntype>;
|
|
@@ -34,4 +35,11 @@ export declare const HyphensRuntype: Union<[Literal<"auto">, Literal<"none">, Li
|
|
|
34
35
|
export declare type Hyphens = Static<typeof HyphensRuntype>;
|
|
35
36
|
export declare const ToggleSizeRuntype: Union<[Literal<"s">, Literal<"m">]>;
|
|
36
37
|
export declare type ToggleSize = Static<typeof ToggleSizeRuntype>;
|
|
38
|
+
export declare type AsProp<C extends React.ElementType> = {
|
|
39
|
+
as?: C;
|
|
40
|
+
};
|
|
41
|
+
declare type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
|
|
42
|
+
export declare type PolymorphicComponentProp<C extends React.ElementType, Props = {
|
|
43
|
+
as: "a";
|
|
44
|
+
}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
37
45
|
export {};
|