@axa-fr/design-system-slash-react 1.2.1-alpha.9 → 1.2.1-alpha.94

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.
Files changed (86) hide show
  1. package/dist/Card/Card.d.ts +13 -0
  2. package/dist/Card/Card.js +6 -0
  3. package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
  4. package/dist/Form/Checkbox/CheckboxInput.js +6 -16
  5. package/dist/Form/Checkbox/CheckboxItem.js +3 -1
  6. package/dist/Form/Choice/Choice.d.ts +3 -2
  7. package/dist/Form/Choice/Choice.js +1 -2
  8. package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
  9. package/dist/Form/Choice/ChoiceInput.js +4 -17
  10. package/dist/Form/Date/DateInput.d.ts +6 -42
  11. package/dist/Form/Date/DateInput.js +5 -11
  12. package/dist/Form/File/FileErrors.js +3 -2
  13. package/dist/Form/File/FileInput.d.ts +4 -5
  14. package/dist/Form/File/FileInput.js +6 -11
  15. package/dist/Form/File/FileTable.js +1 -1
  16. package/dist/Form/MultiSelect/MultiSelectInput.d.ts +4 -6
  17. package/dist/Form/MultiSelect/MultiSelectInput.js +6 -11
  18. package/dist/Form/Number/NumberInput.d.ts +4 -7
  19. package/dist/Form/Number/NumberInput.js +4 -11
  20. package/dist/Form/Pass/PassInput.d.ts +4 -4
  21. package/dist/Form/Pass/PassInput.js +5 -12
  22. package/dist/Form/Radio/Radio.d.ts +19 -7
  23. package/dist/Form/Radio/Radio.js +13 -4
  24. package/dist/Form/Radio/RadioCardGroup.d.ts +10 -0
  25. package/dist/Form/Radio/RadioCardGroup.js +26 -0
  26. package/dist/Form/Radio/RadioInput.d.ts +5 -43
  27. package/dist/Form/Radio/RadioInput.js +6 -11
  28. package/dist/Form/Select/Select.d.ts +52 -52
  29. package/dist/Form/Select/SelectInput.d.ts +96 -108
  30. package/dist/Form/Select/SelectInput.js +5 -11
  31. package/dist/Form/Slider/Slider.d.ts +3 -0
  32. package/dist/Form/Slider/Slider.js +3 -0
  33. package/dist/Form/Slider/SliderInput.d.ts +7 -6
  34. package/dist/Form/Slider/SliderInput.js +7 -12
  35. package/dist/Form/Text/TextInput.d.ts +3 -5
  36. package/dist/Form/Text/TextInput.js +4 -7
  37. package/dist/Form/Textarea/TextareaInput.d.ts +3 -5
  38. package/dist/Form/Textarea/TextareaInput.js +5 -12
  39. package/dist/Form/core/{LegacyField.d.ts → Deprecated/Field.d.ts} +4 -0
  40. package/dist/Form/core/{LegacyField.js → Deprecated/Field.js} +7 -3
  41. package/dist/Form/core/{FieldForm.d.ts → Deprecated/FieldForm.d.ts} +7 -2
  42. package/dist/Form/core/{FieldForm.js → Deprecated/FieldForm.js} +8 -3
  43. package/dist/Form/core/{FieldInput.d.ts → Deprecated/FieldInput.d.ts} +4 -0
  44. package/dist/Form/core/{FieldInput.js → Deprecated/FieldInput.js} +5 -1
  45. package/dist/Form/core/Field.d.ts +58 -6
  46. package/dist/Form/core/Field.js +23 -10
  47. package/dist/Form/core/FormClassManager.js +4 -1
  48. package/dist/Form/core/HelpMessage.d.ts +2 -1
  49. package/dist/Form/core/HelpMessage.js +1 -1
  50. package/dist/Form/core/index.d.ts +7 -4
  51. package/dist/Form/core/index.js +3 -3
  52. package/dist/Layout/Footer/Footer.js +1 -1
  53. package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.d.ts +16 -0
  54. package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.js +20 -0
  55. package/dist/Layout/Header/HeaderTitle/HeaderTitle.d.ts +5 -1
  56. package/dist/Layout/Header/HeaderTitle/HeaderTitle.js +7 -2
  57. package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.js +1 -1
  58. package/dist/Layout/Header/User/InnerUser.js +1 -1
  59. package/dist/Loader/Loader.js +1 -1
  60. package/dist/Messages/Message.d.ts +47 -0
  61. package/dist/Messages/Message.js +43 -0
  62. package/dist/ModalAgent/BooleanModal.d.ts +28 -3
  63. package/dist/ModalAgent/BooleanModal.js +1 -1
  64. package/dist/ModalAgent/Modal.d.ts +17 -3
  65. package/dist/ModalAgent/Modal.js +15 -2
  66. package/dist/ModalAgent/components/Header.d.ts +25 -5
  67. package/dist/ModalAgent/components/Header.js +4 -3
  68. package/dist/Popover/AnimatedPopover.js +1 -1
  69. package/dist/Steps/StepBase.js +5 -3
  70. package/dist/Steps/VerticalStep.d.ts +16 -0
  71. package/dist/Steps/VerticalStep.js +22 -0
  72. package/dist/Steps/index.d.ts +1 -0
  73. package/dist/Steps/index.js +1 -0
  74. package/dist/Steps/types.d.ts +8 -0
  75. package/dist/Steps/types.js +1 -0
  76. package/dist/Summary/index.d.ts +3 -3
  77. package/dist/Summary/index.js +3 -2
  78. package/dist/Svg/Svg.js +1 -1
  79. package/dist/Table/Pagination/Li.js +1 -4
  80. package/dist/index.d.ts +10 -2
  81. package/dist/index.js +9 -2
  82. package/dist/utilities/helpers/getComponentClassName.d.ts +7 -0
  83. package/dist/utilities/helpers/getComponentClassName.js +14 -0
  84. package/package.json +4 -4
  85. package/dist/Alert/Alert.d.ts +0 -17
  86. package/dist/Alert/Alert.js +0 -14
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps } from "react";
2
+ import "@axa-fr/design-system-slash-css/dist/Card/Card.css";
3
+ type CardProps = ComponentProps<"button"> & {
4
+ /** By default : *vertical* */
5
+ orientation?: "vertical" | "horizontal";
6
+ /** icon url, for exemple from "@material-symbols" :
7
+ *
8
+ * import villaIcon from "@material-symbols/svg-400/outlined/villa.svg"; */
9
+ iconSrc?: string;
10
+ error?: boolean;
11
+ };
12
+ export declare const Card: ({ children, className, iconSrc, orientation, error, ...otherProps }: CardProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import { Svg } from "../Svg";
4
+ import "@axa-fr/design-system-slash-css/dist/Card/Card.css";
5
+ const DEFAULT_CLASS_NAME = "af-card";
6
+ export const Card = ({ children, className, iconSrc, orientation = "vertical", error = false, ...otherProps }) => (_jsxs("button", { type: "button", className: classNames(DEFAULT_CLASS_NAME, error && `${DEFAULT_CLASS_NAME}--error`, orientation === "horizontal" && `${DEFAULT_CLASS_NAME}--${orientation}`, className), ...otherProps, children: [iconSrc ? _jsx(Svg, { src: iconSrc }) : null, children] }));
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps } from "react";
2
- import { LegacyField } from "../core";
2
+ import { type ConsumerFieldProps } from "../core";
3
3
  import { Checkbox } from "./Checkbox";
4
- type Props = Omit<ComponentProps<typeof Checkbox> & ComponentProps<typeof LegacyField>, "children" | "placeholder">;
4
+ type Props = Omit<ComponentProps<typeof Checkbox> & ConsumerFieldProps, "children" | "placeholder">;
5
5
  declare const CheckboxInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
6
6
  export { CheckboxInput };
@@ -1,23 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useId } from "react";
3
- import { LegacyField, MessageTypes, useOptionsWithId } from "../core";
2
+ import { forwardRef } from "react";
3
+ import { Field, useOptionsWithId } from "../core";
4
4
  import { Checkbox } from "./Checkbox";
5
5
  import { CheckboxModes } from "./CheckboxModes";
6
- import { useAriaInvalid } from "../core/useAriaInvalid";
7
- const CheckboxInput = forwardRef(({ mode, messageType, message, classModifier, options, classNameContainerLabel, classNameContainerInput, label, isVisible, className, forceDisplayMessage, required, ...checkboxProps }, inputRef) => {
8
- let rowModifier = classModifier;
9
- if (mode === CheckboxModes.classic) {
10
- rowModifier += " label-top";
11
- }
12
- if (required) {
13
- rowModifier += " required";
14
- }
15
- const errorUseId = useId();
6
+ const CheckboxInput = forwardRef(({ label, mode = "default", options, ...otherProps }, inputRef) => {
16
7
  const newOptions = useOptionsWithId(options);
17
- 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 }) }));
8
+ return (_jsx(Field, { label: label, labelPosition: mode === CheckboxModes.classic ? "top" : "center", roleContainer: "group", ...otherProps, renderInput: ({ classModifier, id, ariaInvalid, errorId, ...props }) => {
9
+ return (_jsx(Checkbox, { id: id, mode: mode, options: newOptions, classModifier: ariaInvalid ? `${classModifier} error` : classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }));
10
+ } }));
21
11
  });
22
12
  CheckboxInput.displayName = "CheckboxInput";
23
13
  export { CheckboxInput };
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import check from "@material-symbols/svg-400/sharp/check.svg";
2
3
  import { forwardRef, useId } from "react";
3
4
  import { getOptionClassName } from "../core";
4
5
  import "@axa-fr/design-system-slash-css/dist/Form/Checkbox/Checkbox.scss";
6
+ import { Svg } from "../../Svg";
5
7
  const CheckboxItem = forwardRef(({ disabled = false, value = "", id, children, label, isChecked, className, classModifier, ...otherProps }, inputRef) => {
6
8
  const newLabel = children || label;
7
9
  const generatedId = useId();
8
10
  const newId = id ?? generatedId; // id is required on this component
9
11
  const optionClassName = getOptionClassName(className ?? "", classModifier ?? "", "af-form__checkbox", disabled);
10
- return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-checkbox", value: value, id: newId, disabled: disabled, checked: isChecked, type: "checkbox", ref: inputRef }), _jsxs("label", { className: "af-form__label", htmlFor: newId, children: [_jsx("span", { className: "af-form__indicator", children: _jsx("i", { className: "glyphicon glyphicon-ok" }) }), _jsx("span", { className: "af-form__description", children: newLabel })] })] }));
12
+ return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-checkbox", value: value, id: newId, disabled: disabled, checked: isChecked, type: "checkbox", ref: inputRef }), _jsxs("label", { className: "af-form__label", htmlFor: newId, children: [_jsx("span", { className: "af-form__indicator", children: _jsx(Svg, { role: "presentation", className: "ok-icon", src: check }) }), _jsx("span", { className: "af-form__description", children: newLabel })] })] }));
11
13
  });
12
14
  CheckboxItem.displayName = "CheckboxItem";
13
15
  export { CheckboxItem };
@@ -1,13 +1,14 @@
1
- import "@axa-fr/design-system-slash-css/dist/Form/Choice/Choice.scss";
2
1
  import { type ComponentProps } from "react";
3
2
  import { Radio } from "../Radio";
4
3
  import { type Option } from "../core";
5
- type Props = Omit<ComponentProps<typeof Radio>, "options"> & {
4
+ type Props = Omit<ComponentProps<typeof Radio>, "options" | "value"> & {
6
5
  id: string;
7
6
  name?: string;
8
7
  options?: Array<Omit<Option, "value"> & {
9
8
  value: boolean;
10
9
  }>;
10
+ value?: boolean | string;
11
+ classModifier?: string;
11
12
  };
12
13
  declare const Choice: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
13
14
  export { Choice };
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import "@axa-fr/design-system-slash-css/dist/Form/Choice/Choice.scss";
3
2
  import { forwardRef, useId } from "react";
4
3
  import { Radio } from "../Radio";
5
4
  import { useOptionsWithId } from "../core";
@@ -13,7 +12,7 @@ const Choice = forwardRef(({ children, value, options = defaultOptions, name, ..
13
12
  value: `${o.value}`,
14
13
  })));
15
14
  const generatedId = useId();
16
- return (_jsx(Radio, { ...otherProps, ref: inputRef, name: name ?? `choice_${generatedId}`, value: value?.toString(), options: choiceOptions, children: children }));
15
+ return (_jsx(Radio, { ...otherProps, mode: "default", ref: inputRef, name: name ?? `choice_${generatedId}`, value: value?.toString(), options: choiceOptions, children: children }));
17
16
  });
18
17
  Choice.displayName = "Choice";
19
18
  export { Choice };
@@ -1,6 +1,6 @@
1
1
  import { type ComponentProps } from "react";
2
- import { LegacyField } from "../core";
2
+ import { type ConsumerFieldProps } from "../core";
3
3
  import { Choice } from "./Choice";
4
- type Props = ComponentProps<typeof Choice> & Omit<ComponentProps<typeof LegacyField>, "children">;
4
+ type Props = ComponentProps<typeof Choice> & Omit<ConsumerFieldProps, "children">;
5
5
  declare const ChoiceInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
6
6
  export { ChoiceInput };
@@ -1,26 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useId } from "react";
3
- import { LegacyField, useInputClassModifier, useOptionsWithId } from "../core";
2
+ import { forwardRef } from "react";
3
+ import { Field } from "../core";
4
4
  import { Choice } from "./Choice";
5
- import { useAriaInvalid } from "../core/useAriaInvalid";
6
5
  const defaultOptions = [
7
6
  { label: "Oui", value: true },
8
7
  { label: "Non", value: false },
9
8
  ];
10
- const ChoiceInput = forwardRef(({ id, name, messageType, message, className, classModifier, isVisible, classNameContainerLabel, classNameContainerInput, label, forceDisplayMessage, options = defaultOptions, disabled, required, ...otherProps }, inputRef) => {
11
- const errorUseId = useId();
12
- const newOptions = useOptionsWithId(options.map((o) => ({
13
- ...o,
14
- value: `${o.value}`,
15
- })));
16
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier ?? "", disabled ?? false, false, required);
17
- const firstId = newOptions?.[0]?.id ?? "";
18
- const choiceOptions = newOptions.map((o) => ({
19
- ...o,
20
- value: o.value === "true",
21
- }));
22
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
23
- return (_jsx(LegacyField, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: _jsx(Choice, { ...otherProps, id: id, name: name, ref: inputRef, classModifier: inputClassModifier, options: options ? choiceOptions : undefined, required: required, disabled: disabled, "aria-describedby": errorUseId, "aria-invalid": isInvalid }) }));
9
+ const ChoiceInput = forwardRef(({ label, options = defaultOptions, ...otherProps }, inputRef) => {
10
+ return (_jsx(Field, { label: label, roleContainer: "radiogroup", ...otherProps, renderInput: ({ classModifier, id, errorId, ariaInvalid, ...props }) => (_jsx(Choice, { id: id, ref: inputRef, classModifier: classModifier, "aria-describedby": errorId, "aria-invalid": ariaInvalid, options: options, ...props })) }));
24
11
  });
25
12
  ChoiceInput.displayName = "ChoiceInput";
26
13
  export { ChoiceInput };
@@ -1,44 +1,8 @@
1
- import { ReactNode } from "react";
2
- 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
- } & {
40
- placeholder?: string;
1
+ import { ComponentProps, ReactNode } from "react";
2
+ import { ConsumerFieldProps } from "../core";
3
+ import { Date } from "./Date";
4
+ type Props = Omit<ConsumerFieldProps & ComponentProps<typeof Date> & {
41
5
  helpMessage?: ReactNode;
42
- children?: ReactNode;
43
- } & import("react").RefAttributes<HTMLInputElement>>;
6
+ }, "renderInput" | "children">;
7
+ declare const DateInput: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
44
8
  export { DateInput };
@@ -1,15 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useId } from "react";
3
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { Field } from "../core";
4
4
  import { Date } from "./Date";
5
- 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) => {
7
- const inputUseId = useId();
8
- const errorUseId = useId();
9
- const inputId = id ?? inputUseId;
10
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
11
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
12
- return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__date", classModifier: inputFieldClassModifier, children: [_jsx(Date, { id: inputId, classModifier: inputClassModifier, disabled: disabled, required: required, ref: ref, "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...otherProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
5
+ const DateInput = forwardRef(({ rightElement, ...otherProps }, inputRef) => {
6
+ return (_jsx(Field, { ...otherProps, renderInput: ({ id, classModifier, ariaInvalid, errorId }) => (_jsxs(_Fragment, { children: [_jsx(Date, { id: id, classModifier: classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...otherProps }), rightElement] })) }));
13
7
  });
14
8
  DateInput.displayName = "DateInput";
15
9
  export { DateInput };
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- const FileErrors = ({ errors }) => (_jsxs("div", { className: "af-form__file-errors", children: [_jsx("span", { children: "Le chargement de certains fichiers a \u00E9chou\u00E9 : " }), _jsx("ul", { className: "af-form__file-errors-list", children: errors &&
3
- errors.map((err) => (_jsxs("li", { children: [err.file.name, " (", err.file.size, ")"] }, err.file.name))) })] }));
2
+ const FileErrors = ({ errors }) => (_jsxs("div", { className: "af-form__file-errors", children: [_jsx("span", { children: "Le chargement de certains fichiers a \u00E9chou\u00E9 : " }), _jsx("ul", { className: "af-form__file-errors-list", children: errors
3
+ ? errors.map((err) => (_jsxs("li", { children: [err.file.name, " (", err.file.size, ")"] }, err.file.name)))
4
+ : null })] }));
4
5
  export { FileErrors };
@@ -1,14 +1,13 @@
1
1
  import "@axa-fr/design-system-slash-css/dist/Form/File/File.scss";
2
2
  import { ComponentPropsWithoutRef, ReactNode } from "react";
3
- import { LegacyField } from "../core";
3
+ import { type ConsumerFieldProps } from "../core";
4
4
  import { File } from "./File";
5
5
  import { FileTable } from "./FileTable";
6
- type FieldProps = ComponentPropsWithoutRef<typeof LegacyField>;
7
6
  type FileProps = ComponentPropsWithoutRef<typeof File>;
8
7
  type FileTableProps = ComponentPropsWithoutRef<typeof FileTable>;
9
- type Props = FieldProps & FileProps & Pick<FileTableProps, "values" | "errors"> & {
8
+ type Props = Omit<ConsumerFieldProps & FileProps & Pick<FileTableProps, "values" | "errors"> & {
10
9
  fileLabel?: string;
11
10
  helpMessage?: ReactNode;
12
- };
13
- declare const FileInput: ({ values, name, onChange, classModifier, message, children, helpMessage, id, forceDisplayMessage, messageType, classNameContainerLabel, classNameContainerInput, label, isVisible, className, errors, fileLabel, disabled, required, ...otherFileProps }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ }, "children">;
12
+ declare const FileInput: ({ values, id, name, onChange, rightElement, label, errors, fileLabel, classModifier, ...otherFileProps }: Props) => import("react/jsx-runtime").JSX.Element;
14
13
  export { FileInput };
@@ -1,11 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-slash-css/dist/Form/File/File.scss";
3
3
  import { useId } from "react";
4
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
4
+ import { Field } from "../core";
5
5
  import { File } from "./File";
6
6
  import { FileTable } from "./FileTable";
7
- import { useAriaInvalid } from "../core/useAriaInvalid";
8
- const FileInput = ({ values = [], name = "", onChange, classModifier = "", message, children, helpMessage, id = "", forceDisplayMessage, messageType, classNameContainerLabel, classNameContainerInput, label, isVisible, className, errors, fileLabel, disabled = false, required, ...otherFileProps }) => {
7
+ const FileInput = ({ values = [], id, name = "", onChange, rightElement, label, errors, fileLabel, classModifier, ...otherFileProps }) => {
9
8
  const onDeleteClick = (selectedId, selectInputId) => {
10
9
  const newValues = values.filter((element) => element.id !== selectedId);
11
10
  onChange({
@@ -15,12 +14,8 @@ const FileInput = ({ values = [], name = "", onChange, classModifier = "", messa
15
14
  fileAction: "delete",
16
15
  });
17
16
  };
18
- const inputUseId = useId();
19
- const errorUseId = useId();
20
- const inputId = id ?? inputUseId;
21
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
22
- const rowModifier = `${inputFieldClassModifier} label-top`;
23
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
24
- return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__file", classModifier: inputFieldClassModifier, children: [_jsx(File, { id: inputId, name: name, onChange: onChange, disabled: disabled, classModifier: inputClassModifier, label: fileLabel, required: required || classModifier?.includes("required"), "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...otherFileProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message }), _jsx(FileTable, { errors: errors, values: values, onClick: (selectedId) => onDeleteClick(selectedId, inputId), classModifier: classModifier })] }));
17
+ const generatedId = useId();
18
+ const actualId = id ?? generatedId;
19
+ return (_jsx(Field, { label: label, labelPosition: "top", id: actualId, classNameSuffix: "file", ...otherFileProps, renderInput: ({ classModifier: inputClassModifiers, id: inputId, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(File, { id: inputId, name: name, onChange: onChange, classModifier: inputClassModifiers, label: fileLabel, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), rightElement] })), appendChildren: _jsx(FileTable, { errors: errors, values: values, onClick: (selectedId) => onDeleteClick(selectedId, actualId), classModifier: classModifier }) }));
25
20
  };
26
21
  export { FileInput };
@@ -4,6 +4,6 @@ import { FileErrors } from "./FileErrors";
4
4
  import { getComponentClassName } from "../../utilities";
5
5
  const FileTable = ({ errors, values, className, classModifier, disabled, onClick, }) => {
6
6
  const componentClassName = getComponentClassName(className, classModifier, "custom-table-file af-file-table");
7
- return (_jsxs("div", { className: componentClassName, children: [errors && errors.length > 0 && _jsx(FileErrors, { errors: errors }), values && values.length > 0 && (_jsx("ul", { className: "af-form__file-list", children: values.map(({ file, id }) => (_jsx(FileLine, { disabled: disabled, file: file, onClick: onClick, id: id }, id))) }))] }));
7
+ return (_jsxs("div", { className: componentClassName, children: [errors && errors.length > 0 ? _jsx(FileErrors, { errors: errors }) : null, values && values.length > 0 ? (_jsx("ul", { className: "af-form__file-list", children: values.map(({ file, id }) => (_jsx(FileLine, { disabled: disabled, file: file, onClick: onClick, id: id }, id))) })) : null] }));
8
8
  };
9
9
  export { FileTable };
@@ -1,9 +1,7 @@
1
1
  import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
2
- import { type ComponentProps, type ReactNode } from "react";
3
- import { LegacyField } from "../core";
2
+ import { type ComponentProps } from "react";
3
+ import { ConsumerFieldProps } from "../core";
4
4
  import { MultiSelect } from "./MultiSelect";
5
- type Props = ComponentProps<typeof LegacyField> & ComponentProps<typeof MultiSelect> & {
6
- helpMessage?: ReactNode;
7
- };
8
- declare const MultiSelectInput: ({ classModifier, message, children, helpMessage, id, disabled, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, required, ...multiSelectProps }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ type Props = ConsumerFieldProps & ComponentProps<typeof MultiSelect>;
6
+ declare const MultiSelectInput: ({ label, ...multiSelectProps }: Props) => import("react/jsx-runtime").JSX.Element;
9
7
  export { MultiSelectInput };
@@ -1,15 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-slash-css/dist/Form/MultiSelect/MultiSelect.scss";
3
- import { useId } from "react";
4
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
3
+ import { Field } from "../core";
5
4
  import { MultiSelect } from "./MultiSelect";
6
- import { useAriaInvalid } from "../core/useAriaInvalid";
7
- const MultiSelectInput = ({ classModifier, message, children, helpMessage, id, disabled, classNameContainerLabel, classNameContainerInput, label, messageType, isVisible, forceDisplayMessage, className, required, ...multiSelectProps }) => {
8
- const { inputFieldClassModifier } = useInputClassModifier(classModifier ?? "", disabled ?? false, Boolean(children), required);
9
- const generatedId = useId();
10
- const errorUseId = useId();
11
- const inputId = id || generatedId;
12
- const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
13
- return (_jsxs(LegacyField, { label: label, id: inputId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, errorId: errorUseId, children: [_jsxs(FieldInput, { className: "af-form__select", classModifier: inputFieldClassModifier, children: [_jsx(MultiSelect, { inputId: inputId, disabled: disabled, required: required, "aria-invalid": isInvalid, "aria-errormessage": errorUseId, ...multiSelectProps }), children] }), _jsx(HelpMessage, { message: helpMessage, isVisible: !message })] }));
5
+ const MultiSelectInput = ({ label, ...multiSelectProps }) => {
6
+ return (_jsx(Field, { label: label, ...multiSelectProps, classNameSuffix: "select", renderInput: ({ id, ariaInvalid, errorId, ...props }) => {
7
+ return (_jsx(MultiSelect, { id: id, "aria-invalid": ariaInvalid, "aria-describedby": errorId, ...props }));
8
+ } }));
14
9
  };
15
10
  export { MultiSelectInput };
@@ -1,12 +1,9 @@
1
1
  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
- import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from "react";
5
- import { LegacyField } from "../core";
4
+ import { ComponentPropsWithRef } from "react";
5
+ import { type ConsumerFieldProps } from "../core";
6
6
  import { Number } from "./Number";
7
- type Props = ComponentPropsWithoutRef<typeof LegacyField> & ComponentPropsWithRef<typeof Number> & {
8
- helpMessage?: ReactNode;
9
- children?: ReactNode;
10
- };
11
- export declare const NumberInput: ({ message, children, helpMessage, id, label, classNameContainerLabel, classNameContainerInput, forceDisplayMessage, messageType, isVisible, className, disabled, classModifier, required, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ type Props = Omit<ConsumerFieldProps & ComponentPropsWithRef<typeof Number>, "children">;
8
+ export declare const NumberInput: ({ rightElement, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
12
9
  export {};
@@ -1,16 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-slash-css/dist/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
- import { useId, } from "react";
6
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
5
+ import { Field } from "../core";
7
6
  import { Number } from "./Number";
8
- import { useAriaInvalid } from "../core/useAriaInvalid";
9
- export const NumberInput = ({ message, children, helpMessage, id, label, classNameContainerLabel, classNameContainerInput, forceDisplayMessage, messageType, isVisible, className, disabled = false, classModifier = "", required, ...otherProps }) => {
10
- const inputUseId = useId();
11
- const errorUseId = useId();
12
- const inputId = id ?? inputUseId;
13
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
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 })] }));
7
+ export const NumberInput = ({ rightElement, ...props }) => {
8
+ return (_jsx(Field, { ...props, renderInput: ({ id, classModifier, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(Number, { id: id, classModifier: classModifier, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), rightElement] })) }));
16
9
  };
@@ -1,10 +1,10 @@
1
1
  import { ComponentProps, ReactNode } from "react";
2
- import { LegacyField } from "../core";
2
+ import { ConsumerFieldProps } from "../core";
3
3
  import { Pass } from "./Pass";
4
4
  type PassProps = ComponentProps<typeof Pass>;
5
- type Props = ComponentProps<typeof LegacyField> & Omit<PassProps, "onToggleType" | "type"> & {
5
+ type Props = Omit<ConsumerFieldProps & PassProps & {
6
6
  helpMessage?: ReactNode;
7
7
  score?: string;
8
- };
9
- declare const PassInput: ({ message, children, helpMessage, id, disabled, label, messageType, isVisible, forceDisplayMessage, className, classModifier, classNameContainerLabel, classNameContainerInput, score, required, ...passProps }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ }, "onToggleType" | "type" | "children">;
9
+ declare const PassInput: ({ rightElement, score, classModifier, disabled, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
10
10
  export { PassInput };
@@ -1,8 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, useState } from "react";
3
- import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Field } from "../core";
4
4
  import { Pass } from "./Pass";
5
- import { useAriaInvalid } from "../core/useAriaInvalid";
6
5
  const strengthList = {
7
6
  0: "bad",
8
7
  1: "okay",
@@ -24,15 +23,9 @@ const calculateStrength = (score) => {
24
23
  }
25
24
  return strengthList[strength];
26
25
  };
27
- const PassInput = ({ message, children, helpMessage, id, disabled = false, label, messageType, isVisible, forceDisplayMessage, className, classModifier, classNameContainerLabel, classNameContainerInput, score, required, ...passProps }) => {
26
+ const PassInput = ({ rightElement, score, classModifier, disabled, ...props }) => {
28
27
  const strength = calculateStrength(score);
29
- const classModifierStrength = [classModifier ?? "", strength ?? ""].join(" ");
30
28
  const [type, setType] = useState("password");
31
- const inputId = useId();
32
- const errorUseId = useId();
33
- const finalId = id ?? inputId;
34
- const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifierStrength, disabled, Boolean(children), required);
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 })] }) }));
29
+ return (_jsx(Field, { ...props, classModifier: classModifier, renderInput: ({ id, classModifier: modifier, ariaInvalid, errorId }) => (_jsxs(_Fragment, { children: [_jsx(Pass, { ...props, type: type, id: id, disabled: disabled, classModifier: `${modifier} ${strength}`, "aria-describedby": errorId, "aria-invalid": ariaInvalid, onToggleType: () => setType(type === "password" ? "text" : "password") }), rightElement] })) }));
37
30
  };
38
31
  export { PassInput };
@@ -1,14 +1,26 @@
1
- import { ComponentPropsWithRef } from "react";
2
1
  import type { Option } from "../core";
3
- import { RadioItem } from "./RadioItem";
4
2
  export declare enum RadioModes {
5
3
  classic = "classic",
6
4
  default = "default",
7
- inline = "inline"
5
+ inline = "inline",
6
+ card = "card"
8
7
  }
9
- type Props = Omit<ComponentPropsWithRef<typeof RadioItem>, "id" | "label" | "className"> & {
8
+ declare const Radio: import("react").ForwardRefExoticComponent<(({
10
9
  options: Option[];
11
- mode?: keyof typeof RadioModes;
12
- };
13
- declare const Radio: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
10
+ } & Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
11
+ options: Option[];
12
+ orientation?: "horizontal" | "vertical";
13
+ error?: boolean;
14
+ }, "ref"> & {
15
+ mode: "card";
16
+ }) | Omit<{
17
+ options: Option[];
18
+ } & Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "checked"> & {
19
+ classModifier?: string;
20
+ optionClassName?: string;
21
+ label?: import("react").ReactNode;
22
+ isChecked?: boolean;
23
+ }, "ref"> & import("react").RefAttributes<HTMLInputElement>, "className" | "id" | "label"> & {
24
+ mode?: "classic" | "default" | "inline";
25
+ }, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
14
26
  export { Radio };
@@ -1,11 +1,14 @@
1
1
  import { createElement as _createElement } from "react";
2
- import { forwardRef } from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { forwardRef, } from "react";
3
4
  import { RadioItem } from "./RadioItem";
5
+ import { RadioCardGroup } from "./RadioCardGroup";
4
6
  export var RadioModes;
5
7
  (function (RadioModes) {
6
8
  RadioModes["classic"] = "classic";
7
9
  RadioModes["default"] = "default";
8
10
  RadioModes["inline"] = "inline";
11
+ RadioModes["card"] = "card";
9
12
  })(RadioModes || (RadioModes = {}));
10
13
  const getClassNameMode = (mode) => {
11
14
  switch (mode) {
@@ -13,13 +16,19 @@ const getClassNameMode = (mode) => {
13
16
  return "af-form__radio";
14
17
  case RadioModes.inline:
15
18
  return "af-form__radio-inline";
19
+ case RadioModes.card:
20
+ return "af-form__radio-card";
16
21
  default:
17
22
  return "af-form__radio-custom";
18
23
  }
19
24
  };
20
- const Radio = forwardRef(({ classModifier, options, value = "", mode = RadioModes.default, children, disabled, ...otherProps }, inputRef) => {
21
- const classNameMode = getClassNameMode(mode);
22
- return options.map((option) => (_createElement(RadioItem, { ...otherProps, key: option.value, isChecked: option.value === value, disabled: option.disabled || disabled, className: classNameMode, classModifier: classModifier, ref: inputRef, ...option }, children)));
25
+ const Radio = forwardRef(({ options, value = "", children, disabled, ...otherProps }, inputRef) => {
26
+ const { mode, ...onlyNecessaryProps } = otherProps;
27
+ const classNameMode = getClassNameMode(mode ?? "default");
28
+ if (mode === "card") {
29
+ return (_jsx(RadioCardGroup, { ...onlyNecessaryProps, options: options, disabled: disabled, value: value, children: children }));
30
+ }
31
+ return options.map((option) => (_createElement(RadioItem, { ...onlyNecessaryProps, key: option.value, isChecked: option.value === value, disabled: option.disabled || disabled, className: classNameMode, ref: inputRef, ...option }, children)));
23
32
  });
24
33
  Radio.displayName = "EnhancedInputRadio";
25
34
  export { Radio };
@@ -0,0 +1,10 @@
1
+ import "@axa-fr/design-system-slash-css/dist/Form/Radio/RadioCardGroup.css";
2
+ import { ComponentProps } from "react";
3
+ import type { Option } from "../core";
4
+ type Props = ComponentProps<"input"> & {
5
+ options: Option[];
6
+ orientation?: "horizontal" | "vertical";
7
+ error?: boolean;
8
+ };
9
+ export declare const RadioCardGroup: ({ children, options, className, value, name, orientation, disabled, error, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-slash-css/dist/Form/Radio/RadioCardGroup.css";
3
+ import { useId, useRef } from "react";
4
+ import classNames from "classnames";
5
+ import { Svg } from "../../Svg";
6
+ const DEFAULT_CLASSNAME = "af-card";
7
+ const DEFAULT_CONTAINER_CLASSNAME = "af-form__radio-card-group";
8
+ export const RadioCardGroup = ({ children, options, className, value, name, orientation = "vertical", disabled = false, error = false, ...otherProps }) => {
9
+ const idGenerated = useId();
10
+ const radioGroupRef = useRef(null);
11
+ return (_jsxs("div", { ref: radioGroupRef, role: "radiogroup", className: classNames([
12
+ DEFAULT_CONTAINER_CLASSNAME,
13
+ className,
14
+ orientation === "horizontal" &&
15
+ `${DEFAULT_CONTAINER_CLASSNAME}--horizontal`,
16
+ ]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, ...otherOptionProps }) => {
17
+ const newName = name || optionName || idGenerated;
18
+ const allClassNames = classNames([
19
+ DEFAULT_CLASSNAME,
20
+ orientation === "horizontal" && `${DEFAULT_CLASSNAME}--horizontal`,
21
+ error && `${DEFAULT_CLASSNAME}--error`,
22
+ ]);
23
+ const isDisabled = disabled || optionDisabled;
24
+ return (_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue));
25
+ }), children] }));
26
+ };