allaw-ui 3.5.0 → 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.
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ export interface InboxButtonProps {
3
+ /** Nombre d'éléments à afficher */
4
+ count?: number;
5
+ /** Callback au clic */
6
+ onClick?: () => void;
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>;
25
+ export default InboxButton;
@@ -0,0 +1,47 @@
1
+ import clsx from "clsx";
2
+ import React from "react";
3
+ import styles from "./InboxButton.module.css";
4
+ var InboxButton = function (_a) {
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)));
46
+ };
47
+ export default InboxButton;
@@ -0,0 +1,181 @@
1
+ @import "../../../styles/colors.css";
2
+
3
+ .inboxBtn {
4
+ display: flex;
5
+ flex-direction: row;
6
+ flex-wrap: nowrap;
7
+ justify-content: center;
8
+ align-items: center;
9
+ gap: 0.5rem;
10
+ padding: 0.5rem;
11
+ width: 100%;
12
+ border: none;
13
+ border-radius: 0.5rem;
14
+ cursor: pointer;
15
+ }
16
+
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);
34
+ }
35
+
36
+ .disabled {
37
+ cursor: initial;
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);
97
+ }
98
+
99
+ .label {
100
+ font-family: var(--font-open-sans);
101
+ font-size: 16px;
102
+ font-style: normal;
103
+ font-weight: 600;
104
+ line-height: normal;
105
+ }
106
+
107
+ .labelDisabled {
108
+ color: var(--tag-blue);
109
+ }
110
+
111
+ .bg-mid-grey {
112
+ background-color: var(--mid-grey);
113
+ }
114
+
115
+ .bg-dark-grey {
116
+ background-color: var(--dark-grey);
117
+ }
118
+
119
+ .bg-noir {
120
+ background-color: var(--noir);
121
+ }
122
+
123
+ .bg-pure-white {
124
+ background-color: var(--pure-white);
125
+ }
126
+
127
+ .bg-light-red {
128
+ background-color: var(--tag-light-red, #fdf2f2);
129
+ }
130
+
131
+ .bg-light-blue {
132
+ background-color: var(--blue-tag-light, #daebfb);
133
+ }
134
+
135
+ .bg-dark-green {
136
+ background-color: var(--green-tag-dark);
137
+ }
138
+
139
+ .color-mid-grey {
140
+ color: var(--mid-grey);
141
+ }
142
+
143
+ .color-dark-grey {
144
+ color: var(--dark-grey);
145
+ }
146
+
147
+ .color-noir {
148
+ color: var(--noir);
149
+ }
150
+
151
+ .color-pure-white {
152
+ color: var(--pure-white);
153
+ }
154
+
155
+ .color-red {
156
+ color: var(--tag-red, #e15151);
157
+ }
158
+
159
+ .color-green {
160
+ color: var(--actions-valid);
161
+ }
162
+
163
+ .color-blue {
164
+ color: var(--blue-tag-dark);
165
+ }
166
+
167
+ .icon {
168
+ font-size: 24px;
169
+ line-height: 1;
170
+ display: flex;
171
+ align-items: center;
172
+ }
173
+
174
+ @keyframes rotateReflection {
175
+ from {
176
+ transform: rotate(0deg);
177
+ }
178
+ to {
179
+ transform: rotate(360deg);
180
+ }
181
+ }
@@ -0,0 +1,76 @@
1
+ declare namespace _default {
2
+ export let title: string;
3
+ export { InboxButton as component };
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
+ };
63
+ export namespace parameters {
64
+ namespace docs {
65
+ namespace description {
66
+ let component: string;
67
+ }
68
+ }
69
+ }
70
+ }
71
+ export default _default;
72
+ export const AucuneNotification: any;
73
+ export const UneNotification: any;
74
+ export const PlusieursNotifications: any;
75
+ export const ClientQualifications: any;
76
+ import InboxButton from "./InboxButton";
@@ -0,0 +1,111 @@
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 from "react";
13
+ import "../../../styles/global.css";
14
+ import InboxButton from "./InboxButton";
15
+ export default {
16
+ title: "Components/Atoms/Buttons/InboxButton",
17
+ component: InboxButton,
18
+ tags: ["autodocs"],
19
+ argTypes: {
20
+ count: {
21
+ control: { type: "number" },
22
+ description: "Nombre d’éléments à traiter",
23
+ defaultValue: 0,
24
+ },
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
+ scheme: {
41
+ control: { type: "select", options: ["notification", "qualification"] },
42
+ description: "Thème de couleur du bouton",
43
+ },
44
+ iconClassName: {
45
+ control: { type: "text" },
46
+ description: "Classe CSS de l’icône à afficher",
47
+ },
48
+ iconAriaLabel: {
49
+ control: { type: "text" },
50
+ description: "Label accessible pour l’icône",
51
+ },
52
+ onClick: { action: "clicked" },
53
+ },
54
+ parameters: {
55
+ docs: {
56
+ description: {
57
+ component: "Bouton affichant un nombre d’éléments avec style conditionnel en fonction du thème.",
58
+ },
59
+ },
60
+ },
61
+ };
62
+ var Template = function (args) { return (React.createElement("div", { style: { padding: "20px", display: "flex", gap: "20px", flexWrap: "wrap" } },
63
+ React.createElement(InboxButton, __assign({}, args)))); };
64
+ export var AucuneNotification = Template.bind({});
65
+ AucuneNotification.args = {
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",
75
+ };
76
+ export var UneNotification = Template.bind({});
77
+ UneNotification.args = {
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",
87
+ };
88
+ export var PlusieursNotifications = Template.bind({});
89
+ PlusieursNotifications.args = {
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",
99
+ };
100
+ export var ClientQualifications = Template.bind({});
101
+ ClientQualifications.args = {
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",
111
+ };
@@ -1,24 +1,26 @@
1
- export { default as FavoriteToggle } from "./FavoriteToggle";
2
- export { default as FilterButtonPrimary } from "./FilterButtonPrimary";
3
- export { default as FilterButton } from "./FilterButton";
4
- export { default as GhostButton } from "./GhostButton";
5
- export { default as IconButton } from "./IconButton";
6
- export { default as PendingDocuments } from "./PendingDocuments";
7
- export { default as PrimaryButton } from "./PrimaryButton";
8
- export { default as SecondaryButton } from "./SecondaryButton";
9
- export { default as TabNavigation } from "./TabNavigation";
10
- export { default as TertiaryButton } from "./TertiaryButton";
11
- export { default as OAuthProviderButton } from "./OAuthProviderButton";
12
1
  export { default as ActionButton } from "./ActionButton";
2
+ export type { ActionButtonProps } from "./ActionButton";
3
+ export { default as FavoriteToggle } from "./FavoriteToggle";
13
4
  export type { FavoriteToggleProps } from "./FavoriteToggle";
5
+ export { default as FilterButton } from "./FilterButton";
14
6
  export type { FilterButtonProps } from "./FilterButton";
7
+ export { default as FilterButtonPrimary } from "./FilterButtonPrimary";
8
+ export type { FilterButtonPrimaryProps } from "./FilterButtonPrimary";
9
+ export { default as GhostButton } from "./GhostButton";
15
10
  export type { GhostButtonProps } from "./GhostButton";
11
+ export { default as IconButton } from "./IconButton";
16
12
  export type { IconButtonProps } from "./IconButton";
13
+ export { default as InboxButton } from "./InboxButton";
14
+ export type { InboxButtonProps } from "./InboxButton";
15
+ export { default as OAuthProviderButton } from "./OAuthProviderButton";
16
+ export type { OAuthProviderButtonProps } from "./OAuthProviderButton";
17
+ export { default as PendingDocuments } from "./PendingDocuments";
17
18
  export type { PendingDocumentsProps } from "./PendingDocuments";
19
+ export { default as PrimaryButton } from "./PrimaryButton";
18
20
  export type { PrimaryButtonProps } from "./PrimaryButton";
21
+ export { default as SecondaryButton } from "./SecondaryButton";
19
22
  export type { SecondaryButtonProps } from "./SecondaryButton";
23
+ export { default as TabNavigation } from "./TabNavigation";
20
24
  export type { TabNavigationProps } from "./TabNavigation";
25
+ export { default as TertiaryButton } from "./TertiaryButton";
21
26
  export type { TertiaryButtonProps } from "./TertiaryButton";
22
- export type { OAuthProviderButtonProps } from "./OAuthProviderButton";
23
- export type { FilterButtonPrimaryProps } from "./FilterButtonPrimary";
24
- export type { ActionButtonProps } from "./ActionButton";
@@ -1,12 +1,13 @@
1
+ export { default as ActionButton } from "./ActionButton";
1
2
  export { default as FavoriteToggle } from "./FavoriteToggle";
2
- export { default as FilterButtonPrimary } from "./FilterButtonPrimary";
3
3
  export { default as FilterButton } from "./FilterButton";
4
+ export { default as FilterButtonPrimary } from "./FilterButtonPrimary";
4
5
  export { default as GhostButton } from "./GhostButton";
5
6
  export { default as IconButton } from "./IconButton";
7
+ export { default as InboxButton } from "./InboxButton";
8
+ export { default as OAuthProviderButton } from "./OAuthProviderButton";
6
9
  export { default as PendingDocuments } from "./PendingDocuments";
7
10
  export { default as PrimaryButton } from "./PrimaryButton";
8
11
  export { default as SecondaryButton } from "./SecondaryButton";
9
12
  export { default as TabNavigation } from "./TabNavigation";
10
13
  export { default as TertiaryButton } from "./TertiaryButton";
11
- export { default as OAuthProviderButton } from "./OAuthProviderButton";
12
- export { default as ActionButton } from "./ActionButton";
@@ -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.0",
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