allaw-ui 0.0.343 → 0.0.344
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/components/atoms/checkboxes/Checkbox.css +16 -0
- package/dist/components/atoms/checkboxes/Checkbox.d.ts +1 -0
- package/dist/components/atoms/checkboxes/Checkbox.js +4 -3
- package/dist/components/molecules/checkboxForm/CheckboxForm.d.ts +2 -1
- package/dist/components/molecules/checkboxForm/CheckboxForm.js +5 -3
- package/dist/styles/colors.css +1 -0
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
height: 20px;
|
|
28
28
|
border: 2px solid;
|
|
29
29
|
border-radius: 4px;
|
|
30
|
+
padding-left: 1px;
|
|
31
|
+
padding-bottom: 1px;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.checkbox-small-pressed {
|
|
@@ -114,3 +116,17 @@
|
|
|
114
116
|
border-color: var(--venom-grey-dark);
|
|
115
117
|
color: var(--venom-grey-dark);
|
|
116
118
|
}
|
|
119
|
+
|
|
120
|
+
.checkbox-light {
|
|
121
|
+
border-color: var(--mid-grey);
|
|
122
|
+
border-width: 1px;
|
|
123
|
+
color: var(--bleu-allaw);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.checkbox-icon-light {
|
|
127
|
+
color: var(--bleu-allaw);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.checkbox-icon-light-pressed {
|
|
131
|
+
padding-left: 5px;
|
|
132
|
+
}
|
|
@@ -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, _c = _a.color, color = _c === void 0 ? "noir" : _c, _d = _a.size, size = _d === void 0 ? "default" : _d;
|
|
6
|
-
var
|
|
5
|
+
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, _d = _a.size, size = _d === void 0 ? "default" : _d, _e = _a.style, style = _e === void 0 ? "default" : _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();
|
|
@@ -13,6 +13,7 @@ var Checkbox = function (_a) {
|
|
|
13
13
|
onChange(newChecked);
|
|
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 allaw-icon-close ".concat("checkbox-icon-".concat(checkboxColor), " ").concat(style === "light" ? "checkbox-icon-light" : "") }))));
|
|
17
18
|
};
|
|
18
19
|
export default Checkbox;
|
|
@@ -4,12 +4,13 @@ import "./CheckboxForm.css";
|
|
|
4
4
|
export interface CheckboxFormProps {
|
|
5
5
|
checked?: boolean;
|
|
6
6
|
onChange?: (checked: boolean) => void;
|
|
7
|
-
color?: ParagraphProps["color"]
|
|
7
|
+
color?: ParagraphProps["color"];
|
|
8
8
|
label?: React.ReactNode;
|
|
9
9
|
isRequired?: boolean;
|
|
10
10
|
linkText?: string;
|
|
11
11
|
linkUrl?: string;
|
|
12
12
|
size?: "default" | "small";
|
|
13
|
+
style?: "default" | "light";
|
|
13
14
|
}
|
|
14
15
|
declare const CheckboxForm: React.FC<CheckboxFormProps>;
|
|
15
16
|
export default CheckboxForm;
|
|
@@ -3,15 +3,17 @@ 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, _e = _a.size, size = _e === void 0 ? "default" : _e;
|
|
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, _e = _a.size, size = _e === void 0 ? "default" : _e, _f = _a.style, style = _f === void 0 ? "default" : _f;
|
|
7
7
|
var checkboxId = "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
8
8
|
var handleCheckboxChange = function (checked) {
|
|
9
9
|
if (onChange) {
|
|
10
10
|
onChange(checked);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Déterminer la couleur en fonction du style
|
|
14
|
+
var checkboxColor = style === "light" ? "light" : color;
|
|
15
|
+
return (React.createElement("div", { className: "checkbox-form checkbox-form-".concat(checkboxColor, " ").concat(size === "small" ? "checkbox-form-small" : "") },
|
|
16
|
+
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style }),
|
|
15
17
|
label && (React.createElement("label", { htmlFor: checkboxId, className: "checkbox-form-label-container" },
|
|
16
18
|
React.createElement(Paragraph, { variant: "semiBold", color: color, text: React.createElement(React.Fragment, null,
|
|
17
19
|
React.createElement("span", null, label),
|
package/dist/styles/colors.css
CHANGED