@axa-fr/canopee-react 1.2.1-alpha.8 → 1.3.0

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.
Files changed (66) hide show
  1. package/dist/client.d.ts +4 -0
  2. package/dist/client.js +4 -0
  3. package/dist/distributeur/Form/Date/DateInput.js +1 -1
  4. package/dist/distributeur/Form/Radio/Radio.d.ts +9 -1
  5. package/dist/distributeur/Form/Radio/RadioCardGroup.d.ts +5 -2
  6. package/dist/distributeur/Form/Radio/RadioCardGroup.js +2 -2
  7. package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.js +1 -3
  8. package/dist/distributeur/Layout/MainContainer/MainContainer.d.ts +1 -0
  9. package/dist/distributeur/Layout/MainContainer/MainContainer.js +2 -1
  10. package/dist/distributeur/Steps/Step.d.ts +5 -5
  11. package/dist/distributeur/Steps/Step.js +4 -4
  12. package/dist/distributeur/Steps/StepBase.d.ts +12 -3
  13. package/dist/distributeur/Steps/StepBase.js +4 -3
  14. package/dist/distributeur/Steps/StepLink.d.ts +6 -6
  15. package/dist/distributeur/Steps/StepLink.js +4 -2
  16. package/dist/distributeur/Steps/StepNoLink.d.ts +2 -1
  17. package/dist/distributeur/Steps/StepNoLink.js +1 -1
  18. package/dist/distributeur/Steps/VerticalStep.d.ts +27 -2
  19. package/dist/distributeur/Steps/VerticalStep.js +24 -3
  20. package/dist/distributeur/Steps/index.d.ts +1 -0
  21. package/dist/distributeur/Steps/types.d.ts +2 -0
  22. package/dist/distributeur.d.ts +1 -1
  23. package/dist/distributeur.js +1 -1
  24. package/dist/prospect-client/AccordionContextual/AccordionContextualApollo.d.ts +4 -0
  25. package/dist/prospect-client/AccordionContextual/AccordionContextualApollo.js +7 -0
  26. package/dist/prospect-client/AccordionContextual/AccordionContextualCommon.d.ts +20 -0
  27. package/dist/prospect-client/AccordionContextual/AccordionContextualCommon.js +21 -0
  28. package/dist/prospect-client/AccordionContextual/AccordionContextualLF.d.ts +4 -0
  29. package/dist/prospect-client/AccordionContextual/AccordionContextualLF.js +7 -0
  30. package/dist/prospect-client/AccordionCore/AccordionCoreCommon.d.ts +3 -1
  31. package/dist/prospect-client/AccordionCore/AccordionCoreCommon.js +3 -3
  32. package/dist/prospect-client/ContentItemMono/ContentItemMonoCommon.d.ts +3 -3
  33. package/dist/prospect-client/ContentItemMono/ContentItemMonoCommon.js +1 -1
  34. package/dist/prospect-client/ContentItemMono/ContentItemMonoCore.d.ts +12 -4
  35. package/dist/prospect-client/ContentItemMono/ContentItemMonoCore.js +8 -2
  36. package/dist/prospect-client/Fieldset/FieldsetApollo.d.ts +4 -0
  37. package/dist/prospect-client/Fieldset/FieldsetApollo.js +6 -0
  38. package/dist/prospect-client/Fieldset/FieldsetCommon.d.ts +13 -0
  39. package/dist/prospect-client/Fieldset/FieldsetCommon.js +7 -0
  40. package/dist/prospect-client/Fieldset/FieldsetLF.d.ts +4 -0
  41. package/dist/prospect-client/Fieldset/FieldsetLF.js +6 -0
  42. package/dist/prospect-client/Form/InputTextAtom/InputTextAtomCommon.js +7 -3
  43. package/dist/prospect-client/Heading/HeadingCommon.js +16 -2
  44. package/dist/prospect-client/Heading/types.d.ts +12 -0
  45. package/dist/prospect-client/Heading/types.js +12 -1
  46. package/dist/prospect-client/Icon/IconCommon.d.ts +3 -0
  47. package/dist/prospect-client/Icon/IconCommon.js +3 -0
  48. package/dist/prospect-client/ProgressBar/ProgressBarCommon.d.ts +2 -1
  49. package/dist/prospect-client/ProgressBar/ProgressBarCommon.js +8 -3
  50. package/dist/prospect-client/Skeleton/SkeletonApollo.d.ts +2 -0
  51. package/dist/prospect-client/Skeleton/SkeletonApollo.js +2 -0
  52. package/dist/prospect-client/Skeleton/SkeletonCommon.d.ts +19 -0
  53. package/dist/prospect-client/Skeleton/SkeletonCommon.js +11 -0
  54. package/dist/prospect-client/Skeleton/SkeletonLF.d.ts +2 -0
  55. package/dist/prospect-client/Skeleton/SkeletonLF.js +2 -0
  56. package/dist/prospect-client/SkeletonList/SkeletonListApollo.d.ts +3 -0
  57. package/dist/prospect-client/SkeletonList/SkeletonListApollo.js +5 -0
  58. package/dist/prospect-client/SkeletonList/SkeletonListCommon.d.ts +17 -0
  59. package/dist/prospect-client/SkeletonList/SkeletonListCommon.js +4 -0
  60. package/dist/prospect-client/SkeletonList/SkeletonListLF.d.ts +3 -0
  61. package/dist/prospect-client/SkeletonList/SkeletonListLF.js +5 -0
  62. package/dist/prospect-client/utilities/types/AtLeastOne.d.ts +3 -0
  63. package/dist/prospect-client/utilities/types/AtLeastOne.js +1 -0
  64. package/dist/prospect.d.ts +4 -0
  65. package/dist/prospect.js +4 -0
  66. package/package.json +2 -2
package/dist/client.d.ts CHANGED
@@ -2,6 +2,7 @@ import "@axa-fr/canopee-css/client/common/rebootLF.css";
2
2
  import "@axa-fr/canopee-css/client/common/tokensLF.css";
3
3
  import "@axa-fr/canopee-css/client/Grid/Grid.css";
4
4
  import "@fontsource/source-sans-pro";
5
+ export { AccordionContextual, accordionContextualVariants, type AccordionContextualVariants, } from "./prospect-client/AccordionContextual/AccordionContextualLF";
5
6
  export { Accordion, accordionVariants, type AccordionVariants, } from "./prospect-client/Accordion/AccordionLF";
6
7
  export { AccordionCore } from "./prospect-client/AccordionCore/AccordionCoreLF";
7
8
  export { BasePicture } from "./prospect-client/BasePicture/BasePicture";
@@ -61,3 +62,6 @@ export { ItemPagination, type ItemPaginationProps, } from "./prospect-client/Pag
61
62
  export { Card, type CardProps } from "./prospect-client/Card/CardLF";
62
63
  export { List, type ListProps } from "./prospect-client/List/List/ListLF";
63
64
  export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorLF";
65
+ export { Skeleton, type SkeletonProps, } from "./prospect-client/Skeleton/SkeletonLF";
66
+ export { SkeletonList, type SkeletonListProps, } from "./prospect-client/SkeletonList/SkeletonListLF";
67
+ export { Fieldset, type FieldsetProps, } from "./prospect-client/Fieldset/FieldsetLF";
package/dist/client.js CHANGED
@@ -2,6 +2,7 @@ import "@axa-fr/canopee-css/client/common/rebootLF.css";
2
2
  import "@axa-fr/canopee-css/client/common/tokensLF.css";
3
3
  import "@axa-fr/canopee-css/client/Grid/Grid.css";
4
4
  import "@fontsource/source-sans-pro";
5
+ export { AccordionContextual, accordionContextualVariants, } from "./prospect-client/AccordionContextual/AccordionContextualLF";
5
6
  export { Accordion, accordionVariants, } from "./prospect-client/Accordion/AccordionLF";
6
7
  export { AccordionCore } from "./prospect-client/AccordionCore/AccordionCoreLF";
7
8
  export { BasePicture } from "./prospect-client/BasePicture/BasePicture";
@@ -60,3 +61,6 @@ export { ItemPagination, } from "./prospect-client/Pagination/ItemPagination/Ite
60
61
  export { Card } from "./prospect-client/Card/CardLF";
61
62
  export { List } from "./prospect-client/List/List/ListLF";
62
63
  export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorLF";
64
+ export { Skeleton, } from "./prospect-client/Skeleton/SkeletonLF";
65
+ export { SkeletonList, } from "./prospect-client/SkeletonList/SkeletonListLF";
66
+ export { Fieldset, } from "./prospect-client/Fieldset/FieldsetLF";
@@ -3,7 +3,7 @@ import { forwardRef } from "react";
3
3
  import { Field } from "../core";
4
4
  import { Date } from "./Date";
5
5
  const DateInput = forwardRef(({ children, ...otherProps }, inputRef) => {
6
- return (_jsx(Field, { ...otherProps, renderInput: ({ id, classModifier, ariaInvalid, errorId, ...props }) => (_jsxs(_Fragment, { children: [_jsx(Date, { id: id, classModifier: classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }), children] })) }));
6
+ return (_jsx(Field, { classNameSuffix: "date", ...otherProps, renderInput: ({ id, classModifier, ariaInvalid, errorId, ...props }) => (_jsxs(_Fragment, { children: [_jsx(Date, { id: id, classModifier: classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }), children] })) }));
7
7
  });
8
8
  DateInput.displayName = "DateInput";
9
9
  export { DateInput };
@@ -8,7 +8,15 @@ export declare enum RadioModes {
8
8
  declare const Radio: import("react").ForwardRefExoticComponent<(({
9
9
  options: Option[];
10
10
  } & Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
11
- options: Option[];
11
+ options: ({
12
+ id?: string;
13
+ icon?: import("react").ReactNode;
14
+ label: import("react").ReactNode;
15
+ description?: import("react").ReactNode;
16
+ value: string;
17
+ } & import("react").InputHTMLAttributes<HTMLInputElement> & {
18
+ action?: import("react").ReactNode;
19
+ })[];
12
20
  orientation?: "horizontal" | "vertical";
13
21
  }, "ref"> & {
14
22
  mode: "cardRadio";
@@ -1,8 +1,11 @@
1
1
  import "@axa-fr/canopee-css/distributeur/Form/Radio/RadioCardGroup.css";
2
- import { ComponentProps } from "react";
2
+ import { ComponentProps, ReactNode } from "react";
3
3
  import type { Option } from "../core";
4
+ type RadioOptions = Option & {
5
+ action?: ReactNode;
6
+ };
4
7
  type Props = ComponentProps<"input"> & {
5
- options: Option[];
8
+ options: RadioOptions[];
6
9
  orientation?: "horizontal" | "vertical";
7
10
  };
8
11
  export declare const RadioCardGroup: ({ children, options, className, value, name, orientation, disabled, "aria-invalid": ariaInvalid, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -12,7 +12,7 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
12
12
  className,
13
13
  orientation === "horizontal" &&
14
14
  `${DEFAULT_CONTAINER_CLASSNAME}--horizontal`,
15
- ]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, ...otherOptionProps }) => {
15
+ ]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, action, ...otherOptionProps }) => {
16
16
  const newName = name || optionName || idGenerated;
17
17
  const allClassNames = classNames([
18
18
  DEFAULT_CLASSNAME,
@@ -20,6 +20,6 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
20
20
  ariaInvalid && `${DEFAULT_CLASSNAME}--error`,
21
21
  ]);
22
22
  const isDisabled = disabled || optionDisabled;
23
- return (_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue));
23
+ return (_jsxs("div", { children: [_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue), action] }, optionValue));
24
24
  }), children] }));
25
25
  };
@@ -10,8 +10,6 @@ const defaultClassName = "af-title-bar";
10
10
  const HeaderTitle = ({ children, classModifier, className, isSticky = true, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }) => {
11
11
  const componentClassName = getComponentClassName(className, getClassModifier(classModifier, isSticky), defaultClassName);
12
12
  const isAnchorNavBarPresent = anchorNavBarItems && anchorNavBarItems.length > 0;
13
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames("af-container", componentClassName, {
14
- [`${defaultClassName}__withAnchorNavBar`]: isAnchorNavBarPresent,
15
- }), children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("div", { className: `${defaultClassName}__leftSection`, children: [contentLeft, _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle ? (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle })) : null] }), children] }), contentRight ? (_jsx("div", { className: `${defaultClassName}__rightSection`, children: contentRight })) : null] }), isAnchorNavBarPresent ? (_jsx(AnchorNavBar, { items: anchorNavBarItems })) : null] }));
13
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames("af-container", componentClassName), children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("div", { className: `${defaultClassName}__leftSection`, children: [contentLeft, _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle ? (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle })) : null] }), children] }), contentRight ? (_jsx("div", { className: `${defaultClassName}__rightSection`, children: contentRight })) : null] }), isAnchorNavBarPresent ? (_jsx(AnchorNavBar, { items: anchorNavBarItems })) : null] }));
16
14
  };
17
15
  export { HeaderTitle };
@@ -1,5 +1,6 @@
1
1
  import { ComponentPropsWithoutRef, PropsWithChildren } from "react";
2
2
  import "@axa-fr/canopee-css/distributeur/common/breakpoints.css";
3
+ import "@axa-fr/canopee-css/distributeur/MainContainer/MainContainer.css";
3
4
  type MainContainerProps = ComponentPropsWithoutRef<"main"> & PropsWithChildren;
4
5
  export declare const MainContainer: ({ children, ...othersProps }: MainContainerProps) => import("react/jsx-runtime").JSX.Element;
5
6
  export {};
@@ -1,3 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/canopee-css/distributeur/common/breakpoints.css";
3
- export const MainContainer = ({ children, ...othersProps }) => (_jsx("main", { className: "af-container", ...othersProps, children: children }));
3
+ import "@axa-fr/canopee-css/distributeur/MainContainer/MainContainer.css";
4
+ export const MainContainer = ({ children, ...othersProps }) => (_jsx("main", { className: "af-container af-main-container", ...othersProps, children: children }));
@@ -1,8 +1,8 @@
1
- import { ComponentPropsWithoutRef } from "react";
2
- import { StepLink } from "./StepLink";
3
- type Props = Omit<ComponentPropsWithoutRef<typeof StepLink>, "href"> & {
1
+ import { type StepLinkProps } from "./StepLink";
2
+ import { StepMode } from "./types";
3
+ type Props = Omit<StepLinkProps, "href"> & {
4
4
  href?: string;
5
- mode?: "link" | "active" | "disabled";
5
+ mode?: StepMode;
6
6
  };
7
- declare const Step: ({ number, id, title, classModifier, href, onClick, mode, className, }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ declare const Step: ({ number, id, title, classModifier, href, onClick, mode, className, stateLabel, }: Props) => import("react/jsx-runtime").JSX.Element;
8
8
  export { Step };
@@ -2,14 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { StepCurrent } from "./StepCurrent";
3
3
  import { StepDisabled } from "./StepDisabled";
4
4
  import { StepLink } from "./StepLink";
5
- const Step = ({ number, id, title, classModifier, href, onClick, mode = "link", className, }) => {
5
+ const Step = ({ number, id, title, classModifier, href, onClick, mode = "link", className, stateLabel, }) => {
6
6
  switch (mode) {
7
7
  case "link":
8
- return (_jsx(StepLink, { id: id, href: href ?? "#", number: number, classModifier: classModifier, className: className, title: title, onClick: onClick }));
8
+ return (_jsx(StepLink, { id: id, href: href ?? "#", number: number, classModifier: classModifier, className: className, title: title, onClick: onClick, stateLabel: stateLabel || "complété" }));
9
9
  case "active":
10
- return (_jsx(StepCurrent, { id: id, title: title, classModifier: classModifier, className: className, number: number }));
10
+ return (_jsx(StepCurrent, { id: id, title: title, classModifier: classModifier, className: className, number: number, stateLabel: stateLabel || "en cours" }));
11
11
  default:
12
- return (_jsx(StepDisabled, { id: id, title: title, classModifier: classModifier, className: className, number: number }));
12
+ return (_jsx(StepDisabled, { id: id, title: title, classModifier: classModifier, className: className, number: number, stateLabel: stateLabel || "à venir" }));
13
13
  }
14
14
  };
15
15
  export { Step };
@@ -1,10 +1,19 @@
1
- import { ReactNode } from "react";
2
- type Props = {
1
+ import type { ReactNode } from "react";
2
+ export type StepBaseProps = {
3
3
  id: string;
4
4
  title: string;
5
5
  children?: ReactNode;
6
6
  className?: string;
7
7
  classModifier?: string;
8
+ /**
9
+ * Label to add to the title as state indication (e.g. "in progress", "to come"...)
10
+ * Will be wrapped in parentheses, next to the `title` in the `title` attribute of the <li> element.
11
+ * @example
12
+ * stateLabel="In progress"
13
+ * title="Step 1"
14
+ * => title attribute will be "Step 1 (In progress)"
15
+ */
16
+ stateLabel?: string;
8
17
  };
9
- declare const StepBase: ({ children, id, title, className, classModifier }: Props) => import("react/jsx-runtime").JSX.Element;
18
+ declare const StepBase: ({ children, id, title, className, classModifier, stateLabel, }: StepBaseProps) => import("react/jsx-runtime").JSX.Element;
10
19
  export { StepBase };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import chevronSvg from "@material-symbols/svg-400/outlined/chevron_right.svg";
3
2
  import checkSvg from "@material-symbols/svg-400/outlined/check.svg";
3
+ import chevronSvg from "@material-symbols/svg-400/outlined/chevron_right.svg";
4
4
  import { getComponentClassName, Svg } from "../../distributeur";
5
- const StepBase = ({ children, id, title, className, classModifier }) => {
5
+ const StepBase = ({ children, id, title, className, classModifier, stateLabel, }) => {
6
6
  const componentClassName = getComponentClassName(className, classModifier, "af-steps-list-step");
7
- return (_jsxs("li", { className: componentClassName, title: title, children: [_jsx(Svg, { src: checkSvg }), children, _jsx(Svg, { src: chevronSvg })] }, id));
7
+ const outputTitle = stateLabel ? `${title} (${stateLabel})` : title;
8
+ return (_jsxs("li", { className: componentClassName, title: outputTitle, children: [_jsx(Svg, { src: checkSvg }), children, _jsx(Svg, { src: chevronSvg })] }, id));
8
9
  };
9
10
  export { StepBase };
@@ -1,10 +1,10 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from "react";
2
- import { StepBase } from "./StepBase";
3
- import type { CustomClickEvent } from "./types";
4
- type Props = ComponentPropsWithoutRef<typeof StepBase> & {
1
+ import { ReactNode } from "react";
2
+ import { type StepBaseProps } from "./StepBase";
3
+ import type { StepLinkOnClickHandler } from "./types";
4
+ export type StepLinkProps = StepBaseProps & {
5
5
  href: string;
6
6
  number?: ReactNode;
7
- onClick?: (e: CustomClickEvent) => void;
7
+ onClick?: StepLinkOnClickHandler;
8
8
  };
9
- declare const StepLink: ({ id, href, number, title, className, onClick, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ declare const StepLink: ({ id, href, number, title, className, onClick, ...otherProps }: StepLinkProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export { StepLink };
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { StepBase } from "./StepBase";
3
3
  const StepLink = ({ id, href, number, title, className = "past af-steps-list-step", onClick, ...otherProps }) => (_jsx(StepBase, { id: id, className: `${className} ${number ? "number" : ""}`, title: title, ...otherProps, children: _jsxs("a", { className: "af-steps-list-step__label", href: href, onClick: (e) => {
4
- e.preventDefault();
5
- onClick?.({ href, id, title, number });
4
+ if (onClick) {
5
+ e.preventDefault();
6
+ onClick?.({ href, id, title, number });
7
+ }
6
8
  }, children: [Boolean(number) && (_jsx("div", { className: "af-steps-list-step__number", children: number })), _jsx("div", { className: "af-steps-list-step__title", children: title })] }) }));
7
9
  export { StepLink };
@@ -2,6 +2,7 @@ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
2
  import { StepBase } from "./StepBase";
3
3
  type Props = ComponentPropsWithoutRef<typeof StepBase> & {
4
4
  number?: ReactNode;
5
+ stateLabel?: string;
5
6
  };
6
- declare const StepNoLink: ({ number, title, className, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ declare const StepNoLink: ({ number, title, className, stateLabel, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
7
8
  export { StepNoLink };
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { StepBase } from "./StepBase";
3
- const StepNoLink = ({ number, title, className = "af-steps-list-step", ...otherProps }) => (_jsx(StepBase, { className: `${className} ${number ? "number" : ""}`, title: title, ...otherProps, children: _jsxs("div", { className: "af-steps-list-step__label", children: [Boolean(number) && (_jsx("div", { className: "af-steps-list-step__number", children: number })), _jsx("div", { className: "af-steps-list-step__title", children: title })] }) }));
3
+ const StepNoLink = ({ number, title, className = "af-steps-list-step", stateLabel, ...otherProps }) => (_jsx(StepBase, { className: `${className} ${number ? "number" : ""}`, title: title + (stateLabel ? ` (${stateLabel})` : ""), ...otherProps, children: _jsxs("div", { className: "af-steps-list-step__label", children: [Boolean(number) && (_jsx("div", { className: "af-steps-list-step__number", children: number })), _jsx("div", { className: "af-steps-list-step__title", children: title })] }) }));
4
4
  export { StepNoLink };
@@ -1,11 +1,16 @@
1
1
  import { ReactNode } from "react";
2
2
  import type { VerticalStepMode } from "./types";
3
3
  import "@axa-fr/canopee-css/distributeur/Steps/VerticalStep.css";
4
+ type StateLabelsProp = {
5
+ validatedState: string;
6
+ editState: string;
7
+ lockedState: string;
8
+ };
4
9
  type Props = {
5
10
  /** The title of the step. */
6
11
  title: string;
7
12
  /** The id of the step, used for accessibility. It should be unique within the document. */
8
- id: string;
13
+ id?: string;
9
14
  /** The mode of the step, can be "edited", "validated", or "locked". */
10
15
  stepMode: VerticalStepMode;
11
16
  /** The function to call when the edit button is clicked. */
@@ -24,6 +29,26 @@ type Props = {
24
29
  contentRight?: string;
25
30
  /** The aria-label for the additional content on the right side of the title. */
26
31
  contentRightAriaLabel?: string;
32
+ /** Add the section in read only mode by hiding edit button */
33
+ readonly?: boolean;
34
+ /** Labels for different states for accessibility purposes
35
+ * @default
36
+ * {
37
+ * validatedState: "validée",
38
+ * editState: "en cours de modification",
39
+ * lockedState: "verrouillée",
40
+ * }
41
+ * @example
42
+ * ```json
43
+ * {
44
+ * validatedState: "completed",
45
+ * editState: "being edited",
46
+ * lockedState: "locked",
47
+ * }
48
+ * ```
49
+ * will change the aria-labels of the step to "Étape verticale ${title} (completed)" when validated, "Étape verticale ${title} (being edited)" when in edition and "Étape verticale ${title} (locked)" when locked.
50
+ */
51
+ stateLabels?: StateLabelsProp;
27
52
  };
28
- export declare const VerticalStep: ({ title, id, stepMode, editButtonLabel, editButtonAriaLabel, contentRightAriaLabel, onEdit, form, restitution, showRestitution, contentRight, }: Props) => import("react/jsx-runtime").JSX.Element;
53
+ export declare const VerticalStep: ({ title, stepMode, editButtonLabel, editButtonAriaLabel, contentRightAriaLabel, onEdit, id, form, restitution, showRestitution, readonly, contentRight, stateLabels, }: Props) => import("react/jsx-runtime").JSX.Element;
29
54
  export {};
@@ -3,20 +3,41 @@ import check from "@material-symbols/svg-400/sharp/check.svg";
3
3
  import edit from "@material-symbols/svg-400/sharp/edit-fill.svg";
4
4
  import lock from "@material-symbols/svg-400/sharp/lock-fill.svg";
5
5
  import classNames from "classnames";
6
+ import { useId } from "react";
6
7
  import { Svg } from "../Svg";
7
8
  import { Title } from "../Title/Title";
8
9
  import "@axa-fr/canopee-css/distributeur/Steps/VerticalStep.css";
9
10
  import { Button } from "../Button/Button";
10
11
  const defaultClassName = "af-vertical-step";
11
- export const VerticalStep = ({ title, id, stepMode, editButtonLabel = "Modifier", editButtonAriaLabel = `Modifier l'étape ${title}`, contentRightAriaLabel = `Contenu supplémentaire étape verticale ${title}`, onEdit, form, restitution, showRestitution = true, contentRight, }) => {
12
+ const defaultStateLabels = {
13
+ validatedState: "validée",
14
+ editState: "en cours de modification",
15
+ lockedState: "verrouillée",
16
+ };
17
+ const getStateLabel = (stepMode, stateLabels) => {
18
+ switch (stepMode) {
19
+ case "validated":
20
+ return stateLabels.validatedState;
21
+ case "edited":
22
+ return stateLabels.editState;
23
+ case "locked":
24
+ return stateLabels.lockedState;
25
+ default:
26
+ return "";
27
+ }
28
+ };
29
+ export const VerticalStep = ({ title, stepMode, editButtonLabel = "Modifier", editButtonAriaLabel = `Modifier l'étape ${title}`, contentRightAriaLabel = `Contenu supplémentaire étape verticale ${title}`, onEdit, id, form, restitution, showRestitution = true, readonly = false, contentRight, stateLabels = defaultStateLabels, }) => {
12
30
  const isStepInEdition = stepMode === "edited";
13
31
  const isStepValidated = stepMode === "validated";
14
32
  const isStepLocked = stepMode === "locked";
33
+ const generatedId = useId();
34
+ const stepId = id ?? generatedId;
35
+ const stateLabel = getStateLabel(stepMode, stateLabels);
15
36
  return (_jsxs("section", { className: classNames(defaultClassName, {
16
37
  [`${defaultClassName}--edition`]: isStepInEdition,
17
- }), "aria-label": `Étape verticale ${title}`, children: [_jsxs("div", { className: classNames("af-vertical-step-icon", {
38
+ }), "aria-label": `Étape verticale ${title} (${stateLabel})`, children: [_jsxs("div", { className: classNames("af-vertical-step-icon", {
18
39
  [`${defaultClassName}-icon--validated`]: isStepValidated,
19
40
  [`${defaultClassName}-icon--locked`]: isStepLocked,
20
41
  [`${defaultClassName}-icon--edited`]: isStepInEdition,
21
- }), children: [isStepValidated ? _jsx(Svg, { role: "presentation", src: check }) : null, isStepLocked ? _jsx(Svg, { role: "presentation", src: lock }) : null, isStepInEdition ? _jsx(Svg, { role: "presentation", src: edit }) : null] }), _jsx(Title, { id: id, contentLeft: isStepValidated ? (_jsx(Button, { "aria-label": editButtonAriaLabel, onClick: onEdit, variant: "ghost", leftIcon: _jsx(Svg, { role: "presentation", src: edit }), children: editButtonLabel })) : undefined, contentRight: _jsx("section", { "aria-label": contentRightAriaLabel, children: contentRight }), children: title }), isStepInEdition ? _jsx("section", { children: form }) : null, isStepValidated && showRestitution ? (_jsx("section", { children: restitution })) : null, isStepInEdition ? (_jsx("div", { className: classNames(`${defaultClassName}-icon ${defaultClassName}-icon--lastIcon`), children: _jsx(Svg, { role: "presentation", src: check }) })) : null] }));
42
+ }), children: [isStepValidated ? _jsx(Svg, { role: "presentation", src: check }) : null, isStepLocked ? _jsx(Svg, { role: "presentation", src: lock }) : null, isStepInEdition ? _jsx(Svg, { role: "presentation", src: edit }) : null] }), _jsx(Title, { id: stepId, contentLeft: isStepValidated && !readonly ? (_jsx(Button, { "aria-label": editButtonAriaLabel, onClick: onEdit, variant: "ghost", leftIcon: _jsx(Svg, { role: "presentation", src: edit }), children: editButtonLabel })) : undefined, contentRight: _jsx("section", { "aria-label": contentRightAriaLabel, children: contentRight }), children: title }), isStepInEdition ? _jsx("section", { children: form }) : null, isStepValidated && showRestitution ? (_jsx("section", { children: restitution })) : null, isStepInEdition ? (_jsx("div", { className: classNames(`${defaultClassName}-icon ${defaultClassName}-icon--lastIcon`), children: _jsx(Svg, { role: "presentation", src: check }) })) : null] }));
22
43
  };
@@ -2,4 +2,5 @@ import "@axa-fr/canopee-css/distributeur/Steps/Steps.css";
2
2
  export { Step } from "./Step";
3
3
  export { StepBase } from "./StepBase";
4
4
  export { Steps } from "./Steps";
5
+ export type { StepLinkOnClickHandler, StepMode } from "./types";
5
6
  export { VerticalStep } from "./VerticalStep";
@@ -5,4 +5,6 @@ export type CustomClickEvent = {
5
5
  id: string;
6
6
  title: string;
7
7
  };
8
+ export type StepLinkOnClickHandler = (e: CustomClickEvent) => void;
9
+ export type StepMode = "link" | "active" | "disabled";
8
10
  export type VerticalStepMode = "edited" | "locked" | "validated";
@@ -32,7 +32,7 @@ export { MainContainer } from "./distributeur/Layout/MainContainer/MainContainer
32
32
  export { Link, type LinkProps } from "./distributeur/Link/Link";
33
33
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./distributeur/ModalAgent";
34
34
  export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./distributeur/Restitution";
35
- export { Step, StepBase, Steps, VerticalStep } from "./distributeur/Steps";
35
+ export { Step, StepBase, Steps, VerticalStep, type StepLinkOnClickHandler, type StepMode, } from "./distributeur/Steps";
36
36
  export type { VerticalStepMode } from "./distributeur/Steps/types";
37
37
  export { Summary } from "./distributeur/Summary";
38
38
  export { Svg } from "./distributeur/Svg";
@@ -31,7 +31,7 @@ export { MainContainer } from "./distributeur/Layout/MainContainer/MainContainer
31
31
  export { Link } from "./distributeur/Link/Link";
32
32
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./distributeur/ModalAgent";
33
33
  export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./distributeur/Restitution";
34
- export { Step, StepBase, Steps, VerticalStep } from "./distributeur/Steps";
34
+ export { Step, StepBase, Steps, VerticalStep, } from "./distributeur/Steps";
35
35
  export { Summary } from "./distributeur/Summary";
36
36
  export { Svg } from "./distributeur/Svg";
37
37
  export { Tabs } from "./distributeur/Tabs/Tabs";
@@ -0,0 +1,4 @@
1
+ import { type AccordionContextualProps } from "./AccordionContextualCommon";
2
+ import "@axa-fr/canopee-css/prospect/AccordionContextual/AccordionContextualApollo.css";
3
+ export declare const AccordionContextual: (props: AccordionContextualProps) => import("react/jsx-runtime").JSX.Element;
4
+ export { type AccordionContextualVariants, accordionContextualVariants, } from "./AccordionContextualCommon";
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AccordionCore } from "../AccordionCore/AccordionCoreApollo";
3
+ import { Icon } from "../Icon/IconApollo";
4
+ import { AccordionContextualCommon, } from "./AccordionContextualCommon";
5
+ import "@axa-fr/canopee-css/prospect/AccordionContextual/AccordionContextualApollo.css";
6
+ export const AccordionContextual = (props) => (_jsx(AccordionContextualCommon, { ...props, AccordionCoreComponent: AccordionCore, IconComponent: Icon }));
7
+ export { accordionContextualVariants, } from "./AccordionContextualCommon";
@@ -0,0 +1,20 @@
1
+ import type { ComponentType } from "react";
2
+ import type { IconProps } from "../Icon/IconCommon";
3
+ import type { AccordionCoreProps } from "../AccordionCore/AccordionCoreCommon";
4
+ export declare const accordionContextualVariants: {
5
+ readonly info: "info";
6
+ readonly warning: "warning";
7
+ readonly reverse: "reverse";
8
+ };
9
+ export type AccordionContextualVariants = (typeof accordionContextualVariants)[keyof typeof accordionContextualVariants];
10
+ export type AccordionContextualProps = {
11
+ variant?: AccordionContextualVariants;
12
+ title: string;
13
+ icon?: string;
14
+ } & Omit<AccordionCoreProps, "summary">;
15
+ type AccordionContextualCommonProps = AccordionContextualProps & {
16
+ AccordionCoreComponent: ComponentType<AccordionCoreProps>;
17
+ IconComponent: ComponentType<IconProps>;
18
+ };
19
+ export declare const AccordionContextualCommon: ({ variant, className, children, icon, title, AccordionCoreComponent, IconComponent, ...accordionCoreProps }: AccordionContextualCommonProps) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassName } from "../utilities/getClassName";
3
+ export const accordionContextualVariants = {
4
+ info: "info",
5
+ warning: "warning",
6
+ reverse: "reverse",
7
+ };
8
+ const getIconVariant = (variant) => {
9
+ if (variant === "info")
10
+ return "primary";
11
+ if (variant === "warning")
12
+ return "error";
13
+ if (variant === "reverse")
14
+ return "secondary";
15
+ return undefined;
16
+ };
17
+ export const AccordionContextualCommon = ({ variant = accordionContextualVariants.info, className, children, icon, title, AccordionCoreComponent, IconComponent, ...accordionCoreProps }) => (_jsx(AccordionCoreComponent, { className: getClassName({
18
+ baseClassName: "af-apollo-accordion-contextual",
19
+ modifiers: [variant],
20
+ className,
21
+ }), showArrowAsClickIcon: false, arrowIconVariant: getIconVariant(variant), summary: _jsxs(_Fragment, { children: [icon ? (_jsx(IconComponent, { role: "presentation", src: icon, variant: getIconVariant(variant), size: "S", className: "af-accordion__icon" })) : null, _jsx("p", { className: "af-accordion__title", children: title })] }), ...accordionCoreProps, children: children }));
@@ -0,0 +1,4 @@
1
+ import { type AccordionContextualProps } from "./AccordionContextualCommon";
2
+ import "@axa-fr/canopee-css/client/AccordionContextual/AccordionContextualLF.css";
3
+ export declare const AccordionContextual: (props: AccordionContextualProps) => import("react/jsx-runtime").JSX.Element;
4
+ export { type AccordionContextualVariants, accordionContextualVariants, } from "./AccordionContextualCommon";
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AccordionCore } from "../AccordionCore/AccordionCoreLF";
3
+ import { AccordionContextualCommon, } from "./AccordionContextualCommon";
4
+ import { Icon } from "../Icon/IconCommon";
5
+ import "@axa-fr/canopee-css/client/AccordionContextual/AccordionContextualLF.css";
6
+ export const AccordionContextual = (props) => (_jsx(AccordionContextualCommon, { ...props, AccordionCoreComponent: AccordionCore, IconComponent: Icon }));
7
+ export { accordionContextualVariants, } from "./AccordionContextualCommon";
@@ -9,9 +9,11 @@ export type AccordionCoreProps = {
9
9
  isOpen?: boolean;
10
10
  summaryProps?: Omit<ComponentProps<"summary">, "onClick">;
11
11
  onClick?: SummaryOnClick;
12
+ showArrowAsClickIcon?: boolean;
13
+ arrowIconVariant?: IconProps["variant"];
12
14
  } & ComponentProps<"details">;
13
15
  export type AccordionPropsCommonProps = AccordionCoreProps & {
14
16
  IconComponent: ComponentType<IconProps>;
15
17
  };
16
- export declare const AccordionCoreCommon: ({ summary, children, className, summaryProps, isOpen, IconComponent, onClick, ...detailsProps }: AccordionPropsCommonProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const AccordionCoreCommon: ({ summary, children, className, summaryProps, isOpen, IconComponent, onClick, showArrowAsClickIcon, arrowIconVariant, ...detailsProps }: AccordionPropsCommonProps) => import("react/jsx-runtime").JSX.Element;
17
19
  export {};
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, } from "react";
3
3
  import keyboardDown from "@material-symbols/svg-400/rounded/keyboard_arrow_down-fill.svg";
4
4
  import { getClassName } from "../utilities/getClassName";
5
- export const AccordionCoreCommon = ({ summary, children, className, summaryProps, isOpen = false, IconComponent, onClick, ...detailsProps }) => {
5
+ export const AccordionCoreCommon = ({ summary, children, className, summaryProps, isOpen = false, IconComponent, onClick, showArrowAsClickIcon = true, arrowIconVariant, ...detailsProps }) => {
6
6
  const handleSummaryClick = useCallback((event) => {
7
7
  if (onClick) {
8
8
  event.preventDefault();
@@ -17,6 +17,6 @@ export const AccordionCoreCommon = ({ summary, children, className, summaryProps
17
17
  className: summaryProps?.className,
18
18
  }), children: [summary, _jsx("div", { className: getClassName({
19
19
  baseClassName: "af-accordion__arrow",
20
- className: "af-click-icon",
21
- }), children: _jsx(IconComponent, { src: keyboardDown, role: "presentation" }) })] }), children] }));
20
+ className: showArrowAsClickIcon ? "af-click-icon" : "",
21
+ }), children: _jsx(IconComponent, { src: keyboardDown, role: "presentation", variant: arrowIconVariant }) })] }), children] }));
22
22
  };
@@ -11,14 +11,14 @@ export type ContentMonoItemPictureProps = {
11
11
  };
12
12
  export type ContentMonoItemIconProps = {
13
13
  type: "icon";
14
+ title?: string;
15
+ subtitle1?: string;
16
+ subtitle2?: string;
14
17
  /**
15
18
  * @deprecated Use `iconProps` instead.
16
19
  */
17
20
  icon?: string;
18
21
  iconProps?: IconProps;
19
- title: string;
20
- subtitle1?: string;
21
- subtitle2?: string;
22
22
  };
23
23
  export type ContentMonoItemStickProps = {
24
24
  type: "stick";
@@ -20,7 +20,7 @@ export const getContentItemCoreProps = ({ IconComponent, type, ...props }) => {
20
20
  }
21
21
  return {
22
22
  ...props,
23
- leftComponent: _jsx("div", { className: "stick" }),
23
+ leftComponent: _jsx("div", { className: "af-content-item-mono__stick" }),
24
24
  };
25
25
  };
26
26
  export const ContentItemMonoCommon = (props) => {
@@ -1,9 +1,17 @@
1
+ import type { ElementType } from "react";
2
+ import { ReactNode } from "react";
3
+ import { AtLeastOne } from "../utilities/types/AtLeastOne";
1
4
  export type ContentMonoItemSize = "medium" | "large";
2
- export type ContentItemCoreProps = {
3
- size?: ContentMonoItemSize;
5
+ type TextFields = {
4
6
  title?: string;
5
7
  primarySubtitle?: string;
6
8
  subtitle?: string;
7
- leftComponent?: React.ReactNode;
8
9
  };
9
- export declare const ContentItemMonoCore: ({ size, leftComponent, title, primarySubtitle, subtitle, }: ContentItemCoreProps) => import("react/jsx-runtime").JSX.Element;
10
+ type AtLeastOneText = AtLeastOne<TextFields>;
11
+ export type ContentItemCoreProps<T extends ElementType = "div"> = {
12
+ as?: T;
13
+ size?: ContentMonoItemSize;
14
+ leftComponent?: ReactNode;
15
+ } & AtLeastOneText;
16
+ export declare const ContentItemMonoCore: <T extends ElementType = "div">({ as, size, leftComponent, title, primarySubtitle, subtitle, }: ContentItemCoreProps<T>) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -1,4 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const ContentItemMonoCore = ({ size = "medium", leftComponent, title, primarySubtitle, subtitle, }) => {
3
- return (_jsxs("div", { "data-testid": "container", className: `af-content-item-mono ${size}`, children: [leftComponent, _jsxs("div", { className: "text-content", children: [_jsx("span", { className: "title", children: title }), primarySubtitle ? (_jsx("span", { className: "subtitle-primary", children: primarySubtitle })) : null, subtitle ? _jsx("span", { className: "subtitle", children: subtitle }) : null] })] }));
2
+ import { getClassName } from "../utilities/getClassName";
3
+ export const ContentItemMonoCore = ({ as, size = "medium", leftComponent, title, primarySubtitle, subtitle, }) => {
4
+ const Component = as ?? "div";
5
+ const componentClassName = getClassName({
6
+ baseClassName: "af-content-item-mono",
7
+ modifiers: [size],
8
+ });
9
+ return (_jsxs(Component, { className: componentClassName, children: [leftComponent, _jsxs("div", { className: "af-content-item-mono__text-content", children: [title ? (_jsx("span", { className: "af-content-item-mono__title", children: title })) : null, primarySubtitle ? (_jsx("span", { className: "af-content-item-mono__subtitle-primary", children: primarySubtitle })) : null, subtitle ? (_jsx("span", { className: "af-content-item-mono__subtitle", children: subtitle })) : null] })] }));
4
10
  };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/prospect/Fieldset/FieldsetApollo.css";
2
+ import { type FieldsetProps } from "./FieldsetCommon";
3
+ export type { FieldsetProps };
4
+ export declare const Fieldset: (props: FieldsetProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/prospect/Fieldset/FieldsetApollo.css";
3
+ import { Icon } from "../Icon/IconApollo";
4
+ import { Card } from "../Card/CardApollo";
5
+ import { FieldsetCommon } from "./FieldsetCommon";
6
+ export const Fieldset = (props) => (_jsx(FieldsetCommon, { ...props, IconComponent: Icon, CardComponent: Card }));
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps, ComponentType, PropsWithChildren } from "react";
2
+ import { CardCommon } from "../Card/CardCommon";
3
+ import { Icon, type IconProps } from "../Icon/IconCommon";
4
+ export type FieldsetProps = PropsWithChildren<{
5
+ title: string;
6
+ iconProps?: IconProps;
7
+ className?: string;
8
+ }>;
9
+ export type FieldsetCommonProps = FieldsetProps & {
10
+ IconComponent: ComponentType<ComponentProps<typeof Icon>>;
11
+ CardComponent: ComponentType<ComponentProps<typeof CardCommon>>;
12
+ };
13
+ export declare const FieldsetCommon: ({ children, title, iconProps, className, IconComponent, CardComponent, }: FieldsetCommonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ContentItemMonoCore } from "../ContentItemMono/ContentItemMonoCore";
3
+ import { getClassName } from "../utilities/getClassName";
4
+ export const FieldsetCommon = ({ children, title, iconProps, className, IconComponent, CardComponent, }) => {
5
+ const iconComponent = iconProps && (_jsx(IconComponent, { "aria-hidden": "true", ...iconProps }));
6
+ return (_jsxs(CardComponent, { as: "fieldset", className: getClassName({ baseClassName: "af-fieldset", className }), children: [_jsx(ContentItemMonoCore, { as: "legend", title: title, leftComponent: iconComponent }), _jsx("div", { className: "af-fieldset__content", children: children })] }));
7
+ };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/client/Fieldset/FieldsetLF.css";
2
+ import { type FieldsetProps } from "./FieldsetCommon";
3
+ export type { FieldsetProps };
4
+ export declare const Fieldset: (props: FieldsetProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/client/Fieldset/FieldsetLF.css";
3
+ import { Icon } from "../Icon/IconLF";
4
+ import { Card } from "../Card/CardLF";
5
+ import { FieldsetCommon } from "./FieldsetCommon";
6
+ export const Fieldset = (props) => (_jsx(FieldsetCommon, { ...props, IconComponent: Icon, CardComponent: Card }));
@@ -1,11 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useId, } from "react";
3
- import { getComponentClassName } from "../../utilities/getComponentClassName";
3
+ import { getClassName } from "../../utilities/getClassName";
4
4
  const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, idMessage, idHelp, "aria-errormessage": ariaErrormessage, "aria-describedby": ariaDescribedby, type = "text", ...otherProps }, inputRef) => {
5
- const componentClassName = getComponentClassName("af-form__input-text", className, classModifier + (error || ariaErrormessage ? " error" : ""));
5
+ const componentClassName = getClassName({
6
+ baseClassName: "af-form__input-text",
7
+ modifiers: [classModifier, error || ariaErrormessage ? "error" : ""],
8
+ className,
9
+ });
6
10
  let inputId = useId();
7
11
  inputId = otherProps.id || inputId;
8
- return (_jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: type, required: required, ref: inputRef, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": ariaDescribedby ?? idHelp, ...otherProps }), unit] }));
12
+ return (_jsxs("div", { className: "af-form__input-atom-container", children: [_jsx("input", { id: inputId, className: componentClassName, type: type, required: required, ref: inputRef, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": ariaDescribedby ?? idHelp, ...otherProps }), unit] }));
9
13
  });
10
14
  InputTextAtom.displayName = "InputTextAtom";
11
15
  export { InputTextAtom };
@@ -1,8 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import classNames from "classnames";
3
2
  import { Icon } from "../Icon/IconCommon";
4
3
  import { HeadingWithSubheadings } from "./HeadingWithSubheadings";
4
+ import { headingLevelToIconSizeDesktop, headingLevelToIconSizeMobile, } from "./types";
5
+ import { useIsSmallScreen } from "../utilities/hook/useIsSmallScreen";
6
+ import { BREAKPOINT } from "../utilities/constants";
7
+ import { getClassName } from "../utilities/getClassName";
5
8
  export const DEFAULT_TAG_PROPS = {
6
9
  variant: "neutral",
7
10
  };
8
- export const HeadingCommon = ({ children: title, className, firstSubtitle, secondSubtitle, level = 1, icon, iconProps = {}, tag, ...props }) => (_jsxs("div", { className: classNames("af-heading", className), ...props, children: [tag && level < 3 ? _jsx("div", { className: "af-heading__label", children: tag }) : null, icon && level === 1 ? (_jsx(Icon, { src: icon, size: "L", hasBackground: true, variant: "secondary", ...iconProps, className: classNames("af-heading__icon", iconProps.className) })) : null, _jsx(HeadingWithSubheadings, { title: title, firstSubtitle: firstSubtitle, titleComponent: `h${level}`, secondSubtitle: secondSubtitle })] }));
11
+ export const HeadingCommon = ({ children: title, className, firstSubtitle, secondSubtitle, level = 1, icon, iconProps = {}, tag, ...props }) => {
12
+ const isMobile = useIsSmallScreen(BREAKPOINT.SM);
13
+ return (_jsxs("div", { className: getClassName({
14
+ baseClassName: "af-heading",
15
+ className,
16
+ }), ...props, children: [tag && level < 3 ? _jsx("div", { className: "af-heading__label", children: tag }) : null, icon ? (_jsx(Icon, { src: icon, size: isMobile
17
+ ? headingLevelToIconSizeMobile[level]
18
+ : headingLevelToIconSizeDesktop[level], hasBackground: true, variant: "secondary", ...iconProps, className: getClassName({
19
+ baseClassName: "af-heading__icon",
20
+ className: iconProps.className,
21
+ }) })) : null, _jsx(HeadingWithSubheadings, { title: title, firstSubtitle: firstSubtitle, titleComponent: `h${level}`, secondSubtitle: secondSubtitle })] }));
22
+ };
@@ -1,6 +1,18 @@
1
1
  import type { TagProps } from "../Tag/TagCommon";
2
2
  import type { HeadingCommonProps } from "./HeadingCommon";
3
3
  export type HeadingLevel = 1 | 2 | 3 | 4;
4
+ export declare const headingLevelToIconSizeDesktop: {
5
+ readonly 1: "L";
6
+ readonly 2: "M";
7
+ readonly 3: "S";
8
+ readonly 4: "S";
9
+ };
10
+ export declare const headingLevelToIconSizeMobile: {
11
+ readonly 1: "S";
12
+ readonly 2: "S";
13
+ readonly 3: "S";
14
+ readonly 4: "XS";
15
+ };
4
16
  export type HeadingProps = HeadingCommonProps & {
5
17
  tagProps?: Omit<TagProps, "children">;
6
18
  };
@@ -1 +1,12 @@
1
- export {};
1
+ export const headingLevelToIconSizeDesktop = {
2
+ 1: "L",
3
+ 2: "M",
4
+ 3: "S",
5
+ 4: "S",
6
+ };
7
+ export const headingLevelToIconSizeMobile = {
8
+ 1: "S",
9
+ 2: "S",
10
+ 3: "S",
11
+ 4: "XS",
12
+ };
@@ -4,6 +4,9 @@ export declare const iconVariants: {
4
4
  readonly primary: "primary";
5
5
  readonly secondary: "secondary";
6
6
  readonly disabled: "disabled";
7
+ readonly success: "success";
8
+ readonly error: "error";
9
+ readonly warning: "warning";
7
10
  };
8
11
  export type IconVariants = keyof typeof iconVariants;
9
12
  export declare const iconSizeVariants: {
@@ -6,6 +6,9 @@ export const iconVariants = {
6
6
  primary: "primary",
7
7
  secondary: "secondary",
8
8
  disabled: "disabled",
9
+ success: "success",
10
+ error: "error",
11
+ warning: "warning",
9
12
  };
10
13
  export const iconSizeVariants = {
11
14
  L: "large",
@@ -1,9 +1,10 @@
1
1
  import { type ComponentProps, type ReactNode } from "react";
2
2
  type ProgressBarProps = ComponentProps<"progress"> & {
3
3
  label?: ReactNode;
4
+ showPercentage?: boolean;
4
5
  };
5
6
  export declare const ProgressBar: {
6
- ({ id, label, className, ...props }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
7
+ ({ id, label, showPercentage, className, ...props }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
7
8
  displayName: string;
8
9
  };
9
10
  export {};
@@ -1,8 +1,13 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
- export const ProgressBar = ({ id, label, className, ...props }) => {
3
+ import { getClassName } from "../utilities/getClassName";
4
+ export const ProgressBar = ({ id, label, showPercentage = false, className, ...props }) => {
4
5
  let inputId = useId();
5
6
  inputId = id || inputId;
6
- return (_jsxs(_Fragment, { children: [Boolean(label) && (_jsx("label", { className: "af-progress-bar__label", htmlFor: inputId, children: label })), _jsx("progress", { id: inputId, className: ["af-progress-bar", className].filter(Boolean).join(" "), ...props })] }));
7
+ const componentClassName = getClassName({
8
+ baseClassName: "af-progress-bar",
9
+ className,
10
+ });
11
+ return (_jsxs(_Fragment, { children: [Boolean(label) && (_jsx("label", { className: "af-progress-bar__label", htmlFor: inputId, children: label })), _jsxs("div", { className: componentClassName, children: [_jsx("progress", { id: inputId, className: "af-progress-bar__progress", ...props }), Boolean(showPercentage) && (_jsxs("span", { "aria-hidden": "true", children: [props.value, " %"] }))] })] }));
7
12
  };
8
13
  ProgressBar.displayName = "ProgressBar";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/prospect/Skeleton/SkeletonApollo.css";
2
+ export { Skeleton, type SkeletonProps } from "./SkeletonCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/prospect/Skeleton/SkeletonApollo.css";
2
+ export { Skeleton } from "./SkeletonCommon";
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from "react";
2
+ type isLoadingAndChildrenProps = {
3
+ children: ReactNode;
4
+ isLoading: boolean;
5
+ } | {
6
+ children?: undefined;
7
+ isLoading?: boolean;
8
+ };
9
+ export type SkeletonProps = {
10
+ className?: string;
11
+ grid: number[][];
12
+ "aria-busy"?: boolean;
13
+ "aria-label"?: string;
14
+ maxCols?: number;
15
+ colGap?: number;
16
+ rowGap?: number;
17
+ } & isLoadingAndChildrenProps;
18
+ export declare const Skeleton: ({ className, grid, "aria-busy": ariaBusy, "aria-label": ariaLabel, maxCols, colGap, rowGap, isLoading, children, }: SkeletonProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
19
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getClassName } from "../utilities/getClassName";
3
+ const CLASS_NAME = "af-skeleton";
4
+ export const Skeleton = ({ className, grid = [], "aria-busy": ariaBusy = true, "aria-label": ariaLabel = "Chargement", maxCols = 12, colGap = 16, rowGap = 8, isLoading = true, children, }) => isLoading ? (_jsx("div", { className: getClassName({
5
+ baseClassName: `${CLASS_NAME}-container`,
6
+ className,
7
+ }), "aria-label": ariaLabel, role: "status", "aria-busy": ariaBusy, style: {
8
+ "--max-cols": maxCols,
9
+ "--col-gap": `calc(${colGap} / var(--font-size-base) * 1rem)`,
10
+ "--row-gap": `calc(${rowGap} / var(--font-size-base) * 1rem)`,
11
+ }, children: grid.map((cols, indexRow) => cols.map((colSize, indexCol) => (_jsx("div", { style: { "--col-size": colSize }, className: CLASS_NAME }, `${indexRow}-${indexCol}`)))) })) : (children);
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/client/Skeleton/SkeletonLF.css";
2
+ export { Skeleton, type SkeletonProps } from "./SkeletonCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/client/Skeleton/SkeletonLF.css";
2
+ export { Skeleton } from "./SkeletonCommon";
@@ -0,0 +1,3 @@
1
+ import { type SkeletonListProps } from "./SkeletonListCommon";
2
+ export { type SkeletonListProps } from "./SkeletonListCommon";
3
+ export declare const SkeletonList: (props: SkeletonListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Skeleton } from "../Skeleton/SkeletonApollo";
3
+ import { List } from "../List/List/ListApollo";
4
+ import { SkeletonListCommon, } from "./SkeletonListCommon";
5
+ export const SkeletonList = (props) => (_jsx(SkeletonListCommon, { ...props, SkeletonComponent: Skeleton, ListComponent: List }));
@@ -0,0 +1,17 @@
1
+ import type { ComponentType, PropsWithChildren } from "react";
2
+ import type { SkeletonProps } from "../Skeleton/SkeletonCommon";
3
+ import type { ListProps } from "../List/List/ListCommon";
4
+ export type SkeletonListProps = {
5
+ lists: {
6
+ lines?: number;
7
+ grid: SkeletonProps["grid"];
8
+ }[];
9
+ isLoading?: boolean;
10
+ className?: string;
11
+ } & PropsWithChildren;
12
+ type SkeletonListPropsCommon = SkeletonListProps & {
13
+ ListComponent: ComponentType<ListProps>;
14
+ SkeletonComponent: ComponentType<SkeletonProps>;
15
+ };
16
+ export declare const SkeletonListCommon: ({ children, isLoading, lists, className, ListComponent, SkeletonComponent, }: SkeletonListPropsCommon) => string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element[] | null | undefined;
17
+ export {};
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const SkeletonListCommon = ({ children, isLoading, lists = [], className, ListComponent, SkeletonComponent, }) => isLoading
3
+ ? lists.map(({ lines = 1, grid }, linesIndex) => (_jsx(ListComponent, { className: className, children: [...Array(lines).keys()].map((_, lineIndex) => (_jsx(SkeletonComponent, { grid: grid }, lineIndex))) }, linesIndex)))
4
+ : children;
@@ -0,0 +1,3 @@
1
+ import { type SkeletonListProps } from "./SkeletonListCommon";
2
+ export { type SkeletonListProps } from "./SkeletonListCommon";
3
+ export declare const SkeletonList: (props: SkeletonListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Skeleton } from "../Skeleton/SkeletonLF";
3
+ import { List } from "../List/List/ListLF";
4
+ import { SkeletonListCommon, } from "./SkeletonListCommon";
5
+ export const SkeletonList = (props) => (_jsx(SkeletonListCommon, { ...props, SkeletonComponent: Skeleton, ListComponent: List }));
@@ -0,0 +1,3 @@
1
+ export type AtLeastOne<T, K extends keyof T = keyof T> = Partial<T> & {
2
+ [P in K]: Required<Pick<T, P>>;
3
+ }[K];
@@ -0,0 +1 @@
1
+ export {};
@@ -2,6 +2,7 @@ import "@axa-fr/canopee-css/prospect/common/reboot.css";
2
2
  import "@axa-fr/canopee-css/prospect/common/tokens.css";
3
3
  import "@axa-fr/canopee-css/prospect/Grid/Grid.css";
4
4
  import "@fontsource/source-sans-pro";
5
+ export { AccordionContextual, accordionContextualVariants, type AccordionContextualVariants, } from "./prospect-client/AccordionContextual/AccordionContextualApollo";
5
6
  export { Accordion, accordionVariants, type AccordionVariants, } from "./prospect-client/Accordion/AccordionApollo";
6
7
  export { AccordionCore } from "./prospect-client/AccordionCore/AccordionCoreApollo";
7
8
  export { BasePicture } from "./prospect-client/BasePicture/BasePicture";
@@ -57,3 +58,6 @@ export { ItemPagination, type ItemPaginationProps, } from "./prospect-client/Pag
57
58
  export { Card, type CardProps } from "./prospect-client/Card/CardApollo";
58
59
  export { List, type ListProps } from "./prospect-client/List/List/ListApollo";
59
60
  export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
61
+ export { Skeleton, type SkeletonProps, } from "./prospect-client/Skeleton/SkeletonApollo";
62
+ export { SkeletonList, type SkeletonListProps, } from "./prospect-client/SkeletonList/SkeletonListApollo";
63
+ export { Fieldset, type FieldsetProps, } from "./prospect-client/Fieldset/FieldsetApollo";
package/dist/prospect.js CHANGED
@@ -2,6 +2,7 @@ import "@axa-fr/canopee-css/prospect/common/reboot.css";
2
2
  import "@axa-fr/canopee-css/prospect/common/tokens.css";
3
3
  import "@axa-fr/canopee-css/prospect/Grid/Grid.css";
4
4
  import "@fontsource/source-sans-pro";
5
+ export { AccordionContextual, accordionContextualVariants, } from "./prospect-client/AccordionContextual/AccordionContextualApollo";
5
6
  export { Accordion, accordionVariants, } from "./prospect-client/Accordion/AccordionApollo";
6
7
  export { AccordionCore } from "./prospect-client/AccordionCore/AccordionCoreApollo";
7
8
  export { BasePicture } from "./prospect-client/BasePicture/BasePicture";
@@ -56,3 +57,6 @@ export { ItemPagination, } from "./prospect-client/Pagination/ItemPagination/Ite
56
57
  export { Card } from "./prospect-client/Card/CardApollo";
57
58
  export { List } from "./prospect-client/List/List/ListApollo";
58
59
  export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
60
+ export { Skeleton, } from "./prospect-client/Skeleton/SkeletonApollo";
61
+ export { SkeletonList, } from "./prospect-client/SkeletonList/SkeletonListApollo";
62
+ export { Fieldset, } from "./prospect-client/Fieldset/FieldsetApollo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.2.1-alpha.8",
3
+ "version": "1.3.0",
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.2.1-alpha.8",
48
+ "@axa-fr/canopee-css": "1.3.0",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "@material-symbols/svg-700": ">= 0.19.0",
51
51
  "react": ">= 18"