willba-component-library 0.3.26 → 0.4.0

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.
Files changed (159) hide show
  1. package/README.md +75 -113
  2. package/lib/components/FilterBar/FilterBar.d.ts +1 -1
  3. package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
  4. package/lib/core/i18n/I18nProvider.d.ts +6 -0
  5. package/lib/core/i18n/index.d.ts +1 -0
  6. package/lib/embed.d.ts +18 -0
  7. package/lib/embed.esm.js +74 -0
  8. package/lib/embed.esm.js.map +1 -0
  9. package/lib/embed.umd.js +74 -0
  10. package/lib/embed.umd.js.map +1 -0
  11. package/lib/i18n.d.ts +2 -2
  12. package/lib/index.d.ts +2 -2
  13. package/lib/index.esm.js +1112 -931
  14. package/lib/index.esm.js.map +1 -1
  15. package/lib/index.js +1111 -930
  16. package/lib/index.js.map +1 -1
  17. package/package.json +9 -1
  18. package/.nvmrc +0 -1
  19. package/.storybook/main.ts +0 -17
  20. package/.storybook/preview.ts +0 -15
  21. package/lib/components/FilterBar/components/buttons/index.d.ts +0 -4
  22. package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +0 -13
  23. package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +0 -10
  24. package/lib/components/FilterBar/components/cards/image-card/ImageCard.d.ts +0 -11
  25. package/lib/components/FilterBar/components/cards/index.d.ts +0 -1
  26. package/lib/components/FilterBar/components/categories/Categories.d.ts +0 -8
  27. package/lib/components/FilterBar/components/common/FilterSectionHeader.d.ts +0 -8
  28. package/lib/components/FilterBar/components/dates/Dates.d.ts +0 -17
  29. package/lib/components/FilterBar/components/dates/index.d.ts +0 -1
  30. package/lib/components/FilterBar/components/guests/GuestCount/GuestCount.d.ts +0 -4
  31. package/lib/components/FilterBar/components/guests/Guests.d.ts +0 -12
  32. package/lib/components/FilterBar/components/locations/Locations.d.ts +0 -14
  33. package/lib/components/FilterBar/hooks/useFilterBar.d.ts +0 -32
  34. package/lib/components/FilterBar/hooks/useFilterUi.d.ts +0 -8
  35. package/lib/components/FilterBar/utils/calculateDropdownPosition.d.ts +0 -12
  36. package/lib/components/FilterBar/utils/getLocalizedContent.d.ts +0 -8
  37. package/lib/core/components/buttons/close-button/CloseButton.d.ts +0 -7
  38. package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +0 -14
  39. package/lib/index.umd.js +0 -12489
  40. package/lib/index.umd.js.map +0 -1
  41. package/prettier.config.js +0 -6
  42. package/rollup.config.mjs +0 -63
  43. package/src/assets/IconsSvg.tsx +0 -69
  44. package/src/components/Button/Button.stories.tsx +0 -34
  45. package/src/components/Button/Button.tsx +0 -56
  46. package/src/components/Button/button.css +0 -30
  47. package/src/components/Button/index.ts +0 -1
  48. package/src/components/FilterBar/FilterBar.css +0 -35
  49. package/src/components/FilterBar/FilterBar.stories.tsx +0 -116
  50. package/src/components/FilterBar/FilterBar.tsx +0 -64
  51. package/src/components/FilterBar/FilterBarTypes.ts +0 -71
  52. package/src/components/FilterBar/components/Divider/Divider.css +0 -14
  53. package/src/components/FilterBar/components/Divider/Divider.tsx +0 -7
  54. package/src/components/FilterBar/components/FilterControls/FilterControls.css +0 -22
  55. package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +0 -139
  56. package/src/components/FilterBar/components/FilterPanels/Categories/Categories.css +0 -21
  57. package/src/components/FilterBar/components/FilterPanels/Categories/Categories.tsx +0 -49
  58. package/src/components/FilterBar/components/FilterPanels/Dates/Dates.css +0 -9
  59. package/src/components/FilterBar/components/FilterPanels/Dates/Dates.tsx +0 -60
  60. package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +0 -22
  61. package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +0 -111
  62. package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.css +0 -58
  63. package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.tsx +0 -85
  64. package/src/components/FilterBar/components/FilterPanels/Guests/Guests.css +0 -24
  65. package/src/components/FilterBar/components/FilterPanels/Guests/Guests.tsx +0 -59
  66. package/src/components/FilterBar/components/FilterPanels/Locations/Locations.css +0 -16
  67. package/src/components/FilterBar/components/FilterPanels/Locations/Locations.tsx +0 -94
  68. package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.css +0 -34
  69. package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.tsx +0 -17
  70. package/src/components/FilterBar/components/FilterTabs/FilterTabs.css +0 -10
  71. package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +0 -50
  72. package/src/components/FilterBar/components/ImageCard/ImageCard.css +0 -30
  73. package/src/components/FilterBar/components/ImageCard/ImageCard.tsx +0 -45
  74. package/src/components/FilterBar/components/SelectButton/SelectButton.css +0 -76
  75. package/src/components/FilterBar/components/SelectButton/SelectButton.tsx +0 -54
  76. package/src/components/FilterBar/components/TabButton/TabButton.css +0 -36
  77. package/src/components/FilterBar/components/TabButton/TabButton.tsx +0 -23
  78. package/src/components/FilterBar/components/index.ts +0 -6
  79. package/src/components/FilterBar/hooks/index.ts +0 -5
  80. package/src/components/FilterBar/hooks/useFilterActions.tsx +0 -126
  81. package/src/components/FilterBar/hooks/useFilterRefs.tsx +0 -21
  82. package/src/components/FilterBar/hooks/useFilterState.tsx +0 -86
  83. package/src/components/FilterBar/hooks/usePanelPosition.tsx +0 -52
  84. package/src/components/FilterBar/hooks/useScrollInToView.tsx +0 -29
  85. package/src/components/FilterBar/index.ts +0 -3
  86. package/src/components/FilterBar/providers/FilterBarProvider.tsx +0 -172
  87. package/src/components/FilterBar/providers/index.ts +0 -1
  88. package/src/components/FilterBar/utils/ageCategoriesRules.ts +0 -27
  89. package/src/components/FilterBar/utils/index.tsx +0 -3
  90. package/src/components/FilterBar/utils/parseGuests.tsx +0 -65
  91. package/src/components/FilterBar/utils/parseLocations.ts +0 -28
  92. package/src/components/FilterCalendar/FilterCalendar.css +0 -109
  93. package/src/components/FilterCalendar/FilterCalendar.stories.tsx +0 -554
  94. package/src/components/FilterCalendar/FilterCalendar.tsx +0 -115
  95. package/src/components/FilterCalendar/FilterCalendarTypes.ts +0 -11
  96. package/src/components/FilterCalendar/components/Footer.tsx +0 -96
  97. package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +0 -163
  98. package/src/components/FilterCalendar/index.ts +0 -3
  99. package/src/core/components/buttons/CloseButton/CloseButton.css +0 -33
  100. package/src/core/components/buttons/CloseButton/CloseButton.tsx +0 -16
  101. package/src/core/components/buttons/SubmitButton/SubmitButton.css +0 -54
  102. package/src/core/components/buttons/SubmitButton/SubmitButton.tsx +0 -42
  103. package/src/core/components/calendar/Calendar.css +0 -280
  104. package/src/core/components/calendar/Calendar.tsx +0 -253
  105. package/src/core/components/calendar/CalendarTypes.ts +0 -48
  106. package/src/core/components/calendar/hooks/index.ts +0 -3
  107. package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +0 -19
  108. package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +0 -125
  109. package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +0 -105
  110. package/src/core/components/calendar/utils/calendarSelectionRules.tsx +0 -180
  111. package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +0 -86
  112. package/src/core/components/calendar/utils/disabledDatesByPage.tsx +0 -31
  113. package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +0 -118
  114. package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +0 -75
  115. package/src/core/components/calendar/utils/index.ts +0 -8
  116. package/src/core/components/calendar/utils/nightsCount.tsx +0 -19
  117. package/src/core/components/calendar/utils/parseDate.tsx +0 -17
  118. package/src/core/components/calendar/utils/parseDates.tsx +0 -12
  119. package/src/core/components/index.ts +0 -7
  120. package/src/core/hooks/index.ts +0 -4
  121. package/src/core/hooks/useAutoFocus.tsx +0 -27
  122. package/src/core/hooks/useAwaitRender.tsx +0 -12
  123. package/src/core/hooks/useCloseFilterSection.tsx +0 -29
  124. package/src/core/hooks/useUpdateTranslations.tsx +0 -14
  125. package/src/i18n.ts +0 -27
  126. package/src/index.ts +0 -8
  127. package/src/locales/en/common.json +0 -18
  128. package/src/locales/en/filterBar.json +0 -33
  129. package/src/locales/fi/common.json +0 -19
  130. package/src/locales/fi/filterBar.json +0 -33
  131. package/src/themes/Default.css +0 -69
  132. package/src/themes/useTheme.tsx +0 -27
  133. package/stories/Button.stories.ts +0 -50
  134. package/stories/Button.tsx +0 -53
  135. package/stories/Configure.mdx +0 -364
  136. package/stories/Header.stories.ts +0 -27
  137. package/stories/Header.tsx +0 -70
  138. package/stories/Page.stories.ts +0 -29
  139. package/stories/Page.tsx +0 -91
  140. package/stories/assets/accessibility.png +0 -0
  141. package/stories/assets/accessibility.svg +0 -5
  142. package/stories/assets/addon-library.png +0 -0
  143. package/stories/assets/assets.png +0 -0
  144. package/stories/assets/context.png +0 -0
  145. package/stories/assets/discord.svg +0 -15
  146. package/stories/assets/docs.png +0 -0
  147. package/stories/assets/figma-plugin.png +0 -0
  148. package/stories/assets/github.svg +0 -3
  149. package/stories/assets/share.png +0 -0
  150. package/stories/assets/styling.png +0 -0
  151. package/stories/assets/testing.png +0 -0
  152. package/stories/assets/theming.png +0 -0
  153. package/stories/assets/tutorials.svg +0 -12
  154. package/stories/assets/youtube.svg +0 -4
  155. package/stories/button.css +0 -30
  156. package/stories/header.css +0 -32
  157. package/stories/page.css +0 -69
  158. package/tsconfig.json +0 -29
  159. /package/lib/components/FilterBar/components/{divider → Divider}/Divider.d.ts +0 -0
@@ -1,554 +0,0 @@
1
- import { useState } from 'react'
2
- import type { Meta, StoryObj } from '@storybook/react'
3
-
4
- import FilterCalendar from './FilterCalendar'
5
-
6
- const meta: Meta<typeof FilterCalendar> = {
7
- title: 'Components/FilterCalendar',
8
- component: FilterCalendar,
9
- }
10
-
11
- export default meta
12
-
13
- type Story = StoryObj<typeof FilterCalendar>
14
-
15
- const baseData = {
16
- disableCalendarDates: {
17
- availableDates: [
18
- {
19
- checkIn: new Date('2026-07-01'),
20
- firstCheckOut: new Date('2026-07-02'),
21
- lastCheckOut: new Date('2026-07-04'),
22
- },
23
- {
24
- checkIn: new Date('2026-07-02'),
25
- firstCheckOut: new Date('2026-07-03'),
26
- lastCheckOut: new Date('2026-07-04'),
27
- },
28
- {
29
- checkIn: new Date('2026-07-03'),
30
- firstCheckOut: new Date('2026-07-04'),
31
- lastCheckOut: new Date('2026-07-04'),
32
- },
33
- {
34
- checkIn: new Date('2026-07-08'),
35
- firstCheckOut: new Date('2026-07-09'),
36
- lastCheckOut: new Date('2026-07-14'),
37
- },
38
- {
39
- checkIn: new Date('2026-07-09'),
40
- firstCheckOut: new Date('2026-07-10'),
41
- lastCheckOut: new Date('2026-07-14'),
42
- },
43
- {
44
- checkIn: new Date('2026-07-10'),
45
- firstCheckOut: new Date('2026-07-11'),
46
- lastCheckOut: new Date('2026-07-14'),
47
- },
48
- {
49
- checkIn: new Date('2026-07-11'),
50
- firstCheckOut: new Date('2026-07-12'),
51
- lastCheckOut: new Date('2026-07-14'),
52
- },
53
- {
54
- checkIn: new Date('2026-07-12'),
55
- firstCheckOut: new Date('2026-07-13'),
56
- lastCheckOut: new Date('2026-07-14'),
57
- },
58
- {
59
- checkIn: new Date('2026-07-13'),
60
- firstCheckOut: new Date('2026-07-14'),
61
- lastCheckOut: new Date('2026-07-14'),
62
- },
63
- {
64
- checkIn: new Date('2026-07-17'),
65
- firstCheckOut: new Date('2026-07-20'),
66
- lastCheckOut: new Date('2026-08-05'),
67
- },
68
- {
69
- checkIn: new Date('2026-07-18'),
70
- firstCheckOut: new Date('2026-07-19'),
71
- lastCheckOut: new Date('2026-08-05'),
72
- },
73
- {
74
- checkIn: new Date('2026-07-19'),
75
- firstCheckOut: new Date('2026-07-20'),
76
- lastCheckOut: new Date('2026-08-05'),
77
- },
78
- {
79
- checkIn: new Date('2026-07-20'),
80
- firstCheckOut: new Date('2026-07-21'),
81
- lastCheckOut: new Date('2026-08-05'),
82
- },
83
- {
84
- checkIn: new Date('2026-07-21'),
85
- firstCheckOut: new Date('2026-07-22'),
86
- lastCheckOut: new Date('2026-08-05'),
87
- },
88
- {
89
- checkIn: new Date('2026-07-22'),
90
- firstCheckOut: new Date('2026-07-23'),
91
- lastCheckOut: new Date('2026-08-05'),
92
- },
93
- {
94
- checkIn: new Date('2026-07-23'),
95
- firstCheckOut: new Date('2026-07-24'),
96
- lastCheckOut: new Date('2026-08-05'),
97
- },
98
- {
99
- checkIn: new Date('2026-07-24'),
100
- firstCheckOut: new Date('2026-07-25'),
101
- lastCheckOut: new Date('2026-08-11'),
102
- },
103
- {
104
- checkIn: new Date('2026-07-25'),
105
- firstCheckOut: new Date('2026-07-26'),
106
- lastCheckOut: new Date('2026-08-11'),
107
- },
108
- {
109
- checkIn: new Date('2026-07-26'),
110
- firstCheckOut: new Date('2026-07-27'),
111
- lastCheckOut: new Date('2026-08-11'),
112
- },
113
- {
114
- checkIn: new Date('2026-07-27'),
115
- firstCheckOut: new Date('2026-07-28'),
116
- lastCheckOut: new Date('2026-08-11'),
117
- },
118
- {
119
- checkIn: new Date('2026-07-28'),
120
- firstCheckOut: new Date('2026-07-29'),
121
- lastCheckOut: new Date('2026-08-11'),
122
- },
123
- {
124
- checkIn: new Date('2026-07-29'),
125
- firstCheckOut: new Date('2026-07-30'),
126
- lastCheckOut: new Date('2026-08-11'),
127
- },
128
- {
129
- checkIn: new Date('2026-07-30'),
130
- firstCheckOut: new Date('2026-07-31'),
131
- lastCheckOut: new Date('2026-08-11'),
132
- },
133
- {
134
- checkIn: new Date('2026-07-31'),
135
- firstCheckOut: new Date('2026-08-01'),
136
- lastCheckOut: new Date('2026-08-11'),
137
- },
138
- {
139
- checkIn: new Date('2026-08-01'),
140
- firstCheckOut: new Date('2026-08-02'),
141
- lastCheckOut: new Date('2026-08-11'),
142
- },
143
- {
144
- checkIn: new Date('2026-08-02'),
145
- firstCheckOut: new Date('2026-08-03'),
146
- lastCheckOut: new Date('2026-08-11'),
147
- },
148
- {
149
- checkIn: new Date('2026-08-03'),
150
- firstCheckOut: new Date('2026-08-04'),
151
- lastCheckOut: new Date('2026-08-11'),
152
- },
153
- {
154
- checkIn: new Date('2026-08-04'),
155
- firstCheckOut: new Date('2026-08-05'),
156
- lastCheckOut: new Date('2026-08-11'),
157
- },
158
- {
159
- checkIn: new Date('2026-08-05'),
160
- firstCheckOut: new Date('2026-08-06'),
161
- lastCheckOut: new Date('2026-08-11'),
162
- },
163
- {
164
- checkIn: new Date('2026-08-06'),
165
- firstCheckOut: new Date('2026-08-07'),
166
- lastCheckOut: new Date('2026-08-11'),
167
- },
168
- {
169
- checkIn: new Date('2026-08-07'),
170
- firstCheckOut: new Date('2026-08-08'),
171
- lastCheckOut: new Date('2026-08-11'),
172
- },
173
- {
174
- checkIn: new Date('2026-08-08'),
175
- firstCheckOut: new Date('2026-08-09'),
176
- lastCheckOut: new Date('2026-08-11'),
177
- },
178
- {
179
- checkIn: new Date('2026-08-09'),
180
- firstCheckOut: new Date('2026-08-10'),
181
- lastCheckOut: new Date('2026-08-11'),
182
- },
183
- {
184
- checkIn: new Date('2026-08-10'),
185
- firstCheckOut: new Date('2026-08-11'),
186
- lastCheckOut: new Date('2026-08-11'),
187
- },
188
- {
189
- checkIn: new Date('2026-08-11'),
190
- firstCheckOut: new Date('2026-08-12'),
191
- lastCheckOut: new Date('2026-09-01'),
192
- },
193
- {
194
- checkIn: new Date('2026-08-12'),
195
- firstCheckOut: new Date('2026-08-13'),
196
- lastCheckOut: new Date('2026-09-01'),
197
- },
198
- {
199
- checkIn: new Date('2026-08-13'),
200
- firstCheckOut: new Date('2026-08-14'),
201
- lastCheckOut: new Date('2026-09-01'),
202
- },
203
- {
204
- checkIn: new Date('2026-08-14'),
205
- firstCheckOut: new Date('2026-08-15'),
206
- lastCheckOut: new Date('2026-09-01'),
207
- },
208
- {
209
- checkIn: new Date('2026-08-15'),
210
- firstCheckOut: new Date('2026-08-16'),
211
- lastCheckOut: new Date('2026-09-01'),
212
- },
213
- {
214
- checkIn: new Date('2026-08-16'),
215
- firstCheckOut: new Date('2026-08-17'),
216
- lastCheckOut: new Date('2026-09-01'),
217
- },
218
- {
219
- checkIn: new Date('2026-08-17'),
220
- firstCheckOut: new Date('2026-08-18'),
221
- lastCheckOut: new Date('2026-09-01'),
222
- },
223
- {
224
- checkIn: new Date('2026-08-18'),
225
- firstCheckOut: new Date('2026-08-19'),
226
- lastCheckOut: new Date('2026-09-01'),
227
- },
228
- {
229
- checkIn: new Date('2026-08-19'),
230
- firstCheckOut: new Date('2026-08-20'),
231
- lastCheckOut: new Date('2026-09-01'),
232
- },
233
- {
234
- checkIn: new Date('2026-08-20'),
235
- firstCheckOut: new Date('2026-08-21'),
236
- lastCheckOut: new Date('2026-09-01'),
237
- },
238
- {
239
- checkIn: new Date('2026-08-21'),
240
- firstCheckOut: new Date('2026-08-22'),
241
- lastCheckOut: new Date('2026-09-12'),
242
- },
243
- {
244
- checkIn: new Date('2026-08-22'),
245
- firstCheckOut: new Date('2026-08-23'),
246
- lastCheckOut: new Date('2026-09-12'),
247
- },
248
- {
249
- checkIn: new Date('2026-08-23'),
250
- firstCheckOut: new Date('2026-08-24'),
251
- lastCheckOut: new Date('2026-09-12'),
252
- },
253
- {
254
- checkIn: new Date('2026-08-24'),
255
- firstCheckOut: new Date('2026-08-25'),
256
- lastCheckOut: new Date('2026-09-12'),
257
- },
258
- {
259
- checkIn: new Date('2026-08-25'),
260
- firstCheckOut: new Date('2026-08-26'),
261
- lastCheckOut: new Date('2026-09-12'),
262
- },
263
- {
264
- checkIn: new Date('2026-08-26'),
265
- firstCheckOut: new Date('2026-08-27'),
266
- lastCheckOut: new Date('2026-09-12'),
267
- },
268
- {
269
- checkIn: new Date('2026-08-27'),
270
- firstCheckOut: new Date('2026-08-28'),
271
- lastCheckOut: new Date('2026-09-12'),
272
- },
273
- {
274
- checkIn: new Date('2026-08-28'),
275
- firstCheckOut: new Date('2026-09-01'),
276
- lastCheckOut: new Date('2026-09-12'),
277
- },
278
- {
279
- checkIn: new Date('2026-06-01'),
280
- firstCheckOut: new Date('2026-06-02'),
281
- lastCheckOut: new Date('2026-06-03'),
282
- },
283
- {
284
- checkIn: new Date('2026-06-02'),
285
- firstCheckOut: new Date('2026-06-03'),
286
- lastCheckOut: new Date('2026-06-03'),
287
- },
288
- {
289
- checkIn: new Date('2026-06-07'),
290
- firstCheckOut: new Date('2026-06-08'),
291
- lastCheckOut: new Date('2026-06-11'),
292
- },
293
- {
294
- checkIn: new Date('2026-06-08'),
295
- firstCheckOut: new Date('2026-06-09'),
296
- lastCheckOut: new Date('2026-06-11'),
297
- },
298
- {
299
- checkIn: new Date('2026-06-09'),
300
- firstCheckOut: new Date('2026-06-10'),
301
- lastCheckOut: new Date('2026-06-11'),
302
- },
303
- {
304
- checkIn: new Date('2026-06-10'),
305
- firstCheckOut: new Date('2026-06-11'),
306
- lastCheckOut: new Date('2026-06-11'),
307
- },
308
- {
309
- checkIn: new Date('2026-06-14'),
310
- firstCheckOut: new Date('2026-06-15'),
311
- lastCheckOut: new Date('2026-07-04'),
312
- },
313
- {
314
- checkIn: new Date('2026-06-15'),
315
- firstCheckOut: new Date('2026-06-16'),
316
- lastCheckOut: new Date('2026-07-04'),
317
- },
318
- {
319
- checkIn: new Date('2026-06-16'),
320
- firstCheckOut: new Date('2026-06-17'),
321
- lastCheckOut: new Date('2026-07-04'),
322
- },
323
- {
324
- checkIn: new Date('2026-06-17'),
325
- firstCheckOut: new Date('2026-06-18'),
326
- lastCheckOut: new Date('2026-07-04'),
327
- },
328
- {
329
- checkIn: new Date('2026-06-18'),
330
- firstCheckOut: new Date('2026-06-19'),
331
- lastCheckOut: new Date('2026-07-04'),
332
- },
333
- {
334
- checkIn: new Date('2026-06-19'),
335
- firstCheckOut: new Date('2026-06-20'),
336
- lastCheckOut: new Date('2026-07-04'),
337
- },
338
- {
339
- checkIn: new Date('2026-06-20'),
340
- firstCheckOut: new Date('2026-06-21'),
341
- lastCheckOut: new Date('2026-07-04'),
342
- },
343
- {
344
- checkIn: new Date('2026-06-21'),
345
- firstCheckOut: new Date('2026-06-22'),
346
- lastCheckOut: new Date('2026-07-04'),
347
- },
348
- {
349
- checkIn: new Date('2026-06-22'),
350
- firstCheckOut: new Date('2026-06-23'),
351
- lastCheckOut: new Date('2026-07-04'),
352
- },
353
- {
354
- checkIn: new Date('2026-06-23'),
355
- firstCheckOut: new Date('2026-06-24'),
356
- lastCheckOut: new Date('2026-07-04'),
357
- },
358
- {
359
- checkIn: new Date('2026-06-24'),
360
- firstCheckOut: new Date('2026-06-25'),
361
- lastCheckOut: new Date('2026-07-04'),
362
- },
363
- {
364
- checkIn: new Date('2026-06-25'),
365
- firstCheckOut: new Date('2026-06-26'),
366
- lastCheckOut: new Date('2026-07-04'),
367
- },
368
- {
369
- checkIn: new Date('2026-06-26'),
370
- firstCheckOut: new Date('2026-06-27'),
371
- lastCheckOut: new Date('2026-07-04'),
372
- },
373
- {
374
- checkIn: new Date('2026-06-27'),
375
- firstCheckOut: new Date('2026-06-28'),
376
- lastCheckOut: new Date('2026-07-04'),
377
- },
378
- {
379
- checkIn: new Date('2026-06-28'),
380
- firstCheckOut: new Date('2026-06-29'),
381
- lastCheckOut: new Date('2026-07-04'),
382
- },
383
- {
384
- checkIn: new Date('2026-06-29'),
385
- firstCheckOut: new Date('2026-06-30'),
386
- lastCheckOut: new Date('2026-07-04'),
387
- },
388
- {
389
- checkIn: new Date('2026-06-30'),
390
- firstCheckOut: new Date('2026-06-31'),
391
- lastCheckOut: new Date('2026-07-04'),
392
- },
393
- {
394
- checkIn: new Date('2026-06-31'),
395
- firstCheckOut: new Date('2026-07-01'),
396
- lastCheckOut: new Date('2026-07-04'),
397
- },
398
- {
399
- checkIn: new Date('2026-09-01'),
400
- firstCheckOut: new Date('2026-09-02'),
401
- lastCheckOut: new Date('2026-09-12'),
402
- },
403
- {
404
- checkIn: new Date('2026-09-02'),
405
- firstCheckOut: new Date('2026-09-03'),
406
- lastCheckOut: new Date('2026-09-12'),
407
- },
408
- {
409
- checkIn: new Date('2026-09-03'),
410
- firstCheckOut: new Date('2026-09-04'),
411
- lastCheckOut: new Date('2026-09-12'),
412
- },
413
- {
414
- checkIn: new Date('2026-09-04'),
415
- firstCheckOut: new Date('2026-09-05'),
416
- lastCheckOut: new Date('2026-09-12'),
417
- },
418
- {
419
- checkIn: new Date('2026-09-05'),
420
- firstCheckOut: new Date('2026-09-06'),
421
- lastCheckOut: new Date('2026-09-12'),
422
- },
423
- {
424
- checkIn: new Date('2026-09-06'),
425
- firstCheckOut: new Date('2026-09-07'),
426
- lastCheckOut: new Date('2026-09-12'),
427
- },
428
- {
429
- checkIn: new Date('2026-09-07'),
430
- firstCheckOut: new Date('2026-09-08'),
431
- lastCheckOut: new Date('2026-09-12'),
432
- },
433
- {
434
- checkIn: new Date('2026-09-08'),
435
- firstCheckOut: new Date('2026-09-09'),
436
- lastCheckOut: new Date('2026-09-12'),
437
- },
438
- {
439
- checkIn: new Date('2026-09-09'),
440
- firstCheckOut: new Date('2026-09-10'),
441
- lastCheckOut: new Date('2026-09-12'),
442
- },
443
- {
444
- checkIn: new Date('2026-09-10'),
445
- firstCheckOut: new Date('2026-09-11'),
446
- lastCheckOut: new Date('2026-09-12'),
447
- },
448
- {
449
- checkIn: new Date('2026-09-11'),
450
- firstCheckOut: new Date('2026-09-12'),
451
- lastCheckOut: new Date('2026-09-12'),
452
- },
453
- ],
454
- disabledDates: [
455
- {
456
- to: new Date('2026-07-07'),
457
- from: new Date('2026-07-04'),
458
- },
459
- {
460
- to: new Date('2026-07-16'),
461
- from: new Date('2026-07-14'),
462
- },
463
- {
464
- to: new Date('2026-06-06'),
465
- from: new Date('2026-06-03'),
466
- },
467
- {
468
- to: new Date('2026-06-13'),
469
- from: new Date('2026-06-11'),
470
- },
471
- {
472
- to: new Date('2026-09-31'),
473
- from: new Date('2026-09-12'),
474
- },
475
- ],
476
- },
477
-
478
- language: 'en',
479
- palette: {
480
- primary: '#0095d9',
481
- secondary: '#0095d9',
482
- error: '#d32f2f',
483
- },
484
- loadingData: false,
485
- toggleCalendar: true,
486
- onSubmit: (val: any) => console.log('onSubmit ->', val),
487
- setToggleCalendar: (val: any) => console.log('setToggleCalendar ->', val),
488
- requestDates: (val: any) => console.log('requestDates ->', val),
489
- showFeedback: true,
490
- noActiveSelection: true,
491
- }
492
-
493
- export const Default: Story = {
494
- args: { ...baseData },
495
- render: (args) => {
496
- const [toggleCalendar, setToggleCalendar] = useState(true)
497
- return (
498
- <div style={{ padding: '30px', height: '100vh' }}>
499
- <FilterCalendar
500
- {...args}
501
- toggleCalendar={toggleCalendar}
502
- setToggleCalendar={setToggleCalendar}
503
- />
504
- {/* <button onClick={() => setToggleCalendar(true)}>Open calendar</button> */}
505
- </div>
506
- )
507
- },
508
- }
509
-
510
- export const RangeContext: Story = {
511
- args: {
512
- ...baseData,
513
- rangeContext: {
514
- from: new Date('2026-07-09'),
515
- to: new Date('2026-07-26'),
516
- },
517
- },
518
- render: (args) => {
519
- const [toggleCalendar, setToggleCalendar] = useState(true)
520
- return (
521
- <div style={{ padding: '30px', height: '100vh' }}>
522
- <FilterCalendar
523
- {...args}
524
- toggleCalendar={toggleCalendar}
525
- setToggleCalendar={setToggleCalendar}
526
- />
527
- {/* <button onClick={() => setToggleCalendar(true)}>Open calendar</button> */}
528
- </div>
529
- )
530
- },
531
- }
532
-
533
- export const DisabledRangeContextDates: Story = {
534
- args: {
535
- ...baseData,
536
- rangeContext: {
537
- from: new Date('2026-07-04'),
538
- to: new Date('2026-07-24'),
539
- },
540
- },
541
- render: (args) => {
542
- const [toggleCalendar, setToggleCalendar] = useState(true)
543
- return (
544
- <div style={{ padding: '30px', height: '100vh' }}>
545
- <FilterCalendar
546
- {...args}
547
- toggleCalendar={toggleCalendar}
548
- setToggleCalendar={setToggleCalendar}
549
- />
550
- {/* <button onClick={() => setToggleCalendar(true)}>Open calendar</button> */}
551
- </div>
552
- )
553
- },
554
- }
@@ -1,115 +0,0 @@
1
- import React from 'react'
2
- import { useTranslation } from 'react-i18next'
3
-
4
- import { useTheme } from '../../themes/useTheme'
5
- import { Calendar, CloseButton } from '../../core/components'
6
- import {
7
- useAwaitRender,
8
- useCloseFilterSection,
9
- useUpdateTranslations,
10
- } from '../../core/hooks'
11
-
12
- import { FilterCalendarTypes } from './FilterCalendarTypes'
13
- import { useFilterCalendar } from './hooks/useFilterCalendar'
14
- import { Footer } from './components/Footer'
15
-
16
- import '../../themes/Default.css'
17
- import './FilterCalendar.css'
18
-
19
- export default function FilterCalendar({
20
- calendarOffset,
21
- language,
22
- palette,
23
- onSubmit,
24
- disableCalendarDates: outerDisableCalendarDates,
25
- toggleCalendar,
26
- loadingData,
27
- setToggleCalendar,
28
- requestDates,
29
- showFeedback,
30
- noActiveSelection,
31
- rangeContext: outerRangeContext,
32
- }: FilterCalendarTypes) {
33
- const themePalette = useTheme({ palette })
34
-
35
- // Translations
36
- useUpdateTranslations({ language })
37
- const { t } = useTranslation()
38
-
39
- const {
40
- setCalendarRange,
41
- handleClearDates,
42
- calendarRange,
43
- disabledDates,
44
- updateCalendarMonthNavigation,
45
- updateCalendarDefaultMonth,
46
- setUpdateCalendarMonthNavigation,
47
- calendarHasError,
48
- setCalendarHasError,
49
- setUpdatedForSubmit,
50
- rangeContext,
51
- disableCalendarDates,
52
- } = useFilterCalendar({
53
- onSubmit,
54
- setToggleCalendar,
55
- noActiveSelection,
56
- toggleCalendar,
57
- outerRangeContext,
58
- outerDisableCalendarDates,
59
- })
60
-
61
- // Display component after fully loaded
62
- useAwaitRender()
63
-
64
- // Handle close filter section
65
- const { filterSectionRef } = useCloseFilterSection({
66
- handleSelectedFilter: setToggleCalendar,
67
- })
68
-
69
- return (
70
- <div className={`will-root`} style={themePalette}>
71
- {toggleCalendar && (
72
- <div className={`will-calendar-wrapper`} ref={filterSectionRef}>
73
- <div className={`will-calendar-header`}>
74
- <h2>{t('filterBar:calendar.title')}</h2>
75
- <CloseButton handleClose={() => setToggleCalendar(false)} />
76
- </div>
77
- <div className={`will-calendar-main`}>
78
- <Calendar
79
- calendarRange={calendarRange}
80
- setCalendarRange={setCalendarRange}
81
- calendarOffset={calendarOffset}
82
- selectedPath={'/rooms'}
83
- language={language}
84
- disableCalendarDates={disableCalendarDates}
85
- requestDates={requestDates}
86
- disabledDates={disabledDates}
87
- updateCalendarMonthNavigation={updateCalendarMonthNavigation}
88
- setUpdateCalendarMonthNavigation={
89
- setUpdateCalendarMonthNavigation
90
- }
91
- updateCalendarDefaultMonth={updateCalendarDefaultMonth}
92
- loadingData={loadingData}
93
- showFeedback={showFeedback}
94
- noActiveSelection={noActiveSelection}
95
- palette={palette}
96
- setCalendarHasError={setCalendarHasError}
97
- setUpdatedForSubmit={setUpdatedForSubmit}
98
- rangeContext={rangeContext}
99
- calendarHasError={calendarHasError}
100
- />
101
- </div>
102
- <div className="will-calendar-footer">
103
- <Footer
104
- calendarHasError={calendarHasError}
105
- calendarRange={calendarRange}
106
- handleClearDates={handleClearDates}
107
- language={language}
108
- palette={palette}
109
- />
110
- </div>
111
- </div>
112
- )}
113
- </div>
114
- )
115
- }
@@ -1,11 +0,0 @@
1
- import { DateRange } from 'react-day-picker'
2
-
3
- import { Palette } from '../../themes/useTheme'
4
- import { CalendarTypes } from '../../core/components/calendar/CalendarTypes'
5
-
6
- export interface FilterCalendarTypes extends Partial<CalendarTypes> {
7
- palette: Palette
8
- onSubmit: (val: DateRange) => void
9
- toggleCalendar: boolean
10
- setToggleCalendar: (val: boolean) => void
11
- }