@axa-fr/design-system-slash-react 2.0.5-alpha.3 → 2.0.5
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/Radio/Radio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { RadioCardGroup } from "./RadioCardGroup";
|
|
@@ -29,9 +29,9 @@ const Radio = forwardRef(({ options, value = "", children, disabled, ...otherPro
|
|
|
29
29
|
if (mode === "cardRadio") {
|
|
30
30
|
return (_jsx(RadioCardGroup, { ...onlyNecessaryProps, options: options, disabled: disabled, value: value, children: children }));
|
|
31
31
|
}
|
|
32
|
-
return (_jsx("div", { className: classNames("af-form__radio-group", [
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: classNames("af-form__radio-group", [
|
|
33
|
+
{ "af-form__radio-group-classic": mode === RadioModes.classic },
|
|
34
|
+
]), children: options.map((option) => (_createElement(RadioItem, { ...onlyNecessaryProps, key: option.value, isChecked: option.value === value, disabled: option.disabled || disabled, className: classNameMode, ref: inputRef, ...option }))) }), children] }));
|
|
35
35
|
});
|
|
36
36
|
Radio.displayName = "EnhancedInputRadio";
|
|
37
37
|
export { Radio };
|
|
@@ -2,12 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/Form/Radio/Radio.scss";
|
|
3
3
|
import { forwardRef, useId } from "react";
|
|
4
4
|
import { getOptionClassName } from "../core";
|
|
5
|
-
const RadioItem = forwardRef(({ value = "", id, isChecked,
|
|
5
|
+
const RadioItem = forwardRef(({ value = "", id, isChecked, label, classModifier = "", className = "", disabled = false, ...otherProps }, inputRef) => {
|
|
6
6
|
const optionClassName = getOptionClassName(className, classModifier, "af-form__radio", disabled);
|
|
7
|
-
const newLabel = children || label;
|
|
8
7
|
const generatedId = useId();
|
|
9
8
|
const newId = id ?? generatedId;
|
|
10
|
-
return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-radio", id: newId, type: "radio", value: value, checked: isChecked, ref: inputRef, disabled: disabled }), _jsx("label", { className: "af-form__label", htmlFor: newId, children: _jsx("span", { className: "af-form__description", children:
|
|
9
|
+
return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-radio", id: newId, type: "radio", value: value, checked: isChecked, ref: inputRef, disabled: disabled }), _jsx("label", { className: "af-form__label", htmlFor: newId, children: _jsx("span", { className: "af-form__description", children: label }) })] }, value));
|
|
11
10
|
});
|
|
12
11
|
RadioItem.displayName = "RadioItem";
|
|
13
12
|
export { RadioItem };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "2.0.5
|
|
3
|
+
"version": "2.0.5",
|
|
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.5
|
|
50
|
+
"@axa-fr/design-system-slash-css": "2.0.5",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
53
53
|
"react": ">= 18"
|