willba-component-library 0.2.24 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -149,8 +149,17 @@
149
149
 
150
150
  /* No active selection */
151
151
 
152
- .will-root .will-calendar-filter-container .no-active-selection {
152
+ .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_start.no-active-selection,
153
+ .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.no-active-selection,
154
+ .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_end.no-active-selection {
153
155
  background-color: var(--will-onahau);
156
+ color: inherit;
157
+ }
158
+
159
+ .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_start.no-active-selection:hover,
160
+ .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.no-active-selection:hover,
161
+ .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_end.no-active-selection:hover {
162
+ background-color: var(--rdp-background-color);
154
163
  }
155
164
 
156
165
  /* Overlapping date */
@@ -188,15 +188,9 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
188
188
  setCalendarRange,
189
189
  setDisabledDates,
190
190
  calendarRange,
191
+ overlappingDate,
191
192
  })
192
193
  }
193
- modifiersClassNames={{
194
- today: 'my-today',
195
- booked: 'booked',
196
- disabledAfterCheckIn: 'disabled-after-check-in',
197
- noActiveSelection: 'no-active-selection',
198
- overlappingDate: 'overlapping-date',
199
- }}
200
194
  captionLayout="dropdown-buttons"
201
195
  defaultMonth={
202
196
  selectedStartDate ||
@@ -217,6 +211,19 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
217
211
  ? (requestDates(val), setUpdateCalendar((prev) => !prev))
218
212
  : null
219
213
  }}
214
+ modifiersClassNames={{
215
+ today: 'my-today',
216
+ booked: 'booked',
217
+ disabledAfterCheckIn: 'disabled-after-check-in',
218
+ overlappingDate: 'overlapping-date',
219
+
220
+ noActiveSelectionStart:
221
+ 'rdp-day_selected rdp-day_range_start no-active-selection ',
222
+ noActiveSelectionMid:
223
+ 'rdp-day_selected rdp-day_range_middle no-active-selection',
224
+ noActiveSelectionEnd:
225
+ 'rdp-day_selected rdp-day_range_end no-active-selection',
226
+ }}
220
227
  modifiers={{
221
228
  booked: disabledDatesByPage.length
222
229
  ? disabledDatesByPage
@@ -228,8 +235,22 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
228
235
  ? [{ after: calendarRange.from }]
229
236
  : [],
230
237
 
231
- noActiveSelection: !calendarRange
232
- ? initialCalendarRange || []
238
+ noActiveSelectionStart: !calendarRange
239
+ ? initialCalendarRange?.from || []
240
+ : [],
241
+ noActiveSelectionMid:
242
+ !calendarRange &&
243
+ initialCalendarRange?.from &&
244
+ initialCalendarRange?.to
245
+ ? [
246
+ {
247
+ after: initialCalendarRange?.from,
248
+ before: initialCalendarRange?.to,
249
+ },
250
+ ]
251
+ : [],
252
+ noActiveSelectionEnd: !calendarRange
253
+ ? initialCalendarRange?.to || []
233
254
  : [],
234
255
 
235
256
  overlappingDate:
@@ -261,12 +282,14 @@ const handleSelectedCheckIn = ({
261
282
  setCalendarRange,
262
283
  setDisabledDates,
263
284
  calendarRange,
285
+ overlappingDate,
264
286
  }: {
265
287
  range: DateRange | undefined
266
288
  disableCalendarDates?: DisableCalendarDates
267
289
  setCalendarRange: (range: DateRange | undefined) => void
268
290
  setDisabledDates: ((arg: Matcher[]) => void) | undefined
269
291
  calendarRange?: DateRange
292
+ overlappingDate?: DateRange
270
293
  }) => {
271
294
  // Calendar dates select logic
272
295
  const dateFormat = 'dd-MM-yyyy'
@@ -279,6 +302,10 @@ const handleSelectedCheckIn = ({
279
302
  ? format(calendarRange?.to, dateFormat)
280
303
  : null
281
304
 
305
+ const overlappingDateFrom = overlappingDate?.from
306
+ ? format(overlappingDate.from, dateFormat)
307
+ : null
308
+
282
309
  const checkOutRange = disableCalendarDates?.availableDates?.length
283
310
  ? disableCalendarDates.availableDates.find(
284
311
  (checkInDate) =>
@@ -310,7 +337,8 @@ const handleSelectedCheckIn = ({
310
337
 
311
338
  if (
312
339
  (rangeTo && rangeFrom && rangeFrom === rangeTo) ||
313
- (!rangeTo && !rangeFrom)
340
+ (!rangeTo && !rangeFrom) ||
341
+ rangeFrom === overlappingDateFrom
314
342
  ) {
315
343
  setCalendarRange(undefined)
316
344
  setDisabledDates && setDisabledDates([])