allaw-ui 3.5.1 → 3.5.2

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,14 +1,25 @@
1
1
  import React from "react";
2
- export type InboxButtonProps = {
3
- itemNumber?: number;
2
+ export interface InboxButtonProps {
3
+ /** Nombre d'éléments à afficher */
4
+ count?: number;
5
+ /** Callback au clic */
4
6
  onClick?: () => void;
5
- labelIfNone: string;
6
- labelIfOne: string;
7
- labelIfMultiple: string;
8
- background?: "mid-grey" | "dark-grey" | "noir" | "light-red" | "light-blue" | "dark-green";
9
- color?: "mid-grey" | "dark-grey" | "noir" | "pure-white" | "red" | "green" | "blue";
10
- startIcon?: string;
11
- startIconName?: string;
12
- };
13
- declare const InboxButton: ({ itemNumber, onClick, labelIfNone, labelIfOne, labelIfMultiple, background, color, startIcon, startIconName, }: InboxButtonProps) => React.JSX.Element;
7
+ /** Textes à afficher suivant la valeur de `count` */
8
+ labels: {
9
+ none: string;
10
+ one: string;
11
+ multiple: string;
12
+ };
13
+ /**
14
+ * Thème de couleur automatique :
15
+ * - "notification" : bleu si 0, rouge sinon (et disabled si 0)
16
+ * - "qualification" : vert si count>0, gris sinon
17
+ */
18
+ scheme?: "notification" | "qualification";
19
+ /** Classe CSS de l'icône à gauche */
20
+ iconClassName?: string;
21
+ /** aria-label de l'icône */
22
+ iconAriaLabel?: string;
23
+ }
24
+ declare const InboxButton: React.FC<InboxButtonProps>;
14
25
  export default InboxButton;
@@ -2,15 +2,46 @@ import clsx from "clsx";
2
2
  import React from "react";
3
3
  import styles from "./InboxButton.module.css";
4
4
  var InboxButton = function (_a) {
5
- var _b = _a.itemNumber, itemNumber = _b === void 0 ? 0 : _b, onClick = _a.onClick, labelIfNone = _a.labelIfNone, labelIfOne = _a.labelIfOne, labelIfMultiple = _a.labelIfMultiple, background = _a.background, color = _a.color, startIcon = _a.startIcon, startIconName = _a.startIconName;
6
- var disabled = itemNumber === 0;
7
- var label = itemNumber === 0
8
- ? labelIfNone
9
- : itemNumber === 1
10
- ? labelIfOne
11
- : labelIfMultiple.replace("{{count}}", String(itemNumber));
12
- return (React.createElement("button", { className: clsx(styles.inboxBtn, disabled && styles.disabled, background && styles["bg-".concat(background)]), disabled: disabled, onClick: onClick },
13
- startIcon && (React.createElement("i", { className: clsx(styles.icon, startIcon, color && styles["color-".concat(color)]), "aria-label": startIconName })),
14
- React.createElement("span", { className: clsx(styles.label, disabled && styles.labelDisabled, color && styles["color-".concat(color)]) }, label)));
5
+ var _b = _a.count, count = _b === void 0 ? 0 : _b, onClick = _a.onClick, labels = _a.labels, _c = _a.scheme, scheme = _c === void 0 ? "notification" : _c, iconClassName = _a.iconClassName, iconAriaLabel = _a.iconAriaLabel;
6
+ var isZero = count === 0;
7
+ var isDisabled = scheme === "notification" && 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 = "pure-white";
36
+ colorKey = "noir";
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), disabled: isDisabled, onClick: onClick },
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)));
15
46
  };
16
47
  export default InboxButton;
@@ -14,14 +14,86 @@
14
14
  cursor: pointer;
15
15
  }
16
16
 
17
- .inboxBtn:hover {
18
- filter: brightness(0.95);
17
+ .inboxBtn:hover:not(.disabled):not(.qualificationZero):not(
18
+ .qualificationActive
19
+ ) {
20
+ background-color: #fbe8e8;
21
+ }
22
+
23
+ .qualificationActive:hover {
24
+ background-color: var(--noir);
25
+ color: var(--bleu-allaw);
26
+ }
27
+
28
+ .qualificationActive:hover .icon {
29
+ color: var(--bleu-allaw);
30
+ }
31
+
32
+ .qualificationActive:hover .label {
33
+ color: var(--bleu-allaw);
19
34
  }
20
35
 
21
36
  .disabled {
22
37
  cursor: initial;
23
- background-color: var(--tag-light-blue);
24
- color: var(--tag-blue);
38
+ background-color: var(--tag-light-blue, #daebfb);
39
+ color: var(--blue-tag-dark, #1985e8);
40
+ }
41
+
42
+ .qualificationZero {
43
+ cursor: initial;
44
+ background-color: var(--pure-white, #ffffff);
45
+ color: var(venom-grey-dark, #d1dce8);
46
+ border: 2px solid #8b8e92;
47
+ }
48
+
49
+ .qualificationActive {
50
+ background-color: transparent;
51
+ color: var(--noir);
52
+ position: relative;
53
+ border: 2px solid var(--noir);
54
+ overflow: hidden;
55
+ }
56
+
57
+ .qualificationActive::before {
58
+ content: "";
59
+ position: absolute;
60
+ top: -2px;
61
+ left: -2px;
62
+ right: -2px;
63
+ bottom: -2px;
64
+ border-radius: 0.5rem;
65
+ background: var(--noir);
66
+ z-index: -1;
67
+ }
68
+
69
+ .qualificationActive::after {
70
+ content: "";
71
+ position: absolute;
72
+ top: -2px;
73
+ left: -2px;
74
+ right: -2px;
75
+ bottom: -2px;
76
+ border-radius: 0.5rem;
77
+ background: conic-gradient(
78
+ from 0deg,
79
+ transparent 0deg,
80
+ transparent 70deg,
81
+ rgba(230, 237, 245, 0.8) 85deg,
82
+ rgba(230, 237, 245, 1) 90deg,
83
+ rgba(230, 237, 245, 0.8) 95deg,
84
+ transparent 110deg,
85
+ transparent 360deg
86
+ );
87
+ animation: rotateReflection 4s linear infinite;
88
+ z-index: -1;
89
+ }
90
+
91
+ .colorDarkGrey {
92
+ color: #8b8e92;
93
+ }
94
+
95
+ .colorNoir {
96
+ color: var(--noir);
25
97
  }
26
98
 
27
99
  .label {
@@ -53,11 +125,11 @@
53
125
  }
54
126
 
55
127
  .bg-light-red {
56
- background-color: var(--red-tag-light);
128
+ background-color: var(--tag-light-red, #fdf2f2);
57
129
  }
58
130
 
59
131
  .bg-light-blue {
60
- background-color: var(--blue-tag-light);
132
+ background-color: var(--blue-tag-light, #daebfb);
61
133
  }
62
134
 
63
135
  .bg-dark-green {
@@ -81,7 +153,7 @@
81
153
  }
82
154
 
83
155
  .color-red {
84
- color: var(--actions-error);
156
+ color: var(--tag-red, #e15151);
85
157
  }
86
158
 
87
159
  .color-green {
@@ -98,3 +170,12 @@
98
170
  display: flex;
99
171
  align-items: center;
100
172
  }
173
+
174
+ @keyframes rotateReflection {
175
+ from {
176
+ transform: rotate(0deg);
177
+ }
178
+ to {
179
+ transform: rotate(360deg);
180
+ }
181
+ }
@@ -2,90 +2,69 @@ declare namespace _default {
2
2
  export let title: string;
3
3
  export { InboxButton as component };
4
4
  export let tags: string[];
5
- export namespace argTypes {
6
- namespace itemNumber {
7
- namespace control {
8
- let type: string;
9
- }
10
- let description: string;
11
- let defaultValue: number;
12
- }
13
- namespace labelIfNone {
14
- export namespace control_1 {
15
- let type_1: string;
16
- export { type_1 as type };
17
- }
18
- export { control_1 as control };
19
- let description_1: string;
20
- export { description_1 as description };
21
- }
22
- namespace labelIfOne {
23
- export namespace control_2 {
24
- let type_2: string;
25
- export { type_2 as type };
26
- }
27
- export { control_2 as control };
28
- let description_2: string;
29
- export { description_2 as description };
30
- }
31
- namespace labelIfMultiple {
32
- export namespace control_3 {
33
- let type_3: string;
34
- export { type_3 as type };
35
- }
36
- export { control_3 as control };
37
- let description_3: string;
38
- export { description_3 as description };
39
- }
40
- namespace background {
41
- export namespace control_4 {
42
- let type_4: string;
43
- export { type_4 as type };
44
- export let options: string[];
45
- }
46
- export { control_4 as control };
47
- let description_4: string;
48
- export { description_4 as description };
49
- }
50
- namespace color {
51
- export namespace control_5 {
52
- let type_5: string;
53
- export { type_5 as type };
54
- let options_1: string[];
55
- export { options_1 as options };
56
- }
57
- export { control_5 as control };
58
- let description_5: string;
59
- export { description_5 as description };
60
- }
61
- namespace startIcon {
62
- export namespace control_6 {
63
- let type_6: string;
64
- export { type_6 as type };
65
- }
66
- export { control_6 as control };
67
- let description_6: string;
68
- export { description_6 as description };
69
- }
70
- namespace startIconName {
71
- export namespace control_7 {
72
- let type_7: string;
73
- export { type_7 as type };
74
- }
75
- export { control_7 as control };
76
- let description_7: string;
77
- export { description_7 as description };
78
- }
79
- namespace onClick {
80
- let action: string;
81
- }
82
- }
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
+ };
83
63
  export namespace parameters {
84
64
  namespace docs {
85
- export namespace description_8 {
65
+ namespace description {
86
66
  let component: string;
87
67
  }
88
- export { description_8 as description };
89
68
  }
90
69
  }
91
70
  }
@@ -17,67 +17,44 @@ export default {
17
17
  component: InboxButton,
18
18
  tags: ["autodocs"],
19
19
  argTypes: {
20
- itemNumber: {
20
+ count: {
21
21
  control: { type: "number" },
22
22
  description: "Nombre d’éléments à traiter",
23
23
  defaultValue: 0,
24
24
  },
25
- labelIfNone: {
25
+ "labels.none": {
26
26
  control: { type: "text" },
27
- description: "Texte affiché si itemNumber === 0",
27
+ description: "Texte affiché si count === 0",
28
+ table: { category: "labels" },
28
29
  },
29
- labelIfOne: {
30
+ "labels.one": {
30
31
  control: { type: "text" },
31
- description: "Texte affiché si itemNumber === 1",
32
+ description: "Texte affiché si count === 1",
33
+ table: { category: "labels" },
32
34
  },
33
- labelIfMultiple: {
35
+ "labels.multiple": {
34
36
  control: { type: "text" },
35
- description: "Texte affiché si itemNumber > 1 (utiliser {{count}} pour injecter la valeur)",
37
+ description: "Texte affiché si count > 1 (utiliser {{count}})",
38
+ table: { category: "labels" },
36
39
  },
37
- background: {
38
- control: {
39
- type: "select",
40
- options: [
41
- "light-blue",
42
- "light-red",
43
- "mid-grey",
44
- "dark-grey",
45
- "noir",
46
- "tag-light-blue",
47
- "dark-green",
48
- ],
49
- },
50
- description: "Couleur de fond (classe CSS)",
51
- },
52
- color: {
53
- control: {
54
- type: "select",
55
- options: [
56
- "blue",
57
- "red",
58
- "green",
59
- "mid-grey",
60
- "dark-grey",
61
- "noir",
62
- "pure-white",
63
- ],
64
- },
65
- description: "Couleur du texte (classe CSS)",
40
+ scheme: {
41
+ control: { type: "select", options: ["notification", "qualification"] },
42
+ description: "Thème de couleur du bouton",
66
43
  },
67
- startIcon: {
44
+ iconClassName: {
68
45
  control: { type: "text" },
69
- description: "Nom de la classe d’icône (ex : allaw-icon-folder)",
46
+ description: "Classe CSS de l’icône à afficher",
70
47
  },
71
- startIconName: {
48
+ iconAriaLabel: {
72
49
  control: { type: "text" },
73
- description: "Label accessible pour l’icône (aria-label)",
50
+ description: "Label accessible pour l’icône",
74
51
  },
75
52
  onClick: { action: "clicked" },
76
53
  },
77
54
  parameters: {
78
55
  docs: {
79
56
  description: {
80
- component: "Bouton de notification dynamique avec icône, texte conditionnel, et couleurs personnalisables via les classes CSS d’Allaw.",
57
+ component: "Bouton affichant un nombre d’éléments avec style conditionnel en fonction du thème.",
81
58
  },
82
59
  },
83
60
  },
@@ -86,45 +63,49 @@ var Template = function (args) { return (React.createElement("div", { style: { p
86
63
  React.createElement(InboxButton, __assign({}, args)))); };
87
64
  export var AucuneNotification = Template.bind({});
88
65
  AucuneNotification.args = {
89
- itemNumber: 0,
90
- labelIfNone: "Aucune notification",
91
- labelIfOne: "1 Notification",
92
- labelIfMultiple: "{{count}} notifications",
93
- background: "light-blue",
94
- color: "blue",
95
- startIcon: "allaw-icon-inbox",
96
- startIconName: "Dossier",
66
+ count: 0,
67
+ labels: {
68
+ none: "Aucune demande",
69
+ one: "1 demande en attente",
70
+ multiple: "{{count}} demandes en attente",
71
+ },
72
+ scheme: "notification",
73
+ iconClassName: "allaw-icon-inbox",
74
+ iconAriaLabel: "Inbox",
97
75
  };
98
76
  export var UneNotification = Template.bind({});
99
77
  UneNotification.args = {
100
- itemNumber: 1,
101
- labelIfNone: "Aucune notification",
102
- labelIfOne: "1 Notification",
103
- labelIfMultiple: "{{count}} notifications",
104
- background: "light-red",
105
- color: "red",
106
- startIcon: "allaw-icon-inbox",
107
- startIconName: "Dossier",
78
+ count: 1,
79
+ labels: {
80
+ none: "Aucune demande",
81
+ one: "1 demande en attente",
82
+ multiple: "{{count}} demandes en attente",
83
+ },
84
+ scheme: "notification",
85
+ iconClassName: "allaw-icon-inbox",
86
+ iconAriaLabel: "Inbox",
108
87
  };
109
88
  export var PlusieursNotifications = Template.bind({});
110
89
  PlusieursNotifications.args = {
111
- itemNumber: 7,
112
- labelIfNone: "Aucune Notification",
113
- labelIfOne: "1 Notification",
114
- labelIfMultiple: "{{count}} Notifications",
115
- background: "light-red",
116
- color: "red",
117
- startIcon: "allaw-icon-inbox",
118
- startIconName: "Dossier",
90
+ count: 7,
91
+ labels: {
92
+ none: "Aucune demande",
93
+ one: "1 demande en attente",
94
+ multiple: "{{count}} demandes en attente",
95
+ },
96
+ scheme: "notification",
97
+ iconClassName: "allaw-icon-inbox",
98
+ iconAriaLabel: "Inbox",
119
99
  };
120
100
  export var ClientQualifications = Template.bind({});
121
101
  ClientQualifications.args = {
122
- itemNumber: 5,
123
- labelIfNone: "Aucun client à qualifier",
124
- labelIfOne: "1 Client à qualifier",
125
- labelIfMultiple: "{{count}} clients à qualifier",
126
- background: "dark-green",
127
- color: "pure-white",
128
- startIcon: "allaw-icon-check-circle",
129
- startIconName: "Dossier",
102
+ count: 5,
103
+ labels: {
104
+ none: "Aucune demande",
105
+ one: "1 demande en attente",
106
+ multiple: "{{count}} demandes en attente",
107
+ },
108
+ scheme: "qualification",
109
+ iconClassName: "allaw-icon-check-circle",
110
+ iconAriaLabel: "Check",
130
111
  };
@@ -3,7 +3,7 @@
3
3
  @import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800;900&display=swap");
4
4
  @import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
5
5
 
6
- @import "~typeface-open-sans/index.css";
6
+ /* @import "~typeface-open-sans/index.css"; */
7
7
  @import "./colors.css";
8
8
 
9
9
  @import "./icons.css";
@@ -24,3 +24,7 @@
24
24
  font-weight: 500;
25
25
  font-style: normal;
26
26
  }
27
+
28
+ :root {
29
+ --font-open-sans: "Open Sans", sans-serif;
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
File without changes
File without changes