allaw-ui 3.7.2 → 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
  };
@@ -11,17 +11,20 @@
11
11
 
12
12
  /* Classes d'alignement */
13
13
  .tiny-info.left {
14
- justify-self: flex-start;
14
+ width: 100%;
15
+ justify-content: flex-start;
15
16
  text-align: left;
16
17
  }
17
18
 
18
19
  .tiny-info.center {
19
- justify-self: center;
20
+ width: 100%;
21
+ justify-content: center;
20
22
  text-align: center;
21
23
  }
22
24
 
23
25
  .tiny-info.right {
24
- justify-self: flex-end;
26
+ width: 100%;
27
+ justify-content: flex-end;
25
28
  text-align: right;
26
29
  }
27
30
 
@@ -86,20 +86,27 @@ var Modal = function (_a) {
86
86
  };
87
87
  var renderModalContent = function () {
88
88
  return (React.createElement(React.Fragment, null,
89
- React.createElement("div", { className: style.modalHeadingWrapper },
90
- React.createElement(Heading, { text: title, variant: "h4", color: "noir", align: "left" })),
91
- React.createElement("div", { className: style.modalParagraphWrapper },
92
- React.createElement(Paragraph, { text: description, variant: "medium", size: "default", className: style.modalParagraph })),
93
- renderContent && (React.createElement("div", { className: style.modalCustomWrapper }, renderContent({ isOpen: show, onClose: onCancel }))),
94
- !renderContent && customContent && (React.createElement("div", { className: style.modalCustomWrapper },
95
- React.createElement(customContent.component, __assign({}, (customContent.props || {}))))),
96
- !renderContent && !customContent && children && (React.createElement("div", { className: style.modalCustomWrapper }, children)),
97
- !renderContent &&
98
- !customContent &&
99
- !children &&
100
- imageConfig &&
101
- !imgError && (React.createElement("div", { className: "".concat(style.modalImageWrapper, " ").concat(imageConfig.className || ""), style: __assign({ padding: imageConfig.padding }, imageConfig.style) },
102
- React.createElement("img", { src: imageConfig.url, alt: imageConfig.alt || "", width: imageConfig.width, height: imageConfig.height, onError: handleImageError, className: style.modalImage })))));
89
+ React.createElement("header", { className: style.modalHeader },
90
+ React.createElement("div", { className: style.modalHeadingWrapper },
91
+ React.createElement(Heading, { text: title, variant: "h4", color: "noir", align: "left" })),
92
+ React.createElement("button", { className: style.modalCloseButton, onClick: onCancel, "aria-label": "Fermer", type: "button" },
93
+ React.createElement("span", { className: style.modalCloseIcon }, "\u00D7"))),
94
+ React.createElement("section", { className: style.modalBody },
95
+ React.createElement("div", { className: style.modalParagraphWrapper },
96
+ React.createElement(Paragraph, { text: description, variant: "medium", size: "default", className: style.modalParagraph })),
97
+ renderContent && (React.createElement("div", { className: style.modalCustomWrapper }, renderContent({ isOpen: show, onClose: onCancel }))),
98
+ !renderContent && customContent && (React.createElement("div", { className: style.modalCustomWrapper },
99
+ React.createElement(customContent.component, __assign({}, (customContent.props || {}))))),
100
+ !renderContent && !customContent && children && (React.createElement("div", { className: style.modalCustomWrapper }, children)),
101
+ !renderContent &&
102
+ !customContent &&
103
+ !children &&
104
+ imageConfig &&
105
+ !imgError && (React.createElement("div", { className: "".concat(style.modalImageWrapper, " ").concat(imageConfig.className || ""), style: __assign({ padding: imageConfig.padding }, imageConfig.style) },
106
+ React.createElement("img", { src: imageConfig.url, alt: imageConfig.alt || "", width: imageConfig.width, height: imageConfig.height, onError: handleImageError, className: style.modalImage })))),
107
+ React.createElement("footer", { className: style.modalFooter },
108
+ cancelLabel && (React.createElement(SecondaryButton, { label: cancelLabel, onClick: onCancel, startIconName: "allaw-icon-close", startIcon: true })),
109
+ React.createElement(PrimaryButton, { label: confirmLabel, variant: isDanger ? "warning" : "default", onClick: onConfirm, startIconName: confirmIconName, startIcon: true }))));
103
110
  };
104
111
  // Générer les styles pour la largeur maximale responsive
105
112
  var getMaxWidthStyles = function () {
@@ -203,11 +210,7 @@ var Modal = function (_a) {
203
210
  ? "".concat(horizontalOffset.right, "px")
204
211
  : undefined,
205
212
  } },
206
- React.createElement("div", { className: "".concat(style.modalContent, " ").concat(show ? style.modal : "", " ").concat(getMaxWidthClasses(), " ").concat(getDynamicModalClass()), ref: modalContentRef, style: __assign({}, getMaxWidthStyles()) },
207
- renderModalContent(),
208
- React.createElement("div", { className: style.modalButtons },
209
- cancelLabel && (React.createElement(SecondaryButton, { label: cancelLabel, onClick: onCancel, startIconName: "allaw-icon-close", startIcon: true })),
210
- React.createElement(PrimaryButton, { label: confirmLabel, variant: isDanger ? "warning" : "default", onClick: onConfirm, startIconName: confirmIconName, startIcon: true })))));
213
+ React.createElement("div", { className: "".concat(style.modalContent, " ").concat(show ? style.modal : "", " ").concat(getMaxWidthClasses(), " ").concat(getDynamicModalClass()), ref: modalContentRef, style: __assign({}, getMaxWidthStyles()) }, renderModalContent())));
211
214
  return ReactDOM.createPortal(modalContent, portalContainerRef.current);
212
215
  };
213
216
  export default Modal;
@@ -254,30 +254,89 @@
254
254
  .modalContent {
255
255
  background: #fff;
256
256
  border-radius: 16px;
257
- padding: 2rem;
258
257
  max-width: 500px;
259
258
  width: 90%;
260
259
  animation: fadeIn 0.2s ease-out;
261
260
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
262
- max-height: 90vh;
261
+ max-height: calc(100vh - 120px);
263
262
  display: flex;
264
263
  flex-direction: column;
265
264
  }
266
265
 
266
+ .modalHeader {
267
+ flex-shrink: 0;
268
+ padding: 2rem 2rem 0 2rem;
269
+ background: #fff;
270
+ border-radius: 16px 16px 0 0;
271
+ display: flex;
272
+ justify-content: space-between;
273
+ align-items: flex-start;
274
+ gap: 1rem;
275
+ }
276
+
267
277
  .modalHeadingWrapper {
268
- margin-bottom: 1.5rem;
278
+ flex: 1;
269
279
  display: flex;
270
280
  justify-content: start;
271
281
  }
272
282
 
273
- .modalParagraphWrapper {
274
- margin-bottom: 2.5rem;
283
+ .modalCloseButton {
284
+ background: none;
285
+ border: none;
286
+ cursor: pointer;
287
+ padding: 0.25rem;
288
+ margin: -0.25rem -0.25rem -0.25rem 0;
289
+ border-radius: 0.375rem;
290
+ transition: background-color 0.2s ease;
291
+ flex-shrink: 0;
292
+ }
293
+
294
+ .modalCloseButton:hover {
295
+ background-color: #f3f4f6;
296
+ }
297
+
298
+ .modalCloseIcon {
299
+ font-size: 1.5rem;
300
+ line-height: 1;
301
+ color: #6b7280;
302
+ font-weight: 300;
303
+ display: block;
304
+ width: 24px;
305
+ height: 24px;
306
+ text-align: center;
307
+ }
308
+
309
+ .modalBody {
310
+ flex: 1;
275
311
  overflow-y: auto;
312
+ padding: 1.5rem 2rem;
313
+ }
314
+
315
+ .modalBody::-webkit-scrollbar {
316
+ width: 8px;
317
+ }
318
+
319
+ .modalBody::-webkit-scrollbar-track {
320
+ background: #f1f1f1;
321
+ border-radius: 4px;
322
+ }
323
+
324
+ .modalBody::-webkit-scrollbar-thumb {
325
+ background: #cbd5e1;
326
+ border-radius: 4px;
327
+ }
328
+
329
+ .modalBody::-webkit-scrollbar-thumb:hover {
330
+ background: #94a3b8;
331
+ }
332
+
333
+ .modalParagraphWrapper {
334
+ margin-bottom: 1rem;
276
335
  }
277
336
 
278
337
  .modalImageWrapper {
279
338
  text-align: center;
280
- margin: 0 0 2.5rem 0;
339
+ margin: 1rem 0;
281
340
  }
282
341
 
283
342
  .modalImage {
@@ -288,18 +347,40 @@
288
347
 
289
348
  .modalCustomWrapper {
290
349
  width: 100%;
291
- margin-bottom: 2.5rem;
350
+ margin-top: 1rem;
292
351
  }
293
352
 
294
353
  .modalParagraph {
295
354
  text-align: left;
296
355
  }
297
356
 
357
+ .modalFooter {
358
+ flex-shrink: 0;
359
+ padding: 0 2rem 2rem 2rem;
360
+ background: #fff;
361
+ border-radius: 0 0 16px 16px;
362
+ display: flex;
363
+ justify-content: space-between;
364
+ gap: 16px;
365
+ }
366
+
367
+ .modalFooter button {
368
+ flex: 1;
369
+ }
370
+
371
+ .modalFooter button:only-child {
372
+ width: 100%;
373
+ }
374
+
375
+ /* Deprecated - gardé pour backward compatibility */
298
376
  .modalButtons {
377
+ flex-shrink: 0;
378
+ padding: 0 2rem 2rem 2rem;
379
+ background: #fff;
380
+ border-radius: 0 0 16px 16px;
299
381
  display: flex;
300
382
  justify-content: space-between;
301
383
  gap: 16px;
302
- margin-top: auto;
303
384
  }
304
385
 
305
386
  .modalButtons button {
@@ -322,7 +403,6 @@
322
403
  position: fixed;
323
404
  bottom: 0;
324
405
  justify-content: flex-start;
325
- padding: 2rem;
326
406
  border-bottom-left-radius: 0;
327
407
  border-bottom-right-radius: 0;
328
408
  max-height: none;
@@ -330,6 +410,21 @@
330
410
  max-width: 100%;
331
411
  }
332
412
 
413
+ .modalHeader {
414
+ padding: 1.5rem 2rem 0 2rem;
415
+ border-radius: 0;
416
+ }
417
+
418
+ .modalBody {
419
+ padding: 1rem 2rem;
420
+ }
421
+
422
+ .modalFooter,
423
+ .modalButtons {
424
+ padding: 0 2rem 1.5rem 2rem;
425
+ border-radius: 0;
426
+ }
427
+
333
428
  .modalOverlay {
334
429
  padding-top: 0 !important;
335
430
  padding-bottom: 0 !important;
@@ -123,4 +123,6 @@ export const WithLargeContentAndMaxWidth: any;
123
123
  export const WithCustomBreakpoints: any;
124
124
  export const WithManyBreakpoints: any;
125
125
  export const WithMixedUnitsBreakpoints: any;
126
+ export const WithScrollableContent: any;
127
+ export const WithScrollableContentMobile: any;
126
128
  import Modal from "./Modal";
@@ -307,3 +307,67 @@ WithMixedUnitsBreakpoints.args = __assign(__assign({}, Default.args), { title: "
307
307
  { breakpoint: 1200, maxWidth: 900 },
308
308
  ],
309
309
  } });
310
+ // Nouvelle story pour tester le scroll avec header/footer fixes
311
+ export var WithScrollableContent = Template.bind({});
312
+ WithScrollableContent.args = {
313
+ show: false,
314
+ title: "Modal avec contenu scrollable",
315
+ description: "Cette modal contient beaucoup de contenu pour tester le comportement de scroll. Le header (titre + bouton fermer) et le footer (boutons) doivent rester fixes pendant que seul le corps de la modal défile.",
316
+ confirmLabel: "Valider",
317
+ cancelLabel: "Annuler",
318
+ children: (React.createElement("div", { style: { textAlign: "left" } },
319
+ React.createElement("h3", { style: { marginBottom: "1rem", color: "#1f2937" } }, "Contenu tr\u00E8s long pour tester le scroll"),
320
+ Array.from({ length: 20 }, function (_, i) { return (React.createElement("div", { key: i, style: {
321
+ marginBottom: "1.5rem",
322
+ padding: "1rem",
323
+ backgroundColor: i % 2 === 0 ? "#f9fafb" : "#f3f4f6",
324
+ borderRadius: "0.5rem",
325
+ border: "1px solid #e5e7eb",
326
+ } },
327
+ React.createElement("h4", { style: { margin: "0 0 0.5rem 0", color: "#374151" } },
328
+ "Section ",
329
+ i + 1),
330
+ React.createElement("p", { style: { margin: 0, color: "#6b7280", lineHeight: "1.6" } }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."),
331
+ i === 5 && (React.createElement("div", { style: {
332
+ marginTop: "1rem",
333
+ padding: "1rem",
334
+ backgroundColor: "#dbeafe",
335
+ borderRadius: "0.375rem",
336
+ border: "1px solid #93c5fd",
337
+ } },
338
+ React.createElement("p", { style: { margin: 0, fontSize: "0.875rem", color: "#1e40af" } },
339
+ "\uD83D\uDCA1 ",
340
+ React.createElement("strong", null, "Note importante :"),
341
+ " Pendant que vous scrollez ce contenu, v\u00E9rifiez que le titre en haut et les boutons en bas restent toujours visibles et fixes."))),
342
+ i === 10 && (React.createElement("div", { style: {
343
+ marginTop: "1rem",
344
+ padding: "1rem",
345
+ backgroundColor: "#ecfdf5",
346
+ borderRadius: "0.375rem",
347
+ border: "1px solid #86efac",
348
+ } },
349
+ React.createElement("p", { style: { margin: 0, fontSize: "0.875rem", color: "#047857" } },
350
+ "\u2705 ",
351
+ React.createElement("strong", null, "Test r\u00E9ussi :"),
352
+ " Si vous voyez ce message au milieu du scroll, l'architecture header/body/footer fonctionne correctement !"))))); }),
353
+ React.createElement("div", { style: {
354
+ padding: "1.5rem",
355
+ backgroundColor: "#fef2f2",
356
+ borderRadius: "0.5rem",
357
+ border: "2px solid #fecaca",
358
+ textAlign: "center",
359
+ } },
360
+ React.createElement("h4", { style: { margin: "0 0 1rem 0", color: "#dc2626" } }, "\uD83C\uDFAF Fin du contenu scrollable"),
361
+ React.createElement("p", { style: { margin: 0, color: "#991b1b", fontSize: "0.875rem" } }, "Vous avez atteint la fin du contenu. Les boutons Annuler/Valider doivent toujours \u00EAtre visibles en bas de la modal.")))),
362
+ };
363
+ // Story pour tester sur viewport mobile restreint
364
+ export var WithScrollableContentMobile = Template.bind({});
365
+ WithScrollableContentMobile.args = __assign(__assign({}, WithScrollableContent.args), { title: "Test mobile - Scroll fixe", description: "Version optimisée pour tester le comportement sur écrans mobiles avec hauteur réduite." });
366
+ WithScrollableContentMobile.parameters = {
367
+ viewport: {
368
+ defaultViewport: "mobile1",
369
+ },
370
+ backgrounds: {
371
+ default: "light",
372
+ },
373
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "3.7.2",
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",