ublo-lib 1.18.4 → 1.18.6
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.
|
@@ -30,6 +30,7 @@ const DateItem = ({
|
|
|
30
30
|
_date.setHours(0, 0, 0, 0);
|
|
31
31
|
const isToday = Utils.isSameDay(_date, today);
|
|
32
32
|
const inMonth = month && year && Utils.isSameMonth(_date, new Date([Utils.zeroPad(year, 2), Utils.zeroPad(month, 2), "01"].join("-")));
|
|
33
|
+
const isDisabled = Utils.isBefore(date, min) || Utils.isAfter(date, max);
|
|
33
34
|
const enableAvailability = Boolean(stays);
|
|
34
35
|
const isAvailable = stays?.some(stay => {
|
|
35
36
|
return stay.start < _date && stay.end > _date;
|
|
@@ -43,7 +44,7 @@ const DateItem = ({
|
|
|
43
44
|
if (isLastSelected) setLastSelectedDate(index);
|
|
44
45
|
}, [index, isFirstSelected, isLastSelected, setFirstSelectedDate, setLastSelectedDate]);
|
|
45
46
|
const updateDateSelection = () => {
|
|
46
|
-
if (isPastDate) return;
|
|
47
|
+
if (isPastDate || isDisabled) return;
|
|
47
48
|
if (singleDate) {
|
|
48
49
|
setSelectedDates([_date]);
|
|
49
50
|
setSelecting(false);
|
|
@@ -94,7 +95,6 @@ const DateItem = ({
|
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
const isSelected = !!selectedDates.find(d => d.getTime() === _date.getTime());
|
|
97
|
-
const isDisabled = Utils.isBefore(date, min) || Utils.isAfter(date, max);
|
|
98
98
|
const classes = classNames(styles.date, {
|
|
99
99
|
[styles.dateToday]: isToday,
|
|
100
100
|
[styles.dateSelected]: isSelected,
|
|
@@ -111,6 +111,7 @@ const DateItem = ({
|
|
|
111
111
|
className: classes,
|
|
112
112
|
onClick: updateDateSelection,
|
|
113
113
|
tabIndex: isPastDate ? -1 : 0,
|
|
114
|
+
disabled: isPastDate || isDisabled,
|
|
114
115
|
children: _date.getDate()
|
|
115
116
|
});
|
|
116
117
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const DEFAULT_MESSAGES = {
|
|
2
2
|
fr: {
|
|
3
3
|
"what-are-you-looking-for": "Que recherchez-vous ?",
|
|
4
4
|
"no-results": "Pas de résultats..."
|
|
@@ -6,10 +6,14 @@ const locales = {
|
|
|
6
6
|
en: {
|
|
7
7
|
"what-are-you-looking-for": "What are you looking for?",
|
|
8
8
|
"no-results": "No results..."
|
|
9
|
+
},
|
|
10
|
+
es: {
|
|
11
|
+
"what-are-you-looking-for": "¿Qué estás buscando?",
|
|
12
|
+
"no-results": "No hay resultados..."
|
|
9
13
|
}
|
|
10
14
|
};
|
|
11
|
-
export const message = (lang, id, messages =
|
|
12
|
-
|
|
13
|
-
const langMessages = messages[
|
|
15
|
+
export const message = (lang, id, messages = DEFAULT_MESSAGES) => {
|
|
16
|
+
const locale = !messages[lang] ? "en" : lang;
|
|
17
|
+
const langMessages = messages[locale];
|
|
14
18
|
return langMessages[id] || `??${id}??`;
|
|
15
19
|
};
|