@axa-fr/design-system-look-and-feel-react 0.3.0-ci.289 → 0.3.0-ci.291

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,10 @@
1
- import { ComponentPropsWithoutRef, PropsWithChildren } from "react";
2
- import "@axa-fr/design-system-look-and-feel-css/dist/Link/Link.scss";
1
+ import { ComponentPropsWithoutRef, PropsWithChildren, type ReactNode } from "react";
3
2
  type LinkProps = {
4
3
  openInNewTab?: boolean;
4
+ leftIcon?: ReactNode;
5
+ rightIcon?: ReactNode;
6
+ className?: string;
7
+ classModifier?: string;
5
8
  } & ComponentPropsWithoutRef<"a">;
6
- export declare const Link: ({ href, openInNewTab, children, ...props }: PropsWithChildren<LinkProps>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const Link: ({ href, openInNewTab, leftIcon, rightIcon, children, className, classModifier, ...props }: PropsWithChildren<LinkProps>) => import("react/jsx-runtime").JSX.Element;
7
10
  export {};
package/dist/Link/Link.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import "@axa-fr/design-system-look-and-feel-css/dist/Link/Link.scss";
3
2
  import openInNew from "@material-symbols/svg-400/outlined/open_in_new.svg";
3
+ import { useMemo, } from "react";
4
4
  import { Svg } from "../Svg";
5
- export const Link = ({ href, openInNewTab, children, ...props }) => {
5
+ import { getComponentClassName } from "../utilities";
6
+ export const Link = ({ href, openInNewTab = false, leftIcon, rightIcon, children, className, classModifier = "", ...props }) => {
6
7
  const newTabProps = openInNewTab && {
7
8
  target: "_blank",
8
9
  rel: "noopener noreferrer",
9
10
  };
10
- return (_jsxs("a", { className: `af-link ${openInNewTab ? " af-link--openInNewTab" : ""}`, href: href, ...newTabProps, ...props, children: [children, newTabProps && _jsx(Svg, { src: openInNew })] }));
11
+ const componentClassName = useMemo(() => getComponentClassName(className, `${classModifier}${!className && openInNewTab ? " openInNewTab" : ""}`, "af-link"), [classModifier, className, openInNewTab]);
12
+ return (_jsxs("a", { className: componentClassName, href: href, ...newTabProps, ...props, children: [leftIcon, children, (openInNewTab || Boolean(rightIcon)) &&
13
+ (rightIcon ?? _jsx(Svg, { src: openInNew }))] }));
11
14
  };
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-look-and-feel-css/dist/Link/Link.scss";
2
+ export { Link } from "./Link";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-look-and-feel-css/dist/Link/Link.scss";
2
+ export { Link } from "./Link";
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import { TitleSize, TitleLevel } from "./constants";
2
+ import { TitleLevel, TitleSize } from "./constants";
3
3
  type TitleProps = {
4
4
  children: ReactNode;
5
5
  firstSubtitle?: string;
@@ -6,6 +6,6 @@ import { TitleSize } from "./constants";
6
6
  import { TitleWithSubtitles } from "./TitleWithSubtitles";
7
7
  export const Title = ({ children: title, className, classModifier, firstSubtitle, icon, secondSubtitle, size = TitleSize.XL, level = size === TitleSize.L ? 2 : 1, }) => {
8
8
  const componentClassName = useMemo(() => getComponentClassName(className, classModifier ? `${classModifier} ${size}` : size, "af-title"), [classModifier, className, size]);
9
- const TitleWithSubtitlesPart = useCallback(({ ...args }) => (_jsx(TitleWithSubtitles, { title: title, firstSubtitle: firstSubtitle, ...args })), [title, firstSubtitle]);
10
- return (_jsx("div", { className: componentClassName, children: icon && size === TitleSize.XL ? (_jsxs(_Fragment, { children: [_jsx(IconBg, { className: "af-title__icon af-icon-bg", children: icon }), _jsx("div", { className: "af-title__text-container", children: _jsx(TitleWithSubtitlesPart, { secondSubtitle: secondSubtitle, level: level }) })] })) : (_jsx(TitleWithSubtitlesPart, { level: level })) }));
9
+ const TitleWithSubtitlesPart = useCallback(({ ...args }) => (_jsx(TitleWithSubtitles, { title: title, firstSubtitle: firstSubtitle, level: level, ...args })), [title, firstSubtitle, level]);
10
+ return (_jsx("header", { className: componentClassName, children: icon && size === TitleSize.XL ? (_jsxs(_Fragment, { children: [_jsx(IconBg, { className: "af-title__icon af-icon-bg", children: icon }), _jsx(TitleWithSubtitlesPart, { secondSubtitle: secondSubtitle })] })) : (_jsx(TitleWithSubtitlesPart, {})) }));
11
11
  };
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import { TitleLevel } from "./constants";
2
+ import type { TitleLevel } from ".";
3
3
  type TitleTextProps = {
4
4
  title: ReactNode;
5
5
  firstSubtitle?: string;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
2
  export const TitleWithSubtitles = ({ title, firstSubtitle, secondSubtitle, level = 1, }) => {
4
- const HLevel = useMemo(() => `h${level}`, [level]);
3
+ const HLevel = `h${level}`;
5
4
  return (_jsxs(_Fragment, { children: [_jsx(HLevel, { className: "af-title__title", children: title }), firstSubtitle && (_jsx("span", { className: "af-title__subtitle", children: firstSubtitle })), secondSubtitle && (_jsx("span", { className: "af-title__subtitle", children: secondSubtitle }))] }));
6
5
  };
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export { Text as TextInput } from "./Form/Text";
14
14
  export { IconBg } from "./IconBg";
15
15
  export { Footer } from "./Layout/Footer/Footer";
16
16
  export { Header } from "./Layout/Header";
17
- export { Link } from "./Link/Link";
17
+ export { Link } from "./Link";
18
18
  export { List } from "./List";
19
19
  export { ClickItem, ClickList } from "./List/ClickList";
20
20
  export { ContentItemDuo } from "./List/ContentItemDuo";
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export { Text as TextInput } from "./Form/Text";
13
13
  export { IconBg } from "./IconBg";
14
14
  export { Footer } from "./Layout/Footer/Footer";
15
15
  export { Header } from "./Layout/Header";
16
- export { Link } from "./Link/Link";
16
+ export { Link } from "./Link";
17
17
  export { List } from "./List";
18
18
  export { ClickItem, ClickList } from "./List/ClickList";
19
19
  export { ContentItemDuo } from "./List/ContentItemDuo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-look-and-feel-react",
3
- "version": "0.3.0-ci.289",
3
+ "version": "0.3.0-ci.291",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
47
  "peerDependencies": {
48
- "@axa-fr/design-system-look-and-feel-css": "0.3.0-ci.289",
48
+ "@axa-fr/design-system-look-and-feel-css": "0.3.0-ci.291",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "react": ">= 18"
51
51
  },