allaw-ui 2.2.2 → 2.2.4
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.
|
@@ -14,6 +14,6 @@ var Checkbox = function (_a) {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
var checkboxColor = style === "light" ? "light" : color;
|
|
17
|
-
return (React.createElement("button", { id: id, className: "checkbox ".concat(isChecked ? "checkbox-pressed" : "checkbox-default", " ").concat("checkbox-".concat(checkboxColor), " ").concat(size === "small" ? "checkbox-small" : "", " ").concat(style === "light" ? "checkbox-light" : ""), onClick: handleClick }, isChecked && (React.createElement("span", { className: "checkbox-icon ".concat(markType === "cross" ? "allaw-icon-close" : "allaw-icon-check", " ").concat("checkbox-icon-".concat(checkboxColor), " ").concat(style === "light" ? "checkbox-icon-light" : "") }))));
|
|
17
|
+
return (React.createElement("button", { id: id, className: "checkbox ".concat(isChecked ? "checkbox-pressed" : "checkbox-default", " ").concat("checkbox-".concat(checkboxColor), " ").concat(size === "small" ? "checkbox-small" : "", " ").concat(style === "light" ? "checkbox-light" : ""), onClick: handleClick, "data-cy": "checkbox-".concat(id) }, isChecked && (React.createElement("span", { className: "checkbox-icon ".concat(markType === "cross" ? "allaw-icon-close" : "allaw-icon-check", " ").concat("checkbox-icon-".concat(checkboxColor), " ").concat(style === "light" ? "checkbox-icon-light" : "") }))));
|
|
18
18
|
};
|
|
19
19
|
export default Checkbox;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ParagraphProps } from "../../atoms/typography/Paragraph";
|
|
3
3
|
import "./CheckboxForm.css";
|
|
4
4
|
export interface CheckboxFormProps {
|
|
5
|
+
id?: string;
|
|
5
6
|
checked?: boolean;
|
|
6
7
|
onChange?: (checked: boolean) => void;
|
|
7
8
|
color?: ParagraphProps["color"];
|
|
@@ -3,8 +3,8 @@ import Checkbox from "../../atoms/checkboxes/Checkbox";
|
|
|
3
3
|
import Paragraph from "../../atoms/typography/Paragraph";
|
|
4
4
|
import "./CheckboxForm.css";
|
|
5
5
|
var CheckboxForm = function (_a) {
|
|
6
|
-
var _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.color, color = _c === void 0 ? "noir" : _c, label = _a.label, _d = _a.isRequired, isRequired = _d === void 0 ? false : _d, linkText = _a.linkText, linkUrl = _a.linkUrl, onLinkClick = _a.onLinkClick, _e = _a.size, size = _e === void 0 ? "default" : _e, _f = _a.style, style = _f === void 0 ? "default" : _f, _g = _a.markType, markType = _g === void 0 ? "cross" : _g;
|
|
7
|
-
var checkboxId = "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
6
|
+
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.color, color = _c === void 0 ? "noir" : _c, label = _a.label, _d = _a.isRequired, isRequired = _d === void 0 ? false : _d, linkText = _a.linkText, linkUrl = _a.linkUrl, onLinkClick = _a.onLinkClick, _e = _a.size, size = _e === void 0 ? "default" : _e, _f = _a.style, style = _f === void 0 ? "default" : _f, _g = _a.markType, markType = _g === void 0 ? "cross" : _g;
|
|
7
|
+
var checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
8
8
|
var handleCheckboxChange = function (checked) {
|
|
9
9
|
if (onChange) {
|
|
10
10
|
onChange(checked);
|
|
@@ -12,7 +12,7 @@ var CheckboxForm = function (_a) {
|
|
|
12
12
|
};
|
|
13
13
|
var checkboxColor = style === "light" ? "light" : color;
|
|
14
14
|
return (React.createElement("div", { className: "checkbox-form checkbox-form-".concat(checkboxColor, " ").concat(size === "small" ? "checkbox-form-small" : "") },
|
|
15
|
-
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style, markType: markType
|
|
15
|
+
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style, markType: markType }),
|
|
16
16
|
label && (React.createElement("label", { htmlFor: checkboxId, className: "checkbox-form-label-container" },
|
|
17
17
|
React.createElement(Paragraph, { variant: "semiBold", color: color, text: React.createElement(React.Fragment, null,
|
|
18
18
|
React.createElement("span", null, label),
|