allaw-ui 2.8.8 → 2.8.9

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.
@@ -11,6 +11,7 @@ export interface ColoredCheckboxProps {
11
11
  size?: "default" | "small";
12
12
  markType?: "cross" | "check";
13
13
  isSignedIn?: boolean;
14
+ unlinkIconPath?: string;
14
15
  }
15
16
  declare const ColoredCheckbox: React.FC<ColoredCheckboxProps>;
16
17
  export default ColoredCheckbox;
@@ -1,6 +1,9 @@
1
1
  import React, { useState } from "react";
2
2
  import styles from "./ColoredCheckbox.module.css";
3
3
  import "../../../styles/global.css"; // Pour importer les icônes allaw
4
+ // URL data en base64 pour l'icône de déconnexion (solution de secours)
5
+ // Cette icône représente un lien brisé/déconnecté en rouge
6
+ var DEFAULT_UNLINK_ICON = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTAuNjY3IDEwLjY2N0w4LjY2NyA4LjY2NyIgc3Ryb2tlPSIjRkYwMDAwIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZD0iTTEyLjY2NyA0LjY2N0MxMy40MDMgNS40MDMgMTMuNDAzIDYuNTk3IDEyLjY2NyA3LjMzM0MxMS45MyA4LjA3IDEwLjczNyA4LjA3IDEwIDcuMzMzQzkuMjYzIDYuNTk3IDkuMjYzIDUuNDAzIDEwIDQuNjY3QzEwLjczNyAzLjkzIDExLjkzIDMuOTMgMTIuNjY3IDQuNjY3WiIgc3Ryb2tlPSIjRkYwMDAwIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZD0iTTUuMzMzIDExLjMzM0M2LjA3IDEyLjA3IDcuMjYzIDEyLjA3IDggMTEuMzMzQzguNzM3IDEwLjU5NyA4LjczNyA5LjQwMyA4IDguNjY3QzcuMjYzIDcuOTMgNi4wNyA3LjkzIDUuMzMzIDguNjY3QzQuNTk3IDkuNDAzIDQuNTk3IDEwLjU5NyA1LjMzMyAxMS4zMzNaIiBzdHJva2U9IiNGRjAwMDAiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48cGF0aCBkPSJNNy4zMzMgNy4zMzNMNS4zMzMgNS4zMzMiIHN0cm9rZT0iI0ZGMDAwMCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==";
4
7
  // Fonction pour formater l'email avec des ellipses intelligentes
5
8
  var formatEmail = function (email) {
6
9
  if (!email || typeof email !== "string" || !email.includes("@")) {
@@ -19,8 +22,9 @@ var formatEmail = function (email) {
19
22
  React.createElement("span", { className: styles.emailTLD }, tld)));
20
23
  };
21
24
  var ColoredCheckbox = function (_a) {
22
- var id = _a.id, label = _a.label, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.boxColor, boxColor = _c === void 0 ? "#000000" : _c, _d = _a.markColor, markColor = _d === void 0 ? "#FFFFFF" : _d, _e = _a.textColor, textColor = _e === void 0 ? "#000000" : _e, _f = _a.size, size = _f === void 0 ? "default" : _f, _g = _a.markType, markType = _g === void 0 ? "cross" : _g, _h = _a.isSignedIn, isSignedIn = _h === void 0 ? true : _h;
23
- var _j = useState(checked), isChecked = _j[0], setIsChecked = _j[1];
25
+ 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;
26
+ var _l = useState(checked), isChecked = _l[0], setIsChecked = _l[1];
27
+ var _m = useState(false), iconError = _m[0], setIconError = _m[1];
24
28
  // Generate a random ID if none is provided
25
29
  var checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
26
30
  var handleClick = function (e) {
@@ -53,7 +57,7 @@ var ColoredCheckbox = function (_a) {
53
57
  : label;
54
58
  return (React.createElement("div", { className: styles.container },
55
59
  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
- isSignedIn === false && (React.createElement("img", { src: "/assets/allaw-icon-unlink-red.svg", alt: "Non connect\u00E9", className: styles.unlinkIcon })),
60
+ isSignedIn === false && (React.createElement("img", { src: iconError ? DEFAULT_UNLINK_ICON : unlinkIconPath, alt: "Non connect\u00E9", className: styles.unlinkIcon, width: "16", height: "16", style: { width: "16px", height: "16px" }, onError: function () { return setIconError(true); } })),
57
61
  label && (React.createElement("label", { htmlFor: checkboxId, className: styles.label, style: labelStyle, onClick: handleClick }, formattedLabel))));
58
62
  };
59
63
  export default ColoredCheckbox;
@@ -62,6 +62,11 @@ declare namespace _default {
62
62
  let defaultValue_3: boolean;
63
63
  export { defaultValue_3 as defaultValue };
64
64
  }
65
+ export namespace unlinkIconPath {
66
+ let control_8: string;
67
+ export { control_8 as control };
68
+ export let description: string;
69
+ }
65
70
  }
66
71
  export namespace parameters {
67
72
  namespace backgrounds {
@@ -93,4 +98,5 @@ export const LongEmailLabelVerySmallContainer: any;
93
98
  export const NotSignedIn: any;
94
99
  export const NotSignedInEmail: any;
95
100
  export const NotSignedInChecked: any;
101
+ export const CustomIconPath: any;
96
102
  import ColoredCheckbox from "./ColoredCheckbox";
@@ -30,7 +30,7 @@ export default {
30
30
  },
31
31
  boxColor: {
32
32
  control: "color",
33
- defaultValue: "#000000",
33
+ defaultValue: "#25beeb",
34
34
  },
35
35
  markColor: {
36
36
  control: "color",
@@ -49,7 +49,7 @@ export default {
49
49
  markType: {
50
50
  control: {
51
51
  type: "select",
52
- options: ["cross", "check"],
52
+ options: ["check", "cross"],
53
53
  },
54
54
  },
55
55
  isSignedIn: {
@@ -58,6 +58,10 @@ export default {
58
58
  },
59
59
  defaultValue: true,
60
60
  },
61
+ unlinkIconPath: {
62
+ control: "text",
63
+ description: "Chemin vers l'icône de déconnexion",
64
+ },
61
65
  },
62
66
  parameters: {
63
67
  backgrounds: {
@@ -129,3 +133,6 @@ export var NotSignedInEmail = Template.bind({});
129
133
  NotSignedInEmail.args = __assign(__assign({}, EmailLabel.args), { label: "vincent.desbrosses@hotmail.com", isSignedIn: false });
130
134
  export var NotSignedInChecked = Template.bind({});
131
135
  NotSignedInChecked.args = __assign(__assign({}, NotSignedIn.args), { checked: true });
136
+ // Exemple avec un chemin d'icône personnalisé
137
+ export var CustomIconPath = Template.bind({});
138
+ CustomIconPath.args = __assign({}, NotSignedIn.args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.8.8",
3
+ "version": "2.8.9",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",