allaw-ui 2.9.2 → 2.9.3
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.
|
@@ -12,6 +12,9 @@ export interface ColoredCheckboxProps {
|
|
|
12
12
|
markType?: "cross" | "check";
|
|
13
13
|
isSignedIn?: boolean;
|
|
14
14
|
unlinkIconPath?: any;
|
|
15
|
+
"data-tooltip-id"?: string;
|
|
16
|
+
"data-tooltip-content"?: string;
|
|
17
|
+
[key: string]: any;
|
|
15
18
|
}
|
|
16
19
|
declare const ColoredCheckbox: React.FC<ColoredCheckboxProps>;
|
|
17
20
|
export default ColoredCheckbox;
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
1
23
|
import React, { useState } from "react";
|
|
2
24
|
import styles from "./ColoredCheckbox.module.css";
|
|
3
25
|
import "../../../styles/global.css"; // Pour importer les icônes allaw
|
|
@@ -19,7 +41,7 @@ var formatEmail = function (email) {
|
|
|
19
41
|
React.createElement("span", { className: styles.emailTLD }, tld)));
|
|
20
42
|
};
|
|
21
43
|
var ColoredCheckbox = function (_a) {
|
|
22
|
-
var id = _a.id, _b = _a.label, label = _b === void 0 ? "mon-email@provider.com" : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, onChange = _a.onChange, _d = _a.boxColor, boxColor = _d === void 0 ? "#000000" : _d, _e = _a.markColor, markColor = _e === void 0 ? "#FFFFFF" : _e, _f = _a.textColor, textColor = _f === void 0 ? "#000000" : _f, _g = _a.size, size = _g === void 0 ? "default" : _g, _h = _a.markType, markType = _h === void 0 ? "cross" : _h, _j = _a.isSignedIn, isSignedIn = _j === void 0 ? true : _j, _k = _a.unlinkIconPath, unlinkIconPath = _k === void 0 ? "/assets/images/allaw-icon-unlink-red.svg" : _k;
|
|
44
|
+
var id = _a.id, _b = _a.label, label = _b === void 0 ? "mon-email@provider.com" : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, onChange = _a.onChange, _d = _a.boxColor, boxColor = _d === void 0 ? "#000000" : _d, _e = _a.markColor, markColor = _e === void 0 ? "#FFFFFF" : _e, _f = _a.textColor, textColor = _f === void 0 ? "#000000" : _f, _g = _a.size, size = _g === void 0 ? "default" : _g, _h = _a.markType, markType = _h === void 0 ? "cross" : _h, _j = _a.isSignedIn, isSignedIn = _j === void 0 ? true : _j, _k = _a.unlinkIconPath, unlinkIconPath = _k === void 0 ? "/assets/images/allaw-icon-unlink-red.svg" : _k, tooltipId = _a["data-tooltip-id"], tooltipContent = _a["data-tooltip-content"], rest = __rest(_a, ["id", "label", "checked", "onChange", "boxColor", "markColor", "textColor", "size", "markType", "isSignedIn", "unlinkIconPath", "data-tooltip-id", "data-tooltip-content"]);
|
|
23
45
|
var _l = useState(checked), isChecked = _l[0], setIsChecked = _l[1];
|
|
24
46
|
// Generate a random ID if none is provided
|
|
25
47
|
var checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
@@ -51,7 +73,7 @@ var ColoredCheckbox = function (_a) {
|
|
|
51
73
|
var formattedLabel = typeof label === "string" && label.includes("@")
|
|
52
74
|
? formatEmail(label)
|
|
53
75
|
: label;
|
|
54
|
-
return (React.createElement("div", { className: styles.container },
|
|
76
|
+
return (React.createElement("div", __assign({ className: styles.container, "data-tooltip-id": tooltipId, "data-tooltip-content": tooltipContent || (typeof label === "string" ? label : undefined) }, rest),
|
|
55
77
|
React.createElement("button", { id: checkboxId, className: "".concat(styles.checkbox, " ").concat(isChecked ? styles.checked : "", " ").concat(size === "small" ? styles.small : ""), onClick: handleClick, style: checkboxStyle, "aria-checked": isChecked, role: "checkbox", "data-cy": "checkbox-".concat(checkboxId) }, isChecked && (React.createElement("span", { className: "".concat(styles.icon, " ").concat(markType === "cross" ? "allaw-icon-close" : "allaw-icon-check"), style: markStyle }))),
|
|
56
78
|
isSignedIn === false && unlinkIconPath && (React.createElement("img", { src: unlinkIconPath.src || unlinkIconPath, alt: "Non connect\u00E9", className: styles.unlinkIcon, width: "16", height: "16", style: { width: "16px", height: "16px" } })),
|
|
57
79
|
label && (React.createElement("label", { htmlFor: checkboxId, className: styles.label, style: labelStyle, onClick: handleClick }, formattedLabel))));
|