@axa-fr/design-system-slash-react 1.2.1-alpha.12 → 1.2.1-alpha.123
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/Button/Button.d.ts +11 -7
- package/dist/Button/Button.js +7 -7
- package/dist/Card/Card.d.ts +13 -0
- package/dist/Card/Card.js +6 -0
- package/dist/Divider/Divider.d.ts +7 -0
- package/dist/Divider/Divider.js +10 -0
- package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
- package/dist/Form/Checkbox/CheckboxInput.js +6 -16
- package/dist/Form/Checkbox/CheckboxItem.js +3 -1
- package/dist/Form/Choice/Choice.d.ts +3 -2
- package/dist/Form/Choice/Choice.js +1 -2
- package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
- package/dist/Form/Choice/ChoiceInput.js +4 -17
- package/dist/Form/Date/DateInput.d.ts +6 -42
- package/dist/Form/Date/DateInput.js +5 -11
- package/dist/Form/File/File.js +1 -1
- package/dist/Form/File/FileErrors.js +3 -2
- package/dist/Form/File/FileInput.d.ts +4 -5
- package/dist/Form/File/FileInput.js +6 -11
- package/dist/Form/File/FileTable.js +1 -1
- package/dist/Form/MultiSelect/FormatOptionLabel.d.ts +4 -0
- package/dist/Form/MultiSelect/FormatOptionLabel.js +12 -0
- package/dist/Form/MultiSelect/MultiSelect.d.ts +6 -3
- package/dist/Form/MultiSelect/MultiSelect.js +25 -5
- package/dist/Form/MultiSelect/MultiSelectInput.d.ts +4 -6
- package/dist/Form/MultiSelect/MultiSelectInput.js +6 -11
- package/dist/Form/MultiSelect/NoOptionsMessage.d.ts +3 -0
- package/dist/Form/MultiSelect/NoOptionsMessage.js +1 -0
- package/dist/Form/MultiSelect/ValueContainer.d.ts +4 -0
- package/dist/Form/MultiSelect/ValueContainer.js +20 -0
- package/dist/Form/MultiSelect/useMultiSelectStyle.d.ts +5 -0
- package/dist/Form/MultiSelect/useMultiSelectStyle.js +81 -0
- package/dist/Form/Number/NumberInput.d.ts +4 -7
- package/dist/Form/Number/NumberInput.js +4 -11
- package/dist/Form/Pass/PassInput.d.ts +4 -4
- package/dist/Form/Pass/PassInput.js +5 -12
- package/dist/Form/Radio/Radio.d.ts +19 -7
- package/dist/Form/Radio/Radio.js +13 -4
- package/dist/Form/Radio/RadioCardGroup.d.ts +10 -0
- package/dist/Form/Radio/RadioCardGroup.js +26 -0
- package/dist/Form/Radio/RadioInput.d.ts +5 -43
- package/dist/Form/Radio/RadioInput.js +6 -11
- package/dist/Form/Select/Select.d.ts +52 -52
- package/dist/Form/Select/SelectInput.d.ts +96 -108
- package/dist/Form/Select/SelectInput.js +5 -11
- package/dist/Form/Slider/Slider.d.ts +3 -0
- package/dist/Form/Slider/Slider.js +3 -0
- package/dist/Form/Slider/SliderInput.d.ts +7 -6
- package/dist/Form/Slider/SliderInput.js +7 -12
- package/dist/Form/Text/TextInput.d.ts +3 -5
- package/dist/Form/Text/TextInput.js +4 -7
- package/dist/Form/Textarea/TextareaInput.d.ts +3 -5
- package/dist/Form/Textarea/TextareaInput.js +5 -12
- package/dist/Form/core/{LegacyField.d.ts → Deprecated/Field.d.ts} +4 -0
- package/dist/Form/core/{LegacyField.js → Deprecated/Field.js} +7 -3
- package/dist/Form/core/{FieldForm.d.ts → Deprecated/FieldForm.d.ts} +7 -2
- package/dist/Form/core/{FieldForm.js → Deprecated/FieldForm.js} +8 -3
- package/dist/Form/core/{FieldInput.d.ts → Deprecated/FieldInput.d.ts} +4 -0
- package/dist/Form/core/{FieldInput.js → Deprecated/FieldInput.js} +5 -1
- package/dist/Form/core/Field.d.ts +58 -6
- package/dist/Form/core/Field.js +23 -10
- package/dist/Form/core/FormClassManager.js +4 -1
- package/dist/Form/core/HelpMessage.d.ts +2 -1
- package/dist/Form/core/HelpMessage.js +1 -1
- package/dist/Form/core/index.d.ts +7 -4
- package/dist/Form/core/index.js +3 -3
- package/dist/Layout/Footer/Footer.d.ts +2 -1
- package/dist/Layout/Footer/Footer.js +4 -2
- package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.d.ts +39 -0
- package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.js +21 -0
- package/dist/Layout/Header/Header.js +2 -1
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.d.ts +5 -1
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.js +8 -3
- package/dist/Layout/Header/Infos/Infos.js +3 -1
- package/dist/Layout/Header/NavBar/NavBarBase.js +9 -8
- package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.js +1 -1
- package/dist/Layout/Header/NavBar/index.d.ts +1 -0
- package/dist/Layout/Header/NavBar/index.js +1 -0
- package/dist/Layout/Header/User/InnerUser.js +1 -1
- package/dist/Layout/MainContainer/MainContainer.d.ts +6 -0
- package/dist/Layout/MainContainer/MainContainer.js +4 -0
- package/dist/Link/Link.d.ts +1 -1
- package/dist/Link/Link.js +1 -1
- package/dist/Link/LinkAnchor.d.ts +5 -3
- package/dist/Link/LinkAnchor.js +5 -3
- package/dist/Loader/Loader.js +1 -1
- package/dist/Messages/Message.d.ts +47 -0
- package/dist/Messages/Message.js +43 -0
- package/dist/ModalAgent/BooleanModal.d.ts +28 -3
- package/dist/ModalAgent/BooleanModal.js +1 -1
- package/dist/ModalAgent/Modal.d.ts +17 -3
- package/dist/ModalAgent/Modal.js +15 -2
- package/dist/ModalAgent/components/Header.d.ts +25 -5
- package/dist/ModalAgent/components/Header.js +4 -3
- package/dist/Popover/AnimatedPopover.js +1 -1
- package/dist/Steps/StepBase.js +5 -3
- package/dist/Steps/VerticalStep.d.ts +48 -0
- package/dist/Steps/VerticalStep.js +22 -0
- package/dist/Steps/index.d.ts +1 -0
- package/dist/Steps/index.js +1 -0
- package/dist/Steps/types.d.ts +8 -0
- package/dist/Steps/types.js +1 -0
- package/dist/Summary/index.d.ts +3 -3
- package/dist/Summary/index.js +3 -2
- package/dist/Svg/Svg.js +1 -1
- package/dist/Table/Pagination/Items.d.ts +1 -1
- package/dist/Table/Pagination/Li.d.ts +2 -1
- package/dist/Table/Pagination/Li.js +2 -5
- package/dist/Table/Pagination/Pager.d.ts +5 -1
- package/dist/Table/Pagination/Pager.js +3 -3
- package/dist/Table/Pagination/PaginationButton.d.ts +2 -1
- package/dist/Table/Pagination/PaginationButton.js +2 -2
- package/dist/Table/Pagination/Paging.d.ts +2 -1
- package/dist/Table/Pagination/Paging.js +2 -2
- package/dist/Tag/Tag.d.ts +29 -0
- package/dist/Tag/Tag.js +27 -0
- package/dist/Title/Title.d.ts +2 -2
- package/dist/index.d.ts +21 -3
- package/dist/index.js +16 -3
- package/dist/utilities/helpers/getComponentClassName.d.ts +15 -0
- package/dist/utilities/helpers/getComponentClassName.js +22 -0
- package/package.json +6 -5
- package/dist/Alert/Alert.d.ts +0 -17
- package/dist/Alert/Alert.js +0 -14
- package/dist/Badge/Badge.d.ts +0 -8
- package/dist/Badge/Badge.js +0 -9
package/dist/Form/core/Field.js
CHANGED
|
@@ -3,23 +3,36 @@ import classNames from "classnames";
|
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { FieldError, FormClassManager, HelpMessage, useInputClassModifier, } from ".";
|
|
5
5
|
import { getComponentClassName } from "../../utilities";
|
|
6
|
-
|
|
6
|
+
import { useAriaInvalid } from "./useAriaInvalid";
|
|
7
|
+
export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType, required, classModifier = "", disabled = false, helpMessage, id, isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, labelPosition = "center", classNameSuffix = "text", renderInput, appendChildren, ...otherProps }) => {
|
|
7
8
|
const inputUseId = useId();
|
|
8
9
|
const inputId = id ?? inputUseId;
|
|
9
10
|
const actualRequired = required || classModifier.includes("required");
|
|
10
|
-
const
|
|
11
|
+
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
12
|
+
const errorId = forceDisplayMessage || helpMessage ? `${inputId}-description` : undefined;
|
|
13
|
+
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, false, actualRequired);
|
|
14
|
+
const labelId = useId();
|
|
11
15
|
if (!isVisible) {
|
|
12
16
|
return null;
|
|
13
17
|
}
|
|
14
|
-
const
|
|
18
|
+
const isGroup = roleContainer === "radiogroup" || roleContainer === "group";
|
|
19
|
+
const LabelElement = isGroup ? "div" : "label";
|
|
20
|
+
const modifiers = forceDisplayMessage
|
|
15
21
|
? `${inputFieldClassModifier} ${FormClassManager.getModifier(messageType)}`
|
|
16
|
-
: inputFieldClassModifier
|
|
17
|
-
|
|
22
|
+
: inputFieldClassModifier;
|
|
23
|
+
const fieldContainerClassName = getComponentClassName(`af-form__${classNameSuffix}`, modifiers);
|
|
24
|
+
const groupClassName = getComponentClassName(className, classModifier, "af-form__group");
|
|
25
|
+
return (_jsxs("div", { className: classNames("row", groupClassName, {
|
|
18
26
|
"af-form__group--required": actualRequired,
|
|
19
|
-
|
|
27
|
+
"af-form__group--label-top": labelPosition === "top",
|
|
28
|
+
}), role: roleContainer, "aria-label": ariaLabelContainer, "aria-labelledby": isGroup ? labelId : undefined, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx(LabelElement, { className: classNames("af-form__group-label", {
|
|
20
29
|
"af-form__group-label--required": actualRequired,
|
|
21
|
-
}), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
}), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, id: labelId, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsx("div", { className: fieldContainerClassName, children: renderInput({
|
|
31
|
+
classModifier: `${inputClassModifier} ${modifiers}`,
|
|
32
|
+
id: inputId,
|
|
33
|
+
errorId,
|
|
34
|
+
disabled,
|
|
35
|
+
ariaInvalid: isInvalid,
|
|
36
|
+
...otherProps,
|
|
37
|
+
}) }), forceDisplayMessage ? (_jsx(FieldError, { message: message, messageType: messageType, errorId: errorId })) : (_jsx(HelpMessage, { message: helpMessage, id: errorId })), appendChildren] })] }));
|
|
25
38
|
};
|
|
@@ -2,7 +2,7 @@ import { MessageTypes } from "./MessageTypes";
|
|
|
2
2
|
const getFieldInputClassModifier = (modifier, disabled) => disabled ? `${modifier} disabled` : modifier;
|
|
3
3
|
const getInputClassModifier = (modifier, children) => children ? `${modifier} hasinfobulle` : modifier;
|
|
4
4
|
const getModifier = (messageType) => {
|
|
5
|
-
let modifier = "
|
|
5
|
+
let modifier = "";
|
|
6
6
|
switch (messageType) {
|
|
7
7
|
case MessageTypes.success:
|
|
8
8
|
modifier = "success";
|
|
@@ -10,6 +10,9 @@ const getModifier = (messageType) => {
|
|
|
10
10
|
case MessageTypes.warning:
|
|
11
11
|
modifier = "warning";
|
|
12
12
|
break;
|
|
13
|
+
case MessageTypes.error:
|
|
14
|
+
modifier = "error";
|
|
15
|
+
break;
|
|
13
16
|
default:
|
|
14
17
|
break;
|
|
15
18
|
}
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from "react";
|
|
|
2
2
|
type HelpProps = {
|
|
3
3
|
message?: ReactNode;
|
|
4
4
|
isVisible?: boolean;
|
|
5
|
+
id?: string;
|
|
5
6
|
};
|
|
6
|
-
export declare const HelpMessage: ({ message, isVisible }: HelpProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const HelpMessage: ({ message, isVisible, id }: HelpProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export const HelpMessage = ({ message, isVisible = true }) => isVisible && _jsx("small", { className: "af-form__help", children: message });
|
|
2
|
+
export const HelpMessage = ({ message, isVisible = true, id }) => isVisible && (_jsx("small", { id: id, className: "af-form__help", children: message }));
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
export { LegacyField } from "./Deprecated/Field";
|
|
3
|
+
export { FieldForm } from "./Deprecated/FieldForm";
|
|
4
|
+
export { FieldInput } from "./Deprecated/FieldInput";
|
|
2
5
|
export { Field } from "./Field";
|
|
6
|
+
export type { ConsumerFieldProps } from "./Field";
|
|
3
7
|
export { FieldError } from "./FieldError";
|
|
4
|
-
export { FieldForm } from "./FieldForm";
|
|
5
|
-
export { FieldInput } from "./FieldInput";
|
|
6
8
|
export { FormClassManager } from "./FormClassManager";
|
|
7
9
|
export { HelpMessage } from "./HelpMessage";
|
|
8
10
|
export { InputList } from "./InputList";
|
|
9
|
-
export { LegacyField } from "./LegacyField";
|
|
10
11
|
export { MessageTypes } from "./MessageTypes";
|
|
11
12
|
export { getFirstId } from "./getFirstId";
|
|
12
13
|
export { getOptionClassName } from "./getOptionClassName";
|
|
@@ -16,9 +17,11 @@ export type Option = {
|
|
|
16
17
|
id?: string;
|
|
17
18
|
icon?: ReactNode;
|
|
18
19
|
label: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Ne semble pas utilisé
|
|
22
|
+
*/
|
|
19
23
|
description?: ReactNode;
|
|
20
24
|
value: string;
|
|
21
|
-
disabled?: boolean;
|
|
22
25
|
} & React.InputHTMLAttributes<HTMLInputElement>;
|
|
23
26
|
type BaseFormEvent = {
|
|
24
27
|
id: string;
|
package/dist/Form/core/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
export { LegacyField } from "./Deprecated/Field";
|
|
2
|
+
export { FieldForm } from "./Deprecated/FieldForm";
|
|
3
|
+
export { FieldInput } from "./Deprecated/FieldInput";
|
|
1
4
|
export { Field } from "./Field";
|
|
2
5
|
export { FieldError } from "./FieldError";
|
|
3
|
-
export { FieldForm } from "./FieldForm";
|
|
4
|
-
export { FieldInput } from "./FieldInput";
|
|
5
6
|
export { FormClassManager } from "./FormClassManager";
|
|
6
7
|
export { HelpMessage } from "./HelpMessage";
|
|
7
8
|
export { InputList } from "./InputList";
|
|
8
|
-
export { LegacyField } from "./LegacyField";
|
|
9
9
|
export { MessageTypes } from "./MessageTypes";
|
|
10
10
|
export { getFirstId } from "./getFirstId";
|
|
11
11
|
export { getOptionClassName } from "./getOptionClassName";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "@axa-fr/design-system-slash-css/dist/Layout/Footer/Footer.
|
|
1
|
+
import "@axa-fr/design-system-slash-css/dist/Layout/Footer/Footer.css";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
2
3
|
type FooterProps = {
|
|
3
4
|
href?: string;
|
|
4
5
|
title?: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import logo from "@axa-fr/design-system-slash-css/logo-axa.svg";
|
|
3
|
-
import "@axa-fr/design-system-slash-css/dist/Layout/Footer/Footer.
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/Layout/Footer/Footer.css";
|
|
4
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
4
5
|
import { forwardRef } from "react";
|
|
5
|
-
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
export const Footer = forwardRef(({ className = "af-footer", href = "https://www.axa.fr/", title = "Site Axa", icon = logo, alt = "Logo Axa", version, children = `© ${new Date().getFullYear()} AXA Tous droits réservés`, ...props }, ref) => (_jsxs("footer", { ref: ref, className: classNames("af-container", className), ...props, children: [Boolean(icon) && (_jsx("a", { className: "af-logo", href: href, title: title, target: "_blank", rel: "noopener noreferrer", children: _jsx("img", { className: "af-logo__brand", src: icon, alt: alt }) })), _jsx("div", { className: "af-footer-content", children: children }), version ? (_jsxs("span", { className: "af-footer-version", children: ["Version ", version] })) : null] })));
|
|
6
8
|
Footer.displayName = "Footer";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Layout/Header/AnchorNavBar/AnchorNavBar.css";
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
4
|
+
export type AnchorNavBarItem = {
|
|
5
|
+
/**
|
|
6
|
+
* name - The display name of the navigation item.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* isActive - If true, the item is highlighted as active.
|
|
11
|
+
*/
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* onClick - Optional click handler for the navigation item.
|
|
15
|
+
*/
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* link - The URL or anchor to navigate to when the item is clicked.
|
|
19
|
+
*/
|
|
20
|
+
link?: string;
|
|
21
|
+
/**
|
|
22
|
+
* externalLink - If true, the link will open in a new tab and show an external link icon.
|
|
23
|
+
*/
|
|
24
|
+
externalLink?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* render - Optional custom render function for the navigation item. If provided, it overrides the default rendering.
|
|
27
|
+
*/
|
|
28
|
+
render?: (props: {
|
|
29
|
+
className: string;
|
|
30
|
+
}) => ReactNode;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Props for the AnchorNavBar component.
|
|
34
|
+
* items - An array of navigation items to display in the navigation bar.
|
|
35
|
+
*/
|
|
36
|
+
export type AnchorNavBarProps = {
|
|
37
|
+
items: AnchorNavBarItem[];
|
|
38
|
+
};
|
|
39
|
+
export declare const AnchorNavBar: ({ items }: AnchorNavBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import externalLinkIcon from "@material-symbols/svg-400/sharp/exit_to_app.svg";
|
|
4
|
+
import { Svg } from "../../../Svg";
|
|
5
|
+
import { Link } from "../../../Link/Link";
|
|
6
|
+
import { linkClassName } from "../../../Link/linkClassName";
|
|
7
|
+
import "@axa-fr/design-system-slash-css/dist/Layout/Header/AnchorNavBar/AnchorNavBar.css";
|
|
8
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
9
|
+
const defaultClassName = "af-anchor-navbar";
|
|
10
|
+
export const AnchorNavBar = ({ items }) => {
|
|
11
|
+
return (_jsx("nav", { className: classNames("af-container", defaultClassName), children: _jsx("ul", { children: items.map((item) => {
|
|
12
|
+
if (item.render) {
|
|
13
|
+
return (_jsx("li", { children: _jsx(Link, { render: item.render, className: classNames(`${linkClassName} ${defaultClassName}-link`, {
|
|
14
|
+
[`${defaultClassName}-link--active`]: item.isActive,
|
|
15
|
+
}) }) }, `nav-item-${item.name}`));
|
|
16
|
+
}
|
|
17
|
+
return (_jsx("li", { children: _jsxs(Link, { href: item.link, "aria-current": item.isActive ? "page" : undefined, onClick: item.onClick, className: classNames(`${defaultClassName}-link`, {
|
|
18
|
+
[`${defaultClassName}-link--active`]: item.isActive,
|
|
19
|
+
}), target: item.externalLink ? "_blank" : undefined, children: [item.name, item.externalLink ? (_jsx(Svg, { role: "presentation", src: externalLinkIcon, className: `${defaultClassName}-external-link-svg` })) : null] }) }, `nav-item-${item.name}`));
|
|
20
|
+
}) }) }));
|
|
21
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/Header.scss";
|
|
3
|
+
import classNames from "classnames";
|
|
3
4
|
import { getComponentClassName } from "../../utilities";
|
|
4
5
|
const defaultClassName = "af-header";
|
|
5
6
|
const Header = ({ classModifier, className, children }) => {
|
|
6
7
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
7
|
-
return (_jsx("div", { className:
|
|
8
|
+
return (_jsx("div", { className: classNames("af-container", componentClassName), children: _jsx("header", { className: `${defaultClassName}__content`, role: "banner", children: children }) }));
|
|
8
9
|
};
|
|
9
10
|
export { Header };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/HeaderTitle/HeaderTitle.scss";
|
|
3
|
+
import { AnchorNavBarItem } from "../AnchorNavBar/AnchorNavBar";
|
|
3
4
|
type Props = {
|
|
4
5
|
children?: ReactNode;
|
|
5
6
|
classModifier?: string;
|
|
6
7
|
className?: string;
|
|
7
8
|
isSticky?: boolean;
|
|
9
|
+
contentLeft?: ReactNode;
|
|
10
|
+
contentRight?: ReactNode;
|
|
8
11
|
subtitle?: string;
|
|
9
12
|
title: string;
|
|
10
13
|
toggleMenu?: () => void;
|
|
14
|
+
anchorNavBarItems?: AnchorNavBarItem[];
|
|
11
15
|
};
|
|
12
|
-
declare const HeaderTitle: ({ children, classModifier, className, isSticky, subtitle, title, toggleMenu, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const HeaderTitle: ({ children, classModifier, className, isSticky, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
17
|
export { HeaderTitle };
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/HeaderTitle/HeaderTitle.scss";
|
|
3
|
+
import classNames from "classnames";
|
|
3
4
|
import { getComponentClassName } from "../../../utilities";
|
|
4
5
|
import { ToggleButton } from "../ToggleButton/ToggleButton";
|
|
5
6
|
import { Action } from "../../../Action/Action";
|
|
6
7
|
import { getClassModifier } from "./HeaderTitle.helpers";
|
|
8
|
+
import { AnchorNavBar } from "../AnchorNavBar/AnchorNavBar";
|
|
7
9
|
const defaultClassName = "af-title-bar";
|
|
8
|
-
const HeaderTitle = ({ children, classModifier, className, isSticky = true, subtitle, title, toggleMenu, }) => {
|
|
10
|
+
const HeaderTitle = ({ children, classModifier, className, isSticky = true, contentLeft, contentRight, subtitle, title, toggleMenu, anchorNavBarItems, }) => {
|
|
9
11
|
const componentClassName = getComponentClassName(className, getClassModifier(classModifier, isSticky), defaultClassName);
|
|
10
|
-
|
|
12
|
+
const isAnchorNavBarPresent = anchorNavBarItems && anchorNavBarItems.length > 0;
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: classNames("af-container", componentClassName, {
|
|
14
|
+
[`${defaultClassName}__withAnchorNavBar`]: isAnchorNavBarPresent,
|
|
15
|
+
}), children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("div", { className: `${defaultClassName}__leftSection`, children: [contentLeft, _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle ? (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle })) : null] }), children] }), contentRight ? (_jsx("div", { className: `${defaultClassName}__rightSection`, children: contentRight })) : null] }), isAnchorNavBarPresent ? (_jsx(AnchorNavBar, { items: anchorNavBarItems })) : null] }));
|
|
11
16
|
};
|
|
12
17
|
export { HeaderTitle };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from "react";
|
|
3
|
+
import infoIcon from "@material-symbols/svg-400/outlined/info-fill.svg";
|
|
3
4
|
import { getComponentClassName } from "../../../utilities";
|
|
4
5
|
import { generateId } from "../../../utilities/helpers/generateId";
|
|
5
6
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
|
|
7
|
+
import { Svg } from "../../../Svg";
|
|
6
8
|
const defaultClassName = "af-contrat";
|
|
7
9
|
const Infos = ({ infos, className, classModifier }) => {
|
|
8
10
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
9
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx(
|
|
11
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx(Svg, { className: "af-contrat__icon", src: infoIcon, "aria-hidden": "true" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
|
|
10
12
|
const idTerm = info.id ?? `info-${generateId(info)}`;
|
|
11
13
|
return (_jsxs(Fragment, { children: [_jsx("dt", { id: idTerm, className: `${defaultClassName}__word`, children: info.word }), _jsx("dd", { className: `${defaultClassName}__def`, "aria-labelledby": idTerm, children: info.definition })] }, idTerm));
|
|
12
14
|
}) })] }));
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
2
3
|
import { getComponentClassName } from "../../../utilities";
|
|
3
4
|
const defaultClassName = "af-nav-container";
|
|
4
5
|
const NavBarBase = ({ isVisible = true, onClick, id = "mainmenu", toggleMenuId = "togglemenu", isMenuFocused, className, classModifier, handleKeys, onFocus, onBlur, children, }) => {
|
|
5
6
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
6
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx("button", { "aria-controls": id, "aria-haspopup": "true", type: "button", onClick: onClick, className: `mask fade ${isVisible ? "show" : ""}`, id: `open-${toggleMenuId}`, "aria-label": "Open Menu" }),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
return (_jsxs("div", { className: classNames("af-container", componentClassName), children: [_jsx("button", { "aria-controls": id, "aria-haspopup": "true", type: "button", onClick: onClick, className: `mask fade ${isVisible ? "show" : ""}`, id: `open-${toggleMenuId}`, "aria-label": "Open Menu" }), _jsxs("nav", { className: `af-nav af-drawer left ${isVisible ? "show" : ""}`, role: "navigation", "aria-label": "Menu principal", children: [_jsxs("div", { className: "af-nav__aside-header", children: [_jsx("h4", { className: "af-nav__aside-title", children: "Menu" }), _jsx("button", { "aria-controls": id, "aria-haspopup": "true", onClick: onClick, type: "button", className: "af-nav__aside-close", id: `close-${toggleMenuId}`, "aria-label": "Close Menu", children: "\u00D7" })] }), _jsx("ul", { onKeyDown: (e) => {
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
handleKeys(e.key);
|
|
10
|
+
}, onFocus: (e) => {
|
|
11
|
+
onFocus({ e });
|
|
12
|
+
}, onBlur: (e) => {
|
|
13
|
+
onBlur({ e });
|
|
14
|
+
}, className: `af-nav__list ${isMenuFocused ? "af-nav__list--focused" : ""}`, role: "menubar", id: id, children: children })] })] }));
|
|
14
15
|
};
|
|
15
16
|
export { NavBarBase };
|
|
@@ -49,6 +49,6 @@ const NavBarItem = ({ children, hasFocus = false, actionElt, ariaLabel = "", tab
|
|
|
49
49
|
key: `child${childIndex}`,
|
|
50
50
|
hasFocus: hasFocus && position === childIndex && isMenuOpen,
|
|
51
51
|
}), [position, isMenuOpen, hasFocus]);
|
|
52
|
-
return (_jsx(NavBarItemBase, { className: className, role: role, hasFocus: hasFocus, tabIndex: tabIndex, isMenuOpen: isMenuOpen, handleKeys: handleKeys, actionElt: actionElt, ...otherProps, children: children
|
|
52
|
+
return (_jsx(NavBarItemBase, { className: className, role: role, hasFocus: hasFocus, tabIndex: tabIndex, isMenuOpen: isMenuOpen, handleKeys: handleKeys, actionElt: actionElt, ...otherProps, children: children ? (_jsxs(_Fragment, { children: [_jsx("i", { className: "glyphicon glyphicon-arrow-xs-down" }, `icon${tabIndex}`), _jsx("ul", { className: "af-nav__list af-nav__list--children", role: "menu", "aria-label": ariaLabel, children: React.Children.map(children, renderChild) }, `list${tabIndex}`)] })) : null }));
|
|
53
53
|
};
|
|
54
54
|
export { NavBarItem };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/NavBar/NavBar.scss";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
2
3
|
export { NavBar } from "./NavBar";
|
|
3
4
|
export { NavBarBase } from "./NavBarBase";
|
|
4
5
|
export { NavBarItem, NavBarItemBase, NavBarItemLink } from "./NavBarItem";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/NavBar/NavBar.scss";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
2
3
|
export { NavBar } from "./NavBar";
|
|
3
4
|
export { NavBarBase } from "./NavBarBase";
|
|
4
5
|
export { NavBarItem, NavBarItemBase, NavBarItemLink } from "./NavBarItem";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
const InnerUser = ({ name, profile }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "af-info-user__name", children: name }, "1"), profile
|
|
2
|
+
const InnerUser = ({ name, profile }) => (_jsxs(_Fragment, { children: [_jsx("span", { className: "af-info-user__name", children: name }, "1"), profile ? (_jsxs("span", { className: "af-info-user__profile", children: ["[", profile, "]"] }, "2")) : null] }));
|
|
3
3
|
export { InnerUser };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, PropsWithChildren } from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Layout/MainContainer/MainContainer.css";
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
4
|
+
type MainContainerProps = ComponentPropsWithoutRef<"main"> & PropsWithChildren;
|
|
5
|
+
export declare const MainContainer: ({ children, ...othersProps }: MainContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Layout/MainContainer/MainContainer.css";
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/common/breakpoints.css";
|
|
4
|
+
export const MainContainer = ({ children, ...othersProps }) => (_jsx("main", { className: "af-container", ...othersProps, children: children }));
|
package/dist/Link/Link.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "@axa-fr/design-system-slash-css/dist/Link/Link.
|
|
1
|
+
import "@axa-fr/design-system-slash-css/dist/Link/Link.css";
|
|
2
2
|
import { type CustomLinkProps } from "./CustomLink";
|
|
3
3
|
import { type LinkComponentProps } from "./LinkAnchor";
|
|
4
4
|
export type LinkProps = LinkComponentProps | CustomLinkProps;
|
package/dist/Link/Link.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "@axa-fr/design-system-slash-css/dist/Link/Link.
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Link/Link.css";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { CustomLink } from "./CustomLink";
|
|
5
5
|
import { LinkAnchor } from "./LinkAnchor";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ComponentPropsWithRef,
|
|
1
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
2
|
+
import { Svg } from "../Svg";
|
|
2
3
|
type AnchorLinkProps = {
|
|
3
|
-
leftIcon?:
|
|
4
|
-
rightIcon?:
|
|
4
|
+
leftIcon?: ReactElement<typeof Svg>;
|
|
5
|
+
rightIcon?: ReactElement<typeof Svg>;
|
|
5
6
|
className?: string;
|
|
6
7
|
disabled?: boolean;
|
|
8
|
+
variant?: "default" | "reverse";
|
|
7
9
|
};
|
|
8
10
|
type LinkComponentProps = ComponentPropsWithRef<"a"> & AnchorLinkProps;
|
|
9
11
|
declare const LinkAnchor: import("react").ForwardRefExoticComponent<Omit<LinkComponentProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
package/dist/Link/LinkAnchor.js
CHANGED
|
@@ -2,9 +2,11 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { linkClassName } from "./linkClassName";
|
|
5
|
-
const LinkAnchor = forwardRef(({ className, target, rel, leftIcon, children, rightIcon, disabled, ...restProps }, ref) => {
|
|
6
|
-
const finalClassName = classnames(linkClassName, className
|
|
7
|
-
|
|
5
|
+
const LinkAnchor = forwardRef(({ className, target, rel, leftIcon, children, rightIcon, disabled, variant, ...restProps }, ref) => {
|
|
6
|
+
const finalClassName = classnames(linkClassName, className, {
|
|
7
|
+
[`${linkClassName}--reverse`]: variant === "reverse",
|
|
8
|
+
});
|
|
9
|
+
return (_jsxs("a", { className: finalClassName, rel: target === "_blank" ? "noopener noreferrer" : rel, "aria-disabled": disabled ?? restProps["aria-disabled"], ref: ref, target: target, ...restProps, children: [leftIcon, children, rightIcon] }));
|
|
8
10
|
});
|
|
9
11
|
LinkAnchor.displayName = "LinkAnchor";
|
|
10
12
|
export { LinkAnchor };
|
package/dist/Loader/Loader.js
CHANGED
|
@@ -22,5 +22,5 @@ export const Loader = ({ className, text, children, classModifier, mode = "none"
|
|
|
22
22
|
const message = text || getText(mode);
|
|
23
23
|
const isLoaderVisible = mode !== "none";
|
|
24
24
|
const isLoaderInError = mode === "error";
|
|
25
|
-
return (_jsxs("div", { className: componentClassName, children: [children, isLoaderVisible
|
|
25
|
+
return (_jsxs("div", { className: componentClassName, children: [children, isLoaderVisible ? (_jsx("div", { className: `${componentClassName} af-loader-on`, children: _jsxs("div", { className: "af-spinner", role: "alert", "aria-live": "assertive", "aria-busy": !isLoaderInError, "aria-label": message, children: [!isLoaderInError && _jsx("div", { className: "af-spinner__animation" }), _jsx("div", { className: "af-spinner__caption", children: message })] }) })) : null] }));
|
|
26
26
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "@axa-fr/design-system-slash-css/dist/Message/Message.css";
|
|
2
|
+
import { MouseEventHandler, PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
export type MessageVariants = "error" | "warning" | "info" | "success";
|
|
4
|
+
export type MessageProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Content of the message title. Can be a string or a ReactNode.
|
|
7
|
+
*/
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* URL of an svg icon to display in the sidebar of the message.
|
|
11
|
+
* If not provided, a default icon based on the classModifier will be used.
|
|
12
|
+
* <strong>This not recommended to use</strong>. Only use as an escape hatch.
|
|
13
|
+
*/
|
|
14
|
+
icon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* handler for the close button click event.
|
|
17
|
+
* If not provided, the close button will not be displayed.
|
|
18
|
+
*/
|
|
19
|
+
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
20
|
+
/**
|
|
21
|
+
* If you want to add a custom class to the component.
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Message className="my-custom-class" title="My message">
|
|
25
|
+
* ```
|
|
26
|
+
* will produce
|
|
27
|
+
* ```html
|
|
28
|
+
* <div class="my-custom-class af-alert">My message</div>
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use `variant` instead.
|
|
33
|
+
*/
|
|
34
|
+
classModifier?: MessageVariants | "danger";
|
|
35
|
+
/**
|
|
36
|
+
* Variant of the message.
|
|
37
|
+
* This will determine the icon and the style of the message.
|
|
38
|
+
*/
|
|
39
|
+
variant?: MessageVariants;
|
|
40
|
+
/**
|
|
41
|
+
* Aria label for the close button.
|
|
42
|
+
* This is important for accessibility, use a meaningful label to describe the action.
|
|
43
|
+
* @default "close"
|
|
44
|
+
*/
|
|
45
|
+
closeButtonAriaLabel?: string;
|
|
46
|
+
};
|
|
47
|
+
export declare const Message: ({ className, onClose, icon, title, children, classModifier, variant, closeButtonAriaLabel, }: PropsWithChildren<MessageProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Message/Message.css";
|
|
3
|
+
import successSvg from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
|
|
4
|
+
import closeSvg from "@material-symbols/svg-400/outlined/close.svg";
|
|
5
|
+
import errorSvg from "@material-symbols/svg-400/outlined/error-fill.svg";
|
|
6
|
+
import infoSvg from "@material-symbols/svg-400/outlined/info-fill.svg";
|
|
7
|
+
import warningSvg from "@material-symbols/svg-400/outlined/warning-fill.svg";
|
|
8
|
+
import { Svg } from "../Svg";
|
|
9
|
+
import { getComponentClassNameWithUserClassname } from "../utilities/helpers/getComponentClassName";
|
|
10
|
+
const getIconUrl = (type) => {
|
|
11
|
+
switch (type) {
|
|
12
|
+
case "info":
|
|
13
|
+
return infoSvg;
|
|
14
|
+
case "success":
|
|
15
|
+
return successSvg;
|
|
16
|
+
case "error":
|
|
17
|
+
return errorSvg;
|
|
18
|
+
case "warning":
|
|
19
|
+
return warningSvg;
|
|
20
|
+
default:
|
|
21
|
+
return errorSvg;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const getVariant = (classModifier, variant) => {
|
|
25
|
+
if (variant) {
|
|
26
|
+
return variant;
|
|
27
|
+
}
|
|
28
|
+
if (classModifier) {
|
|
29
|
+
return classModifier === "danger" ? "warning" : classModifier;
|
|
30
|
+
}
|
|
31
|
+
return "error"; // Default variant
|
|
32
|
+
};
|
|
33
|
+
export const Message = ({ className, onClose, icon, title, children, classModifier = "error", variant, // Backward compatibility
|
|
34
|
+
closeButtonAriaLabel = "close", }) => {
|
|
35
|
+
const safeVariant = getVariant(classModifier, variant);
|
|
36
|
+
const componentClassName = getComponentClassNameWithUserClassname({
|
|
37
|
+
componentClassName: "af-alert",
|
|
38
|
+
userClassName: className,
|
|
39
|
+
classModifier: safeVariant,
|
|
40
|
+
});
|
|
41
|
+
const iconSrc = icon ?? getIconUrl(safeVariant);
|
|
42
|
+
return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsx("div", { className: "af-alert__sidebar", children: _jsx("div", { className: "af-alert__indicator", children: _jsx(Svg, { src: iconSrc, className: "af-alert__icon", role: "presentation" }) }) }), _jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__title", children: title }), children] }), onClose ? (_jsx("button", { onClick: onClose, "aria-label": closeButtonAriaLabel, type: "button", className: "af-alert__close-button", children: _jsx(Svg, { src: closeSvg, className: "af-alert__close-icon", role: "presentation" }) })) : null] }));
|
|
43
|
+
};
|
|
@@ -1,15 +1,40 @@
|
|
|
1
|
-
import React, { type ReactNode
|
|
1
|
+
import React, { type ReactNode } from "react";
|
|
2
2
|
import { type HeaderProps } from "./components/Header";
|
|
3
|
-
|
|
3
|
+
import { ModalProps } from "./Modal";
|
|
4
|
+
export type BooleanModalProps = React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> & Omit<HeaderProps, "children" | "onCancel" | "title"> & Pick<ModalProps, "size"> & {
|
|
5
|
+
/**
|
|
6
|
+
* Title of the modal, displayed in the header.
|
|
7
|
+
* Also used as the `aria-label` of the <dialog> element for accessibility.
|
|
8
|
+
*/
|
|
9
|
+
title: string;
|
|
10
|
+
/**
|
|
11
|
+
* Callback function called when the modal is submitted.
|
|
12
|
+
* @param event The event that triggered the submission, can be a mouse click or a keyboard event.
|
|
13
|
+
* @returns void
|
|
14
|
+
*/
|
|
4
15
|
onSubmit: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Callback function called when the modal is cancelled.
|
|
18
|
+
* @param event The event that triggered the cancellation, can be a mouse click or a keyboard event.
|
|
19
|
+
* @returns void
|
|
20
|
+
*/
|
|
5
21
|
onCancel: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
6
22
|
id: string;
|
|
7
23
|
children: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Text content of the submit button.
|
|
26
|
+
*/
|
|
8
27
|
submitTitle?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Text content of the cancel button.
|
|
30
|
+
*/
|
|
9
31
|
cancelTitle?: string;
|
|
10
32
|
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use `size` prop instead.
|
|
35
|
+
* Class modifier for the modal. Can be used to apply custom styles.
|
|
36
|
+
*/
|
|
11
37
|
classModifier?: string;
|
|
12
|
-
ref?: Ref<HTMLDialogElement>;
|
|
13
38
|
};
|
|
14
39
|
declare const BooleanModal: React.ForwardRefExoticComponent<Omit<BooleanModalProps, "ref"> & React.RefAttributes<HTMLDialogElement>>;
|
|
15
40
|
export { BooleanModal };
|
|
@@ -7,7 +7,7 @@ import { Header } from "./components/Header";
|
|
|
7
7
|
const defaultClassName = "af-modal";
|
|
8
8
|
const BooleanModal = forwardRef(({ children, title, submitTitle = "Valider", cancelTitle = "Annuler", className = defaultClassName, classModifier, onCancel, onSubmit, closeButtonAriaLabel, ...props }, ref) => {
|
|
9
9
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
10
|
-
return (_jsxs(Modal, { className: componentClassName, onOutsideTap: onCancel, title: title, ref: ref, ...props, children: [_jsx(Header, { title: title, onCancel: onCancel, closeButtonAriaLabel: closeButtonAriaLabel }), _jsx(Body, { children: children }), _jsxs(Footer, { children: [_jsx(Button, {
|
|
10
|
+
return (_jsxs(Modal, { className: componentClassName, onOutsideTap: onCancel, title: title, ref: ref, ...props, children: [_jsx(Header, { title: title, onCancel: onCancel, closeButtonAriaLabel: closeButtonAriaLabel }), _jsx(Body, { children: children }), _jsxs(Footer, { children: [_jsx(Button, { variant: "secondary", onClick: onCancel, children: cancelTitle }), _jsx(Button, { onClick: onSubmit, variant: "validated", children: submitTitle })] })] }));
|
|
11
11
|
});
|
|
12
12
|
BooleanModal.displayName = "BooleanModal";
|
|
13
13
|
export { BooleanModal };
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
export type ModalProps = React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> & {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
size?: "lg" | "sm";
|
|
4
|
+
/**
|
|
5
|
+
* The content of the modal.
|
|
6
|
+
*/
|
|
6
7
|
children: ReactNode;
|
|
8
|
+
onOutsideTap: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
9
|
+
/**
|
|
10
|
+
* `aria-label` of the modal, used for accessibility.
|
|
11
|
+
*/
|
|
12
|
+
title?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `size` prop instead.
|
|
16
|
+
* Class modifier for the modal. Can be used to apply custom styles.
|
|
17
|
+
*/
|
|
7
18
|
classModifier?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Size of the modal. Overrides classModifier if set
|
|
21
|
+
*/
|
|
8
22
|
ref?: React.Ref<HTMLDialogElement>;
|
|
9
23
|
};
|
|
10
24
|
declare const Modal: import("react").ForwardRefExoticComponent<Omit<ModalProps, "ref"> & import("react").RefAttributes<HTMLDialogElement>>;
|