@axa-fr/canopee-react 2.0.1-alpha.6 → 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/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/package.json +2 -2
|
@@ -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] }));
|
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"
|