@axa-fr/canopee-react 1.3.1-alpha.17 → 1.3.1-alpha.18
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,7 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, PropsWithChildren, type ReactNode } from "react";
|
|
2
2
|
export declare const linkVariants: {
|
|
3
|
-
readonly default: "default";
|
|
4
|
-
readonly underline: "underline";
|
|
5
3
|
readonly inverse: "inverse";
|
|
6
4
|
};
|
|
7
5
|
export type LinkVariants = keyof typeof linkVariants;
|
|
@@ -11,6 +9,9 @@ type LinkProps = {
|
|
|
11
9
|
leftIcon?: ReactNode;
|
|
12
10
|
rightIcon?: ReactNode;
|
|
13
11
|
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use variant instead
|
|
14
|
+
*/
|
|
14
15
|
classModifier?: string;
|
|
15
16
|
} & ComponentPropsWithoutRef<"a">;
|
|
16
17
|
export declare const Link: ({ href, variant, openInNewTab, leftIcon, rightIcon, children, className, classModifier, ...props }: PropsWithChildren<LinkProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import openInNew from "@material-symbols/svg-400/outlined/open_in_new.svg";
|
|
3
|
-
import { useMemo, } from "react";
|
|
4
3
|
import { Svg } from "../Svg/Svg";
|
|
5
|
-
import {
|
|
4
|
+
import { getClassName } from "../utilities/getClassName";
|
|
6
5
|
export const linkVariants = {
|
|
7
|
-
default: "default",
|
|
8
|
-
underline: "underline",
|
|
9
6
|
inverse: "inverse",
|
|
10
7
|
};
|
|
11
|
-
export const Link = ({ href, variant
|
|
8
|
+
export const Link = ({ href, variant, openInNewTab = false, leftIcon, rightIcon, children, className, classModifier = "", ...props }) => {
|
|
12
9
|
const newTabProps = openInNewTab && {
|
|
13
10
|
target: "_blank",
|
|
14
11
|
rel: "noopener noreferrer",
|
|
15
12
|
};
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
return (_jsxs("a", { className: getClassName({
|
|
14
|
+
baseClassName: "af-link",
|
|
15
|
+
modifiers: [classModifier, variant, openInNewTab && "openInNewTab"],
|
|
16
|
+
className,
|
|
17
|
+
}), href: href, ...newTabProps, ...props, children: [leftIcon, children, openInNewTab || Boolean(rightIcon)
|
|
18
18
|
? (rightIcon ?? _jsx(Svg, { src: openInNew }))
|
|
19
19
|
: null] }));
|
|
20
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/canopee-react",
|
|
3
|
-
"version": "1.3.1-alpha.
|
|
3
|
+
"version": "1.3.1-alpha.18",
|
|
4
4
|
"description": "Package React - Design System Canopée",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./distributeur": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@axa-fr/canopee-css": "1.3.1-alpha.
|
|
48
|
+
"@axa-fr/canopee-css": "1.3.1-alpha.18",
|
|
49
49
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
50
50
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
51
51
|
"react": ">= 18"
|