@axa-fr/design-system-slash-react 1.2.1-alpha.105 → 1.2.1-alpha.107
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.
|
@@ -2,15 +2,37 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/AnchorNavBar/AnchorNavBar.css";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
4
4
|
export type AnchorNavBarItem = {
|
|
5
|
+
/**
|
|
6
|
+
* name - The display name of the navigation item.
|
|
7
|
+
*/
|
|
5
8
|
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* isActive - If true, the item is highlighted as active.
|
|
11
|
+
*/
|
|
6
12
|
isActive?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* onClick - Optional click handler for the navigation item.
|
|
15
|
+
*/
|
|
7
16
|
onClick?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* link - The URL or anchor to navigate to when the item is clicked.
|
|
19
|
+
*/
|
|
8
20
|
link?: string;
|
|
21
|
+
/**
|
|
22
|
+
* externalLink - If true, the link will open in a new tab and show an external link icon.
|
|
23
|
+
*/
|
|
9
24
|
externalLink?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* render - Optional custom render function for the navigation item. If provided, it overrides the default rendering.
|
|
27
|
+
*/
|
|
10
28
|
render?: (props: {
|
|
11
29
|
className: string;
|
|
12
30
|
}) => ReactNode;
|
|
13
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Props for the AnchorNavBar component.
|
|
34
|
+
* items - An array of navigation items to display in the navigation bar.
|
|
35
|
+
*/
|
|
14
36
|
export type AnchorNavBarProps = {
|
|
15
37
|
items: AnchorNavBarItem[];
|
|
16
38
|
};
|
|
@@ -16,6 +16,6 @@ export const AnchorNavBar = ({ items }) => {
|
|
|
16
16
|
}
|
|
17
17
|
return (_jsx("li", { children: _jsxs(Link, { href: item.link, "aria-current": item.isActive ? "page" : undefined, onClick: item.onClick, className: classNames(`${defaultClassName}-link`, {
|
|
18
18
|
[`${defaultClassName}-link--active`]: item.isActive,
|
|
19
|
-
}), children: [item.name, item.externalLink ? (_jsx(Svg, { role: "presentation", src: externalLinkIcon, className: `${defaultClassName}-external-link-svg` })) : null] }) }, `nav-item-${item.name}`));
|
|
19
|
+
}), target: item.externalLink ? "_blank" : undefined, children: [item.name, item.externalLink ? (_jsx(Svg, { role: "presentation", src: externalLinkIcon, className: `${defaultClassName}-external-link-svg` })) : null] }) }, `nav-item-${item.name}`));
|
|
20
20
|
}) }) }));
|
|
21
21
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from "react";
|
|
3
|
+
import infoIcon from "@material-symbols/svg-400/outlined/info-fill.svg";
|
|
3
4
|
import { getComponentClassName } from "../../../utilities";
|
|
4
5
|
import { generateId } from "../../../utilities/helpers/generateId";
|
|
5
6
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
|
|
7
|
+
import { Svg } from "../../../Svg";
|
|
6
8
|
const defaultClassName = "af-contrat";
|
|
7
9
|
const Infos = ({ infos, className, classModifier }) => {
|
|
8
10
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
9
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx(
|
|
11
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx(Svg, { className: "af-contrat__icon", src: infoIcon, "aria-hidden": "true" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
|
|
10
12
|
const idTerm = info.id ?? `info-${generateId(info)}`;
|
|
11
13
|
return (_jsxs(Fragment, { children: [_jsx("dt", { id: idTerm, className: `${defaultClassName}__word`, children: info.word }), _jsx("dd", { className: `${defaultClassName}__def`, "aria-labelledby": idTerm, children: info.definition })] }, idTerm));
|
|
12
14
|
}) })] }));
|
package/dist/Link/LinkAnchor.js
CHANGED
|
@@ -4,7 +4,7 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { linkClassName } from "./linkClassName";
|
|
5
5
|
const LinkAnchor = forwardRef(({ className, target, rel, leftIcon, children, rightIcon, disabled, ...restProps }, ref) => {
|
|
6
6
|
const finalClassName = classnames(linkClassName, className);
|
|
7
|
-
return (_jsxs("a", { className: finalClassName, rel: target === "_blank" ? "noopener noreferrer" : rel, "aria-disabled": disabled ?? restProps["aria-disabled"], ref: ref, ...restProps, children: [leftIcon, children, rightIcon] }));
|
|
7
|
+
return (_jsxs("a", { className: finalClassName, rel: target === "_blank" ? "noopener noreferrer" : rel, "aria-disabled": disabled ?? restProps["aria-disabled"], ref: ref, target: target, ...restProps, children: [leftIcon, children, rightIcon] }));
|
|
8
8
|
});
|
|
9
9
|
LinkAnchor.displayName = "LinkAnchor";
|
|
10
10
|
export { LinkAnchor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.107",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@axa-fr/design-system-slash-css": "1.2.1-alpha.
|
|
50
|
+
"@axa-fr/design-system-slash-css": "1.2.1-alpha.107",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|