@axa-fr/design-system-slash-react 1.2.1-alpha.12 → 1.2.1-alpha.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button/Button.d.ts +11 -7
- package/dist/Button/Button.js +7 -7
- package/dist/Card/Card.d.ts +13 -0
- package/dist/Card/Card.js +6 -0
- package/dist/Divider/Divider.d.ts +7 -0
- package/dist/Divider/Divider.js +10 -0
- package/dist/Form/Checkbox/CheckboxInput.d.ts +2 -2
- package/dist/Form/Checkbox/CheckboxInput.js +6 -16
- package/dist/Form/Checkbox/CheckboxItem.js +3 -1
- package/dist/Form/Choice/Choice.d.ts +3 -2
- package/dist/Form/Choice/Choice.js +1 -2
- package/dist/Form/Choice/ChoiceInput.d.ts +2 -2
- package/dist/Form/Choice/ChoiceInput.js +4 -17
- package/dist/Form/Date/DateInput.d.ts +6 -42
- package/dist/Form/Date/DateInput.js +5 -11
- package/dist/Form/File/File.js +1 -1
- package/dist/Form/File/FileErrors.js +3 -2
- package/dist/Form/File/FileInput.d.ts +4 -5
- package/dist/Form/File/FileInput.js +6 -11
- package/dist/Form/File/FileTable.js +1 -1
- package/dist/Form/MultiSelect/FormatOptionLabel.d.ts +4 -0
- package/dist/Form/MultiSelect/FormatOptionLabel.js +12 -0
- package/dist/Form/MultiSelect/MultiSelect.d.ts +6 -3
- package/dist/Form/MultiSelect/MultiSelect.js +25 -5
- package/dist/Form/MultiSelect/MultiSelectInput.d.ts +4 -6
- package/dist/Form/MultiSelect/MultiSelectInput.js +6 -11
- package/dist/Form/MultiSelect/NoOptionsMessage.d.ts +3 -0
- package/dist/Form/MultiSelect/NoOptionsMessage.js +1 -0
- package/dist/Form/MultiSelect/ValueContainer.d.ts +4 -0
- package/dist/Form/MultiSelect/ValueContainer.js +20 -0
- package/dist/Form/MultiSelect/useMultiSelectStyle.d.ts +5 -0
- package/dist/Form/MultiSelect/useMultiSelectStyle.js +81 -0
- package/dist/Form/Number/NumberInput.d.ts +4 -7
- package/dist/Form/Number/NumberInput.js +4 -11
- package/dist/Form/Pass/PassInput.d.ts +4 -4
- package/dist/Form/Pass/PassInput.js +5 -12
- package/dist/Form/Radio/Radio.d.ts +19 -7
- package/dist/Form/Radio/Radio.js +13 -4
- package/dist/Form/Radio/RadioCardGroup.d.ts +10 -0
- package/dist/Form/Radio/RadioCardGroup.js +26 -0
- package/dist/Form/Radio/RadioInput.d.ts +5 -43
- package/dist/Form/Radio/RadioInput.js +6 -11
- package/dist/Form/Select/Select.d.ts +52 -52
- package/dist/Form/Select/SelectInput.d.ts +96 -108
- package/dist/Form/Select/SelectInput.js +5 -11
- package/dist/Form/Slider/Slider.d.ts +3 -0
- package/dist/Form/Slider/Slider.js +3 -0
- package/dist/Form/Slider/SliderInput.d.ts +7 -6
- package/dist/Form/Slider/SliderInput.js +7 -12
- package/dist/Form/Text/TextInput.d.ts +3 -5
- package/dist/Form/Text/TextInput.js +4 -7
- package/dist/Form/Textarea/TextareaInput.d.ts +3 -5
- package/dist/Form/Textarea/TextareaInput.js +5 -12
- package/dist/Form/core/{LegacyField.d.ts → Deprecated/Field.d.ts} +4 -0
- package/dist/Form/core/{LegacyField.js → Deprecated/Field.js} +7 -3
- package/dist/Form/core/{FieldForm.d.ts → Deprecated/FieldForm.d.ts} +7 -2
- package/dist/Form/core/{FieldForm.js → Deprecated/FieldForm.js} +8 -3
- package/dist/Form/core/{FieldInput.d.ts → Deprecated/FieldInput.d.ts} +4 -0
- package/dist/Form/core/{FieldInput.js → Deprecated/FieldInput.js} +5 -1
- package/dist/Form/core/Field.d.ts +58 -6
- package/dist/Form/core/Field.js +23 -10
- package/dist/Form/core/FormClassManager.js +4 -1
- package/dist/Form/core/HelpMessage.d.ts +2 -1
- package/dist/Form/core/HelpMessage.js +1 -1
- package/dist/Form/core/index.d.ts +7 -4
- package/dist/Form/core/index.js +3 -3
- package/dist/Layout/Footer/Footer.d.ts +2 -1
- package/dist/Layout/Footer/Footer.js +4 -2
- package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.d.ts +39 -0
- package/dist/Layout/Header/AnchorNavBar/AnchorNavBar.js +21 -0
- package/dist/Layout/Header/Header.js +2 -1
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.d.ts +5 -1
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.js +8 -3
- package/dist/Layout/Header/Infos/Infos.js +3 -1
- package/dist/Layout/Header/NavBar/NavBarBase.js +9 -8
- package/dist/Layout/Header/NavBar/NavBarItem/NavBarItem.js +1 -1
- package/dist/Layout/Header/NavBar/index.d.ts +1 -0
- package/dist/Layout/Header/NavBar/index.js +1 -0
- package/dist/Layout/Header/User/InnerUser.js +1 -1
- package/dist/Layout/MainContainer/MainContainer.d.ts +6 -0
- package/dist/Layout/MainContainer/MainContainer.js +4 -0
- package/dist/Link/Link.d.ts +1 -1
- package/dist/Link/Link.js +1 -1
- package/dist/Link/LinkAnchor.d.ts +5 -3
- package/dist/Link/LinkAnchor.js +5 -3
- package/dist/Loader/Loader.js +1 -1
- package/dist/Messages/Message.d.ts +47 -0
- package/dist/Messages/Message.js +43 -0
- package/dist/ModalAgent/BooleanModal.d.ts +28 -3
- package/dist/ModalAgent/BooleanModal.js +1 -1
- package/dist/ModalAgent/Modal.d.ts +17 -3
- package/dist/ModalAgent/Modal.js +15 -2
- package/dist/ModalAgent/components/Header.d.ts +25 -5
- package/dist/ModalAgent/components/Header.js +4 -3
- package/dist/Popover/AnimatedPopover.js +1 -1
- package/dist/Steps/StepBase.js +5 -3
- package/dist/Steps/VerticalStep.d.ts +48 -0
- package/dist/Steps/VerticalStep.js +22 -0
- package/dist/Steps/index.d.ts +1 -0
- package/dist/Steps/index.js +1 -0
- package/dist/Steps/types.d.ts +8 -0
- package/dist/Steps/types.js +1 -0
- package/dist/Summary/index.d.ts +3 -3
- package/dist/Summary/index.js +3 -2
- package/dist/Svg/Svg.js +1 -1
- package/dist/Table/Pagination/Items.d.ts +1 -1
- package/dist/Table/Pagination/Li.d.ts +2 -1
- package/dist/Table/Pagination/Li.js +2 -5
- package/dist/Table/Pagination/Pager.d.ts +5 -1
- package/dist/Table/Pagination/Pager.js +3 -3
- package/dist/Table/Pagination/PaginationButton.d.ts +2 -1
- package/dist/Table/Pagination/PaginationButton.js +2 -2
- package/dist/Table/Pagination/Paging.d.ts +2 -1
- package/dist/Table/Pagination/Paging.js +2 -2
- package/dist/Tag/Tag.d.ts +29 -0
- package/dist/Tag/Tag.js +27 -0
- package/dist/Title/Title.d.ts +2 -2
- package/dist/index.d.ts +21 -3
- package/dist/index.js +16 -3
- package/dist/utilities/helpers/getComponentClassName.d.ts +15 -0
- package/dist/utilities/helpers/getComponentClassName.js +22 -0
- package/package.json +6 -5
- package/dist/Alert/Alert.d.ts +0 -17
- package/dist/Alert/Alert.js +0 -14
- package/dist/Badge/Badge.d.ts +0 -8
- package/dist/Badge/Badge.js +0 -9
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const useMultiSelectStyle = () => {
|
|
2
|
+
// The recommended way to provide custom styles to react-select is to use the styles prop
|
|
3
|
+
// https://react-select.com/styles#the-styles-prop
|
|
4
|
+
const styles = {
|
|
5
|
+
container: () => ({
|
|
6
|
+
width: "100%",
|
|
7
|
+
}),
|
|
8
|
+
control: (provided, state) => ({
|
|
9
|
+
...provided,
|
|
10
|
+
whiteSpace: "normal",
|
|
11
|
+
borderRadius: "0",
|
|
12
|
+
borderColor: state.isFocused ? "var(--axablue80)" : provided.borderColor,
|
|
13
|
+
boxShadow: state.isFocused ? "0" : provided.boxShadow,
|
|
14
|
+
width: "100%",
|
|
15
|
+
cursor: state.isDisabled ? "not-allowed" : "pointer",
|
|
16
|
+
":hover": {
|
|
17
|
+
borderColor: state.isFocused
|
|
18
|
+
? "var(--axablue80)"
|
|
19
|
+
: provided.borderColor,
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
menu: (provided) => ({
|
|
23
|
+
...provided,
|
|
24
|
+
borderRadius: "0",
|
|
25
|
+
}),
|
|
26
|
+
menuList: (provided) => ({
|
|
27
|
+
...provided,
|
|
28
|
+
padding: "0",
|
|
29
|
+
}),
|
|
30
|
+
option: (provided, state) => ({
|
|
31
|
+
...provided,
|
|
32
|
+
backgroundColor: (state.isSelected && !state.isMulti) || state.isFocused
|
|
33
|
+
? "var(--axablue30)"
|
|
34
|
+
: "var(--white)",
|
|
35
|
+
color: state.isSelected || state.isFocused
|
|
36
|
+
? "var(--axablue80)"
|
|
37
|
+
: provided.color,
|
|
38
|
+
cursor: state.isDisabled ? "not-allowed" : "pointer",
|
|
39
|
+
padding: "0.406rem 0.75rem",
|
|
40
|
+
":hover": {
|
|
41
|
+
backgroundColor: "var(--axablue30)",
|
|
42
|
+
color: "var(--axablue80)",
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
singleValue: (provided) => ({
|
|
46
|
+
...provided,
|
|
47
|
+
whiteSpace: "normal",
|
|
48
|
+
}),
|
|
49
|
+
multiValue: (provided) => ({
|
|
50
|
+
...provided,
|
|
51
|
+
whiteSpace: "normal",
|
|
52
|
+
flexDirection: "row-reverse",
|
|
53
|
+
borderRadius: "0.25rem",
|
|
54
|
+
}),
|
|
55
|
+
multiValueLabel: (provided, state) => ({
|
|
56
|
+
...provided,
|
|
57
|
+
whiteSpace: "normal",
|
|
58
|
+
backgroundColor: state.isDisabled
|
|
59
|
+
? provided.backgroundColor
|
|
60
|
+
: "var(--axablue30)",
|
|
61
|
+
color: state.isDisabled ? provided.backgroundColor : "var(--axablue80)",
|
|
62
|
+
padding: "0.125rem 0.375rem 0.125rem 0.375rem",
|
|
63
|
+
borderRadius: "0 0.25rem 0.25rem 0",
|
|
64
|
+
}),
|
|
65
|
+
multiValueRemove: (provided, state) => ({
|
|
66
|
+
...provided,
|
|
67
|
+
backgroundColor: state.isDisabled
|
|
68
|
+
? provided.backgroundColor
|
|
69
|
+
: "var(--axablue30)",
|
|
70
|
+
color: state.isDisabled ? provided.color : "var(--axablue80)",
|
|
71
|
+
// borderRadius: "0.25rem 0 0 0.25rem",
|
|
72
|
+
":hover": {
|
|
73
|
+
backgroundColor: state.isDisabled
|
|
74
|
+
? provided.backgroundColor
|
|
75
|
+
: "var(--axablue40)",
|
|
76
|
+
color: state.isDisabled ? provided.color : "var(--axablue80)",
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
return { styles };
|
|
81
|
+
};
|
|
@@ -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 {
|
|
5
|
-
import {
|
|
4
|
+
import { ComponentPropsWithRef } from "react";
|
|
5
|
+
import { type ConsumerFieldProps } from "../core";
|
|
6
6
|
import { Number } from "./Number";
|
|
7
|
-
type Props =
|
|
8
|
-
|
|
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 {
|
|
6
|
-
import { FieldInput, HelpMessage, LegacyField, useInputClassModifier, } from "../core";
|
|
5
|
+
import { Field } from "../core";
|
|
7
6
|
import { Number } from "./Number";
|
|
8
|
-
|
|
9
|
-
|
|
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 {
|
|
2
|
+
import { ConsumerFieldProps } from "../core";
|
|
3
3
|
import { Pass } from "./Pass";
|
|
4
4
|
type PassProps = ComponentProps<typeof Pass>;
|
|
5
|
-
type Props =
|
|
5
|
+
type Props = Omit<ConsumerFieldProps & PassProps & {
|
|
6
6
|
helpMessage?: ReactNode;
|
|
7
7
|
score?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const PassInput: ({
|
|
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 {
|
|
3
|
-
import {
|
|
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 = ({
|
|
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
|
-
|
|
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
|
-
|
|
8
|
+
declare const Radio: import("react").ForwardRefExoticComponent<(({
|
|
10
9
|
options: Option[];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 };
|
package/dist/Form/Radio/Radio.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
|
-
import {
|
|
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(({
|
|
21
|
-
const
|
|
22
|
-
|
|
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
|
+
};
|
|
@@ -1,44 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
className?: string;
|
|
7
|
-
classModifier?: string;
|
|
8
|
-
forceDisplayMessage?: boolean;
|
|
9
|
-
children: import("react").ReactNode;
|
|
10
|
-
setStateMemoryFn?: typeof import("../core/FieldForm").setStateMemory;
|
|
11
|
-
onChangeByStateFn?: typeof import("../core/FieldForm").onChangeByState;
|
|
12
|
-
setStateOnBlurFn?: typeof import("../core/FieldForm").setStateOnBlur;
|
|
13
|
-
setStateOnFocusFn?: typeof import("../core/FieldForm").setStateOnFocus;
|
|
14
|
-
initialState?: {
|
|
15
|
-
hasLostFocusOnce: boolean;
|
|
16
|
-
hasFocus: boolean;
|
|
17
|
-
hasChange: boolean;
|
|
18
|
-
memory: {
|
|
19
|
-
message?: string;
|
|
20
|
-
messageType?: import("../core").MessageTypes;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
}, "children"> & {
|
|
24
|
-
label: import("react").ReactNode;
|
|
25
|
-
children?: import("react").ReactNode;
|
|
26
|
-
id?: string;
|
|
27
|
-
classModifier?: string;
|
|
28
|
-
classNameContainerLabel?: string;
|
|
29
|
-
classNameContainerInput?: string;
|
|
30
|
-
isVisible?: boolean;
|
|
31
|
-
roleContainer?: string;
|
|
32
|
-
ariaLabelContainer?: string;
|
|
33
|
-
isLabelContainerLinkedToInput?: boolean;
|
|
34
|
-
errorId?: string;
|
|
35
|
-
} & Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "type" | "checked"> & {
|
|
36
|
-
classModifier?: string;
|
|
37
|
-
optionClassName?: string;
|
|
38
|
-
label?: import("react").ReactNode;
|
|
39
|
-
isChecked?: boolean;
|
|
40
|
-
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "label" | "className" | "id"> & {
|
|
41
|
-
options: import("../core").Option[];
|
|
42
|
-
mode?: keyof typeof RadioModes;
|
|
43
|
-
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { type ConsumerFieldProps } from "../core";
|
|
3
|
+
import { Radio } from "./Radio";
|
|
4
|
+
type RadioInputProps = Omit<ConsumerFieldProps & ComponentPropsWithoutRef<typeof Radio>, "children">;
|
|
5
|
+
declare const RadioInput: import("react").ForwardRefExoticComponent<RadioInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
44
6
|
export { RadioInput };
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Field, useOptionsWithId } from "../core";
|
|
4
4
|
import { Radio, RadioModes } from "./Radio";
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const rowModifier = `${classModifier ?? ""}${mode === RadioModes.classic ? " label-top " : ""}`;
|
|
5
|
+
const RadioInput = forwardRef(({ label, mode = "default", options, rightElement, ...props }, inputRef) => {
|
|
6
|
+
const labelPosition = mode === RadioModes.classic ? "top" : "center";
|
|
8
7
|
const newOptions = useOptionsWithId(options);
|
|
9
|
-
|
|
10
|
-
const errorUseId = useId();
|
|
11
|
-
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
12
|
-
const isInvalid = useAriaInvalid(message, forceDisplayMessage, messageType);
|
|
13
|
-
return (_jsxs(LegacyField, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier + inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, roleContainer: "radiogroup", ariaLabelContainer: ariaLabelContainer ?? label?.toString(), isLabelContainerLinkedToInput: false, errorId: errorUseId, children: [_jsx(Radio, { options: newOptions, mode: mode, classModifier: inputClassModifier, ref: inputRef, disabled: disabled, required: required || classModifier?.includes("required"), "aria-describedby": errorUseId, "aria-invalid": isInvalid, ...radioProps }), children] }));
|
|
8
|
+
return (_jsx(Field, { label: label, labelPosition: labelPosition, roleContainer: mode !== "card" ? "radiogroup" : undefined, ...props, renderInput: ({ classModifier, ariaInvalid, errorId, ...radioProps }) => (_jsxs(_Fragment, { children: [_jsx(Radio, { options: newOptions, mode: mode, classModifier: classModifier, ref: inputRef, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...radioProps }), rightElement] })) }));
|
|
14
9
|
});
|
|
15
10
|
RadioInput.displayName = "EnhancedInputRadio";
|
|
16
11
|
export { RadioInput };
|
|
@@ -1,61 +1,14 @@
|
|
|
1
1
|
import { OptionHTMLAttributes } from "react";
|
|
2
2
|
declare const Select: import("react").ForwardRefExoticComponent<(Omit<Omit<{
|
|
3
|
-
form?: string | undefined | undefined;
|
|
4
|
-
slot?: string | undefined | undefined;
|
|
5
|
-
style?: import("react").CSSProperties | undefined;
|
|
6
|
-
title?: string | undefined | undefined;
|
|
7
|
-
ref?: import("react").Ref<HTMLSelectElement> | undefined;
|
|
8
|
-
key?: import("react").Key | null | undefined;
|
|
9
|
-
defaultChecked?: boolean | undefined | undefined;
|
|
10
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
11
|
-
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
12
3
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
13
|
-
accessKey?: string | undefined | undefined;
|
|
14
|
-
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
15
|
-
autoFocus?: boolean | undefined | undefined;
|
|
16
4
|
className?: string | undefined | undefined;
|
|
17
|
-
|
|
18
|
-
contextMenu?: string | undefined | undefined;
|
|
19
|
-
dir?: string | undefined | undefined;
|
|
20
|
-
draggable?: (boolean | "true" | "false") | undefined;
|
|
21
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
22
|
-
hidden?: boolean | undefined | undefined;
|
|
5
|
+
color?: string | undefined | undefined;
|
|
23
6
|
id?: string | undefined | undefined;
|
|
24
7
|
lang?: string | undefined | undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
tabIndex?: number | undefined | undefined;
|
|
28
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
29
|
-
radioGroup?: string | undefined | undefined;
|
|
8
|
+
name?: string | undefined | undefined;
|
|
9
|
+
style?: import("react").CSSProperties | undefined;
|
|
30
10
|
role?: import("react").AriaRole | undefined;
|
|
31
|
-
|
|
32
|
-
content?: string | undefined | undefined;
|
|
33
|
-
datatype?: string | undefined | undefined;
|
|
34
|
-
inlist?: any;
|
|
35
|
-
prefix?: string | undefined | undefined;
|
|
36
|
-
property?: string | undefined | undefined;
|
|
37
|
-
rel?: string | undefined | undefined;
|
|
38
|
-
resource?: string | undefined | undefined;
|
|
39
|
-
rev?: string | undefined | undefined;
|
|
40
|
-
typeof?: string | undefined | undefined;
|
|
41
|
-
vocab?: string | undefined | undefined;
|
|
42
|
-
autoCorrect?: string | undefined | undefined;
|
|
43
|
-
autoSave?: string | undefined | undefined;
|
|
44
|
-
color?: string | undefined | undefined;
|
|
45
|
-
itemProp?: string | undefined | undefined;
|
|
46
|
-
itemScope?: boolean | undefined | undefined;
|
|
47
|
-
itemType?: string | undefined | undefined;
|
|
48
|
-
itemID?: string | undefined | undefined;
|
|
49
|
-
itemRef?: string | undefined | undefined;
|
|
50
|
-
results?: number | undefined | undefined;
|
|
51
|
-
security?: string | undefined | undefined;
|
|
52
|
-
unselectable?: "on" | "off" | undefined | undefined;
|
|
53
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
54
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
55
|
-
popoverTarget?: string | undefined | undefined;
|
|
56
|
-
inert?: boolean | undefined | undefined;
|
|
57
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
58
|
-
is?: string | undefined | undefined;
|
|
11
|
+
tabIndex?: number | undefined | undefined;
|
|
59
12
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
60
13
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
61
14
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
@@ -281,9 +234,56 @@ declare const Select: import("react").ForwardRefExoticComponent<(Omit<Omit<{
|
|
|
281
234
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
282
235
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
283
236
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
237
|
+
ref?: import("react").Ref<HTMLSelectElement> | undefined;
|
|
238
|
+
form?: string | undefined | undefined;
|
|
239
|
+
slot?: string | undefined | undefined;
|
|
240
|
+
title?: string | undefined | undefined;
|
|
241
|
+
dir?: string | undefined | undefined;
|
|
284
242
|
classModifier?: string | undefined;
|
|
243
|
+
key?: import("react").Key | null | undefined;
|
|
244
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
245
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
246
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
247
|
+
accessKey?: string | undefined | undefined;
|
|
248
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
249
|
+
autoFocus?: boolean | undefined | undefined;
|
|
250
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
251
|
+
contextMenu?: string | undefined | undefined;
|
|
252
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
253
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
254
|
+
hidden?: boolean | undefined | undefined;
|
|
255
|
+
nonce?: string | undefined | undefined;
|
|
256
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
257
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
258
|
+
radioGroup?: string | undefined | undefined;
|
|
259
|
+
about?: string | undefined | undefined;
|
|
260
|
+
content?: string | undefined | undefined;
|
|
261
|
+
datatype?: string | undefined | undefined;
|
|
262
|
+
inlist?: any;
|
|
263
|
+
prefix?: string | undefined | undefined;
|
|
264
|
+
property?: string | undefined | undefined;
|
|
265
|
+
rel?: string | undefined | undefined;
|
|
266
|
+
resource?: string | undefined | undefined;
|
|
267
|
+
rev?: string | undefined | undefined;
|
|
268
|
+
typeof?: string | undefined | undefined;
|
|
269
|
+
vocab?: string | undefined | undefined;
|
|
270
|
+
autoCorrect?: string | undefined | undefined;
|
|
271
|
+
autoSave?: string | undefined | undefined;
|
|
272
|
+
itemProp?: string | undefined | undefined;
|
|
273
|
+
itemScope?: boolean | undefined | undefined;
|
|
274
|
+
itemType?: string | undefined | undefined;
|
|
275
|
+
itemID?: string | undefined | undefined;
|
|
276
|
+
itemRef?: string | undefined | undefined;
|
|
277
|
+
results?: number | undefined | undefined;
|
|
278
|
+
security?: string | undefined | undefined;
|
|
279
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
280
|
+
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
281
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
282
|
+
popoverTarget?: string | undefined | undefined;
|
|
283
|
+
inert?: boolean | undefined | undefined;
|
|
284
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
285
|
+
is?: string | undefined | undefined;
|
|
285
286
|
disabled?: boolean | undefined | undefined;
|
|
286
|
-
name?: string | undefined | undefined;
|
|
287
287
|
value?: string | number | readonly string[] | undefined;
|
|
288
288
|
required?: boolean | undefined | undefined;
|
|
289
289
|
autoComplete?: string | undefined | undefined;
|