allaw-ui 4.1.3 → 4.1.4

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.
Files changed (31) hide show
  1. package/dist/assets/allaw-font.eot +0 -0
  2. package/dist/assets/allaw-font.svg +3 -2
  3. package/dist/assets/allaw-font.ttf +0 -0
  4. package/dist/assets/allaw-font.woff +0 -0
  5. package/dist/components/atoms/inputs/SearchBar.css +28 -2
  6. package/dist/components/atoms/inputs/SearchBar.d.ts +1 -0
  7. package/dist/components/atoms/inputs/SearchBar.js +11 -3
  8. package/dist/components/atoms/inputs/SearchBar.stories.d.ts +8 -0
  9. package/dist/components/atoms/inputs/SearchBar.stories.js +14 -1
  10. package/dist/components/molecules/proSwitch/AvatarBubble.d.ts +16 -0
  11. package/dist/components/molecules/proSwitch/AvatarBubble.js +72 -0
  12. package/dist/components/molecules/proSwitch/AvatarBubble.stories.d.ts +93 -0
  13. package/dist/components/molecules/proSwitch/AvatarBubble.stories.js +215 -0
  14. package/dist/components/molecules/proSwitch/AvatarToggleGroup.d.ts +21 -0
  15. package/dist/components/molecules/proSwitch/AvatarToggleGroup.js +150 -0
  16. package/dist/components/molecules/proSwitch/AvatarToggleGroup.stories.d.ts +75 -0
  17. package/dist/components/molecules/proSwitch/AvatarToggleGroup.stories.js +276 -0
  18. package/dist/components/molecules/proSwitch/ProSwitch.d.ts +16 -0
  19. package/dist/components/molecules/proSwitch/ProSwitch.js +86 -0
  20. package/dist/components/molecules/proSwitch/ProSwitch.stories.d.ts +9 -0
  21. package/dist/components/molecules/proSwitch/ProSwitch.stories.js +144 -0
  22. package/dist/components/molecules/proSwitch/ProSwitchModal.d.ts +21 -0
  23. package/dist/components/molecules/proSwitch/ProSwitchModal.js +285 -0
  24. package/dist/components/molecules/proSwitch/ProSwitchModal.stories.d.ts +60 -0
  25. package/dist/components/molecules/proSwitch/ProSwitchModal.stories.js +194 -0
  26. package/dist/components/molecules/proSwitch/avatarBubble.module.css +116 -0
  27. package/dist/components/molecules/proSwitch/avatarToggleGroup.module.css +183 -0
  28. package/dist/components/molecules/proSwitch/proSwitch.module.css +32 -0
  29. package/dist/components/molecules/proSwitch/proSwitchModal.module.css +370 -0
  30. package/dist/styles/icons.css +3 -0
  31. package/package.json +4 -1
Binary file
@@ -7,8 +7,8 @@
7
7
  {
8
8
  "fontFamily": "allaw-font",
9
9
  "majorVersion": 1,
10
- "minorVersion": 5,
11
- "version": "Version 1.5",
10
+ "minorVersion": 6,
11
+ "version": "Version 1.6",
12
12
  "fontId": "allaw-font",
13
13
  "psName": "allaw-font",
14
14
  "subFamily": "Regular",
@@ -148,4 +148,5 @@
148
148
  <glyph unicode="&#xe97b;" glyph-name="website" data-tags="website" d="M45.742-61.901c-10.296 3.27-21.314 9.659-27.741 16.086-12.094 12.094-19.797 34.549-17.64 51.422 3.326 26.012 1.705 24.038 103.747 126.329 55.9 56.037 88.947 90.199 88.063 91.036-0.778 0.737-28.44 15.015-61.471 31.728-39.305 19.888-61.947 32.181-65.527 35.577-6.492 6.159-8.726 12.135-8.835 23.631-0.105 11.096 3.758 18.708 11.762 23.175 3.3 1.842 98.823 31.081 212.273 64.975 226.502 67.669 218.13 65.558 232.335 58.579 5.33-2.619 8.060-5.262 11.338-10.979 8.095-14.113 10.825-2.836-55.897-230.846-33.133-113.228-61.417-208.176-62.852-210.995s-4.482-6.85-6.772-8.956c-11.467-10.548-33.816-9.277-45.075 2.563-2.194 2.308-17.755 31.661-34.58 65.229s-31.15 61.38-31.836 61.803c-0.685 0.424-40.096-38.14-87.579-85.697-82.67-82.797-94.863-94.314-105.892-100.015-12.807-6.619-34.861-8.762-47.822-4.645zM497.632-62.639c-14.021 4.607-40.354 22.302-38.886 26.13 0.926 2.412 38.158 128.902 65.218 221.567 9.764 33.434 18.43 62.931 19.26 65.55l1.508 4.761h71.661c39.414 0 71.661-0.268 71.661-0.596 0-2.833-9.649-51.046-13.221-66.059-5.315-22.341-9.199-35.74-19.318-66.642-9.973-30.457-18.138-50.198-32.734-79.147-26.729-53.011-53.885-84.996-85.519-100.727-9.731-4.839-12.253-5.456-23.437-5.731-6.893-0.17-14.18 0.233-16.195 0.895zM646.475-46.014c0.589 1.007 3.861 5.786 7.271 10.62 41.368 58.644 78.164 161.599 98.421 275.382l2.608 14.648 115.317 0.375c63.424 0.207 115.317-0.153 115.317-0.799 0-2.506-14.701-34.065-23.003-49.38-46.509-85.799-109.097-150.983-190.858-198.772-19.13-11.181-49.76-26.368-67.759-33.596-12.369-4.967-56.093-20.309-57.879-20.309-0.279 0-0.028 0.824 0.564 1.831zM565.012 320.575c0 0.416 5.984 20.356 13.298 44.31 12.697 41.582 13.335 44.332 14.116 60.754 1.467 30.852-5.977 50.845-27.337 73.426-18.602 19.665-39.453 28.754-65.969 28.754-16.29 0-24.384-1.974-101.814-24.836-37.888-11.187-70.772-20.813-73.075-21.391l-4.187-1.051 0.963 16.681c2.032 35.194 3.833 62.416 4.665 70.512l0.865 8.423h371.495l0.847-6.958c6.263-51.424 6.247-186.929-0.028-241.691l-0.881-7.69h-66.479c-36.564 0-66.479 0.34-66.479 0.757zM763.377 326.044c3.256 25.424 4.425 57.636 4.425 121.944s-1.169 96.52-4.425 121.944l-0.797 6.225h246.003l3-13.028c8.686-37.723 12.35-71.888 12.35-115.141 0-43.486-2.886-71.213-11.469-110.172-1.99-9.034-3.618-16.779-3.618-17.211s-55.41-0.786-123.133-0.786h-123.133zM3.465 384.636c-0.471 2.618-1.574 17.614-2.451 33.324-2.714 48.646 1.492 99.696 11.962 145.17l3 13.028h246.003l-0.819-6.225c-2.091-15.897-3.8-42.778-4.701-73.936l-0.983-34.020-8.191-2.375c-50.76-14.717-210.663-62.564-216.49-64.778-4.192-1.593-11.683-5.609-16.646-8.923s-9.205-6.026-9.426-6.026c-0.221 0-0.788 2.142-1.259 4.761zM39.151 641.876c0 2.632 13.444 31.481 22.435 48.14 26.125 48.409 53.345 84.983 92.511 124.304 47.887 48.076 109.104 86.869 179.247 113.59 17.38 6.621 46.092 15.889 46.883 15.133 0.281-0.269-2.443-4.653-6.053-9.742-46.645-65.761-80.388-159.17-103.35-286.101l-1.060-5.859-115.306-0.375c-65.409-0.213-115.306 0.181-115.306 0.91zM336.504 641.103c0 0.272 1.681 9.665 3.736 20.873 7.283 39.731 15.296 70.898 28.778 111.929 23.028 70.086 58.558 133.478 90.080 160.72 33.516 28.965 58.495 32.731 88.551 13.352 19.925-12.847 34.684-28.441 53.367-56.385 10.922-16.336 30.975-55.366 40.522-78.87 12.024-29.604 26.375-75.738 34.629-111.324 3.448-14.866 11.888-57.673 11.888-60.295 0-0.272-79.099-0.494-175.775-0.494s-175.775 0.222-175.775 0.494zM754.719 642.44c-0.343 1.007-2.013 9.741-3.71 19.409-19.074 108.674-56.196 208.816-100.624 271.453-3.61 5.090-6.334 9.474-6.053 9.742 0.791 0.755 29.503-8.512 46.883-15.133 70.144-26.721 131.36-65.514 179.247-113.59 39.167-39.321 66.387-75.896 92.511-124.304 8.976-16.633 22.435-45.506 22.435-48.131 0-0.714-50.674-1.276-115.032-1.276-90.716 0-115.164 0.387-115.657 1.831z" />
149
149
  <glyph unicode="&#xe97c;" glyph-name="x-small" data-tags="x-small" d="M215.409 96.435c-16.271 3.272-32.785 12.856-40.751 23.65-10.406 14.101-15.343 28.71-15.343 45.403 0 16.165 4.236 29.32 14.009 43.502 3.629 5.266 76.523 77.935 231.306 230.59l8.424 8.308-51.202 50.698c-28.161 27.884-81.227 80.41-117.924 116.725-67.506 66.803-71.296 70.843-76.947 82.052-10.56 20.944-10.263 46.73 0.778 67.618 6.758 12.786 14.483 20.511 27.269 27.269 20.888 11.041 46.673 11.337 67.618 0.778 11.209-5.651 15.25-9.441 82.052-76.947 36.315-36.698 88.82-89.743 116.679-117.878l50.652-51.155 50.652 51.155c27.858 28.135 80.364 81.18 116.679 117.878 66.802 67.506 70.843 71.296 82.052 76.947 20.944 10.56 46.73 10.263 67.618-0.778 12.786-6.758 20.511-14.483 27.269-27.269 11.041-20.888 11.337-46.673 0.777-67.618-5.651-11.209-9.441-15.25-76.947-82.052-36.698-36.315-89.764-88.841-117.924-116.725l-51.201-50.698 8.424-8.308c154.783-152.656 227.677-225.324 231.306-230.59 9.772-14.182 14.009-27.337 14.009-43.502 0-16.693-4.937-31.302-15.343-45.403-6.026-8.165-18.513-16.719-30.458-20.863-18.435-6.397-40.274-4.988-57.529 3.712-11.924 6.012-13.594 7.623-132.608 127.931-63.895 64.59-116.444 117.436-116.775 117.436s-52.88-52.846-116.775-117.436c-87.268-88.217-117.667-118.465-122.18-121.569-10.374-7.137-18.608-10.688-29.817-12.856-7.131-1.379-20.998-1.382-27.846-0.004z" />
150
150
  <glyph unicode="&#xe97d;" glyph-name="play" data-tags="play" horiz-adv-x="877" d="M94.48-63.141c-32.274 5.287-63.377 26.516-79.643 54.361-6.986 11.959-12.17 28.677-13.919 44.888-1.224 11.345-1.224 812.334 0 823.68 3.044 28.221 13.476 49.939 32.911 68.519 34.712 33.184 82.082 40.948 123.653 20.265 10.169-5.059 666.111-405.913 674.048-411.918 26.288-19.891 41.424-46.683 45.222-80.048 2.187-19.213-3.817-46.177-14.211-63.816-7.59-12.88-18.692-25.036-30.619-33.527-9.888-7.039-665.618-407.55-674.44-411.939-8.208-4.084-18.146-7.57-27.483-9.641-8.259-1.832-26.744-2.261-35.519-0.823z" />
151
+ <glyph unicode="&#xe97e;" glyph-name="allaw-icon-drag" data-tags="allaw-icon-drag" d="M444.559 754.913c0-65.602-53.181-118.783-118.783-118.783s-118.783 53.181-118.783 118.783c0 65.602 53.181 118.783 118.783 118.783s118.783-53.181 118.783-118.783zM444.559 448c0-65.602-53.181-118.783-118.783-118.783s-118.783 53.181-118.783 118.783c0 65.602 53.181 118.783 118.783 118.783s118.783-53.181 118.783-118.783zM444.559 141.087c0-65.602-53.181-118.783-118.783-118.783s-118.783 53.181-118.783 118.783c0 65.602 53.181 118.783 118.783 118.783s118.783-53.181 118.783-118.783zM817.006 754.913c0-65.602-53.181-118.783-118.783-118.783s-118.783 53.181-118.783 118.783c0 65.602 53.181 118.783 118.783 118.783s118.783-53.181 118.783-118.783zM817.006 448c0-65.602-53.181-118.783-118.783-118.783s-118.783 53.181-118.783 118.783c0 65.602 53.181 118.783 118.783 118.783s118.783-53.181 118.783-118.783zM817.006 141.087c0-65.602-53.181-118.783-118.783-118.783s-118.783 53.181-118.783 118.783c0 65.602 53.181 118.783 118.783 118.783s118.783-53.181 118.783-118.783z" />
151
152
  </font></defs></svg>
Binary file
Binary file
@@ -6,7 +6,7 @@
6
6
  height: 45px;
7
7
  padding: 0px 6px 0px 14px;
8
8
  align-items: center;
9
- gap: 73px;
9
+ gap: 8px;
10
10
  flex-shrink: 0;
11
11
  border-radius: 73px;
12
12
  border: 1px solid var(--venom-grey, #e6edf5);
@@ -23,7 +23,8 @@
23
23
  opacity: 0.9;
24
24
  border: none;
25
25
  outline: none;
26
- width: 100%;
26
+ flex: 1;
27
+ width: auto;
27
28
  padding-left: 3px;
28
29
  }
29
30
 
@@ -52,3 +53,28 @@
52
53
  align-items: center;
53
54
  justify-content: center;
54
55
  }
56
+
57
+ .SearchBar-clear-button {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ width: 28px;
62
+ height: 28px;
63
+ border: none;
64
+ background: transparent;
65
+ border-radius: 50%;
66
+ cursor: pointer;
67
+ margin-right: 0;
68
+ margin-left: 0;
69
+ transition: background 0.15s;
70
+ }
71
+
72
+ .SearchBar-clear-button:hover {
73
+ background: #f6fcfe;
74
+ }
75
+
76
+ .SearchBar-clear-button i {
77
+ color: #728ea7;
78
+ font-size: 18px;
79
+ pointer-events: none;
80
+ }
@@ -7,6 +7,7 @@ export interface SearchBarProps {
7
7
  endIcon?: string;
8
8
  value?: string;
9
9
  onChange?: (value: string) => void;
10
+ showClear?: boolean;
10
11
  }
11
12
  declare const SearchBar: React.FC<SearchBarProps>;
12
13
  export default SearchBar;
@@ -3,8 +3,8 @@ import "./SearchBar.css";
3
3
  import "../../../styles/global.css";
4
4
  import "../../../styles/icons.css";
5
5
  var SearchBar = function (_a) {
6
- var _b = _a.placeholder, placeholder = _b === void 0 ? "Faites une recherche" : _b, _c = _a.endIcon, endIcon = _c === void 0 ? "allaw-icon-search" : _c, _d = _a.value, controlledValue = _d === void 0 ? "" : _d, onChange = _a.onChange;
7
- var _e = useState(controlledValue), value = _e[0], setValue = _e[1];
6
+ var _b = _a.placeholder, placeholder = _b === void 0 ? "Faites une recherche" : _b, _c = _a.endIcon, endIcon = _c === void 0 ? "allaw-icon-search" : _c, _d = _a.value, controlledValue = _d === void 0 ? "" : _d, onChange = _a.onChange, _e = _a.showClear, showClear = _e === void 0 ? false : _e;
7
+ var _f = useState(controlledValue), value = _f[0], setValue = _f[1];
8
8
  var handleChange = function (event) {
9
9
  var newValue = event.target.value;
10
10
  setValue(newValue);
@@ -12,9 +12,17 @@ var SearchBar = function (_a) {
12
12
  onChange(newValue);
13
13
  }
14
14
  };
15
+ var handleClear = function () {
16
+ setValue("");
17
+ if (onChange) {
18
+ onChange("");
19
+ }
20
+ };
15
21
  return (React.createElement("div", { className: "SearchBar" },
16
22
  React.createElement("input", { type: "text", placeholder: placeholder, className: "SearchBar-placeholder", value: controlledValue || value, onChange: handleChange }),
17
- React.createElement("button", { className: "SearchBar-icon-button" },
23
+ showClear && (controlledValue || value) && (React.createElement("button", { type: "button", className: "SearchBar-clear-button", onClick: handleClear, "aria-label": "Effacer la recherche" },
24
+ React.createElement("i", { className: "allaw-icon-x-small" }))),
25
+ React.createElement("button", { className: "SearchBar-icon-button", tabIndex: -1, "aria-label": "Rechercher" },
18
26
  React.createElement("i", { className: endIcon }))));
19
27
  };
20
28
  export default SearchBar;
@@ -10,6 +10,7 @@ declare namespace _default {
10
10
  export let excludeStories: RegExp;
11
11
  export namespace args {
12
12
  let endIcon: string;
13
+ let showClear: boolean;
13
14
  }
14
15
  export namespace argTypes {
15
16
  export namespace placeholder {
@@ -32,6 +33,12 @@ declare namespace _default {
32
33
  }
33
34
  export { control_2 as control };
34
35
  }
36
+ export namespace showClear_1 {
37
+ let control_3: string;
38
+ export { control_3 as control };
39
+ export let description: string;
40
+ }
41
+ export { showClear_1 as showClear };
35
42
  export namespace onChange_1 {
36
43
  let action_1: string;
37
44
  export { action_1 as action };
@@ -51,4 +58,5 @@ declare namespace _default {
51
58
  }
52
59
  export default _default;
53
60
  export const Default: any;
61
+ export const WithClear: any;
54
62
  import SearchBar from "./SearchBar";
@@ -21,7 +21,7 @@ export default {
21
21
  component: SearchBar,
22
22
  tags: ["autodocs"],
23
23
  excludeStories: /.*Data$/,
24
- args: __assign(__assign({}, ActionsData), { endIcon: "allaw-icon-search" }),
24
+ args: __assign(__assign({}, ActionsData), { endIcon: "allaw-icon-search", showClear: false }),
25
25
  argTypes: {
26
26
  placeholder: {
27
27
  control: {
@@ -38,6 +38,10 @@ export default {
38
38
  type: "text",
39
39
  },
40
40
  },
41
+ showClear: {
42
+ control: "boolean",
43
+ description: "Affiche une croix pour effacer le champ si true.",
44
+ },
41
45
  onChange: { action: "changed" },
42
46
  },
43
47
  parameters: {
@@ -63,5 +67,14 @@ export var Default = Template.bind({});
63
67
  Default.args = {
64
68
  placeholder: "Faites une recherche",
65
69
  endIcon: "allaw-icon-search",
70
+ showClear: false,
71
+ onChange: function (value) { return console.log("Search value:", value); },
72
+ };
73
+ export var WithClear = Template.bind({});
74
+ WithClear.args = {
75
+ placeholder: "Faites une recherche",
76
+ endIcon: "allaw-icon-search",
77
+ showClear: true,
78
+ value: "test",
66
79
  onChange: function (value) { return console.log("Search value:", value); },
67
80
  };
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ export interface AvatarBubbleProps {
3
+ firstName: string;
4
+ name: string;
5
+ src?: string;
6
+ size?: number;
7
+ isSelected?: boolean;
8
+ disabled?: boolean;
9
+ disableHoverAnimation?: boolean;
10
+ onClick?: () => void;
11
+ alt?: string;
12
+ className?: string;
13
+ borderThick?: boolean;
14
+ }
15
+ declare const AvatarBubble: React.FC<AvatarBubbleProps>;
16
+ export default AvatarBubble;
@@ -0,0 +1,72 @@
1
+ import React, { useState, useCallback } from "react";
2
+ import Image from "next/image";
3
+ import styles from "./avatarBubble.module.css";
4
+ // Fonction de hash simple (DJB2)
5
+ var hashString = function (str) {
6
+ var hash = 5381;
7
+ for (var i = 0; i < str.length; i++) {
8
+ hash = (hash << 5) + hash + str.charCodeAt(i);
9
+ }
10
+ return Math.abs(hash);
11
+ };
12
+ // Génère la couleur de fond basée sur le nom
13
+ var generateBackgroundColor = function (firstName, name) {
14
+ var fullName = "".concat(firstName, " ").concat(name).trim();
15
+ var hash = hashString(fullName);
16
+ var hue = hash % 360;
17
+ return "hsl(".concat(hue, ", 60%, 70%)");
18
+ };
19
+ // Génère les initiales
20
+ var generateInitials = function (firstName, name) {
21
+ var _a, _b;
22
+ var firstInitial = ((_a = firstName === null || firstName === void 0 ? void 0 : firstName.charAt(0)) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || "";
23
+ var lastInitial = ((_b = name === null || name === void 0 ? void 0 : name.charAt(0)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) || "";
24
+ return "".concat(firstInitial).concat(lastInitial);
25
+ };
26
+ var AvatarBubble = function (_a) {
27
+ var firstName = _a.firstName, name = _a.name, src = _a.src, _b = _a.size, size = _b === void 0 ? 42.5 : _b, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.disableHoverAnimation, disableHoverAnimation = _e === void 0 ? false : _e, onClick = _a.onClick, alt = _a.alt, _f = _a.className, className = _f === void 0 ? "" : _f, _g = _a.borderThick, borderThick = _g === void 0 ? false : _g;
28
+ var _h = useState(false), imageError = _h[0], setImageError = _h[1];
29
+ var hasValidSrc = src && src.trim() !== "";
30
+ var shouldShowInitials = !hasValidSrc || imageError;
31
+ var backgroundColor = generateBackgroundColor(firstName, name);
32
+ var initials = generateInitials(firstName, name);
33
+ var displayAlt = alt || "".concat(firstName, " ").concat(name);
34
+ var ariaLabel = "".concat(firstName, " ").concat(name).concat(isSelected ? ", sélectionné(e)" : "");
35
+ var handleImageError = useCallback(function () {
36
+ setImageError(true);
37
+ }, []);
38
+ var handleClick = useCallback(function () {
39
+ if (!disabled && onClick) {
40
+ onClick();
41
+ }
42
+ }, [disabled, onClick]);
43
+ var handleKeyDown = useCallback(function (event) {
44
+ if (event.key === "Enter" || event.key === " ") {
45
+ event.preventDefault();
46
+ handleClick();
47
+ }
48
+ }, [handleClick]);
49
+ var containerStyle = {
50
+ width: "".concat(size, "px"),
51
+ height: "".concat(size, "px"),
52
+ };
53
+ var initialsStyle = {
54
+ backgroundColor: backgroundColor,
55
+ fontSize: "".concat(Math.max(12, size * 0.4), "px"),
56
+ };
57
+ return (React.createElement("div", { className: "".concat(styles.avatarBubble, " ").concat(className, " ") +
58
+ (borderThick
59
+ ? isSelected
60
+ ? styles.selectedThick
61
+ : styles.thick
62
+ : isSelected
63
+ ? styles.selectedThin
64
+ : styles.thin), style: containerStyle, role: "button", "aria-label": ariaLabel, tabIndex: disabled ? -1 : 0, onClick: handleClick, onKeyDown: handleKeyDown, "data-selected": isSelected, "data-disabled": disabled, "data-disable-hover-animation": disableHoverAnimation }, shouldShowInitials ? (React.createElement("div", { className: styles.initials, style: initialsStyle, "aria-label": displayAlt }, initials)) : (React.createElement("div", { className: styles.imageContainer },
65
+ React.createElement(Image, { src: src, alt: displayAlt, width: size, height: size, className: styles.image, onError: handleImageError, onLoad: function () { return setImageError(false); }, style: {
66
+ objectFit: "cover",
67
+ width: "100%",
68
+ height: "100%",
69
+ borderRadius: "50%",
70
+ } })))));
71
+ };
72
+ export default AvatarBubble;
@@ -0,0 +1,93 @@
1
+ declare namespace _default {
2
+ export let title: string;
3
+ export { AvatarBubble as component };
4
+ export let tags: string[];
5
+ export namespace argTypes {
6
+ namespace firstName {
7
+ let control: string;
8
+ let description: string;
9
+ }
10
+ namespace name {
11
+ let control_1: string;
12
+ export { control_1 as control };
13
+ let description_1: string;
14
+ export { description_1 as description };
15
+ }
16
+ namespace src {
17
+ let control_2: string;
18
+ export { control_2 as control };
19
+ let description_2: string;
20
+ export { description_2 as description };
21
+ }
22
+ namespace size {
23
+ export namespace control_3 {
24
+ let type: string;
25
+ let min: number;
26
+ let max: number;
27
+ let step: number;
28
+ }
29
+ export { control_3 as control };
30
+ let description_3: string;
31
+ export { description_3 as description };
32
+ }
33
+ namespace isSelected {
34
+ let control_4: string;
35
+ export { control_4 as control };
36
+ let description_4: string;
37
+ export { description_4 as description };
38
+ }
39
+ namespace disabled {
40
+ let control_5: string;
41
+ export { control_5 as control };
42
+ let description_5: string;
43
+ export { description_5 as description };
44
+ }
45
+ namespace disableHoverAnimation {
46
+ let control_6: string;
47
+ export { control_6 as control };
48
+ let description_6: string;
49
+ export { description_6 as description };
50
+ }
51
+ namespace borderThick {
52
+ let control_7: string;
53
+ export { control_7 as control };
54
+ let description_7: string;
55
+ export { description_7 as description };
56
+ }
57
+ namespace onClick {
58
+ export let action: string;
59
+ let description_8: string;
60
+ export { description_8 as description };
61
+ }
62
+ namespace alt {
63
+ let control_8: string;
64
+ export { control_8 as control };
65
+ let description_9: string;
66
+ export { description_9 as description };
67
+ }
68
+ }
69
+ export namespace parameters {
70
+ namespace backgrounds {
71
+ let _default: string;
72
+ export { _default as default };
73
+ export let values: {
74
+ name: string;
75
+ value: string;
76
+ }[];
77
+ }
78
+ }
79
+ }
80
+ export default _default;
81
+ export const Default: any;
82
+ export const WithInitials: any;
83
+ export const Selected: any;
84
+ export const Disabled: any;
85
+ export const Small: any;
86
+ export const Large: any;
87
+ export const WithoutHoverAnimation: any;
88
+ export const SelectedWithoutHoverAnimation: any;
89
+ export function MultipleSizes(): React.JSX.Element;
90
+ export function ColorVariations(): React.JSX.Element;
91
+ export function HoverAnimationComparison(): React.JSX.Element;
92
+ import AvatarBubble from "./AvatarBubble";
93
+ import React from "react";
@@ -0,0 +1,215 @@
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
+ import React, { useState } from "react";
13
+ import { action } from "@storybook/addon-actions";
14
+ import AvatarBubble from "./AvatarBubble";
15
+ import "../../../styles/global.css";
16
+ export default {
17
+ title: "Components/Molecules/ProSwitch/AvatarBubble",
18
+ component: AvatarBubble,
19
+ tags: ["autodocs"],
20
+ argTypes: {
21
+ firstName: {
22
+ control: "text",
23
+ description: "Prénom de la personne",
24
+ },
25
+ name: {
26
+ control: "text",
27
+ description: "Nom de famille de la personne",
28
+ },
29
+ src: {
30
+ control: "text",
31
+ description: "URL de l'image de profil (optionnel)",
32
+ },
33
+ size: {
34
+ control: { type: "number", min: 20, max: 100, step: 0.5 },
35
+ description: "Taille de l'avatar en pixels (défaut: 42.5)",
36
+ },
37
+ isSelected: {
38
+ control: "boolean",
39
+ description: "État sélectionné avec anneau bleu",
40
+ },
41
+ disabled: {
42
+ control: "boolean",
43
+ description: "État désactivé (grisé)",
44
+ },
45
+ disableHoverAnimation: {
46
+ control: "boolean",
47
+ description: "Désactive l'animation au hover (translateY)",
48
+ },
49
+ borderThick: {
50
+ control: "boolean",
51
+ description: "Bordure épaisse (4px) autour de l'avatar si true, 2px sinon (défaut)",
52
+ },
53
+ onClick: {
54
+ action: "clicked",
55
+ description: "Callback appelé au clic",
56
+ },
57
+ alt: {
58
+ control: "text",
59
+ description: "Texte alternatif pour l'accessibilité",
60
+ },
61
+ },
62
+ parameters: {
63
+ backgrounds: {
64
+ default: "light",
65
+ values: [
66
+ { name: "light", value: "#ffffff" },
67
+ { name: "grey", value: "#728ea7" },
68
+ { name: "figma", value: "#404040" },
69
+ { name: "dark", value: "#171e25" },
70
+ ],
71
+ },
72
+ },
73
+ };
74
+ var Template = function (args) {
75
+ var _a = useState(args.isSelected || false), selected = _a[0], setSelected = _a[1];
76
+ var handleClick = function () {
77
+ setSelected(!selected);
78
+ action("Avatar clicked")(args);
79
+ };
80
+ return (React.createElement("div", { style: { padding: "20px" } },
81
+ React.createElement(AvatarBubble, __assign({}, args, { isSelected: selected, onClick: handleClick }))));
82
+ };
83
+ export var Default = Template.bind({});
84
+ Default.args = {
85
+ firstName: "Jean",
86
+ name: "Dupont",
87
+ src: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=150&h=150&fit=crop&crop=face",
88
+ size: 42.5,
89
+ isSelected: false,
90
+ disabled: false,
91
+ disableHoverAnimation: false,
92
+ borderThick: false,
93
+ };
94
+ export var WithInitials = Template.bind({});
95
+ WithInitials.args = {
96
+ firstName: "Marie",
97
+ name: "Martin",
98
+ src: "", // Pas d'image pour forcer l'affichage des initiales
99
+ size: 42.5,
100
+ isSelected: false,
101
+ disabled: false,
102
+ disableHoverAnimation: false,
103
+ borderThick: false,
104
+ };
105
+ export var Selected = Template.bind({});
106
+ Selected.args = {
107
+ firstName: "Pierre",
108
+ name: "Durand",
109
+ src: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&h=150&fit=crop&crop=face",
110
+ size: 42.5,
111
+ isSelected: true,
112
+ disabled: false,
113
+ disableHoverAnimation: false,
114
+ borderThick: false,
115
+ };
116
+ export var Disabled = Template.bind({});
117
+ Disabled.args = {
118
+ firstName: "Sophie",
119
+ name: "Bernard",
120
+ src: "https://images.unsplash.com/photo-1494790108755-2616b612b786?w=150&h=150&fit=crop&crop=face",
121
+ size: 42.5,
122
+ isSelected: false,
123
+ disabled: true,
124
+ disableHoverAnimation: false,
125
+ borderThick: false,
126
+ };
127
+ export var Small = Template.bind({});
128
+ Small.args = {
129
+ firstName: "Lucas",
130
+ name: "Petit",
131
+ src: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=150&h=150&fit=crop&crop=face",
132
+ size: 32,
133
+ isSelected: false,
134
+ disabled: false,
135
+ disableHoverAnimation: false,
136
+ borderThick: false,
137
+ };
138
+ export var Large = Template.bind({});
139
+ Large.args = {
140
+ firstName: "Emma",
141
+ name: "Rousseau",
142
+ src: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=150&h=150&fit=crop&crop=face",
143
+ size: 56,
144
+ isSelected: false,
145
+ disabled: false,
146
+ disableHoverAnimation: false,
147
+ borderThick: false,
148
+ };
149
+ export var WithoutHoverAnimation = Template.bind({});
150
+ WithoutHoverAnimation.args = {
151
+ firstName: "Thomas",
152
+ name: "Leroy",
153
+ src: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&h=150&fit=crop&crop=face",
154
+ size: 42.5,
155
+ isSelected: false,
156
+ disabled: false,
157
+ disableHoverAnimation: true,
158
+ borderThick: false,
159
+ };
160
+ export var SelectedWithoutHoverAnimation = Template.bind({});
161
+ SelectedWithoutHoverAnimation.args = {
162
+ firstName: "Julie",
163
+ name: "Moreau",
164
+ src: "https://images.unsplash.com/photo-1494790108755-2616b612b786?w=150&h=150&fit=crop&crop=face",
165
+ size: 42.5,
166
+ isSelected: true,
167
+ disabled: false,
168
+ disableHoverAnimation: true,
169
+ borderThick: false,
170
+ };
171
+ export var MultipleSizes = function () {
172
+ var _a = useState(0), selectedIndex = _a[0], setSelectedIndex = _a[1];
173
+ var avatars = [
174
+ { firstName: "Alice", name: "Dubois", size: 32 },
175
+ { firstName: "Bob", name: "Moreau", size: 42.5 },
176
+ { firstName: "Claire", name: "Simon", size: 56 },
177
+ ];
178
+ return (React.createElement("div", { style: {
179
+ padding: "20px",
180
+ display: "flex",
181
+ gap: "20px",
182
+ alignItems: "center",
183
+ } }, avatars.map(function (avatar, index) { return (React.createElement(AvatarBubble, { key: index, firstName: avatar.firstName, name: avatar.name, size: avatar.size, isSelected: selectedIndex === index, onClick: function () { return setSelectedIndex(index); } })); })));
184
+ };
185
+ export var ColorVariations = function () {
186
+ var names = [
187
+ { firstName: "Alice", name: "Dubois" },
188
+ { firstName: "Bob", name: "Moreau" },
189
+ { firstName: "Claire", name: "Simon" },
190
+ { firstName: "David", name: "Michel" },
191
+ { firstName: "Emma", name: "Rousseau" },
192
+ { firstName: "François", name: "Leroy" },
193
+ ];
194
+ return (React.createElement("div", { style: {
195
+ padding: "20px",
196
+ display: "flex",
197
+ gap: "10px",
198
+ flexWrap: "wrap",
199
+ } }, names.map(function (name, index) { return (React.createElement(AvatarBubble, { key: index, firstName: name.firstName, name: name.name, size: 42.5, onClick: function () { return action("Clicked ".concat(name.firstName, " ").concat(name.name))(); } })); })));
200
+ };
201
+ export var HoverAnimationComparison = function () {
202
+ var _a = useState(0), selectedIndex = _a[0], setSelectedIndex = _a[1];
203
+ return (React.createElement("div", { style: {
204
+ padding: "20px",
205
+ display: "flex",
206
+ gap: "20px",
207
+ alignItems: "center",
208
+ } },
209
+ React.createElement("div", { style: { textAlign: "center" } },
210
+ React.createElement("h4", { style: { marginBottom: "10px" } }, "Avec animation"),
211
+ React.createElement(AvatarBubble, { firstName: "Jean", name: "Dupont", src: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=150&h=150&fit=crop&crop=face", size: 42.5, isSelected: selectedIndex === 0, onClick: function () { return setSelectedIndex(0); } })),
212
+ React.createElement("div", { style: { textAlign: "center" } },
213
+ React.createElement("h4", { style: { marginBottom: "10px" } }, "Sans animation"),
214
+ React.createElement(AvatarBubble, { firstName: "Marie", name: "Martin", src: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=150&h=150&fit=crop&crop=face", size: 42.5, isSelected: selectedIndex === 1, onClick: function () { return setSelectedIndex(1); }, disableHoverAnimation: true }))));
215
+ };
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ export interface Pro {
3
+ token: string;
4
+ proUserId: string;
5
+ name: string;
6
+ firstName: string;
7
+ profilePictureLink: string;
8
+ profession?: string;
9
+ }
10
+ export interface AvatarToggleGroupProps {
11
+ pros: Pro[];
12
+ mode: "single" | "multiple";
13
+ selected: string[];
14
+ onSelect: (selectedPros: Pro[]) => void;
15
+ maxVisible?: number;
16
+ disabled?: boolean;
17
+ onOpenPortal?: () => void;
18
+ className?: string;
19
+ }
20
+ declare const AvatarToggleGroup: React.FC<AvatarToggleGroupProps>;
21
+ export default AvatarToggleGroup;