willba-component-library 0.1.43 → 0.1.45
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/index.esm.js +15 -17
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +15 -17
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +15 -17
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/components/calendar/Calendar.tsx +6 -9
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +9 -6
- package/src/components/FilterBar/hooks/useFilterBar.tsx +0 -7
package/package.json
CHANGED
|
@@ -15,6 +15,10 @@ export const Calendar = forwardRef<HTMLDivElement, Props>(
|
|
|
15
15
|
({ calendarRange, setCalendarRange }: Props, ref) => {
|
|
16
16
|
const isTablet = useMediaQuery({ maxWidth: 960 })
|
|
17
17
|
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!calendarRange) setCalendarRange(undefined)
|
|
20
|
+
}, [])
|
|
21
|
+
|
|
18
22
|
const today = startOfDay(new Date())
|
|
19
23
|
|
|
20
24
|
const disabledDays = [
|
|
@@ -23,21 +27,14 @@ export const Calendar = forwardRef<HTMLDivElement, Props>(
|
|
|
23
27
|
to: addDays(today, -50),
|
|
24
28
|
},
|
|
25
29
|
]
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!calendarRange) setCalendarRange(undefined)
|
|
29
|
-
}, [])
|
|
30
|
+
const selectedStartDate = calendarRange?.from
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
33
|
<div className="will-filter-bar-calendar" ref={ref}>
|
|
33
|
-
{/* <div className="will-calendar-filter-header">
|
|
34
|
-
<h3 className="will-calendar-filter-title">{t('calendar.title')}</h3>
|
|
35
|
-
</div> */}
|
|
36
34
|
<div className="will-calendar-filter-container">
|
|
37
35
|
<DayPicker
|
|
38
36
|
id="will-calendar"
|
|
39
37
|
mode="range"
|
|
40
|
-
//showOutsideDays
|
|
41
38
|
numberOfMonths={!isTablet ? 2 : 1}
|
|
42
39
|
weekStartsOn={1}
|
|
43
40
|
selected={calendarRange}
|
|
@@ -49,7 +46,7 @@ export const Calendar = forwardRef<HTMLDivElement, Props>(
|
|
|
49
46
|
disabled: { opacity: '0.2' },
|
|
50
47
|
}}
|
|
51
48
|
captionLayout="dropdown-buttons"
|
|
52
|
-
defaultMonth={today}
|
|
49
|
+
defaultMonth={selectedStartDate || today}
|
|
53
50
|
disabled={disabledDays}
|
|
54
51
|
fromMonth={today}
|
|
55
52
|
/>
|
|
@@ -12,6 +12,12 @@ export default function GuestCount({
|
|
|
12
12
|
count,
|
|
13
13
|
minVal,
|
|
14
14
|
}: GuestsCountPropsType) {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (minVal && minVal > count) {
|
|
17
|
+
updateGuestsCount(`guests-${id}`, minVal)
|
|
18
|
+
}
|
|
19
|
+
}, [])
|
|
20
|
+
|
|
15
21
|
const handleDecrement = () => {
|
|
16
22
|
if (count > minVal) {
|
|
17
23
|
updateGuestsCount(`guests-${id}`, count - 1)
|
|
@@ -30,15 +36,12 @@ export default function GuestCount({
|
|
|
30
36
|
<button
|
|
31
37
|
className="will-guests-filter-counter-button"
|
|
32
38
|
onClick={handleDecrement}
|
|
33
|
-
disabled={minVal && count <= minVal ? true : false}
|
|
39
|
+
disabled={(minVal && count <= minVal) || !count ? true : false}
|
|
34
40
|
style={{
|
|
35
41
|
cursor:
|
|
36
|
-
minVal && count <= minVal
|
|
37
|
-
? 'initial'
|
|
38
|
-
: !minVal && count < 1
|
|
39
|
-
? 'initial'
|
|
40
|
-
: 'pointer',
|
|
42
|
+
(minVal && count <= minVal) || !count ? 'initial' : 'pointer',
|
|
41
43
|
paddingBottom: '4px',
|
|
44
|
+
opacity: (minVal && count <= minVal) || !count ? 0.4 : 1,
|
|
42
45
|
}}
|
|
43
46
|
>
|
|
44
47
|
-
|
|
@@ -172,13 +172,6 @@ const handleAgeCategoryRules = ({
|
|
|
172
172
|
ageCategories?.map((a) => {
|
|
173
173
|
if (a.minVal) {
|
|
174
174
|
// Age categories rules
|
|
175
|
-
const totalAgeCategories = Object.entries(ageCategoryCounts).reduce(
|
|
176
|
-
(acc, c) => {
|
|
177
|
-
return acc + c[1]
|
|
178
|
-
},
|
|
179
|
-
0
|
|
180
|
-
)
|
|
181
|
-
|
|
182
175
|
const ageCategory = ageCategoryCounts[`guests-${a.id}`]
|
|
183
176
|
|
|
184
177
|
if (!ageCategory) {
|