@axa-fr/design-system-slash-react 1.1.1-alpha.2 → 1.1.1-alpha.204
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/Accordion/CollapseCard.d.ts +3 -3
- package/dist/Action/Action.js +1 -1
- package/dist/Alert/Alert.d.ts +2 -1
- package/dist/Alert/Alert.js +2 -2
- package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
- package/dist/Form/Checkbox/CheckboxInput.js +8 -3
- package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
- package/dist/Form/Choice/ChoiceInput.js +6 -3
- package/dist/Form/Date/DateInput.d.ts +40 -6
- package/dist/Form/Date/DateInput.js +9 -5
- package/dist/Form/File/File.d.ts +2 -0
- package/dist/Form/File/File.js +1 -0
- package/dist/Form/File/FileInput.d.ts +2 -2
- package/dist/Form/File/FileInput.js +6 -2
- package/dist/Form/File/constants.d.ts +1 -0
- package/dist/Form/File/constants.js +1 -0
- package/dist/Form/File/index.d.ts +4 -3
- package/dist/Form/File/index.js +3 -3
- package/dist/Form/MultiSelect/MultiSelectInput.d.ts +2 -2
- package/dist/Form/MultiSelect/MultiSelectInput.js +5 -2
- package/dist/Form/NestedQuestion/NestedQuestion.d.ts +5 -0
- package/dist/Form/NestedQuestion/NestedQuestion.js +7 -0
- package/dist/Form/Number/NumberInput.d.ts +2 -2
- package/dist/Form/Number/NumberInput.js +5 -2
- package/dist/Form/Pass/PassInput.d.ts +2 -2
- package/dist/Form/Pass/PassInput.js +7 -3
- package/dist/Form/Radio/RadioInput.d.ts +3 -6
- package/dist/Form/Radio/RadioInput.js +6 -3
- package/dist/Form/Select/Select.d.ts +310 -5
- package/dist/Form/Select/Select.js +7 -4
- package/dist/Form/Select/SelectBase.d.ts +1 -1
- package/dist/Form/Select/SelectBase.js +3 -2
- package/dist/Form/Select/SelectDefault.d.ts +3 -2
- package/dist/Form/Select/SelectDefault.js +6 -8
- package/dist/Form/Select/SelectDefaultWithOptions.d.ts +9 -0
- package/dist/Form/Select/SelectDefaultWithOptions.js +18 -0
- package/dist/Form/Select/SelectInput.d.ts +386 -6
- package/dist/Form/Select/SelectInput.js +5 -2
- package/dist/Form/Slider/SliderInput.d.ts +2 -2
- package/dist/Form/Slider/SliderInput.js +8 -3
- package/dist/Form/Text/TextInput.d.ts +3 -6
- package/dist/Form/Text/TextInput.js +7 -10
- package/dist/Form/Text/index.d.ts +1 -1
- package/dist/Form/Text/index.js +1 -1
- package/dist/Form/Textarea/TextareaInput.d.ts +2 -2
- package/dist/Form/Textarea/TextareaInput.js +5 -2
- package/dist/Form/core/Field.d.ts +16 -4
- package/dist/Form/core/Field.js +18 -8
- package/dist/Form/core/FieldError.d.ts +2 -1
- package/dist/Form/core/FieldError.js +2 -2
- package/dist/Form/core/FieldForm.d.ts +2 -2
- package/dist/Form/core/FieldForm.js +3 -2
- package/dist/Form/core/LegacyField.d.ts +17 -0
- package/dist/Form/core/LegacyField.js +15 -0
- package/dist/Form/core/index.d.ts +6 -5
- package/dist/Form/core/index.js +6 -5
- package/dist/Form/core/useAriaInvalid.d.ts +2 -0
- package/dist/Form/core/useAriaInvalid.js +2 -0
- package/dist/Layout/Footer/Footer.js +1 -1
- package/dist/Layout/Header/Infos/Infos.js +4 -1
- package/dist/Layout/Header/MenuTitleWrapper/MenuTitleWrapper.d.ts +4 -1
- package/dist/Layout/Header/MenuTitleWrapper/MenuTitleWrapper.js +3 -3
- package/dist/Layout/Header/NavBar/NavBar.js +1 -0
- package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.d.ts +7 -1
- package/dist/Layout/Header/NavBar/NavBarItem/NavBarItemBase.d.ts +1 -1
- package/dist/Layout/Header/ToggleButton/ToggleButton.d.ts +2 -2
- package/dist/Layout/Header/ToggleButton/ToggleButton.js +1 -1
- package/dist/Layout/Header/index.d.ts +3 -2
- package/dist/Layout/Header/index.js +3 -2
- package/dist/Link/Link.d.ts +10 -0
- package/dist/Link/Link.js +8 -0
- package/dist/ModalAgent/Modal.js +1 -1
- package/dist/Restitution/HeaderRestitution.js +1 -1
- package/dist/Restitution/SectionRestitutionTitle.js +1 -1
- package/dist/Summary/index.js +2 -1
- package/dist/Table/Pagination/Items.d.ts +2 -1
- package/dist/Table/Pagination/Items.js +9 -5
- package/dist/Table/Pagination/Paging.d.ts +1 -1
- package/dist/Table/Pagination/Paging.js +2 -2
- package/dist/Tabs/components/TabsStateless.d.ts +2 -2
- package/dist/Tabs/components/TabsStateless.js +1 -1
- package/dist/Title/Title.d.ts +3 -1
- package/dist/Title/Title.js +6 -5
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -1
- package/package.json +41 -19
- package/dist/Form/Text/inputTypes.d.ts +0 -2
- package/dist/Form/Text/inputTypes.js +0 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import type { DetailsHTMLAttributes, ReactNode } from "react";
|
|
2
2
|
export type CollapseProps = {
|
|
3
3
|
id: string;
|
|
4
4
|
title: ReactNode;
|
|
5
|
-
children?:
|
|
5
|
+
children?: ReactNode;
|
|
6
6
|
open?: boolean;
|
|
7
7
|
name?: string;
|
|
8
|
-
onToggle?:
|
|
8
|
+
onToggle?: DetailsHTMLAttributes<HTMLDetailsElement>["onToggle"];
|
|
9
9
|
className?: string;
|
|
10
10
|
classModifier?: string;
|
|
11
11
|
};
|
package/dist/Action/Action.js
CHANGED
|
@@ -4,6 +4,6 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { getComponentClassName } from "../utilities";
|
|
5
5
|
export const Action = forwardRef(({ icon, className, classModifier, ...otherProps }, ref) => {
|
|
6
6
|
const componentClassName = getComponentClassName(className, classModifier, "btn af-btn--circle");
|
|
7
|
-
return (_jsx("a", { ...otherProps, className: componentClassName, ref: ref, children: _jsx("i", { className: `glyphicon glyphicon-${icon}` }) }));
|
|
7
|
+
return (_jsx("a", { ...otherProps, className: componentClassName, ref: ref, children: _jsx("i", { role: "img", className: `glyphicon glyphicon-${icon}` }) }));
|
|
8
8
|
});
|
|
9
9
|
Action.displayName = "Action";
|
package/dist/Alert/Alert.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export type AlertCoreComponentProps = {
|
|
|
12
12
|
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
13
13
|
className?: string;
|
|
14
14
|
classModifier?: "error" | "danger" | "info" | "success";
|
|
15
|
+
ariaLabel?: string;
|
|
15
16
|
};
|
|
16
|
-
export declare const Alert: ({ className, onClose, icon, title, children, classModifier, }: PropsWithChildren<AlertCoreComponentProps>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const Alert: ({ className, onClose, icon, title, children, classModifier, ariaLabel, }: PropsWithChildren<AlertCoreComponentProps>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Alert/Alert.js
CHANGED
|
@@ -8,7 +8,7 @@ export var TypeIcons;
|
|
|
8
8
|
TypeIcons["info"] = "glyphicon glyphicon-info-sign";
|
|
9
9
|
TypeIcons["success"] = "glyphicon glyphicon-ok";
|
|
10
10
|
})(TypeIcons || (TypeIcons = {}));
|
|
11
|
-
export const Alert = ({ className, onClose, icon, title, children, classModifier = "error", }) => {
|
|
11
|
+
export const Alert = ({ className, onClose, icon, title, children, classModifier = "error", ariaLabel = "close", }) => {
|
|
12
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", { 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":
|
|
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": ariaLabel, 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
14
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyField } from "../core";
|
|
3
3
|
import { Checkbox } from "./Checkbox";
|
|
4
|
-
type Props = Omit<ComponentProps<typeof Checkbox> & ComponentProps<typeof
|
|
4
|
+
type Props = Omit<ComponentProps<typeof Checkbox> & ComponentProps<typeof LegacyField>, "children" | "placeholder">;
|
|
5
5
|
declare const CheckboxInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { CheckboxInput };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { LegacyField, MessageTypes, useOptionsWithId } from "../core";
|
|
4
4
|
import { Checkbox } from "./Checkbox";
|
|
5
5
|
import { CheckboxModes } from "./CheckboxModes";
|
|
6
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
6
7
|
const CheckboxInput = forwardRef(({ mode, messageType, message, classModifier, options, classNameContainerLabel, classNameContainerInput, label, isVisible, className, forceDisplayMessage, required, ...checkboxProps }, inputRef) => {
|
|
7
8
|
let rowModifier = classModifier;
|
|
8
9
|
if (mode === CheckboxModes.classic) {
|
|
@@ -11,8 +12,12 @@ const CheckboxInput = forwardRef(({ mode, messageType, message, classModifier, o
|
|
|
11
12
|
if (required) {
|
|
12
13
|
rowModifier += " required";
|
|
13
14
|
}
|
|
15
|
+
const errorUseId = useId();
|
|
14
16
|
const newOptions = useOptionsWithId(options);
|
|
15
|
-
|
|
17
|
+
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
18
|
+
return (_jsx(LegacyField, { label: label, id: newOptions[0].id, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: _jsx(Checkbox, { mode: mode, options: newOptions, classModifier: message && messageType === MessageTypes.error && forceDisplayMessage
|
|
19
|
+
? `${classModifier} error`
|
|
20
|
+
: classModifier, ref: inputRef, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...checkboxProps }) }));
|
|
16
21
|
});
|
|
17
22
|
CheckboxInput.displayName = "CheckboxInput";
|
|
18
23
|
export { CheckboxInput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyField } from "../core";
|
|
3
3
|
import { Choice } from "./Choice";
|
|
4
|
-
type Props = ComponentProps<typeof Choice> & Omit<ComponentProps<typeof
|
|
4
|
+
type Props = ComponentProps<typeof Choice> & Omit<ComponentProps<typeof LegacyField>, "children">;
|
|
5
5
|
declare const ChoiceInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { ChoiceInput };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { LegacyField, useInputClassModifier, useOptionsWithId } from "../core";
|
|
4
4
|
import { Choice } from "./Choice";
|
|
5
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
5
6
|
const defaultOptions = [
|
|
6
7
|
{ label: "Oui", value: true, id: "radioItemTrue" },
|
|
7
8
|
{ label: "Non", value: false, id: "radioItemFalse" },
|
|
8
9
|
];
|
|
9
10
|
const ChoiceInput = forwardRef(({ id, messageType, message, className, classModifier, isVisible, classNameContainerLabel, classNameContainerInput, label, forceDisplayMessage, options = defaultOptions, disabled, required, ...otherProps }, inputRef) => {
|
|
11
|
+
const errorUseId = useId();
|
|
10
12
|
const newOptions = useOptionsWithId(options.map((o) => ({ ...o, value: `${o.value}` })), id);
|
|
11
13
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier ?? "", disabled ?? false, false, required);
|
|
12
14
|
const firstId = newOptions?.[0]?.id ?? "";
|
|
@@ -14,7 +16,8 @@ const ChoiceInput = forwardRef(({ id, messageType, message, className, classModi
|
|
|
14
16
|
...o,
|
|
15
17
|
value: o.value === "true",
|
|
16
18
|
}));
|
|
17
|
-
|
|
19
|
+
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
20
|
+
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, ref: inputRef, classModifier: inputClassModifier, options: options ? choiceOptions : undefined, required: required, disabled: disabled, "aria-describedby": errorUseId, "aria-invalid": isInvalid }) }));
|
|
18
21
|
});
|
|
19
22
|
ChoiceInput.displayName = "ChoiceInput";
|
|
20
23
|
export { ChoiceInput };
|
|
@@ -1,10 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
declare const DateInput: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "value"> & {
|
|
3
|
+
classModifier?: string;
|
|
4
|
+
defaultValue?: Date | string;
|
|
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
|
+
} & {
|
|
5
40
|
placeholder?: string;
|
|
6
41
|
helpMessage?: ReactNode;
|
|
7
42
|
children?: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
declare const DateInput: ({ classModifier, message, children, helpMessage, id, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, disabled, required, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
44
|
export { DateInput };
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useId } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
4
4
|
import { Date } from "./Date";
|
|
5
|
-
|
|
5
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
6
|
+
const DateInput = forwardRef(({ classModifier = "", message, children, helpMessage, id, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, disabled = false, required, ...otherProps }, ref) => {
|
|
6
7
|
const inputUseId = useId();
|
|
8
|
+
const errorUseId = useId();
|
|
7
9
|
const inputId = id ?? inputUseId;
|
|
8
10
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
9
|
-
|
|
10
|
-
};
|
|
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 })] }));
|
|
13
|
+
});
|
|
14
|
+
DateInput.displayName = "DateInput";
|
|
11
15
|
export { DateInput };
|
package/dist/Form/File/File.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DropzoneInputProps, DropzoneOptions, FileRejection } from "react-dropzone";
|
|
2
|
+
import { FileActions } from "./constants";
|
|
2
3
|
type Dropzone = DropzoneInputProps & DropzoneOptions;
|
|
3
4
|
type Props = Omit<Dropzone, "onDrop" | "onChange"> & {
|
|
4
5
|
classModifier?: string;
|
|
@@ -16,6 +17,7 @@ export type CustomFile<T = FilePreview> = {
|
|
|
16
17
|
type onChangeProps = {
|
|
17
18
|
id?: string;
|
|
18
19
|
name?: string;
|
|
20
|
+
fileAction?: FileActions;
|
|
19
21
|
values: CustomFile[];
|
|
20
22
|
errors?: CustomFile<FileRejection>[];
|
|
21
23
|
};
|
package/dist/Form/File/File.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 { LegacyField } from "../core";
|
|
4
4
|
import { File } from "./File";
|
|
5
5
|
import { FileTable } from "./FileTable";
|
|
6
|
-
type FieldProps = ComponentPropsWithoutRef<typeof
|
|
6
|
+
type FieldProps = ComponentPropsWithoutRef<typeof LegacyField>;
|
|
7
7
|
type FileProps = ComponentPropsWithoutRef<typeof File>;
|
|
8
8
|
type FileTableProps = ComponentPropsWithoutRef<typeof FileTable>;
|
|
9
9
|
type Props = FieldProps & FileProps & Pick<FileTableProps, "values" | "errors"> & {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, 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 { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
5
5
|
import { File } from "./File";
|
|
6
6
|
import { FileTable } from "./FileTable";
|
|
7
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
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 }) => {
|
|
8
9
|
const onDeleteClick = (selectedId, selectInputId) => {
|
|
9
10
|
const newValues = values.filter((element) => element.id !== selectedId);
|
|
@@ -11,12 +12,15 @@ const FileInput = ({ values = [], name = "", onChange, classModifier = "", messa
|
|
|
11
12
|
values: newValues,
|
|
12
13
|
name,
|
|
13
14
|
id: selectInputId,
|
|
15
|
+
fileAction: "delete",
|
|
14
16
|
});
|
|
15
17
|
};
|
|
16
18
|
const inputUseId = useId();
|
|
19
|
+
const errorUseId = useId();
|
|
17
20
|
const inputId = id ?? inputUseId;
|
|
18
21
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
19
22
|
const rowModifier = `${inputFieldClassModifier} label-top`;
|
|
20
|
-
|
|
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 })] }));
|
|
21
25
|
};
|
|
22
26
|
export { FileInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FileActions = "add" | "delete";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { FileInput } from "./FileInput";
|
|
2
1
|
export { File } from "./File";
|
|
3
|
-
export {
|
|
4
|
-
export { FileLine } from "./FileLine";
|
|
2
|
+
export type { FilePreview } from "./File";
|
|
5
3
|
export { FileErrors } from "./FileErrors";
|
|
4
|
+
export { FileInput } from "./FileInput";
|
|
5
|
+
export { FileLine } from "./FileLine";
|
|
6
|
+
export { FileTable } from "./FileTable";
|
package/dist/Form/File/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { FileInput } from "./FileInput";
|
|
2
1
|
export { File } from "./File";
|
|
3
|
-
export { FileTable } from "./FileTable";
|
|
4
|
-
export { FileLine } from "./FileLine";
|
|
5
2
|
export { FileErrors } from "./FileErrors";
|
|
3
|
+
export { FileInput } from "./FileInput";
|
|
4
|
+
export { FileLine } from "./FileLine";
|
|
5
|
+
export { FileTable } from "./FileTable";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
|
|
2
2
|
import { type ComponentProps, type ReactNode } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { LegacyField } from "../core";
|
|
4
4
|
import { MultiSelect } from "./MultiSelect";
|
|
5
|
-
type Props = ComponentProps<typeof
|
|
5
|
+
type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof MultiSelect> & {
|
|
6
6
|
helpMessage?: ReactNode;
|
|
7
7
|
};
|
|
8
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;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
5
5
|
import { MultiSelect } from "./MultiSelect";
|
|
6
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
6
7
|
const MultiSelectInput = ({ classModifier, message, children, helpMessage, id, disabled, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, required, ...multiSelectProps }) => {
|
|
7
8
|
const { inputFieldClassModifier } = useInputClassModifier(classModifier ?? "", disabled ?? false, Boolean(children), required);
|
|
8
9
|
const generatedId = useId();
|
|
10
|
+
const errorUseId = useId();
|
|
9
11
|
const inputId = id || generatedId;
|
|
10
|
-
|
|
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 })] }));
|
|
11
14
|
};
|
|
12
15
|
export { MultiSelectInput };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@axa-fr/design-system-slash-css/dist/Form/NestedQuestion/NestedQuestion.scss";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
export declare const NestedQuestion: ({ children, className, }: {
|
|
4
|
+
className?: string;
|
|
5
|
+
} & PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Form/NestedQuestion/NestedQuestion.scss";
|
|
3
|
+
import { getComponentClassName } from "../../utilities";
|
|
4
|
+
export const NestedQuestion = ({ children, className, }) => {
|
|
5
|
+
const componentClassName = getComponentClassName(className, "", "af-form__nested-question");
|
|
6
|
+
return (_jsxs("section", { className: componentClassName, children: [_jsx("div", { className: `${componentClassName}-arrow` }), _jsx("section", { children: children })] }));
|
|
7
|
+
};
|
|
@@ -2,9 +2,9 @@ import "@axa-fr/design-system-slash-css/dist/common/grid.scss";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/Form/core/FormCore.scss";
|
|
4
4
|
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { LegacyField } from "../core";
|
|
6
6
|
import { Number } from "./Number";
|
|
7
|
-
type Props = ComponentPropsWithoutRef<typeof
|
|
7
|
+
type Props = ComponentPropsWithoutRef<typeof LegacyField> & ComponentPropsWithRef<typeof Number> & {
|
|
8
8
|
helpMessage?: ReactNode;
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
};
|
|
@@ -3,11 +3,14 @@ import "@axa-fr/design-system-slash-css/dist/common/grid.scss";
|
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
4
4
|
import "@axa-fr/design-system-slash-css/dist/Form/core/FormCore.scss";
|
|
5
5
|
import { useId, } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
7
7
|
import { Number } from "./Number";
|
|
8
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
8
9
|
export const NumberInput = ({ message, children, helpMessage, id, label, classNameContainerLabel, classNameContainerInput, forceDisplayMessage, messageType, isVisible, className, disabled = false, classModifier = "", required, ...otherProps }) => {
|
|
9
10
|
const inputUseId = useId();
|
|
11
|
+
const errorUseId = useId();
|
|
10
12
|
const inputId = id ?? inputUseId;
|
|
11
13
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
12
|
-
|
|
14
|
+
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
15
|
+
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__text", classModifier: inputFieldClassModifier, children: [_jsx(Number, { id: inputId, classModifier: inputClassModifier, disabled: disabled, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...otherProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
13
16
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyField } from "../core";
|
|
3
3
|
import { Pass } from "./Pass";
|
|
4
4
|
type PassProps = ComponentProps<typeof Pass>;
|
|
5
|
-
type Props = ComponentProps<typeof
|
|
5
|
+
type Props = ComponentProps<typeof LegacyField> & Omit<PassProps, "onToggleType" | "type"> & {
|
|
6
6
|
helpMessage?: ReactNode;
|
|
7
7
|
score?: string;
|
|
8
8
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
4
4
|
import { Pass } from "./Pass";
|
|
5
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
5
6
|
const strengthList = {
|
|
6
7
|
0: "bad",
|
|
7
8
|
1: "okay",
|
|
@@ -13,7 +14,8 @@ const calculateStrength = (score) => {
|
|
|
13
14
|
if (score === null || score === undefined) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
const scoreToNumber = Number(score);
|
|
18
|
+
let strength = Number.isNaN(scoreToNumber) ? 0 : scoreToNumber;
|
|
17
19
|
if (strength > 4) {
|
|
18
20
|
strength = 4;
|
|
19
21
|
}
|
|
@@ -27,8 +29,10 @@ const PassInput = ({ message, children, helpMessage, id, disabled = false, label
|
|
|
27
29
|
const classModifierStrength = [classModifier ?? "", strength ?? ""].join(" ");
|
|
28
30
|
const [type, setType] = useState("password");
|
|
29
31
|
const inputId = useId();
|
|
32
|
+
const errorUseId = useId();
|
|
30
33
|
const finalId = id ?? inputId;
|
|
31
34
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifierStrength, disabled, Boolean(children), required);
|
|
32
|
-
|
|
35
|
+
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
36
|
+
return (_jsx(LegacyField, { label: label, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, id: finalId, classModifier: `${classModifierStrength} ${inputFieldClassModifier}`, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: _jsxs(FieldInput, { className: "af-form__pass-container", classModifier: inputFieldClassModifier, children: [_jsx(Pass, { ...passProps, type: type, id: inputId, disabled: disabled, classModifier: inputClassModifier, "aria-describedby": errorUseId, "aria-invalid": isInvalid, onToggleType: () => setType(type === "password" ? "text" : "password") }), children, _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }) }));
|
|
33
37
|
};
|
|
34
38
|
export { PassInput };
|
|
@@ -31,16 +31,13 @@ declare const RadioInput: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
31
31
|
roleContainer?: string;
|
|
32
32
|
ariaLabelContainer?: string;
|
|
33
33
|
isLabelContainerLinkedToInput?: boolean;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, "type" | "checked"> & {
|
|
34
|
+
errorId?: string;
|
|
35
|
+
} & Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "checked"> & {
|
|
37
36
|
classModifier?: string;
|
|
38
37
|
optionClassName?: string;
|
|
39
38
|
label?: import("react").ReactNode;
|
|
40
39
|
isChecked?: boolean;
|
|
41
|
-
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "
|
|
42
|
-
ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
|
|
43
|
-
}, "label" | "className" | "id"> & {
|
|
40
|
+
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "label" | "className" | "id"> & {
|
|
44
41
|
options: import("../core").Option[];
|
|
45
42
|
mode?: keyof typeof RadioModes;
|
|
46
43
|
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { LegacyField, getFirstId, useInputClassModifier, useOptionsWithId, } from "../core";
|
|
4
4
|
import { Radio, RadioModes } from "./Radio";
|
|
5
|
+
import { useAriaInvalid } from "../core/useAriaInvalid";
|
|
5
6
|
const RadioInput = forwardRef(({ mode, messageType, message, className, classModifier = "", isVisible, options, classNameContainerLabel, classNameContainerInput, label, forceDisplayMessage, children, required, disabled = false, ariaLabelContainer, ...radioProps }, inputRef) => {
|
|
6
7
|
const rowModifier = `${classModifier ?? ""}${mode === RadioModes.classic ? " label-top " : ""}`;
|
|
7
8
|
const newOptions = useOptionsWithId(options);
|
|
8
9
|
const firstId = getFirstId(newOptions);
|
|
10
|
+
const errorUseId = useId();
|
|
9
11
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
10
|
-
|
|
12
|
+
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
13
|
+
return (_jsxs(LegacyField, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier + inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, roleContainer: "radiogroup", ariaLabelContainer: ariaLabelContainer ?? label?.toString(), isLabelContainerLinkedToInput: false, errorId: errorUseId, children: [_jsx(Radio, { options: newOptions, mode: mode, classModifier: inputClassModifier, ref: inputRef, disabled: disabled, required: required || classModifier?.includes("required"), "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...radioProps }), children] }));
|
|
11
14
|
});
|
|
12
15
|
RadioInput.displayName = "EnhancedInputRadio";
|
|
13
16
|
export { RadioInput };
|