@axa-fr/design-system-slash-react 1.1.1-alpha.7 → 1.1.1-alpha.71
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/Form/Checkbox/CheckboxInput.d.ts +2 -2
- package/dist/Form/Checkbox/CheckboxInput.js +2 -2
- package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
- package/dist/Form/Choice/ChoiceInput.js +2 -2
- package/dist/Form/Date/DateInput.d.ts +2 -2
- package/dist/Form/Date/DateInput.js +2 -2
- 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 +3 -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 +2 -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 +2 -2
- package/dist/Form/Pass/PassInput.d.ts +2 -2
- package/dist/Form/Pass/PassInput.js +2 -2
- package/dist/Form/Radio/RadioInput.d.ts +2 -6
- package/dist/Form/Radio/RadioInput.js +2 -2
- package/dist/Form/Select/SelectInput.d.ts +2 -2
- package/dist/Form/Select/SelectInput.js +2 -2
- package/dist/Form/Slider/SliderInput.d.ts +2 -2
- package/dist/Form/Slider/SliderInput.js +2 -2
- package/dist/Form/Text/TextInput.d.ts +3 -6
- package/dist/Form/Text/TextInput.js +4 -12
- 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 +2 -2
- package/dist/Form/core/Field.d.ts +15 -4
- package/dist/Form/core/Field.js +15 -8
- package/dist/Form/core/FieldForm.d.ts +2 -2
- package/dist/Form/core/FieldForm.js +3 -2
- package/dist/Form/core/LegacyField.d.ts +16 -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/Layout/Footer/Footer.js +1 -1
- package/dist/Layout/Header/Infos/Infos.js +4 -1
- 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/Summary/index.js +2 -1
- package/dist/Tabs/components/TabsStateless.d.ts +2 -2
- package/dist/Tabs/components/TabsStateless.js +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -2
- package/package.json +27 -15
- package/dist/Form/Text/inputTypes.d.ts +0 -2
- package/dist/Form/Text/inputTypes.js +0 -5
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { LegacyField, useOptionsWithId } from "../core";
|
|
4
4
|
import { Checkbox } from "./Checkbox";
|
|
5
5
|
import { CheckboxModes } from "./CheckboxModes";
|
|
6
6
|
const CheckboxInput = forwardRef(({ mode, messageType, message, classModifier, options, classNameContainerLabel, classNameContainerInput, label, isVisible, className, forceDisplayMessage, required, ...checkboxProps }, inputRef) => {
|
|
@@ -12,7 +12,7 @@ const CheckboxInput = forwardRef(({ mode, messageType, message, classModifier, o
|
|
|
12
12
|
rowModifier += " required";
|
|
13
13
|
}
|
|
14
14
|
const newOptions = useOptionsWithId(options);
|
|
15
|
-
return (_jsx(
|
|
15
|
+
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, children: _jsx(Checkbox, { mode: mode, options: newOptions, classModifier: classModifier, ref: inputRef, ...checkboxProps }) }));
|
|
16
16
|
});
|
|
17
17
|
CheckboxInput.displayName = "CheckboxInput";
|
|
18
18
|
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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { LegacyField, useInputClassModifier, useOptionsWithId } from "../core";
|
|
4
4
|
import { Choice } from "./Choice";
|
|
5
5
|
const defaultOptions = [
|
|
6
6
|
{ label: "Oui", value: true, id: "radioItemTrue" },
|
|
@@ -14,7 +14,7 @@ const ChoiceInput = forwardRef(({ id, messageType, message, className, classModi
|
|
|
14
14
|
...o,
|
|
15
15
|
value: o.value === "true",
|
|
16
16
|
}));
|
|
17
|
-
return (_jsx(
|
|
17
|
+
return (_jsx(LegacyField, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: _jsx(Choice, { ...otherProps, id: id, ref: inputRef, classModifier: inputClassModifier, options: options ? choiceOptions : undefined, required: required, disabled: disabled }) }));
|
|
18
18
|
});
|
|
19
19
|
ChoiceInput.displayName = "ChoiceInput";
|
|
20
20
|
export { ChoiceInput };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyField } from "../core";
|
|
3
3
|
import { Date } from "./Date";
|
|
4
|
-
type Props = Omit<ComponentPropsWithoutRef<typeof Date>, "placeholderText"> & ComponentPropsWithoutRef<typeof
|
|
4
|
+
type Props = Omit<ComponentPropsWithoutRef<typeof Date>, "placeholderText"> & ComponentPropsWithoutRef<typeof LegacyField> & {
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
helpMessage?: ReactNode;
|
|
7
7
|
children?: ReactNode;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
4
4
|
import { Date } from "./Date";
|
|
5
5
|
const DateInput = ({ classModifier = "", message, children, helpMessage, id, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, disabled = false, required, ...otherProps }) => {
|
|
6
6
|
const inputUseId = useId();
|
|
7
7
|
const inputId = id ?? inputUseId;
|
|
8
8
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
9
|
-
return (_jsxs(
|
|
9
|
+
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsxs(FieldInput, { className: "af-form__date", classModifier: inputFieldClassModifier, children: [_jsx(Date, { id: inputId, classModifier: inputClassModifier, disabled: disabled, required: required, ...otherProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
10
10
|
};
|
|
11
11
|
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,7 +1,7 @@
|
|
|
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
7
|
const FileInput = ({ values = [], name = "", onChange, classModifier = "", message, children, helpMessage, id = "", forceDisplayMessage, messageType, classNameContainerLabel, classNameContainerInput, label, isVisible, className, errors, fileLabel, disabled = false, required, ...otherFileProps }) => {
|
|
@@ -11,12 +11,13 @@ const FileInput = ({ values = [], name = "", onChange, classModifier = "", messa
|
|
|
11
11
|
values: newValues,
|
|
12
12
|
name,
|
|
13
13
|
id: selectInputId,
|
|
14
|
+
fileAction: "delete",
|
|
14
15
|
});
|
|
15
16
|
};
|
|
16
17
|
const inputUseId = useId();
|
|
17
18
|
const inputId = id ?? inputUseId;
|
|
18
19
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
19
20
|
const rowModifier = `${inputFieldClassModifier} label-top`;
|
|
20
|
-
return (_jsxs(
|
|
21
|
+
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, 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"), ...otherFileProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message }), _jsx(FileTable, { errors: errors, values: values, onClick: (selectedId) => onDeleteClick(selectedId, inputId), classModifier: classModifier })] }));
|
|
21
22
|
};
|
|
22
23
|
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,12 @@
|
|
|
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
6
|
const MultiSelectInput = ({ classModifier, message, children, helpMessage, id, disabled, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, required, ...multiSelectProps }) => {
|
|
7
7
|
const { inputFieldClassModifier } = useInputClassModifier(classModifier ?? "", disabled ?? false, Boolean(children), required);
|
|
8
8
|
const generatedId = useId();
|
|
9
9
|
const inputId = id || generatedId;
|
|
10
|
-
return (_jsxs(
|
|
10
|
+
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsxs(FieldInput, { className: "af-form__select", classModifier: inputFieldClassModifier, children: [_jsx(MultiSelect, { inputId: inputId, disabled: disabled, required: required, ...multiSelectProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
11
11
|
};
|
|
12
12
|
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,11 @@ 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
8
|
export const NumberInput = ({ message, children, helpMessage, id, label, classNameContainerLabel, classNameContainerInput, forceDisplayMessage, messageType, isVisible, className, disabled = false, classModifier = "", required, ...otherProps }) => {
|
|
9
9
|
const inputUseId = useId();
|
|
10
10
|
const inputId = id ?? inputUseId;
|
|
11
11
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
12
|
-
return (_jsxs(
|
|
12
|
+
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsxs(FieldInput, { className: "af-form__text", classModifier: inputFieldClassModifier, children: [_jsx(Number, { id: inputId, classModifier: inputClassModifier, disabled: disabled, ...otherProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
13
13
|
};
|
|
@@ -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,6 +1,6 @@
|
|
|
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
5
|
const strengthList = {
|
|
6
6
|
0: "bad",
|
|
@@ -29,6 +29,6 @@ const PassInput = ({ message, children, helpMessage, id, disabled = false, label
|
|
|
29
29
|
const inputId = useId();
|
|
30
30
|
const finalId = id ?? inputId;
|
|
31
31
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifierStrength, disabled, Boolean(children), required);
|
|
32
|
-
return (_jsx(
|
|
32
|
+
return (_jsx(LegacyField, { label: label, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, id: finalId, classModifier: `${classModifierStrength} ${inputFieldClassModifier}`, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: _jsxs(FieldInput, { className: "af-form__pass-container", classModifier: inputFieldClassModifier, children: [_jsx(Pass, { ...passProps, type: type, id: inputId, disabled: disabled, classModifier: inputClassModifier, onToggleType: () => setType(type === "password" ? "text" : "password") }), children, _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }) }));
|
|
33
33
|
};
|
|
34
34
|
export { PassInput };
|
|
@@ -31,16 +31,12 @@ declare const RadioInput: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
31
31
|
roleContainer?: string;
|
|
32
32
|
ariaLabelContainer?: string;
|
|
33
33
|
isLabelContainerLinkedToInput?: boolean;
|
|
34
|
-
} & Omit<Omit<Omit<Omit<Omit<
|
|
35
|
-
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;
|
|
36
|
-
}, "type" | "checked"> & {
|
|
34
|
+
} & Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "checked"> & {
|
|
37
35
|
classModifier?: string;
|
|
38
36
|
optionClassName?: string;
|
|
39
37
|
label?: import("react").ReactNode;
|
|
40
38
|
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"> & {
|
|
39
|
+
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "label" | "className" | "id"> & {
|
|
44
40
|
options: import("../core").Option[];
|
|
45
41
|
mode?: keyof typeof RadioModes;
|
|
46
42
|
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { LegacyField, getFirstId, useInputClassModifier, useOptionsWithId, } from "../core";
|
|
4
4
|
import { Radio, RadioModes } from "./Radio";
|
|
5
5
|
const RadioInput = forwardRef(({ mode, messageType, message, className, classModifier = "", isVisible, options, classNameContainerLabel, classNameContainerInput, label, forceDisplayMessage, children, required, disabled = false, ariaLabelContainer, ...radioProps }, inputRef) => {
|
|
6
6
|
const rowModifier = `${classModifier ?? ""}${mode === RadioModes.classic ? " label-top " : ""}`;
|
|
7
7
|
const newOptions = useOptionsWithId(options);
|
|
8
8
|
const firstId = getFirstId(newOptions);
|
|
9
9
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
10
|
-
return (_jsxs(
|
|
10
|
+
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, children: [_jsx(Radio, { options: newOptions, mode: mode, classModifier: inputClassModifier, ref: inputRef, disabled: disabled, required: required || classModifier?.includes("required"), ...radioProps }), children] }));
|
|
11
11
|
});
|
|
12
12
|
RadioInput.displayName = "EnhancedInputRadio";
|
|
13
13
|
export { RadioInput };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyField } from "../core";
|
|
3
3
|
import { Select } from "./Select";
|
|
4
|
-
type Props = ComponentProps<typeof
|
|
4
|
+
type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof Select> & {
|
|
5
5
|
helpMessage?: ReactNode;
|
|
6
6
|
};
|
|
7
7
|
declare const SelectInput: import("react").ForwardRefExoticComponent<Omit<PropsWithChildren<Props>, "ref"> & import("react").RefAttributes<HTMLSelectElement>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
4
4
|
import { Select } from "./Select";
|
|
5
5
|
const SelectInput = forwardRef(({ classModifier = "", message, children, helpMessage, id, disabled = false, label, classNameContainerLabel, classNameContainerInput, messageType, isVisible, forceDisplayMessage, className, required, ...otherSelectProps }, inputRef) => {
|
|
6
6
|
const generatedId = useId();
|
|
7
7
|
const inputId = id ?? generatedId;
|
|
8
8
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
9
|
-
return (_jsxs(
|
|
9
|
+
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsxs(FieldInput, { className: "af-form__select", classModifier: inputFieldClassModifier, children: [_jsx(Select, { id: inputId, disabled: disabled, classModifier: inputClassModifier, ref: inputRef, required: required, ...otherSelectProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
10
10
|
});
|
|
11
11
|
SelectInput.displayName = "SelectInput";
|
|
12
12
|
export { SelectInput };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyField } from "../core";
|
|
3
3
|
import { Slider } from "./Slider";
|
|
4
|
-
type Props = ComponentProps<typeof
|
|
4
|
+
type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof Slider> & {
|
|
5
5
|
helpMessage?: ReactNode;
|
|
6
6
|
};
|
|
7
7
|
declare const SliderInput: ({ id, children, helpMessage, message, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, classModifier, ...sliderProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { HelpMessage, LegacyField } from "../core";
|
|
4
4
|
import { Slider } from "./Slider";
|
|
5
5
|
const SliderInput = ({ id, children, helpMessage, message, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, classModifier, ...sliderProps }) => {
|
|
6
6
|
const generatedId = useId();
|
|
7
7
|
const newId = useMemo(() => id ?? generatedId, [generatedId, id]);
|
|
8
|
-
return (_jsxs(
|
|
8
|
+
return (_jsxs(LegacyField, { id: newId, label: label, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: classModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsx(Slider, { ...sliderProps, id: id, classModifier: classModifier }), children, _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
9
9
|
};
|
|
10
10
|
export { SliderInput };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import "@axa-fr/design-system-slash-css/dist/Form/core/FormCore.scss";
|
|
2
|
-
import "@axa-fr/design-system-slash-css/dist/common/grid.scss";
|
|
3
|
-
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
4
1
|
import { ComponentProps, ReactNode } from "react";
|
|
5
2
|
import { Field } from "../core";
|
|
6
3
|
import { Text } from "./Text";
|
|
7
|
-
type
|
|
4
|
+
export type TextInputProps = Omit<ComponentProps<typeof Field> & ComponentProps<typeof Text> & {
|
|
8
5
|
helpMessage?: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
declare const TextInput: import("react").ForwardRefExoticComponent<Omit<
|
|
6
|
+
}, "renderInput">;
|
|
7
|
+
declare const TextInput: import("react").ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
8
|
export { TextInput };
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
5
|
-
import { forwardRef, useId } from "react";
|
|
6
|
-
import { Field, FieldInput, HelpMessage, useInputClassModifier } from "../core";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Field } from "../core";
|
|
7
4
|
import { Text } from "./Text";
|
|
8
|
-
const TextInput = forwardRef(({
|
|
9
|
-
const inputUseId = useId();
|
|
10
|
-
const inputId = id ?? inputUseId;
|
|
11
|
-
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
12
|
-
return (_jsxs(Field, { label: label, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, id: inputId, classModifier: classModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsxs(FieldInput, { className: "af-form__text", classModifier: inputFieldClassModifier, children: [_jsx(Text, { id: inputId, classModifier: inputClassModifier, disabled: disabled, ref: inputRef, required: required, ...inputTextProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
13
|
-
});
|
|
5
|
+
const TextInput = forwardRef(({ children, ...props }, inputRef) => (_jsx(Field, { ...props, renderInput: ({ id, classModifier }) => (_jsx(Text, { id: id, classModifier: classModifier, ref: inputRef, ...props })), children: children })));
|
|
14
6
|
TextInput.displayName = "TextInput";
|
|
15
7
|
export { TextInput };
|
package/dist/Form/Text/index.js
CHANGED
|
@@ -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 { ComponentProps, ReactNode } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { LegacyField } from "../core";
|
|
6
6
|
import { Textarea } from "./Textarea";
|
|
7
|
-
type Props = ComponentProps<typeof
|
|
7
|
+
type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof Textarea> & {
|
|
8
8
|
helpMessage?: ReactNode;
|
|
9
9
|
};
|
|
10
10
|
declare const TextareaInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -3,14 +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 { forwardRef, useId } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
7
7
|
import { Textarea } from "./Textarea";
|
|
8
8
|
const TextareaInput = forwardRef(({ id, classModifier = "", message, children, helpMessage, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, rows = 5, cols = 50, disabled = false, required, ...textareaInputProps }, inputRef) => {
|
|
9
9
|
const rowModifier = `${classModifier} label-top`;
|
|
10
10
|
const inputUseId = useId();
|
|
11
11
|
const inputId = id ?? inputUseId;
|
|
12
12
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
13
|
-
return (_jsxs(
|
|
13
|
+
return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsxs(FieldInput, { className: "af-form__textarea", classModifier: `${rowModifier} ${inputFieldClassModifier}`, children: [_jsx(Textarea, { ...textareaInputProps, id: inputId, rows: rows, cols: cols, classModifier: inputClassModifier, disabled: disabled, ref: inputRef }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
|
|
14
14
|
});
|
|
15
15
|
TextareaInput.displayName = "TextareaInput";
|
|
16
16
|
export { TextareaInput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { MessageTypes } from ".";
|
|
3
|
+
type InputProps = {
|
|
4
4
|
label: ReactNode;
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
id?: string;
|
|
@@ -11,6 +11,17 @@ type FieldProps = Omit<ComponentPropsWithoutRef<typeof FieldForm>, "children"> &
|
|
|
11
11
|
roleContainer?: string;
|
|
12
12
|
ariaLabelContainer?: string;
|
|
13
13
|
isLabelContainerLinkedToInput?: boolean;
|
|
14
|
+
forceDisplayMessage?: boolean;
|
|
15
|
+
message?: string;
|
|
16
|
+
messageType?: MessageTypes;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
helpMessage?: ReactNode;
|
|
14
20
|
};
|
|
15
|
-
export declare const Field: ({
|
|
21
|
+
export declare const Field: ({ classNameContainerInput, classNameContainerLabel, label, forceDisplayMessage, message, messageType, required, classModifier, children, disabled, helpMessage, id, isVisible, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, renderInput: Element, }: InputProps & {
|
|
22
|
+
renderInput: (props: {
|
|
23
|
+
id: string;
|
|
24
|
+
classModifier: string;
|
|
25
|
+
}) => ReactNode;
|
|
26
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
27
|
export {};
|
package/dist/Form/core/Field.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { FieldError, FormClassManager, HelpMessage, useInputClassModifier, } from ".";
|
|
3
5
|
import { getComponentClassName } from "../../utilities";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", label, forceDisplayMessage, message, messageType, required, classModifier = "", children, disabled = false, helpMessage, id, isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, renderInput: Element, }) => {
|
|
7
|
+
const inputUseId = useId();
|
|
8
|
+
const inputId = id ?? inputUseId;
|
|
9
|
+
const actualRequired = required || classModifier.includes("required");
|
|
10
|
+
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), actualRequired);
|
|
8
11
|
if (!isVisible) {
|
|
9
12
|
return null;
|
|
10
13
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const fieldContainerClassName = getComponentClassName("af-form__text", forceDisplayMessage
|
|
15
|
+
? `${inputFieldClassModifier} ${FormClassManager.getModifier(messageType)}`
|
|
16
|
+
: inputFieldClassModifier);
|
|
17
|
+
return (_jsxs("div", { className: classNames("row af-form__group", {
|
|
18
|
+
"af-form__group--required": actualRequired,
|
|
19
|
+
}), role: roleContainer, "aria-label": ariaLabelContainer, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx("label", { className: classNames("af-form__group-label", {
|
|
20
|
+
"af-form__group-label--required": actualRequired,
|
|
21
|
+
}), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsxs("div", { className: fieldContainerClassName, children: [_jsx(Element, { id: inputId, classModifier: inputClassModifier }), children] }), forceDisplayMessage ? (_jsx(FieldError, { message: message, messageType: messageType })) : (_jsx(HelpMessage, { message: helpMessage }))] })] }));
|
|
15
22
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseSyntheticEvent, Dispatch, ReactNode, SetStateAction } from "react";
|
|
1
|
+
import { type BaseSyntheticEvent, type Dispatch, type ReactElement, type ReactNode, type SetStateAction } from "react";
|
|
2
2
|
import { FormClassManager } from "./FormClassManager";
|
|
3
3
|
import { MessageTypes } from "./MessageTypes";
|
|
4
4
|
type TMessage = {
|
|
@@ -49,7 +49,7 @@ export declare const eventWrapper: ({ wrapper, props }: EventWrapperProps) => {
|
|
|
49
49
|
onFocus: (ev: BaseSyntheticEvent) => void;
|
|
50
50
|
};
|
|
51
51
|
type AddPropsClone = Omit<RenderChildrenProps, "children"> & {
|
|
52
|
-
child:
|
|
52
|
+
child: ReactElement<Record<string, unknown>>;
|
|
53
53
|
classModifier: string;
|
|
54
54
|
name: string;
|
|
55
55
|
getMessageClassModifierFn?: typeof FormClassManager.getMessageClassModifier;
|
|
@@ -100,7 +100,8 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
|
|
|
100
100
|
};
|
|
101
101
|
if (child.props.children) {
|
|
102
102
|
const subChildren = renderedChildren({
|
|
103
|
-
children: child.props
|
|
103
|
+
children: child.props
|
|
104
|
+
.children,
|
|
104
105
|
wrapper,
|
|
105
106
|
message,
|
|
106
107
|
messageType,
|
|
@@ -118,7 +119,7 @@ export const renderedChildren = ({ children, wrapper, message, messageType, }) =
|
|
|
118
119
|
messageType,
|
|
119
120
|
classModifier: props.classModifier,
|
|
120
121
|
wrapper,
|
|
121
|
-
child,
|
|
122
|
+
child: child,
|
|
122
123
|
}),
|
|
123
124
|
});
|
|
124
125
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { FieldForm } from "./FieldForm";
|
|
3
|
+
type FieldProps = Omit<ComponentPropsWithoutRef<typeof FieldForm>, "children"> & {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
id?: string;
|
|
7
|
+
classModifier?: string;
|
|
8
|
+
classNameContainerLabel?: string;
|
|
9
|
+
classNameContainerInput?: string;
|
|
10
|
+
isVisible?: boolean;
|
|
11
|
+
roleContainer?: string;
|
|
12
|
+
ariaLabelContainer?: string;
|
|
13
|
+
isLabelContainerLinkedToInput?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const LegacyField: ({ id, message, messageType, label, children, forceDisplayMessage, classModifier, className, classNameContainerLabel, classNameContainerInput, isVisible, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput, }: FieldProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { getComponentClassName } from "../../utilities";
|
|
4
|
+
import { FieldError } from "./FieldError";
|
|
5
|
+
import { FieldForm } from "./FieldForm";
|
|
6
|
+
import { MessageTypes } from "./MessageTypes";
|
|
7
|
+
export const LegacyField = ({ id = "", message = "", messageType = MessageTypes.error, label, children, forceDisplayMessage, classModifier = "", className, classNameContainerLabel = "col-md-2", classNameContainerInput = "col-md-10", isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, }) => {
|
|
8
|
+
if (!isVisible) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const componentClassName = getComponentClassName(className, classModifier, "row af-form__group");
|
|
12
|
+
return (_jsxs("div", { className: componentClassName, role: roleContainer, "aria-label": ariaLabelContainer, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx("label", { className: classNames({
|
|
13
|
+
"af-form__group-label--required": classModifier.includes("required"),
|
|
14
|
+
}, "af-form__group-label"), htmlFor: isLabelContainerLinkedToInput ? id : undefined, children: label }) }), _jsxs(FieldForm, { className: classNameContainerInput, message: message, messageType: messageType, forceDisplayMessage: forceDisplayMessage, children: [children, _jsx(FieldError, { message: message, messageType: messageType })] })] }));
|
|
15
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
export { Field } from "./Field";
|
|
3
|
-
export { FieldInput } from "./FieldInput";
|
|
4
|
-
export { MessageTypes } from "./MessageTypes";
|
|
5
3
|
export { FieldError } from "./FieldError";
|
|
6
|
-
export { FormClassManager } from "./FormClassManager";
|
|
7
4
|
export { FieldForm } from "./FieldForm";
|
|
5
|
+
export { FieldInput } from "./FieldInput";
|
|
6
|
+
export { FormClassManager } from "./FormClassManager";
|
|
8
7
|
export { HelpMessage } from "./HelpMessage";
|
|
9
8
|
export { InputList } from "./InputList";
|
|
10
|
-
export {
|
|
9
|
+
export { LegacyField } from "./LegacyField";
|
|
10
|
+
export { MessageTypes } from "./MessageTypes";
|
|
11
|
+
export { getFirstId } from "./getFirstId";
|
|
11
12
|
export { getOptionClassName } from "./getOptionClassName";
|
|
13
|
+
export { useInputClassModifier } from "./useInputClassModifier";
|
|
12
14
|
export { useOptionsWithId } from "./useOptionsWithId";
|
|
13
|
-
export { getFirstId } from "./getFirstId";
|
|
14
15
|
export type Option = {
|
|
15
16
|
id?: string;
|
|
16
17
|
icon?: ReactNode;
|
package/dist/Form/core/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { Field } from "./Field";
|
|
2
|
-
export { FieldInput } from "./FieldInput";
|
|
3
|
-
export { MessageTypes } from "./MessageTypes";
|
|
4
2
|
export { FieldError } from "./FieldError";
|
|
5
|
-
export { FormClassManager } from "./FormClassManager";
|
|
6
3
|
export { FieldForm } from "./FieldForm";
|
|
4
|
+
export { FieldInput } from "./FieldInput";
|
|
5
|
+
export { FormClassManager } from "./FormClassManager";
|
|
7
6
|
export { HelpMessage } from "./HelpMessage";
|
|
8
7
|
export { InputList } from "./InputList";
|
|
9
|
-
export {
|
|
8
|
+
export { LegacyField } from "./LegacyField";
|
|
9
|
+
export { MessageTypes } from "./MessageTypes";
|
|
10
|
+
export { getFirstId } from "./getFirstId";
|
|
10
11
|
export { getOptionClassName } from "./getOptionClassName";
|
|
12
|
+
export { useInputClassModifier } from "./useInputClassModifier";
|
|
11
13
|
export { useOptionsWithId } from "./useOptionsWithId";
|
|
12
|
-
export { getFirstId } from "./getFirstId";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import logo from "@axa-fr/design-system-slash-css/
|
|
2
|
+
import logo from "@axa-fr/design-system-slash-css/logo-axa.svg";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/Layout/Footer/Footer.scss";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
export const Footer = forwardRef(({ className = "af-footer", href = "https://www.axa.fr/", title = "Site Axa", icon = logo, alt = "Logo Axa", children = `© ${new Date().getFullYear()} AXA Tous droits réservés`, ...props }, ref) => (_jsx("footer", { ref: ref, className: className, ...props, children: _jsxs("div", { className: "container-fluid container", children: [Boolean(icon) && (_jsx("a", { className: "af-logo", href: href, title: title, target: "blank", rel: "noopener noreferrer", children: _jsx("img", { className: "af-logo__brand", src: icon, alt: alt }) })), _jsx("div", { className: "af-footer-content", children: children })] }) })));
|
|
@@ -6,6 +6,9 @@ import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
|
|
|
6
6
|
const defaultClassName = "af-contrat";
|
|
7
7
|
const Infos = ({ infos, className, classModifier }) => {
|
|
8
8
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
9
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx("i", { className: "glyphicon glyphicon-info-sign" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) =>
|
|
9
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx("i", { className: "glyphicon glyphicon-info-sign" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
|
|
10
|
+
const idTerm = info.id ?? `info-${generateId(info)}`;
|
|
11
|
+
return (_jsxs(Fragment, { children: [_jsx("dt", { id: idTerm, className: `${defaultClassName}__word`, children: info.word }), _jsx("dd", { className: `${defaultClassName}__def`, "aria-labelledby": idTerm, children: info.definition })] }, idTerm));
|
|
12
|
+
}) })] }));
|
|
10
13
|
};
|
|
11
14
|
export { Infos };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement } from "react";
|
|
2
2
|
import { NavBarItemBase } from "./NavBarItemBase";
|
|
3
|
+
type ChildrenProps = {
|
|
4
|
+
classModifier?: string;
|
|
5
|
+
tabIndex?: number;
|
|
6
|
+
hasFocus?: boolean;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
3
9
|
type Props = Omit<ComponentProps<typeof NavBarItemBase>, "handleKeys" | "isMenuOpen" | "position"> & {
|
|
4
10
|
ariaLabel?: string;
|
|
5
|
-
children?: ReactElement | ReactElement[];
|
|
11
|
+
children?: ReactElement<ChildrenProps> | ReactElement<ChildrenProps>[];
|
|
6
12
|
};
|
|
7
13
|
declare const NavBarItem: ({ children, hasFocus, actionElt, ariaLabel, tabIndex, role, className, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
14
|
export { NavBarItem };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, KeyboardEvent, ReactElement } from "react";
|
|
2
2
|
type Props = HTMLAttributes<HTMLLIElement> & {
|
|
3
|
-
actionElt: ReactElement
|
|
3
|
+
actionElt: ReactElement<HTMLAttributes<HTMLElement>>;
|
|
4
4
|
handleKeys: (event: KeyboardEvent<HTMLLIElement>) => void;
|
|
5
5
|
hasFocus?: boolean;
|
|
6
6
|
isMenuOpen?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
|
|
2
2
|
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
idControl: string;
|
|
5
5
|
};
|
|
6
|
-
declare const ToggleButton: ({ children, idControl }: Props) => false |
|
|
6
|
+
declare const ToggleButton: ({ children, idControl }: Props) => false | ReactElement<HTMLAttributes<HTMLElement>, string | import("react").JSXElementConstructor<any>>;
|
|
7
7
|
export { ToggleButton };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Header } from "./Header";
|
|
2
|
+
export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
|
|
2
3
|
export { Infos } from "./Infos/Infos";
|
|
4
|
+
export { MenuTitleWrapper } from "./MenuTitleWrapper/MenuTitleWrapper";
|
|
3
5
|
export { Name } from "./Name/Name";
|
|
4
|
-
export {
|
|
6
|
+
export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
|
|
5
7
|
export { ToggleButton } from "./ToggleButton/ToggleButton";
|
|
6
8
|
export { User } from "./User/User";
|
|
7
|
-
export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Header } from "./Header";
|
|
2
|
+
export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
|
|
2
3
|
export { Infos } from "./Infos/Infos";
|
|
4
|
+
export { MenuTitleWrapper } from "./MenuTitleWrapper/MenuTitleWrapper";
|
|
3
5
|
export { Name } from "./Name/Name";
|
|
4
|
-
export {
|
|
6
|
+
export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
|
|
5
7
|
export { ToggleButton } from "./ToggleButton/ToggleButton";
|
|
6
8
|
export { User } from "./User/User";
|
|
7
|
-
export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
|
package/dist/Summary/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Alert } from "../Alert/Alert";
|
|
3
|
+
import { generateId } from "../utilities/helpers/generateId";
|
|
3
4
|
export const Summary = ({ messages = [], isVisible = true, title = "Invalid form", classModifier = "error", ...args }) => {
|
|
4
5
|
const messagesNotBlank = messages.filter((message) => Boolean(message));
|
|
5
6
|
if (!messages || !isVisible || messagesNotBlank.length === 0) {
|
|
6
7
|
return null;
|
|
7
8
|
}
|
|
8
|
-
return (_jsx(Alert, { icon: "glyphicon glyphicon-warning-sign", title: title, classModifier: classModifier, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${message}`))) }) }));
|
|
9
|
+
return (_jsx(Alert, { icon: "glyphicon glyphicon-warning-sign", title: title, classModifier: classModifier, ...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 })}`))) }) }));
|
|
9
10
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode, type MouseEvent } from "react";
|
|
2
2
|
export interface TabsStatelessProps {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
activeIndex: string;
|
|
@@ -6,7 +6,7 @@ export interface TabsStatelessProps {
|
|
|
6
6
|
classModifier?: string;
|
|
7
7
|
}
|
|
8
8
|
export interface TabsStatelessHandlers {
|
|
9
|
-
onChange: (event:
|
|
9
|
+
onChange: (event: MouseEvent<HTMLButtonElement>, index: string) => void;
|
|
10
10
|
}
|
|
11
11
|
type Props = TabsStatelessProps & TabsStatelessHandlers;
|
|
12
12
|
declare const TabsStateless: ({ activeIndex, className, classModifier, children, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Children, isValidElement } from "react";
|
|
2
|
+
import { Children, isValidElement, } from "react";
|
|
3
3
|
import { getComponentClassName } from "../..";
|
|
4
4
|
import { Pane } from "./Pane";
|
|
5
5
|
import { Title } from "./Title";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/common/tokens.scss";
|
|
2
3
|
import "@fontsource/source-sans-pro";
|
|
3
4
|
export { Action } from "./Action/Action";
|
|
4
5
|
export { Alert } from "./Alert/Alert";
|
|
@@ -8,7 +9,7 @@ export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Ch
|
|
|
8
9
|
export { Choice, ChoiceInput } from "./Form/Choice";
|
|
9
10
|
export { Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
|
|
10
11
|
export { Date, DateInput } from "./Form/Date";
|
|
11
|
-
export { File, FileInput, FileTable } from "./Form/File";
|
|
12
|
+
export { File, FileInput, FileTable, type FilePreview } from "./Form/File";
|
|
12
13
|
export { MultiSelect, MultiSelectInput } from "./Form/MultiSelect";
|
|
13
14
|
export { Number, NumberInput } from "./Form/Number";
|
|
14
15
|
export { Pass, PassInput } from "./Form/Pass";
|
|
@@ -17,8 +18,10 @@ export { Select, SelectBase, SelectInput } from "./Form/Select";
|
|
|
17
18
|
export { Slider, SliderInput } from "./Form/Slider";
|
|
18
19
|
export { Text, TextInput } from "./Form/Text";
|
|
19
20
|
export { Textarea, TextareaInput } from "./Form/Textarea";
|
|
21
|
+
export { NestedQuestion } from "./Form/NestedQuestion/NestedQuestion";
|
|
20
22
|
export { Footer } from "./Layout/Footer";
|
|
21
|
-
export { Header, HeaderTitle, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
|
|
23
|
+
export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
|
|
24
|
+
export { Link, type LinkProps } from "./Link/Link";
|
|
22
25
|
export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
|
|
23
26
|
export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
|
|
24
27
|
export { Step, StepBase, Steps } from "./Steps";
|
|
@@ -27,7 +30,6 @@ export { Svg } from "./Svg";
|
|
|
27
30
|
export { Tabs } from "./Tabs/Tabs";
|
|
28
31
|
export { Title } from "./Title/Title";
|
|
29
32
|
export { getComponentClassName } from "./utilities";
|
|
30
|
-
export { Link, type LinkProps } from "./Link/Link";
|
|
31
33
|
export * from "./Accordion";
|
|
32
34
|
export * from "./Popover";
|
|
33
35
|
export * from "./Table";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/common/tokens.scss";
|
|
2
3
|
import "@fontsource/source-sans-pro";
|
|
3
4
|
export { Action } from "./Action/Action";
|
|
4
5
|
export { Alert } from "./Alert/Alert";
|
|
@@ -17,8 +18,10 @@ export { Select, SelectBase, SelectInput } from "./Form/Select";
|
|
|
17
18
|
export { Slider, SliderInput } from "./Form/Slider";
|
|
18
19
|
export { Text, TextInput } from "./Form/Text";
|
|
19
20
|
export { Textarea, TextareaInput } from "./Form/Textarea";
|
|
21
|
+
export { NestedQuestion } from "./Form/NestedQuestion/NestedQuestion";
|
|
20
22
|
export { Footer } from "./Layout/Footer";
|
|
21
|
-
export { Header, HeaderTitle, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
|
|
23
|
+
export { Header, HeaderTitle, Infos, MenuTitleWrapper, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, ToggleButton, User, } from "./Layout/Header";
|
|
24
|
+
export { Link } from "./Link/Link";
|
|
22
25
|
export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
|
|
23
26
|
export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
|
|
24
27
|
export { Step, StepBase, Steps } from "./Steps";
|
|
@@ -27,7 +30,6 @@ export { Svg } from "./Svg";
|
|
|
27
30
|
export { Tabs } from "./Tabs/Tabs";
|
|
28
31
|
export { Title } from "./Title/Title";
|
|
29
32
|
export { getComponentClassName } from "./utilities";
|
|
30
|
-
export { Link } from "./Link/Link";
|
|
31
33
|
export * from "./Accordion";
|
|
32
34
|
export * from "./Popover";
|
|
33
35
|
export * from "./Table";
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.1.1-alpha.
|
|
3
|
+
"version": "1.1.1-alpha.71",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"
|
|
10
|
-
|
|
9
|
+
"default": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
11
13
|
},
|
|
12
14
|
"./utilities": {
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
+
"default": {
|
|
16
|
+
"import": "./dist/utilities.js",
|
|
17
|
+
"types": "./dist/utilities.d.ts"
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"files": [
|
|
@@ -20,19 +24,16 @@
|
|
|
20
24
|
"scripts": {
|
|
21
25
|
"prebuild": "rimraf dist",
|
|
22
26
|
"build": "tsc -p tsconfig.build.json",
|
|
27
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
23
28
|
"postbuild": "copyfiles --up 1 \"src/assets/svg/*.svg\" ./dist/",
|
|
24
|
-
"start:storybook": "storybook dev -p 6007",
|
|
25
|
-
"build:storybook": "storybook build",
|
|
26
|
-
"build-storybook": "storybook build",
|
|
27
29
|
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
28
30
|
"eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
|
|
29
31
|
"prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --check",
|
|
30
32
|
"prettier:fix": "prettier \"src/**/*.!(js|jsx|ts|tsx)\" --write",
|
|
31
|
-
"
|
|
33
|
+
"check-types": "tsc --noEmit",
|
|
32
34
|
"test": "vitest",
|
|
33
35
|
"test:ui": "vitest --ui",
|
|
34
|
-
"test:ci": "vitest run --coverage"
|
|
35
|
-
"chromatic": "npx chromatic"
|
|
36
|
+
"test:ci": "vitest run --coverage"
|
|
36
37
|
},
|
|
37
38
|
"repository": {
|
|
38
39
|
"type": "git",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
},
|
|
48
49
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@axa-fr/design-system-slash-css": "1.1.1-alpha.
|
|
51
|
+
"@axa-fr/design-system-slash-css": "1.1.1-alpha.71",
|
|
51
52
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
53
|
"react": ">= 18"
|
|
53
54
|
},
|
|
@@ -68,10 +69,21 @@
|
|
|
68
69
|
},
|
|
69
70
|
"lint-staged": {
|
|
70
71
|
"*.(js|jsx|ts|tsx)": "eslint --fix",
|
|
71
|
-
"*.(ts|tsx)": "tsc-files --noEmit"
|
|
72
|
-
"*.mdx": "prettier --write"
|
|
72
|
+
"*.(ts|tsx)": "tsc-files --noEmit"
|
|
73
73
|
},
|
|
74
74
|
"volta": {
|
|
75
75
|
"extends": "../../package.json"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@testing-library/dom": "^10.4.0",
|
|
79
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
80
|
+
"@testing-library/react": "^16.2.0",
|
|
81
|
+
"@testing-library/user-event": "^14.6.1",
|
|
82
|
+
"@types/jest": "^29.5.14",
|
|
83
|
+
"@types/jest-axe": "^3.5.9",
|
|
84
|
+
"@vitest/coverage-v8": "^3.0.7",
|
|
85
|
+
"@vitest/ui": "^3.0.7",
|
|
86
|
+
"jest-axe": "^9.0.0",
|
|
87
|
+
"vitest": "^3.0.7"
|
|
76
88
|
}
|
|
77
|
-
}
|
|
89
|
+
}
|