allaw-ui 3.1.4 → 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.
@@ -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, _e = _a.style, style = _e === void 0 ? "default" : _e, _f = _a.markType, markType = _f === void 0 ? "cross" : _f;
6
- var _g = useState(checked), isChecked = _g[0], setIsChecked = _g[1];
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
- 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" : "", " ").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("checkbox-icon-".concat(checkboxColor), " ").concat(style === "light" ? "checkbox-icon-light" : "") }))));
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;
@@ -10,14 +10,17 @@ var CheckboxForm = function (_a) {
10
10
  onChange(checked);
11
11
  }
12
12
  };
13
- // Ne pas appliquer de couleur par défaut si style="form"
14
- var defaultColor = style === "form" ? undefined : "noir";
15
- // Appliquer la couleur light si style="light", sinon utiliser la couleur fournie ou la couleur par défaut
16
- var checkboxColor = style === "light" ? "light" : color || defaultColor;
17
- return (React.createElement("div", { className: "checkbox-form checkbox-form-".concat(checkboxColor || "noir", " ").concat(size === "small" ? "checkbox-form-small" : "") },
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" : "") },
18
21
  React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style, markType: markType }),
19
22
  label && (React.createElement("label", { htmlFor: checkboxId, className: "checkbox-form-label-container" },
20
- React.createElement(Paragraph, { variant: style === "form" ? "medium" : "semiBold", color: color || defaultColor, 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,
21
24
  React.createElement("span", null, label),
22
25
  linkText && linkUrl && (React.createElement("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", className: "checkbox-form-link", onClick: onLinkClick }, linkText))), size: size }),
23
26
  isRequired && (React.createElement("span", { className: "checkbox-form-required" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",