@axa-fr/canopee-react 1.7.1-alpha.17 → 1.7.1-alpha.19
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.
|
@@ -8,7 +8,8 @@ const DropdownCommon = forwardRef(({ id, required, label, error, placeholder, ch
|
|
|
8
8
|
let inputId = useId();
|
|
9
9
|
inputId = id || inputId;
|
|
10
10
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
11
|
-
const
|
|
11
|
+
const hasWarning = !hasError && Boolean(message) && messageType === "warning";
|
|
12
|
+
const classname = classNames("af-form__dropdown-input", hasError && "af-form__dropdown-input--error", hasWarning && "af-form__dropdown-input--warning");
|
|
12
13
|
return (_jsxs("div", { className: "af-form__dropdown-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsxs("select", { className: classname, ...otherProps, ref: inputRef, id: inputId, children: [Boolean(placeholder) && _jsx("option", { value: "", children: placeholder }), children] }), helper ? (_jsx("span", { className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
13
14
|
});
|
|
14
15
|
DropdownCommon.displayName = "Dropdown";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
+
import { getClassName } from "../../utilities/getClassName";
|
|
3
4
|
import { ItemLabelCommon, } from "../ItemLabel/ItemLabelCommon";
|
|
4
5
|
import { ItemMessage, } from "../ItemMessage/ItemMessageCommon";
|
|
5
6
|
const TextAreaCommon = forwardRef(({ id, className, label, description, helper, error, message, messageType, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder = " ", containerProps, ...inputProps }, inputRef) => {
|
|
@@ -8,9 +9,14 @@ const TextAreaCommon = forwardRef(({ id, className, label, description, helper,
|
|
|
8
9
|
const helperId = `${inputId}-helper`;
|
|
9
10
|
const messageId = `${inputId}-error`;
|
|
10
11
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
12
|
+
const hasWarning = Boolean(message) && messageType === "warning" && !hasError;
|
|
13
|
+
const textareaClassName = getClassName({
|
|
14
|
+
baseClassName: "af-form__textarea",
|
|
15
|
+
modifiers: [hasWarning && "warning"],
|
|
16
|
+
});
|
|
11
17
|
return (_jsxs("div", { className: ["af-form__input-container", className]
|
|
12
18
|
.filter(Boolean)
|
|
13
|
-
.join(" "), ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx("textarea", { id: inputId, className:
|
|
19
|
+
.join(" "), ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx("textarea", { id: inputId, className: textareaClassName, ref: inputRef, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": helper ? helperId : undefined, required: required, "aria-invalid": hasError || undefined, placeholder: placeholder, ...inputProps }), helper ? (_jsx("span", { id: helperId, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
|
|
14
20
|
});
|
|
15
21
|
TextAreaCommon.displayName = "TextArea";
|
|
16
22
|
export { TextAreaCommon };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/canopee-react",
|
|
3
|
-
"version": "1.7.1-alpha.
|
|
3
|
+
"version": "1.7.1-alpha.19",
|
|
4
4
|
"description": "Package React - Design System Canopée",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./distributeur": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@axa-fr/canopee-css": "1.7.1-alpha.
|
|
52
|
+
"@axa-fr/canopee-css": "1.7.1-alpha.19",
|
|
53
53
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
54
54
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
55
55
|
"react": ">= 18"
|