@axa-fr/canopee-react 2.0.0-alpha.7 → 2.0.0-alpha.70
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.
- package/dist/client.d.ts +17 -16
- package/dist/client.js +17 -16
- package/dist/distributeur/ButtonMultiActions/ButtonMultiActions.d.ts +10 -0
- package/dist/distributeur/ButtonMultiActions/ButtonMultiActions.js +51 -0
- package/dist/distributeur/ButtonMultiActions/index.d.ts +2 -0
- package/dist/distributeur/ButtonMultiActions/index.js +1 -0
- package/dist/distributeur/Title/Title.js +1 -1
- package/dist/distributeur.d.ts +1 -0
- package/dist/distributeur.js +1 -0
- package/dist/prospect-client/AccordionCore/AccordionCoreCommon.d.ts +3 -5
- package/dist/prospect-client/AccordionCore/AccordionCoreCommon.js +10 -4
- package/dist/prospect-client/AppName/AppName.d.ts +44 -0
- package/dist/prospect-client/AppName/AppName.js +23 -0
- package/dist/prospect-client/Card/CardApollo.d.ts +1 -1
- package/dist/prospect-client/Card/CardApollo.js +1 -1
- package/dist/prospect-client/Card/CardCommon.d.ts +30 -2
- package/dist/prospect-client/Card/CardCommon.js +18 -1
- package/dist/prospect-client/Card/CardLF.d.ts +1 -1
- package/dist/prospect-client/Card/CardLF.js +1 -1
- package/dist/prospect-client/CardMessage/CardMessageCommon.js +6 -4
- package/dist/prospect-client/ContentItemDuoAction/ContentItemDuoActionCommon.d.ts +2 -2
- package/dist/prospect-client/ContentItemDuoAction/ContentItemDuoActionCommon.js +5 -2
- package/dist/prospect-client/ContentItemMono/ContentItemMonoCommon.d.ts +0 -4
- package/dist/prospect-client/ContentItemMono/ContentItemMonoCommon.js +2 -3
- package/dist/prospect-client/DataAgent/DataAgentCommon.js +2 -2
- package/dist/prospect-client/Divider/DividerCommon.js +6 -2
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxApollo.d.ts +1 -0
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.d.ts +1 -17
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.js +4 -4
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxLF.d.ts +1 -0
- package/dist/prospect-client/Form/Checkbox/Checkbox/CheckboxCommon.d.ts +2 -6
- package/dist/prospect-client/Form/Checkbox/Checkbox/CheckboxCommon.js +6 -2
- package/dist/prospect-client/Form/Checkbox/CheckboxText/CheckboxTextCommon.d.ts +1 -5
- package/dist/prospect-client/Form/Checkbox/CheckboxText/CheckboxTextCommon.js +3 -3
- package/dist/prospect-client/Form/Dropdown/DropdownCommon.d.ts +2 -10
- package/dist/prospect-client/Form/Dropdown/DropdownCommon.js +3 -3
- package/dist/prospect-client/Form/InputDate/InputDateCommon.d.ts +2 -10
- package/dist/prospect-client/Form/InputDate/InputDateCommon.js +4 -5
- package/dist/prospect-client/Form/InputPhone/InputPhoneCommon.d.ts +2 -10
- package/dist/prospect-client/Form/InputPhone/InputPhoneCommon.js +9 -5
- package/dist/prospect-client/Form/InputText/InputTextCommon.d.ts +3 -11
- package/dist/prospect-client/Form/InputText/InputTextCommon.js +6 -5
- package/dist/prospect-client/Form/ItemLabel/ItemLabelCommon.d.ts +2 -22
- package/dist/prospect-client/Form/ItemLabel/ItemLabelCommon.js +4 -5
- package/dist/prospect-client/Form/ItemMultiSelect/ItemMultiSelectApollo.d.ts +7 -0
- package/dist/prospect-client/Form/ItemMultiSelect/ItemMultiSelectApollo.js +6 -0
- package/dist/prospect-client/Form/ItemMultiSelect/ItemMultiSelectCommon.d.ts +8 -0
- package/dist/prospect-client/Form/ItemMultiSelect/ItemMultiSelectCommon.js +9 -0
- package/dist/prospect-client/Form/ItemMultiSelect/ItemMultiSelectLF.d.ts +7 -0
- package/dist/prospect-client/Form/ItemMultiSelect/ItemMultiSelectLF.js +6 -0
- package/dist/prospect-client/Form/MultiSelectList/MultiSelectListApollo.d.ts +4 -0
- package/dist/prospect-client/Form/MultiSelectList/MultiSelectListApollo.js +5 -0
- package/dist/prospect-client/Form/MultiSelectList/MultiSelectListCommon.d.ts +11 -0
- package/dist/prospect-client/Form/MultiSelectList/MultiSelectListCommon.js +2 -0
- package/dist/prospect-client/Form/MultiSelectList/MultiSelectListLF.d.ts +4 -0
- package/dist/prospect-client/Form/MultiSelectList/MultiSelectListLF.js +5 -0
- package/dist/prospect-client/Form/Radio/CardRadio/CardRadioCommon.d.ts +1 -5
- package/dist/prospect-client/Form/Radio/CardRadio/CardRadioCommon.js +4 -4
- package/dist/prospect-client/Form/Radio/CardRadioGroup/CardRadioGroupCommon.d.ts +3 -27
- package/dist/prospect-client/Form/Radio/CardRadioGroup/CardRadioGroupCommon.js +4 -6
- package/dist/prospect-client/Form/Radio/Radio/RadioCommon.d.ts +2 -5
- package/dist/prospect-client/Form/Radio/Radio/RadioCommon.js +6 -4
- package/dist/prospect-client/Form/TextArea/TextAreaCommon.d.ts +2 -6
- package/dist/prospect-client/Form/TextArea/TextAreaCommon.js +3 -3
- package/dist/prospect-client/Header/HeaderApollo.d.ts +4 -0
- package/dist/prospect-client/Header/HeaderApollo.js +8 -0
- package/dist/prospect-client/Header/HeaderCommon.d.ts +22 -0
- package/dist/prospect-client/Header/HeaderCommon.js +37 -0
- package/dist/prospect-client/Header/HeaderLF.d.ts +4 -0
- package/dist/prospect-client/Header/HeaderLF.js +8 -0
- package/dist/prospect-client/Icon/IconCommon.d.ts +1 -1
- package/dist/prospect-client/Icon/IconCommon.js +8 -9
- package/dist/prospect-client/ItemTabBar/ItemTabBarCommon.js +5 -2
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutApollo.d.ts +12 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutApollo.js +12 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutLF.d.ts +12 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutLF.js +12 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutSkeleton.d.ts +23 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutSkeleton.js +17 -0
- package/dist/prospect-client/Link/LinkCommon.d.ts +1 -5
- package/dist/prospect-client/Link/LinkCommon.js +2 -2
- package/dist/prospect-client/List/ClickItem/ClickItemCommon.d.ts +1 -0
- package/dist/prospect-client/List/ContentItemDuo/ContentItemDuoCommon.d.ts +1 -5
- package/dist/prospect-client/List/ContentItemDuo/ContentItemDuoCommon.js +3 -7
- package/dist/prospect-client/List/List/ListCommon.d.ts +27 -2
- package/dist/prospect-client/List/List/ListCommon.js +12 -0
- package/dist/prospect-client/MenuBurger/MenuBurgerApollo.d.ts +4 -0
- package/dist/prospect-client/MenuBurger/MenuBurgerApollo.js +8 -0
- package/dist/prospect-client/MenuBurger/MenuBurgerCommon.d.ts +60 -0
- package/dist/prospect-client/MenuBurger/MenuBurgerCommon.js +34 -0
- package/dist/prospect-client/MenuBurger/MenuBurgerLF.d.ts +4 -0
- package/dist/prospect-client/MenuBurger/MenuBurgerLF.js +8 -0
- package/dist/prospect-client/MessageBar/MessageBarAction.d.ts +8 -0
- package/dist/prospect-client/MessageBar/MessageBarAction.js +11 -0
- package/dist/prospect-client/MessageBar/MessageBarApollo.d.ts +5 -0
- package/dist/prospect-client/MessageBar/MessageBarApollo.js +7 -0
- package/dist/prospect-client/MessageBar/MessageBarCommon.d.ts +26 -0
- package/dist/prospect-client/MessageBar/MessageBarCommon.js +33 -0
- package/dist/prospect-client/MessageBar/MessageBarDescription.d.ts +6 -0
- package/dist/prospect-client/MessageBar/MessageBarDescription.js +8 -0
- package/dist/prospect-client/MessageBar/MessageBarLF.d.ts +5 -0
- package/dist/prospect-client/MessageBar/MessageBarLF.js +7 -0
- package/dist/prospect-client/MessageBar/MessageBarSummary.d.ts +11 -0
- package/dist/prospect-client/MessageBar/MessageBarSummary.js +2 -0
- package/dist/prospect-client/MessageBar/types.d.ts +1 -0
- package/dist/prospect-client/MessageBar/types.js +1 -0
- package/dist/prospect-client/Modal/ModalApollo.d.ts +1 -1
- package/dist/prospect-client/Modal/ModalApollo.js +1 -3
- package/dist/prospect-client/Modal/ModalCommon.d.ts +1 -1
- package/dist/prospect-client/Modal/ModalCommon.js +1 -1
- package/dist/prospect-client/Modal/ModalLF.d.ts +1 -1
- package/dist/prospect-client/Modal/ModalLF.js +1 -3
- package/dist/prospect-client/Modal/components/ModalCoreHeaderCommon.d.ts +0 -7
- package/dist/prospect-client/Modal/components/ModalCoreHeaderCommon.js +2 -12
- package/dist/prospect-client/Modal/types.d.ts +0 -15
- package/dist/prospect-client/ProgressBarGroup/ProgressBarGroupCommon.d.ts +1 -5
- package/dist/prospect-client/ProgressBarGroup/ProgressBarGroupCommon.js +1 -1
- package/dist/prospect-client/Skeleton/Skeleton.d.ts +61 -0
- package/dist/prospect-client/Skeleton/Skeleton.js +41 -0
- package/dist/prospect-client/SkeletonGrid/SkeletonGrid.d.ts +51 -0
- package/dist/prospect-client/SkeletonGrid/SkeletonGrid.js +37 -0
- package/dist/prospect-client/SkeletonList/SkeletonListApollo.d.ts +7 -0
- package/dist/prospect-client/SkeletonList/SkeletonListApollo.js +8 -2
- package/dist/prospect-client/SkeletonList/SkeletonListCommon.d.ts +21 -4
- package/dist/prospect-client/SkeletonList/SkeletonListCommon.js +18 -2
- package/dist/prospect-client/SkeletonList/SkeletonListLF.d.ts +7 -0
- package/dist/prospect-client/SkeletonList/SkeletonListLF.js +8 -2
- package/dist/prospect-client/Stepper/StepperApollo.js +2 -1
- package/dist/prospect-client/Stepper/StepperCommon.d.ts +11 -6
- package/dist/prospect-client/Stepper/StepperCommon.js +2 -3
- package/dist/prospect-client/Stepper/StepperLF.js +2 -1
- package/dist/prospect-client/TabMenu/TabMenu.js +1 -1
- package/dist/prospect-client/Tag/TagCommon.js +6 -2
- package/dist/prospect-client/Toggle/ToggleCommon.js +2 -2
- package/dist/prospect.d.ts +11 -6
- package/dist/prospect.js +11 -6
- package/package.json +2 -2
- package/dist/prospect-client/Skeleton/SkeletonApollo.d.ts +0 -2
- package/dist/prospect-client/Skeleton/SkeletonApollo.js +0 -2
- package/dist/prospect-client/Skeleton/SkeletonCommon.d.ts +0 -19
- package/dist/prospect-client/Skeleton/SkeletonCommon.js +0 -11
- package/dist/prospect-client/Skeleton/SkeletonLF.d.ts +0 -2
- package/dist/prospect-client/Skeleton/SkeletonLF.js +0 -2
- package/dist/prospect-client/utilities/getComponentClassName.d.ts +0 -4
- package/dist/prospect-client/utilities/getComponentClassName.js +0 -30
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/canopee-css/prospect/MenuBurger/MenuBurgerAll.css";
|
|
3
|
+
import { Button } from "../Button/ButtonApollo";
|
|
4
|
+
import { Icon } from "../Icon/IconApollo";
|
|
5
|
+
import { ClickItem } from "../List/ClickItem/ClickItemApollo";
|
|
6
|
+
import { List } from "../List/List/ListApollo";
|
|
7
|
+
import { MenuBurgerCommon } from "./MenuBurgerCommon";
|
|
8
|
+
export const MenuBurger = (props) => (_jsx(MenuBurgerCommon, { ButtonComponent: Button, ClickItemComponent: ClickItem, IconComponent: Icon, ListComponent: List, ...props }));
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ComponentType, type ReactNode, type PropsWithChildren } from "react";
|
|
2
|
+
import type { ButtonProps } from "../Button/ButtonCommon";
|
|
3
|
+
import type { IconProps } from "../Icon/IconCommon";
|
|
4
|
+
import type { ClickItemProps } from "../List/ClickItem/ClickItemCommon";
|
|
5
|
+
import type { ListProps } from "../List/List/ListCommon";
|
|
6
|
+
export declare const menuBurgerVariants: {
|
|
7
|
+
readonly primary: "primary";
|
|
8
|
+
readonly secondary: "secondary";
|
|
9
|
+
};
|
|
10
|
+
export type MenuBurgerVariants = keyof typeof menuBurgerVariants;
|
|
11
|
+
export type MenuBurgerClickItemProps = Omit<ClickItemProps, "variant"> & {
|
|
12
|
+
variant?: ClickItemProps["variant"];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Props for the MenuBurger component.
|
|
16
|
+
*/
|
|
17
|
+
export type MenuBurgerProps = {
|
|
18
|
+
/**
|
|
19
|
+
* Label displayed inside the trigger button.
|
|
20
|
+
*/
|
|
21
|
+
buttonLabel: string;
|
|
22
|
+
/**
|
|
23
|
+
* Extra content rendered below the ClickItem list.
|
|
24
|
+
*/
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Icon displayed on the left side of the trigger button.
|
|
28
|
+
* @default person
|
|
29
|
+
*/
|
|
30
|
+
icon?: IconProps["src"];
|
|
31
|
+
/**
|
|
32
|
+
* Visual variant of the trigger button.
|
|
33
|
+
* @default primary
|
|
34
|
+
*/
|
|
35
|
+
variant?: MenuBurgerVariants;
|
|
36
|
+
/**
|
|
37
|
+
* ClickItem list rendered inside the popover panel.
|
|
38
|
+
*/
|
|
39
|
+
clickItems?: MenuBurgerClickItemProps[];
|
|
40
|
+
} & Omit<ComponentPropsWithoutRef<"div">, "children">;
|
|
41
|
+
type MenuBurgerCommonProps = PropsWithChildren<MenuBurgerProps> & {
|
|
42
|
+
ButtonComponent: ComponentType<ButtonProps>;
|
|
43
|
+
ClickItemComponent: ComponentType<ClickItemProps>;
|
|
44
|
+
IconComponent: ComponentType<IconProps>;
|
|
45
|
+
ListComponent: ComponentType<ListProps>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Renders a burger-style menu button opening a popover panel with navigation and actions.
|
|
49
|
+
*
|
|
50
|
+
* @component
|
|
51
|
+
* @param {PropsWithChildren<MenuBurgerProps>} props - MenuBurger props.
|
|
52
|
+
* @param {string} props.buttonLabel - Label shown in the trigger button.
|
|
53
|
+
* @param {IconProps["src"]} [props.icon=person] - Icon shown on the left of the trigger button.
|
|
54
|
+
* @param {MenuBurgerVariants} [props.variant=primary] - Visual variant of the trigger button.
|
|
55
|
+
* @param {ClickItemProps[]} [props.clickItems] - Click items displayed under the links.
|
|
56
|
+
* @param {React.ReactNode} [props.children] - Extra content rendered below the ClickItem list.
|
|
57
|
+
* @returns {JSX.Element} The rendered MenuBurger component.
|
|
58
|
+
*/
|
|
59
|
+
export declare const MenuBurgerCommon: ({ buttonLabel, icon, variant, clickItems, children, className, ButtonComponent, ClickItemComponent, IconComponent, ListComponent, ...props }: MenuBurgerCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import keyboardArrowDown from "@material-symbols/svg-400/outlined/keyboard_arrow_down.svg";
|
|
3
|
+
import person from "@material-symbols/svg-400/outlined/person.svg";
|
|
4
|
+
import { useId, } from "react";
|
|
5
|
+
import { getClassName } from "../utilities/getClassName";
|
|
6
|
+
import { useIsSmallScreen } from "../utilities/hook/useIsSmallScreen";
|
|
7
|
+
import { BREAKPOINT } from "../utilities/constants";
|
|
8
|
+
export const menuBurgerVariants = {
|
|
9
|
+
primary: "primary",
|
|
10
|
+
secondary: "secondary",
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Renders a burger-style menu button opening a popover panel with navigation and actions.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {PropsWithChildren<MenuBurgerProps>} props - MenuBurger props.
|
|
17
|
+
* @param {string} props.buttonLabel - Label shown in the trigger button.
|
|
18
|
+
* @param {IconProps["src"]} [props.icon=person] - Icon shown on the left of the trigger button.
|
|
19
|
+
* @param {MenuBurgerVariants} [props.variant=primary] - Visual variant of the trigger button.
|
|
20
|
+
* @param {ClickItemProps[]} [props.clickItems] - Click items displayed under the links.
|
|
21
|
+
* @param {React.ReactNode} [props.children] - Extra content rendered below the ClickItem list.
|
|
22
|
+
* @returns {JSX.Element} The rendered MenuBurger component.
|
|
23
|
+
*/
|
|
24
|
+
export const MenuBurgerCommon = ({ buttonLabel, icon = person, variant = "primary", clickItems, children, className, ButtonComponent, ClickItemComponent, IconComponent, ListComponent, ...props }) => {
|
|
25
|
+
const isSmallScreen = useIsSmallScreen(BREAKPOINT.MD);
|
|
26
|
+
const isDesktop = !isSmallScreen;
|
|
27
|
+
const popoverId = useId();
|
|
28
|
+
const triggerId = `${popoverId}-trigger`;
|
|
29
|
+
const iconVariant = variant === "primary" ? "secondary" : "primary";
|
|
30
|
+
return (_jsxs("div", { className: getClassName({
|
|
31
|
+
baseClassName: "af-menu-burger",
|
|
32
|
+
className,
|
|
33
|
+
}), ...props, children: [isDesktop ? (_jsx(ButtonComponent, { id: triggerId, className: "af-menu-burger__button", variant: variant, iconLeft: _jsx(IconComponent, { src: icon, alt: "", role: "presentation", size: "S", variant: iconVariant }), iconRight: _jsx(IconComponent, { className: "af-menu-burger__button-icon--suffix", src: keyboardArrowDown, alt: "", role: "presentation", size: "S", variant: iconVariant }), popoverTarget: popoverId, popoverTargetAction: "toggle", "aria-haspopup": "true", children: buttonLabel })) : null, _jsxs("section", { id: isDesktop ? popoverId : undefined, popover: isDesktop ? "auto" : undefined, className: "af-menu-burger__panel", "aria-labelledby": isDesktop ? triggerId : undefined, children: [clickItems && clickItems.length > 0 ? (_jsx("div", { className: "af-menu-burger__section af-menu-burger__section--actions", children: _jsx(ListComponent, { className: "af-menu-burger__click-items", variant: "unstyled", children: clickItems.map((clickItem) => (_jsx(ClickItemComponent, { variant: clickItem.variant ?? "small", ...clickItem }, clickItem.title))) }) })) : null, children ? (_jsx("div", { className: "af-menu-burger__section af-menu-burger__content", children: children })) : null] })] }));
|
|
34
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/canopee-css/client/MenuBurger/MenuBurgerAll.css";
|
|
3
|
+
import { Button } from "../Button/ButtonLF";
|
|
4
|
+
import { Icon } from "../Icon/IconLF";
|
|
5
|
+
import { ClickItem } from "../List/ClickItem/ClickItemLF";
|
|
6
|
+
import { List } from "../List/List/ListLF";
|
|
7
|
+
import { MenuBurgerCommon } from "./MenuBurgerCommon";
|
|
8
|
+
export const MenuBurger = (props) => (_jsx(MenuBurgerCommon, { ButtonComponent: Button, ClickItemComponent: ClickItem, IconComponent: Icon, ListComponent: List, ...props }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { ButtonProps } from "../Button/ButtonCommon";
|
|
3
|
+
type MessageBarActionProps = {
|
|
4
|
+
buttonProps?: ButtonProps;
|
|
5
|
+
ButtonComponent: ComponentType<ButtonProps>;
|
|
6
|
+
};
|
|
7
|
+
export declare const MessageBarAction: ({ buttonProps, ButtonComponent, }: MessageBarActionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName } from "../utilities/getClassName";
|
|
3
|
+
export const MessageBarAction = ({ buttonProps, ButtonComponent, }) => {
|
|
4
|
+
if (!buttonProps) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return (_jsx(ButtonComponent, { ...buttonProps, className: getClassName({
|
|
8
|
+
baseClassName: "af-message-bar__action",
|
|
9
|
+
className: buttonProps.className,
|
|
10
|
+
}) }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@axa-fr/canopee-css/prospect/MessageBar/MessageBarAll.css";
|
|
2
|
+
import { type MessageBarProps } from "./MessageBarCommon";
|
|
3
|
+
export type { MessageBarProps } from "./MessageBarCommon";
|
|
4
|
+
export type { MessageBarVariant } from "./types";
|
|
5
|
+
export declare const MessageBar: (props: MessageBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/canopee-css/prospect/MessageBar/MessageBarAll.css";
|
|
3
|
+
import { AccordionCore } from "../AccordionCore/AccordionCoreApollo";
|
|
4
|
+
import { Button } from "../Button/ButtonApollo";
|
|
5
|
+
import { Icon } from "../Icon/IconApollo";
|
|
6
|
+
import { MessageBarCommon } from "./MessageBarCommon";
|
|
7
|
+
export const MessageBar = (props) => (_jsx(MessageBarCommon, { ...props, AccordionCoreComponent: AccordionCore, ButtonComponent: Button, IconComponent: Icon }));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import type { AccordionCoreProps } from "../AccordionCore/AccordionCoreCommon";
|
|
3
|
+
import type { ButtonProps } from "../Button/ButtonCommon";
|
|
4
|
+
import type { IconProps } from "../Icon/IconCommon";
|
|
5
|
+
import type { MessageBarVariant } from "./types";
|
|
6
|
+
export type MessageBarProps = {
|
|
7
|
+
/** Message title. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Description. Always visible on desktop and collapsible on mobile. */
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/** Icon displayed before the title. */
|
|
12
|
+
icon: string;
|
|
13
|
+
/** Visual variant. */
|
|
14
|
+
variant?: MessageBarVariant;
|
|
15
|
+
/** Initial mobile expanded state for the description. */
|
|
16
|
+
defaultDescriptionOpen?: boolean;
|
|
17
|
+
/** Action button props. No button is rendered when omitted. */
|
|
18
|
+
buttonProps?: ButtonProps;
|
|
19
|
+
} & Omit<ComponentPropsWithoutRef<"section">, "children">;
|
|
20
|
+
type MessageBarCommonProps = MessageBarProps & {
|
|
21
|
+
AccordionCoreComponent: ComponentType<AccordionCoreProps>;
|
|
22
|
+
ButtonComponent: ComponentType<ButtonProps>;
|
|
23
|
+
IconComponent: ComponentType<IconProps>;
|
|
24
|
+
};
|
|
25
|
+
export declare const MessageBarCommon: ({ title, description, icon, variant, defaultDescriptionOpen, buttonProps, className, AccordionCoreComponent, ButtonComponent, IconComponent, ...sectionProps }: MessageBarCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, } from "react";
|
|
3
|
+
import { BREAKPOINT } from "../utilities/constants";
|
|
4
|
+
import { getClassName } from "../utilities/getClassName";
|
|
5
|
+
import { useIsSmallScreen } from "../utilities/hook/useIsSmallScreen";
|
|
6
|
+
import { MessageBarAction } from "./MessageBarAction";
|
|
7
|
+
import { MessageBarDescription } from "./MessageBarDescription";
|
|
8
|
+
import { MessageBarSummary } from "./MessageBarSummary";
|
|
9
|
+
const iconVariantByMessageBarVariant = {
|
|
10
|
+
info: "primary",
|
|
11
|
+
error: "error",
|
|
12
|
+
};
|
|
13
|
+
export const MessageBarCommon = ({ title, description, icon, variant = "info", defaultDescriptionOpen = false, buttonProps, className, AccordionCoreComponent, ButtonComponent, IconComponent, ...sectionProps }) => {
|
|
14
|
+
const titleId = useId();
|
|
15
|
+
const isMobile = useIsSmallScreen(BREAKPOINT.MD);
|
|
16
|
+
const hasDescription = Boolean(description);
|
|
17
|
+
const sectionAriaLabelledBy = sectionProps["aria-label"] || sectionProps["aria-labelledby"]
|
|
18
|
+
? undefined
|
|
19
|
+
: titleId;
|
|
20
|
+
const iconVariant = iconVariantByMessageBarVariant[variant];
|
|
21
|
+
const componentClassName = getClassName({
|
|
22
|
+
baseClassName: "af-message-bar",
|
|
23
|
+
modifiers: [variant],
|
|
24
|
+
className,
|
|
25
|
+
});
|
|
26
|
+
const summary = (_jsx(MessageBarSummary, { title: title, titleId: titleId, icon: icon, iconVariant: iconVariant, IconComponent: IconComponent }));
|
|
27
|
+
const action = (_jsx(MessageBarAction, { buttonProps: buttonProps, ButtonComponent: ButtonComponent }));
|
|
28
|
+
const body = _jsx(MessageBarDescription, { description: description });
|
|
29
|
+
if (hasDescription && isMobile) {
|
|
30
|
+
return (_jsxs(AccordionCoreComponent, { className: componentClassName, role: "region", "aria-labelledby": sectionAriaLabelledBy, open: defaultDescriptionOpen, summary: summary, summaryProps: { className: "af-message-bar__header" }, arrowClickIconVariant: "ghost", arrowIconVariant: iconVariant, ...sectionProps, children: [body, action] }));
|
|
31
|
+
}
|
|
32
|
+
return (_jsxs("section", { className: componentClassName, "aria-labelledby": sectionAriaLabelledBy, ...sectionProps, children: [_jsx("div", { className: "af-message-bar__header", children: summary }), body, action] }));
|
|
33
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const MessageBarDescription = ({ description, }) => {
|
|
3
|
+
if (!description) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
const Component = typeof description === "string" ? "p" : "div";
|
|
7
|
+
return _jsx(Component, { className: "af-message-bar__body", children: description });
|
|
8
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@axa-fr/canopee-css/client/MessageBar/MessageBarAll.css";
|
|
2
|
+
import { type MessageBarProps } from "./MessageBarCommon";
|
|
3
|
+
export type { MessageBarProps } from "./MessageBarCommon";
|
|
4
|
+
export type { MessageBarVariant } from "./types";
|
|
5
|
+
export declare const MessageBar: (props: MessageBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/canopee-css/client/MessageBar/MessageBarAll.css";
|
|
3
|
+
import { AccordionCore } from "../AccordionCore/AccordionCoreLF";
|
|
4
|
+
import { Button } from "../Button/ButtonLF";
|
|
5
|
+
import { Icon } from "../Icon/IconLF";
|
|
6
|
+
import { MessageBarCommon } from "./MessageBarCommon";
|
|
7
|
+
export const MessageBar = (props) => (_jsx(MessageBarCommon, { ...props, AccordionCoreComponent: AccordionCore, ButtonComponent: Button, IconComponent: Icon }));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { IconProps } from "../Icon/IconCommon";
|
|
3
|
+
type MessageBarSummaryProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
titleId: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
iconVariant: IconProps["variant"];
|
|
8
|
+
IconComponent: ComponentType<IconProps>;
|
|
9
|
+
};
|
|
10
|
+
export declare const MessageBarSummary: ({ title, titleId, icon, iconVariant, IconComponent, }: MessageBarSummaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const MessageBarSummary = ({ title, titleId, icon, iconVariant, IconComponent, }) => (_jsxs(_Fragment, { children: [_jsx(IconComponent, { src: icon, className: "af-message-bar__icon", role: "presentation", variant: iconVariant }), _jsx("p", { id: titleId, className: "af-message-bar__title", children: title })] }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MessageBarVariant = "info" | "error";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,6 +6,6 @@ export { ModalCoreFooter } from "./components/ModalCoreFooterApollo";
|
|
|
6
6
|
export { ModalCoreHeader } from "./components/ModalCoreHeaderApollo";
|
|
7
7
|
export type { ModalCoreFooterProps, ModalCoreHeaderProps, ModalProps, } from "./types";
|
|
8
8
|
export declare const Modal: {
|
|
9
|
-
({ headingProps,
|
|
9
|
+
({ headingProps, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
@@ -7,10 +7,8 @@ export { ModalCore } from "./components/ModalCore";
|
|
|
7
7
|
export { ModalCoreBody, } from "./components/ModalCoreBody";
|
|
8
8
|
export { ModalCoreFooter } from "./components/ModalCoreFooterApollo";
|
|
9
9
|
export { ModalCoreHeader } from "./components/ModalCoreHeaderApollo";
|
|
10
|
-
export const Modal = ({ headingProps = {},
|
|
10
|
+
export const Modal = ({ headingProps = {}, ...props }) => (_jsx(ModalCommon, { ...props, headingComponent: Heading, headingProps: {
|
|
11
11
|
...headingProps,
|
|
12
12
|
children: props.title,
|
|
13
|
-
icon: headingProps.icon ?? icon,
|
|
14
|
-
iconProps: headingProps.iconProps ?? iconProps,
|
|
15
13
|
}, buttonComponent: Button }));
|
|
16
14
|
Modal.displayName = "Modal";
|
|
@@ -8,6 +8,6 @@ export type ModalCommonProps = ModalCoreProps & Omit<ModalCoreHeaderCommonProps,
|
|
|
8
8
|
modalCoreHeaderProps?: ModalCoreHeaderContainerProps;
|
|
9
9
|
};
|
|
10
10
|
export declare const ModalCommon: {
|
|
11
|
-
({ children, headingComponent, headingProps, closeButtonAriaLabel, onClose,
|
|
11
|
+
({ children, headingComponent, headingProps, closeButtonAriaLabel, onClose, primaryButtonProps, secondaryButtonProps, tertiaryButtonProps, buttonComponent, modalCoreBodyProps, modalCoreFooterProps, modalCoreHeaderProps, ...props }: ModalCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
@@ -3,5 +3,5 @@ import { ModalCore } from "./components/ModalCore";
|
|
|
3
3
|
import { ModalCoreBody, } from "./components/ModalCoreBody";
|
|
4
4
|
import { ModalCoreFooterCommon, } from "./components/ModalCoreFooterCommon";
|
|
5
5
|
import { ModalCoreHeaderCommon } from "./components/ModalCoreHeaderCommon";
|
|
6
|
-
export const ModalCommon = ({ children, headingComponent, headingProps, closeButtonAriaLabel, onClose,
|
|
6
|
+
export const ModalCommon = ({ children, headingComponent, headingProps, closeButtonAriaLabel, onClose, primaryButtonProps, secondaryButtonProps, tertiaryButtonProps, buttonComponent, modalCoreBodyProps, modalCoreFooterProps, modalCoreHeaderProps, ...props }) => (_jsxs(ModalCore, { onClose: onClose, ...props, children: [_jsx(ModalCoreHeaderCommon, { headingComponent: headingComponent, headingProps: headingProps, onClose: onClose, closeButtonAriaLabel: closeButtonAriaLabel, ...modalCoreHeaderProps }), _jsx(ModalCoreBody, { ...modalCoreBodyProps, children: children }), _jsx(ModalCoreFooterCommon, { buttonComponent: buttonComponent, primaryButtonProps: primaryButtonProps, secondaryButtonProps: secondaryButtonProps, tertiaryButtonProps: tertiaryButtonProps, ...modalCoreFooterProps })] }));
|
|
7
7
|
ModalCommon.displayName = "ModalCommon";
|
|
@@ -6,6 +6,6 @@ export { ModalCoreFooter } from "./components/ModalCoreFooterLF";
|
|
|
6
6
|
export { ModalCoreHeader } from "./components/ModalCoreHeaderLF";
|
|
7
7
|
export type { ModalCoreFooterProps, ModalCoreHeaderProps, ModalProps, } from "./types";
|
|
8
8
|
export declare const Modal: {
|
|
9
|
-
({ headingProps,
|
|
9
|
+
({ headingProps, ...props }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
@@ -7,10 +7,8 @@ export { ModalCore } from "./components/ModalCore";
|
|
|
7
7
|
export { ModalCoreBody, } from "./components/ModalCoreBody";
|
|
8
8
|
export { ModalCoreFooter } from "./components/ModalCoreFooterLF";
|
|
9
9
|
export { ModalCoreHeader } from "./components/ModalCoreHeaderLF";
|
|
10
|
-
export const Modal = ({ headingProps = {},
|
|
10
|
+
export const Modal = ({ headingProps = {}, ...props }) => (_jsx(ModalCommon, { ...props, headingComponent: Heading, headingProps: {
|
|
11
11
|
...headingProps,
|
|
12
12
|
children: props.title,
|
|
13
|
-
icon: headingProps.icon ?? icon,
|
|
14
|
-
iconProps: headingProps.iconProps ?? iconProps,
|
|
15
13
|
}, buttonComponent: Button }));
|
|
16
14
|
Modal.displayName = "Modal";
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ComponentType } from "react";
|
|
2
2
|
import type { HeadingProps } from "../../Heading/types";
|
|
3
|
-
import type { IconProps } from "../../Icon/IconCommon";
|
|
4
3
|
export type ModalCoreHeaderContainerProps = ComponentPropsWithoutRef<"header">;
|
|
5
4
|
export type ModalCoreHeaderCommonProps = ModalCoreHeaderContainerProps & {
|
|
6
5
|
headingComponent: ComponentType<HeadingProps>;
|
|
7
6
|
headingProps: HeadingProps;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Pass `icon` and `iconProps` (without `src`) inside
|
|
10
|
-
* `headingProps` instead. The legacy `iconProps` is forwarded to the
|
|
11
|
-
* Heading molecule for backward compatibility and will be removed in 2.0.0.
|
|
12
|
-
*/
|
|
13
|
-
iconProps?: IconProps;
|
|
14
7
|
onClose?: VoidFunction;
|
|
15
8
|
closeButtonAriaLabel?: string;
|
|
16
9
|
};
|
|
@@ -2,16 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import close from "@material-symbols/svg-400/rounded/close.svg";
|
|
3
3
|
import { ClickIcon } from "../../ClickIcon/ClickIconCommon";
|
|
4
4
|
export const ModalCoreHeaderCommon = (props) => {
|
|
5
|
-
const { className, headingComponent: HeadingComponent, headingProps,
|
|
6
|
-
|
|
7
|
-
// Heading molecule, which already renders the icon and title together.
|
|
8
|
-
const { src: legacyIconSrc, ...legacyIconRest } = iconProps ?? {};
|
|
9
|
-
const mergedHeadingProps = legacyIconSrc
|
|
10
|
-
? {
|
|
11
|
-
...headingProps,
|
|
12
|
-
icon: headingProps.icon ?? legacyIconSrc,
|
|
13
|
-
iconProps: { ...legacyIconRest, ...(headingProps.iconProps ?? {}) },
|
|
14
|
-
}
|
|
15
|
-
: headingProps;
|
|
16
|
-
return (_jsxs("header", { className: ["af-modal__header", className].filter(Boolean).join(" "), ...rest, children: [_jsx(ClickIcon, { className: "af-modal__header-close-btn", src: close, onClick: onClose, "aria-label": closeButtonAriaLabel }), _jsx("div", { className: "af-modal__header-title", children: _jsx(HeadingComponent, { level: 2, ...mergedHeadingProps }) })] }));
|
|
5
|
+
const { className, headingComponent: HeadingComponent, headingProps, onClose, closeButtonAriaLabel = "Fermer la boite de dialogue", ...rest } = props;
|
|
6
|
+
return (_jsxs("header", { className: ["af-modal__header", className].filter(Boolean).join(" "), ...rest, children: [_jsx(ClickIcon, { className: "af-modal__header-close-btn", src: close, onClick: onClose, "aria-label": closeButtonAriaLabel }), _jsx("div", { className: "af-modal__header-title", children: _jsx(HeadingComponent, { level: 2, ...headingProps }) })] }));
|
|
17
7
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { HeadingProps } from "../Heading/types";
|
|
2
|
-
import type { IconProps } from "../Icon/IconCommon";
|
|
3
2
|
import type { ModalCoreFooterCommonProps } from "./components/ModalCoreFooterCommon";
|
|
4
3
|
import type { ModalCoreHeaderCommonProps } from "./components/ModalCoreHeaderCommon";
|
|
5
4
|
import type { ModalCommonProps } from "./ModalCommon";
|
|
@@ -7,18 +6,4 @@ export type ModalCoreHeaderProps = Omit<ModalCoreHeaderCommonProps, "headingComp
|
|
|
7
6
|
export type ModalCoreFooterProps = Omit<ModalCoreFooterCommonProps, "buttonComponent">;
|
|
8
7
|
export type ModalProps = Omit<ModalCommonProps, "headingComponent" | "headingProps" | "iconProps" | "buttonComponent"> & {
|
|
9
8
|
headingProps?: Omit<HeadingProps, "children">;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Pass `icon` inside `headingProps` instead
|
|
12
|
-
* (e.g. `headingProps={{ icon }}`). The top-level `icon` prop is
|
|
13
|
-
* forwarded to the Heading molecule for backward compatibility and will
|
|
14
|
-
* be removed in 2.0.0.
|
|
15
|
-
*/
|
|
16
|
-
icon?: string;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Pass `iconProps` inside `headingProps` instead
|
|
19
|
-
* (e.g. `headingProps={{ iconProps }}`). The top-level `iconProps`
|
|
20
|
-
* is forwarded to the Heading molecule for backward compatibility and
|
|
21
|
-
* will be removed in 2.0.0.
|
|
22
|
-
*/
|
|
23
|
-
iconProps?: Omit<IconProps, "src">;
|
|
24
9
|
};
|
|
@@ -3,10 +3,6 @@ import { ProgressBar } from "../ProgressBar/ProgressBarCommon";
|
|
|
3
3
|
export type ProgressBarGroupProps = {
|
|
4
4
|
currentStepProgress?: number;
|
|
5
5
|
currentStep: number;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use `stepsCount` instead.
|
|
8
|
-
*/
|
|
9
|
-
nbSteps?: 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
10
6
|
stepsCount?: 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
11
7
|
max?: number;
|
|
12
8
|
className?: string;
|
|
@@ -14,5 +10,5 @@ export type ProgressBarGroupProps = {
|
|
|
14
10
|
type ProgressBarGroupCommonProps = ProgressBarGroupProps & {
|
|
15
11
|
ProgressBarComponent: ComponentType<ComponentProps<typeof ProgressBar>>;
|
|
16
12
|
};
|
|
17
|
-
export declare const ProgressBarGroupCommon: ({ currentStepProgress, max,
|
|
13
|
+
export declare const ProgressBarGroupCommon: ({ currentStepProgress, max, stepsCount, currentStep, className, ProgressBarComponent, ...props }: ProgressBarGroupCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
14
|
export {};
|
|
@@ -3,7 +3,7 @@ import classNames from "classnames";
|
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { ProgressBar } from "../ProgressBar/ProgressBarCommon";
|
|
5
5
|
import { useSequentialProgress } from "./useSequentialProgress";
|
|
6
|
-
export const ProgressBarGroupCommon = ({ currentStepProgress = 0, max = 100,
|
|
6
|
+
export const ProgressBarGroupCommon = ({ currentStepProgress = 0, max = 100, stepsCount = 4, currentStep, className, ProgressBarComponent, ...props }) => {
|
|
7
7
|
const stepperId = useId();
|
|
8
8
|
const progressValues = useSequentialProgress(currentStepProgress / max, currentStep, stepsCount);
|
|
9
9
|
return (_jsx("ol", { className: classNames("af-progress-bar-group", className), ...props, children: progressValues.map((value, index) => (_jsx("li", { className: "af-progress-bar-group__item", children: _jsx(ProgressBarComponent, { value: value, "aria-hidden": true }) }, `af-progress-bar-group__item--${stepperId}-${index}`))) }));
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import "@axa-fr/canopee-css/client/Skeleton/SkeletonAll.css";
|
|
3
|
+
export declare const skeletonVariants: {
|
|
4
|
+
readonly action: "action";
|
|
5
|
+
readonly circle: "circle";
|
|
6
|
+
readonly rectangle: "rectangle";
|
|
7
|
+
};
|
|
8
|
+
export type SkeletonVariant = keyof typeof skeletonVariants;
|
|
9
|
+
export declare const skeletonSizeVariants: {
|
|
10
|
+
readonly XS: "extra-small";
|
|
11
|
+
readonly S: "small";
|
|
12
|
+
readonly M: "medium";
|
|
13
|
+
readonly L: "large";
|
|
14
|
+
readonly XL: "extra-large";
|
|
15
|
+
readonly XXL: "extra-extra-large";
|
|
16
|
+
};
|
|
17
|
+
export type SkeletonSizeVariant = keyof typeof skeletonSizeVariants;
|
|
18
|
+
export type SkeletonCircleSizeVariant = keyof Pick<typeof skeletonSizeVariants, "S" | "M" | "L">;
|
|
19
|
+
export type SkeletonActionSizeVariant = keyof Pick<typeof skeletonSizeVariants, "M">;
|
|
20
|
+
type SkeletonSharedProps = {
|
|
21
|
+
colSize?: number;
|
|
22
|
+
rowSize?: number;
|
|
23
|
+
} & ComponentPropsWithoutRef<"div">;
|
|
24
|
+
type SkeletonCircleProps = {
|
|
25
|
+
size?: SkeletonCircleSizeVariant;
|
|
26
|
+
variant: "circle";
|
|
27
|
+
};
|
|
28
|
+
type SkeletonActionProps = {
|
|
29
|
+
size?: SkeletonActionSizeVariant;
|
|
30
|
+
variant: "action";
|
|
31
|
+
};
|
|
32
|
+
type SkeletonRectangleProps = {
|
|
33
|
+
size?: SkeletonSizeVariant;
|
|
34
|
+
variant?: "rectangle";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Props for the `Skeleton` component.
|
|
38
|
+
*
|
|
39
|
+
* The allowed `size` values depend on the selected `variant`:
|
|
40
|
+
* - `circle`: `S | M | L`
|
|
41
|
+
* - `action`: `M`
|
|
42
|
+
* - `rectangle`: `XS | S | M | L | XL | XXL`
|
|
43
|
+
*/
|
|
44
|
+
export type SkeletonProps = SkeletonSharedProps & (SkeletonCircleProps | SkeletonActionProps | SkeletonRectangleProps);
|
|
45
|
+
/**
|
|
46
|
+
* Renders one skeleton placeholder block.
|
|
47
|
+
*
|
|
48
|
+
* This is the base building block used by `SkeletonGrid`, `SkeletonList`,
|
|
49
|
+
* and `ExitLayoutSkeleton`.
|
|
50
|
+
*
|
|
51
|
+
* @component
|
|
52
|
+
* @param {SkeletonProps} props - Skeleton props.
|
|
53
|
+
* @param {number} [props.colSize=1] - Number of grid columns occupied by the skeleton.
|
|
54
|
+
* @param {number} [props.rowSize=1] - Number of grid rows occupied by the skeleton.
|
|
55
|
+
* @param {SkeletonVariant} [props.variant="rectangle"] - Visual variant of the placeholder.
|
|
56
|
+
* @param {SkeletonSizeVariant | SkeletonCircleSizeVariant | SkeletonActionSizeVariant} [props.size="M"] - Size applied to the skeleton. The accepted values depend on `variant`.
|
|
57
|
+
* @param {string} [props.className] - Additional CSS class applied to the skeleton.
|
|
58
|
+
* @returns {JSX.Element} The rendered Skeleton component.
|
|
59
|
+
*/
|
|
60
|
+
export declare const Skeleton: ({ className, colSize, rowSize, size, variant, style, ...props }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/canopee-css/client/Skeleton/SkeletonAll.css";
|
|
3
|
+
import { getClassName } from "../utilities/getClassName";
|
|
4
|
+
const CLASS_NAME = "af-skeleton";
|
|
5
|
+
export const skeletonVariants = {
|
|
6
|
+
action: "action",
|
|
7
|
+
circle: "circle",
|
|
8
|
+
rectangle: "rectangle",
|
|
9
|
+
};
|
|
10
|
+
export const skeletonSizeVariants = {
|
|
11
|
+
XS: "extra-small",
|
|
12
|
+
S: "small",
|
|
13
|
+
M: "medium",
|
|
14
|
+
L: "large",
|
|
15
|
+
XL: "extra-large",
|
|
16
|
+
XXL: "extra-extra-large",
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Renders one skeleton placeholder block.
|
|
20
|
+
*
|
|
21
|
+
* This is the base building block used by `SkeletonGrid`, `SkeletonList`,
|
|
22
|
+
* and `ExitLayoutSkeleton`.
|
|
23
|
+
*
|
|
24
|
+
* @component
|
|
25
|
+
* @param {SkeletonProps} props - Skeleton props.
|
|
26
|
+
* @param {number} [props.colSize=1] - Number of grid columns occupied by the skeleton.
|
|
27
|
+
* @param {number} [props.rowSize=1] - Number of grid rows occupied by the skeleton.
|
|
28
|
+
* @param {SkeletonVariant} [props.variant="rectangle"] - Visual variant of the placeholder.
|
|
29
|
+
* @param {SkeletonSizeVariant | SkeletonCircleSizeVariant | SkeletonActionSizeVariant} [props.size="M"] - Size applied to the skeleton. The accepted values depend on `variant`.
|
|
30
|
+
* @param {string} [props.className] - Additional CSS class applied to the skeleton.
|
|
31
|
+
* @returns {JSX.Element} The rendered Skeleton component.
|
|
32
|
+
*/
|
|
33
|
+
export const Skeleton = ({ className, colSize = 1, rowSize = 1, size = "M", variant = "rectangle", style, ...props }) => (_jsx("div", { ...props, className: getClassName({
|
|
34
|
+
baseClassName: CLASS_NAME,
|
|
35
|
+
modifiers: [variant, skeletonSizeVariants[size]],
|
|
36
|
+
className,
|
|
37
|
+
}), style: {
|
|
38
|
+
"--col-size": colSize,
|
|
39
|
+
"--row-size": rowSize,
|
|
40
|
+
...style,
|
|
41
|
+
} }));
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type SkeletonProps } from "../Skeleton/Skeleton";
|
|
3
|
+
import "@axa-fr/canopee-css/prospect/SkeletonGrid/SkeletonGridAll.css";
|
|
4
|
+
/**
|
|
5
|
+
* One skeleton cell rendered inside a `SkeletonGrid` row.
|
|
6
|
+
*/
|
|
7
|
+
export type SkeletonGridItem = SkeletonProps;
|
|
8
|
+
type isLoadingAndChildrenProps = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
children?: undefined;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Props for the `SkeletonGrid` component.
|
|
17
|
+
*
|
|
18
|
+
* `grid` is a two-level array where:
|
|
19
|
+
* - first level represents rows
|
|
20
|
+
* - second level represents skeleton cells rendered in each row
|
|
21
|
+
*/
|
|
22
|
+
export type SkeletonGridProps = {
|
|
23
|
+
className?: string;
|
|
24
|
+
grid: SkeletonGridItem[][];
|
|
25
|
+
"aria-busy"?: boolean;
|
|
26
|
+
"aria-label"?: string;
|
|
27
|
+
maxCols?: number;
|
|
28
|
+
colGap?: number;
|
|
29
|
+
rowGap?: number;
|
|
30
|
+
} & isLoadingAndChildrenProps;
|
|
31
|
+
/**
|
|
32
|
+
* Renders a responsive grid of skeleton placeholders.
|
|
33
|
+
*
|
|
34
|
+
* When `isLoading` is `false`, the component returns its `children` instead of
|
|
35
|
+
* the skeleton grid.
|
|
36
|
+
*
|
|
37
|
+
* @component
|
|
38
|
+
* @param {SkeletonGridProps} props - SkeletonGrid props.
|
|
39
|
+
* @param {SkeletonGridItem[][]} props.grid - Grid definition where each row contains one or more skeleton cells.
|
|
40
|
+
* @param {number} [props.maxCols=12] - Number of columns used to build the grid template.
|
|
41
|
+
* @param {number} [props.colGap=16] - Horizontal gap between grid columns, in pixels.
|
|
42
|
+
* @param {number} [props.rowGap=8] - Vertical gap between grid rows, in pixels.
|
|
43
|
+
* @param {boolean} [props.isLoading=true] - When `true`, displays the skeleton placeholders.
|
|
44
|
+
* @param {ReactNode} [props.children] - Content rendered when `isLoading` is `false`.
|
|
45
|
+
* @param {string} [props.className] - Additional CSS class applied to the root element.
|
|
46
|
+
* @param {string} [props.aria-label="Chargement"] - Accessible label for the loading region.
|
|
47
|
+
* @param {boolean} [props.aria-busy=true] - Announces the loading region as busy to assistive technologies.
|
|
48
|
+
* @returns {JSX.Element | ReactNode} The rendered skeleton grid or the fallback children.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SkeletonGrid: ({ className, grid, "aria-busy": ariaBusy, "aria-label": ariaLabel, maxCols, colGap, rowGap, isLoading, children, }: SkeletonGridProps) => 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;
|
|
51
|
+
export {};
|