allaw-ui 1.0.19 → 1.0.21
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/TabNavigation.css +3 -3
- package/dist/components/atoms/datepickers/Datepicker.d.ts +11 -0
- package/dist/components/atoms/datepickers/Datepicker.js +81 -0
- package/dist/components/atoms/datepickers/datepicker.css +207 -0
- package/dist/components/atoms/datepickers/index.d.ts +2 -0
- package/dist/components/atoms/datepickers/index.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -2
- package/package.json +4 -1
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.tab-item.active {
|
|
25
|
-
border-bottom:
|
|
26
|
-
padding-bottom:
|
|
25
|
+
border-bottom: 3px solid #000;
|
|
26
|
+
padding-bottom: 10px;
|
|
27
27
|
color: var(--Primary-Mid-black, var(--primary-black, #171e25));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.tab-item.inactive {
|
|
31
|
-
border-bottom:
|
|
31
|
+
border-bottom: 3px solid var(--grey-venom, #e6edf5);
|
|
32
32
|
color: var(--Tags-Mid-grey, var(--light-grey, #728ea7));
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
3
|
+
import "./datepicker.css";
|
|
4
|
+
import "../../../styles/global.css";
|
|
5
|
+
export interface DatepickerProps {
|
|
6
|
+
value?: Date;
|
|
7
|
+
onChange?: (date: Date) => void;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Datepicker: React.FC<DatepickerProps>;
|
|
11
|
+
export default Datepicker;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { forwardRef, useState, useRef, useEffect } from "react";
|
|
2
|
+
import ReactDatePicker from "react-datepicker";
|
|
3
|
+
import ReactDOM from "react-dom";
|
|
4
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
5
|
+
import "./datepicker.css";
|
|
6
|
+
import "../../../styles/global.css";
|
|
7
|
+
import { fr } from "date-fns/locale";
|
|
8
|
+
import { format } from "date-fns";
|
|
9
|
+
var CustomInput = forwardRef(function (_a, ref) {
|
|
10
|
+
var value = _a.value, onClick = _a.onClick, placeholder = _a.placeholder;
|
|
11
|
+
return (React.createElement("button", { type: "button", className: "datepicker", onClick: onClick, ref: ref },
|
|
12
|
+
React.createElement("span", { className: "datepicker-text" }, value || placeholder),
|
|
13
|
+
React.createElement("i", { className: "datepicker-icon allaw-icon-calendar" })));
|
|
14
|
+
});
|
|
15
|
+
CustomInput.displayName = "CustomInput";
|
|
16
|
+
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 _c = useState(value), selectedDate = _c[0], setSelectedDate = _c[1];
|
|
19
|
+
var _d = useState(false), isOpen = _d[0], setIsOpen = _d[1];
|
|
20
|
+
var _e = useState({ top: 0, left: 0 }), position = _e[0], setPosition = _e[1];
|
|
21
|
+
var buttonRef = useRef(null);
|
|
22
|
+
var calendarRef = useRef(null);
|
|
23
|
+
var updatePosition = function () {
|
|
24
|
+
if (buttonRef.current) {
|
|
25
|
+
var rect = buttonRef.current.getBoundingClientRect();
|
|
26
|
+
setPosition({
|
|
27
|
+
top: rect.bottom + window.scrollY,
|
|
28
|
+
left: rect.left + window.scrollX,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
if (isOpen) {
|
|
34
|
+
updatePosition();
|
|
35
|
+
window.addEventListener("scroll", updatePosition);
|
|
36
|
+
window.addEventListener("resize", updatePosition);
|
|
37
|
+
}
|
|
38
|
+
return function () {
|
|
39
|
+
window.removeEventListener("scroll", updatePosition);
|
|
40
|
+
window.removeEventListener("resize", updatePosition);
|
|
41
|
+
};
|
|
42
|
+
}, [isOpen]);
|
|
43
|
+
var handleDateChange = function (date) {
|
|
44
|
+
if (date) {
|
|
45
|
+
setSelectedDate(date);
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
47
|
+
setIsOpen(false);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var handleClickOutside = function (event) {
|
|
51
|
+
if (buttonRef.current &&
|
|
52
|
+
!buttonRef.current.contains(event.target) &&
|
|
53
|
+
calendarRef.current &&
|
|
54
|
+
!calendarRef.current.contains(event.target)) {
|
|
55
|
+
setIsOpen(false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
if (isOpen) {
|
|
60
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
64
|
+
}
|
|
65
|
+
return function () {
|
|
66
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
67
|
+
};
|
|
68
|
+
}, [isOpen]);
|
|
69
|
+
var renderCalendar = function () { return (React.createElement("div", { ref: calendarRef, className: "datepicker-portal", style: {
|
|
70
|
+
position: "absolute",
|
|
71
|
+
top: "".concat(position.top, "px"),
|
|
72
|
+
left: "".concat(position.left, "px"),
|
|
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() }))); };
|
|
75
|
+
return (React.createElement("div", { className: "datepicker-container", ref: buttonRef },
|
|
76
|
+
React.createElement(CustomInput, { value: selectedDate
|
|
77
|
+
? format(selectedDate, "dd MMMM yyyy", { locale: fr })
|
|
78
|
+
: "", onClick: function () { return setIsOpen(!isOpen); }, placeholder: placeholder }),
|
|
79
|
+
isOpen && ReactDOM.createPortal(renderCalendar(), document.body)));
|
|
80
|
+
};
|
|
81
|
+
export default Datepicker;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
.datepicker-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.datepicker {
|
|
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
|
+
}
|
|
20
|
+
|
|
21
|
+
.datepicker:hover {
|
|
22
|
+
background: var(--grey-venom, #e6edf5);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.datepicker-text {
|
|
26
|
+
color: var(--Primary-Mid-black, #171e25);
|
|
27
|
+
font-family: "Open Sans";
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
line-height: normal;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.datepicker-icon {
|
|
38
|
+
color: var(--Primary-Dark-grey, #456073);
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
padding-left: 6px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Customisation du calendrier */
|
|
44
|
+
.custom-calendar {
|
|
45
|
+
border: none !important;
|
|
46
|
+
font-family: "Open Sans";
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
width: 300px !important;
|
|
49
|
+
padding: 16px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.react-datepicker__month-container {
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.react-datepicker__header {
|
|
57
|
+
background: white;
|
|
58
|
+
border: none;
|
|
59
|
+
padding: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.react-datepicker__day-names {
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
padding: 16px 8px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.react-datepicker__day-name {
|
|
69
|
+
color: var(--Primary-Dark-grey, #456073);
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
width: 36px;
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.react-datepicker__month {
|
|
76
|
+
margin: 0;
|
|
77
|
+
padding: 8px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.react-datepicker__day {
|
|
81
|
+
width: 36px;
|
|
82
|
+
height: 36px;
|
|
83
|
+
line-height: 36px;
|
|
84
|
+
margin: 0;
|
|
85
|
+
border-radius: 18px;
|
|
86
|
+
color: var(--Primary-Dark-grey, #456073);
|
|
87
|
+
font-family: "Open Sans";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.react-datepicker__day:hover {
|
|
91
|
+
background: var(--grey-venom, #e6edf5);
|
|
92
|
+
border-radius: 18px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.react-datepicker__day--selected {
|
|
96
|
+
background: var(--bleu-allaw, #1985e8) !important;
|
|
97
|
+
border-radius: 18px !important;
|
|
98
|
+
color: white !important;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.react-datepicker__day--keyboard-selected {
|
|
102
|
+
background: var(--grey-venom, #e6edf5);
|
|
103
|
+
border-radius: 18px;
|
|
104
|
+
color: var(--Primary-Mid-black, #171e25);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.react-datepicker__day--keyboard-selected:not([aria-disabled="true"]):hover,
|
|
108
|
+
.react-datepicker__month-text--keyboard-selected:not(
|
|
109
|
+
[aria-disabled="true"]
|
|
110
|
+
):hover,
|
|
111
|
+
.react-datepicker__quarter-text--keyboard-selected:not(
|
|
112
|
+
[aria-disabled="true"]
|
|
113
|
+
):hover,
|
|
114
|
+
.react-datepicker__year-text--keyboard-selected:not(
|
|
115
|
+
[aria-disabled="true"]
|
|
116
|
+
):hover {
|
|
117
|
+
background-color: var(--bleu-allaw, #25beeb);
|
|
118
|
+
color: white;
|
|
119
|
+
border-radius: 18px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.custom-header {
|
|
123
|
+
margin-bottom: 16px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.year-dropdown,
|
|
127
|
+
.month-dropdown {
|
|
128
|
+
padding: 8px;
|
|
129
|
+
min-width: 100px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Style pour mobile */
|
|
133
|
+
@media (max-width: 768px) {
|
|
134
|
+
.datepicker {
|
|
135
|
+
width: 100%;
|
|
136
|
+
min-width: unset;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.datepicker-portal {
|
|
141
|
+
position: absolute;
|
|
142
|
+
z-index: 9999;
|
|
143
|
+
background: white;
|
|
144
|
+
border: 1px solid var(--grey-venom, #e6edf5);
|
|
145
|
+
border-radius: 8px;
|
|
146
|
+
box-shadow: 0px 4px 8px 0px rgba(9, 30, 66, 0.15);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Customisation des flèches de navigation */
|
|
150
|
+
.react-datepicker__navigation {
|
|
151
|
+
padding: 8px;
|
|
152
|
+
border-radius: 18px;
|
|
153
|
+
margin: 8px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.react-datepicker__navigation--previous {
|
|
157
|
+
left: 1px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.react-datepicker__navigation--next {
|
|
161
|
+
right: 1px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.react-datepicker__navigation:hover {
|
|
165
|
+
background: var(--grey-venom, #e6edf5);
|
|
166
|
+
border-radius: 18px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Padding pour le mois en cours */
|
|
170
|
+
.react-datepicker__current-month {
|
|
171
|
+
padding-bottom: 18px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.react-datepicker__current-month.react-datepicker__current-month--hasYearDropdown.react-datepicker__current-month--hasMonthDropdown {
|
|
175
|
+
padding-bottom: 16px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.react-datepicker__month-select,
|
|
179
|
+
.react-datepicker__year-select {
|
|
180
|
+
font-size: 16px;
|
|
181
|
+
font-family: "Open Sans";
|
|
182
|
+
padding: 6px 10px;
|
|
183
|
+
border-radius: 8px;
|
|
184
|
+
border: 1px solid var(--grey-venom, #e6edf5);
|
|
185
|
+
background-color: white;
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.react-datepicker__month-select:hover,
|
|
190
|
+
.react-datepicker__year-select:hover {
|
|
191
|
+
background: var(--grey-venom, #e6edf5);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.react-datepicker__navigation-icon.react-datepicker__navigation-icon--previous {
|
|
195
|
+
left: 1px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.react-datepicker__navigation-icon.react-datepicker__navigation-icon--next {
|
|
199
|
+
right: 1px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.react-datepicker__day:not([aria-disabled="true"]):hover,
|
|
203
|
+
.react-datepicker__month-text:not([aria-disabled="true"]):hover,
|
|
204
|
+
.react-datepicker__quarter-text:not([aria-disabled="true"]):hover,
|
|
205
|
+
.react-datepicker__year-text:not([aria-disabled="true"]):hover {
|
|
206
|
+
border-radius: 18px;
|
|
207
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Datepicker } from "./Datepicker";
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export { default as Select } from "./components/atoms/selects/Select";
|
|
|
23
23
|
export type { SelectItem, SelectProps, SelectRef, } from "./components/atoms/selects/Select";
|
|
24
24
|
export { default as ComboBox } from "./components/atoms/selects/ComboBox";
|
|
25
25
|
export type { ComboBoxProps, ComboBoxRef, } from "./components/atoms/selects/ComboBox";
|
|
26
|
+
export { default as Datepicker } from "./components/atoms/datepickers/Datepicker";
|
|
27
|
+
export type { DatepickerProps } from "./components/atoms/datepickers/Datepicker";
|
|
26
28
|
export { default as AppointementStatusTag } from "./components/atoms/tags/AppointementStatusTag";
|
|
27
29
|
export { default as FolderStatusTag } from "./components/atoms/tags/FolderStatusTag";
|
|
28
30
|
export { default as OtherStatusTag } from "./components/atoms/tags/OtherStatusTag";
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,8 @@ export { default as SingleFilter } from "./components/atoms/filters/SingleFilter
|
|
|
27
27
|
// Selects
|
|
28
28
|
export { default as Select } from "./components/atoms/selects/Select";
|
|
29
29
|
export { default as ComboBox } from "./components/atoms/selects/ComboBox";
|
|
30
|
+
// Datepickers
|
|
31
|
+
export { default as Datepicker } from "./components/atoms/datepickers/Datepicker";
|
|
30
32
|
// Tags
|
|
31
33
|
export { default as AppointementStatusTag } from "./components/atoms/tags/AppointementStatusTag";
|
|
32
34
|
export { default as FolderStatusTag } from "./components/atoms/tags/FolderStatusTag";
|
|
@@ -48,9 +50,9 @@ export { default as AppointmentSlot } from "./components/molecules/appointmentSl
|
|
|
48
50
|
export { default as CaseCard } from "./components/molecules/caseCard/CaseCard";
|
|
49
51
|
// Contact Card
|
|
50
52
|
export { default as ContactCard } from "./components/molecules/contactCard/ContactCard";
|
|
51
|
-
// Case Link Card
|
|
53
|
+
// Case Link Card
|
|
52
54
|
export { default as CaseCardLink } from "./components/molecules/caseLinkCard/CaseLinkCard";
|
|
53
|
-
// Case Link Card
|
|
55
|
+
// Case Link Card
|
|
54
56
|
export { default as ClientLinkCard } from "./components/molecules/clientLinkCard/ClientLinkCard";
|
|
55
57
|
export { default as LoadingBox } from "./components/molecules/loadingBox/LoadingBox";
|
|
56
58
|
// Document Card
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allaw-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"description": "Composants UI pour l'application Allaw",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -40,8 +40,11 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@types/react-datepicker": "^7.0.0",
|
|
44
|
+
"date-fns": "^4.1.0",
|
|
43
45
|
"next": "14.2.5",
|
|
44
46
|
"react": "^17.0.0 || ^18.0.0",
|
|
47
|
+
"react-datepicker": "^7.5.0",
|
|
45
48
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
46
49
|
"react-hook-form": "^7.53.0",
|
|
47
50
|
"typeface-open-sans": "^1.1.13"
|