allaw-ui 3.7.3 → 3.7.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.
@@ -1,27 +1,23 @@
1
1
  import React from "react";
2
2
  export interface InboxButtonProps {
3
- /** Nombre d'éléments à afficher */
4
- count?: number;
5
- /** Callback au clic */
6
- onClick?: () => void;
7
3
  /** Textes à afficher suivant la valeur de count */
8
4
  labels: {
9
5
  none: string;
10
6
  one: string;
11
7
  multiple: string;
12
8
  };
13
- /** Identifiant pour les tests Playwright */
14
- dataCy?: string;
15
- /**
16
- * Thème de couleur automatique :
17
- * - "notification" : bleu si 0, rouge sinon (et disabled si 0)
18
- * - "qualification" : vert si count>0, gris sinon
19
- */
9
+ /** Nombre d'éléments à afficher */
10
+ count?: number;
11
+ /** Callback au clic */
12
+ onClick?: () => void;
13
+ /** Thème visuel */
20
14
  scheme?: "notification" | "qualification";
21
15
  /** Classe CSS de l'icône à gauche */
22
16
  iconClassName?: string;
23
17
  /** aria-label de l'icône */
24
18
  iconAriaLabel?: string;
19
+ /** Identifiant pour les tests Playwright */
20
+ dataCy?: string;
25
21
  }
26
22
  declare const InboxButton: React.FC<InboxButtonProps>;
27
23
  export default InboxButton;
@@ -1,47 +1,35 @@
1
- import clsx from "clsx";
2
1
  import React from "react";
3
2
  import styles from "./InboxButton.module.css";
4
3
  var InboxButton = function (_a) {
5
- var _b = _a.count, count = _b === void 0 ? 0 : _b, onClick = _a.onClick, labels = _a.labels, dataCy = _a.dataCy, _c = _a.scheme, scheme = _c === void 0 ? "notification" : _c, iconClassName = _a.iconClassName, iconAriaLabel = _a.iconAriaLabel;
6
- var isZero = count === 0;
7
- var isDisabled = scheme === "qualification" && isZero;
8
- var isQualificationZero = scheme === "qualification" && isZero;
9
- // Choix du label
10
- var label = isZero
11
- ? labels.none
12
- : count === 1
13
- ? labels.one
14
- : labels.multiple.replace("{{count}}", String(count));
15
- // Choix automatique des classes bg + text
16
- var bgKey;
17
- var colorKey;
18
- if (scheme === "notification") {
19
- if (isZero) {
20
- bgKey = "light-blue";
21
- colorKey = "blue";
22
- }
23
- else {
24
- bgKey = "light-red";
25
- colorKey = "red";
26
- }
27
- }
28
- else {
29
- // qualification
30
- if (isZero) {
31
- bgKey = "pure-white";
32
- colorKey = "mid-grey";
33
- }
34
- else {
35
- bgKey = "light-red";
36
- colorKey = "red";
37
- }
38
- }
39
- return (React.createElement("button", { className: clsx(styles.inboxBtn, isDisabled && styles.disabled, isQualificationZero && styles.qualificationZero, !isDisabled && !isQualificationZero && styles["bg-".concat(bgKey)], scheme === "qualification" &&
40
- !isQualificationZero &&
41
- styles.qualificationActive, scheme === "notification" && !isZero && styles.notifActive, scheme === "qualification" && !isZero && styles.shiny), disabled: isDisabled, onClick: onClick, "data-cy": dataCy },
42
- iconClassName && (React.createElement("i", { className: clsx(styles.icon, iconClassName, !isDisabled && !isQualificationZero && styles["color-".concat(colorKey)], isQualificationZero && styles.colorDarkGrey, scheme === "qualification" &&
43
- !isQualificationZero &&
44
- styles.colorNoir), "aria-label": iconAriaLabel })),
45
- React.createElement("span", { className: clsx(styles.label, isDisabled && styles.labelDisabled, !isDisabled && !isQualificationZero && styles["color-".concat(colorKey)], isQualificationZero && styles.colorDarkGrey, scheme === "qualification" && !isQualificationZero && styles.colorNoir) }, label)));
4
+ var labels = _a.labels, _b = _a.count, count = _b === void 0 ? 0 : _b, onClick = _a.onClick, _c = _a.scheme, scheme = _c === void 0 ? "notification" : _c, iconClassName = _a.iconClassName, iconAriaLabel = _a.iconAriaLabel, dataCy = _a.dataCy;
5
+ // Calcul du label
6
+ var getLabel = function () {
7
+ if (count === 0)
8
+ return labels.none;
9
+ if (count === 1)
10
+ return labels.one;
11
+ return labels.multiple.replace("{{count}}", String(count));
12
+ };
13
+ // Logique des états
14
+ var isNotificationZero = scheme === "notification" && count === 0;
15
+ var isNotificationActive = scheme === "notification" && count > 0;
16
+ var isQualificationZero = scheme === "qualification" && count === 0;
17
+ var isQualificationActive = scheme === "qualification" && count > 0;
18
+ // Le bouton est disabled seulement pour notification à 0
19
+ var isDisabled = isNotificationZero;
20
+ // Classes CSS
21
+ var buttonClasses = [
22
+ styles.inboxBtn,
23
+ isNotificationZero && styles.notificationZero,
24
+ isNotificationActive && styles.notificationActive,
25
+ isQualificationZero && styles.qualificationZero,
26
+ isQualificationActive && styles.qualificationActive,
27
+ ]
28
+ .filter(Boolean)
29
+ .join(" ");
30
+ var iconClasses = [styles.icon, iconClassName].filter(Boolean).join(" ");
31
+ return (React.createElement("button", { className: buttonClasses, disabled: isDisabled, onClick: onClick, "data-cy": dataCy },
32
+ iconClassName && (React.createElement("i", { className: iconClasses, "aria-label": iconAriaLabel })),
33
+ React.createElement("span", { className: styles.label }, getLabel())));
46
34
  };
47
35
  export default InboxButton;
@@ -1,196 +1,118 @@
1
- /* Effet shiny pour les boutons qualification actifs */
2
- .shiny {
3
- position: relative;
4
- overflow: hidden;
5
- }
6
-
7
- .shiny::before {
8
- content: "";
9
- position: absolute;
10
- top: 0;
11
- left: -100%;
12
- width: 100%;
13
- height: 100%;
14
- background: linear-gradient(
15
- 120deg,
16
- transparent,
17
- rgba(225, 81, 81, 0.4),
18
- transparent
19
- );
20
- animation: shine 5s ease-in-out infinite;
21
- transition: left 0.65s ease-in-out;
22
- }
23
-
24
- @keyframes shine {
25
- 0% {
26
- left: -100%;
27
- }
28
- 13% {
29
- left: 100%;
30
- }
31
- 100% {
32
- left: 100%;
33
- }
34
- }
1
+ /* ===========================================
2
+ BASE STYLES
3
+ =========================================== */
35
4
 
36
5
  .inboxBtn {
6
+ /* Layout */
37
7
  display: flex;
38
8
  flex-direction: row;
39
- flex-wrap: nowrap;
40
9
  justify-content: center;
41
10
  align-items: center;
42
11
  gap: 0.5rem;
43
- padding: 0.5rem;
12
+
13
+ /* Dimensions */
44
14
  width: 100%;
15
+ padding: 0.5rem;
16
+
17
+ /* Style */
45
18
  border: none;
46
19
  border-radius: 0.5rem;
47
- }
48
-
49
- .notifActive {
50
- cursor: pointer;
51
- }
52
-
53
- .notifActive:hover {
54
- cursor: pointer;
55
- background-color: #fbe8e8;
56
- }
57
-
58
- .qualificationActive:hover {
59
- background-color: #fbe8e8;
60
- border: 0px solid #fbe8e8;
61
- cursor: pointer;
62
- }
63
-
64
- .qualificationActive:hover .icon {
65
- color: #456073;
66
- }
67
-
68
- .qualificationActive:hover .label {
69
- color: #456073;
70
- }
71
-
72
- .disabled {
73
- cursor: default;
74
- background-color: #daebfb;
75
- /* color: #1985e8; */
76
- }
77
-
78
- .qualificationZero {
79
- cursor: initial;
80
- background-color: #ffffff;
81
- color: #d1dce8;
82
- border: 0px solid #e6edf5;
83
- }
84
-
85
- .qualificationActive {
86
- background-color: #fdf2f2;
87
- color: #456073;
88
- position: relative;
89
- border: 0px solid #fdf2f2;
90
- overflow: hidden;
91
- }
92
-
93
- .colorDarkGrey {
94
- color: #d1dce8;
95
- }
96
-
97
- .colorNoir {
98
- color: #456073;
99
- }
100
20
 
101
- .label {
21
+ /* Typography */
102
22
  font-family: "Open Sans", sans-serif;
103
23
  font-size: 15px;
104
- font-style: normal;
105
24
  font-weight: 600;
106
25
  line-height: normal;
107
26
  }
108
27
 
109
- .labelDisabled {
110
- color: #d1dce8;
111
- }
112
-
113
- .bg-mid-grey {
114
- background-color: #728ea7;
115
- }
116
-
117
- .bg-dark-grey {
118
- background-color: #456073;
119
- }
120
-
121
- .bg-noir {
122
- background-color: #000000;
28
+ .icon {
29
+ font-size: 20px;
30
+ line-height: 1;
31
+ padding-right: 0.15rem;
123
32
  }
124
33
 
125
- .bg-pure-white {
126
- background-color: #ffffff;
34
+ .label {
35
+ /* Hérite de la couleur du bouton parent */
127
36
  }
128
37
 
129
- .bg-light-red {
130
- background-color: #fdf2f2;
131
- }
38
+ /* ===========================================
39
+ NOTIFICATION STATES
40
+ =========================================== */
132
41
 
133
- .bg-light-blue {
42
+ /* Notification Zero: disabled, bleu */
43
+ .notificationZero {
134
44
  background-color: #daebfb;
45
+ color: #1985e8;
46
+ cursor: default;
135
47
  }
136
48
 
137
- .bg-dark-green {
138
- background-color: #29a36a;
139
- }
140
-
141
- .bg-grey-venom {
142
- background-color: #e6edf5;
143
- }
144
-
145
- .bg-grey-light {
146
- background-color: #f6fcfe;
49
+ /* Notification Active: rouge, cliquable */
50
+ .notificationActive {
51
+ background-color: #fdf2f2;
52
+ color: #e15151;
53
+ cursor: pointer;
147
54
  }
148
55
 
149
- .color-grey-light {
150
- color: #f6fcfe;
56
+ .notificationActive:hover {
57
+ background-color: #fbe8e8;
151
58
  }
152
59
 
153
- .color-mid-grey {
154
- color: #728ea7;
155
- }
60
+ /* ===========================================
61
+ QUALIFICATION STATES
62
+ =========================================== */
156
63
 
157
- .color-dark-grey {
158
- color: #456073;
159
- }
160
-
161
- .color-noir {
162
- color: #000000;
64
+ /* Qualification Zero: rouge, cliquable */
65
+ .qualificationZero {
66
+ background-color: #fdf2f2;
67
+ color: #e15151;
68
+ cursor: pointer;
163
69
  }
164
70
 
165
- .color-pure-white {
166
- color: #ffffff;
71
+ .qualificationZero:hover {
72
+ background-color: #fbe8e8;
167
73
  }
168
74
 
169
- .color-red {
75
+ /* Qualification Active: rouge, cliquable + effet shiny */
76
+ .qualificationActive {
77
+ background-color: #fdf2f2;
170
78
  color: #e15151;
79
+ cursor: pointer;
80
+ position: relative;
81
+ overflow: hidden;
171
82
  }
172
83
 
173
- .color-green {
174
- color: #29a36a;
84
+ .qualificationActive:hover {
85
+ background-color: #fbe8e8;
175
86
  }
176
87
 
177
- .color-blue {
178
- color: #1985e8;
179
- }
88
+ /* ===========================================
89
+ SHINY EFFECT (qualification active uniquement)
90
+ =========================================== */
180
91
 
181
- .icon {
182
- font-size: 20px;
183
- line-height: 1;
184
- display: flex;
185
- align-items: center;
186
- padding-right: 0.15rem;
92
+ .qualificationActive::before {
93
+ content: "";
94
+ position: absolute;
95
+ top: 0;
96
+ left: -100%;
97
+ width: 100%;
98
+ height: 100%;
99
+ background: linear-gradient(
100
+ 120deg,
101
+ transparent,
102
+ rgba(225, 81, 81, 0.4),
103
+ transparent
104
+ );
105
+ animation: shine 5s ease-in-out infinite;
187
106
  }
188
107
 
189
- @keyframes rotateReflection {
190
- from {
191
- transform: rotate(0deg);
108
+ @keyframes shine {
109
+ 0% {
110
+ left: -100%;
111
+ }
112
+ 13% {
113
+ left: 100%;
192
114
  }
193
- to {
194
- transform: rotate(360deg);
115
+ 100% {
116
+ left: 100%;
195
117
  }
196
118
  }
@@ -2,75 +2,67 @@ declare namespace _default {
2
2
  export let title: string;
3
3
  export { InboxButton as component };
4
4
  export let tags: string[];
5
- export let argTypes: {
6
- count: {
7
- control: {
8
- type: string;
9
- };
10
- description: string;
11
- defaultValue: number;
12
- };
13
- "labels.none": {
14
- control: {
15
- type: string;
16
- };
17
- description: string;
18
- table: {
19
- category: string;
20
- };
21
- };
22
- "labels.one": {
23
- control: {
24
- type: string;
25
- };
26
- description: string;
27
- table: {
28
- category: string;
29
- };
30
- };
31
- "labels.multiple": {
32
- control: {
33
- type: string;
34
- };
35
- description: string;
36
- table: {
37
- category: string;
38
- };
39
- };
40
- scheme: {
41
- control: {
42
- type: string;
43
- options: string[];
44
- };
45
- description: string;
46
- };
47
- iconClassName: {
48
- control: {
49
- type: string;
50
- };
51
- description: string;
52
- };
53
- iconAriaLabel: {
54
- control: {
55
- type: string;
56
- };
57
- description: string;
58
- };
59
- onClick: {
60
- action: string;
61
- };
62
- };
5
+ export namespace argTypes {
6
+ namespace labels {
7
+ let control: string;
8
+ let description: string;
9
+ }
10
+ namespace count {
11
+ export namespace control_1 {
12
+ let type: string;
13
+ }
14
+ export { control_1 as control };
15
+ let description_1: string;
16
+ export { description_1 as description };
17
+ export let defaultValue: number;
18
+ }
19
+ namespace scheme {
20
+ export namespace control_2 {
21
+ let type_1: string;
22
+ export { type_1 as type };
23
+ export let options: string[];
24
+ }
25
+ export { control_2 as control };
26
+ let description_2: string;
27
+ export { description_2 as description };
28
+ }
29
+ namespace iconClassName {
30
+ export namespace control_3 {
31
+ let type_2: string;
32
+ export { type_2 as type };
33
+ }
34
+ export { control_3 as control };
35
+ let description_3: string;
36
+ export { description_3 as description };
37
+ }
38
+ namespace iconAriaLabel {
39
+ export namespace control_4 {
40
+ let type_3: string;
41
+ export { type_3 as type };
42
+ }
43
+ export { control_4 as control };
44
+ let description_4: string;
45
+ export { description_4 as description };
46
+ }
47
+ namespace onClick {
48
+ let action: string;
49
+ }
50
+ }
63
51
  export namespace parameters {
64
52
  namespace docs {
65
- namespace description {
53
+ export namespace description_5 {
66
54
  let component: string;
67
55
  }
56
+ export { description_5 as description };
68
57
  }
69
58
  }
70
59
  }
71
60
  export default _default;
72
- export const AucuneNotification: any;
73
- export const UneNotification: any;
74
- export const PlusieursNotifications: any;
75
- export const ClientQualifications: any;
61
+ export const NotificationZero: any;
62
+ export const NotificationOne: any;
63
+ export const NotificationMultiple: any;
64
+ export const QualificationZero: any;
65
+ export const QualificationOne: any;
66
+ export const QualificationMultiple: any;
67
+ export const SansIcone: any;
76
68
  import InboxButton from "./InboxButton";
@@ -17,95 +17,127 @@ export default {
17
17
  component: InboxButton,
18
18
  tags: ["autodocs"],
19
19
  argTypes: {
20
+ labels: {
21
+ control: "object",
22
+ description: "Textes à afficher selon le count",
23
+ },
20
24
  count: {
21
25
  control: { type: "number" },
22
- description: "Nombre d’éléments à traiter",
26
+ description: "Nombre d'éléments à traiter",
23
27
  defaultValue: 0,
24
28
  },
25
- "labels.none": {
26
- control: { type: "text" },
27
- description: "Texte affiché si count === 0",
28
- table: { category: "labels" },
29
- },
30
- "labels.one": {
31
- control: { type: "text" },
32
- description: "Texte affiché si count === 1",
33
- table: { category: "labels" },
34
- },
35
- "labels.multiple": {
36
- control: { type: "text" },
37
- description: "Texte affiché si count > 1 (utiliser {{count}})",
38
- table: { category: "labels" },
39
- },
40
29
  scheme: {
41
30
  control: { type: "select", options: ["notification", "qualification"] },
42
- description: "Thème de couleur du bouton",
31
+ description: "Thème visuel du bouton",
43
32
  },
44
33
  iconClassName: {
45
34
  control: { type: "text" },
46
- description: "Classe CSS de licône à afficher",
35
+ description: "Classe CSS de l'icône à afficher",
47
36
  },
48
37
  iconAriaLabel: {
49
38
  control: { type: "text" },
50
- description: "Label accessible pour licône",
39
+ description: "Label accessible pour l'icône",
51
40
  },
52
41
  onClick: { action: "clicked" },
53
42
  },
54
43
  parameters: {
55
44
  docs: {
56
45
  description: {
57
- component: "Bouton affichant un nombre d’éléments avec style conditionnel en fonction du thème.",
46
+ component: "Bouton avec compteur dynamique et thèmes visuels configurables pour notifications et qualifications.",
58
47
  },
59
48
  },
60
49
  },
61
50
  };
62
- var Template = function (args) { return (React.createElement("div", { style: { padding: "20px", display: "flex", gap: "20px", flexWrap: "wrap" } },
51
+ var Template = function (args) { return (React.createElement("div", { style: { padding: "20px", maxWidth: "300px" } },
63
52
  React.createElement(InboxButton, __assign({}, args)))); };
64
- export var AucuneNotification = Template.bind({});
65
- AucuneNotification.args = {
53
+ // ===========================================
54
+ // NOTIFICATION SCHEME
55
+ // ===========================================
56
+ export var NotificationZero = Template.bind({});
57
+ NotificationZero.args = {
66
58
  count: 0,
59
+ scheme: "notification",
67
60
  labels: {
68
- none: "Aucune demande",
69
- one: "1 demande en attente",
70
- multiple: "{{count}} demandes en attente",
61
+ none: "Aucune notification",
62
+ one: "1 notification",
63
+ multiple: "{{count}} notifications",
71
64
  },
72
- scheme: "notification",
73
65
  iconClassName: "allaw-icon-inbox",
74
- iconAriaLabel: "Inbox",
66
+ iconAriaLabel: "Notifications",
75
67
  };
76
- export var UneNotification = Template.bind({});
77
- UneNotification.args = {
68
+ export var NotificationOne = Template.bind({});
69
+ NotificationOne.args = {
78
70
  count: 1,
71
+ scheme: "notification",
79
72
  labels: {
80
- none: "Aucune demande",
81
- one: "1 demande en attente",
82
- multiple: "{{count}} demandes en attente",
73
+ none: "Aucune notification",
74
+ one: "1 notification",
75
+ multiple: "{{count}} notifications",
83
76
  },
84
- scheme: "notification",
85
77
  iconClassName: "allaw-icon-inbox",
86
- iconAriaLabel: "Inbox",
78
+ iconAriaLabel: "Notifications",
87
79
  };
88
- export var PlusieursNotifications = Template.bind({});
89
- PlusieursNotifications.args = {
90
- count: 7,
80
+ export var NotificationMultiple = Template.bind({});
81
+ NotificationMultiple.args = {
82
+ count: 5,
83
+ scheme: "notification",
91
84
  labels: {
92
- none: "Aucune demande",
93
- one: "1 demande en attente",
94
- multiple: "{{count}} demandes en attente",
85
+ none: "Aucune notification",
86
+ one: "1 notification",
87
+ multiple: "{{count}} notifications",
95
88
  },
96
- scheme: "notification",
97
89
  iconClassName: "allaw-icon-inbox",
98
- iconAriaLabel: "Inbox",
90
+ iconAriaLabel: "Notifications",
99
91
  };
100
- export var ClientQualifications = Template.bind({});
101
- ClientQualifications.args = {
102
- count: 5,
92
+ // ===========================================
93
+ // QUALIFICATION SCHEME
94
+ // ===========================================
95
+ export var QualificationZero = Template.bind({});
96
+ QualificationZero.args = {
97
+ count: 0,
98
+ scheme: "qualification",
103
99
  labels: {
104
- none: "Aucune demande",
105
- one: "1 demande en attente",
106
- multiple: "{{count}} demandes en attente",
100
+ none: "Aucune qualification",
101
+ one: "1 contact à qualifier",
102
+ multiple: "{{count}} contacts à qualifier",
107
103
  },
104
+ iconClassName: "allaw-icon-check-circle",
105
+ iconAriaLabel: "Qualification",
106
+ };
107
+ export var QualificationOne = Template.bind({});
108
+ QualificationOne.args = {
109
+ count: 1,
108
110
  scheme: "qualification",
111
+ labels: {
112
+ none: "Aucune qualification",
113
+ one: "1 contact à qualifier",
114
+ multiple: "{{count}} contacts à qualifier",
115
+ },
109
116
  iconClassName: "allaw-icon-check-circle",
110
- iconAriaLabel: "Check",
117
+ iconAriaLabel: "Qualification",
118
+ };
119
+ export var QualificationMultiple = Template.bind({});
120
+ QualificationMultiple.args = {
121
+ count: 3,
122
+ scheme: "qualification",
123
+ labels: {
124
+ none: "Aucune qualification",
125
+ one: "1 contact à qualifier",
126
+ multiple: "{{count}} contacts à qualifier",
127
+ },
128
+ iconClassName: "allaw-icon-check-circle",
129
+ iconAriaLabel: "Qualification",
130
+ };
131
+ // ===========================================
132
+ // SANS ICÔNE
133
+ // ===========================================
134
+ export var SansIcone = Template.bind({});
135
+ SansIcone.args = {
136
+ count: 2,
137
+ scheme: "qualification",
138
+ labels: {
139
+ none: "Aucun élément",
140
+ one: "1 élément",
141
+ multiple: "{{count}} éléments",
142
+ },
111
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",