@axa-fr/design-system-slash-react 1.2.1-alpha.9 → 1.2.1-alpha.91
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/Card/Card.d.ts +13 -0
- package/dist/Card/Card.js +6 -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/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/MultiSelectInput.d.ts +4 -6
- package/dist/Form/MultiSelect/MultiSelectInput.js +6 -11
- 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.js +1 -1
- package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.d.ts +16 -0
- package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.js +20 -0
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.d.ts +5 -1
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.js +7 -2
- package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.js +1 -1
- package/dist/Layout/Header/User/InnerUser.js +1 -1
- 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 +16 -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/Li.js +1 -4
- package/dist/index.d.ts +10 -2
- package/dist/index.js +9 -2
- package/dist/utilities/helpers/getComponentClassName.d.ts +7 -0
- package/dist/utilities/helpers/getComponentClassName.js +14 -0
- package/package.json +4 -4
- package/dist/Alert/Alert.d.ts +0 -17
- package/dist/Alert/Alert.js +0 -14
package/dist/ModalAgent/Modal.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { getComponentClassName } from "..";
|
|
4
|
-
const Modal = forwardRef(({ className, title = "", onOutsideTap, children, classModifier, ...props }, ref) => {
|
|
5
|
-
|
|
4
|
+
const Modal = forwardRef(({ className, title = "", onOutsideTap, children, classModifier, size, ...props }, ref) => {
|
|
5
|
+
// If size is set to 'lg' or 'sm', use it as the classModifier, otherwise use the provided classModifier
|
|
6
|
+
let effectiveClassModifier;
|
|
7
|
+
if (size) {
|
|
8
|
+
if (classModifier && classModifier !== "lg" && classModifier !== "sm") {
|
|
9
|
+
effectiveClassModifier = `${size} ${classModifier}`;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
effectiveClassModifier = size;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
effectiveClassModifier = classModifier;
|
|
17
|
+
}
|
|
18
|
+
const componentClassName = getComponentClassName(className, effectiveClassModifier, "af-modal");
|
|
6
19
|
return (
|
|
7
20
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events
|
|
8
21
|
_jsx("dialog", { "aria-label": title, className: componentClassName, onClick: onOutsideTap, ref: ref, ...props, children: _jsx("div", { className: "af-modal__dialog", onClick: (event) => event.stopPropagation(), children: _jsx("div", { className: "af-modal__content", children: children }) }) }));
|
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
import type { MouseEventHandler } from "react";
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from "react";
|
|
2
2
|
export type HeaderProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Text displayed in the header.
|
|
5
|
+
* @deprecated Use `children` instead to allow for more flexible content.
|
|
6
|
+
*/
|
|
5
7
|
title?: string;
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Text displayed in the header, overrides `title` if both are set.
|
|
10
|
+
*/
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function called when the close button is clicked.
|
|
14
|
+
*/
|
|
15
|
+
onCancel: MouseEventHandler<HTMLButtonElement>;
|
|
16
|
+
/**
|
|
17
|
+
* Aria label for the close button, used for accessibility.
|
|
18
|
+
*/
|
|
7
19
|
closeButtonAriaLabel?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Class modifier for the header. Can be used to apply custom styles.
|
|
22
|
+
*/
|
|
23
|
+
classModifier?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Prop to override the style of the header. Will totally remove the default styles.
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
8
28
|
};
|
|
9
|
-
declare const Header: ({ className, classModifier, title, closeButtonAriaLabel, onCancel, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare const Header: ({ className, classModifier, title, closeButtonAriaLabel, onCancel, children, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
30
|
export { Header };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import closeIcon from "@material-symbols/svg-400/outlined/close.svg";
|
|
3
|
+
import { getComponentClassName, Svg } from "../..";
|
|
4
|
+
const Header = ({ className, classModifier, title, closeButtonAriaLabel = "Fermer la boite de dialogue", onCancel, children, ...props }) => {
|
|
4
5
|
const componentClassName = getComponentClassName(className, classModifier, "af-modal__header");
|
|
5
|
-
return (_jsxs("header", { className: componentClassName, ...props, children: [_jsx("h4", { className: "af-modal__header-title", children: title }), _jsx("button", { className: "af-modal__header-close-btn", type: "button", "aria-label": closeButtonAriaLabel, onClick: onCancel, children: _jsx(
|
|
6
|
+
return (_jsxs("header", { className: componentClassName, ...props, children: [_jsx("h4", { className: "af-modal__header-title", children: children ?? title }), _jsx("button", { className: "af-modal__header-close-btn", type: "button", "aria-label": closeButtonAriaLabel, onClick: onCancel, children: _jsx(Svg, { src: closeIcon }) })] }));
|
|
6
7
|
};
|
|
7
8
|
export { Header };
|
|
@@ -14,5 +14,5 @@ export const AnimatedPopover = ({ placement, children, isOpen, target, className
|
|
|
14
14
|
elements: { reference: referenceElement, floating: popperElement },
|
|
15
15
|
middleware: [offset(12), arrow({ element: arrowRef })],
|
|
16
16
|
});
|
|
17
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { ref: setReferenceElement, className: "af-popover__container-over", role: "presentation", children: target }), isOpen
|
|
17
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { ref: setReferenceElement, className: "af-popover__container-over", role: "presentation", children: target }), isOpen ? (_jsxs("div", { ref: setPopperElement, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: floatingStyles, "data-popper-placement": placement, className: "af-popover__container-pop", children: [_jsx("div", { children: children }), _jsx(FloatingArrow, { ref: arrowRef, context: context, fill: "white" })] })) : null] }));
|
|
18
18
|
};
|
package/dist/Steps/StepBase.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import chevronSvg from "@material-symbols/svg-400/outlined/chevron_right.svg";
|
|
3
|
+
import checkSvg from "@material-symbols/svg-400/outlined/check.svg";
|
|
4
|
+
import { getComponentClassName, Svg } from "..";
|
|
3
5
|
const StepBase = ({ children, id, title, className, classModifier }) => {
|
|
4
6
|
const componentClassName = getComponentClassName(className, classModifier, "af-steps-list-step");
|
|
5
|
-
return (
|
|
7
|
+
return (_jsxs("li", { className: componentClassName, title: title, children: [_jsx(Svg, { src: checkSvg }), children, _jsx(Svg, { src: chevronSvg })] }, id));
|
|
6
8
|
};
|
|
7
9
|
export { StepBase };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import type { VerticalStepMode } from "./types";
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/Steps/VerticalStep.css";
|
|
4
|
+
type Props = {
|
|
5
|
+
title: string;
|
|
6
|
+
id: string;
|
|
7
|
+
stepMode: VerticalStepMode;
|
|
8
|
+
onEdit: React.MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
form: ReactNode;
|
|
10
|
+
restitution: ReactNode;
|
|
11
|
+
editButtonLabel?: string;
|
|
12
|
+
editButtonAriaLabel?: string;
|
|
13
|
+
showRestitution?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const VerticalStep: ({ title, id, stepMode, editButtonLabel, editButtonAriaLabel, onEdit, form, restitution, showRestitution, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import edit from "@material-symbols/svg-400/sharp/edit-fill.svg";
|
|
4
|
+
import check from "@material-symbols/svg-400/sharp/check.svg";
|
|
5
|
+
import lock from "@material-symbols/svg-400/sharp/lock-fill.svg";
|
|
6
|
+
import { Title } from "../Title/Title";
|
|
7
|
+
import { Svg } from "../Svg";
|
|
8
|
+
import "@axa-fr/design-system-slash-css/dist/Steps/VerticalStep.css";
|
|
9
|
+
import { Button } from "../Button/Button";
|
|
10
|
+
const defaultClassName = "af-vertical-step";
|
|
11
|
+
export const VerticalStep = ({ title, id, stepMode, editButtonLabel = "Modifier", editButtonAriaLabel = `Modifier l'étape ${title}`, onEdit, form, restitution, showRestitution = true, }) => {
|
|
12
|
+
const isStepInEdition = stepMode === "edited";
|
|
13
|
+
const isStepValidated = stepMode === "validated";
|
|
14
|
+
const isStepLocked = stepMode === "locked";
|
|
15
|
+
return (_jsxs("div", { className: classNames(defaultClassName, {
|
|
16
|
+
[`${defaultClassName}--edition`]: isStepInEdition,
|
|
17
|
+
}), children: [_jsxs("div", { className: classNames("af-vertical-step-icon", {
|
|
18
|
+
[`${defaultClassName}-icon--validated`]: isStepValidated,
|
|
19
|
+
[`${defaultClassName}-icon--locked`]: isStepLocked,
|
|
20
|
+
[`${defaultClassName}-icon--edited`]: isStepInEdition,
|
|
21
|
+
}), children: [isStepValidated ? _jsx(Svg, { role: "presentation", src: check }) : null, isStepLocked ? _jsx(Svg, { role: "presentation", src: lock }) : null, isStepInEdition ? _jsx(Svg, { role: "presentation", src: edit }) : null] }), _jsx(Title, { className: classNames("af-title", `${defaultClassName}-title`), id: id, contentLeft: isStepValidated ? (_jsxs(Button, { "aria-label": editButtonAriaLabel, onClick: onEdit, className: "af-vertical-step-title-button", children: [_jsx(Svg, { role: "presentation", src: edit }), editButtonLabel] })) : undefined, children: title }), isStepInEdition ? _jsx("section", { children: form }) : null, isStepValidated && showRestitution ? (_jsx("section", { children: restitution })) : null, isStepInEdition ? (_jsx("div", { className: classNames(`${defaultClassName}-icon ${defaultClassName}-icon--lastIcon`), children: _jsx(Svg, { role: "presentation", src: check }) })) : null] }));
|
|
22
|
+
};
|
package/dist/Steps/index.d.ts
CHANGED
package/dist/Steps/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Summary/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type SummaryProps = Omit<
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { type MessageProps } from "../Messages/Message";
|
|
3
|
+
type SummaryProps = Omit<MessageProps, "title"> & {
|
|
4
4
|
title?: string;
|
|
5
5
|
messages?: ReactNode[];
|
|
6
6
|
isVisible?: boolean;
|
package/dist/Summary/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Message } from "../Messages/Message";
|
|
3
3
|
import { generateId } from "../utilities/helpers/generateId";
|
|
4
4
|
export const Summary = ({ messages = [], isVisible = true, title = "Invalid form", classModifier = "error", ...args }) => {
|
|
5
5
|
const messagesNotBlank = messages.filter((message) => Boolean(message));
|
|
6
6
|
if (!messages || !isVisible || messagesNotBlank.length === 0) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
const variant = classModifier === "danger" ? "warning" : classModifier;
|
|
10
|
+
return (_jsx(Message, { icon: "glyphicon glyphicon-warning-sign", title: title, variant: variant, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${generateId({ message })}`))) }) }));
|
|
10
11
|
};
|
package/dist/Svg/Svg.js
CHANGED
|
@@ -46,5 +46,5 @@ export const Svg = ({ src, alt, width = 24, height = 24, ...props }) => {
|
|
|
46
46
|
if (hasError) {
|
|
47
47
|
return alt ? (_jsx("span", { ...props, children: alt })) : null;
|
|
48
48
|
}
|
|
49
|
-
return _jsx("svg", { ref: rootRef, "data-src": src, ...props });
|
|
49
|
+
return _jsx("svg", { ref: rootRef, "data-src": src, role: "presentation", ...props });
|
|
50
50
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import classNames from "classnames";
|
|
3
2
|
const onClick = ({ onChange, value }) => (event) => {
|
|
4
3
|
event.preventDefault();
|
|
5
4
|
onChange({
|
|
@@ -10,8 +9,6 @@ const Li = ({ isVisible, active, value, ...props }) => {
|
|
|
10
9
|
if (!isVisible) {
|
|
11
10
|
return null;
|
|
12
11
|
}
|
|
13
|
-
return (_jsx("li", { className:
|
|
14
|
-
"af-pager__item--active": active,
|
|
15
|
-
}), children: _jsx("a", { className: "af-pager__item-link", href: "/#", onClick: onClick({ ...props, value }), children: _jsx("span", { children: value }) }) }));
|
|
12
|
+
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { "aria-current": active ? "page" : undefined, className: "af-pager__item-link", href: "/#", onClick: onClick({ ...props, value }), children: _jsx("span", { children: value }) }) }));
|
|
16
13
|
};
|
|
17
14
|
export { Li };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
|
|
4
4
|
import "@fontsource/source-sans-pro";
|
|
5
|
+
import { Message } from "./Messages/Message";
|
|
5
6
|
export { Action } from "./Action/Action";
|
|
6
|
-
export { Alert } from "./Alert/Alert";
|
|
7
7
|
export { Badge } from "./Badge/Badge";
|
|
8
8
|
export { Button } from "./Button/Button";
|
|
9
|
+
export { Card } from "./Card/Card";
|
|
9
10
|
export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
|
|
10
11
|
export { Choice, ChoiceInput } from "./Form/Choice";
|
|
11
12
|
export { LegacyField as Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
|
|
@@ -25,14 +26,21 @@ export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase,
|
|
|
25
26
|
export { Link, type LinkProps } from "./Link/Link";
|
|
26
27
|
export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
|
|
27
28
|
export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
|
|
28
|
-
export { Step, StepBase, Steps } from "./Steps";
|
|
29
|
+
export { Step, StepBase, Steps, VerticalStep } from "./Steps";
|
|
29
30
|
export { Summary } from "./Summary";
|
|
30
31
|
export { Svg } from "./Svg";
|
|
31
32
|
export { Tabs } from "./Tabs/Tabs";
|
|
32
33
|
export { Title } from "./Title/Title";
|
|
33
34
|
export { getComponentClassName } from "./utilities";
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
|
|
37
|
+
* @see {@link Message}
|
|
38
|
+
*/
|
|
39
|
+
declare const Alert: ({ className, onClose, icon, title, children, classModifier, variant, closeButtonAriaLabel, }: import("react").PropsWithChildren<import("./Messages/Message").MessageProps>) => import("react/jsx-runtime").JSX.Element;
|
|
34
40
|
export * from "./Accordion";
|
|
41
|
+
export { type MessageProps, type MessageVariants } from "./Messages/Message";
|
|
35
42
|
export * from "./Popover";
|
|
36
43
|
export * from "./Table";
|
|
44
|
+
export { Alert, Message };
|
|
37
45
|
export { HelpButton } from "./HelpButton";
|
|
38
46
|
export { Loader } from "./Loader/Loader";
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,11 @@ import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
|
|
4
4
|
import "@fontsource/source-sans-pro";
|
|
5
|
+
import { Message } from "./Messages/Message";
|
|
5
6
|
export { Action } from "./Action/Action";
|
|
6
|
-
export { Alert } from "./Alert/Alert";
|
|
7
7
|
export { Badge } from "./Badge/Badge";
|
|
8
8
|
export { Button } from "./Button/Button";
|
|
9
|
+
export { Card } from "./Card/Card";
|
|
9
10
|
export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
|
|
10
11
|
export { Choice, ChoiceInput } from "./Form/Choice";
|
|
11
12
|
export { LegacyField as Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
|
|
@@ -25,14 +26,20 @@ export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase,
|
|
|
25
26
|
export { Link } from "./Link/Link";
|
|
26
27
|
export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
|
|
27
28
|
export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
|
|
28
|
-
export { Step, StepBase, Steps } from "./Steps";
|
|
29
|
+
export { Step, StepBase, Steps, VerticalStep } from "./Steps";
|
|
29
30
|
export { Summary } from "./Summary";
|
|
30
31
|
export { Svg } from "./Svg";
|
|
31
32
|
export { Tabs } from "./Tabs/Tabs";
|
|
32
33
|
export { Title } from "./Title/Title";
|
|
33
34
|
export { getComponentClassName } from "./utilities";
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
|
|
37
|
+
* @see {@link Message}
|
|
38
|
+
*/
|
|
39
|
+
const Alert = Message;
|
|
34
40
|
export * from "./Accordion";
|
|
35
41
|
export * from "./Popover";
|
|
36
42
|
export * from "./Table";
|
|
43
|
+
export { Alert, Message };
|
|
37
44
|
export { HelpButton } from "./HelpButton";
|
|
38
45
|
export { Loader } from "./Loader/Loader";
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export declare const getComponentClassName: (className?: string, classModifier?: string, defaultClassName?: string) => string;
|
|
2
|
+
type getComponentClassNameWithUserClassnameParams = {
|
|
3
|
+
userClassName?: string;
|
|
4
|
+
classModifier?: string;
|
|
5
|
+
componentClassName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getComponentClassNameWithUserClassname: ({ componentClassName, userClassName, classModifier, }: getComponentClassNameWithUserClassnameParams) => string;
|
|
8
|
+
export {};
|
|
@@ -26,3 +26,17 @@ export const getComponentClassName = (className, classModifier, defaultClassName
|
|
|
26
26
|
});
|
|
27
27
|
return classNames(classNameToUse, modifiersObject);
|
|
28
28
|
};
|
|
29
|
+
export const getComponentClassNameWithUserClassname = ({ componentClassName, userClassName, classModifier, }) => {
|
|
30
|
+
// Fail fast, when no className or componentClassName we don't want to loop on modifier
|
|
31
|
+
if (!componentClassName) {
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
const classWithoutModifier = getLastClassName(componentClassName);
|
|
35
|
+
const modifiers = listClassModifier(classModifier);
|
|
36
|
+
const modifiersObject = modifiers
|
|
37
|
+
.filter((it) => /\S/.test(it))
|
|
38
|
+
.map((it) => {
|
|
39
|
+
return `${classWithoutModifier}--${it}`;
|
|
40
|
+
});
|
|
41
|
+
return classNames(componentClassName, modifiersObject, userClassName);
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.91",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@axa-fr/design-system-slash-css": "1.2.1-alpha.
|
|
50
|
+
"@axa-fr/design-system-slash-css": "1.2.1-alpha.91",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"@types/dompurify": "^3.0.5",
|
|
78
78
|
"@types/jest": "^29.5.14",
|
|
79
79
|
"@types/jest-axe": "^3.5.9",
|
|
80
|
-
"@vitest/coverage-v8": "^3.
|
|
80
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
81
81
|
"@vitest/ui": "^3.0.7",
|
|
82
82
|
"copyfiles": "^2.4.1",
|
|
83
|
-
"jest-axe": "^
|
|
83
|
+
"jest-axe": "^10.0.0",
|
|
84
84
|
"jsdom": "^25.0.1",
|
|
85
85
|
"react": "^19.0.0",
|
|
86
86
|
"rimraf": "^6.0.1",
|
package/dist/Alert/Alert.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { MouseEventHandler, PropsWithChildren } from "react";
|
|
2
|
-
import "@axa-fr/design-system-slash-css/dist/Alert/Alert.scss";
|
|
3
|
-
export declare enum TypeIcons {
|
|
4
|
-
error = "glyphicon glyphicon-minus-sign",
|
|
5
|
-
danger = "glyphicon glyphicon-alert",
|
|
6
|
-
info = "glyphicon glyphicon-info-sign",
|
|
7
|
-
success = "glyphicon glyphicon-ok"
|
|
8
|
-
}
|
|
9
|
-
export type AlertCoreComponentProps = {
|
|
10
|
-
title: string;
|
|
11
|
-
icon?: string;
|
|
12
|
-
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
13
|
-
className?: string;
|
|
14
|
-
classModifier?: "error" | "danger" | "info" | "success";
|
|
15
|
-
closeButtonAriaLabel?: string;
|
|
16
|
-
};
|
|
17
|
-
export declare const Alert: ({ className, onClose, icon, title, children, classModifier, closeButtonAriaLabel, }: PropsWithChildren<AlertCoreComponentProps>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Alert/Alert.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getComponentClassName } from "../utilities";
|
|
3
|
-
import "@axa-fr/design-system-slash-css/dist/Alert/Alert.scss";
|
|
4
|
-
export var TypeIcons;
|
|
5
|
-
(function (TypeIcons) {
|
|
6
|
-
TypeIcons["error"] = "glyphicon glyphicon-minus-sign";
|
|
7
|
-
TypeIcons["danger"] = "glyphicon glyphicon-alert";
|
|
8
|
-
TypeIcons["info"] = "glyphicon glyphicon-info-sign";
|
|
9
|
-
TypeIcons["success"] = "glyphicon glyphicon-ok";
|
|
10
|
-
})(TypeIcons || (TypeIcons = {}));
|
|
11
|
-
export const Alert = ({ className, onClose, icon, title, children, classModifier = "error", closeButtonAriaLabel = "close", }) => {
|
|
12
|
-
const componentClassName = getComponentClassName(className, classModifier, "af-alert");
|
|
13
|
-
return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsxs("div", { className: "af-alert__title", children: [_jsx("div", { className: "af-alert__title-icon", children: _jsx("i", { role: "presentation", className: icon || TypeIcons[classModifier] }) }), _jsx("div", { className: "af-alert__title-text", children: title }), onClose && (_jsx("button", { type: "button", className: "af-alert__title-icon-close", onClick: onClose, "aria-label": closeButtonAriaLabel, children: _jsx("i", { className: "glyphicon glyphicon-close" }) }))] }), children && (_jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__content-left" }), _jsx("div", { className: "af-alert__content-right", children: children })] }))] }));
|
|
14
|
-
};
|