willba-component-library 0.2.80 → 0.2.82
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/components/FilterBar/FilterBar.stories.d.ts +1 -1
- package/lib/components/FilterBar/FilterBarTypes.d.ts +2 -2
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
- package/lib/components/FilterCalendar/FilterCalendar.stories.d.ts +3 -1
- package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +10 -3
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +3 -1
- package/lib/core/components/calendar/CalendarTypes.d.ts +9 -2
- package/lib/index.d.ts +11 -4
- package/lib/index.esm.js +896 -268
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +896 -268
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +896 -268
- 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 +68 -0
- package/src/components/FilterBar/FilterBar.stories.tsx +2 -1
- package/src/components/FilterBar/FilterBar.tsx +2 -2
- package/src/components/FilterBar/FilterBarTypes.ts +1 -1
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +1 -1
- package/src/components/FilterCalendar/FilterCalendar.css +26 -10
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +522 -153
- package/src/components/FilterCalendar/FilterCalendar.tsx +25 -54
- package/src/components/FilterCalendar/FilterCalendarTypes.ts +0 -1
- package/src/components/FilterCalendar/components/Footer.tsx +96 -0
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +94 -4
- package/src/core/components/buttons/submit-button/SubmitButton.css +16 -2
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +6 -5
- package/src/core/components/calendar/Calendar.css +71 -18
- package/src/core/components/calendar/Calendar.tsx +132 -342
- package/src/core/components/calendar/CalendarTypes.ts +10 -3
- package/src/core/components/calendar/hooks/index.ts +3 -0
- package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +19 -0
- package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +125 -0
- package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +107 -0
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +228 -0
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +86 -0
- package/src/core/components/calendar/utils/disabledDatesByPage.tsx +36 -0
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +147 -0
- package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +75 -0
- package/src/core/components/calendar/utils/index.ts +8 -0
- package/src/locales/en/common.json +7 -1
- package/src/locales/en/filterBar.json +2 -1
- package/src/locales/fi/common.json +7 -1
- package/src/locales/fi/filterBar.json +2 -1
- package/src/themes/Default.css +12 -3
- package/src/themes/useTheme.tsx +3 -0
- package/src/assets/SpinnerSvg.tsx +0 -40
- 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
|
@@ -3,16 +3,16 @@ import { useTranslation } from 'react-i18next'
|
|
|
3
3
|
|
|
4
4
|
import useTheme from '../../themes/useTheme'
|
|
5
5
|
import '../../themes/Default.css'
|
|
6
|
-
import { Calendar,
|
|
6
|
+
import { Calendar, CloseButton } from '../../core/components'
|
|
7
7
|
import {
|
|
8
8
|
useAwaitRender,
|
|
9
9
|
useCloseFilterSection,
|
|
10
10
|
useUpdateTranslations,
|
|
11
11
|
} from '../../core/hooks'
|
|
12
|
-
import { nightsCount, parseDate } from '../../core/utils'
|
|
13
12
|
|
|
14
13
|
import { FilterCalendarTypes } from './FilterCalendarTypes'
|
|
15
14
|
import { useFilterCalendar } from './hooks/useFilterCalendar'
|
|
15
|
+
import { Footer } from './components/Footer'
|
|
16
16
|
|
|
17
17
|
import './FilterCalendar.css'
|
|
18
18
|
|
|
@@ -21,13 +21,14 @@ export default function FilterCalendar({
|
|
|
21
21
|
language,
|
|
22
22
|
palette,
|
|
23
23
|
onSubmit,
|
|
24
|
-
disableCalendarDates,
|
|
24
|
+
disableCalendarDates: outerDisableCalendarDates,
|
|
25
25
|
toggleCalendar,
|
|
26
26
|
loadingData,
|
|
27
27
|
setToggleCalendar,
|
|
28
28
|
requestDates,
|
|
29
29
|
showFeedback,
|
|
30
30
|
noActiveSelection,
|
|
31
|
+
rangeContext: outerRangeContext,
|
|
31
32
|
}: FilterCalendarTypes) {
|
|
32
33
|
const themePalette = useTheme({ palette })
|
|
33
34
|
|
|
@@ -36,21 +37,26 @@ export default function FilterCalendar({
|
|
|
36
37
|
const { t } = useTranslation()
|
|
37
38
|
|
|
38
39
|
const {
|
|
39
|
-
handleSubmit,
|
|
40
40
|
setCalendarRange,
|
|
41
41
|
handleClearDates,
|
|
42
42
|
calendarRange,
|
|
43
43
|
disabledDates,
|
|
44
44
|
setDisabledDates,
|
|
45
45
|
updateCalendarMonthNavigation,
|
|
46
|
-
|
|
46
|
+
updateCalendarDefaultMonth,
|
|
47
47
|
setUpdateCalendarMonthNavigation,
|
|
48
|
-
|
|
48
|
+
calendarHasError,
|
|
49
|
+
setCalendarHasError,
|
|
50
|
+
setUpdatedForSubmit,
|
|
51
|
+
rangeContext,
|
|
52
|
+
disableCalendarDates,
|
|
49
53
|
} = useFilterCalendar({
|
|
50
54
|
onSubmit,
|
|
51
55
|
setToggleCalendar,
|
|
52
56
|
noActiveSelection,
|
|
53
57
|
toggleCalendar,
|
|
58
|
+
outerRangeContext,
|
|
59
|
+
outerDisableCalendarDates,
|
|
54
60
|
})
|
|
55
61
|
|
|
56
62
|
// Display component after fully loaded
|
|
@@ -61,10 +67,6 @@ export default function FilterCalendar({
|
|
|
61
67
|
handleSelectedFilter: setToggleCalendar,
|
|
62
68
|
})
|
|
63
69
|
|
|
64
|
-
const nights = nightsCount({
|
|
65
|
-
calendarRange: calendarRange || initialCalendarRange,
|
|
66
|
-
})
|
|
67
|
-
|
|
68
70
|
return (
|
|
69
71
|
<div className={`will-root`} style={themePalette}>
|
|
70
72
|
{toggleCalendar && (
|
|
@@ -88,56 +90,25 @@ export default function FilterCalendar({
|
|
|
88
90
|
setUpdateCalendarMonthNavigation={
|
|
89
91
|
setUpdateCalendarMonthNavigation
|
|
90
92
|
}
|
|
91
|
-
|
|
93
|
+
updateCalendarDefaultMonth={updateCalendarDefaultMonth}
|
|
92
94
|
loadingData={loadingData}
|
|
93
|
-
initialCalendarRange={initialCalendarRange}
|
|
94
95
|
showFeedback={showFeedback}
|
|
95
96
|
noActiveSelection={noActiveSelection}
|
|
96
97
|
palette={palette}
|
|
98
|
+
setCalendarHasError={setCalendarHasError}
|
|
99
|
+
setUpdatedForSubmit={setUpdatedForSubmit}
|
|
100
|
+
rangeContext={rangeContext}
|
|
101
|
+
calendarHasError={calendarHasError}
|
|
97
102
|
/>
|
|
98
103
|
</div>
|
|
99
|
-
<div className=
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}) || t('common:checkIn')}
|
|
108
|
-
</span>
|
|
109
|
-
<span className={`will-calendar-footer-dates-separator`}>
|
|
110
|
-
-
|
|
111
|
-
</span>
|
|
112
|
-
<span>
|
|
113
|
-
{parseDate({
|
|
114
|
-
date: calendarRange?.to || initialCalendarRange?.to,
|
|
115
|
-
dateFormat: 'EEEEEE d.M.yyyy',
|
|
116
|
-
language,
|
|
117
|
-
}) || t('common:checkOut')}
|
|
118
|
-
</span>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<span className={`will-calendar-footer-booked`}>
|
|
122
|
-
{nights
|
|
123
|
-
? `${nights} ${t(
|
|
124
|
-
`common:${nights === 1 ? 'night' : 'nights'}`
|
|
125
|
-
)}`
|
|
126
|
-
: ''}
|
|
127
|
-
</span>
|
|
128
|
-
</div>
|
|
129
|
-
<div className={`will-calendar-footer-actions`}>
|
|
130
|
-
<SubmitButton
|
|
131
|
-
onClick={handleClearDates}
|
|
132
|
-
disabled={!calendarRange?.from}
|
|
133
|
-
label={t(`common:clearDates`)}
|
|
134
|
-
/>
|
|
135
|
-
<SubmitButton
|
|
136
|
-
onClick={() => handleSubmit()}
|
|
137
|
-
label={t(`common:apply`)}
|
|
138
|
-
disabled={!calendarRange?.from || !calendarRange?.to}
|
|
139
|
-
/>
|
|
140
|
-
</div>
|
|
104
|
+
<div className="will-calendar-footer">
|
|
105
|
+
<Footer
|
|
106
|
+
calendarHasError={calendarHasError}
|
|
107
|
+
calendarRange={calendarRange}
|
|
108
|
+
handleClearDates={handleClearDates}
|
|
109
|
+
language={language}
|
|
110
|
+
palette={palette}
|
|
111
|
+
/>
|
|
141
112
|
</div>
|
|
142
113
|
</div>
|
|
143
114
|
)}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { useMediaQuery } from 'react-responsive'
|
|
4
|
+
import { DateRange } from 'react-day-picker'
|
|
5
|
+
|
|
6
|
+
import { Palette } from '../../../themes/useTheme'
|
|
7
|
+
import { nightsCount, parseDate } from '../../../core/components/calendar/utils'
|
|
8
|
+
import { IconsSvg } from '../../../assets/IconsSvg'
|
|
9
|
+
import { SubmitButton } from '../../../core/components'
|
|
10
|
+
|
|
11
|
+
export const Footer = ({
|
|
12
|
+
calendarHasError,
|
|
13
|
+
calendarRange,
|
|
14
|
+
handleClearDates,
|
|
15
|
+
language,
|
|
16
|
+
palette,
|
|
17
|
+
}: {
|
|
18
|
+
calendarHasError: boolean
|
|
19
|
+
calendarRange?: DateRange
|
|
20
|
+
handleClearDates: () => void
|
|
21
|
+
language?: string
|
|
22
|
+
palette: Palette
|
|
23
|
+
}) => {
|
|
24
|
+
const { t } = useTranslation()
|
|
25
|
+
const isMobile = useMediaQuery({ maxWidth: 600 })
|
|
26
|
+
|
|
27
|
+
const nights = nightsCount({
|
|
28
|
+
calendarRange: calendarRange,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="will-calendar-footer-actions-wrapper">
|
|
33
|
+
<div className="will-calendar-footer-dates">
|
|
34
|
+
{calendarHasError ? (
|
|
35
|
+
<div className="will-calendar-footer-error">
|
|
36
|
+
{calendarHasError &&
|
|
37
|
+
renderCalendarErrorMessage({
|
|
38
|
+
palette,
|
|
39
|
+
message: t(
|
|
40
|
+
`common:errors.calendarErrors.checkInAvailabilityError`
|
|
41
|
+
),
|
|
42
|
+
})}
|
|
43
|
+
</div>
|
|
44
|
+
) : (
|
|
45
|
+
<div>
|
|
46
|
+
<span>
|
|
47
|
+
{parseDate({
|
|
48
|
+
date: calendarRange?.from,
|
|
49
|
+
dateFormat: 'EEEEEE d.M.yyyy',
|
|
50
|
+
language,
|
|
51
|
+
}) || t('common:checkIn')}
|
|
52
|
+
</span>
|
|
53
|
+
<span className="will-calendar-footer-dates-separator">-</span>
|
|
54
|
+
<span>
|
|
55
|
+
{parseDate({
|
|
56
|
+
date: calendarRange?.to,
|
|
57
|
+
dateFormat: 'EEEEEE d.M.yyyy',
|
|
58
|
+
language,
|
|
59
|
+
}) || t('common:checkOut')}
|
|
60
|
+
</span>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
<span className="will-calendar-footer-booked">
|
|
65
|
+
{!calendarHasError && nights
|
|
66
|
+
? `${nights} ${t(`common:${nights === 1 ? 'night' : 'nights'}`)}`
|
|
67
|
+
: ''}
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div className="will-calendar-footer-actions">
|
|
72
|
+
<SubmitButton
|
|
73
|
+
onClick={handleClearDates}
|
|
74
|
+
disabled={!calendarRange?.from}
|
|
75
|
+
label={t(`common:clearDates`)}
|
|
76
|
+
variant="text"
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/////////
|
|
84
|
+
|
|
85
|
+
const renderCalendarErrorMessage = ({
|
|
86
|
+
message,
|
|
87
|
+
palette,
|
|
88
|
+
}: {
|
|
89
|
+
message?: string
|
|
90
|
+
palette: Palette
|
|
91
|
+
}) => (
|
|
92
|
+
<>
|
|
93
|
+
<IconsSvg fill={palette?.error || 'inherit'} size={25} icon="warning" />
|
|
94
|
+
<span>{message || ''}</span>
|
|
95
|
+
</>
|
|
96
|
+
)
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
2
|
import { DateRange, Matcher } from 'react-day-picker'
|
|
3
|
+
import { compareAsc, endOfDay, format, isAfter, parseISO } from 'date-fns'
|
|
4
|
+
import {
|
|
5
|
+
DisableCalendarDates,
|
|
6
|
+
RangeContext,
|
|
7
|
+
} from 'src/core/components/calendar/CalendarTypes'
|
|
3
8
|
|
|
4
9
|
type Props = {
|
|
5
10
|
onSubmit: (val: any) => void
|
|
6
11
|
setToggleCalendar: (val: boolean) => void
|
|
7
12
|
noActiveSelection?: boolean
|
|
8
13
|
toggleCalendar?: boolean
|
|
14
|
+
outerRangeContext?: RangeContext
|
|
15
|
+
outerDisableCalendarDates?: DisableCalendarDates
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
export const useFilterCalendar = ({
|
|
@@ -13,17 +20,59 @@ export const useFilterCalendar = ({
|
|
|
13
20
|
setToggleCalendar,
|
|
14
21
|
noActiveSelection,
|
|
15
22
|
toggleCalendar,
|
|
23
|
+
outerRangeContext,
|
|
24
|
+
outerDisableCalendarDates,
|
|
16
25
|
}: Props) => {
|
|
26
|
+
// State
|
|
17
27
|
const [calendarRange, setCalendarRange] = useState<DateRange | undefined>()
|
|
28
|
+
const [rangeContext, setRangeContext] = useState<RangeContext | undefined>(
|
|
29
|
+
outerRangeContext
|
|
30
|
+
)
|
|
18
31
|
const [initialCalendarRange, setInitialCalendarRange] = useState<
|
|
19
32
|
DateRange | undefined
|
|
20
33
|
>()
|
|
21
34
|
const [disabledDates, setDisabledDates] = useState<Matcher[]>([])
|
|
22
35
|
const [updateCalendarMonthNavigation, setUpdateCalendarMonthNavigation] =
|
|
23
36
|
useState<boolean>(false)
|
|
24
|
-
const [
|
|
37
|
+
const [updateCalendarDefaultMonth, setUpdateCalendarDefaultMonth] =
|
|
25
38
|
useState<number>(0)
|
|
26
39
|
|
|
40
|
+
const [calendarHasError, setCalendarHasError] = useState<boolean>(false)
|
|
41
|
+
|
|
42
|
+
const [updatedForSubmit, setUpdatedForSubmit] = useState<boolean>(false)
|
|
43
|
+
const [disableCalendarDates, setDisableCalendarDates] =
|
|
44
|
+
useState<DisableCalendarDates>()
|
|
45
|
+
|
|
46
|
+
// Lifecycle
|
|
47
|
+
|
|
48
|
+
// Handle update component with new data
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (outerDisableCalendarDates?.availableDates) {
|
|
51
|
+
setDisableCalendarDates({
|
|
52
|
+
availableDates: [
|
|
53
|
+
...outerDisableCalendarDates.availableDates.sort((a, b) =>
|
|
54
|
+
compareAsc(a.checkIn, b.checkIn)
|
|
55
|
+
),
|
|
56
|
+
],
|
|
57
|
+
disabledDates: outerDisableCalendarDates.disabledDates
|
|
58
|
+
? [
|
|
59
|
+
...outerDisableCalendarDates.disabledDates.sort((a, b) =>
|
|
60
|
+
compareAsc(a.from, b.from)
|
|
61
|
+
),
|
|
62
|
+
]
|
|
63
|
+
: [],
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (disabledDates && !!outerDisableCalendarDates?.disabledDates?.length) {
|
|
68
|
+
setDisabledDates({
|
|
69
|
+
...disabledDates,
|
|
70
|
+
...outerDisableCalendarDates.disabledDates,
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}, [outerDisableCalendarDates])
|
|
74
|
+
|
|
75
|
+
// Handle Range Context initial selections
|
|
27
76
|
useEffect(() => {
|
|
28
77
|
if (typeof window === 'undefined') return
|
|
29
78
|
|
|
@@ -35,11 +84,17 @@ export const useFilterCalendar = ({
|
|
|
35
84
|
if (startDateParam && endDateParam) {
|
|
36
85
|
if (noActiveSelection) {
|
|
37
86
|
handleClearDates()
|
|
38
|
-
|
|
87
|
+
setUpdateCalendarDefaultMonth((prev) => prev + 1)
|
|
88
|
+
setUpdatedForSubmit(false)
|
|
89
|
+
setRangeContext(outerRangeContext)
|
|
39
90
|
setInitialCalendarRange({
|
|
40
91
|
from: new Date(startDateParam),
|
|
41
92
|
to: new Date(endDateParam),
|
|
42
93
|
})
|
|
94
|
+
setCalendarRange({
|
|
95
|
+
from: new Date(startDateParam),
|
|
96
|
+
to: new Date(endDateParam),
|
|
97
|
+
})
|
|
43
98
|
} else {
|
|
44
99
|
setCalendarRange({
|
|
45
100
|
from: new Date(startDateParam),
|
|
@@ -49,6 +104,35 @@ export const useFilterCalendar = ({
|
|
|
49
104
|
}
|
|
50
105
|
}, [toggleCalendar])
|
|
51
106
|
|
|
107
|
+
// Handle submit dates
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const formatString = 'dd.MM.yyyy'
|
|
110
|
+
const initialRangeTo = initialCalendarRange?.to
|
|
111
|
+
? format(initialCalendarRange.to, formatString)
|
|
112
|
+
: null
|
|
113
|
+
const initialRangeFrom = initialCalendarRange?.from
|
|
114
|
+
? format(initialCalendarRange.from, formatString)
|
|
115
|
+
: null
|
|
116
|
+
const calendarRangeTo = calendarRange?.to
|
|
117
|
+
? format(calendarRange.to, formatString)
|
|
118
|
+
: null
|
|
119
|
+
const calendarRangeFrom = calendarRange?.from
|
|
120
|
+
? format(calendarRange.from, formatString)
|
|
121
|
+
: null
|
|
122
|
+
|
|
123
|
+
if (!!(calendarRangeTo && calendarRangeFrom && updatedForSubmit)) {
|
|
124
|
+
if (
|
|
125
|
+
!!(calendarRangeTo !== initialRangeTo) ||
|
|
126
|
+
!!(calendarRangeFrom !== initialRangeFrom)
|
|
127
|
+
) {
|
|
128
|
+
handleSubmit()
|
|
129
|
+
} else {
|
|
130
|
+
setToggleCalendar(false)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, [calendarRange])
|
|
134
|
+
|
|
135
|
+
// Methods
|
|
52
136
|
const handleSubmit = () => {
|
|
53
137
|
setToggleCalendar(false)
|
|
54
138
|
return onSubmit(calendarRange)
|
|
@@ -57,6 +141,8 @@ export const useFilterCalendar = ({
|
|
|
57
141
|
const handleClearDates = () => {
|
|
58
142
|
setDisabledDates([])
|
|
59
143
|
setCalendarRange(undefined)
|
|
144
|
+
setCalendarHasError(false)
|
|
145
|
+
setInitialCalendarRange(undefined)
|
|
60
146
|
}
|
|
61
147
|
|
|
62
148
|
return {
|
|
@@ -68,7 +154,11 @@ export const useFilterCalendar = ({
|
|
|
68
154
|
calendarRange,
|
|
69
155
|
disabledDates,
|
|
70
156
|
updateCalendarMonthNavigation,
|
|
71
|
-
|
|
72
|
-
|
|
157
|
+
updateCalendarDefaultMonth,
|
|
158
|
+
calendarHasError,
|
|
159
|
+
setCalendarHasError,
|
|
160
|
+
setUpdatedForSubmit,
|
|
161
|
+
rangeContext,
|
|
162
|
+
disableCalendarDates,
|
|
73
163
|
}
|
|
74
164
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
.will-filter-bar-submit-button {
|
|
2
2
|
width: auto;
|
|
3
3
|
height: auto;
|
|
4
|
-
background-color: var(--will-primary);
|
|
5
|
-
color: var(--will-white);
|
|
6
4
|
padding: 10px 20px;
|
|
7
5
|
border-radius: 20px;
|
|
8
6
|
cursor: pointer;
|
|
@@ -12,6 +10,22 @@
|
|
|
12
10
|
font-size: 12px;
|
|
13
11
|
display: flex;
|
|
14
12
|
align-items: center;
|
|
13
|
+
user-select: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Submit button variants */
|
|
17
|
+
.will-filter-bar-submit-button.default {
|
|
18
|
+
background-color: var(--will-primary);
|
|
19
|
+
color: var(--will-white);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.will-filter-bar-submit-button.text {
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
color: var(--will-black);
|
|
25
|
+
text-decoration: underline;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
font-size: 15px;
|
|
28
|
+
padding: 0 10px;
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
.will-filter-bar-submit-button span {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { FaSpinner } from 'react-icons/fa'
|
|
1
2
|
import React, { ReactNode } from 'react'
|
|
2
3
|
|
|
3
|
-
import { SpinnerSVG } from '../../../../assets/SpinnerSvg'
|
|
4
|
-
import { Palette } from '../../../../themes/useTheme'
|
|
5
|
-
|
|
6
4
|
import './SubmitButton.css'
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
type SubmitButtonVariant = 'text' | 'full'
|
|
8
7
|
|
|
9
8
|
type Props = {
|
|
10
9
|
onClick?: () => void
|
|
@@ -12,6 +11,7 @@ type Props = {
|
|
|
12
11
|
label?: string
|
|
13
12
|
disabled?: boolean
|
|
14
13
|
isLoading?: boolean
|
|
14
|
+
variant?: SubmitButtonVariant
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const SubmitButton = ({
|
|
@@ -20,10 +20,11 @@ export const SubmitButton = ({
|
|
|
20
20
|
label,
|
|
21
21
|
disabled,
|
|
22
22
|
isLoading,
|
|
23
|
+
variant,
|
|
23
24
|
}: Props) => {
|
|
24
25
|
return (
|
|
25
26
|
<button
|
|
26
|
-
className=
|
|
27
|
+
className={`will-filter-bar-submit-button ${variant || 'default'}`}
|
|
27
28
|
onClick={onClick}
|
|
28
29
|
disabled={disabled || isLoading}
|
|
29
30
|
>
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
/* Calendar overrides */
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
.will-calendar-filter-container .DayPicker {
|
|
11
|
-
font-size: 25px;
|
|
10
|
+
font-size: 25px;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.will-calendar-filter-container .rdp-month {
|
|
@@ -42,9 +41,15 @@
|
|
|
42
41
|
opacity: .6;
|
|
43
42
|
}
|
|
44
43
|
|
|
44
|
+
.will-calendar-filter-container .rdp-table {
|
|
45
|
+
border-collapse: separate;
|
|
46
|
+
border-spacing: 0px 2px;
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
.will-calendar-filter-container .rdp-button_reset.rdp-button.rdp-day.rdp-day_selected {
|
|
46
50
|
background-color: var(--will-primary);
|
|
47
51
|
opacity: 1;
|
|
52
|
+
color: var(--will-white)
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
.will-calendar-filter-container .my-today:not(.rdp-day_selected) {
|
|
@@ -67,7 +72,8 @@
|
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
.will-calendar-filter-container .rdp-cell .rdp-button[disabled] {
|
|
70
|
-
|
|
75
|
+
color: var(--will-transparent-black);
|
|
76
|
+
opacity: 1
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
@media (max-width: 960px) {
|
|
@@ -85,10 +91,12 @@
|
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
|
|
88
|
-
/*
|
|
94
|
+
/* Tooltips */
|
|
89
95
|
.will-root .will-calendar-filter-container .will-calendar-tooltip,
|
|
90
96
|
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out,
|
|
91
|
-
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date
|
|
97
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date,
|
|
98
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only,
|
|
99
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only {
|
|
92
100
|
position: absolute;
|
|
93
101
|
top: -42px;
|
|
94
102
|
transform: translateX(calc(-50% + 20px));
|
|
@@ -96,9 +104,12 @@
|
|
|
96
104
|
white-space: nowrap;
|
|
97
105
|
z-index: 2;
|
|
98
106
|
}
|
|
107
|
+
|
|
99
108
|
.will-root .will-calendar-filter-container .will-calendar-tooltip > div,
|
|
100
109
|
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out > div,
|
|
101
|
-
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date > div
|
|
110
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date > div,
|
|
111
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only > div,
|
|
112
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only > div {
|
|
102
113
|
background-color: white;
|
|
103
114
|
position: relative;
|
|
104
115
|
padding: 5px 10px;
|
|
@@ -108,7 +119,9 @@
|
|
|
108
119
|
|
|
109
120
|
.will-root .will-calendar-filter-container .will-calendar-tooltip::before,
|
|
110
121
|
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out::before,
|
|
111
|
-
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date::before
|
|
122
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date::before,
|
|
123
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only::before,
|
|
124
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only::before {
|
|
112
125
|
content: "";
|
|
113
126
|
width: 10px;
|
|
114
127
|
height: 10px;
|
|
@@ -123,7 +136,9 @@
|
|
|
123
136
|
|
|
124
137
|
.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip,
|
|
125
138
|
.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-out,
|
|
126
|
-
.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-overlapping-date
|
|
139
|
+
.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-overlapping-date,
|
|
140
|
+
.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-out-only,
|
|
141
|
+
.will-root .will-calendar-filter-container .rdp-cell:hover .will-calendar-tooltip-check-in-only {
|
|
127
142
|
display: block;
|
|
128
143
|
}
|
|
129
144
|
|
|
@@ -149,17 +164,43 @@
|
|
|
149
164
|
|
|
150
165
|
/* No active selection */
|
|
151
166
|
|
|
152
|
-
.will-root .will-calendar-filter-container .
|
|
153
|
-
.will-root .will-calendar-filter-container .
|
|
154
|
-
.will-root .will-calendar-filter-container .
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
.will-root .will-calendar-filter-container .no-active-selection-start,
|
|
168
|
+
.will-root .will-calendar-filter-container .no-active-selection-mid,
|
|
169
|
+
.will-root .will-calendar-filter-container .no-active-selection-end {
|
|
170
|
+
position: initial;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.will-root .will-calendar-filter-container .no-active-selection-start::before,
|
|
174
|
+
.will-root .will-calendar-filter-container .no-active-selection-mid::before,
|
|
175
|
+
.will-root .will-calendar-filter-container .no-active-selection-end::before {
|
|
176
|
+
content: "";
|
|
177
|
+
position: absolute;
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 100%;
|
|
180
|
+
border: 2px solid var(--will-light-grey);
|
|
181
|
+
box-sizing: border-box;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.will-root .will-calendar-filter-container .no-active-selection-start::before {
|
|
185
|
+
border-right: none;
|
|
186
|
+
border-top-left-radius: 50%;
|
|
187
|
+
border-bottom-left-radius: 50%;
|
|
157
188
|
}
|
|
158
189
|
|
|
159
|
-
.will-root .will-calendar-filter-container .
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
190
|
+
.will-root .will-calendar-filter-container .no-active-selection-mid::before {
|
|
191
|
+
border-right: none;
|
|
192
|
+
border-left: none;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.will-root .will-calendar-filter-container .no-active-selection-end::before {
|
|
196
|
+
border-left: none;
|
|
197
|
+
border-top-right-radius: 50%;
|
|
198
|
+
border-bottom-right-radius: 50%;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.will-root .will-calendar-filter-container .rdp-day_selected.rdp-day_range_middle.checkout-option {
|
|
202
|
+
background-color: var(--will-primary-lightest);
|
|
203
|
+
color: inherit;
|
|
163
204
|
}
|
|
164
205
|
|
|
165
206
|
/* Overlapping date */
|
|
@@ -167,11 +208,23 @@
|
|
|
167
208
|
.will-root .will-calendar-filter-container .overlapping-date {
|
|
168
209
|
user-select: none;
|
|
169
210
|
pointer-events: none;
|
|
170
|
-
|
|
171
211
|
}
|
|
172
212
|
|
|
173
213
|
.will-root .will-calendar-filter-container .overlapping-date:hover {
|
|
174
214
|
cursor: not-allowed;
|
|
175
215
|
}
|
|
176
216
|
|
|
217
|
+
@media (max-width: 600px) {
|
|
218
|
+
/* Tooltips */
|
|
219
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip,
|
|
220
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out,
|
|
221
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-overlapping-date,
|
|
222
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-out-only,
|
|
223
|
+
.will-root .will-calendar-filter-container .will-calendar-tooltip-check-in-only {
|
|
224
|
+
top: -70px;
|
|
225
|
+
white-space: wrap;
|
|
226
|
+
max-width: 120px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
177
230
|
|