willba-component-library 0.2.78 → 0.2.80
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/assets/SpinnerSvg.d.ts +5 -0
- package/lib/components/Button/Button.d.ts +29 -0
- package/lib/components/Button/Button.stories.d.ts +7 -0
- package/lib/components/Button/index.d.ts +1 -0
- package/lib/components/FilterBar/FilterBar.d.ts +5 -0
- package/lib/components/FilterBar/FilterBar.stories.d.ts +6 -0
- package/lib/components/FilterBar/FilterBarTypes.d.ts +56 -0
- package/lib/components/FilterBar/components/buttons/close-button/CloseButton.d.ts +7 -0
- package/lib/components/FilterBar/components/buttons/index.d.ts +4 -0
- package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +10 -0
- package/lib/components/FilterBar/components/buttons/submit-button/SubmitButton.d.ts +3 -0
- package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +10 -0
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +14 -0
- package/lib/components/FilterBar/components/categories/Categories.d.ts +8 -0
- package/lib/components/FilterBar/components/divider/Divider.d.ts +3 -0
- package/lib/components/FilterBar/components/guests/GuestCount/GuestCount.d.ts +4 -0
- package/lib/components/FilterBar/components/guests/Guests.d.ts +10 -0
- package/lib/components/FilterBar/components/index.d.ts +4 -0
- package/lib/components/FilterBar/hooks/index.d.ts +2 -0
- package/lib/components/FilterBar/hooks/useCloseFilterSection.d.ts +8 -0
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +27 -0
- package/lib/components/FilterBar/hooks/useScrollInToView.d.ts +9 -0
- package/lib/components/FilterBar/hooks/useUpdateTranslations.d.ts +5 -0
- package/lib/components/FilterBar/index.d.ts +2 -0
- package/lib/components/FilterBar/utils/index.d.ts +1 -0
- package/lib/components/FilterBar/utils/parseDates.d.ts +6 -0
- package/lib/components/FilterBar/utils/parseGuests.d.ts +17 -0
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +5 -0
- package/lib/components/FilterCalendar/FilterCalendar.stories.d.ts +6 -0
- package/lib/components/FilterCalendar/FilterCalendarTypes.d.ts +9 -0
- package/lib/components/FilterCalendar/components/Footer.d.ts +10 -0
- package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +21 -0
- package/lib/components/FilterCalendar/index.d.ts +2 -0
- package/lib/core/components/buttons/close-button/CloseButton.d.ts +7 -0
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +11 -0
- package/lib/core/components/calendar/Calendar.d.ts +5 -0
- package/lib/core/components/calendar/CalendarTypes.d.ts +39 -0
- package/{src/core/components/calendar/hooks/index.ts → lib/core/components/calendar/hooks/index.d.ts} +3 -3
- package/lib/core/components/calendar/hooks/useCalendarLoadingSpinner.d.ts +5 -0
- package/lib/core/components/calendar/hooks/useCalendarTooltips.d.ts +5 -0
- package/lib/core/components/calendar/hooks/useUpdateDisabledDates.d.ts +14 -0
- package/lib/core/components/calendar/utils/calendarSelectionRules.d.ts +15 -0
- package/lib/core/components/calendar/utils/checkForContinuousSelection.d.ts +11 -0
- package/lib/core/components/calendar/utils/disabledDatesByPage.d.ts +9 -0
- package/lib/core/components/calendar/utils/handleCalendarModifiers.d.ts +47 -0
- package/lib/core/components/calendar/utils/handleRangeContextDisabledDates.d.ts +27 -0
- package/{src/core/components/calendar/utils/index.ts → lib/core/components/calendar/utils/index.d.ts} +8 -8
- 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/core/components/index.d.ts +3 -0
- package/lib/core/hooks/index.d.ts +3 -0
- package/lib/core/hooks/useAwaitRender.d.ts +1 -0
- package/lib/core/hooks/useCloseFilterSection.d.ts +8 -0
- package/lib/core/hooks/useUpdateTranslations.d.ts +5 -0
- package/lib/core/utils/handleOverlappingDates.d.ts +1 -0
- package/lib/core/utils/index.d.ts +3 -0
- package/lib/core/utils/nightsCount.d.ts +6 -0
- package/lib/core/utils/parseDate.d.ts +7 -0
- package/lib/core/utils/parseDates.d.ts +6 -0
- package/lib/i18n.d.ts +2 -0
- package/lib/index.d.ts +119 -0
- package/lib/index.esm.js +11576 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +11598 -0
- package/lib/index.js.map +1 -0
- package/lib/index.umd.js +11602 -0
- package/lib/index.umd.js.map +1 -0
- package/lib/themes/useTheme.d.ts +13 -0
- package/package.json +1 -1
- package/src/assets/SpinnerSvg.tsx +40 -0
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -2
- package/src/components/FilterBar/FilterBar.tsx +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 +10 -26
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +153 -522
- package/src/components/FilterCalendar/FilterCalendar.tsx +54 -25
- package/src/components/FilterCalendar/FilterCalendarTypes.ts +1 -0
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +4 -94
- package/src/core/components/buttons/submit-button/SubmitButton.css +2 -16
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +5 -6
- package/src/core/components/calendar/Calendar.css +18 -71
- package/src/core/components/calendar/Calendar.tsx +342 -132
- package/src/core/components/calendar/CalendarTypes.ts +3 -10
- package/src/core/utils/index.ts +3 -0
- package/src/locales/en/common.json +1 -7
- package/src/locales/en/filterBar.json +1 -2
- package/src/locales/fi/common.json +1 -7
- package/src/locales/fi/filterBar.json +1 -2
- package/src/themes/Default.css +3 -12
- package/src/themes/useTheme.tsx +0 -3
- package/src/assets/IconsSvg.tsx +0 -68
- package/src/components/FilterCalendar/components/Footer.tsx +0 -96
- package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +0 -19
- package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +0 -125
- package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +0 -107
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +0 -228
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +0 -86
- package/src/core/components/calendar/utils/disabledDatesByPage.tsx +0 -36
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +0 -147
- package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +0 -75
- package/willba-component-library-0.2.77.tgz +0 -0
- /package/src/core/{components/calendar/utils → utils}/nightsCount.tsx +0 -0
- /package/src/core/{components/calendar/utils → utils}/parseDate.tsx +0 -0
- /package/src/core/{components/calendar/utils → utils}/parseDates.tsx +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export type Palette = {
|
|
3
|
+
primary: string;
|
|
4
|
+
secondary: string;
|
|
5
|
+
};
|
|
6
|
+
export type ThemeProps = {
|
|
7
|
+
palette?: Palette;
|
|
8
|
+
};
|
|
9
|
+
export interface CustomPaletteTypes extends CSSProperties {
|
|
10
|
+
'--will-primary'?: string;
|
|
11
|
+
'--will-secondary'?: string;
|
|
12
|
+
}
|
|
13
|
+
export default function useTheme({ palette }: ThemeProps): CustomPaletteTypes;
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export const SpinnerSVG = ({
|
|
4
|
+
fill,
|
|
5
|
+
size,
|
|
6
|
+
}: {
|
|
7
|
+
fill?: string
|
|
8
|
+
size?: number
|
|
9
|
+
}) => (
|
|
10
|
+
<svg
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
width={`${size || 25}`}
|
|
13
|
+
height={`${size || 25}`}
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
>
|
|
16
|
+
<style>
|
|
17
|
+
{`
|
|
18
|
+
.spinner_z9k8 {
|
|
19
|
+
transform-origin: center;
|
|
20
|
+
animation: spinner_StKS .75s infinite linear;
|
|
21
|
+
}
|
|
22
|
+
@keyframes spinner_StKS {
|
|
23
|
+
100% {
|
|
24
|
+
transform: rotate(360deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`}
|
|
28
|
+
</style>
|
|
29
|
+
<path
|
|
30
|
+
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"
|
|
31
|
+
opacity=".25"
|
|
32
|
+
fill={fill}
|
|
33
|
+
/>
|
|
34
|
+
<path
|
|
35
|
+
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"
|
|
36
|
+
className="spinner_z9k8"
|
|
37
|
+
fill={fill}
|
|
38
|
+
/>
|
|
39
|
+
</svg>
|
|
40
|
+
)
|
|
@@ -13,7 +13,7 @@ export default meta
|
|
|
13
13
|
|
|
14
14
|
type Story = StoryObj<typeof FilterBar>
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const Primary: Story = {
|
|
17
17
|
args: {
|
|
18
18
|
disableCalendarDates: {
|
|
19
19
|
disabledDatesByPage: [
|
|
@@ -53,7 +53,6 @@ export const Main: Story = {
|
|
|
53
53
|
palette: {
|
|
54
54
|
primary: '',
|
|
55
55
|
secondary: '',
|
|
56
|
-
error: '#d32f2f',
|
|
57
56
|
},
|
|
58
57
|
mode: 'dark',
|
|
59
58
|
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/
|
|
13
|
+
import { parseDates } from '../../core/utils'
|
|
14
14
|
|
|
15
15
|
import { parseGuests } from './utils'
|
|
16
16
|
import { FilterBarProps, FilterSections, Pages } from './FilterBarTypes'
|
|
@@ -124,7 +124,7 @@ export const useFilterBar = ({
|
|
|
124
124
|
|
|
125
125
|
handleSelectedFilter(false)
|
|
126
126
|
|
|
127
|
-
if (onSubmit && selectedPath
|
|
127
|
+
if (onSubmit && window.location.href.includes(selectedPath)) {
|
|
128
128
|
onSubmit(newParams)
|
|
129
129
|
} else {
|
|
130
130
|
setInnerLoading(true),
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
position: absolute;
|
|
6
6
|
top: 0;
|
|
7
7
|
left: 0;
|
|
8
|
-
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.will-root .will-calendar-wrapper .will-calendar-header,
|
|
@@ -26,14 +25,10 @@
|
|
|
26
25
|
/* Footer */
|
|
27
26
|
|
|
28
27
|
.will-root .will-calendar-wrapper .will-calendar-footer {
|
|
29
|
-
border-top: 1px solid var(--will-grey);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/* Footer actions */
|
|
33
|
-
|
|
34
|
-
.will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {
|
|
35
28
|
display: flex;
|
|
36
29
|
justify-content: space-between;
|
|
30
|
+
align-items: center;
|
|
31
|
+
border-top: 1px solid var(--will-grey);
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates > div {
|
|
@@ -47,23 +42,19 @@
|
|
|
47
42
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates .will-calendar-footer-booked {
|
|
48
43
|
display: flex;
|
|
49
44
|
min-height: 20.5px;
|
|
50
|
-
margin-top: 10px;
|
|
51
45
|
}
|
|
52
46
|
|
|
53
|
-
.will-root .will-calendar-wrapper .will-calendar-footer-
|
|
47
|
+
.will-root .will-calendar-wrapper .will-calendar-footer-actions {
|
|
54
48
|
display: flex;
|
|
55
|
-
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 10px;
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
display: inline-block;
|
|
60
|
-
margin-left: 10px;
|
|
61
|
-
}
|
|
53
|
+
|
|
62
54
|
|
|
63
55
|
@media (max-width: 960px) {
|
|
64
56
|
.will-root .will-calendar-wrapper {
|
|
65
57
|
width: -webkit-fill-available;
|
|
66
|
-
margin: 0 -6%;
|
|
67
58
|
}
|
|
68
59
|
|
|
69
60
|
.will-root .will-calendar-wrapper .will-calendar-header,
|
|
@@ -72,11 +63,12 @@
|
|
|
72
63
|
padding: 20px 10px;
|
|
73
64
|
}
|
|
74
65
|
|
|
75
|
-
.will-root .will-calendar-wrapper .will-calendar-footer
|
|
66
|
+
.will-root .will-calendar-wrapper .will-calendar-footer {
|
|
76
67
|
flex-direction: column;
|
|
77
68
|
}
|
|
78
69
|
|
|
79
70
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates {
|
|
71
|
+
margin-bottom: 12px;
|
|
80
72
|
text-align: center;
|
|
81
73
|
}
|
|
82
74
|
|
|
@@ -91,19 +83,11 @@
|
|
|
91
83
|
|
|
92
84
|
.will-root .will-calendar-wrapper .will-calendar-footer-actions button{
|
|
93
85
|
width: 100%;
|
|
94
|
-
margin-top: 10px;
|
|
95
86
|
}
|
|
96
|
-
|
|
97
|
-
.will-root .will-calendar-wrapper .will-calendar-footer-error {
|
|
98
|
-
max-width: 100%;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.will-root .will-calendar-wrapper .will-calendar-footer-error span {
|
|
102
|
-
text-align: center;
|
|
103
|
-
margin-left: 5px;
|
|
104
|
-
}
|
|
105
87
|
}
|
|
106
88
|
|
|
89
|
+
/**/
|
|
90
|
+
|
|
107
91
|
.will-root .will-calendar-wrapper .will-calendar-header .will-filter-bar-close-button {
|
|
108
92
|
position: initial;
|
|
109
93
|
}
|