allaw-ui 3.1.3 → 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.
- package/dist/components/atoms/checkboxes/Checkbox.css +12 -0
- package/dist/components/atoms/checkboxes/Checkbox.d.ts +1 -1
- package/dist/components/atoms/checkboxes/Checkbox.js +4 -3
- package/dist/components/atoms/checkboxes/Checkbox.stories.js +1 -1
- package/dist/components/molecules/checkboxForm/CheckboxForm.d.ts +1 -1
- package/dist/components/molecules/checkboxForm/CheckboxForm.js +10 -4
- package/dist/components/molecules/checkboxForm/CheckboxForm.stories.d.ts +4 -0
- package/dist/components/molecules/checkboxForm/CheckboxForm.stories.js +9 -1
- package/package.json +1 -1
|
@@ -130,3 +130,15 @@
|
|
|
130
130
|
.checkbox-icon-light-pressed {
|
|
131
131
|
padding-left: 5px;
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
.checkbox-style-form {
|
|
135
|
+
border: 2px solid var(--grey-venom, #e6edf5);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.checkbox-style-form:hover {
|
|
139
|
+
border-color: var(--venom-grey-dark, #d1dce8);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.checkbox-style-form.checkbox-pressed {
|
|
143
|
+
border-color: var(--venom-grey-dark, #d1dce8);
|
|
144
|
+
}
|
|
@@ -7,7 +7,7 @@ export interface CheckboxProps {
|
|
|
7
7
|
onChange?: (checked: boolean) => void;
|
|
8
8
|
color?: string;
|
|
9
9
|
size?: "default" | "small";
|
|
10
|
-
style?: "default" | "light";
|
|
10
|
+
style?: "default" | "light" | "form";
|
|
11
11
|
markType?: "cross" | "check";
|
|
12
12
|
}
|
|
13
13
|
declare const Checkbox: React.FC<CheckboxProps>;
|
|
@@ -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;
|
|
@@ -12,7 +12,7 @@ export interface CheckboxFormProps {
|
|
|
12
12
|
linkUrl?: string;
|
|
13
13
|
onLinkClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
14
14
|
size?: "default" | "small";
|
|
15
|
-
style?: "default" | "light";
|
|
15
|
+
style?: "default" | "light" | "form";
|
|
16
16
|
markType?: "cross" | "check";
|
|
17
17
|
}
|
|
18
18
|
declare const CheckboxForm: React.FC<CheckboxFormProps>;
|
|
@@ -3,18 +3,24 @@ 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 id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange,
|
|
6
|
+
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, color = _a.color, label = _a.label, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, linkText = _a.linkText, linkUrl = _a.linkUrl, onLinkClick = _a.onLinkClick, _d = _a.size, size = _d === void 0 ? "default" : _d, _e = _a.style, style = _e === void 0 ? "default" : _e, _f = _a.markType, markType = _f === void 0 ? "cross" : _f;
|
|
7
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);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
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" : "") },
|
|
15
21
|
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style, markType: markType }),
|
|
16
22
|
label && (React.createElement("label", { htmlFor: checkboxId, className: "checkbox-form-label-container" },
|
|
17
|
-
React.createElement(Paragraph, { variant: "semiBold", color: color, text: React.createElement(React.Fragment, null,
|
|
23
|
+
React.createElement(Paragraph, { variant: style === "form" ? "medium" : "semiBold", color: color || (style === "form" ? undefined : "noir"), text: React.createElement(React.Fragment, null,
|
|
18
24
|
React.createElement("span", null, label),
|
|
19
25
|
linkText && linkUrl && (React.createElement("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", className: "checkbox-form-link", onClick: onLinkClick }, linkText))), size: size }),
|
|
20
26
|
isRequired && (React.createElement("span", { className: "checkbox-form-required" },
|
|
@@ -87,4 +87,8 @@ export const Light: any;
|
|
|
87
87
|
export const LightChecked: any;
|
|
88
88
|
export const LightCheckMark: any;
|
|
89
89
|
export const LightCheckedCheckMark: any;
|
|
90
|
+
export const Form: any;
|
|
91
|
+
export const FormChecked: any;
|
|
92
|
+
export const FormCheckMark: any;
|
|
93
|
+
export const FormCheckedCheckMark: any;
|
|
90
94
|
import CheckboxForm from "./CheckboxForm";
|
|
@@ -58,7 +58,7 @@ export default {
|
|
|
58
58
|
style: {
|
|
59
59
|
control: {
|
|
60
60
|
type: "select",
|
|
61
|
-
options: ["default", "light"],
|
|
61
|
+
options: ["default", "light", "form"],
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
markType: {
|
|
@@ -147,3 +147,11 @@ export var LightCheckMark = Template.bind({});
|
|
|
147
147
|
LightCheckMark.args = __assign(__assign({}, Light.args), { label: "Light CheckboxForm with check mark", markType: "check" });
|
|
148
148
|
export var LightCheckedCheckMark = Template.bind({});
|
|
149
149
|
LightCheckedCheckMark.args = __assign(__assign({}, LightCheckMark.args), { checked: true, label: "Light Checked CheckboxForm with check mark" });
|
|
150
|
+
export var Form = Template.bind({});
|
|
151
|
+
Form.args = __assign(__assign({}, Default.args), { label: "Form CheckboxForm", style: "form" });
|
|
152
|
+
export var FormChecked = Template.bind({});
|
|
153
|
+
FormChecked.args = __assign(__assign({}, Form.args), { checked: true, label: "Form Checked CheckboxForm" });
|
|
154
|
+
export var FormCheckMark = Template.bind({});
|
|
155
|
+
FormCheckMark.args = __assign(__assign({}, Form.args), { label: "Form CheckboxForm with check mark", markType: "check" });
|
|
156
|
+
export var FormCheckedCheckMark = Template.bind({});
|
|
157
|
+
FormCheckedCheckMark.args = __assign(__assign({}, FormCheckMark.args), { checked: true, label: "Form Checked CheckboxForm with check mark" });
|