@axa-fr/design-system-slash-react 2.0.4-alpha.60 → 2.0.4-alpha.62
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.
|
@@ -10,7 +10,6 @@ declare const Radio: import("react").ForwardRefExoticComponent<(({
|
|
|
10
10
|
} & Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
11
11
|
options: Option[];
|
|
12
12
|
orientation?: "horizontal" | "vertical";
|
|
13
|
-
error?: boolean;
|
|
14
13
|
}, "ref"> & {
|
|
15
14
|
mode: "cardRadio";
|
|
16
15
|
}) | Omit<{
|
|
@@ -4,7 +4,6 @@ import type { Option } from "../core";
|
|
|
4
4
|
type Props = ComponentProps<"input"> & {
|
|
5
5
|
options: Option[];
|
|
6
6
|
orientation?: "horizontal" | "vertical";
|
|
7
|
-
error?: boolean;
|
|
8
7
|
};
|
|
9
|
-
export declare const RadioCardGroup: ({ children, options, className, value, name, orientation, disabled,
|
|
8
|
+
export declare const RadioCardGroup: ({ children, options, className, value, name, orientation, disabled, "aria-invalid": ariaInvalid, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Form/Radio/RadioCardGroup.css";
|
|
3
|
-
import { useId
|
|
3
|
+
import { useId } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { Svg } from "../../Svg";
|
|
6
6
|
const DEFAULT_CLASSNAME = "af-card";
|
|
7
7
|
const DEFAULT_CONTAINER_CLASSNAME = "af-form__radio-card-group";
|
|
8
|
-
export const RadioCardGroup = ({ children, options, className, value, name, orientation = "vertical", disabled = false,
|
|
8
|
+
export const RadioCardGroup = ({ children, options, className, value, name, orientation = "vertical", disabled = false, "aria-invalid": ariaInvalid, ...otherProps }) => {
|
|
9
9
|
const idGenerated = useId();
|
|
10
|
-
|
|
11
|
-
return (_jsxs("div", { ref: radioGroupRef, role: "radiogroup", className: classNames([
|
|
10
|
+
return (_jsxs("div", { className: classNames([
|
|
12
11
|
DEFAULT_CONTAINER_CLASSNAME,
|
|
13
12
|
className,
|
|
14
13
|
orientation === "horizontal" &&
|
|
@@ -18,7 +17,7 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
|
|
|
18
17
|
const allClassNames = classNames([
|
|
19
18
|
DEFAULT_CLASSNAME,
|
|
20
19
|
orientation === "horizontal" && `${DEFAULT_CLASSNAME}--horizontal`,
|
|
21
|
-
|
|
20
|
+
ariaInvalid && `${DEFAULT_CLASSNAME}--error`,
|
|
22
21
|
]);
|
|
23
22
|
const isDisabled = disabled || optionDisabled;
|
|
24
23
|
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));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Field, useOptionsWithId } from "../core";
|
|
4
4
|
import { Radio, RadioModes } from "./Radio";
|
|
5
5
|
const RadioInput = forwardRef(({ label, mode = "default", options, children, ...props }, inputRef) => {
|
|
6
6
|
const labelPosition = mode === RadioModes.classic ? "top" : "center";
|
|
7
7
|
const newOptions = useOptionsWithId(options);
|
|
8
|
-
return (_jsx(Field, { label: label, labelPosition: labelPosition, roleContainer:
|
|
8
|
+
return (_jsx(Field, { label: label, labelPosition: labelPosition, roleContainer: "radiogroup", ...props, renderInput: ({ classModifier, ...radioProps }) => (_jsx(Radio, { options: newOptions, mode: mode, classModifier: classModifier, ref: inputRef, ...radioProps, children: children })) }));
|
|
9
9
|
});
|
|
10
10
|
RadioInput.displayName = "EnhancedInputRadio";
|
|
11
11
|
export { RadioInput };
|
package/dist/Form/core/Field.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import { FieldError, FormClassManager, HelpMessage, useInputClassModifier, } from ".";
|
|
4
|
+
import { FieldError, FormClassManager, HelpMessage, MessageTypes, useInputClassModifier, } from ".";
|
|
5
5
|
import { getComponentClassName } from "../../utilities";
|
|
6
6
|
import { useAriaInvalid } from "./useAriaInvalid";
|
|
7
7
|
function isIdDefined(id) {
|
|
8
8
|
return typeof id === "string" && id.length > 0;
|
|
9
9
|
}
|
|
10
|
-
export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType, required, classModifier = "", disabled = false, helpMessage, id, isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, labelPosition = "center", classNameSuffix = "text", renderInput, appendChildren, ...otherProps }) => {
|
|
10
|
+
export const Field = ({ classNameContainerInput = "col-md-10", classNameContainerLabel = "col-md-2", className, label, forceDisplayMessage, message, messageType = MessageTypes.error, required, classModifier = "", disabled = false, helpMessage, id, isVisible = true, roleContainer, ariaLabelContainer, isLabelContainerLinkedToInput = true, labelPosition = "center", classNameSuffix = "text", renderInput, appendChildren, ...otherProps }) => {
|
|
11
11
|
const inputUseId = useId();
|
|
12
12
|
const inputId = isIdDefined(id) ? id : inputUseId;
|
|
13
13
|
const actualRequired = required || classModifier.includes("required");
|
|
@@ -28,7 +28,7 @@ export const Field = ({ classNameContainerInput = "col-md-10", classNameContaine
|
|
|
28
28
|
return (_jsxs("div", { className: classNames("row", groupClassName, {
|
|
29
29
|
"af-form__group--required": actualRequired,
|
|
30
30
|
"af-form__group--label-top": labelPosition === "top",
|
|
31
|
-
}), role: roleContainer, "aria-label": ariaLabelContainer, "aria-labelledby": isGroup ? labelId : undefined, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx(LabelElement, { className: classNames("af-form__group-label", {
|
|
31
|
+
}), role: roleContainer, "aria-invalid": isGroup ? isInvalid : undefined, "aria-required": isGroup ? required : undefined, "aria-label": ariaLabelContainer, "aria-labelledby": isGroup ? labelId : undefined, "aria-errormessage": isGroup && isInvalid ? errorId : undefined, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx(LabelElement, { className: classNames("af-form__group-label", {
|
|
32
32
|
"af-form__group-label--required": actualRequired,
|
|
33
33
|
}), htmlFor: isLabelContainerLinkedToInput ? inputId : undefined, id: labelId, children: label }) }), _jsxs("div", { className: classNameContainerInput, children: [_jsx("div", { className: fieldContainerClassName, children: renderInput({
|
|
34
34
|
classModifier: `${inputClassModifier} ${modifiers}`,
|
|
@@ -4,5 +4,5 @@ import { MessageTypes } from "./MessageTypes";
|
|
|
4
4
|
const DEFAULT_CLASS_NAME = "af-form__message";
|
|
5
5
|
export const FieldError = ({ message = null, messageType = MessageTypes.error, errorId = undefined, }) => {
|
|
6
6
|
const className = getComponentClassName(DEFAULT_CLASS_NAME, messageType, DEFAULT_CLASS_NAME);
|
|
7
|
-
return (message && (_jsxs("small", { className: className, children: [_jsx("span", { className: "glyphicon glyphicon-exclamation-sign" }), _jsx("span", { id: errorId, className: `af-form__${messageType}-text`, children: message })] })));
|
|
7
|
+
return (message && (_jsxs("small", { className: className, children: [_jsx("span", { className: "glyphicon glyphicon-exclamation-sign" }), _jsx("span", { id: errorId, role: "alert", className: `af-form__${messageType}-text`, children: message })] })));
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "2.0.4-alpha.
|
|
3
|
+
"version": "2.0.4-alpha.62",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@axa-fr/design-system-slash-css": "2.0.4-alpha.
|
|
50
|
+
"@axa-fr/design-system-slash-css": "2.0.4-alpha.62",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
53
53
|
"react": ">= 18"
|