@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/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,48 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* title - The title of the step.
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
9
|
+
/**
|
|
10
|
+
* id - The id of the step, used for accessibility.
|
|
11
|
+
* It should be unique within the document.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* stepMode - The mode of the step, can be "edited", "validated", or "locked".
|
|
16
|
+
*/
|
|
17
|
+
stepMode: VerticalStepMode;
|
|
18
|
+
/**
|
|
19
|
+
* onEdit - The function to call when the edit button is clicked.
|
|
20
|
+
*/
|
|
21
|
+
onEdit: React.MouseEventHandler<HTMLButtonElement>;
|
|
22
|
+
/**
|
|
23
|
+
* form - The content of the form to display when the step is in "edited" mode.
|
|
24
|
+
*/
|
|
25
|
+
form: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* restitution - The content to display when the step is in "validated" mode.
|
|
28
|
+
*/
|
|
29
|
+
restitution: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* editButtonLabel - The label of the edit button.
|
|
32
|
+
*/
|
|
33
|
+
editButtonLabel?: string;
|
|
34
|
+
/**
|
|
35
|
+
* editButtonAriaLabel - The aria-label of the edit button.
|
|
36
|
+
*/
|
|
37
|
+
editButtonAriaLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* showRestitution - Whether to show the restitution content when the step is validated.
|
|
40
|
+
*/
|
|
41
|
+
showRestitution?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* contentRight - Additional content to display on the right side of the title.
|
|
44
|
+
*/
|
|
45
|
+
contentRight?: string;
|
|
46
|
+
};
|
|
47
|
+
export declare const VerticalStep: ({ title, id, stepMode, editButtonLabel, editButtonAriaLabel, onEdit, form, restitution, showRestitution, contentRight, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
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, contentRight, }) => {
|
|
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, { 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, contentRight: contentRight, 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
|
};
|
|
@@ -2,9 +2,10 @@ type LiProps = {
|
|
|
2
2
|
isVisible?: boolean;
|
|
3
3
|
active?: boolean;
|
|
4
4
|
value: number;
|
|
5
|
+
pageLinkLabel: string;
|
|
5
6
|
onChange: (e: {
|
|
6
7
|
value: number;
|
|
7
8
|
}) => void;
|
|
8
9
|
};
|
|
9
|
-
declare const Li: ({ isVisible, active, value,
|
|
10
|
+
declare const Li: ({ isVisible, active, value, pageLinkLabel, onChange }: LiProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
11
|
export { Li };
|
|
@@ -1,17 +1,14 @@
|
|
|
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({
|
|
6
5
|
value: Number(value),
|
|
7
6
|
});
|
|
8
7
|
};
|
|
9
|
-
const Li = ({ isVisible, active, value,
|
|
8
|
+
const Li = ({ isVisible, active, value, pageLinkLabel, onChange }) => {
|
|
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: "/#", "aria-label": `Page ${value} des ${pageLinkLabel}`, onClick: onClick({ onChange, value }), children: _jsx("span", { children: value }) }) }));
|
|
16
13
|
};
|
|
17
14
|
export { Li };
|
|
@@ -27,11 +27,15 @@ export type PagerComponentProps = Pick<ComponentPropsWithoutRef<typeof Paginatio
|
|
|
27
27
|
* Label for the next button
|
|
28
28
|
*/
|
|
29
29
|
nextLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Label for page links and select
|
|
32
|
+
*/
|
|
33
|
+
elementsLabel?: string;
|
|
30
34
|
/**
|
|
31
35
|
* Label for text betweeen current page a total number of pages. Only used in "light" mode
|
|
32
36
|
* @default "sur"
|
|
33
37
|
*/
|
|
34
38
|
ofLabel?: string;
|
|
35
39
|
};
|
|
36
|
-
declare const Pager: ({ className, classModifier, numberPages, currentPage, onChange, mode, previousLabel, nextLabel, ofLabel, }: PagerComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare const Pager: ({ className, classModifier, numberPages, currentPage, onChange, mode, previousLabel, nextLabel, elementsLabel, ofLabel, }: PagerComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
41
|
export { Pager };
|
|
@@ -4,13 +4,13 @@ import { getComponentClassName } from "../..";
|
|
|
4
4
|
import { Li } from "./Li";
|
|
5
5
|
import { LiPoint } from "./LiPoint";
|
|
6
6
|
import { PaginationButton } from "./PaginationButton";
|
|
7
|
-
const Pager = ({ className, classModifier, numberPages = 1, currentPage = 1, onChange, mode = "default", previousLabel = "« Précédent", nextLabel = "Suivant »", ofLabel = "sur", }) => {
|
|
7
|
+
const Pager = ({ className, classModifier, numberPages = 1, currentPage = 1, onChange, mode = "default", previousLabel = "« Précédent", nextLabel = "Suivant »", elementsLabel = "éléments", ofLabel = "sur", }) => {
|
|
8
8
|
const hasNext = currentPage < numberPages;
|
|
9
9
|
const hasPrevious = currentPage > 1;
|
|
10
10
|
const componentClassName = getComponentClassName(className, classModifier, "af-pager");
|
|
11
11
|
if (mode === "light") {
|
|
12
|
-
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, children: _jsx("i", { className: "glyphicon glyphicon-chevron-left", "aria-hidden": "true" }) }), _jsxs(LiPoint, { isVisible: true, children: [currentPage, " ", ofLabel, " ", numberPages] }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, children: _jsx("i", { className: "glyphicon glyphicon-chevron-right", "aria-hidden": "true" }) })] }) }));
|
|
12
|
+
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, ariaLabel: `Page précédente des ${elementsLabel}`, children: _jsx("i", { className: "glyphicon glyphicon-chevron-left", "aria-hidden": "true" }) }), _jsxs(LiPoint, { isVisible: true, children: [currentPage, " ", ofLabel, " ", numberPages] }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, ariaLabel: `Page suivante des ${elementsLabel}`, children: _jsx("i", { className: "glyphicon glyphicon-chevron-right", "aria-hidden": "true" }) })] }) }));
|
|
13
13
|
}
|
|
14
|
-
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, children: previousLabel }), _jsx(Li, { onChange: onChange, value: 1, isVisible: numberPages > 1 && currentPage > 1 }), _jsx(LiPoint, { isVisible: currentPage > 3, children: "..." }), _jsx(Li, { onChange: onChange, value: currentPage - 1, isVisible: numberPages > 2 && currentPage > 2 }), _jsx(Li, { onChange: onChange, value: currentPage, active: true, isVisible: numberPages > 0 }), _jsx(Li, { onChange: onChange, value: currentPage + 1, isVisible: currentPage < numberPages - 1 }), _jsx(LiPoint, { isVisible: currentPage < numberPages - 2, children: "..." }), _jsx(Li, { onChange: onChange, value: numberPages, isVisible: currentPage < numberPages }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, children: nextLabel })] }) }));
|
|
14
|
+
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, ariaLabel: `Page précédente des ${elementsLabel}`, children: previousLabel }), _jsx(Li, { onChange: onChange, value: 1, isVisible: numberPages > 1 && currentPage > 1, pageLinkLabel: elementsLabel }), _jsx(LiPoint, { isVisible: currentPage > 3, children: "..." }), _jsx(Li, { onChange: onChange, value: currentPage - 1, isVisible: numberPages > 2 && currentPage > 2, pageLinkLabel: elementsLabel }), _jsx(Li, { onChange: onChange, value: currentPage, active: true, isVisible: numberPages > 0, pageLinkLabel: elementsLabel }), _jsx(Li, { onChange: onChange, value: currentPage + 1, isVisible: currentPage < numberPages - 1, pageLinkLabel: elementsLabel }), _jsx(LiPoint, { isVisible: currentPage < numberPages - 2, children: "..." }), _jsx(Li, { onChange: onChange, value: numberPages, isVisible: currentPage < numberPages, pageLinkLabel: elementsLabel }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, ariaLabel: `Page suivante des ${elementsLabel}`, children: nextLabel })] }) }));
|
|
15
15
|
};
|
|
16
16
|
export { Pager };
|
|
@@ -7,6 +7,7 @@ type PaginationButtonProps = {
|
|
|
7
7
|
onChange: (e: {
|
|
8
8
|
value: number;
|
|
9
9
|
}) => void;
|
|
10
|
+
ariaLabel: string;
|
|
10
11
|
};
|
|
11
|
-
declare const PaginationButton: ({ isVisible, active, children, value, onChange, }: PaginationButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
declare const PaginationButton: ({ isVisible, active, children, value, onChange, ariaLabel, }: PaginationButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
13
|
export { PaginationButton };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
const PaginationButton = ({ isVisible, active, children, value, onChange, }) => {
|
|
2
|
+
const PaginationButton = ({ isVisible, active, children, value, onChange, ariaLabel, }) => {
|
|
3
3
|
if (!isVisible) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|
|
6
6
|
if (active) {
|
|
7
|
-
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { className: "af-pager__item-link", href: "/#", role: "button", onClick: (e) => {
|
|
7
|
+
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { className: "af-pager__item-link", href: "/#", role: "button", "aria-label": ariaLabel, onClick: (e) => {
|
|
8
8
|
e.preventDefault();
|
|
9
9
|
onChange({ value });
|
|
10
10
|
}, children: children }) }));
|
|
@@ -9,6 +9,7 @@ type OnChangePager = (e: {
|
|
|
9
9
|
}) => void;
|
|
10
10
|
export type Props = Omit<PagingComponentProps, "onChange"> & {
|
|
11
11
|
onChange?: OnChangePager;
|
|
12
|
+
selectPageSizeLabel?: string;
|
|
12
13
|
};
|
|
13
|
-
declare const Paging: ({ className, classModifier, currentPage, displayLabel,
|
|
14
|
+
declare const Paging: ({ className, classModifier, currentPage, displayLabel, elementsLabel, selectPageSizeLabel, id, mode, nextLabel, numberItems, numberPages, ofLabel, previousLabel, items, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export { Paging };
|
|
@@ -4,7 +4,7 @@ import { useCallback } from "react";
|
|
|
4
4
|
import { getComponentClassName } from "../..";
|
|
5
5
|
import { Items } from "./Items";
|
|
6
6
|
import { Pager } from "./Pager";
|
|
7
|
-
const Paging = ({ className, classModifier, currentPage = 1, displayLabel,
|
|
7
|
+
const Paging = ({ className, classModifier, currentPage = 1, displayLabel, elementsLabel, selectPageSizeLabel, id, mode, nextLabel, numberItems = 10, numberPages, ofLabel, previousLabel, items, onChange, }) => {
|
|
8
8
|
const componentClassName = getComponentClassName(className, classModifier, "af-paging");
|
|
9
9
|
const handleChangeItems = useCallback((e) => onChange &&
|
|
10
10
|
onChange({
|
|
@@ -16,6 +16,6 @@ const Paging = ({ className, classModifier, currentPage = 1, displayLabel, selec
|
|
|
16
16
|
numberItems,
|
|
17
17
|
page: e.value,
|
|
18
18
|
}), [numberItems, onChange]);
|
|
19
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { className: "af-paging__limit", children: _jsx(Items, { onChange: handleChangeItems, numberItems: numberItems, id: id, displayLabel: displayLabel, selectAriaLabel:
|
|
19
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { className: "af-paging__limit", children: _jsx(Items, { onChange: handleChangeItems, numberItems: numberItems, id: id, displayLabel: displayLabel, selectAriaLabel: selectPageSizeLabel, elementsLabel: elementsLabel, items: items }) }), _jsx("div", { className: "af-paging__pager", children: _jsx(Pager, { onChange: handleChangePager, currentPage: currentPage, numberPages: numberPages, previousLabel: previousLabel, nextLabel: nextLabel, elementsLabel: elementsLabel, ofLabel: ofLabel, mode: mode }) })] }));
|
|
20
20
|
};
|
|
21
21
|
export { Paging };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, PropsWithChildren } from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Tag/Tag.scss";
|
|
3
|
+
type TagModifier = "success" | "information" | "warning" | "error" | "default" | "dark" | "purple" | "gray";
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated instead use warning
|
|
6
|
+
*/
|
|
7
|
+
type TagModifierDecrepated = "danger" | "info";
|
|
8
|
+
type TagProps = ComponentPropsWithRef<"span"> & {
|
|
9
|
+
classModifier?: `${TagModifier | TagModifierDecrepated}` | string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Tag component to display a label with various styles.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage
|
|
18
|
+
* <Tag classModifier="success">Success Tag</Tag>
|
|
19
|
+
*
|
|
20
|
+
* @param {object} props - The properties object.
|
|
21
|
+
* @param {React.ReactNode} props.children - The content to be displayed inside the tag.
|
|
22
|
+
* @param {string} [props.className] - Additional class names to apply to the tag.
|
|
23
|
+
* @param {string} [props.classModifier] - Modifier class to apply specific styles. Note: "danger" is deprecated, use "warning" instead. "info" is deprecated, use "information" instead
|
|
24
|
+
* @param {boolean} [props.disabled] - If true, the tag will be disabled.
|
|
25
|
+
* @param {React.Ref<HTMLSpanElement>} ref - The ref to the span element.
|
|
26
|
+
* @returns {JSX.Element} The rendered Tag component.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Tag: import("react").ForwardRefExoticComponent<Omit<PropsWithChildren<TagProps>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
29
|
+
export {};
|
package/dist/Tag/Tag.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { getComponentClassName } from "../utilities";
|
|
4
|
+
import "@axa-fr/design-system-slash-css/dist/Tag/Tag.scss";
|
|
5
|
+
/**
|
|
6
|
+
* Tag component to display a label with various styles.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
9
|
+
* @example
|
|
10
|
+
* // Basic usage
|
|
11
|
+
* <Tag classModifier="success">Success Tag</Tag>
|
|
12
|
+
*
|
|
13
|
+
* @param {object} props - The properties object.
|
|
14
|
+
* @param {React.ReactNode} props.children - The content to be displayed inside the tag.
|
|
15
|
+
* @param {string} [props.className] - Additional class names to apply to the tag.
|
|
16
|
+
* @param {string} [props.classModifier] - Modifier class to apply specific styles. Note: "danger" is deprecated, use "warning" instead. "info" is deprecated, use "information" instead
|
|
17
|
+
* @param {boolean} [props.disabled] - If true, the tag will be disabled.
|
|
18
|
+
* @param {React.Ref<HTMLSpanElement>} ref - The ref to the span element.
|
|
19
|
+
* @returns {JSX.Element} The rendered Tag component.
|
|
20
|
+
*/
|
|
21
|
+
export const Tag = forwardRef(({ children, className, classModifier = "default", ...otherProps }, ref) => {
|
|
22
|
+
const componentClassName = getComponentClassName(className, classModifier, "af-tag");
|
|
23
|
+
// Kept for backward compatibility. May be removed in a future version
|
|
24
|
+
const badgeClassName = getComponentClassName(className, classModifier, "af-badge");
|
|
25
|
+
return (_jsx("span", { ref: ref, className: `${componentClassName} ${badgeClassName}`, ...otherProps, children: children }));
|
|
26
|
+
});
|
|
27
|
+
Tag.displayName = "Tag";
|
package/dist/Title/Title.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Title/Title.scss";
|
|
2
|
-
import { ComponentPropsWithRef, PropsWithChildren, ReactElement } from "react";
|
|
2
|
+
import { ComponentPropsWithRef, PropsWithChildren, ReactElement, ReactNode } from "react";
|
|
3
3
|
type Headings = "h2" | "h3" | "h4";
|
|
4
4
|
type TitleProps = ComponentPropsWithRef<"h2"> & {
|
|
5
5
|
classModifier?: string;
|
|
6
6
|
heading?: Headings;
|
|
7
7
|
contentLeft?: ReactElement;
|
|
8
|
-
contentRight?:
|
|
8
|
+
contentRight?: ReactNode;
|
|
9
9
|
};
|
|
10
10
|
export declare const Title: import("react").ForwardRefExoticComponent<Omit<PropsWithChildren<TitleProps>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
11
11
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,20 @@ 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 "@fontsource/source-sans-pro/700.css";
|
|
6
|
+
import { Message } from "./Messages/Message";
|
|
7
|
+
import { Tag } from "./Tag/Tag";
|
|
5
8
|
export { Action } from "./Action/Action";
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
/** @deprecated Use `Tag` instead. */
|
|
10
|
+
declare const Badge: import("react").ForwardRefExoticComponent<Omit<import("react").PropsWithChildren<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
11
|
+
classModifier?: `${("error" | "warning" | "success" | "information" | "default" | "dark" | "purple" | "gray") | ("info" | "danger")}` | string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
export { Badge, Tag };
|
|
8
15
|
export { Button } from "./Button/Button";
|
|
16
|
+
export type { ButtonVariant } from "./Button/Button";
|
|
17
|
+
export { Card } from "./Card/Card";
|
|
18
|
+
export { Divider } from "./Divider/Divider";
|
|
9
19
|
export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
|
|
10
20
|
export { Choice, ChoiceInput } from "./Form/Choice";
|
|
11
21
|
export { LegacyField as Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
|
|
@@ -22,17 +32,25 @@ export { Text, TextInput } from "./Form/Text";
|
|
|
22
32
|
export { Textarea, TextareaInput } from "./Form/Textarea";
|
|
23
33
|
export { Footer } from "./Layout/Footer";
|
|
24
34
|
export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
|
|
35
|
+
export { MainContainer } from "./Layout/MainContainer/MainContainer";
|
|
25
36
|
export { Link, type LinkProps } from "./Link/Link";
|
|
26
37
|
export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
|
|
27
38
|
export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
|
|
28
|
-
export { Step, StepBase, Steps } from "./Steps";
|
|
39
|
+
export { Step, StepBase, Steps, VerticalStep } from "./Steps";
|
|
29
40
|
export { Summary } from "./Summary";
|
|
30
41
|
export { Svg } from "./Svg";
|
|
31
42
|
export { Tabs } from "./Tabs/Tabs";
|
|
32
43
|
export { Title } from "./Title/Title";
|
|
33
44
|
export { getComponentClassName } from "./utilities";
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
|
|
47
|
+
* @see {@link Message}
|
|
48
|
+
*/
|
|
49
|
+
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
50
|
export * from "./Accordion";
|
|
51
|
+
export { type MessageProps, type MessageVariants } from "./Messages/Message";
|
|
35
52
|
export * from "./Popover";
|
|
36
53
|
export * from "./Table";
|
|
54
|
+
export { Alert, Message };
|
|
37
55
|
export { HelpButton } from "./HelpButton";
|
|
38
56
|
export { Loader } from "./Loader/Loader";
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,16 @@ 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 "@fontsource/source-sans-pro/700.css";
|
|
6
|
+
import { Message } from "./Messages/Message";
|
|
7
|
+
import { Tag } from "./Tag/Tag";
|
|
5
8
|
export { Action } from "./Action/Action";
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
/** @deprecated Use `Tag` instead. */
|
|
10
|
+
const Badge = Tag;
|
|
11
|
+
export { Badge, Tag };
|
|
8
12
|
export { Button } from "./Button/Button";
|
|
13
|
+
export { Card } from "./Card/Card";
|
|
14
|
+
export { Divider } from "./Divider/Divider";
|
|
9
15
|
export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
|
|
10
16
|
export { Choice, ChoiceInput } from "./Form/Choice";
|
|
11
17
|
export { LegacyField as Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
|
|
@@ -22,17 +28,24 @@ export { Text, TextInput } from "./Form/Text";
|
|
|
22
28
|
export { Textarea, TextareaInput } from "./Form/Textarea";
|
|
23
29
|
export { Footer } from "./Layout/Footer";
|
|
24
30
|
export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
|
|
31
|
+
export { MainContainer } from "./Layout/MainContainer/MainContainer";
|
|
25
32
|
export { Link } from "./Link/Link";
|
|
26
33
|
export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
|
|
27
34
|
export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
|
|
28
|
-
export { Step, StepBase, Steps } from "./Steps";
|
|
35
|
+
export { Step, StepBase, Steps, VerticalStep } from "./Steps";
|
|
29
36
|
export { Summary } from "./Summary";
|
|
30
37
|
export { Svg } from "./Svg";
|
|
31
38
|
export { Tabs } from "./Tabs/Tabs";
|
|
32
39
|
export { Title } from "./Title/Title";
|
|
33
40
|
export { getComponentClassName } from "./utilities";
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
|
|
43
|
+
* @see {@link Message}
|
|
44
|
+
*/
|
|
45
|
+
const Alert = Message;
|
|
34
46
|
export * from "./Accordion";
|
|
35
47
|
export * from "./Popover";
|
|
36
48
|
export * from "./Table";
|
|
49
|
+
export { Alert, Message };
|
|
37
50
|
export { HelpButton } from "./HelpButton";
|
|
38
51
|
export { Loader } from "./Loader/Loader";
|
|
@@ -1 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a component class name string based on provided class names and modifiers.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} [className] - The base class name.
|
|
5
|
+
* @param {string} [classModifier] - A space-separated string of class modifiers.
|
|
6
|
+
* @param {string} [defaultClassName] - The default class name to use if className is not provided.
|
|
7
|
+
* @returns {string} The generated class name string.
|
|
8
|
+
*/
|
|
1
9
|
export declare const getComponentClassName: (className?: string, classModifier?: string, defaultClassName?: string) => string;
|
|
10
|
+
type getComponentClassNameWithUserClassnameParams = {
|
|
11
|
+
userClassName?: string;
|
|
12
|
+
classModifier?: string;
|
|
13
|
+
componentClassName: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const getComponentClassNameWithUserClassname: ({ componentClassName, userClassName, classModifier, }: getComponentClassNameWithUserClassnameParams) => string;
|
|
16
|
+
export {};
|
|
@@ -11,6 +11,14 @@ const listClassModifier = (classModifier) => {
|
|
|
11
11
|
}
|
|
12
12
|
return classModifier.split(" ");
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Generates a component class name string based on provided class names and modifiers.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} [className] - The base class name.
|
|
18
|
+
* @param {string} [classModifier] - A space-separated string of class modifiers.
|
|
19
|
+
* @param {string} [defaultClassName] - The default class name to use if className is not provided.
|
|
20
|
+
* @returns {string} The generated class name string.
|
|
21
|
+
*/
|
|
14
22
|
export const getComponentClassName = (className, classModifier, defaultClassName) => {
|
|
15
23
|
const classNameToUse = className || defaultClassName;
|
|
16
24
|
// Fail fast, when no className or defaultClassName we don't want to loop on modifier
|
|
@@ -26,3 +34,17 @@ export const getComponentClassName = (className, classModifier, defaultClassName
|
|
|
26
34
|
});
|
|
27
35
|
return classNames(classNameToUse, modifiersObject);
|
|
28
36
|
};
|
|
37
|
+
export const getComponentClassNameWithUserClassname = ({ componentClassName, userClassName, classModifier, }) => {
|
|
38
|
+
// Fail fast, when no className or componentClassName we don't want to loop on modifier
|
|
39
|
+
if (!componentClassName) {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
const classWithoutModifier = getLastClassName(componentClassName);
|
|
43
|
+
const modifiers = listClassModifier(classModifier);
|
|
44
|
+
const modifiersObject = modifiers
|
|
45
|
+
.filter((it) => /\S/.test(it))
|
|
46
|
+
.map((it) => {
|
|
47
|
+
return `${classWithoutModifier}--${it}`;
|
|
48
|
+
});
|
|
49
|
+
return classNames(componentClassName, modifiersObject, userClassName);
|
|
50
|
+
};
|