allaw-ui 0.0.336 → 0.0.338
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.d.ts +1 -0
- package/dist/components/atoms/checkboxes/Checkbox.js +2 -2
- package/dist/components/atoms/typography/Paragraph.d.ts +1 -1
- package/dist/components/atoms/typography/Paragraph.js +4 -2
- package/dist/components/molecules/checkboxForm/CheckboxForm.css +37 -1
- package/dist/components/molecules/checkboxForm/CheckboxForm.d.ts +5 -1
- package/dist/components/molecules/checkboxForm/CheckboxForm.js +13 -7
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import "./Checkbox.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
4
|
var Checkbox = function (_a) {
|
|
5
|
-
var _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.isWhite, isWhite = _c === void 0 ? false : _c;
|
|
5
|
+
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.isWhite, isWhite = _c === void 0 ? false : _c;
|
|
6
6
|
var handleClick = function (e) {
|
|
7
7
|
e.preventDefault();
|
|
8
8
|
e.stopPropagation();
|
|
@@ -10,6 +10,6 @@ var Checkbox = function (_a) {
|
|
|
10
10
|
onChange(!checked);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
return (React.createElement("button", { className: "checkbox ".concat(checked ? "checkbox-pressed" : "checkbox-default", " ").concat(isWhite ? "checkbox-white" : "checkbox-black"), onClick: handleClick }, checked && (React.createElement("span", { className: "checkbox-icon allaw-icon-close ".concat(isWhite ? "checkbox-icon-white" : "checkbox-icon-black") }))));
|
|
13
|
+
return (React.createElement("button", { id: id, className: "checkbox ".concat(checked ? "checkbox-pressed" : "checkbox-default", " ").concat(isWhite ? "checkbox-white" : "checkbox-black"), onClick: handleClick }, checked && (React.createElement("span", { className: "checkbox-icon allaw-icon-close ".concat(isWhite ? "checkbox-icon-white" : "checkbox-icon-black") }))));
|
|
14
14
|
};
|
|
15
15
|
export default Checkbox;
|
|
@@ -9,7 +9,9 @@ var Paragraph = function (_a) {
|
|
|
9
9
|
return text.slice(0, maxChars) + "...";
|
|
10
10
|
};
|
|
11
11
|
// Tronquer le texte si maxChars est défini
|
|
12
|
-
var truncatedText = maxChars
|
|
12
|
+
var truncatedText = maxChars
|
|
13
|
+
? truncateText(text, maxChars)
|
|
14
|
+
: text;
|
|
13
15
|
return (React.createElement("p", { className: "paragraph ".concat(variant, " ").concat(color ? "color-".concat(color) : ""), style: maxLines
|
|
14
16
|
? {
|
|
15
17
|
WebkitLineClamp: maxLines,
|
|
@@ -17,6 +19,6 @@ var Paragraph = function (_a) {
|
|
|
17
19
|
WebkitBoxOrient: "vertical",
|
|
18
20
|
overflow: "hidden",
|
|
19
21
|
}
|
|
20
|
-
: {},
|
|
22
|
+
: {} }, truncatedText));
|
|
21
23
|
};
|
|
22
24
|
export default Paragraph;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.checkbox-form {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
gap:
|
|
4
|
+
gap: 0.75rem;
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -22,3 +22,39 @@
|
|
|
22
22
|
.checkbox-form-required {
|
|
23
23
|
color: var(--dark-grey, #456073);
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
.checkbox-form-link {
|
|
27
|
+
color: var(--allaw-blue, #25beeb);
|
|
28
|
+
text-decoration: underline;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
margin-left: 0.25rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Ajout des classes pour les différentes couleurs */
|
|
34
|
+
.checkbox-form-bleu-allaw input[type="checkbox"] {
|
|
35
|
+
accent-color: var(--bleu-allaw);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.checkbox-form-mid-grey input[type="checkbox"] {
|
|
39
|
+
accent-color: var(--mid-grey);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.checkbox-form-dark-grey input[type="checkbox"] {
|
|
43
|
+
accent-color: var(--dark-grey);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.checkbox-form-noir input[type="checkbox"] {
|
|
47
|
+
accent-color: var(--noir);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.checkbox-form-pure-white input[type="checkbox"] {
|
|
51
|
+
accent-color: var(--pure-white);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.checkbox-form-grey-venom input[type="checkbox"] {
|
|
55
|
+
accent-color: var(--grey-venom);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.checkbox-form-venom-grey-dark input[type="checkbox"] {
|
|
59
|
+
accent-color: var(--venom-grey-dark);
|
|
60
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ParagraphProps } from "../../atoms/typography/Paragraph";
|
|
2
3
|
import "./CheckboxForm.css";
|
|
3
4
|
export interface CheckboxFormProps {
|
|
4
5
|
checked?: boolean;
|
|
5
6
|
onChange?: (checked: boolean) => void;
|
|
7
|
+
labelColor?: ParagraphProps["color"] | "grey-venom" | "venom-grey-dark";
|
|
6
8
|
isWhite?: boolean;
|
|
7
|
-
label?:
|
|
9
|
+
label?: React.ReactNode;
|
|
8
10
|
isRequired?: boolean;
|
|
11
|
+
linkText?: string;
|
|
12
|
+
linkUrl?: string;
|
|
9
13
|
}
|
|
10
14
|
declare const CheckboxForm: React.FC<CheckboxFormProps>;
|
|
11
15
|
export default CheckboxForm;
|
|
@@ -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 _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.isWhite, isWhite =
|
|
7
|
-
var
|
|
8
|
-
|
|
6
|
+
var _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.labelColor, labelColor = _c === void 0 ? "noir" : _c, _d = _a.isWhite, isWhite = _d === void 0 ? false : _d, label = _a.label, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, linkText = _a.linkText, linkUrl = _a.linkUrl;
|
|
7
|
+
var checkboxId = "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
8
|
+
var handleLabelClick = function (e) {
|
|
9
9
|
e.stopPropagation();
|
|
10
10
|
if (onChange) {
|
|
11
11
|
onChange(!checked);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// Convertir les couleurs supplémentaires en couleurs acceptées par Paragraph
|
|
15
|
+
var paragraphColor = labelColor === "grey-venom" || labelColor === "venom-grey-dark"
|
|
16
|
+
? "noir"
|
|
17
|
+
: labelColor;
|
|
18
|
+
return (React.createElement("div", { className: "checkbox-form ".concat(isWhite ? "checkbox-form-white" : "checkbox-form-black", " checkbox-form-").concat(labelColor) },
|
|
19
|
+
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: onChange, isWhite: isWhite }),
|
|
20
|
+
label && (React.createElement("div", { className: "checkbox-form-label-container", onClick: handleLabelClick },
|
|
21
|
+
React.createElement(Paragraph, { variant: "semiBold", color: paragraphColor, text: React.createElement(React.Fragment, null,
|
|
22
|
+
React.createElement("span", null, label),
|
|
23
|
+
linkText && linkUrl && (React.createElement("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", className: "checkbox-form-link", onClick: function (e) { return e.stopPropagation(); } }, linkText))) }),
|
|
18
24
|
isRequired && (React.createElement("span", { className: "checkbox-form-required" },
|
|
19
25
|
"\u00A0",
|
|
20
26
|
"*"))))));
|