allaw-ui 3.1.4 → 3.1.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.
|
@@ -2,8 +2,8 @@ import React, { useState } from "react";
|
|
|
2
2
|
import "./Checkbox.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
4
|
var Checkbox = function (_a) {
|
|
5
|
-
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange,
|
|
6
|
-
var
|
|
5
|
+
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, color = _a.color, _c = _a.size, size = _c === void 0 ? "default" : _c, _d = _a.style, style = _d === void 0 ? "default" : _d, _e = _a.markType, markType = _e === void 0 ? "cross" : _e;
|
|
6
|
+
var _f = useState(checked), isChecked = _f[0], setIsChecked = _f[1];
|
|
7
7
|
var handleClick = function (e) {
|
|
8
8
|
e.preventDefault();
|
|
9
9
|
e.stopPropagation();
|
|
@@ -14,6 +14,7 @@ var Checkbox = function (_a) {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
var checkboxColor = style === "light" ? "light" : color;
|
|
17
|
-
|
|
17
|
+
var colorClass = checkboxColor ? "checkbox-".concat(checkboxColor) : "";
|
|
18
|
+
return (React.createElement("button", { id: id, className: "checkbox ".concat(isChecked ? "checkbox-pressed" : "checkbox-default", " ").concat(colorClass, " ").concat(size === "small" ? "checkbox-small" : "", " ").concat(style === "light" ? "checkbox-light" : "", " ").concat(style === "form" ? "checkbox-style-form" : ""), onClick: handleClick, "data-cy": "checkbox-".concat(id) }, isChecked && (React.createElement("span", { className: "checkbox-icon ".concat(markType === "cross" ? "allaw-icon-close" : "allaw-icon-check", " ").concat(colorClass, " ").concat(style === "light" ? "checkbox-icon-light" : "") }))));
|
|
18
19
|
};
|
|
19
20
|
export default Checkbox;
|
|
@@ -10,14 +10,17 @@ var CheckboxForm = function (_a) {
|
|
|
10
10
|
onChange(checked);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
//
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
// Déterminer la couleur à utiliser
|
|
14
|
+
var checkboxColor = style === "light"
|
|
15
|
+
? "light"
|
|
16
|
+
: style === "form"
|
|
17
|
+
? undefined
|
|
18
|
+
: color || "noir";
|
|
19
|
+
var colorClass = checkboxColor ? "checkbox-form-".concat(checkboxColor) : "";
|
|
20
|
+
return (React.createElement("div", { className: "checkbox-form ".concat(colorClass, " ").concat(size === "small" ? "checkbox-form-small" : "") },
|
|
18
21
|
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style, markType: markType }),
|
|
19
22
|
label && (React.createElement("label", { htmlFor: checkboxId, className: "checkbox-form-label-container" },
|
|
20
|
-
React.createElement(Paragraph, { variant: style === "form" ? "medium" : "semiBold", color: color ||
|
|
23
|
+
React.createElement(Paragraph, { variant: style === "form" ? "medium" : "semiBold", color: color || (style === "form" ? undefined : "noir"), text: React.createElement(React.Fragment, null,
|
|
21
24
|
React.createElement("span", null, label),
|
|
22
25
|
linkText && linkUrl && (React.createElement("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", className: "checkbox-form-link", onClick: onLinkClick }, linkText))), size: size }),
|
|
23
26
|
isRequired && (React.createElement("span", { className: "checkbox-form-required" },
|