willba-component-library 0.2.68 → 0.2.70

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.68",
3
+ "version": "0.2.70",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -760,8 +760,8 @@ export const RangeContext: Story = {
760
760
  args: {
761
761
  ...baseData,
762
762
  rangeContext: {
763
- from: new Date('2024-11-20'),
764
- to: new Date('2024-11-23'),
763
+ from: new Date('2025-01-09'),
764
+ to: new Date('2025-01-26'),
765
765
  },
766
766
  },
767
767
  render: (args) => {
@@ -783,8 +783,8 @@ export const DisabledRangeContextDates: Story = {
783
783
  args: {
784
784
  ...baseData,
785
785
  rangeContext: {
786
- from: new Date('2024-12-03'),
787
- to: new Date('2024-12-28'),
786
+ from: new Date('2025-01-09'),
787
+ to: new Date('2025-01-26'),
788
788
  },
789
789
  },
790
790
  render: (args) => {
@@ -63,6 +63,13 @@ export const useFilterCalendar = ({
63
63
  : [],
64
64
  })
65
65
  }
66
+
67
+ if (disabledDates && !!outerDisableCalendarDates?.disabledDates?.length) {
68
+ setDisabledDates({
69
+ ...disabledDates,
70
+ ...outerDisableCalendarDates.disabledDates,
71
+ })
72
+ }
66
73
  }, [outerDisableCalendarDates])
67
74
 
68
75
  // Handle Range Context initial selections
@@ -158,20 +158,45 @@
158
158
 
159
159
  /* No active selection */
160
160
 
161
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_start.no-active-selection,
162
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.no-active-selection,
163
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_end.no-active-selection,
164
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_start.no-active-selection.checkout-option,
165
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.no-active-selection.checkout-option,
166
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_end.no-active-selection.checkout-option {
167
- background-color: var(--rdp-background-color);
168
- color: inherit;
161
+
162
+
163
+
164
+ /* ---- */
165
+
166
+ .will-root .will-calendar-filter-container .no-active-selection-start,
167
+ .will-root .will-calendar-filter-container .no-active-selection-mid,
168
+ .will-root .will-calendar-filter-container .no-active-selection-end {
169
+ position: initial;
169
170
  }
170
171
 
171
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_start.no-active-selection:hover,
172
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.no-active-selection:hover,
173
- .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_end.no-active-selection:hover {
174
- background-color: var(--rdp-background-color);
172
+ .will-root .will-calendar-filter-container .no-active-selection-start::before,
173
+ .will-root .will-calendar-filter-container .no-active-selection-mid::before,
174
+ .will-root .will-calendar-filter-container .no-active-selection-end::before {
175
+ content: "";
176
+ position: absolute;
177
+ width: 100%;
178
+ height: 91%;
179
+ margin-top: -2px;
180
+
181
+ border: 3px dashed var(--will-grey);
182
+ }
183
+
184
+
185
+ .will-root .will-calendar-filter-container .no-active-selection-start::before {
186
+ border-right: none;
187
+ border-top-left-radius: 50%;
188
+ border-bottom-left-radius: 50%;
189
+ }
190
+
191
+ .will-root .will-calendar-filter-container .no-active-selection-mid::before {
192
+ border-right: none;
193
+ border-left: none;
194
+ }
195
+
196
+ .will-root .will-calendar-filter-container .no-active-selection-end::before {
197
+ border-left: none;
198
+ border-top-right-radius: 50%;
199
+ border-bottom-right-radius: 50%;
175
200
  }
176
201
 
177
202
  .will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.checkout-option {
@@ -185,7 +210,6 @@
185
210
  .will-root .will-calendar-filter-container .overlapping-date {
186
211
  user-select: none;
187
212
  pointer-events: none;
188
-
189
213
  }
190
214
 
191
215
  .will-root .will-calendar-filter-container .overlapping-date:hover {
@@ -146,7 +146,6 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
146
146
  ? disabledDatesByPage
147
147
  : disabledDates?.length
148
148
  ? [
149
- ...(newDisableCalendarDates?.disabledDates || []),
150
149
  lastPossibleCheckout && lastPossibleCheckout,
151
150
  ...disabledDates,
152
151
  ...firstPossibleRangeContextCheckIn,
@@ -177,12 +176,11 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
177
176
  booked: 'booked',
178
177
  disabledAfterCheckIn: 'disabled-after-check-in',
179
178
  overlappingDate: 'overlapping-date',
180
- noActiveSelectionStart:
181
- 'rdp-day_selected rdp-day_range_start no-active-selection',
182
- noActiveSelectionMid:
183
- 'rdp-day_selected rdp-day_range_middle no-active-selection',
184
- noActiveSelectionEnd:
185
- 'rdp-day_selected rdp-day_range_end no-active-selection',
179
+
180
+ noActiveSelectionStart: 'no-active-selection-start',
181
+ noActiveSelectionMid: 'no-active-selection-mid',
182
+ noActiveSelectionEnd: 'no-active-selection-end',
183
+
186
184
  checkoutOptionsMid:
187
185
  'rdp-day_selected rdp-day_range_middle checkout-option',
188
186
 
@@ -218,10 +216,10 @@ export const Calendar = forwardRef<HTMLDivElement, CalendarTypes>(
218
216
  <div>{t('checkOutOnly')}</div>
219
217
  </div>
220
218
  <div className={'will-calendar-tooltip-check-in-only'}>
221
- <div>Check-in Only</div>
219
+ <div>{t('checkInOnly')}</div>
222
220
  </div>
223
221
  <div className={'will-calendar-tooltip-check-out-only'}>
224
- <div>Checkout Only</div>
222
+ <div>{t('checkOutOnly')}</div>
225
223
  </div>
226
224
  <div className={'will-calendar-spinner'}>
227
225
  <IconsSvg
@@ -193,6 +193,8 @@ const disableFutureDates = ({
193
193
  // Will disable all dates before the check-in date
194
194
  // { before: findCheckOutRange?.checkIn },
195
195
 
196
+ ...(newDisableCalendarDates?.disabledDates || []),
197
+
196
198
  {
197
199
  from: noDatesRange ? undefined : checkIn,
198
200
  to: noDatesRange ? undefined : firstCheckOut,
@@ -1,14 +1,4 @@
1
- import {
2
- format,
3
- addDays,
4
- endOfDay,
5
- differenceInDays,
6
- isEqual,
7
- eachDayOfInterval,
8
- isAfter,
9
- isBefore,
10
- isWithinInterval,
11
- } from 'date-fns'
1
+ import { addDays, endOfDay } from 'date-fns'
12
2
  import { DateRange, Matcher } from 'react-day-picker'
13
3
 
14
4
  import { DisableCalendarDates, RangeContext } from '../CalendarTypes'
@@ -57,44 +47,6 @@ export const handleCalendarModifiers = ({
57
47
  const rangeContextFrom = rangeContext?.from && endOfDay(rangeContext.from)
58
48
  const rangeContextTo = rangeContext?.to && endOfDay(rangeContext.to)
59
49
 
60
- // Create range for range context middle selection and current overlapping selection
61
-
62
- const rangeContextMiddleSelection =
63
- rangeContextFrom && rangeContextTo
64
- ? eachDayOfInterval({
65
- start: addDays(rangeContextFrom, 1),
66
- end: addDays(rangeContextTo, -1),
67
- }).filter(
68
- (date) =>
69
- !(
70
- (calendarRangeFrom &&
71
- isEqual(endOfDay(calendarRangeFrom), endOfDay(date))) ||
72
- (calendarRangeTo &&
73
- isEqual(endOfDay(calendarRangeTo), endOfDay(date))) ||
74
- (calendarRangeFrom &&
75
- !calendarRangeTo &&
76
- currentSelectionLastCheckoutDate?.lastCheckOut &&
77
- isAfter(calendarRangeFrom, rangeContextFrom) &&
78
- isBefore(
79
- currentSelectionLastCheckoutDate?.lastCheckOut,
80
- rangeContextTo
81
- ) &&
82
- isWithinInterval(date, {
83
- start: currentSelectionLastCheckoutDate.checkIn,
84
- end: currentSelectionLastCheckoutDate.lastCheckOut,
85
- })) ||
86
- (calendarRangeFrom &&
87
- calendarRangeTo &&
88
- isAfter(calendarRangeFrom, rangeContextFrom) &&
89
- isBefore(calendarRangeTo, rangeContextTo) &&
90
- isWithinInterval(date, {
91
- start: calendarRangeFrom,
92
- end: calendarRangeTo,
93
- }))
94
- )
95
- )
96
- : []
97
-
98
50
  return {
99
51
  booked: disabledDatesByPage.length
100
52
  ? disabledDatesByPage
@@ -124,31 +76,15 @@ export const handleCalendarModifiers = ({
124
76
  : []),
125
77
  ],
126
78
 
127
- noActiveSelectionStart:
128
- rangeContextFrom &&
129
- !(
130
- calendarRangeFrom &&
131
- rangeContextFrom &&
132
- isEqual(endOfDay(rangeContextFrom), endOfDay(calendarRangeFrom))
133
- )
134
- ? rangeContextFrom
135
- : [],
79
+ noActiveSelectionStart: rangeContextFrom || [],
136
80
 
137
81
  noActiveSelectionMid: [
138
- ...(rangeContextMiddleSelection.length
139
- ? rangeContextMiddleSelection
140
- : []),
82
+ rangeContextFrom && rangeContextTo
83
+ ? { after: rangeContextFrom, before: rangeContextTo }
84
+ : [],
141
85
  ],
142
86
 
143
- noActiveSelectionEnd:
144
- rangeContextTo &&
145
- !(
146
- calendarRangeFrom &&
147
- rangeContextTo &&
148
- isEqual(endOfDay(rangeContextTo), endOfDay(calendarRangeFrom))
149
- )
150
- ? rangeContextTo
151
- : [],
87
+ noActiveSelectionEnd: rangeContextTo || [],
152
88
 
153
89
  checkoutOptionsMid: [
154
90
  ...(calendarRangeFrom &&
@@ -9,8 +9,7 @@
9
9
  "noCheckIn": "Room not available",
10
10
  "noCheckOut": "Check-out not available",
11
11
  "checkOutOnly": "Check-out only",
12
- "onlyCheckOut": "Check-in only",
13
- "onlyCheckIn": "Check-out only",
12
+ "checkInOnly": "Check-in only",
14
13
  "errors": {
15
14
  "calendarErrors": {
16
15
  "checkInAvailabilityError": "Check-in available for second room only with connection dates",
@@ -9,8 +9,7 @@
9
9
  "noCheckIn": "Huone ei saatavilla",
10
10
  "noCheckOut": "Uloskirjaus ei saatavilla",
11
11
  "checkOutOnly": "Vain uloskirjaus",
12
- "onlyCheckOut": "Check-in only",
13
- "onlyCheckIn": "Check-out only",
12
+ "checkInOnly": "Check-in only",
14
13
  "errors": {
15
14
  "calendarErrors": {
16
15
  "checkInAvailabilityError": "Check-in available for second room only with connection dates",