willba-component-library 0.2.55 → 0.2.56
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/assets/IconsSvg.d.ts +9 -0
- package/lib/components/FilterBar/FilterBar.stories.d.ts +1 -1
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
- package/lib/components/FilterCalendar/FilterCalendar.stories.d.ts +2 -1
- package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +3 -3
- package/lib/core/components/calendar/CalendarTypes.d.ts +8 -6
- package/lib/core/components/calendar/hooks/index.d.ts +3 -0
- package/lib/core/components/calendar/hooks/useCalendarLoadingSpinner.d.ts +7 -0
- package/lib/core/components/calendar/hooks/useCalendarTooltips.d.ts +10 -0
- package/lib/core/components/calendar/hooks/useUpdateDisabledDates.d.ts +13 -0
- package/lib/core/components/calendar/utils/calendarSelectionRules.d.ts +15 -0
- package/lib/core/components/calendar/utils/checkForContinuousSelection.d.ts +10 -0
- package/lib/core/components/calendar/utils/disabledDatesByPage.d.ts +9 -0
- package/lib/core/components/calendar/utils/handleCalendarModifiers.d.ts +46 -0
- package/lib/core/components/calendar/utils/handleRangeContextDisabledDates.d.ts +27 -0
- package/lib/core/components/calendar/utils/index.d.ts +8 -0
- package/lib/core/components/calendar/utils/nightsCount.d.ts +6 -0
- package/lib/core/components/calendar/utils/parseDate.d.ts +7 -0
- package/lib/core/components/calendar/utils/parseDates.d.ts +6 -0
- package/lib/index.d.ts +10 -7
- package/lib/index.esm.js +646 -273
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +646 -273
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +646 -273
- package/lib/index.umd.js.map +1 -1
- package/lib/themes/useTheme.d.ts +2 -0
- package/package.json +1 -1
- package/src/assets/IconsSvg.tsx +66 -0
- package/src/components/FilterBar/FilterBar.stories.tsx +2 -1
- package/src/components/FilterBar/FilterBar.tsx +1 -1
- package/src/components/FilterCalendar/FilterCalendar.css +8 -9
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +345 -158
- package/src/components/FilterCalendar/FilterCalendar.tsx +69 -52
- package/src/components/FilterCalendar/FilterCalendarTypes.ts +0 -1
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +44 -4
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +1 -4
- package/src/core/components/calendar/Calendar.css +24 -6
- package/src/core/components/calendar/Calendar.tsx +127 -382
- package/src/core/components/calendar/CalendarTypes.ts +9 -4
- package/src/core/components/calendar/hooks/index.ts +3 -0
- package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +25 -0
- package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +139 -0
- package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +94 -0
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +163 -0
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +50 -0
- package/src/core/components/calendar/utils/disabledDatesByPage.tsx +36 -0
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +151 -0
- package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +70 -0
- package/src/core/components/calendar/utils/index.ts +8 -0
- package/src/themes/Default.css +6 -0
- package/src/themes/useTheme.tsx +3 -0
- package/src/assets/SpinnerSvg.tsx +0 -40
- package/src/core/utils/handleOverlappingDates.tsx +0 -3
- package/src/core/utils/index.ts +0 -3
- /package/src/core/{utils → components/calendar/utils}/nightsCount.tsx +0 -0
- /package/src/core/{utils → components/calendar/utils}/parseDate.tsx +0 -0
- /package/src/core/{utils → components/calendar/utils}/parseDates.tsx +0 -0
package/lib/themes/useTheme.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
export type Palette = {
|
|
3
3
|
primary: string;
|
|
4
4
|
secondary: string;
|
|
5
|
+
error: string;
|
|
5
6
|
};
|
|
6
7
|
export type ThemeProps = {
|
|
7
8
|
palette?: Palette;
|
|
@@ -9,5 +10,6 @@ export type ThemeProps = {
|
|
|
9
10
|
export interface CustomPaletteTypes extends CSSProperties {
|
|
10
11
|
'--will-primary'?: string;
|
|
11
12
|
'--will-secondary'?: string;
|
|
13
|
+
'--will-error'?: string;
|
|
12
14
|
}
|
|
13
15
|
export default function useTheme({ palette }: ThemeProps): CustomPaletteTypes;
|
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
type Icon = 'spinner' | 'warning'
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
fill?: string
|
|
7
|
+
size?: number
|
|
8
|
+
icon: Icon
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const IconsSvg = ({ fill, size, icon }: Props) => {
|
|
12
|
+
switch (icon) {
|
|
13
|
+
case 'spinner':
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
width={`${size || 25}`}
|
|
18
|
+
height={`${size || 25}`}
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
>
|
|
21
|
+
<style>
|
|
22
|
+
{`
|
|
23
|
+
.spinner_z9k8 {
|
|
24
|
+
transform-origin: center;
|
|
25
|
+
animation: spinner_StKS .75s infinite linear;
|
|
26
|
+
}
|
|
27
|
+
@keyframes spinner_StKS {
|
|
28
|
+
100% {
|
|
29
|
+
transform: rotate(360deg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`}
|
|
33
|
+
</style>
|
|
34
|
+
<path
|
|
35
|
+
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
|
|
36
|
+
opacity=".25"
|
|
37
|
+
fill={fill}
|
|
38
|
+
/>
|
|
39
|
+
<path
|
|
40
|
+
d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"
|
|
41
|
+
className="spinner_z9k8"
|
|
42
|
+
fill={fill}
|
|
43
|
+
/>
|
|
44
|
+
</svg>
|
|
45
|
+
)
|
|
46
|
+
case 'warning':
|
|
47
|
+
return (
|
|
48
|
+
<svg
|
|
49
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
+
width={`${size || 25}`}
|
|
51
|
+
height={`${size || 25}`}
|
|
52
|
+
className="svg-icon"
|
|
53
|
+
style={{
|
|
54
|
+
verticalAlign: 'middle',
|
|
55
|
+
fill: fill,
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
}}
|
|
58
|
+
viewBox="0 0 1024 1024"
|
|
59
|
+
version="1.1"
|
|
60
|
+
>
|
|
61
|
+
<path d="M42.666667 896h938.666666L512 85.333333 42.666667 896z m512-128h-85.333334v-85.333333h85.333334v85.333333z m0-170.666667h-85.333334v-170.666666h85.333334v170.666666z" />
|
|
62
|
+
</svg>
|
|
63
|
+
)
|
|
64
|
+
default:
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -13,7 +13,7 @@ export default meta
|
|
|
13
13
|
|
|
14
14
|
type Story = StoryObj<typeof FilterBar>
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const Main: Story = {
|
|
17
17
|
args: {
|
|
18
18
|
disableCalendarDates: {
|
|
19
19
|
disabledDatesByPage: [
|
|
@@ -53,6 +53,7 @@ export const Primary: Story = {
|
|
|
53
53
|
palette: {
|
|
54
54
|
primary: '',
|
|
55
55
|
secondary: '',
|
|
56
|
+
error: '#d32f2f',
|
|
56
57
|
},
|
|
57
58
|
mode: 'dark',
|
|
58
59
|
tabs: [
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useUpdateTranslations,
|
|
11
11
|
} from '../../core/hooks'
|
|
12
12
|
import { Calendar, SubmitButton, CloseButton } from '../../core/components'
|
|
13
|
-
import { parseDates } from '../../core/utils'
|
|
13
|
+
import { parseDates } from '../../core/components/calendar/utils'
|
|
14
14
|
|
|
15
15
|
import { parseGuests } from './utils'
|
|
16
16
|
import { FilterBarProps, FilterSections, Pages } from './FilterBarTypes'
|
|
@@ -16,22 +16,25 @@
|
|
|
16
16
|
/* Header */
|
|
17
17
|
|
|
18
18
|
.will-root .will-calendar-wrapper .will-calendar-header {
|
|
19
|
-
border-bottom: 1px solid var(--will-grey);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.will-root .will-calendar-wrapper .will-calendar-header-row {
|
|
23
19
|
display: flex;
|
|
24
20
|
justify-content: space-between;
|
|
21
|
+
border-bottom: 1px solid var(--will-grey);
|
|
25
22
|
align-items: center;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
/* Footer */
|
|
29
26
|
|
|
30
27
|
.will-root .will-calendar-wrapper .will-calendar-footer {
|
|
28
|
+
border-top: 1px solid var(--will-grey);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Footer actions */
|
|
32
|
+
|
|
33
|
+
.will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {
|
|
31
34
|
display: flex;
|
|
32
35
|
justify-content: space-between;
|
|
33
36
|
align-items: center;
|
|
34
|
-
|
|
37
|
+
margin-bottom: 10px;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates > div {
|
|
@@ -53,8 +56,6 @@
|
|
|
53
56
|
gap: 10px;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
59
|
@media (max-width: 960px) {
|
|
59
60
|
.will-root .will-calendar-wrapper {
|
|
60
61
|
width: -webkit-fill-available;
|
|
@@ -89,8 +90,6 @@
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
/**/
|
|
93
|
-
|
|
94
93
|
.will-root .will-calendar-wrapper .will-calendar-header .will-filter-bar-close-button {
|
|
95
94
|
position: initial;
|
|
96
95
|
}
|
|
@@ -12,166 +12,353 @@ export default meta
|
|
|
12
12
|
|
|
13
13
|
type Story = StoryObj<typeof FilterCalendar>
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
lastCheckOut: new Date('2024-08-07'),
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
checkIn: new Date('2024-08-02'),
|
|
26
|
-
firstCheckOut: new Date('2024-08-03'),
|
|
27
|
-
lastCheckOut: new Date('2024-08-07'),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
checkIn: new Date('2024-08-03'),
|
|
31
|
-
firstCheckOut: new Date('2024-08-04'),
|
|
32
|
-
lastCheckOut: new Date('2024-08-07'),
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
checkIn: new Date('2024-08-04'),
|
|
36
|
-
firstCheckOut: new Date('2024-08-05'),
|
|
37
|
-
lastCheckOut: new Date('2024-08-07'),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
checkIn: new Date('2024-08-05'),
|
|
41
|
-
firstCheckOut: new Date('2024-08-06'),
|
|
42
|
-
lastCheckOut: new Date('2024-08-07'),
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
checkIn: new Date('2024-08-06'),
|
|
46
|
-
firstCheckOut: new Date('2024-08-07'),
|
|
47
|
-
lastCheckOut: new Date('2024-08-07'),
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
checkIn: new Date('2024-08-08'),
|
|
51
|
-
firstCheckOut: new Date('2024-08-09'),
|
|
52
|
-
lastCheckOut: new Date('2024-08-13'),
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
checkIn: new Date('2024-08-09'),
|
|
56
|
-
firstCheckOut: new Date('2024-08-10'),
|
|
57
|
-
lastCheckOut: new Date('2024-08-13'),
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
checkIn: new Date('2024-08-10'),
|
|
61
|
-
firstCheckOut: new Date('2024-08-11'),
|
|
62
|
-
lastCheckOut: new Date('2024-08-13'),
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
checkIn: new Date('2024-08-11'),
|
|
66
|
-
firstCheckOut: new Date('2024-08-12'),
|
|
67
|
-
lastCheckOut: new Date('2024-08-13'),
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
checkIn: new Date('2024-08-12'),
|
|
71
|
-
firstCheckOut: new Date('2024-08-13'),
|
|
72
|
-
lastCheckOut: new Date('2024-08-13'),
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
checkIn: new Date('2024-08-15'),
|
|
76
|
-
firstCheckOut: new Date('2024-08-16'),
|
|
77
|
-
lastCheckOut: new Date('2024-08-20'),
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
checkIn: new Date('2024-08-16'),
|
|
81
|
-
firstCheckOut: new Date('2024-08-17'),
|
|
82
|
-
lastCheckOut: new Date('2024-08-20'),
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
checkIn: new Date('2024-08-17'),
|
|
86
|
-
firstCheckOut: new Date('2024-08-18'),
|
|
87
|
-
lastCheckOut: new Date('2024-08-20'),
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
checkIn: new Date('2024-08-18'),
|
|
91
|
-
firstCheckOut: new Date('2024-08-19'),
|
|
92
|
-
lastCheckOut: new Date('2024-08-20'),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
checkIn: new Date('2024-08-19'),
|
|
96
|
-
firstCheckOut: new Date('2024-08-20'),
|
|
97
|
-
lastCheckOut: new Date('2024-08-20'),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
checkIn: new Date('2024-08-24'),
|
|
101
|
-
firstCheckOut: new Date('2024-08-25'),
|
|
102
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
checkIn: new Date('2024-08-25'),
|
|
106
|
-
firstCheckOut: new Date('2024-08-26'),
|
|
107
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
checkIn: new Date('2024-08-26'),
|
|
111
|
-
firstCheckOut: new Date('2024-08-27'),
|
|
112
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
checkIn: new Date('2024-08-27'),
|
|
116
|
-
firstCheckOut: new Date('2024-08-28'),
|
|
117
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
checkIn: new Date('2024-08-28'),
|
|
121
|
-
firstCheckOut: new Date('2024-08-29'),
|
|
122
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
checkIn: new Date('2024-08-29'),
|
|
126
|
-
firstCheckOut: new Date('2024-08-30'),
|
|
127
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
checkIn: new Date('2024-08-30'),
|
|
131
|
-
firstCheckOut: new Date('2024-08-31'),
|
|
132
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
checkIn: new Date('2024-08-31'),
|
|
136
|
-
firstCheckOut: new Date('2024-09-01'),
|
|
137
|
-
lastCheckOut: new Date('2024-09-10'),
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
disabledDates: [
|
|
141
|
-
{
|
|
142
|
-
from: new Date('2024-07-02'),
|
|
143
|
-
to: new Date('2024-07-03'),
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
from: new Date('2024-08-07'),
|
|
147
|
-
to: new Date('2024-08-07'),
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
from: new Date('2024-08-13'),
|
|
151
|
-
to: new Date('2024-08-14'),
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
from: new Date('2024-08-20'),
|
|
155
|
-
to: new Date('2024-08-23'),
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
selectedDates: {
|
|
159
|
-
from: new Date('2024-09-05'),
|
|
160
|
-
to: new Date('2024-09-10'),
|
|
15
|
+
const baseData = {
|
|
16
|
+
disableCalendarDates: {
|
|
17
|
+
availableDates: [
|
|
18
|
+
{
|
|
19
|
+
checkIn: new Date('2024-11-01'),
|
|
20
|
+
firstCheckOut: new Date('2024-11-02'),
|
|
21
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
161
22
|
},
|
|
23
|
+
{
|
|
24
|
+
checkIn: new Date('2024-11-02'),
|
|
25
|
+
firstCheckOut: new Date('2024-11-03'),
|
|
26
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
checkIn: new Date('2024-11-03'),
|
|
30
|
+
firstCheckOut: new Date('2024-11-04'),
|
|
31
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
checkIn: new Date('2024-11-04'),
|
|
35
|
+
firstCheckOut: new Date('2024-11-05'),
|
|
36
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
checkIn: new Date('2024-11-05'),
|
|
40
|
+
firstCheckOut: new Date('2024-11-06'),
|
|
41
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
checkIn: new Date('2024-11-06'),
|
|
45
|
+
firstCheckOut: new Date('2024-11-07'),
|
|
46
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
checkIn: new Date('2024-11-07'),
|
|
50
|
+
firstCheckOut: new Date('2024-11-08'),
|
|
51
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
checkIn: new Date('2024-11-08'),
|
|
55
|
+
firstCheckOut: new Date('2024-11-09'),
|
|
56
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
checkIn: new Date('2024-11-09'),
|
|
60
|
+
firstCheckOut: new Date('2024-11-10'),
|
|
61
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
checkIn: new Date('2024-11-10'),
|
|
65
|
+
firstCheckOut: new Date('2024-11-11'),
|
|
66
|
+
lastCheckOut: new Date('2024-11-11'),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
checkIn: new Date('2024-11-15'),
|
|
70
|
+
firstCheckOut: new Date('2024-11-16'),
|
|
71
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
checkIn: new Date('2024-11-16'),
|
|
75
|
+
firstCheckOut: new Date('2024-11-17'),
|
|
76
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
checkIn: new Date('2024-11-17'),
|
|
80
|
+
firstCheckOut: new Date('2024-11-18'),
|
|
81
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
checkIn: new Date('2024-11-18'),
|
|
85
|
+
firstCheckOut: new Date('2024-11-19'),
|
|
86
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
checkIn: new Date('2024-11-19'),
|
|
90
|
+
firstCheckOut: new Date('2024-11-20'),
|
|
91
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
checkIn: new Date('2024-11-20'),
|
|
95
|
+
firstCheckOut: new Date('2024-11-21'),
|
|
96
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
checkIn: new Date('2024-11-21'),
|
|
100
|
+
firstCheckOut: new Date('2024-11-22'),
|
|
101
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
checkIn: new Date('2024-11-22'),
|
|
105
|
+
firstCheckOut: new Date('2024-11-23'),
|
|
106
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
checkIn: new Date('2024-11-23'),
|
|
110
|
+
firstCheckOut: new Date('2024-11-24'),
|
|
111
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
checkIn: new Date('2024-11-24'),
|
|
115
|
+
firstCheckOut: new Date('2024-11-25'),
|
|
116
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
checkIn: new Date('2024-11-25'),
|
|
120
|
+
firstCheckOut: new Date('2024-11-26'),
|
|
121
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
checkIn: new Date('2024-11-26'),
|
|
125
|
+
firstCheckOut: new Date('2024-11-27'),
|
|
126
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
checkIn: new Date('2024-11-27'),
|
|
130
|
+
firstCheckOut: new Date('2024-11-28'),
|
|
131
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
checkIn: new Date('2024-11-28'),
|
|
135
|
+
firstCheckOut: new Date('2024-11-29'),
|
|
136
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
checkIn: new Date('2024-11-29'),
|
|
140
|
+
firstCheckOut: new Date('2024-11-30'),
|
|
141
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
checkIn: new Date('2024-11-30'),
|
|
145
|
+
firstCheckOut: new Date('2024-12-01'),
|
|
146
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
checkIn: new Date('2024-12-01'),
|
|
150
|
+
firstCheckOut: new Date('2024-12-02'),
|
|
151
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
checkIn: new Date('2024-12-02'),
|
|
155
|
+
firstCheckOut: new Date('2024-12-03'),
|
|
156
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
checkIn: new Date('2024-12-03'),
|
|
160
|
+
firstCheckOut: new Date('2024-12-04'),
|
|
161
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
checkIn: new Date('2024-12-04'),
|
|
165
|
+
firstCheckOut: new Date('2024-12-05'),
|
|
166
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
checkIn: new Date('2024-12-05'),
|
|
170
|
+
firstCheckOut: new Date('2024-12-06'),
|
|
171
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
checkIn: new Date('2024-12-06'),
|
|
175
|
+
firstCheckOut: new Date('2024-12-07'),
|
|
176
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
checkIn: new Date('2024-12-07'),
|
|
180
|
+
firstCheckOut: new Date('2024-12-08'),
|
|
181
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
checkIn: new Date('2024-12-08'),
|
|
185
|
+
firstCheckOut: new Date('2024-12-09'),
|
|
186
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
checkIn: new Date('2024-12-09'),
|
|
190
|
+
firstCheckOut: new Date('2024-12-10'),
|
|
191
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
checkIn: new Date('2024-12-10'),
|
|
195
|
+
firstCheckOut: new Date('2024-12-11'),
|
|
196
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
checkIn: new Date('2024-12-11'),
|
|
200
|
+
firstCheckOut: new Date('2024-12-12'),
|
|
201
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
checkIn: new Date('2024-12-12'),
|
|
205
|
+
firstCheckOut: new Date('2024-12-13'),
|
|
206
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
checkIn: new Date('2024-12-13'),
|
|
210
|
+
firstCheckOut: new Date('2024-12-14'),
|
|
211
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
checkIn: new Date('2024-12-14'),
|
|
215
|
+
firstCheckOut: new Date('2024-12-15'),
|
|
216
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
checkIn: new Date('2024-12-15'),
|
|
220
|
+
firstCheckOut: new Date('2024-12-16'),
|
|
221
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
checkIn: new Date('2024-12-16'),
|
|
225
|
+
firstCheckOut: new Date('2024-12-17'),
|
|
226
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
checkIn: new Date('2024-12-17'),
|
|
230
|
+
firstCheckOut: new Date('2024-12-18'),
|
|
231
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
checkIn: new Date('2024-12-18'),
|
|
235
|
+
firstCheckOut: new Date('2024-12-19'),
|
|
236
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
checkIn: new Date('2024-12-19'),
|
|
240
|
+
firstCheckOut: new Date('2024-12-20'),
|
|
241
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
checkIn: new Date('2024-12-20'),
|
|
245
|
+
firstCheckOut: new Date('2024-12-21'),
|
|
246
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
checkIn: new Date('2024-12-21'),
|
|
250
|
+
firstCheckOut: new Date('2024-12-22'),
|
|
251
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
checkIn: new Date('2024-12-22'),
|
|
255
|
+
firstCheckOut: new Date('2024-12-23'),
|
|
256
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
checkIn: new Date('2024-12-23'),
|
|
260
|
+
firstCheckOut: new Date('2024-12-24'),
|
|
261
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
checkIn: new Date('2024-12-24'),
|
|
265
|
+
firstCheckOut: new Date('2024-12-25'),
|
|
266
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
checkIn: new Date('2024-12-25'),
|
|
270
|
+
firstCheckOut: new Date('2024-12-26'),
|
|
271
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
checkIn: new Date('2024-12-26'),
|
|
275
|
+
firstCheckOut: new Date('2024-12-27'),
|
|
276
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
checkIn: new Date('2024-12-27'),
|
|
280
|
+
firstCheckOut: new Date('2024-12-28'),
|
|
281
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
checkIn: new Date('2024-12-28'),
|
|
285
|
+
firstCheckOut: new Date('2024-12-29'),
|
|
286
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
checkIn: new Date('2024-12-29'),
|
|
290
|
+
firstCheckOut: new Date('2024-12-30'),
|
|
291
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
checkIn: new Date('2024-12-30'),
|
|
295
|
+
firstCheckOut: new Date('2024-12-31'),
|
|
296
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
checkIn: new Date('2024-12-31'),
|
|
300
|
+
firstCheckOut: new Date('2025-01-01'),
|
|
301
|
+
lastCheckOut: new Date('2025-03-01'),
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
disabledDates: [
|
|
305
|
+
{
|
|
306
|
+
to: new Date('2024-10-09'),
|
|
307
|
+
from: new Date('2024-10-01'),
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
to: new Date('2024-10-18'),
|
|
311
|
+
from: new Date('2024-10-17'),
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
to: new Date('2024-10-23'),
|
|
315
|
+
from: new Date('2024-10-22'),
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
to: new Date('2024-11-14'),
|
|
319
|
+
from: new Date('2024-11-11'),
|
|
320
|
+
},
|
|
321
|
+
],
|
|
322
|
+
},
|
|
323
|
+
language: 'en',
|
|
324
|
+
palette: {
|
|
325
|
+
primary: '#0095d9',
|
|
326
|
+
secondary: '#0095d9',
|
|
327
|
+
error: '#d32f2f',
|
|
328
|
+
},
|
|
329
|
+
loadingData: false,
|
|
330
|
+
toggleCalendar: true,
|
|
331
|
+
onSubmit: (val: any) => console.log('onSubmit ->', val),
|
|
332
|
+
setToggleCalendar: (val: any) => console.log('setToggleCalendar ->', val),
|
|
333
|
+
requestDates: (val: any) => console.log('requestDates ->', val),
|
|
334
|
+
showFeedback: true,
|
|
335
|
+
noActiveSelection: true,
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export const Default: Story = {
|
|
339
|
+
args: { ...baseData },
|
|
340
|
+
render: (args) => {
|
|
341
|
+
const [toggleCalendar, setToggleCalendar] = useState(true)
|
|
342
|
+
return (
|
|
343
|
+
<div style={{ padding: '30px', height: '100vh' }}>
|
|
344
|
+
<FilterCalendar
|
|
345
|
+
{...args}
|
|
346
|
+
toggleCalendar={toggleCalendar}
|
|
347
|
+
setToggleCalendar={setToggleCalendar}
|
|
348
|
+
/>
|
|
349
|
+
{/* <button onClick={() => setToggleCalendar(true)}>Open calendar</button> */}
|
|
350
|
+
</div>
|
|
351
|
+
)
|
|
352
|
+
},
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export const RangeContext: Story = {
|
|
356
|
+
args: {
|
|
357
|
+
...baseData,
|
|
358
|
+
rangeContext: {
|
|
359
|
+
from: new Date('2024-11-20'),
|
|
360
|
+
to: new Date('2024-11-23'),
|
|
162
361
|
},
|
|
163
|
-
language: 'en',
|
|
164
|
-
palette: {
|
|
165
|
-
primary: '#0095d9',
|
|
166
|
-
secondary: '#0095d9',
|
|
167
|
-
},
|
|
168
|
-
loadingData: true,
|
|
169
|
-
toggleCalendar: true,
|
|
170
|
-
onSubmit: (val) => console.log('onSubmit ->', val),
|
|
171
|
-
setToggleCalendar: (val) => console.log('setToggleCalendar ->', val),
|
|
172
|
-
requestDates: (val) => console.log('requestDates ->', val),
|
|
173
|
-
showFeedback: true,
|
|
174
|
-
noActiveSelection: true,
|
|
175
362
|
},
|
|
176
363
|
render: (args) => {
|
|
177
364
|
const [toggleCalendar, setToggleCalendar] = useState(true)
|