@axa-fr/canopee-react 2.0.1-alpha.3 → 2.0.1-alpha.8
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/prospect-client/Card/CardCommon.d.ts +4 -1
- package/dist/prospect-client/Card/CardCommon.js +2 -1
- package/dist/prospect-client/Link/LinkApollo.d.ts +1 -0
- package/dist/prospect-client/Link/LinkApollo.js +1 -0
- package/dist/prospect-client/Link/LinkCommon.d.ts +7 -0
- package/dist/prospect-client/Link/LinkCommon.js +17 -2
- package/dist/prospect-client/Link/LinkLF.d.ts +1 -0
- package/dist/prospect-client/Link/LinkLF.js +1 -0
- package/dist/prospect-client/utilities/types/Permutations.d.ts +1 -0
- package/dist/prospect-client/utilities/types/Permutations.js +1 -0
- package/package.json +2 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ComponentProps, ElementType } from "react";
|
|
2
2
|
import { type PolymorphicComponent } from "../utilities/types/PolymorphicComponent";
|
|
3
|
+
import type { Permutations } from "../utilities/types/Permutations";
|
|
3
4
|
export declare const cardVariants: {
|
|
4
5
|
readonly unstyled: "unstyled";
|
|
6
|
+
readonly vertical: "vertical";
|
|
5
7
|
};
|
|
6
8
|
export type CardVariants = keyof typeof cardVariants;
|
|
7
9
|
/**
|
|
@@ -13,8 +15,9 @@ export type CardCommonProps<T extends ElementType> = PolymorphicComponent<T, Com
|
|
|
13
15
|
/**
|
|
14
16
|
* Visual variant of the card.
|
|
15
17
|
* - `"unstyled"` — removes border and padding.
|
|
18
|
+
* - `"vertical"` — displays the card content in a vertical layout.
|
|
16
19
|
*/
|
|
17
|
-
variant?: CardVariants
|
|
20
|
+
variant?: Permutations<CardVariants>;
|
|
18
21
|
}>;
|
|
19
22
|
/**
|
|
20
23
|
* Polymorphic card wrapper that adds padding and a border.
|
|
@@ -3,6 +3,7 @@ import {} from "../utilities/types/PolymorphicComponent";
|
|
|
3
3
|
import { getClassName } from "../utilities/getClassName";
|
|
4
4
|
export const cardVariants = {
|
|
5
5
|
unstyled: "unstyled",
|
|
6
|
+
vertical: "vertical",
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
9
|
* Polymorphic card wrapper that adds padding and a border.
|
|
@@ -21,7 +22,7 @@ export const CardCommon = ({ as, children, className, variant, ...props }) => {
|
|
|
21
22
|
const Component = as || "div";
|
|
22
23
|
return (_jsx(Component, { className: getClassName({
|
|
23
24
|
baseClassName: "af-card",
|
|
24
|
-
modifiers:
|
|
25
|
+
modifiers: variant?.split(" "),
|
|
25
26
|
className,
|
|
26
27
|
}), ...props, children: children }));
|
|
27
28
|
};
|
|
@@ -2,6 +2,13 @@ import type { ElementType, ReactNode } from "react";
|
|
|
2
2
|
import type { PolymorphicComponent } from "../utilities/types/PolymorphicComponent";
|
|
3
3
|
export declare const linkVariants: {
|
|
4
4
|
readonly inverse: "inverse";
|
|
5
|
+
readonly "button-primary": "button-primary";
|
|
6
|
+
readonly "button-primary-business": "button-primary-business";
|
|
7
|
+
readonly "button-primary-inverse": "button-primary-inverse";
|
|
8
|
+
readonly "button-secondary": "button-secondary";
|
|
9
|
+
readonly "button-secondary-inverse": "button-secondary-inverse";
|
|
10
|
+
readonly "button-tertiary": "button-tertiary";
|
|
11
|
+
readonly "button-ghost": "button-ghost";
|
|
5
12
|
};
|
|
6
13
|
export type LinkVariants = keyof typeof linkVariants;
|
|
7
14
|
export type LinkProps<T extends ElementType = "a"> = PolymorphicComponent<T, {
|
|
@@ -4,17 +4,32 @@ import { Svg } from "../Svg/Svg";
|
|
|
4
4
|
import { getClassName } from "../utilities/getClassName";
|
|
5
5
|
export const linkVariants = {
|
|
6
6
|
inverse: "inverse",
|
|
7
|
+
"button-primary": "button-primary",
|
|
8
|
+
"button-primary-business": "button-primary-business",
|
|
9
|
+
"button-primary-inverse": "button-primary-inverse",
|
|
10
|
+
"button-secondary": "button-secondary",
|
|
11
|
+
"button-secondary-inverse": "button-secondary-inverse",
|
|
12
|
+
"button-tertiary": "button-tertiary",
|
|
13
|
+
"button-ghost": "button-ghost",
|
|
7
14
|
};
|
|
15
|
+
const BUTTON_VARIANT_PREFIX = "button-";
|
|
16
|
+
const getButtonClassName = (variant) => variant?.startsWith(BUTTON_VARIANT_PREFIX)
|
|
17
|
+
? `af-btn-client af-btn-client--${variant.slice(BUTTON_VARIANT_PREFIX.length)}`
|
|
18
|
+
: undefined;
|
|
8
19
|
export const Link = ({ as, variant, openInNewTab = false, leftIcon, rightIcon, children, className, ...props }) => {
|
|
9
20
|
const Component = as ?? "a";
|
|
10
21
|
const newTabProps = openInNewTab && {
|
|
11
22
|
target: "_blank",
|
|
12
23
|
rel: "noopener noreferrer",
|
|
13
24
|
};
|
|
25
|
+
const buttonClassName = getButtonClassName(variant);
|
|
14
26
|
return (_jsxs(Component, { className: getClassName({
|
|
15
27
|
baseClassName: "af-link",
|
|
16
|
-
modifiers: [
|
|
17
|
-
|
|
28
|
+
modifiers: [
|
|
29
|
+
buttonClassName ? undefined : variant,
|
|
30
|
+
openInNewTab && "openInNewTab",
|
|
31
|
+
],
|
|
32
|
+
className: [buttonClassName, className].filter(Boolean).join(" "),
|
|
18
33
|
}), ...newTabProps, ...props, children: [leftIcon, children, openInNewTab || Boolean(rightIcon)
|
|
19
34
|
? (rightIcon ?? _jsx(Svg, { src: openInNew }))
|
|
20
35
|
: null] }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Permutations<T extends string, U extends string = T> = T extends unknown ? T | `${T} ${Permutations<Exclude<U, T>>}` : never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/canopee-react",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.8",
|
|
4
4
|
"description": "Package React - Design System Canopée",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./distributeur": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@axa-fr/canopee-css": "2.0.1-alpha.
|
|
56
|
+
"@axa-fr/canopee-css": "2.0.1-alpha.8",
|
|
57
57
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
58
58
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
59
59
|
"react": ">= 19"
|