@axa-fr/design-system-slash-react 1.2.1-alpha.124 → 1.2.1-alpha.126

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,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
2
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.css";
3
3
  export type TInfo = {
4
4
  definition: ReactNode;
5
5
  id?: string;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment } from "react";
3
2
  import infoIcon from "@material-symbols/svg-400/outlined/info-fill.svg";
3
+ import { Fragment } from "react";
4
4
  import { getComponentClassName } from "../../../utilities";
5
5
  import { generateId } from "../../../utilities/helpers/generateId";
6
- import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
6
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.css";
7
7
  import { Svg } from "../../../Svg";
8
8
  const defaultClassName = "af-contrat";
9
9
  const Infos = ({ infos, className, classModifier }) => {
@@ -1,17 +1,59 @@
1
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/User/User.css";
1
2
  import { MouseEvent, ReactNode } from "react";
2
- import "@axa-fr/design-system-slash-css/dist/Layout/Header/User/User.scss";
3
3
  type Props = {
4
+ /**
5
+ * User's name
6
+ */
7
+ name: string;
8
+ /**
9
+ * User's profile or role, optional
10
+ */
11
+ profile?: string;
12
+ /**
13
+ * Children elements to be rendered next to the user's name and role
14
+ */
4
15
  children?: ReactNode;
16
+ /**
17
+ * Class modifier to apply additional styles\
18
+ * @example
19
+ * ```tsx
20
+ * <User classModifier="custom-class" />
21
+ * ```
22
+ * This will apply the class `af-info-user--custom-class` to the component.
23
+ */
5
24
  classModifier?: string;
25
+ /**
26
+ * classNames to override completely the component's style
27
+ */
6
28
  className?: string;
29
+ /**
30
+ * URL to navigate to when the user name is clicked
31
+ * If provided, the user name will be wrapped in an anchor tag.
32
+ * If not provided, the user name will be displayed as plain text.
33
+ */
7
34
  href?: string;
8
- name: string;
35
+ /**
36
+ * Function to call when the user name link is clicked
37
+ * @param action - Contains the event and optionally the path
38
+ */
9
39
  onClick?: (action: {
10
40
  path?: string;
11
41
  event: MouseEvent<HTMLAnchorElement>;
12
42
  }) => void;
43
+ /**
44
+ * Optional path to be used in the onClick function
45
+ * @example
46
+ * ```tsx
47
+ * <User onClick={({ path }) => console.log(path)} path="/user-profile" />
48
+ * ```
49
+ * This will log `/user-profile` when the user name link is clicked.
50
+ */
13
51
  path?: string;
14
- profile?: string;
52
+ /**
53
+ * Title for the user link, defaults to "Voir mon profil"
54
+ * This is used as the `title` attribute for the anchor tag if `href` is provided.
55
+ * It provides additional context for screen readers and tooltips.
56
+ */
15
57
  title?: string;
16
58
  };
17
59
  declare const User: ({ children, classModifier, className, href, name, path, profile, onClick, title, }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { InnerUser } from "./InnerUser";
3
- import "@axa-fr/design-system-slash-css/dist/Layout/Header/User/User.scss";
2
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/User/User.css";
4
3
  import { getComponentClassName } from "../../../utilities";
4
+ import { InnerUser } from "./InnerUser";
5
5
  const defaultClassName = "af-info-user";
6
6
  const User = ({ children, classModifier, className, href, name, path, profile, onClick, title = "Voir mon profil", }) => {
7
7
  const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
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.124",
3
+ "version": "1.2.1-alpha.126",
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.124",
50
+ "@axa-fr/design-system-slash-css": "1.2.1-alpha.126",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },