@axa-fr/canopee-react 2.0.0-alpha.28 → 2.0.0-alpha.29
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 +8 -14
- package/dist/client.js +8 -14
- package/dist/prospect-client/AccordionCore/AccordionCoreCommon.d.ts +1 -5
- package/dist/prospect-client/AccordionCore/AccordionCoreCommon.js +3 -3
- 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/CardCheckboxCommon.d.ts +1 -17
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.js +4 -4
- package/dist/prospect-client/Form/Checkbox/Checkbox/CheckboxCommon.d.ts +2 -7
- package/dist/prospect-client/Form/Checkbox/Checkbox/CheckboxCommon.js +1 -1
- 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 +8 -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/Radio/CardRadio/CardRadioCommon.d.ts +1 -5
- package/dist/prospect-client/Form/Radio/CardRadio/CardRadioCommon.js +2 -2
- package/dist/prospect-client/Form/Radio/CardRadioGroup/CardRadioGroupCommon.d.ts +1 -25
- package/dist/prospect-client/Form/Radio/CardRadioGroup/CardRadioGroupCommon.js +4 -6
- 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/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/Link/LinkCommon.d.ts +1 -5
- package/dist/prospect-client/Link/LinkCommon.js +2 -2
- 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/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/Tag/TagCommon.js +6 -2
- package/dist/prospect-client/Toggle/ToggleCommon.js +2 -2
- package/dist/prospect.d.ts +1 -3
- package/dist/prospect.js +1 -3
- package/package.json +2 -2
- package/dist/prospect-client/utilities/getComponentClassName.d.ts +0 -4
- package/dist/prospect-client/utilities/getComponentClassName.js +0 -30
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import type { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
2
3
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
3
4
|
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
4
5
|
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
5
|
-
import type { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
6
6
|
export type InputTextProps = ComponentProps<"input"> & {
|
|
7
7
|
unit?: ReactNode;
|
|
8
8
|
classModifier?: string;
|
|
9
9
|
label?: ItemLabelProps["children"];
|
|
10
10
|
helper?: string;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `message` and messageType instead.
|
|
13
|
-
*/
|
|
14
|
-
error?: string;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `message` and messageType instead.
|
|
17
|
-
*/
|
|
18
|
-
success?: string;
|
|
19
11
|
containerProps?: GridContainerProps;
|
|
20
|
-
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "
|
|
12
|
+
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "onMoreButtonClick" | "sideButtonLabel" | "onSideButtonClick"> & Pick<ItemMessageProps, "message" | "messageType">;
|
|
21
13
|
type InputTextCommonProps = InputTextProps & {
|
|
22
14
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
23
15
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
24
16
|
InputTextAtomComponent: ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
25
17
|
};
|
|
26
18
|
declare const InputTextCommon: {
|
|
27
|
-
({ unit, className, classModifier, helper,
|
|
19
|
+
({ unit, className, classModifier, helper, message, messageType, label, description, moreButtonLabel, onMoreButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, containerProps, ...otherProps }: InputTextCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
28
20
|
displayName: string;
|
|
29
21
|
};
|
|
30
22
|
export { InputTextCommon };
|
|
@@ -3,15 +3,16 @@ import { useId, } from "react";
|
|
|
3
3
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
4
4
|
import { ItemLabelCommon, } from "../ItemLabel/ItemLabelCommon";
|
|
5
5
|
import { ItemMessage, } from "../ItemMessage/ItemMessageCommon";
|
|
6
|
-
const InputTextCommon = ({ unit, className, classModifier = "", helper,
|
|
6
|
+
const InputTextCommon = ({ unit, className, classModifier = "", helper, message, messageType = "error", label, description, moreButtonLabel, onMoreButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, containerProps, ...otherProps }) => {
|
|
7
7
|
let inputId = useId();
|
|
8
8
|
inputId = otherProps.id || inputId;
|
|
9
9
|
const idMessage = useId();
|
|
10
10
|
const idHelp = useId();
|
|
11
|
-
const ariaDescribedby = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const ariaDescribedby = [
|
|
12
|
+
helper && idHelp,
|
|
13
|
+
message && messageType === "success" && idMessage,
|
|
14
|
+
].filter(Boolean);
|
|
15
|
+
return (_jsxs("div", { className: "af-form__input-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel, onMoreButtonClick: onMoreButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx(InputTextAtomComponent, { id: inputId, unit: unit, className: className, classModifier: classModifier, error: message && messageType === "error" ? messageType : undefined, warning: message && messageType === "warning" ? messageType : undefined, required: required, idMessage: message ? idMessage : undefined, idHelp: ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, ...otherProps }), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message, messageType: messageType })] }));
|
|
15
16
|
};
|
|
16
17
|
InputTextCommon.displayName = "InputText";
|
|
17
18
|
export { InputTextCommon };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentType, type MouseEventHandler, type ReactNode } from "react";
|
|
2
2
|
import type { ButtonProps } from "../../Button/ButtonCommon";
|
|
3
3
|
export type ItemLabelProps = ComponentProps<"label"> & {
|
|
4
|
-
/**
|
|
5
|
-
* Label text content
|
|
6
|
-
* @deprecated use `children` instead.
|
|
7
|
-
*/
|
|
8
|
-
label?: ReactNode;
|
|
9
4
|
/**
|
|
10
5
|
* Additional description text that enriches the label.
|
|
11
6
|
* @example "Phone bill, EDF receipt, etc."
|
|
@@ -15,11 +10,6 @@ export type ItemLabelProps = ComponentProps<"label"> & {
|
|
|
15
10
|
* Shows a visual asterisk (*) indicator next to the label.
|
|
16
11
|
*/
|
|
17
12
|
required?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* ID of the associated input element
|
|
20
|
-
* @deprecated use `htmlFor` instead.
|
|
21
|
-
*/
|
|
22
|
-
inputId?: string;
|
|
23
13
|
/**
|
|
24
14
|
* Label content for the side action button.
|
|
25
15
|
* When provided, renders a secondary button next to the main label.
|
|
@@ -33,16 +23,6 @@ export type ItemLabelProps = ComponentProps<"label"> & {
|
|
|
33
23
|
* Additional props to pass to the side button component.
|
|
34
24
|
*/
|
|
35
25
|
sideButtonProps?: Omit<Partial<ButtonProps>, "children" | "onClick" | "variant" | "className">;
|
|
36
|
-
/**
|
|
37
|
-
* Label content for the more button
|
|
38
|
-
* @deprecated use `moreButtonLabel` instead.
|
|
39
|
-
*/
|
|
40
|
-
buttonLabel?: ReactNode;
|
|
41
|
-
/**
|
|
42
|
-
* Click handler for the info button
|
|
43
|
-
* @deprecated use `onMoreButtonClick` instead.
|
|
44
|
-
*/
|
|
45
|
-
onButtonClick?: MouseEventHandler<HTMLButtonElement>;
|
|
46
26
|
/**
|
|
47
27
|
* Label content for the more button
|
|
48
28
|
* When provided, renders an more button with an info icon.
|
|
@@ -92,7 +72,7 @@ export type ItemLabelCommonProps = ItemLabelProps & {
|
|
|
92
72
|
* description="Accepted: PDF, JPG, PNG (max 5MB)"
|
|
93
73
|
* sideButtonLabel="Browse"
|
|
94
74
|
* onSideButtonClick={handleBrowse}
|
|
95
|
-
*
|
|
75
|
+
* moreButtonLabel="Help"
|
|
96
76
|
* onMoreButtonClick={handleShowHelp}
|
|
97
77
|
* ButtonComponent={Button}
|
|
98
78
|
* >
|
|
@@ -100,4 +80,4 @@ export type ItemLabelCommonProps = ItemLabelProps & {
|
|
|
100
80
|
* </ItemLabelCommon>
|
|
101
81
|
* ```
|
|
102
82
|
*/
|
|
103
|
-
export declare const ItemLabelCommon: ({
|
|
83
|
+
export declare const ItemLabelCommon: ({ children, description, required, className, style, "aria-describedby": ariaDescribedby, sideButtonLabel, onSideButtonClick, sideButtonProps, moreButtonLabel, onMoreButtonClick, ButtonComponent, moreButtonProps, ...props }: ItemLabelCommonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -34,7 +34,7 @@ import { Svg } from "../../Svg/Svg";
|
|
|
34
34
|
* description="Accepted: PDF, JPG, PNG (max 5MB)"
|
|
35
35
|
* sideButtonLabel="Browse"
|
|
36
36
|
* onSideButtonClick={handleBrowse}
|
|
37
|
-
*
|
|
37
|
+
* moreButtonLabel="Help"
|
|
38
38
|
* onMoreButtonClick={handleShowHelp}
|
|
39
39
|
* ButtonComponent={Button}
|
|
40
40
|
* >
|
|
@@ -42,14 +42,13 @@ import { Svg } from "../../Svg/Svg";
|
|
|
42
42
|
* </ItemLabelCommon>
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export const ItemLabelCommon = ({
|
|
45
|
+
export const ItemLabelCommon = ({ children, description, required, className, style, "aria-describedby": ariaDescribedby, sideButtonLabel, onSideButtonClick, sideButtonProps, moreButtonLabel, onMoreButtonClick, ButtonComponent, moreButtonProps, ...props }) => {
|
|
46
46
|
const idDescription = useId();
|
|
47
|
-
const contentLabel = children ?? label;
|
|
48
47
|
const describedByIds = [description ? idDescription : null, ariaDescribedby]
|
|
49
48
|
.filter(Boolean)
|
|
50
49
|
.join(" ");
|
|
51
|
-
if (!
|
|
50
|
+
if (!children) {
|
|
52
51
|
return null;
|
|
53
52
|
}
|
|
54
|
-
return (_jsxs("div", { className: ["af-item-label", className].filter(Boolean).join(" "), style: style, children: [_jsxs("label", {
|
|
53
|
+
return (_jsxs("div", { className: ["af-item-label", className].filter(Boolean).join(" "), style: style, children: [_jsxs("label", { className: "af-item-label__label", "aria-describedby": describedByIds || undefined, ...props, children: [children, required ? _jsx("span", { "aria-hidden": true, children: "*" }) : null] }), sideButtonLabel ? (_jsx(ButtonComponent, { ...sideButtonProps, variant: "ghost", onClick: onSideButtonClick, className: "af-item-label__sidebutton", children: sideButtonLabel })) : null, description ? (_jsx("span", { id: idDescription, className: "af-item-label__description", children: description })) : null, moreButtonLabel ? (_jsx(ButtonComponent, { iconLeft: _jsx(Svg, { src: infoIcon, role: "presentation" }), ...moreButtonProps, variant: "ghost", className: "af-item-label__more", onClick: onMoreButtonClick, children: moreButtonLabel })) : null] }));
|
|
55
54
|
};
|
|
@@ -8,10 +8,6 @@ type BaseCardRadioProps = Omit<ComponentProps<typeof Radio>, "size"> & {
|
|
|
8
8
|
subtitle?: ReactNode;
|
|
9
9
|
};
|
|
10
10
|
export type CardRadioProps = BaseCardRadioProps & {
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `position` instead.
|
|
13
|
-
*/
|
|
14
|
-
type?: "vertical" | "horizontal";
|
|
15
11
|
position?: "vertical" | "horizontal";
|
|
16
12
|
icon?: ComponentProps<typeof IconCommon>["src"];
|
|
17
13
|
src?: ComponentProps<typeof BasePicture>["src"];
|
|
@@ -22,7 +18,7 @@ export type CardRadioCommonProps = CardRadioProps & {
|
|
|
22
18
|
IconComponent: ComponentType<ComponentProps<typeof IconCommon>>;
|
|
23
19
|
};
|
|
24
20
|
export declare const CardRadioCommon: {
|
|
25
|
-
({ label, position,
|
|
21
|
+
({ label, position, description, subtitle, icon, src, basePictureProps, variant, className, RadioComponent, IconComponent, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
26
22
|
displayName: string;
|
|
27
23
|
};
|
|
28
24
|
export {};
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import {} from "react";
|
|
3
3
|
import { BasePicture } from "../../../BasePicture/BasePicture";
|
|
4
4
|
import { getClassName } from "../../../utilities/getClassName";
|
|
5
|
-
export const CardRadioCommon = ({ label, position,
|
|
6
|
-
const isCardRadioHorizontal =
|
|
5
|
+
export const CardRadioCommon = ({ label, position, description, subtitle, icon, src, basePictureProps, variant, className, RadioComponent, IconComponent, ...inputProps }) => {
|
|
6
|
+
const isCardRadioHorizontal = position === "horizontal";
|
|
7
7
|
return (_jsxs("label", { className: getClassName({
|
|
8
8
|
baseClassName: "af-card-radio",
|
|
9
9
|
modifiers: [
|
|
@@ -4,35 +4,11 @@ import { ItemMessage, type ItemMessageProps } from "../../ItemMessage/ItemMessag
|
|
|
4
4
|
import { type CardRadioProps } from "../CardRadio/CardRadioCommon";
|
|
5
5
|
type RadioOption = Omit<CardRadioProps, "name" | "type" | "variant">;
|
|
6
6
|
export type CardRadioGroupProps = Omit<CardRadioProps, "value" | "label" | "type" | "variant" | "icon" | "src" | "basePictureProps" | "description" | "subtitle" | "children" | "position"> & {
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use `position` and `cardStyle` instead.
|
|
9
|
-
*/
|
|
10
|
-
type?: "vertical" | "horizontal";
|
|
11
7
|
cardStyle?: CardRadioProps["position"];
|
|
12
8
|
position?: "line" | "column";
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use `label` instead.
|
|
15
|
-
*/
|
|
16
|
-
labelGroup?: string;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use `description` instead.
|
|
19
|
-
*/
|
|
20
|
-
descriptionGroup?: string;
|
|
21
9
|
label: ReactNode;
|
|
22
10
|
description?: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Use `required` instead.
|
|
25
|
-
*/
|
|
26
|
-
isRequired?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated This prop is deprecated. To check an option, use the `checked` property in each item of the `options` array.
|
|
29
|
-
*/
|
|
30
|
-
value?: number | string;
|
|
31
11
|
options: RadioOption[];
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use `message` and messageType instead.
|
|
34
|
-
*/
|
|
35
|
-
error?: ReactNode;
|
|
36
12
|
containerProps?: GridContainerProps<"fieldset">;
|
|
37
13
|
} & PropsWithChildren & Partial<ItemMessageProps>;
|
|
38
14
|
export type CardRadioCommonProps = CardRadioGroupProps & {
|
|
@@ -40,7 +16,7 @@ export type CardRadioCommonProps = CardRadioGroupProps & {
|
|
|
40
16
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
41
17
|
};
|
|
42
18
|
declare const CardRadioGroupCommon: {
|
|
43
|
-
({ className,
|
|
19
|
+
({ className, label, description, required, options, cardStyle, position, message, messageType, name, id, CardRadioComponent, ItemMessageComponent, containerProps, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
44
20
|
displayName: string;
|
|
45
21
|
};
|
|
46
22
|
export { CardRadioGroupCommon };
|
|
@@ -2,17 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId, } from "react";
|
|
3
3
|
import { ItemMessage, } from "../../ItemMessage/ItemMessageCommon";
|
|
4
4
|
import {} from "../CardRadio/CardRadioCommon";
|
|
5
|
-
const CardRadioGroupCommon = ({ className,
|
|
5
|
+
const CardRadioGroupCommon = ({ className, label, description, required, options, cardStyle, position = cardStyle === "vertical" ? "column" : "line", message, messageType = "error", name, id, CardRadioComponent, ItemMessageComponent, containerProps, ...inputProps }) => {
|
|
6
6
|
const generatedId = useId();
|
|
7
7
|
const cardRadioGroupId = id ?? generatedId;
|
|
8
8
|
const messageId = `${cardRadioGroupId}-error`;
|
|
9
|
-
const hasError =
|
|
10
|
-
return (_jsxs("fieldset", { className: ["af-card-radio-group", className].filter(Boolean).join(" "), role: "radiogroup", "aria-required": Boolean(required) || undefined, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, id: cardRadioGroupId, ...containerProps, children: [_jsxs("legend", { className: "af-card-radio-group__legend", children: [_jsxs("p", { className: "af-card-radio-group__label", children: [label,
|
|
9
|
+
const hasError = Boolean(message) && messageType === "error";
|
|
10
|
+
return (_jsxs("fieldset", { className: ["af-card-radio-group", className].filter(Boolean).join(" "), role: "radiogroup", "aria-required": Boolean(required) || undefined, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, id: cardRadioGroupId, ...containerProps, children: [_jsxs("legend", { className: "af-card-radio-group__legend", children: [_jsxs("p", { className: "af-card-radio-group__label", children: [label, required ? _jsx("span", { "aria-hidden": true, children: "*" }) : null] }), description ? (_jsx("p", { className: "af-card-radio-group__description", children: description })) : null] }), _jsx("div", { className: [
|
|
11
11
|
"af-card-radio-group__options",
|
|
12
12
|
`af-card-radio-group__options--${position}`,
|
|
13
|
-
].join(" "), children: options.map((cardRadioItemProps) => (_jsx(CardRadioComponent, { id: `${cardRadioGroupId}-${cardRadioItemProps.value}`,
|
|
14
|
-
? value === cardRadioItemProps.value
|
|
15
|
-
: undefined, required: required, position: cardStyle ?? type, ...inputProps, ...cardRadioItemProps, variant: hasError ? "error" : undefined, name: name }, `${name ?? cardRadioGroupId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
|
|
13
|
+
].join(" "), children: options.map((cardRadioItemProps) => (_jsx(CardRadioComponent, { id: `${cardRadioGroupId}-${cardRadioItemProps.value}`, required: required, position: cardStyle, ...inputProps, ...cardRadioItemProps, variant: hasError ? "error" : undefined, name: name }, `${name ?? cardRadioGroupId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: messageId, message: message, messageType: messageType })] }));
|
|
16
14
|
};
|
|
17
15
|
CardRadioGroupCommon.displayName = "CardRadioGroupCommon";
|
|
18
16
|
export { CardRadioGroupCommon };
|
|
@@ -5,18 +5,14 @@ import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCo
|
|
|
5
5
|
export type TextAreaProps = ComponentPropsWithRef<"textarea"> & {
|
|
6
6
|
label?: ItemLabelProps["children"];
|
|
7
7
|
helper?: string;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `message` and messageType instead.
|
|
10
|
-
*/
|
|
11
|
-
error?: string;
|
|
12
8
|
containerProps?: GridContainerProps;
|
|
13
|
-
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "
|
|
9
|
+
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "onMoreButtonClick" | "sideButtonLabel" | "onSideButtonClick"> & Pick<ItemMessageProps, "message" | "messageType">;
|
|
14
10
|
type TextAreaCommonProps = TextAreaProps & {
|
|
15
11
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
16
12
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
17
13
|
};
|
|
18
14
|
declare const TextAreaCommon: {
|
|
19
|
-
({ id, className, label, description, helper,
|
|
15
|
+
({ id, className, label, description, helper, message, messageType, moreButtonLabel, onMoreButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder, containerProps, ...inputProps }: TextAreaCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
16
|
displayName: string;
|
|
21
17
|
};
|
|
22
18
|
export { TextAreaCommon };
|
|
@@ -3,12 +3,12 @@ import { useId, } from "react";
|
|
|
3
3
|
import { getClassName } from "../../utilities/getClassName";
|
|
4
4
|
import { ItemLabelCommon, } from "../ItemLabel/ItemLabelCommon";
|
|
5
5
|
import { ItemMessage, } from "../ItemMessage/ItemMessageCommon";
|
|
6
|
-
const TextAreaCommon = ({ id, className, label, description, helper,
|
|
6
|
+
const TextAreaCommon = ({ id, className, label, description, helper, message, messageType = "error", moreButtonLabel, onMoreButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder = " ", containerProps, ...inputProps }) => {
|
|
7
7
|
const generatedId = useId();
|
|
8
8
|
const inputId = id ?? generatedId;
|
|
9
9
|
const helperId = `${inputId}-helper`;
|
|
10
10
|
const messageId = `${inputId}-error`;
|
|
11
|
-
const hasError =
|
|
11
|
+
const hasError = Boolean(message) && messageType === "error";
|
|
12
12
|
const hasWarning = Boolean(message) && messageType === "warning" && !hasError;
|
|
13
13
|
const textareaClassName = getClassName({
|
|
14
14
|
baseClassName: "af-form__textarea",
|
|
@@ -16,7 +16,7 @@ const TextAreaCommon = ({ id, className, label, description, helper, error, mess
|
|
|
16
16
|
});
|
|
17
17
|
return (_jsxs("div", { className: ["af-form__input-container", className]
|
|
18
18
|
.filter(Boolean)
|
|
19
|
-
.join(" "), ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel
|
|
19
|
+
.join(" "), ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel, onMoreButtonClick: onMoreButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx("textarea", { id: inputId, className: textareaClassName, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": helper ? helperId : undefined, required: required, "aria-invalid": hasError || undefined, placeholder: placeholder, ...inputProps }), helper ? (_jsx("span", { id: helperId, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message, messageType: messageType })] }));
|
|
20
20
|
};
|
|
21
21
|
TextAreaCommon.displayName = "TextArea";
|
|
22
22
|
export { TextAreaCommon };
|
|
@@ -21,4 +21,4 @@ export type IconProps = ComponentProps<typeof Svg> & {
|
|
|
21
21
|
size?: IconSizeVariants;
|
|
22
22
|
hasBackground?: boolean;
|
|
23
23
|
};
|
|
24
|
-
export declare const Icon: ({ variant, size, hasBackground, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const Icon: ({ variant, size, hasBackground, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Svg } from "../Svg/Svg";
|
|
4
|
-
import {
|
|
4
|
+
import { getClassName } from "../utilities/getClassName";
|
|
5
5
|
export const iconVariants = {
|
|
6
6
|
primary: "primary",
|
|
7
7
|
secondary: "secondary",
|
|
@@ -16,16 +16,15 @@ export const iconSizeVariants = {
|
|
|
16
16
|
S: "small",
|
|
17
17
|
XS: "extra-small",
|
|
18
18
|
};
|
|
19
|
-
export const Icon = ({ variant = "primary", size = "S", hasBackground = false, ...props }) => {
|
|
20
|
-
const componentClassName = useMemo(() => {
|
|
21
|
-
|
|
19
|
+
export const Icon = ({ variant = "primary", size = "S", hasBackground = false, className, ...props }) => {
|
|
20
|
+
const componentClassName = useMemo(() => getClassName({
|
|
21
|
+
baseClassName: "af-icon",
|
|
22
|
+
className,
|
|
23
|
+
modifiers: [
|
|
22
24
|
variant,
|
|
23
25
|
iconSizeVariants[size],
|
|
24
26
|
hasBackground && "has-background",
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
.join(" ");
|
|
28
|
-
return getComponentClassName("af-icon", "", newClassModifier);
|
|
29
|
-
}, [variant, hasBackground, size]);
|
|
27
|
+
].filter(Boolean),
|
|
28
|
+
}), [className, variant, size, hasBackground]);
|
|
30
29
|
return (_jsx("div", { className: componentClassName, children: _jsx(Svg, { ...props }) }));
|
|
31
30
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import {} from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { getClassName } from "../utilities/getClassName";
|
|
4
4
|
export const ItemTabBar = ({ isActive = false, title, className, ...props }) => {
|
|
5
|
-
const classNames =
|
|
5
|
+
const classNames = getClassName({
|
|
6
|
+
baseClassName: "af-item-tab-bar",
|
|
7
|
+
className,
|
|
8
|
+
});
|
|
6
9
|
return (_jsx("button", { type: "button", role: "tab", "aria-selected": isActive, className: classNames, ...props, children: title }));
|
|
7
10
|
};
|
|
8
11
|
ItemTabBar.displayName = "ItemTabBar";
|
|
@@ -9,9 +9,5 @@ export type LinkProps = {
|
|
|
9
9
|
leftIcon?: ReactNode;
|
|
10
10
|
rightIcon?: ReactNode;
|
|
11
11
|
className?: string;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Use variant instead
|
|
14
|
-
*/
|
|
15
|
-
classModifier?: string;
|
|
16
12
|
} & ComponentPropsWithoutRef<"a">;
|
|
17
|
-
export declare const Link: ({ href, variant, openInNewTab, leftIcon, rightIcon, children, className,
|
|
13
|
+
export declare const Link: ({ href, variant, openInNewTab, leftIcon, rightIcon, children, className, ...props }: PropsWithChildren<LinkProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,14 +5,14 @@ import { getClassName } from "../utilities/getClassName";
|
|
|
5
5
|
export const linkVariants = {
|
|
6
6
|
inverse: "inverse",
|
|
7
7
|
};
|
|
8
|
-
export const Link = ({ href, variant, openInNewTab = false, leftIcon, rightIcon, children, className,
|
|
8
|
+
export const Link = ({ href, variant, openInNewTab = false, leftIcon, rightIcon, children, className, ...props }) => {
|
|
9
9
|
const newTabProps = openInNewTab && {
|
|
10
10
|
target: "_blank",
|
|
11
11
|
rel: "noopener noreferrer",
|
|
12
12
|
};
|
|
13
13
|
return (_jsxs("a", { className: getClassName({
|
|
14
14
|
baseClassName: "af-link",
|
|
15
|
-
modifiers: [
|
|
15
|
+
modifiers: [variant, openInNewTab && "openInNewTab"],
|
|
16
16
|
className,
|
|
17
17
|
}), href: href, ...newTabProps, ...props, children: [leftIcon, children, openInNewTab || Boolean(rightIcon)
|
|
18
18
|
? (rightIcon ?? _jsx(Svg, { src: openInNew }))
|
|
@@ -13,14 +13,10 @@ export type ContentItemDuoProps = {
|
|
|
13
13
|
value: ReactNode;
|
|
14
14
|
buttonText?: string;
|
|
15
15
|
onButtonClick?: () => void;
|
|
16
|
-
/** @deprecated Use `position` instead */
|
|
17
|
-
isVertical?: boolean;
|
|
18
|
-
/** @deprecated Use `size` or `className` instead */
|
|
19
|
-
classModifier?: string;
|
|
20
16
|
} & Pick<ItemMessageProps, "message" | "messageType"> & ContentItemDuoPositions & ComponentProps<"div">;
|
|
21
17
|
type ContentItemDuoCommonProps = ContentItemDuoProps & {
|
|
22
18
|
ButtonComponent: ComponentType<ButtonProps>;
|
|
23
19
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
24
20
|
};
|
|
25
|
-
export declare const ContentItemDuoCommon: ({ label, value, position, size, className,
|
|
21
|
+
export declare const ContentItemDuoCommon: ({ label, value, position, size, className, buttonText, onButtonClick, ButtonComponent, message, messageType, ItemMessageComponent, ...containerProps }: ContentItemDuoCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
22
|
export {};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import {} from "react";
|
|
3
|
-
import { getClassName } from "../../utilities/getClassName";
|
|
4
3
|
import { ItemMessage, } from "../../Form/ItemMessage/ItemMessageCommon";
|
|
5
|
-
|
|
4
|
+
import { getClassName } from "../../utilities/getClassName";
|
|
5
|
+
export const ContentItemDuoCommon = ({ label, value, position = "horizontal", size = "large", className, buttonText, onButtonClick, ButtonComponent, message, messageType, ItemMessageComponent, ...containerProps }) => {
|
|
6
6
|
const componentClassName = getClassName({
|
|
7
7
|
baseClassName: "af-content-item-duo",
|
|
8
8
|
className,
|
|
9
|
-
modifiers: [
|
|
10
|
-
isVertical ? "vertical" : position,
|
|
11
|
-
size === "small" && size,
|
|
12
|
-
classModifier,
|
|
13
|
-
],
|
|
9
|
+
modifiers: [position, size === "small" && size],
|
|
14
10
|
});
|
|
15
11
|
return (_jsxs("div", { className: componentClassName, ...containerProps, children: [_jsx("dt", { className: "af-content-item-duo__label", children: label }), _jsxs("dd", { className: "af-content-item-duo__value", children: [value, message ? (_jsx(ItemMessageComponent, { message: message, messageType: messageType })) : null] }), buttonText && onButtonClick ? (_jsx(ButtonComponent, { className: "af-content-item-duo__button", variant: "ghost", onClick: onButtonClick, children: buttonText })) : null] }));
|
|
16
12
|
};
|
|
@@ -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}`))) }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { getClassName } from "../utilities/getClassName";
|
|
4
4
|
export const tagVariants = {
|
|
5
5
|
info: "info",
|
|
6
6
|
success: "success",
|
|
@@ -9,6 +9,10 @@ export const tagVariants = {
|
|
|
9
9
|
neutral: "neutral",
|
|
10
10
|
};
|
|
11
11
|
export const Tag = ({ children, className, variant = "info", ...divProps }) => {
|
|
12
|
-
const componentClassName = useMemo(() =>
|
|
12
|
+
const componentClassName = useMemo(() => getClassName({
|
|
13
|
+
baseClassName: "af-tag",
|
|
14
|
+
className,
|
|
15
|
+
modifiers: [variant],
|
|
16
|
+
}), [className, variant]);
|
|
13
17
|
return (_jsx("div", { className: componentClassName, ...divProps, children: _jsx("span", { className: "af-tag__label", children: children }) }));
|
|
14
18
|
};
|