willba-component-library 0.2.80 → 0.2.81
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/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 -3
- package/lib/index.esm.js +893 -266
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +893 -266
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +893 -266
- 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 +1 -1
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +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
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,68 @@
|
|
|
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
|
+
minWidth: '25px',
|
|
58
|
+
minHeight: '25px',
|
|
59
|
+
}}
|
|
60
|
+
viewBox="0 0 1024 1024"
|
|
61
|
+
version="1.1"
|
|
62
|
+
>
|
|
63
|
+
<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" />
|
|
64
|
+
</svg>
|
|
65
|
+
)
|
|
66
|
+
default:
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -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'
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
position: absolute;
|
|
6
6
|
top: 0;
|
|
7
7
|
left: 0;
|
|
8
|
+
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.will-root .will-calendar-wrapper .will-calendar-header,
|
|
@@ -25,10 +26,14 @@
|
|
|
25
26
|
/* Footer */
|
|
26
27
|
|
|
27
28
|
.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 {
|
|
28
35
|
display: flex;
|
|
29
36
|
justify-content: space-between;
|
|
30
|
-
align-items: center;
|
|
31
|
-
border-top: 1px solid var(--will-grey);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates > div {
|
|
@@ -42,19 +47,23 @@
|
|
|
42
47
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates .will-calendar-footer-booked {
|
|
43
48
|
display: flex;
|
|
44
49
|
min-height: 20.5px;
|
|
50
|
+
margin-top: 10px;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
|
-
.will-root .will-calendar-wrapper .will-calendar-footer-
|
|
53
|
+
.will-root .will-calendar-wrapper .will-calendar-footer-error {
|
|
48
54
|
display: flex;
|
|
49
|
-
|
|
50
|
-
gap: 10px;
|
|
55
|
+
max-width: 80%;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
.will-root .will-calendar-wrapper .will-calendar-footer-error span {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
margin-left: 10px;
|
|
61
|
+
}
|
|
54
62
|
|
|
55
63
|
@media (max-width: 960px) {
|
|
56
64
|
.will-root .will-calendar-wrapper {
|
|
57
65
|
width: -webkit-fill-available;
|
|
66
|
+
margin: 0 -6%;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
.will-root .will-calendar-wrapper .will-calendar-header,
|
|
@@ -63,12 +72,11 @@
|
|
|
63
72
|
padding: 20px 10px;
|
|
64
73
|
}
|
|
65
74
|
|
|
66
|
-
.will-root .will-calendar-wrapper .will-calendar-footer {
|
|
75
|
+
.will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {
|
|
67
76
|
flex-direction: column;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
.will-root .will-calendar-wrapper .will-calendar-footer-dates {
|
|
71
|
-
margin-bottom: 12px;
|
|
72
80
|
text-align: center;
|
|
73
81
|
}
|
|
74
82
|
|
|
@@ -83,10 +91,18 @@
|
|
|
83
91
|
|
|
84
92
|
.will-root .will-calendar-wrapper .will-calendar-footer-actions button{
|
|
85
93
|
width: 100%;
|
|
94
|
+
margin-top: 10px;
|
|
86
95
|
}
|
|
87
|
-
}
|
|
88
96
|
|
|
89
|
-
|
|
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
|
+
}
|
|
90
106
|
|
|
91
107
|
.will-root .will-calendar-wrapper .will-calendar-header .will-filter-bar-close-button {
|
|
92
108
|
position: initial;
|