@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.
@@ -1,2 +1,3 @@
1
+ import "@axa-fr/canopee-css/prospect/Button/ButtonApollo.css";
1
2
  import "@axa-fr/canopee-css/prospect/Link/LinkApollo.css";
2
3
  export { Link, type LinkVariants, linkVariants, type LinkProps, } from "./LinkCommon";
@@ -1,2 +1,3 @@
1
+ import "@axa-fr/canopee-css/prospect/Button/ButtonApollo.css";
1
2
  import "@axa-fr/canopee-css/prospect/Link/LinkApollo.css";
2
3
  export { Link, linkVariants, } from "./LinkCommon";
@@ -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: [variant, openInNewTab && "openInNewTab"],
17
- className,
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] }));
@@ -1,2 +1,3 @@
1
+ import "@axa-fr/canopee-css/client/Button/ButtonLF.css";
1
2
  import "@axa-fr/canopee-css/client/Link/LinkLF.css";
2
3
  export { Link, type LinkVariants, linkVariants, type LinkProps, } from "./LinkCommon";
@@ -1,2 +1,3 @@
1
+ import "@axa-fr/canopee-css/client/Button/ButtonLF.css";
1
2
  import "@axa-fr/canopee-css/client/Link/LinkLF.css";
2
3
  export { Link, linkVariants, } from "./LinkCommon";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "2.0.1-alpha.6",
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.6",
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"