allaw-ui 1.0.24 → 1.0.26
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.
- package/dist/components/atoms/buttons/SecondaryButton.css +66 -0
- package/dist/components/atoms/buttons/SecondaryButton.d.ts +1 -0
- package/dist/components/atoms/buttons/SecondaryButton.js +4 -4
- package/dist/components/atoms/buttons/TabNavigation.css +1 -1
- package/dist/components/atoms/datepickers/Datepicker.d.ts +1 -0
- package/dist/components/atoms/datepickers/Datepicker.js +67 -14
- package/dist/components/atoms/datepickers/datepicker.css +37 -5
- package/dist/components/molecules/contactCard/ContactCard.d.ts +1 -0
- package/dist/components/molecules/contactCard/ContactCard.js +2 -2
- package/dist/components/molecules/datepickerForm/DatepickerForm.d.ts +1 -1
- package/dist/components/molecules/datepickerForm/DatepickerForm.js +4 -76
- package/dist/components/molecules/datepickerForm/datepickerForm.css +0 -211
- package/dist/components/molecules/documentCard/DocumentCard.css +4 -0
- package/dist/components/molecules/documentCard/DocumentCard.js +4 -1
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
.secondary-button-enabled:hover {
|
|
26
26
|
color: #25beeb;
|
|
27
|
+
border: 0px;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
.secondary-button-enabled:active {
|
|
@@ -122,3 +123,68 @@
|
|
|
122
123
|
.secondary-button-full-width {
|
|
123
124
|
width: 100%;
|
|
124
125
|
}
|
|
126
|
+
|
|
127
|
+
/* Styles pour les différentes couleurs */
|
|
128
|
+
.secondary-button-color-bleu-allaw {
|
|
129
|
+
border-color: var(--bleu-allaw);
|
|
130
|
+
color: var(--bleu-allaw);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.secondary-button-color-mid-grey {
|
|
134
|
+
border-color: var(--mid-grey);
|
|
135
|
+
color: var(--mid-grey);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.secondary-button-color-dark-grey {
|
|
139
|
+
border-color: var(--dark-grey);
|
|
140
|
+
color: var(--dark-grey);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.secondary-button-color-noir {
|
|
144
|
+
border-color: var(--noir);
|
|
145
|
+
color: var(--noir);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.secondary-button-color-pure-white {
|
|
149
|
+
border-color: var(--pure-white);
|
|
150
|
+
color: var(--pure-white);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.secondary-button-color-actions-error {
|
|
154
|
+
border-color: var(--actions-error);
|
|
155
|
+
color: var(--actions-error);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.secondary-button-color-actions-valid {
|
|
159
|
+
border-color: var(--actions-valid);
|
|
160
|
+
color: var(--actions-valid);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Ajustement des icônes pour chaque couleur */
|
|
164
|
+
.secondary-button-color-bleu-allaw .secondary-button-icon {
|
|
165
|
+
color: var(--bleu-allaw);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.secondary-button-color-mid-grey .secondary-button-icon {
|
|
169
|
+
color: var(--mid-grey);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.secondary-button-color-dark-grey .secondary-button-icon {
|
|
173
|
+
color: var(--dark-grey);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.secondary-button-color-noir .secondary-button-icon {
|
|
177
|
+
color: var(--noir);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.secondary-button-color-pure-white .secondary-button-icon {
|
|
181
|
+
color: var(--pure-white);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.secondary-button-color-actions-error .secondary-button-icon {
|
|
185
|
+
color: var(--actions-error);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.secondary-button-color-actions-valid .secondary-button-icon {
|
|
189
|
+
color: var(--actions-valid);
|
|
190
|
+
}
|
|
@@ -9,6 +9,7 @@ export interface SecondaryButtonProps extends ButtonHTMLAttributes<HTMLButtonEle
|
|
|
9
9
|
label: string;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
mode?: "dark" | "light";
|
|
12
|
+
color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white" | "actions-error" | "actions-valid";
|
|
12
13
|
onClick?: () => Promise<void> | void;
|
|
13
14
|
fullWidth?: boolean;
|
|
14
15
|
type?: "button" | "submit" | "reset";
|
|
@@ -61,10 +61,10 @@ import React, { forwardRef, useImperativeHandle, useState, useEffect, } from "re
|
|
|
61
61
|
import "./SecondaryButton.css";
|
|
62
62
|
import "../../../styles/global.css";
|
|
63
63
|
var SecondaryButton = forwardRef(function (_a, ref) {
|
|
64
|
-
var startIcon = _a.startIcon, endIcon = _a.endIcon, startIconName = _a.startIconName, endIconName = _a.endIconName, label = _a.label, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.mode, mode = _c === void 0 ? "dark" : _c, onClick = _a.onClick,
|
|
64
|
+
var startIcon = _a.startIcon, endIcon = _a.endIcon, startIconName = _a.startIconName, endIconName = _a.endIconName, label = _a.label, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.mode, mode = _c === void 0 ? "dark" : _c, _d = _a.color, color = _d === void 0 ? "noir" : _d, onClick = _a.onClick, _e = _a.fullWidth, fullWidth = _e === void 0 ? false : _e, _f = _a.type, type = _f === void 0 ? "button" : _f, _g = _a.isLoading, isLoading = _g === void 0 ? false : _g, props = __rest(_a, ["startIcon", "endIcon", "startIconName", "endIconName", "label", "disabled", "mode", "color", "onClick", "fullWidth", "type", "isLoading"]);
|
|
65
65
|
var buttonRef = React.useRef(null);
|
|
66
|
-
var
|
|
67
|
-
var
|
|
66
|
+
var _h = useState(false), internalIsLoading = _h[0], setInternalIsLoading = _h[1];
|
|
67
|
+
var _j = useState(""), loadingDots = _j[0], setLoadingDots = _j[1];
|
|
68
68
|
useImperativeHandle(ref, function () { return buttonRef.current; });
|
|
69
69
|
var isButtonLoading = isLoading || internalIsLoading;
|
|
70
70
|
useEffect(function () {
|
|
@@ -108,7 +108,7 @@ var SecondaryButton = forwardRef(function (_a, ref) {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
}); };
|
|
111
|
-
return (React.createElement("button", __assign({ ref: buttonRef, className: "secondary-button ".concat(disabled ? "secondary-button-disabled" : "secondary-button-enabled", " secondary-button-").concat(mode, " ").concat(fullWidth ? "secondary-button-full-width" : "", " ").concat(isButtonLoading ? "secondary-button-loading" : ""), disabled: disabled, onClick: handleClick, type: type }, props),
|
|
111
|
+
return (React.createElement("button", __assign({ ref: buttonRef, className: "secondary-button ".concat(disabled ? "secondary-button-disabled" : "secondary-button-enabled", " secondary-button-").concat(mode, " ").concat(fullWidth ? "secondary-button-full-width" : "", " ").concat(isButtonLoading ? "secondary-button-loading" : "", " ").concat(color ? "secondary-button-color-".concat(color) : ""), disabled: disabled, onClick: handleClick, type: type }, props),
|
|
112
112
|
startIcon && (React.createElement("span", { className: "secondary-button-icon ".concat(startIconName) })),
|
|
113
113
|
React.createElement("span", { className: "secondary-button-label" }, label),
|
|
114
114
|
isButtonLoading ? (React.createElement("span", { className: "secondary-button-loading-dots" }, loadingDots)) : (endIcon && React.createElement("span", { className: "secondary-button-icon ".concat(endIconName) }))));
|
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
import React, { forwardRef, useState, useRef, useEffect } from "react";
|
|
2
13
|
import ReactDatePicker from "react-datepicker";
|
|
3
14
|
import ReactDOM from "react-dom";
|
|
@@ -8,24 +19,68 @@ import { fr } from "date-fns/locale";
|
|
|
8
19
|
import { format } from "date-fns";
|
|
9
20
|
var CustomInput = forwardRef(function (_a, ref) {
|
|
10
21
|
var value = _a.value, onClick = _a.onClick, placeholder = _a.placeholder;
|
|
22
|
+
var _b = useState(placeholder), displayedPlaceholder = _b[0], setDisplayedPlaceholder = _b[1];
|
|
23
|
+
var containerRef = useRef(null);
|
|
24
|
+
var testRef = useRef(null);
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
var checkTextFit = function () {
|
|
27
|
+
if (containerRef.current && testRef.current && placeholder) {
|
|
28
|
+
// Élément de test invisible pour mesurer la largeur réelle du texte complet
|
|
29
|
+
testRef.current.style.visibility = "hidden";
|
|
30
|
+
testRef.current.style.position = "absolute";
|
|
31
|
+
testRef.current.textContent = placeholder;
|
|
32
|
+
var containerWidth = containerRef.current.offsetWidth;
|
|
33
|
+
var textWidth = testRef.current.offsetWidth;
|
|
34
|
+
// Ajouter une marge pour l'icône et le padding (40px)
|
|
35
|
+
setDisplayedPlaceholder(textWidth + 40 > containerWidth ? "Date" : placeholder);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
checkTextFit();
|
|
39
|
+
window.addEventListener("resize", checkTextFit);
|
|
40
|
+
return function () { return window.removeEventListener("resize", checkTextFit); };
|
|
41
|
+
}, [placeholder]);
|
|
11
42
|
return (React.createElement("button", { type: "button", className: "datepicker", onClick: onClick, ref: ref },
|
|
12
|
-
React.createElement("span", { className: "datepicker-
|
|
13
|
-
|
|
43
|
+
React.createElement("span", { className: "datepicker-content", ref: containerRef },
|
|
44
|
+
React.createElement("span", { className: "datepicker-text" }, value || displayedPlaceholder),
|
|
45
|
+
React.createElement("i", { className: "datepicker-icon allaw-icon-calendar" })),
|
|
46
|
+
React.createElement("span", { className: "datepicker-test-text", ref: testRef, "aria-hidden": "true" })));
|
|
14
47
|
});
|
|
15
48
|
CustomInput.displayName = "CustomInput";
|
|
16
49
|
var Datepicker = function (_a) {
|
|
17
|
-
var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b;
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
50
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, _c = _a.yearDropdownItemNumber, yearDropdownItemNumber = _c === void 0 ? 10 : _c;
|
|
51
|
+
var _d = useState(value), selectedDate = _d[0], setSelectedDate = _d[1];
|
|
52
|
+
var _e = useState(false), isOpen = _e[0], setIsOpen = _e[1];
|
|
53
|
+
var _f = useState({ top: 0, left: 0 }), position = _f[0], setPosition = _f[1];
|
|
21
54
|
var buttonRef = useRef(null);
|
|
22
55
|
var calendarRef = useRef(null);
|
|
56
|
+
var _g = useState("bottom"), placement = _g[0], setPlacement = _g[1];
|
|
23
57
|
var updatePosition = function () {
|
|
24
58
|
if (buttonRef.current) {
|
|
25
59
|
var rect = buttonRef.current.getBoundingClientRect();
|
|
60
|
+
var windowHeight = window.innerHeight;
|
|
61
|
+
var calendarHeight = 360; // Hauteur approximative du calendrier
|
|
62
|
+
// Vérifier s'il y a assez d'espace en dessous
|
|
63
|
+
var spaceBelow = windowHeight - rect.bottom;
|
|
64
|
+
var shouldShowBelow = spaceBelow >= calendarHeight;
|
|
65
|
+
setPlacement(shouldShowBelow ? "bottom" : "top");
|
|
66
|
+
// Calcul de la position horizontale centrée
|
|
67
|
+
var buttonCenter = rect.left + rect.width / 2;
|
|
68
|
+
var calendarWidth = 300; // Largeur du calendrier
|
|
69
|
+
var leftPosition = buttonCenter - calendarWidth / 2;
|
|
70
|
+
// Ajuster si le calendrier dépasse de l'écran
|
|
71
|
+
if (leftPosition + calendarWidth > window.innerWidth) {
|
|
72
|
+
leftPosition = window.innerWidth - calendarWidth - 16;
|
|
73
|
+
}
|
|
74
|
+
if (leftPosition < 16) {
|
|
75
|
+
leftPosition = 16;
|
|
76
|
+
}
|
|
77
|
+
// Calcul de la position verticale
|
|
78
|
+
var topPosition = shouldShowBelow
|
|
79
|
+
? rect.bottom + window.scrollY + 8 // 8px de marge en dessous du bouton
|
|
80
|
+
: rect.top + window.scrollY - calendarHeight - 8; // 8px de marge au-dessus du bouton
|
|
26
81
|
setPosition({
|
|
27
|
-
top:
|
|
28
|
-
left:
|
|
82
|
+
top: topPosition,
|
|
83
|
+
left: leftPosition + window.scrollX,
|
|
29
84
|
});
|
|
30
85
|
}
|
|
31
86
|
};
|
|
@@ -66,12 +121,10 @@ var Datepicker = function (_a) {
|
|
|
66
121
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
67
122
|
};
|
|
68
123
|
}, [isOpen]);
|
|
69
|
-
var renderCalendar = function () { return (React.createElement("div", { ref: calendarRef, className: "datepicker-portal", style: {
|
|
70
|
-
|
|
71
|
-
top: "".concat(position.top, "px"),
|
|
72
|
-
|
|
73
|
-
} },
|
|
74
|
-
React.createElement(ReactDatePicker, { selected: selectedDate, onChange: handleDateChange, locale: fr, inline: true, dateFormat: "dd MMMM yyyy", calendarClassName: "custom-calendar", showMonthDropdown: true, showYearDropdown: true, dropdownMode: "select", yearItemNumber: 15, maxDate: new Date() }))); };
|
|
124
|
+
var renderCalendar = function () { return (React.createElement("div", { ref: calendarRef, className: "datepicker-portal ".concat(placement), style: __assign({ left: "".concat(position.left, "px") }, (placement === "bottom"
|
|
125
|
+
? { top: "".concat(position.top, "px") }
|
|
126
|
+
: { top: "".concat(position.top, "px") })) },
|
|
127
|
+
React.createElement(ReactDatePicker, { selected: selectedDate, onChange: handleDateChange, locale: fr, inline: true, dateFormat: "dd MMMM yyyy", calendarClassName: "custom-calendar", showMonthDropdown: true, showYearDropdown: true, dropdownMode: "select", maxDate: new Date(), minDate: new Date(new Date().setFullYear(new Date().getFullYear() - yearDropdownItemNumber)) }))); };
|
|
75
128
|
return (React.createElement("div", { className: "datepicker-container", ref: buttonRef },
|
|
76
129
|
React.createElement(CustomInput, { value: selectedDate
|
|
77
130
|
? format(selectedDate, "dd MMMM yyyy", { locale: fr })
|
|
@@ -7,15 +7,13 @@
|
|
|
7
7
|
display: flex;
|
|
8
8
|
height: 40px;
|
|
9
9
|
padding: 8px 16px;
|
|
10
|
-
justify-content:
|
|
10
|
+
justify-content: space-between;
|
|
11
11
|
align-items: center;
|
|
12
|
-
gap: 8px;
|
|
13
|
-
align-self: stretch;
|
|
14
12
|
border-radius: 8px;
|
|
15
13
|
background: var(--Primary-Light-grey, #f4f7fb);
|
|
16
14
|
border: none;
|
|
17
15
|
cursor: pointer;
|
|
18
|
-
min-width:
|
|
16
|
+
min-width: 120px;
|
|
19
17
|
width: 100%;
|
|
20
18
|
}
|
|
21
19
|
|
|
@@ -23,6 +21,14 @@
|
|
|
23
21
|
background: var(--grey-venom, #e6edf5);
|
|
24
22
|
}
|
|
25
23
|
|
|
24
|
+
.datepicker-content {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
width: 100%;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
.datepicker-text {
|
|
27
33
|
color: var(--Primary-Mid-black, #171e25);
|
|
28
34
|
font-family: "Open Sans";
|
|
@@ -33,12 +39,22 @@
|
|
|
33
39
|
white-space: nowrap;
|
|
34
40
|
overflow: hidden;
|
|
35
41
|
text-overflow: ellipsis;
|
|
42
|
+
flex: 1;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
.datepicker-icon {
|
|
39
46
|
color: var(--Primary-Dark-grey, #456073);
|
|
40
47
|
font-size: 16px;
|
|
41
|
-
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.datepicker-test-text {
|
|
52
|
+
visibility: hidden;
|
|
53
|
+
position: absolute;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
font-family: "Open Sans";
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
font-weight: 700;
|
|
42
58
|
}
|
|
43
59
|
|
|
44
60
|
/* Customisation du calendrier */
|
|
@@ -147,6 +163,12 @@
|
|
|
147
163
|
box-shadow: 0px 4px 8px 0px rgba(9, 30, 66, 0.15);
|
|
148
164
|
}
|
|
149
165
|
|
|
166
|
+
/* Suppression des styles top et bottom qui ne sont plus nécessaires */
|
|
167
|
+
.datepicker-portal.top,
|
|
168
|
+
.datepicker-portal.bottom {
|
|
169
|
+
transform: none; /* Suppression de la transformation */
|
|
170
|
+
}
|
|
171
|
+
|
|
150
172
|
/* Customisation des flèches de navigation */
|
|
151
173
|
.react-datepicker__navigation {
|
|
152
174
|
padding: 8px;
|
|
@@ -206,3 +228,13 @@
|
|
|
206
228
|
.react-datepicker__year-text:not([aria-disabled="true"]):hover {
|
|
207
229
|
border-radius: 18px;
|
|
208
230
|
}
|
|
231
|
+
|
|
232
|
+
.react-datepicker__day--disabled {
|
|
233
|
+
color: var(--venom-grey-dark, #d1dce8) !important;
|
|
234
|
+
cursor: not-allowed;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.react-datepicker__day--disabled:hover {
|
|
238
|
+
background: none !important;
|
|
239
|
+
cursor: not-allowed;
|
|
240
|
+
}
|
|
@@ -5,7 +5,7 @@ import IconButton from "../../atoms/buttons/IconButton";
|
|
|
5
5
|
import Image from "next/image";
|
|
6
6
|
var NoPhoto = "/assets/NoPhoto.png";
|
|
7
7
|
var ContactCard = function (_a) {
|
|
8
|
-
var size = _a.size, name = _a.name, birthDate = _a.birthDate, avatarUrl = _a.avatarUrl, status = _a.status, address = _a.address, phone = _a.phone, email = _a.email, onEdit = _a.onEdit, gender = _a.gender;
|
|
8
|
+
var size = _a.size, name = _a.name, birthDate = _a.birthDate, avatarUrl = _a.avatarUrl, status = _a.status, address = _a.address, phone = _a.phone, email = _a.email, onEdit = _a.onEdit, gender = _a.gender, _b = _a.actionIconName, actionIconName = _b === void 0 ? "allaw-icon-edit-2" : _b;
|
|
9
9
|
var renderContent = function () {
|
|
10
10
|
switch (size) {
|
|
11
11
|
case "small":
|
|
@@ -73,7 +73,7 @@ var ContactCard = function (_a) {
|
|
|
73
73
|
React.createElement("i", { className: "allaw-icon-mail info-icon" }),
|
|
74
74
|
React.createElement("span", { className: "info-text contact" }, email))))),
|
|
75
75
|
React.createElement("div", { className: "action-button-container" },
|
|
76
|
-
React.createElement(IconButton, { style: "largeFilled", iconName:
|
|
76
|
+
React.createElement(IconButton, { style: "largeFilled", iconName: actionIconName, onClick: onEdit }))));
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
return React.createElement("div", { className: "contact-card ".concat(size) }, renderContent());
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import "react-datepicker/dist/react-datepicker.css";
|
|
3
2
|
import "./datepickerForm.css";
|
|
4
3
|
import "../../../styles/global.css";
|
|
5
4
|
export interface DatepickerFormProps {
|
|
@@ -9,6 +8,7 @@ export interface DatepickerFormProps {
|
|
|
9
8
|
text?: string;
|
|
10
9
|
variant?: "bold" | "semiBold" | "medium";
|
|
11
10
|
color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white" | "grey-venom" | "venom-grey-dark";
|
|
11
|
+
yearDropdownItemNumber?: number;
|
|
12
12
|
}
|
|
13
13
|
declare const DatepickerForm: React.FC<DatepickerFormProps>;
|
|
14
14
|
export default DatepickerForm;
|
|
@@ -1,84 +1,12 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import ReactDatePicker from "react-datepicker";
|
|
3
|
-
import ReactDOM from "react-dom";
|
|
4
|
-
import "react-datepicker/dist/react-datepicker.css";
|
|
1
|
+
import React from "react";
|
|
5
2
|
import "./datepickerForm.css";
|
|
6
3
|
import "../../../styles/global.css";
|
|
7
|
-
import { fr } from "date-fns/locale";
|
|
8
|
-
import { format } from "date-fns";
|
|
9
4
|
import Paragraph from "../../atoms/typography/Paragraph";
|
|
10
|
-
|
|
11
|
-
var value = _a.value, onClick = _a.onClick, placeholder = _a.placeholder;
|
|
12
|
-
return (React.createElement("button", { type: "button", className: "datepicker-form", onClick: onClick, ref: ref },
|
|
13
|
-
React.createElement("span", { className: "datepicker-form-text" }, value || placeholder),
|
|
14
|
-
React.createElement("i", { className: "datepicker-form-icon allaw-icon-calendar" })));
|
|
15
|
-
});
|
|
16
|
-
CustomInput.displayName = "CustomInput";
|
|
5
|
+
import Datepicker from "../../atoms/datepickers/Datepicker";
|
|
17
6
|
var DatepickerForm = function (_a) {
|
|
18
|
-
var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, text = _a.text, _c = _a.variant, variant = _c === void 0 ? "medium" : _c, _d = _a.color, color = _d === void 0 ? "noir" : _d;
|
|
19
|
-
var _e = useState(value), selectedDate = _e[0], setSelectedDate = _e[1];
|
|
20
|
-
var _f = useState(false), isOpen = _f[0], setIsOpen = _f[1];
|
|
21
|
-
var _g = useState({ top: 0, left: 0 }), position = _g[0], setPosition = _g[1];
|
|
22
|
-
var buttonRef = useRef(null);
|
|
23
|
-
var calendarRef = useRef(null);
|
|
24
|
-
var updatePosition = function () {
|
|
25
|
-
if (buttonRef.current) {
|
|
26
|
-
var rect = buttonRef.current.getBoundingClientRect();
|
|
27
|
-
setPosition({
|
|
28
|
-
top: rect.bottom + window.scrollY,
|
|
29
|
-
left: rect.left + window.scrollX,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
if (isOpen) {
|
|
35
|
-
updatePosition();
|
|
36
|
-
window.addEventListener("scroll", updatePosition);
|
|
37
|
-
window.addEventListener("resize", updatePosition);
|
|
38
|
-
}
|
|
39
|
-
return function () {
|
|
40
|
-
window.removeEventListener("scroll", updatePosition);
|
|
41
|
-
window.removeEventListener("resize", updatePosition);
|
|
42
|
-
};
|
|
43
|
-
}, [isOpen]);
|
|
44
|
-
var handleDateChange = function (date) {
|
|
45
|
-
if (date) {
|
|
46
|
-
setSelectedDate(date);
|
|
47
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
48
|
-
setIsOpen(false);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var handleClickOutside = function (event) {
|
|
52
|
-
if (buttonRef.current &&
|
|
53
|
-
!buttonRef.current.contains(event.target) &&
|
|
54
|
-
calendarRef.current &&
|
|
55
|
-
!calendarRef.current.contains(event.target)) {
|
|
56
|
-
setIsOpen(false);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
useEffect(function () {
|
|
60
|
-
if (isOpen) {
|
|
61
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
65
|
-
}
|
|
66
|
-
return function () {
|
|
67
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
68
|
-
};
|
|
69
|
-
}, [isOpen]);
|
|
70
|
-
var renderCalendar = function () { return (React.createElement("div", { ref: calendarRef, className: "datepicker-form-portal", style: {
|
|
71
|
-
position: "absolute",
|
|
72
|
-
top: "".concat(position.top, "px"),
|
|
73
|
-
left: "".concat(position.left, "px"),
|
|
74
|
-
} },
|
|
75
|
-
React.createElement(ReactDatePicker, { selected: selectedDate, onChange: handleDateChange, locale: fr, inline: true, dateFormat: "dd MMMM yyyy", calendarClassName: "custom-calendar", showMonthDropdown: true, showYearDropdown: true, dropdownMode: "select", yearItemNumber: 15, maxDate: new Date() }))); };
|
|
7
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, text = _a.text, _c = _a.variant, variant = _c === void 0 ? "medium" : _c, _d = _a.color, color = _d === void 0 ? "noir" : _d, _e = _a.yearDropdownItemNumber, yearDropdownItemNumber = _e === void 0 ? 10 : _e;
|
|
76
8
|
return (React.createElement("div", { className: "datepicker-form-wrapper" },
|
|
77
9
|
text && React.createElement(Paragraph, { text: text, variant: variant, color: color }),
|
|
78
|
-
React.createElement(
|
|
79
|
-
React.createElement(CustomInput, { value: selectedDate
|
|
80
|
-
? format(selectedDate, "dd MMMM yyyy", { locale: fr })
|
|
81
|
-
: "", onClick: function () { return setIsOpen(!isOpen); }, placeholder: placeholder }),
|
|
82
|
-
isOpen && ReactDOM.createPortal(renderCalendar(), document.body))));
|
|
10
|
+
React.createElement(Datepicker, { value: value, onChange: onChange, placeholder: placeholder, yearDropdownItemNumber: yearDropdownItemNumber })));
|
|
83
11
|
};
|
|
84
12
|
export default DatepickerForm;
|
|
@@ -1,214 +1,3 @@
|
|
|
1
|
-
.datepicker-form-container {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.datepicker-form {
|
|
7
|
-
display: flex;
|
|
8
|
-
height: 40px;
|
|
9
|
-
padding: 8px 16px;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
align-items: center;
|
|
12
|
-
gap: 8px;
|
|
13
|
-
align-self: stretch;
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
background: var(--Primary-Light-grey, #f4f7fb);
|
|
16
|
-
border: none;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
min-width: 200px;
|
|
19
|
-
width: 100%;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.datepicker-form:hover {
|
|
23
|
-
background: var(--grey-venom, #e6edf5);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.datepicker-form-text {
|
|
27
|
-
color: var(--Primary-Mid-black, #171e25);
|
|
28
|
-
font-family: "Open Sans";
|
|
29
|
-
font-size: 16px;
|
|
30
|
-
font-style: normal;
|
|
31
|
-
font-weight: 700;
|
|
32
|
-
line-height: normal;
|
|
33
|
-
white-space: nowrap;
|
|
34
|
-
overflow: hidden;
|
|
35
|
-
text-overflow: ellipsis;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.datepicker-form-icon {
|
|
39
|
-
color: var(--Primary-Dark-grey, #456073);
|
|
40
|
-
font-size: 16px;
|
|
41
|
-
padding-left: 6px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* Customisation du calendrier */
|
|
45
|
-
.custom-calendar {
|
|
46
|
-
border: none !important;
|
|
47
|
-
font-family: "Open Sans";
|
|
48
|
-
font-size: 16px;
|
|
49
|
-
width: 300px !important;
|
|
50
|
-
padding: 16px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.react-datepicker-form__month-container {
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.react-datepicker-form__header {
|
|
58
|
-
background: white;
|
|
59
|
-
border: none;
|
|
60
|
-
padding: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.react-datepicker-form__day-names {
|
|
64
|
-
display: flex;
|
|
65
|
-
justify-content: space-between;
|
|
66
|
-
padding: 16px 8px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.react-datepicker-form__day-name {
|
|
70
|
-
color: var(--Primary-Dark-grey, #456073);
|
|
71
|
-
font-weight: 600;
|
|
72
|
-
width: 36px;
|
|
73
|
-
margin: 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.react-datepicker-form__month {
|
|
77
|
-
margin: 0;
|
|
78
|
-
padding: 8px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.react-datepicker-form__day {
|
|
82
|
-
width: 36px;
|
|
83
|
-
height: 36px;
|
|
84
|
-
line-height: 36px;
|
|
85
|
-
margin: 0;
|
|
86
|
-
border-radius: 18px;
|
|
87
|
-
color: var(--Primary-Dark-grey, #456073);
|
|
88
|
-
font-family: "Open Sans";
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.react-datepicker-form__day:hover {
|
|
92
|
-
background: var(--grey-venom, #e6edf5);
|
|
93
|
-
border-radius: 18px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.react-datepicker-form__day--selected {
|
|
97
|
-
background: var(--bleu-allaw, #1985e8) !important;
|
|
98
|
-
border-radius: 18px !important;
|
|
99
|
-
color: white !important;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.react-datepicker-form__day--keyboard-selected {
|
|
103
|
-
background: var(--grey-venom, #e6edf5);
|
|
104
|
-
border-radius: 18px;
|
|
105
|
-
color: var(--Primary-Mid-black, #171e25);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.react-datepicker-form__day--keyboard-selected:not(
|
|
109
|
-
[aria-disabled="true"]
|
|
110
|
-
):hover,
|
|
111
|
-
.react-datepicker-form__month-text--keyboard-selected:not(
|
|
112
|
-
[aria-disabled="true"]
|
|
113
|
-
):hover,
|
|
114
|
-
.react-datepicker-form__quarter-text--keyboard-selected:not(
|
|
115
|
-
[aria-disabled="true"]
|
|
116
|
-
):hover,
|
|
117
|
-
.react-datepicker-form__year-text--keyboard-selected:not(
|
|
118
|
-
[aria-disabled="true"]
|
|
119
|
-
):hover {
|
|
120
|
-
background-color: var(--bleu-allaw, #25beeb);
|
|
121
|
-
color: white;
|
|
122
|
-
border-radius: 18px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.custom-header {
|
|
126
|
-
margin-bottom: 16px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.year-dropdown,
|
|
130
|
-
.month-dropdown {
|
|
131
|
-
padding: 8px;
|
|
132
|
-
min-width: 100px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/* Style pour mobile */
|
|
136
|
-
@media (max-width: 768px) {
|
|
137
|
-
.datepicker-form {
|
|
138
|
-
width: 100%;
|
|
139
|
-
min-width: unset;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.datepicker-form-portal {
|
|
144
|
-
position: absolute;
|
|
145
|
-
z-index: 9999;
|
|
146
|
-
background: white;
|
|
147
|
-
border: 1px solid var(--grey-venom, #e6edf5);
|
|
148
|
-
border-radius: 8px;
|
|
149
|
-
box-shadow: 0px 4px 8px 0px rgba(9, 30, 66, 0.15);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/* Customisation des flèches de navigation */
|
|
153
|
-
.react-datepicker-form__navigation {
|
|
154
|
-
padding: 8px;
|
|
155
|
-
border-radius: 18px;
|
|
156
|
-
margin: 8px;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.react-datepicker-form__navigation--previous {
|
|
160
|
-
left: 1px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.react-datepicker-form__navigation--next {
|
|
164
|
-
right: 1px;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.react-datepicker-form__navigation:hover {
|
|
168
|
-
background: var(--grey-venom, #e6edf5);
|
|
169
|
-
border-radius: 18px;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/* Padding pour le mois en cours */
|
|
173
|
-
.react-datepicker-form__current-month {
|
|
174
|
-
padding-bottom: 18px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.react-datepicker-form__current-month.react-datepicker-form__current-month--hasYearDropdown.react-datepicker-form__current-month--hasMonthDropdown {
|
|
178
|
-
padding-bottom: 16px;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.react-datepicker-form__month-select,
|
|
182
|
-
.react-datepicker-form__year-select {
|
|
183
|
-
font-size: 16px;
|
|
184
|
-
font-family: "Open Sans";
|
|
185
|
-
padding: 6px 10px;
|
|
186
|
-
border-radius: 8px;
|
|
187
|
-
border: 1px solid var(--grey-venom, #e6edf5);
|
|
188
|
-
background-color: white;
|
|
189
|
-
cursor: pointer;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.react-datepicker-form__month-select:hover,
|
|
193
|
-
.react-datepicker-form__year-select:hover {
|
|
194
|
-
background: var(--grey-venom, #e6edf5);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.react-datepicker-form__navigation-icon.react-datepicker-form__navigation-icon--previous {
|
|
198
|
-
left: 1px;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.react-datepicker-form__navigation-icon.react-datepicker-form__navigation-icon--next {
|
|
202
|
-
right: 1px;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.react-datepicker-form__day:not([aria-disabled="true"]):hover,
|
|
206
|
-
.react-datepicker-form__month-text:not([aria-disabled="true"]):hover,
|
|
207
|
-
.react-datepicker-form__quarter-text:not([aria-disabled="true"]):hover,
|
|
208
|
-
.react-datepicker-form__year-text:not([aria-disabled="true"]):hover {
|
|
209
|
-
border-radius: 18px;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
1
|
.datepicker-form-wrapper {
|
|
213
2
|
display: flex;
|
|
214
3
|
flex-direction: column;
|
|
@@ -67,6 +67,9 @@ var DocumentCard = function (_a) {
|
|
|
67
67
|
React.createElement(Paragraph, { text: title, variant: "semiBold", size: "default", maxLines: 1, color: "noir" }),
|
|
68
68
|
React.createElement("span", { className: "document-card-date" }, formatDate(date)))),
|
|
69
69
|
React.createElement("div", { className: "document-card-right" },
|
|
70
|
-
React.createElement(
|
|
70
|
+
React.createElement("div", { className: "document-card-status" },
|
|
71
|
+
React.createElement(OtherStatusTag, { type: "information", label: getStatusName() })),
|
|
72
|
+
React.createElement("div", { className: "document-card-icon-eye" },
|
|
73
|
+
React.createElement("i", { className: "allaw-icon-eye" })))));
|
|
71
74
|
};
|
|
72
75
|
export default DocumentCard;
|