allaw-ui 2.8.9 → 2.9.0

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,7 +11,9 @@ export interface ColoredCheckboxProps {
11
11
  size?: "default" | "small";
12
12
  markType?: "cross" | "check";
13
13
  isSignedIn?: boolean;
14
- unlinkIconPath?: string;
14
+ unlinkIconPath?: string | {
15
+ default: string;
16
+ };
15
17
  }
16
18
  declare const ColoredCheckbox: React.FC<ColoredCheckboxProps>;
17
19
  export default ColoredCheckbox;
@@ -55,9 +55,20 @@ var ColoredCheckbox = function (_a) {
55
55
  var formattedLabel = typeof label === "string" && label.includes("@")
56
56
  ? formatEmail(label)
57
57
  : label;
58
+ // Gérer les différents formats d'importation d'image
59
+ var getIconPath = function () {
60
+ if (!unlinkIconPath)
61
+ return DEFAULT_UNLINK_ICON;
62
+ // Si c'est un objet importé (comme avec import x from 'y')
63
+ if (typeof unlinkIconPath === "object" && unlinkIconPath.default) {
64
+ return unlinkIconPath.default;
65
+ }
66
+ // Si c'est une chaîne de caractères
67
+ return unlinkIconPath;
68
+ };
58
69
  return (React.createElement("div", { className: styles.container },
59
70
  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 }))),
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); } })),
71
+ isSignedIn === false && (React.createElement("img", { src: iconError ? DEFAULT_UNLINK_ICON : getIconPath(), alt: "Non connect\u00E9", className: styles.unlinkIcon, width: "16", height: "16", style: { width: "16px", height: "16px" }, onError: function () { return setIconError(true); } })),
61
72
  label && (React.createElement("label", { htmlFor: checkboxId, className: styles.label, style: labelStyle, onClick: handleClick }, formattedLabel))));
62
73
  };
63
74
  export default ColoredCheckbox;
@@ -4,13 +4,17 @@ declare namespace _default {
4
4
  export let tags: string[];
5
5
  export namespace args {
6
6
  let label: string;
7
+ let checked: boolean;
8
+ let boxColor: string;
9
+ let markType: string;
7
10
  }
8
11
  export namespace argTypes {
9
- export namespace checked {
12
+ export namespace checked_1 {
10
13
  namespace control {
11
14
  let type: string;
12
15
  }
13
16
  }
17
+ export { checked_1 as checked };
14
18
  export namespace onChange {
15
19
  let action: string;
16
20
  }
@@ -19,11 +23,12 @@ declare namespace _default {
19
23
  export { control_1 as control };
20
24
  }
21
25
  export { label_1 as label };
22
- export namespace boxColor {
26
+ export namespace boxColor_1 {
23
27
  let control_2: string;
24
28
  export { control_2 as control };
25
29
  export let defaultValue: string;
26
30
  }
31
+ export { boxColor_1 as boxColor };
27
32
  export namespace markColor {
28
33
  let control_3: string;
29
34
  export { control_3 as control };
@@ -44,7 +49,7 @@ declare namespace _default {
44
49
  }
45
50
  export { control_5 as control };
46
51
  }
47
- export namespace markType {
52
+ export namespace markType_1 {
48
53
  export namespace control_6 {
49
54
  let type_2: string;
50
55
  export { type_2 as type };
@@ -53,6 +58,7 @@ declare namespace _default {
53
58
  }
54
59
  export { control_6 as control };
55
60
  }
61
+ export { markType_1 as markType };
56
62
  export namespace isSignedIn {
57
63
  export namespace control_7 {
58
64
  let type_3: string;
@@ -16,7 +16,10 @@ export default {
16
16
  component: ColoredCheckbox,
17
17
  tags: ["autodocs"],
18
18
  args: {
19
- label: "Sample label",
19
+ label: "my-email-address@provider.com",
20
+ checked: true,
21
+ boxColor: "#25beeb",
22
+ markType: "check",
20
23
  },
21
24
  argTypes: {
22
25
  checked: {
@@ -49,7 +52,7 @@ export default {
49
52
  markType: {
50
53
  control: {
51
54
  type: "select",
52
- options: ["check", "cross"],
55
+ options: ["cross", "check"],
53
56
  },
54
57
  },
55
58
  isSignedIn: {
@@ -85,13 +88,13 @@ var Template = function (args) {
85
88
  };
86
89
  export var Default = Template.bind({});
87
90
  Default.args = {
88
- checked: false,
89
- label: "Default Checkbox",
90
- boxColor: "#000000",
91
+ checked: true,
92
+ label: "my-email-address@provider.com",
93
+ boxColor: "#25beeb",
91
94
  markColor: "#FFFFFF",
92
95
  textColor: "#000000",
93
96
  size: "default",
94
- markType: "cross",
97
+ markType: "check",
95
98
  isSignedIn: true,
96
99
  };
97
100
  export var Checked = Template.bind({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.8.9",
3
+ "version": "2.9.0",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",