allaw-ui 1.0.18 → 1.0.20

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.
@@ -109,3 +109,20 @@
109
109
  font-size: 18px;
110
110
  background: transparent;
111
111
  }
112
+
113
+ .icon-button.custom-color {
114
+ background-color: var(--custom-background-color);
115
+ }
116
+
117
+ .icon-button.custom-color:hover {
118
+ opacity: 0.8;
119
+ }
120
+
121
+ /* Modifier les sélecteurs hover existants */
122
+ .icon-button.smallFilled:not(.custom-color):hover {
123
+ background: var(--grey-venom, #e6edf5);
124
+ }
125
+
126
+ .icon-button.largeFilled:not(.custom-color):hover {
127
+ background: var(--grey-venom, #e6edf5);
128
+ }
@@ -2,8 +2,13 @@ import React from "react";
2
2
  import "./IconButton.css";
3
3
  import "../../../styles/global.css";
4
4
  var IconButton = function (_a) {
5
- var style = _a.style, iconName = _a.iconName, _b = _a.color, color = _b === void 0 ? "var(--secondary-light-grey, #f4f7fb)" : _b, onClick = _a.onClick;
6
- return (React.createElement("button", { className: "icon-button ".concat(style), onClick: onClick, style: { backgroundColor: color } },
5
+ var style = _a.style, iconName = _a.iconName, color = _a.color, onClick = _a.onClick;
6
+ var customStyle = color
7
+ ? {
8
+ "--custom-background-color": color,
9
+ }
10
+ : {};
11
+ return (React.createElement("button", { className: "icon-button ".concat(style, " ").concat(color ? "custom-color" : ""), onClick: onClick, style: customStyle },
7
12
  React.createElement("i", { className: "icon ".concat(iconName) })));
8
13
  };
9
14
  IconButton.defaultProps = {
@@ -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,2 @@
1
+ export { default as Datepicker } from "./Datepicker";
2
+ export type { DatepickerProps } from "./Datepicker";
@@ -0,0 +1 @@
1
+ export { default as Datepicker } from "./Datepicker";
@@ -14,6 +14,7 @@ export interface InputProps {
14
14
  onChange?: (value: string) => void;
15
15
  value?: string;
16
16
  error?: string;
17
+ color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white" | "grey-venom" | "venom-grey-dark";
17
18
  }
18
19
  export interface InputRef {
19
20
  validate: () => boolean;
@@ -6,11 +6,11 @@ import { commonRegex } from "../../../utils/regex";
6
6
  import TinyInfo from "../typography/TinyInfo";
7
7
  import Paragraph from "../typography/Paragraph";
8
8
  var Input = forwardRef(function (_a, ref) {
9
- var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, endIcon = _a.endIcon, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error;
10
- var _d = useState(false), isPasswordVisible = _d[0], setIsPasswordVisible = _d[1];
11
- var _e = useState(propValue || ""), value = _e[0], setValue = _e[1];
12
- var _f = useState(propError || ""), error = _f[0], setError = _f[1];
13
- var _g = useState(false), isTouched = _g[0], setIsTouched = _g[1];
9
+ var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, endIcon = _a.endIcon, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error, _d = _a.color, color = _d === void 0 ? "noir" : _d;
10
+ var _e = useState(false), isPasswordVisible = _e[0], setIsPasswordVisible = _e[1];
11
+ var _f = useState(propValue || ""), value = _f[0], setValue = _f[1];
12
+ var _g = useState(propError || ""), error = _g[0], setError = _g[1];
13
+ var _h = useState(false), isTouched = _h[0], setIsTouched = _h[1];
14
14
  var inputRef = useRef(null);
15
15
  useEffect(function () {
16
16
  setValue(propValue || "");
@@ -71,7 +71,7 @@ var Input = forwardRef(function (_a, ref) {
71
71
  };
72
72
  return (React.createElement("div", { className: "Input Input-".concat(style) },
73
73
  React.createElement("div", { className: "Input-title-container" },
74
- React.createElement(Paragraph, { variant: "semiBold", color: "noir", text: title }),
74
+ React.createElement(Paragraph, { variant: "semiBold", color: color, text: title }),
75
75
  isRequired && title && (React.createElement("span", { className: "Input-required" },
76
76
  "\u00A0",
77
77
  "*"))),
@@ -325,6 +325,7 @@
325
325
 
326
326
  .contact-card.editable .content-container {
327
327
  display: flex;
328
+ flex-direction: row;
328
329
  align-items: center;
329
330
  gap: 24px;
330
331
  }
@@ -392,6 +393,33 @@
392
393
  gap: 16px;
393
394
  }
394
395
 
396
+ @media (max-width: 800px) {
397
+ .contact-card.editable .telephone-email-items {
398
+ flex-direction: column;
399
+ align-items: flex-start;
400
+ gap: 10px;
401
+ }
402
+ }
403
+
404
+ @media (max-width: 600px) {
405
+ .contact-card.editable .content-container {
406
+ flex-direction: column;
407
+ }
408
+ .contact-card.editable .name-tag-container {
409
+ align-items: flex-start;
410
+ width: 100%;
411
+ }
412
+ }
413
+
414
+ @media (max-width: 450px) {
415
+ .contact-card.editable .action-button-container {
416
+ display: block;
417
+ position: absolute;
418
+ top: 24px;
419
+ right: 24px;
420
+ }
421
+ }
422
+
395
423
  .action-button-container {
396
424
  display: flex;
397
425
  flex-direction: column;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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"