@axa-fr/canopee-react 1.1.1-alpha.8 → 1.2.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 (28) hide show
  1. package/dist/client.d.ts +3 -0
  2. package/dist/client.js +3 -0
  3. package/dist/prospect-client/Card/CardApollo.d.ts +2 -0
  4. package/dist/prospect-client/Card/CardApollo.js +2 -0
  5. package/dist/prospect-client/Card/CardCommon.d.ts +4 -0
  6. package/dist/prospect-client/Card/CardCommon.js +9 -0
  7. package/dist/prospect-client/Card/CardLF.d.ts +2 -0
  8. package/dist/prospect-client/Card/CardLF.js +2 -0
  9. package/dist/prospect-client/ContentItemDuoAction/ContentItemDuoActionCommon.d.ts +1 -1
  10. package/dist/prospect-client/LevelSelector/LevelSelectorApollo.d.ts +4 -0
  11. package/dist/prospect-client/LevelSelector/LevelSelectorApollo.js +8 -0
  12. package/dist/prospect-client/LevelSelector/LevelSelectorCommon.d.ts +18 -0
  13. package/dist/prospect-client/LevelSelector/LevelSelectorCommon.js +9 -0
  14. package/dist/prospect-client/LevelSelector/LevelSelectorLF.d.ts +4 -0
  15. package/dist/prospect-client/LevelSelector/LevelSelectorLF.js +8 -0
  16. package/dist/prospect-client/List/ContentItemDuo/ContentItemDuoCommon.d.ts +14 -6
  17. package/dist/prospect-client/List/ContentItemDuo/ContentItemDuoCommon.js +12 -11
  18. package/dist/prospect-client/List/List/ListApollo.d.ts +4 -0
  19. package/dist/prospect-client/List/List/ListApollo.js +5 -0
  20. package/dist/prospect-client/List/List/ListCommon.d.ts +8 -0
  21. package/dist/prospect-client/List/List/ListCommon.js +4 -0
  22. package/dist/prospect-client/List/List/ListLF.d.ts +4 -0
  23. package/dist/prospect-client/List/List/ListLF.js +5 -0
  24. package/dist/prospect-client/Pagination/PaginationCommon.d.ts +1 -1
  25. package/dist/prospect-client/Pagination/PaginationCommon.js +1 -1
  26. package/dist/prospect.d.ts +3 -0
  27. package/dist/prospect.js +3 -0
  28. package/package.json +2 -2
package/dist/client.d.ts CHANGED
@@ -58,3 +58,6 @@ export { TimelineVertical } from "./prospect-client/TimelineVertical/TimelineVer
58
58
  export { Toggle } from "./prospect-client/Toggle/ToggleLF";
59
59
  export { Pagination } from "./prospect-client/Pagination/PaginationLF";
60
60
  export { ItemPagination, type ItemPaginationProps, } from "./prospect-client/Pagination/ItemPagination/ItemPaginationLF";
61
+ export { Card, type CardProps } from "./prospect-client/Card/CardLF";
62
+ export { List, type ListProps } from "./prospect-client/List/List/ListLF";
63
+ export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorLF";
package/dist/client.js CHANGED
@@ -57,3 +57,6 @@ export { TimelineVertical } from "./prospect-client/TimelineVertical/TimelineVer
57
57
  export { Toggle } from "./prospect-client/Toggle/ToggleLF";
58
58
  export { Pagination } from "./prospect-client/Pagination/PaginationLF";
59
59
  export { ItemPagination, } from "./prospect-client/Pagination/ItemPagination/ItemPaginationLF";
60
+ export { Card } from "./prospect-client/Card/CardLF";
61
+ export { List } from "./prospect-client/List/List/ListLF";
62
+ export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorLF";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/prospect/Card/CardApollo.css";
2
+ export { type CardCommonProps as CardProps, CardCommon as Card, } from "./CardCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/prospect/Card/CardApollo.css";
2
+ export { CardCommon as Card, } from "./CardCommon";
@@ -0,0 +1,4 @@
1
+ import type { ComponentProps, ElementType } from "react";
2
+ import { type PolymorphicComponent } from "../utilities/types/PolymorphicComponent";
3
+ export type CardCommonProps<T extends ElementType> = PolymorphicComponent<T, ComponentProps<"div">>;
4
+ export declare const CardCommon: <T extends ElementType = "div">({ as, children, className, ...props }: CardCommonProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getClassName } from "../utilities/getClassName";
3
+ export const CardCommon = ({ as, children, className, ...props }) => {
4
+ const Component = as || "div";
5
+ return (_jsx(Component, { className: getClassName({
6
+ baseClassName: "af-card",
7
+ className,
8
+ }), ...props, children: children }));
9
+ };
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/client/Card/CardLF.css";
2
+ export { type CardCommonProps as CardProps, CardCommon as Card, } from "./CardCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/canopee-css/client/Card/CardLF.css";
2
+ export { CardCommon as Card, } from "./CardCommon";
@@ -12,7 +12,7 @@ export type ContentItemDuoActionToggleProps = {
12
12
  ContentItemMonoComponent: ComponentType<ContentItemProps>;
13
13
  contentItemProps: ContentItemProps;
14
14
  ToggleComponent: ComponentType<ToggleProps>;
15
- toggleProps: ToggleProps;
15
+ toggleProps?: ToggleProps;
16
16
  };
17
17
  export type ContentItemDuoActionButtonsProps = {
18
18
  className?: string;
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/prospect/LevelSelector/LevelSelectorApollo.css";
2
+ import { type LevelSelectorProps } from "./LevelSelectorCommon";
3
+ export declare const LevelSelector: (props: LevelSelectorProps) => import("react/jsx-runtime").JSX.Element;
4
+ export { type LevelSelectorProps };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/prospect/LevelSelector/LevelSelectorApollo.css";
3
+ import { ClickIcon } from "../ClickIcon/ClickIconApollo";
4
+ import { Card } from "../Card/CardApollo";
5
+ import { LevelSelectorCommon, } from "./LevelSelectorCommon";
6
+ export const LevelSelector = (props) => {
7
+ return (_jsx(LevelSelectorCommon, { ...props, ClickIconComponent: ClickIcon, CardComponent: Card }));
8
+ };
@@ -0,0 +1,18 @@
1
+ import { ComponentProps, ComponentType } from "react";
2
+ import { ClickIcon } from "../ClickIcon/ClickIconCommon";
3
+ import { CardCommon } from "../Card/CardCommon";
4
+ export type LevelSelectorProps = {
5
+ title: string;
6
+ description?: string;
7
+ value?: number;
8
+ stepsCount?: 1 | 2 | 3;
9
+ minusAriaLabel?: string;
10
+ plusAriaLabel?: string;
11
+ onChange?: (value: number) => void;
12
+ };
13
+ type LevelSelectorCommonProps = LevelSelectorProps & {
14
+ ClickIconComponent: ComponentType<ComponentProps<typeof ClickIcon>>;
15
+ CardComponent: ComponentType<ComponentProps<typeof CardCommon>>;
16
+ };
17
+ export declare const LevelSelectorCommon: ({ title, description, value, stepsCount, ClickIconComponent, CardComponent, minusAriaLabel, plusAriaLabel, onChange, }: LevelSelectorCommonProps) => import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import add from "@material-symbols/svg-400/rounded/add-fill.svg";
3
+ import remove from "@material-symbols/svg-400/rounded/remove-fill.svg";
4
+ import { useId } from "react";
5
+ export const LevelSelectorCommon = ({ title, description, value = 0, stepsCount = 2, ClickIconComponent, CardComponent, minusAriaLabel = "Diminuer le niveau", plusAriaLabel = "Augmenter le niveau", onChange, }) => {
6
+ const levelSelectorId = useId();
7
+ const stepsArray = Array.from({ length: stepsCount }, (_, index) => index + 1);
8
+ return (_jsxs(CardComponent, { as: "fieldset", role: "radiogroup", className: "af-level-selector", children: [Boolean(title) && (_jsx("legend", { className: "af-level-selector__title", children: title })), _jsxs("div", { className: "af-level-selector__content", children: [_jsx(ClickIconComponent, { "aria-label": minusAriaLabel, src: remove, onClick: () => onChange?.(value - 1), disabled: value === 0 }), _jsx("div", { className: "af-level-selector__group", children: stepsArray.map((step) => (_jsx("label", { className: `af-level-selector__radio ${step <= value ? "af-level-selector__active" : ""}`, "aria-label": `Niveau ${step}`, children: _jsx("input", { type: "radio", name: `level-selector-${levelSelectorId}`, "aria-describedby": `level-selector-${levelSelectorId}-description`, value: step, checked: step === value, onChange: () => onChange?.(step) }) }, step))) }), _jsx(ClickIconComponent, { "aria-label": plusAriaLabel, src: add, onClick: () => onChange?.(value + 1), disabled: value === stepsCount })] }), Boolean(description) && (_jsx("span", { id: `level-selector-${levelSelectorId}-description`, className: "af-level-selector__description", "aria-live": "polite", children: description }))] }));
9
+ };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/client/LevelSelector/LevelSelectorLF.css";
2
+ import { type LevelSelectorProps } from "./LevelSelectorCommon";
3
+ export declare const LevelSelector: (props: LevelSelectorProps) => import("react/jsx-runtime").JSX.Element;
4
+ export { type LevelSelectorProps };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/client/LevelSelector/LevelSelectorLF.css";
3
+ import { ClickIcon } from "../ClickIcon/ClickIconLF";
4
+ import { Card } from "../Card/CardLF";
5
+ import { LevelSelectorCommon, } from "./LevelSelectorCommon";
6
+ export const LevelSelector = (props) => {
7
+ return (_jsx(LevelSelectorCommon, { ...props, ClickIconComponent: ClickIcon, CardComponent: Card }));
8
+ };
@@ -1,16 +1,24 @@
1
1
  import { type ComponentProps, type ComponentType, type ReactNode } from "react";
2
2
  import type { ButtonProps } from "../../Button/ButtonCommon";
3
+ type ContentItemDuoPositions = {
4
+ position?: "horizontal";
5
+ size?: "small" | "large";
6
+ } | {
7
+ size?: "large";
8
+ position: "vertical";
9
+ };
3
10
  export type ContentItemDuoProps = {
4
- label: string;
11
+ label: ReactNode;
5
12
  value: ReactNode;
6
- isVertical?: boolean;
7
- className?: string;
8
- classModifier?: string;
9
13
  buttonText?: string;
10
14
  onButtonClick?: () => void;
11
- } & ComponentProps<"div">;
15
+ /** @deprecated Use `position` instead */
16
+ isVertical?: boolean;
17
+ /** @deprecated Use `size` or `className` instead */
18
+ classModifier?: string;
19
+ } & ContentItemDuoPositions & ComponentProps<"div">;
12
20
  type ContentItemDuoCommonProps = ContentItemDuoProps & {
13
21
  ButtonComponent: ComponentType<ButtonProps>;
14
22
  };
15
- export declare const ContentItemDuoCommon: ({ label, value, isVertical, className, classModifier, buttonText, onButtonClick, ButtonComponent, ...containerProps }: ContentItemDuoCommonProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const ContentItemDuoCommon: ({ label, value, position, size, className, classModifier, isVertical, buttonText, onButtonClick, ButtonComponent, ...containerProps }: ContentItemDuoCommonProps) => import("react/jsx-runtime").JSX.Element;
16
24
  export {};
@@ -1,13 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, } from "react";
3
- import { getComponentClassName } from "../../utilities/getComponentClassName";
4
- export const ContentItemDuoCommon = ({ label, value, isVertical = false, className, classModifier, buttonText, onButtonClick, ButtonComponent, ...containerProps }) => {
5
- const componentClassName = useMemo(() => {
6
- const classModifiers = [classModifier];
7
- if (isVertical) {
8
- classModifiers.push("vertical");
9
- }
10
- return getComponentClassName("af-content-item-duo", className, classModifiers.filter(Boolean).join(" "));
11
- }, [classModifier, className, isVertical]);
12
- return (_jsxs("div", { className: componentClassName, ...containerProps, children: [_jsx("p", { className: "af-content-item-duo__label", children: label }), typeof value === "string" ? (_jsx("p", { className: "af-content-item-duo__value", children: value })) : (_jsx("div", { className: "af-content-item-duo__value", children: value })), buttonText ? (_jsx("div", { className: "af-content-item-duo__button", children: _jsx(ButtonComponent, { variant: "ghost", onClick: onButtonClick, children: buttonText }) })) : null] }));
2
+ import { getClassName } from "../../utilities/getClassName";
3
+ export const ContentItemDuoCommon = ({ label, value, position = "horizontal", size = "large", className, classModifier, isVertical, buttonText, onButtonClick, ButtonComponent, ...containerProps }) => {
4
+ const componentClassName = getClassName({
5
+ baseClassName: "af-content-item-duo",
6
+ className,
7
+ modifiers: [
8
+ isVertical ? "vertical" : position,
9
+ size === "small" && size,
10
+ classModifier,
11
+ ],
12
+ });
13
+ return (_jsxs("div", { className: componentClassName, ...containerProps, children: [_jsx("dt", { className: "af-content-item-duo__label", children: label }), _jsx("dd", { className: "af-content-item-duo__value", children: value }), Boolean(buttonText && onButtonClick) && (_jsx(ButtonComponent, { className: "af-content-item-duo__button", variant: "ghost", onClick: onButtonClick, children: buttonText }))] }));
13
14
  };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/prospect/List/List/ListApollo.css";
2
+ import { type ListProps } from "./ListCommon";
3
+ export { type ListProps } from "./ListCommon";
4
+ export declare const List: (props: ListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/prospect/List/List/ListApollo.css";
3
+ import { Card } from "../../Card/CardApollo";
4
+ import { ListCommon } from "./ListCommon";
5
+ export const List = (props) => (_jsx(ListCommon, { ...props, CardComponent: Card }));
@@ -0,0 +1,8 @@
1
+ import { ComponentProps, ComponentType } from "react";
2
+ import { CardCommon as Card, type CardCommonProps } from "../../Card/CardCommon";
3
+ export type ListProps = CardCommonProps<"ul" | "ol">;
4
+ type ListPropsCommon = ListProps & {
5
+ CardComponent: ComponentType<ComponentProps<typeof Card>>;
6
+ };
7
+ export declare const ListCommon: ({ children, CardComponent, as, ...listProps }: ListPropsCommon) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Children } from "react";
3
+ import { generateId } from "../../utilities/generateId";
4
+ export const ListCommon = ({ children, CardComponent, as = "ul", ...listProps }) => (_jsx(CardComponent, { as: as, ...listProps, children: Children.toArray(children).map((child) => (_jsx("li", { children: child }, generateId(child)))) }));
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/canopee-css/client/List/List/ListLF.css";
2
+ import { type ListProps } from "./ListCommon";
3
+ export { type ListProps } from "./ListCommon";
4
+ export declare const List: (props: ListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/canopee-css/client/List/List/ListLF.css";
3
+ import { Card } from "../../Card/CardLF";
4
+ import { ListCommon } from "./ListCommon";
5
+ export const List = (props) => (_jsx(ListCommon, { ...props, CardComponent: Card }));
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps, ComponentType, type ComponentPropsWithoutRef } from "react";
2
- import { ClickIcon } from "../ClickIcon/ClickIconApollo";
2
+ import { ClickIcon } from "../ClickIcon/ClickIconCommon";
3
3
  import { ItemPaginationCommon } from "./ItemPagination/ItemPaginationCommon";
4
4
  import { type getItemsProps } from "./Pagination.helper";
5
5
  export type PaginationProps = getItemsProps & ComponentPropsWithoutRef<"nav"> & {
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import chevronBackward from "@material-symbols/svg-400/rounded/chevron_backward.svg";
3
3
  import chevronForward from "@material-symbols/svg-400/rounded/chevron_forward.svg";
4
4
  import { getClassName } from "../utilities/getClassName";
5
- import { ClickIcon } from "../ClickIcon/ClickIconApollo";
5
+ import { ClickIcon } from "../ClickIcon/ClickIconCommon";
6
6
  import { ELLIPSIS, } from "./ItemPagination/ItemPaginationCommon";
7
7
  import { getItems } from "./Pagination.helper";
8
8
  export const PaginationCommon = ({ numberPages = 1, onChangePage, className, currentPage = 1, asItem, hidePrevNext = false, "aria-label": ariaLabel = "Pagination", ItemPaginationComponent, prevButtonProps, nextButtonProps, }) => {
@@ -54,3 +54,6 @@ export { TimelineVertical } from "./prospect-client/TimelineVertical/TimelineVer
54
54
  export { Toggle } from "./prospect-client/Toggle/ToggleApollo";
55
55
  export { Pagination } from "./prospect-client/Pagination/PaginationApollo";
56
56
  export { ItemPagination, type ItemPaginationProps, } from "./prospect-client/Pagination/ItemPagination/ItemPaginationApollo";
57
+ export { Card, type CardProps } from "./prospect-client/Card/CardApollo";
58
+ export { List, type ListProps } from "./prospect-client/List/List/ListApollo";
59
+ export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
package/dist/prospect.js CHANGED
@@ -53,3 +53,6 @@ export { TimelineVertical } from "./prospect-client/TimelineVertical/TimelineVer
53
53
  export { Toggle } from "./prospect-client/Toggle/ToggleApollo";
54
54
  export { Pagination } from "./prospect-client/Pagination/PaginationApollo";
55
55
  export { ItemPagination, } from "./prospect-client/Pagination/ItemPagination/ItemPaginationApollo";
56
+ export { Card } from "./prospect-client/Card/CardApollo";
57
+ export { List } from "./prospect-client/List/List/ListApollo";
58
+ export { LevelSelector, } from "./prospect-client/LevelSelector/LevelSelectorApollo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.1.1-alpha.8",
3
+ "version": "1.2.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.1.1-alpha.8",
48
+ "@axa-fr/canopee-css": "1.2.0",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "@material-symbols/svg-700": ">= 0.19.0",
51
51
  "react": ">= 18"