willba-component-library 0.1.72 → 0.1.73
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.d.ts +4 -3
- package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +2 -1
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +1 -1
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +2 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.esm.js +20 -14
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -14
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +20 -14
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +15 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +4 -2
- package/src/components/FilterBar/FilterBar.tsx +10 -4
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +15 -5
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.tsx +5 -2
- package/src/components/FilterBar/components/calendar/Calendar.tsx +6 -4
- package/src/components/FilterBar/hooks/useFilterBar.tsx +11 -6
- package/src/themes/Default.css +3 -1
package/package.json
CHANGED
|
@@ -38,9 +38,11 @@
|
|
|
38
38
|
z-index: 222;
|
|
39
39
|
border-radius: 40px;
|
|
40
40
|
background-color: var(--will-white);
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
|
|
45
|
+
|
|
44
46
|
@media (max-width: 960px) {
|
|
45
47
|
.will-filter-bar-header {
|
|
46
48
|
flex-direction: column;
|
|
@@ -78,3 +80,15 @@
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
/* Common */
|
|
84
|
+
|
|
85
|
+
.will-filter-bar-header.dark,
|
|
86
|
+
.will-filter-bar-container.dark {
|
|
87
|
+
box-shadow: var(--will-box-shadow-dark)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.will-filter-bar-header.light,
|
|
91
|
+
.will-filter-bar-container.light {
|
|
92
|
+
box-shadow: var(--will-box-shadow-light)
|
|
93
|
+
}
|
|
94
|
+
|
|
@@ -43,13 +43,15 @@ export const Primary: Story = {
|
|
|
43
43
|
},
|
|
44
44
|
],
|
|
45
45
|
palette: {
|
|
46
|
-
primary: '
|
|
46
|
+
primary: '',
|
|
47
47
|
secondary: '',
|
|
48
48
|
},
|
|
49
49
|
currentViewApply: 'roomFilters',
|
|
50
|
+
mode: 'dark',
|
|
51
|
+
defaultTab: '/rooms',
|
|
50
52
|
},
|
|
51
53
|
render: (args) => (
|
|
52
|
-
<div style={{ background: '
|
|
54
|
+
<div style={{ background: 'white', padding: '30px', height: '100vh' }}>
|
|
53
55
|
<FilterBar {...args} onSubmit={false ? null : (val: Filters) => null} />
|
|
54
56
|
</div>
|
|
55
57
|
),
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
import './FilterBar.css'
|
|
34
34
|
|
|
35
35
|
export type FilterBarProps = {
|
|
36
|
-
vendor?: string
|
|
37
36
|
language?: string
|
|
38
37
|
ageCategories?: AgeCategoryType[]
|
|
39
38
|
redirectUrl?: string
|
|
@@ -41,7 +40,9 @@ export type FilterBarProps = {
|
|
|
41
40
|
currentViewApply?: string
|
|
42
41
|
onSubmit?: ((val: Filters) => void) | null
|
|
43
42
|
fullWidth?: boolean
|
|
44
|
-
calendarOffset
|
|
43
|
+
calendarOffset?: CalendarOffset
|
|
44
|
+
mode?: string
|
|
45
|
+
defaultTab?: string
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export default function FilterBar({
|
|
@@ -53,6 +54,8 @@ export default function FilterBar({
|
|
|
53
54
|
onSubmit,
|
|
54
55
|
fullWidth,
|
|
55
56
|
calendarOffset,
|
|
57
|
+
mode,
|
|
58
|
+
defaultTab,
|
|
56
59
|
}: FilterBarProps) {
|
|
57
60
|
const themePalette = useTheme({ palette })
|
|
58
61
|
|
|
@@ -79,6 +82,7 @@ export default function FilterBar({
|
|
|
79
82
|
currentViewApply,
|
|
80
83
|
ageCategories,
|
|
81
84
|
onSubmit,
|
|
85
|
+
defaultTab,
|
|
82
86
|
})
|
|
83
87
|
|
|
84
88
|
// Default selected tab when tabs are hidden
|
|
@@ -131,6 +135,7 @@ export default function FilterBar({
|
|
|
131
135
|
setSelectedPath(Pages.EVENTS), handleResetFilters()
|
|
132
136
|
}}
|
|
133
137
|
active={selectedPath === Pages.EVENTS}
|
|
138
|
+
mode={mode}
|
|
134
139
|
/>
|
|
135
140
|
<TabButton
|
|
136
141
|
label={t('tabs.rooms')}
|
|
@@ -138,12 +143,13 @@ export default function FilterBar({
|
|
|
138
143
|
setSelectedPath(Pages.ROOMS), handleResetFilters()
|
|
139
144
|
}}
|
|
140
145
|
active={selectedPath === Pages.ROOMS}
|
|
146
|
+
mode={mode}
|
|
141
147
|
/>
|
|
142
148
|
</div>
|
|
143
149
|
)}
|
|
144
150
|
|
|
145
151
|
<div
|
|
146
|
-
className=
|
|
152
|
+
className={`will-filter-bar-header ${mode || 'dark'}`}
|
|
147
153
|
ref={currentViewApply ? targetFilterBarRef : null}
|
|
148
154
|
>
|
|
149
155
|
<SelectButton
|
|
@@ -177,7 +183,7 @@ export default function FilterBar({
|
|
|
177
183
|
|
|
178
184
|
{selectedFilter && (
|
|
179
185
|
<div
|
|
180
|
-
className=
|
|
186
|
+
className={`will-filter-bar-container ${mode || 'dark'}`}
|
|
181
187
|
style={currentViewApply && !isMobile ? { top: 66 } : {}}
|
|
182
188
|
>
|
|
183
189
|
<CloseButton handleClose={() => handleSelectedFilter(false)} />
|
|
@@ -12,15 +12,25 @@
|
|
|
12
12
|
user-select: none;
|
|
13
13
|
font-weight: 600;
|
|
14
14
|
border-radius: 50px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.will-filter-bar-tab-button.light {
|
|
15
18
|
color: var(--will-white)
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
.will-filter-bar-tab-button.dark {
|
|
22
|
+
color: var(--will-black)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.will-filter-bar-tab-button.light.active,
|
|
19
26
|
.will-filter-bar-tab-button:hover {
|
|
20
27
|
background-color: var(--will-transparent-white);
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
.will-filter-bar-tab-button.active
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
30
|
+
.will-filter-bar-tab-button.dark.active,
|
|
31
|
+
.will-filter-bar-tab-button:hover {
|
|
32
|
+
background-color: var(--will-transparent-black);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
@@ -6,12 +6,15 @@ type Props = {
|
|
|
6
6
|
onClick?: () => void
|
|
7
7
|
label: string
|
|
8
8
|
active?: boolean
|
|
9
|
+
mode?: string
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export const TabButton = ({ onClick, label, active }: Props) => {
|
|
12
|
+
export const TabButton = ({ onClick, label, active, mode }: Props) => {
|
|
12
13
|
return (
|
|
13
14
|
<button
|
|
14
|
-
className={`will-filter-bar-tab-button ${
|
|
15
|
+
className={`will-filter-bar-tab-button ${mode || 'dark'} ${
|
|
16
|
+
active && 'active'
|
|
17
|
+
} `}
|
|
15
18
|
onClick={onClick}
|
|
16
19
|
>
|
|
17
20
|
{label}
|
|
@@ -12,7 +12,7 @@ import './Calendar.css'
|
|
|
12
12
|
type Props = {
|
|
13
13
|
calendarRange: DateRange | undefined
|
|
14
14
|
setCalendarRange: (range: DateRange | undefined) => void
|
|
15
|
-
calendarOffset
|
|
15
|
+
calendarOffset?: CalendarOffset
|
|
16
16
|
selectedPath: string
|
|
17
17
|
locale?: string
|
|
18
18
|
}
|
|
@@ -36,9 +36,11 @@ export const Calendar = forwardRef<HTMLDivElement, Props>(
|
|
|
36
36
|
|
|
37
37
|
const today = startOfDay(new Date())
|
|
38
38
|
|
|
39
|
-
const daysToOffsetCalendar =
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const daysToOffsetCalendar = calendarOffset
|
|
40
|
+
? Object.entries(calendarOffset)?.find(
|
|
41
|
+
(page) => selectedPath.substring(1) === page[0]
|
|
42
|
+
)
|
|
43
|
+
: null
|
|
42
44
|
|
|
43
45
|
const disabledDays = [
|
|
44
46
|
{
|
|
@@ -14,6 +14,7 @@ type Props = {
|
|
|
14
14
|
currentViewApply?: string
|
|
15
15
|
ageCategories?: AgeCategoryType[]
|
|
16
16
|
onSubmit?: ((val: Filters) => void) | null
|
|
17
|
+
defaultTab?: string
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export const useFilterBar = ({
|
|
@@ -21,6 +22,7 @@ export const useFilterBar = ({
|
|
|
21
22
|
currentViewApply,
|
|
22
23
|
ageCategories,
|
|
23
24
|
onSubmit,
|
|
25
|
+
defaultTab,
|
|
24
26
|
}: Props) => {
|
|
25
27
|
const [selectedPath, setSelectedPath] = useState(Pages.EVENTS)
|
|
26
28
|
const [selectedFilter, setSelectedFilter] = useState<string | boolean>(false)
|
|
@@ -69,12 +71,15 @@ export const useFilterBar = ({
|
|
|
69
71
|
useEffect(() => {
|
|
70
72
|
// Handle default selected tab
|
|
71
73
|
if (typeof window === 'undefined') return
|
|
72
|
-
|
|
73
|
-
const currentPath =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
console.log(defaultTab)
|
|
75
|
+
const currentPath =
|
|
76
|
+
defaultTab === Pages.EVENTS ||
|
|
77
|
+
window.location.pathname.includes(Pages.EVENTS)
|
|
78
|
+
? Pages.EVENTS
|
|
79
|
+
: defaultTab === Pages.ROOMS ||
|
|
80
|
+
window.location.pathname.includes(Pages.ROOMS)
|
|
81
|
+
? Pages.ROOMS
|
|
82
|
+
: Pages.EVENTS
|
|
78
83
|
|
|
79
84
|
setSelectedPath(currentPath)
|
|
80
85
|
}, [])
|
package/src/themes/Default.css
CHANGED
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
--will-onahau: #CDEEFF;
|
|
21
21
|
--will-text: #5A5959;
|
|
22
22
|
--will-transparent-white: rgba(255, 255, 255, 0.30);
|
|
23
|
+
--will-transparent-black: rgba(171, 167, 175, 0.30);
|
|
23
24
|
|
|
24
25
|
/* Confines */
|
|
25
|
-
--will-box-shadow: 0px
|
|
26
|
+
--will-box-shadow-dark: 0px 2px 12px 2px #a1a1a180;
|
|
27
|
+
--will-box-shadow-light: 0px 2px 12px 2px #bcb9b980;
|
|
26
28
|
|
|
27
29
|
/* Breakpoints */
|
|
28
30
|
|