willba-component-library 0.2.39 → 0.2.41
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/lib/index.esm.js +19 -15
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +19 -15
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +19 -15
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/core/components/calendar/Calendar.tsx +18 -14
package/package.json
CHANGED
|
@@ -39,19 +39,6 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
|
|
|
39
39
|
const today = startOfDay(new Date())
|
|
40
40
|
const selectedStartDate = calendarRange?.from
|
|
41
41
|
|
|
42
|
-
// Handle loading spinner
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (typeof document === 'undefined') return
|
|
45
|
-
const loadingSpinner: HTMLElement | null = document.querySelector(
|
|
46
|
-
'.will-filter-bar-calendar .will-calendar-spinner'
|
|
47
|
-
)
|
|
48
|
-
if (loadingData) {
|
|
49
|
-
if (loadingSpinner) loadingSpinner.style.display = 'flex'
|
|
50
|
-
} else {
|
|
51
|
-
if (loadingSpinner) loadingSpinner.style.display = 'none'
|
|
52
|
-
}
|
|
53
|
-
}, [loadingData])
|
|
54
|
-
|
|
55
42
|
// Handle overlapping availableDates.lastCheckOut and disabledDates.start
|
|
56
43
|
const [overlappingDate, setOverlappingDate] = useState<
|
|
57
44
|
DateRange[] | undefined
|
|
@@ -156,6 +143,7 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
|
|
|
156
143
|
|
|
157
144
|
const tooltipClonesCheckIn: Element[] = []
|
|
158
145
|
const tooltipClonesCheckOut: Element[] = []
|
|
146
|
+
const tooltipClonesSpinner: Element[] = []
|
|
159
147
|
const tooltipClonesOverlappingDates: Element[] = []
|
|
160
148
|
|
|
161
149
|
if (calendarTooltip && calendarButtons.length > 0) {
|
|
@@ -179,7 +167,9 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
|
|
|
179
167
|
}
|
|
180
168
|
|
|
181
169
|
if (loadingSpinner && calendarMonthContainer) {
|
|
182
|
-
|
|
170
|
+
const tooltipClone: Element = loadingSpinner.cloneNode(true) as Element
|
|
171
|
+
calendarMonthContainer.appendChild(tooltipClone)
|
|
172
|
+
tooltipClonesSpinner.push(tooltipClone)
|
|
183
173
|
}
|
|
184
174
|
|
|
185
175
|
if (
|
|
@@ -197,6 +187,7 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
|
|
|
197
187
|
return () => {
|
|
198
188
|
tooltipClonesCheckIn.forEach((clone) => clone.remove())
|
|
199
189
|
tooltipClonesCheckOut.forEach((clone) => clone.remove())
|
|
190
|
+
tooltipClonesSpinner.forEach((clone) => clone.remove())
|
|
200
191
|
tooltipClonesOverlappingDates.forEach((clone) => clone.remove())
|
|
201
192
|
}
|
|
202
193
|
}, [
|
|
@@ -207,6 +198,19 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
|
|
|
207
198
|
updateCalendarDefaultMoth,
|
|
208
199
|
])
|
|
209
200
|
|
|
201
|
+
// Handle loading spinner
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (typeof document === 'undefined') return
|
|
204
|
+
const loadingSpinner: HTMLElement | null = document.querySelector(
|
|
205
|
+
'.will-filter-bar-calendar .rdp-months .will-calendar-spinner'
|
|
206
|
+
)
|
|
207
|
+
if (loadingData) {
|
|
208
|
+
if (loadingSpinner) loadingSpinner.style.display = 'flex'
|
|
209
|
+
} else {
|
|
210
|
+
if (loadingSpinner) loadingSpinner.style.display = 'none'
|
|
211
|
+
}
|
|
212
|
+
}, [loadingData, updateCalendarMonthNavigation, updateCalendarDefaultMoth])
|
|
213
|
+
|
|
210
214
|
return (
|
|
211
215
|
<div className="will-filter-bar-calendar" ref={ref}>
|
|
212
216
|
<div className="will-calendar-filter-container">
|