@axa-fr/design-system-slash-react 1.2.1-alpha.13 → 1.2.1-alpha.131
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/CardData/CardData.d.ts +15 -0
- package/dist/CardData/CardData.js +6 -0
- package/dist/CardData/CardDataHeader.d.ts +14 -0
- package/dist/CardData/CardDataHeader.js +9 -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.d.ts +1 -1
- package/dist/Layout/Header/Infos/Infos.js +4 -2
- 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/Header/User/User.d.ts +45 -3
- package/dist/Layout/Header/User/User.js +2 -2
- 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 +23 -3
- package/dist/index.js +17 -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/Button/Button.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Button/Button.css";
|
|
3
|
+
export type ButtonVariant = "primary" | "secondary" | "validated" | "danger" | "ghost" | "ghost-reverse";
|
|
4
|
+
export declare const Button: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
small?: boolean;
|
|
7
|
+
leftIcon?: ReactNode;
|
|
8
|
+
rightIcon?: ReactNode;
|
|
9
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
10
|
+
children?: ReactNode | undefined;
|
|
11
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
package/dist/Button/Button.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, } from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import "@axa-fr/design-system-slash-css/dist/Button/Button.css";
|
|
5
|
+
const DEFAULT_CLASS_NAME = "af-btn";
|
|
6
|
+
export const Button = forwardRef(({ variant = "primary", small, leftIcon, rightIcon, className, children, ...props }, ref) => (_jsxs("button", { type: "button", className: classNames(DEFAULT_CLASS_NAME, variant !== "primary" && `${DEFAULT_CLASS_NAME}--${variant}`, small && `${DEFAULT_CLASS_NAME}--small`, className), ...props, ref: ref, children: [leftIcon, children, rightIcon] })));
|
|
7
|
+
Button.displayName = "Button";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Card/Card.css";
|
|
3
|
+
type CardProps = ComponentProps<"button"> & {
|
|
4
|
+
/** By default : *vertical* */
|
|
5
|
+
orientation?: "vertical" | "horizontal";
|
|
6
|
+
/** icon url, for exemple from "@material-symbols" :
|
|
7
|
+
*
|
|
8
|
+
* import villaIcon from "@material-symbols/svg-400/outlined/villa.svg"; */
|
|
9
|
+
iconSrc?: string;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const Card: ({ children, className, iconSrc, orientation, error, ...otherProps }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { Svg } from "../Svg";
|
|
4
|
+
import "@axa-fr/design-system-slash-css/dist/Card/Card.css";
|
|
5
|
+
const DEFAULT_CLASS_NAME = "af-card";
|
|
6
|
+
export const Card = ({ children, className, iconSrc, orientation = "vertical", error = false, ...otherProps }) => (_jsxs("button", { type: "button", className: classNames(DEFAULT_CLASS_NAME, error && `${DEFAULT_CLASS_NAME}--error`, orientation === "horizontal" && `${DEFAULT_CLASS_NAME}--${orientation}`, className), ...otherProps, children: [iconSrc ? _jsx(Svg, { src: iconSrc }) : null, children] }));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/CardData/CardData.css";
|
|
3
|
+
export type CardDataVariant = "error" | "warning" | "information" | "success" | "default" | "dark" | "gray" | "purple";
|
|
4
|
+
type CardDataProps = {
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
subTitle?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
icon: string;
|
|
9
|
+
variant?: CardDataVariant;
|
|
10
|
+
contentFitAllSize?: boolean;
|
|
11
|
+
contentRight?: React.ReactNode;
|
|
12
|
+
withDivider?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const CardData: ({ title, subTitle, description, icon, variant, contentFitAllSize, contentRight, children, withDivider, }: PropsWithChildren<CardDataProps>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { CardDataHeader } from "./CardDataHeader";
|
|
4
|
+
import "@axa-fr/design-system-slash-css/dist/CardData/CardData.css";
|
|
5
|
+
const defaultClassName = "af-card-data";
|
|
6
|
+
export const CardData = ({ title, subTitle, description, icon, variant = "default", contentFitAllSize = false, contentRight, children, withDivider = true, }) => (_jsxs("div", { className: defaultClassName, children: [_jsx(CardDataHeader, { title: title, subTitle: subTitle, description: description, icon: icon, variant: variant, contentRight: contentRight, withDivider: withDivider }), _jsx("section", { className: classNames({ [`${defaultClassName}-content--max-size`]: contentFitAllSize }, { [`${defaultClassName}-content`]: !contentFitAllSize }), children: children })] }));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/CardData/CardData.css";
|
|
3
|
+
import { CardDataVariant } from "./CardData";
|
|
4
|
+
type CardDataHeaderProps = {
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
subTitle?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
icon: string;
|
|
9
|
+
variant?: CardDataVariant;
|
|
10
|
+
contentRight?: React.ReactNode;
|
|
11
|
+
withDivider?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const CardDataHeader: ({ title, subTitle, description, icon, variant, contentRight, withDivider, }: CardDataHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/CardData/CardData.css";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { Svg } from "../Svg";
|
|
5
|
+
import { Divider } from "../Divider/Divider";
|
|
6
|
+
import { Title } from "../Title/Title";
|
|
7
|
+
const defaultClassName = "af-card-data-header";
|
|
8
|
+
const iconDefaultClassName = `${defaultClassName}-icon`;
|
|
9
|
+
export const CardDataHeader = ({ title, subTitle, description, icon, variant, contentRight, withDivider, }) => (_jsxs(_Fragment, { children: [_jsxs("header", { className: defaultClassName, children: [_jsx("span", { className: classNames(iconDefaultClassName, variant !== "default" ? `${iconDefaultClassName}--${variant}` : null), children: _jsx(Svg, { src: icon }) }), _jsxs(Title, { heading: "h3", children: [title, subTitle ? (_jsx("span", { className: `${defaultClassName}-subtitle`, children: subTitle })) : null, description ? (_jsx("span", { className: `${defaultClassName}-description`, children: description })) : null] }), contentRight ? (_jsx("span", { className: `${defaultClassName}-rightcontent`, children: contentRight })) : null] }), withDivider ? _jsx(Divider, {}) : null] }));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "@axa-fr/design-system-slash-css/dist/Divider/Divider.css";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
type DividerProps = ComponentProps<"hr"> & {
|
|
4
|
+
mode?: "horizontal" | "vertical";
|
|
5
|
+
};
|
|
6
|
+
export declare const Divider: ({ mode, className, ...props }: DividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/Divider/Divider.css";
|
|
4
|
+
export const Divider = ({ mode = "horizontal", className, ...props }) => {
|
|
5
|
+
const componentClassName = classnames("af-divider", {
|
|
6
|
+
"af-divider--horizontal": mode === "horizontal",
|
|
7
|
+
"af-divider--vertical": mode === "vertical",
|
|
8
|
+
}, className);
|
|
9
|
+
return _jsx("hr", { className: componentClassName, ...props });
|
|
10
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { type ConsumerFieldProps } from "../core";
|
|
3
3
|
import { Checkbox } from "./Checkbox";
|
|
4
|
-
type Props = Omit<ComponentProps<typeof Checkbox> &
|
|
4
|
+
type Props = Omit<ComponentProps<typeof Checkbox> & ConsumerFieldProps, "children" | "placeholder">;
|
|
5
5
|
declare const CheckboxInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { CheckboxInput };
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Field, useOptionsWithId } from "../core";
|
|
4
4
|
import { Checkbox } from "./Checkbox";
|
|
5
5
|
import { CheckboxModes } from "./CheckboxModes";
|
|
6
|
-
|
|
7
|
-
const CheckboxInput = forwardRef(({ mode, messageType, message, classModifier, options, classNameContainerLabel, classNameContainerInput, label, isVisible, className, forceDisplayMessage, required, ...checkboxProps }, inputRef) => {
|
|
8
|
-
let rowModifier = classModifier;
|
|
9
|
-
if (mode === CheckboxModes.classic) {
|
|
10
|
-
rowModifier += " label-top";
|
|
11
|
-
}
|
|
12
|
-
if (required) {
|
|
13
|
-
rowModifier += " required";
|
|
14
|
-
}
|
|
15
|
-
const errorUseId = useId();
|
|
6
|
+
const CheckboxInput = forwardRef(({ label, mode = "default", options, ...otherProps }, inputRef) => {
|
|
16
7
|
const newOptions = useOptionsWithId(options);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
: classModifier, ref: inputRef, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...checkboxProps }) }));
|
|
8
|
+
return (_jsx(Field, { label: label, labelPosition: mode === CheckboxModes.classic ? "top" : "center", roleContainer: "group", classNameSuffix: "checkbox-container", ...otherProps, renderInput: ({ classModifier, id, ariaInvalid, errorId, ...props }) => {
|
|
9
|
+
return (_jsx(Checkbox, { id: id, mode: mode, options: newOptions, classModifier: ariaInvalid ? `${classModifier} error` : classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }));
|
|
10
|
+
} }));
|
|
21
11
|
});
|
|
22
12
|
CheckboxInput.displayName = "CheckboxInput";
|
|
23
13
|
export { CheckboxInput };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import check from "@material-symbols/svg-400/sharp/check.svg";
|
|
2
3
|
import { forwardRef, useId } from "react";
|
|
3
4
|
import { getOptionClassName } from "../core";
|
|
4
5
|
import "@axa-fr/design-system-slash-css/dist/Form/Checkbox/Checkbox.scss";
|
|
6
|
+
import { Svg } from "../../Svg";
|
|
5
7
|
const CheckboxItem = forwardRef(({ disabled = false, value = "", id, children, label, isChecked, className, classModifier, ...otherProps }, inputRef) => {
|
|
6
8
|
const newLabel = children || label;
|
|
7
9
|
const generatedId = useId();
|
|
8
10
|
const newId = id ?? generatedId; // id is required on this component
|
|
9
11
|
const optionClassName = getOptionClassName(className ?? "", classModifier ?? "", "af-form__checkbox", disabled);
|
|
10
|
-
return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-checkbox", value: value, id: newId, disabled: disabled, checked: isChecked, type: "checkbox", ref: inputRef }), _jsxs("label", { className: "af-form__label", htmlFor: newId, children: [_jsx("span", { className: "af-form__indicator", children: _jsx("
|
|
12
|
+
return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-checkbox", value: value, id: newId, disabled: disabled, checked: isChecked, type: "checkbox", ref: inputRef }), _jsxs("label", { className: "af-form__label", htmlFor: newId, children: [_jsx("span", { className: "af-form__indicator", children: _jsx(Svg, { role: "presentation", className: "ok-icon", src: check }) }), _jsx("span", { className: "af-form__description", children: newLabel })] })] }));
|
|
11
13
|
});
|
|
12
14
|
CheckboxItem.displayName = "CheckboxItem";
|
|
13
15
|
export { CheckboxItem };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import "@axa-fr/design-system-slash-css/dist/Form/Choice/Choice.scss";
|
|
2
1
|
import { type ComponentProps } from "react";
|
|
3
2
|
import { Radio } from "../Radio";
|
|
4
3
|
import { type Option } from "../core";
|
|
5
|
-
type Props = Omit<ComponentProps<typeof Radio>, "options"> & {
|
|
4
|
+
type Props = Omit<ComponentProps<typeof Radio>, "options" | "value"> & {
|
|
6
5
|
id: string;
|
|
7
6
|
name?: string;
|
|
8
7
|
options?: Array<Omit<Option, "value"> & {
|
|
9
8
|
value: boolean;
|
|
10
9
|
}>;
|
|
10
|
+
value?: boolean | string;
|
|
11
|
+
classModifier?: string;
|
|
11
12
|
};
|
|
12
13
|
declare const Choice: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
13
14
|
export { Choice };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "@axa-fr/design-system-slash-css/dist/Form/Choice/Choice.scss";
|
|
3
2
|
import { forwardRef, useId } from "react";
|
|
4
3
|
import { Radio } from "../Radio";
|
|
5
4
|
import { useOptionsWithId } from "../core";
|
|
@@ -13,7 +12,7 @@ const Choice = forwardRef(({ children, value, options = defaultOptions, name, ..
|
|
|
13
12
|
value: `${o.value}`,
|
|
14
13
|
})));
|
|
15
14
|
const generatedId = useId();
|
|
16
|
-
return (_jsx(Radio, { ...otherProps, ref: inputRef, name: name ?? `choice_${generatedId}`, value: value?.toString(), options: choiceOptions, children: children }));
|
|
15
|
+
return (_jsx(Radio, { ...otherProps, mode: "default", ref: inputRef, name: name ?? `choice_${generatedId}`, value: value?.toString(), options: choiceOptions, children: children }));
|
|
17
16
|
});
|
|
18
17
|
Choice.displayName = "Choice";
|
|
19
18
|
export { Choice };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { type ConsumerFieldProps } from "../core";
|
|
3
3
|
import { Choice } from "./Choice";
|
|
4
|
-
type Props = ComponentProps<typeof Choice> & Omit<
|
|
4
|
+
type Props = ComponentProps<typeof Choice> & Omit<ConsumerFieldProps, "children">;
|
|
5
5
|
declare const ChoiceInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { ChoiceInput };
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Field } from "../core";
|
|
4
4
|
import { Choice } from "./Choice";
|
|
5
|
-
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
6
5
|
const defaultOptions = [
|
|
7
6
|
{ label: "Oui", value: true },
|
|
8
7
|
{ label: "Non", value: false },
|
|
9
8
|
];
|
|
10
|
-
const ChoiceInput = forwardRef(({
|
|
11
|
-
|
|
12
|
-
const newOptions = useOptionsWithId(options.map((o) => ({
|
|
13
|
-
...o,
|
|
14
|
-
value: `${o.value}`,
|
|
15
|
-
})));
|
|
16
|
-
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier ?? "", disabled ?? false, false, required);
|
|
17
|
-
const firstId = newOptions?.[0]?.id ?? "";
|
|
18
|
-
const choiceOptions = newOptions.map((o) => ({
|
|
19
|
-
...o,
|
|
20
|
-
value: o.value === "true",
|
|
21
|
-
}));
|
|
22
|
-
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
23
|
-
return (_jsx(LegacyField, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: _jsx(Choice, { ...otherProps, id: id, name: name, ref: inputRef, classModifier: inputClassModifier, options: options ? choiceOptions : undefined, required: required, disabled: disabled, "aria-describedby": errorUseId, "aria-invalid": isInvalid }) }));
|
|
9
|
+
const ChoiceInput = forwardRef(({ label, options = defaultOptions, ...otherProps }, inputRef) => {
|
|
10
|
+
return (_jsx(Field, { label: label, roleContainer: "radiogroup", ...otherProps, renderInput: ({ classModifier, id, errorId, ariaInvalid, ...props }) => (_jsx(Choice, { id: id, ref: inputRef, classModifier: classModifier, "aria-describedby": errorId, "aria-invalid": ariaInvalid, options: options, ...props })) }));
|
|
24
11
|
});
|
|
25
12
|
ChoiceInput.displayName = "ChoiceInput";
|
|
26
13
|
export { ChoiceInput };
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value?: Date | string;
|
|
6
|
-
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref">, "placeholderText"> & Omit<{
|
|
7
|
-
message?: string;
|
|
8
|
-
messageType?: import("../core").MessageTypes;
|
|
9
|
-
} & {
|
|
10
|
-
className?: string;
|
|
11
|
-
classModifier?: string;
|
|
12
|
-
forceDisplayMessage?: boolean;
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
setStateMemoryFn?: typeof import("../core/FieldForm").setStateMemory;
|
|
15
|
-
onChangeByStateFn?: typeof import("../core/FieldForm").onChangeByState;
|
|
16
|
-
setStateOnBlurFn?: typeof import("../core/FieldForm").setStateOnBlur;
|
|
17
|
-
setStateOnFocusFn?: typeof import("../core/FieldForm").setStateOnFocus;
|
|
18
|
-
initialState?: {
|
|
19
|
-
hasLostFocusOnce: boolean;
|
|
20
|
-
hasFocus: boolean;
|
|
21
|
-
hasChange: boolean;
|
|
22
|
-
memory: {
|
|
23
|
-
message?: string;
|
|
24
|
-
messageType?: import("../core").MessageTypes;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
}, "children"> & {
|
|
28
|
-
label: ReactNode;
|
|
29
|
-
children?: ReactNode;
|
|
30
|
-
id?: string;
|
|
31
|
-
classModifier?: string;
|
|
32
|
-
classNameContainerLabel?: string;
|
|
33
|
-
classNameContainerInput?: string;
|
|
34
|
-
isVisible?: boolean;
|
|
35
|
-
roleContainer?: string;
|
|
36
|
-
ariaLabelContainer?: string;
|
|
37
|
-
isLabelContainerLinkedToInput?: boolean;
|
|
38
|
-
errorId?: string;
|
|
39
|
-
} & {
|
|
40
|
-
placeholder?: string;
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { ConsumerFieldProps } from "../core";
|
|
3
|
+
import { Date } from "./Date";
|
|
4
|
+
type Props = Omit<ConsumerFieldProps & ComponentProps<typeof Date> & {
|
|
41
5
|
helpMessage?: ReactNode;
|
|
42
|
-
|
|
43
|
-
|
|
6
|
+
}, "renderInput" | "children">;
|
|
7
|
+
declare const DateInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
44
8
|
export { DateInput };
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Field } from "../core";
|
|
4
4
|
import { Date } from "./Date";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const inputUseId = useId();
|
|
8
|
-
const errorUseId = useId();
|
|
9
|
-
const inputId = id ?? inputUseId;
|
|
10
|
-
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
11
|
-
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
12
|
-
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__date", classModifier: inputFieldClassModifier, children: [_jsx(Date, { id: inputId, classModifier: inputClassModifier, disabled: disabled, required: required, ref: ref, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...otherProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
5
|
+
const DateInput = forwardRef(({ rightElement, ...otherProps }, inputRef) => {
|
|
6
|
+
return (_jsx(Field, { ...otherProps, renderInput: ({ id, classModifier, ariaInvalid, errorId }) => (_jsxs(_Fragment, { children: [_jsx(Date, { id: id, classModifier: classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...otherProps }), rightElement] })) }));
|
|
13
7
|
});
|
|
14
8
|
DateInput.displayName = "DateInput";
|
|
15
9
|
export { DateInput };
|
package/dist/Form/File/File.js
CHANGED
|
@@ -55,6 +55,6 @@ const File = ({ className, classModifier, id, name, disabled, onChange, multiple
|
|
|
55
55
|
disabled,
|
|
56
56
|
});
|
|
57
57
|
const componentClassName = getComponentClassName(className, classModifier, "af-form__file-input");
|
|
58
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsxs("div", { ...getRootProps({ className: "drop-box" }), children: [_jsx("input", { ...getInputProps({ id, name, readOnly, ...otherProps }) }), _jsx("div", { children: placeholder })] }),
|
|
58
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsxs("div", { ...getRootProps({ className: "drop-box" }), children: [_jsx("input", { ...getInputProps({ id, name, readOnly, ...otherProps }) }), _jsx("div", { children: placeholder })] }), _jsx(Button, { className: "af-btn--file", leftIcon: _jsx("i", { className: `glyphicon glyphicon-${icon}` }), onClick: open, disabled: disabled, children: label })] }));
|
|
59
59
|
};
|
|
60
60
|
export { File };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
const FileErrors = ({ errors }) => (_jsxs("div", { className: "af-form__file-errors", children: [_jsx("span", { children: "Le chargement de certains fichiers a \u00E9chou\u00E9 : " }), _jsx("ul", { className: "af-form__file-errors-list", children: errors
|
|
3
|
-
errors.map((err) => (_jsxs("li", { children: [err.file.name, " (", err.file.size, ")"] }, err.file.name)))
|
|
2
|
+
const FileErrors = ({ errors }) => (_jsxs("div", { className: "af-form__file-errors", children: [_jsx("span", { children: "Le chargement de certains fichiers a \u00E9chou\u00E9 : " }), _jsx("ul", { className: "af-form__file-errors-list", children: errors
|
|
3
|
+
? errors.map((err) => (_jsxs("li", { children: [err.file.name, " (", err.file.size, ")"] }, err.file.name)))
|
|
4
|
+
: null })] }));
|
|
4
5
|
export { FileErrors };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Form/File/File.scss";
|
|
2
2
|
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { type ConsumerFieldProps } from "../core";
|
|
4
4
|
import { File } from "./File";
|
|
5
5
|
import { FileTable } from "./FileTable";
|
|
6
|
-
type FieldProps = ComponentPropsWithoutRef<typeof LegacyField>;
|
|
7
6
|
type FileProps = ComponentPropsWithoutRef<typeof File>;
|
|
8
7
|
type FileTableProps = ComponentPropsWithoutRef<typeof FileTable>;
|
|
9
|
-
type Props =
|
|
8
|
+
type Props = Omit<ConsumerFieldProps & FileProps & Pick<FileTableProps, "values" | "errors"> & {
|
|
10
9
|
fileLabel?: string;
|
|
11
10
|
helpMessage?: ReactNode;
|
|
12
|
-
}
|
|
13
|
-
declare const FileInput: ({ values,
|
|
11
|
+
}, "children">;
|
|
12
|
+
declare const FileInput: ({ values, id, name, onChange, rightElement, label, errors, fileLabel, classModifier, ...otherFileProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export { FileInput };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Form/File/File.scss";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Field } from "../core";
|
|
5
5
|
import { File } from "./File";
|
|
6
6
|
import { FileTable } from "./FileTable";
|
|
7
|
-
|
|
8
|
-
const FileInput = ({ values = [], name = "", onChange, classModifier = "", message, children, helpMessage, id = "", forceDisplayMessage, messageType, classNameContainerLabel, classNameContainerInput, label, isVisible, className, errors, fileLabel, disabled = false, required, ...otherFileProps }) => {
|
|
7
|
+
const FileInput = ({ values = [], id, name = "", onChange, rightElement, label, errors, fileLabel, classModifier, ...otherFileProps }) => {
|
|
9
8
|
const onDeleteClick = (selectedId, selectInputId) => {
|
|
10
9
|
const newValues = values.filter((element) => element.id !== selectedId);
|
|
11
10
|
onChange({
|
|
@@ -15,12 +14,8 @@ const FileInput = ({ values = [], name = "", onChange, classModifier = "", messa
|
|
|
15
14
|
fileAction: "delete",
|
|
16
15
|
});
|
|
17
16
|
};
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
22
|
-
const rowModifier = `${inputFieldClassModifier} label-top`;
|
|
23
|
-
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
24
|
-
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__file", classModifier: inputFieldClassModifier, children: [_jsx(File, { id: inputId, name: name, onChange: onChange, disabled: disabled, classModifier: inputClassModifier, label: fileLabel, required: required || classModifier?.includes("required"), "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...otherFileProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message }), _jsx(FileTable, { errors: errors, values: values, onClick: (selectedId) => onDeleteClick(selectedId, inputId), classModifier: classModifier })] }));
|
|
17
|
+
const generatedId = useId();
|
|
18
|
+
const actualId = id ?? generatedId;
|
|
19
|
+
return (_jsx(Field, { label: label, labelPosition: "top", id: actualId, classNameSuffix: "file", ...otherFileProps, renderInput: ({ classModifier: inputClassModifiers, id: inputId, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(File, { id: inputId, name: name, onChange: onChange, classModifier: inputClassModifiers, label: fileLabel, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), rightElement] })), appendChildren: _jsx(FileTable, { errors: errors, values: values, onClick: (selectedId) => onDeleteClick(selectedId, actualId), classModifier: classModifier }) }));
|
|
25
20
|
};
|
|
26
21
|
export { FileInput };
|
|
@@ -4,6 +4,6 @@ import { FileErrors } from "./FileErrors";
|
|
|
4
4
|
import { getComponentClassName } from "../../utilities";
|
|
5
5
|
const FileTable = ({ errors, values, className, classModifier, disabled, onClick, }) => {
|
|
6
6
|
const componentClassName = getComponentClassName(className, classModifier, "custom-table-file af-file-table");
|
|
7
|
-
return (_jsxs("div", { className: componentClassName, children: [errors && errors.length > 0
|
|
7
|
+
return (_jsxs("div", { className: componentClassName, children: [errors && errors.length > 0 ? _jsx(FileErrors, { errors: errors }) : null, values && values.length > 0 ? (_jsx("ul", { className: "af-form__file-list", children: values.map(({ file, id }) => (_jsx(FileLine, { disabled: disabled, file: file, onClick: onClick, id: id }, id))) })) : null] }));
|
|
8
8
|
};
|
|
9
9
|
export { FileTable };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type FormatOptionLabelMeta } from "react-select";
|
|
2
|
+
import { Option } from "./MultiSelect";
|
|
3
|
+
declare const formatOptionLabel: (data: Option, formatOptionLabelMeta: FormatOptionLabelMeta<Option>) => string | import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { formatOptionLabel };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import checkIcon from "@material-symbols/svg-700/outlined/check.svg";
|
|
4
|
+
import { Svg } from "../..";
|
|
5
|
+
const formatOptionLabel = (data, formatOptionLabelMeta) => {
|
|
6
|
+
if (formatOptionLabelMeta.context === "value") {
|
|
7
|
+
return data.label;
|
|
8
|
+
}
|
|
9
|
+
const isChecked = formatOptionLabelMeta.selectValue.some((selectValue) => data.value === selectValue.value);
|
|
10
|
+
return (_jsxs("div", { className: "react-select__multi-option-label", children: [_jsx("div", { className: "checkbox-indicator", children: _jsx("span", { className: classNames("indicator", { "checkbox-checked": isChecked }), children: isChecked ? _jsx(Svg, { src: checkIcon }) : null }) }), data.label] }));
|
|
11
|
+
};
|
|
12
|
+
export { formatOptionLabel };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { GroupBase } from "react-select";
|
|
1
|
+
import { type GroupBase } from "react-select";
|
|
2
2
|
import { AsyncProps } from "react-select/async";
|
|
3
|
+
import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
|
|
3
4
|
type Option = {
|
|
4
5
|
value: string;
|
|
5
6
|
label: string;
|
|
@@ -9,6 +10,8 @@ type Props = Omit<AsyncProps<Option, true, GroupBase<Option>>, "value" | "isDisa
|
|
|
9
10
|
values?: string[] | null;
|
|
10
11
|
value?: string;
|
|
11
12
|
disabled?: boolean;
|
|
13
|
+
selectedLimit?: number;
|
|
14
|
+
selectedLimitLabel?: string;
|
|
12
15
|
};
|
|
13
16
|
type onChangeProps = {
|
|
14
17
|
id: string;
|
|
@@ -16,5 +19,5 @@ type onChangeProps = {
|
|
|
16
19
|
values?: string[];
|
|
17
20
|
value?: string;
|
|
18
21
|
};
|
|
19
|
-
declare const MultiSelect: ({ id, name, loadOptions, values, options, value, onChange, onBlur, placeholder, className, disabled, loadingMessage, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export { MultiSelect };
|
|
22
|
+
declare const MultiSelect: ({ id, name, loadOptions, values, options, value, onChange, onBlur, placeholder, className, disabled, loadingMessage, isMulti, selectedLimit, selectedLimitLabel, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export { MultiSelect, type Option };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
3
|
+
import Select from "react-select";
|
|
4
|
+
import AsyncSelect from "react-select/async";
|
|
5
|
+
import { ValueContainer } from "./ValueContainer";
|
|
6
|
+
import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
|
|
7
|
+
import { formatOptionLabel } from "./FormatOptionLabel";
|
|
8
|
+
import { useMultiSelectStyle } from "./useMultiSelectStyle";
|
|
9
|
+
import { noOptionsMessage } from "./NoOptionsMessage";
|
|
10
|
+
const MultiSelect = ({ id, name, loadOptions, values, options, value, onChange, onBlur, placeholder = "- Sélectionner -", className = "react-select", disabled, loadingMessage = () => "Chargement...", isMulti, selectedLimit, selectedLimitLabel, ...otherProps }) => {
|
|
11
|
+
const { styles } = useMultiSelectStyle();
|
|
6
12
|
const generatedId = useId();
|
|
7
13
|
const inputId = id || generatedId;
|
|
8
14
|
const handleOnChange = (newValue) => {
|
|
@@ -37,11 +43,25 @@ const MultiSelect = ({ id, name, loadOptions, values, options, value, onChange,
|
|
|
37
43
|
options,
|
|
38
44
|
valueKey: "value",
|
|
39
45
|
labelKey: "label",
|
|
46
|
+
styles,
|
|
47
|
+
isMulti,
|
|
48
|
+
noOptionsMessage,
|
|
49
|
+
isClearable: true,
|
|
50
|
+
hideSelectedOptions: false,
|
|
51
|
+
components: { ValueContainer },
|
|
52
|
+
closeMenuOnSelect: !values,
|
|
40
53
|
...otherProps,
|
|
41
54
|
};
|
|
42
55
|
if (values) {
|
|
43
56
|
const newValues = options.filter((opt) => values.includes(opt.value));
|
|
44
|
-
|
|
57
|
+
const commonValuesProps = {
|
|
58
|
+
...commonProps,
|
|
59
|
+
value: newValues,
|
|
60
|
+
formatOptionLabel,
|
|
61
|
+
selectedLimit,
|
|
62
|
+
selectedLimitLabel,
|
|
63
|
+
};
|
|
64
|
+
return loadOptions ? (_jsx(AsyncSelect, { ...commonValuesProps, loadOptions: loadOptions, loadingMessage: loadingMessage, isMulti: true })) : (_jsx(Select, { ...commonValuesProps, isMulti: true }));
|
|
45
65
|
}
|
|
46
66
|
const newValue = options.find((o) => o.value === value);
|
|
47
67
|
const commonValueProps = {
|
|
@@ -49,6 +69,6 @@ const MultiSelect = ({ id, name, loadOptions, values, options, value, onChange,
|
|
|
49
69
|
multi: false,
|
|
50
70
|
value: newValue,
|
|
51
71
|
};
|
|
52
|
-
return loadOptions ? (_jsx(
|
|
72
|
+
return loadOptions ? (_jsx(AsyncSelect, { ...commonValueProps, loadOptions: loadOptions, loadingMessage: loadingMessage })) : (_jsx(Select, { ...commonValueProps }));
|
|
53
73
|
};
|
|
54
74
|
export { MultiSelect };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
|
|
2
|
-
import { type ComponentProps
|
|
3
|
-
import {
|
|
2
|
+
import { type ComponentProps } from "react";
|
|
3
|
+
import { ConsumerFieldProps } from "../core";
|
|
4
4
|
import { MultiSelect } from "./MultiSelect";
|
|
5
|
-
type Props =
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
declare const MultiSelectInput: ({ classModifier, message, children, helpMessage, id, disabled, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, required, ...multiSelectProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
type Props = ConsumerFieldProps & ComponentProps<typeof MultiSelect>;
|
|
6
|
+
declare const MultiSelectInput: ({ label, ...multiSelectProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
7
|
export { MultiSelectInput };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
|
|
3
|
-
import {
|
|
4
|
-
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
3
|
+
import { Field } from "../core";
|
|
5
4
|
import { MultiSelect } from "./MultiSelect";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const errorUseId = useId();
|
|
11
|
-
const inputId = id || generatedId;
|
|
12
|
-
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
13
|
-
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__select", classModifier: inputFieldClassModifier, children: [_jsx(MultiSelect, { inputId: inputId, disabled: disabled, required: required, "aria-invalid": isInvalid, "aria-errormessage": errorUseId, ...multiSelectProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
5
|
+
const MultiSelectInput = ({ label, ...multiSelectProps }) => {
|
|
6
|
+
return (_jsx(Field, { label: label, ...multiSelectProps, classNameSuffix: "select", renderInput: ({ id, ariaInvalid, errorId, ...props }) => {
|
|
7
|
+
return (_jsx(MultiSelect, { id: id, "aria-invalid": ariaInvalid, "aria-describedby": errorId, ...props }));
|
|
8
|
+
} }));
|
|
14
9
|
};
|
|
15
10
|
export { MultiSelectInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const noOptionsMessage = ({ inputValue }) => `Pas de résultats pour "${inputValue}"`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GroupBase, type ValueContainerProps } from "react-select";
|
|
2
|
+
import { Option } from "./MultiSelect";
|
|
3
|
+
declare const ValueContainer: ({ children, ...props }: ValueContainerProps<Option, boolean, GroupBase<Option>>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { ValueContainer };
|