willba-component-library 0.3.26 → 0.4.0
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/README.md +75 -113
- package/lib/components/FilterBar/FilterBar.d.ts +1 -1
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
- package/lib/core/i18n/I18nProvider.d.ts +6 -0
- package/lib/core/i18n/index.d.ts +1 -0
- package/lib/embed.d.ts +18 -0
- package/lib/embed.esm.js +74 -0
- package/lib/embed.esm.js.map +1 -0
- package/lib/embed.umd.js +74 -0
- package/lib/embed.umd.js.map +1 -0
- package/lib/i18n.d.ts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.esm.js +1112 -931
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1111 -930
- package/lib/index.js.map +1 -1
- package/package.json +9 -1
- package/.nvmrc +0 -1
- package/.storybook/main.ts +0 -17
- package/.storybook/preview.ts +0 -15
- package/lib/components/FilterBar/components/buttons/index.d.ts +0 -4
- package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +0 -13
- package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +0 -10
- package/lib/components/FilterBar/components/cards/image-card/ImageCard.d.ts +0 -11
- package/lib/components/FilterBar/components/cards/index.d.ts +0 -1
- package/lib/components/FilterBar/components/categories/Categories.d.ts +0 -8
- package/lib/components/FilterBar/components/common/FilterSectionHeader.d.ts +0 -8
- package/lib/components/FilterBar/components/dates/Dates.d.ts +0 -17
- package/lib/components/FilterBar/components/dates/index.d.ts +0 -1
- package/lib/components/FilterBar/components/guests/GuestCount/GuestCount.d.ts +0 -4
- package/lib/components/FilterBar/components/guests/Guests.d.ts +0 -12
- package/lib/components/FilterBar/components/locations/Locations.d.ts +0 -14
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +0 -32
- package/lib/components/FilterBar/hooks/useFilterUi.d.ts +0 -8
- package/lib/components/FilterBar/utils/calculateDropdownPosition.d.ts +0 -12
- package/lib/components/FilterBar/utils/getLocalizedContent.d.ts +0 -8
- package/lib/core/components/buttons/close-button/CloseButton.d.ts +0 -7
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +0 -14
- package/lib/index.umd.js +0 -12489
- package/lib/index.umd.js.map +0 -1
- package/prettier.config.js +0 -6
- package/rollup.config.mjs +0 -63
- package/src/assets/IconsSvg.tsx +0 -69
- package/src/components/Button/Button.stories.tsx +0 -34
- package/src/components/Button/Button.tsx +0 -56
- package/src/components/Button/button.css +0 -30
- package/src/components/Button/index.ts +0 -1
- package/src/components/FilterBar/FilterBar.css +0 -35
- package/src/components/FilterBar/FilterBar.stories.tsx +0 -116
- package/src/components/FilterBar/FilterBar.tsx +0 -64
- package/src/components/FilterBar/FilterBarTypes.ts +0 -71
- package/src/components/FilterBar/components/Divider/Divider.css +0 -14
- package/src/components/FilterBar/components/Divider/Divider.tsx +0 -7
- package/src/components/FilterBar/components/FilterControls/FilterControls.css +0 -22
- package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +0 -139
- package/src/components/FilterBar/components/FilterPanels/Categories/Categories.css +0 -21
- package/src/components/FilterBar/components/FilterPanels/Categories/Categories.tsx +0 -49
- package/src/components/FilterBar/components/FilterPanels/Dates/Dates.css +0 -9
- package/src/components/FilterBar/components/FilterPanels/Dates/Dates.tsx +0 -60
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +0 -22
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +0 -111
- package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.css +0 -58
- package/src/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.tsx +0 -85
- package/src/components/FilterBar/components/FilterPanels/Guests/Guests.css +0 -24
- package/src/components/FilterBar/components/FilterPanels/Guests/Guests.tsx +0 -59
- package/src/components/FilterBar/components/FilterPanels/Locations/Locations.css +0 -16
- package/src/components/FilterBar/components/FilterPanels/Locations/Locations.tsx +0 -94
- package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.css +0 -34
- package/src/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.tsx +0 -17
- package/src/components/FilterBar/components/FilterTabs/FilterTabs.css +0 -10
- package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +0 -50
- package/src/components/FilterBar/components/ImageCard/ImageCard.css +0 -30
- package/src/components/FilterBar/components/ImageCard/ImageCard.tsx +0 -45
- package/src/components/FilterBar/components/SelectButton/SelectButton.css +0 -76
- package/src/components/FilterBar/components/SelectButton/SelectButton.tsx +0 -54
- package/src/components/FilterBar/components/TabButton/TabButton.css +0 -36
- package/src/components/FilterBar/components/TabButton/TabButton.tsx +0 -23
- package/src/components/FilterBar/components/index.ts +0 -6
- package/src/components/FilterBar/hooks/index.ts +0 -5
- package/src/components/FilterBar/hooks/useFilterActions.tsx +0 -126
- package/src/components/FilterBar/hooks/useFilterRefs.tsx +0 -21
- package/src/components/FilterBar/hooks/useFilterState.tsx +0 -86
- package/src/components/FilterBar/hooks/usePanelPosition.tsx +0 -52
- package/src/components/FilterBar/hooks/useScrollInToView.tsx +0 -29
- package/src/components/FilterBar/index.ts +0 -3
- package/src/components/FilterBar/providers/FilterBarProvider.tsx +0 -172
- package/src/components/FilterBar/providers/index.ts +0 -1
- package/src/components/FilterBar/utils/ageCategoriesRules.ts +0 -27
- package/src/components/FilterBar/utils/index.tsx +0 -3
- package/src/components/FilterBar/utils/parseGuests.tsx +0 -65
- package/src/components/FilterBar/utils/parseLocations.ts +0 -28
- package/src/components/FilterCalendar/FilterCalendar.css +0 -109
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +0 -554
- package/src/components/FilterCalendar/FilterCalendar.tsx +0 -115
- package/src/components/FilterCalendar/FilterCalendarTypes.ts +0 -11
- package/src/components/FilterCalendar/components/Footer.tsx +0 -96
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +0 -163
- package/src/components/FilterCalendar/index.ts +0 -3
- package/src/core/components/buttons/CloseButton/CloseButton.css +0 -33
- package/src/core/components/buttons/CloseButton/CloseButton.tsx +0 -16
- package/src/core/components/buttons/SubmitButton/SubmitButton.css +0 -54
- package/src/core/components/buttons/SubmitButton/SubmitButton.tsx +0 -42
- package/src/core/components/calendar/Calendar.css +0 -280
- package/src/core/components/calendar/Calendar.tsx +0 -253
- package/src/core/components/calendar/CalendarTypes.ts +0 -48
- package/src/core/components/calendar/hooks/index.ts +0 -3
- 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 -105
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +0 -180
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +0 -86
- package/src/core/components/calendar/utils/disabledDatesByPage.tsx +0 -31
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +0 -118
- package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +0 -75
- package/src/core/components/calendar/utils/index.ts +0 -8
- package/src/core/components/calendar/utils/nightsCount.tsx +0 -19
- package/src/core/components/calendar/utils/parseDate.tsx +0 -17
- package/src/core/components/calendar/utils/parseDates.tsx +0 -12
- package/src/core/components/index.ts +0 -7
- package/src/core/hooks/index.ts +0 -4
- package/src/core/hooks/useAutoFocus.tsx +0 -27
- package/src/core/hooks/useAwaitRender.tsx +0 -12
- package/src/core/hooks/useCloseFilterSection.tsx +0 -29
- package/src/core/hooks/useUpdateTranslations.tsx +0 -14
- package/src/i18n.ts +0 -27
- package/src/index.ts +0 -8
- package/src/locales/en/common.json +0 -18
- package/src/locales/en/filterBar.json +0 -33
- package/src/locales/fi/common.json +0 -19
- package/src/locales/fi/filterBar.json +0 -33
- package/src/themes/Default.css +0 -69
- package/src/themes/useTheme.tsx +0 -27
- package/stories/Button.stories.ts +0 -50
- package/stories/Button.tsx +0 -53
- package/stories/Configure.mdx +0 -364
- package/stories/Header.stories.ts +0 -27
- package/stories/Header.tsx +0 -70
- package/stories/Page.stories.ts +0 -29
- package/stories/Page.tsx +0 -91
- package/stories/assets/accessibility.png +0 -0
- package/stories/assets/accessibility.svg +0 -5
- package/stories/assets/addon-library.png +0 -0
- package/stories/assets/assets.png +0 -0
- package/stories/assets/context.png +0 -0
- package/stories/assets/discord.svg +0 -15
- package/stories/assets/docs.png +0 -0
- package/stories/assets/figma-plugin.png +0 -0
- package/stories/assets/github.svg +0 -3
- package/stories/assets/share.png +0 -0
- package/stories/assets/styling.png +0 -0
- package/stories/assets/testing.png +0 -0
- package/stories/assets/theming.png +0 -0
- package/stories/assets/tutorials.svg +0 -12
- package/stories/assets/youtube.svg +0 -4
- package/stories/button.css +0 -30
- package/stories/header.css +0 -32
- package/stories/page.css +0 -69
- package/tsconfig.json +0 -29
- /package/lib/components/FilterBar/components/{divider → Divider}/Divider.d.ts +0 -0
package/prettier.config.js
DELETED
package/rollup.config.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
|
|
2
|
-
import resolve from '@rollup/plugin-node-resolve'
|
|
3
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
4
|
-
import typescript from '@rollup/plugin-typescript'
|
|
5
|
-
import postcss from 'rollup-plugin-postcss'
|
|
6
|
-
import dts from 'rollup-plugin-dts'
|
|
7
|
-
import json from '@rollup/plugin-json'
|
|
8
|
-
|
|
9
|
-
// This is required to read package.json file when
|
|
10
|
-
// using Native ES modules in Node.js
|
|
11
|
-
// https://rollupjs.org/command-line-interface/#importing-package-json
|
|
12
|
-
import { createRequire } from 'node:module'
|
|
13
|
-
const requireFile = createRequire(import.meta.url)
|
|
14
|
-
const packageJson = requireFile('./package.json')
|
|
15
|
-
|
|
16
|
-
const globals = {
|
|
17
|
-
react: 'React',
|
|
18
|
-
'react-dom': 'ReactDOM',
|
|
19
|
-
'react-query': 'ReactQuery',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default [
|
|
23
|
-
{
|
|
24
|
-
input: 'src/index.ts',
|
|
25
|
-
output: [
|
|
26
|
-
{
|
|
27
|
-
file: packageJson.main,
|
|
28
|
-
format: 'cjs',
|
|
29
|
-
sourcemap: true,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
file: packageJson.module,
|
|
33
|
-
format: 'esm',
|
|
34
|
-
sourcemap: true,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'WillbaComponentLibrary',
|
|
38
|
-
file: `lib/index.umd.js`,
|
|
39
|
-
format: 'umd',
|
|
40
|
-
sourcemap: true,
|
|
41
|
-
globals,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
plugins: [
|
|
45
|
-
peerDepsExternal(),
|
|
46
|
-
resolve(),
|
|
47
|
-
commonjs(),
|
|
48
|
-
typescript({
|
|
49
|
-
jsx: 'react',
|
|
50
|
-
}),
|
|
51
|
-
postcss({
|
|
52
|
-
extensions: ['.css'],
|
|
53
|
-
}),
|
|
54
|
-
json(),
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
input: 'lib/index.d.ts',
|
|
59
|
-
output: [{ file: 'lib/index.d.ts', format: 'es' }],
|
|
60
|
-
plugins: [dts()],
|
|
61
|
-
external: [/\.css$/],
|
|
62
|
-
},
|
|
63
|
-
]
|
package/src/assets/IconsSvg.tsx
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
return null
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
-
import Button from './Button'
|
|
4
|
-
|
|
5
|
-
// Default metadata of the story https://storybook.js.org/docs/react/api/csf#default-export
|
|
6
|
-
const meta: Meta<typeof Button> = {
|
|
7
|
-
title: 'Components/Button',
|
|
8
|
-
component: Button,
|
|
9
|
-
argTypes: {
|
|
10
|
-
textColor: { control: 'color' },
|
|
11
|
-
onClick: { action: 'clicked' },
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default meta
|
|
16
|
-
|
|
17
|
-
// The story type for the component https://storybook.js.org/docs/react/api/csf#named-story-exports
|
|
18
|
-
type Story = StoryObj<typeof Button>
|
|
19
|
-
|
|
20
|
-
export const Primary: Story = {
|
|
21
|
-
args: {
|
|
22
|
-
label: 'Primary 😃',
|
|
23
|
-
size: 'large',
|
|
24
|
-
type: 'primary',
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const Secondary: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
...Primary.args,
|
|
31
|
-
type: 'secondary',
|
|
32
|
-
label: 'Secondary 😇',
|
|
33
|
-
},
|
|
34
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { useState, MouseEvent } from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
import './button.css'
|
|
4
|
-
|
|
5
|
-
export interface ButtonProps {
|
|
6
|
-
/**
|
|
7
|
-
* Is this the principal call to action on the page?
|
|
8
|
-
*/
|
|
9
|
-
type?: 'primary' | 'secondary'
|
|
10
|
-
/**
|
|
11
|
-
* What background color to use
|
|
12
|
-
*/
|
|
13
|
-
textColor?: string
|
|
14
|
-
/**
|
|
15
|
-
* How large should the button be?
|
|
16
|
-
*/
|
|
17
|
-
size?: 'small' | 'medium' | 'large'
|
|
18
|
-
/**
|
|
19
|
-
* Button contents
|
|
20
|
-
*/
|
|
21
|
-
label: string
|
|
22
|
-
/**
|
|
23
|
-
* Optional click handler
|
|
24
|
-
*/
|
|
25
|
-
onClick?: (event: MouseEvent<HTMLButtonElement>) => void
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Primary UI component for user interaction
|
|
30
|
-
*/
|
|
31
|
-
const Button = ({
|
|
32
|
-
type = 'primary',
|
|
33
|
-
textColor,
|
|
34
|
-
size = 'medium',
|
|
35
|
-
onClick,
|
|
36
|
-
label,
|
|
37
|
-
}: ButtonProps) => {
|
|
38
|
-
const [theState, setTheState] = useState(4)
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<button
|
|
42
|
-
type="button"
|
|
43
|
-
className={classNames(
|
|
44
|
-
'storybook-button',
|
|
45
|
-
`storybook-button--${size}`,
|
|
46
|
-
`storybook-button--${type}`
|
|
47
|
-
)}
|
|
48
|
-
style={textColor ? { color: textColor } : {}}
|
|
49
|
-
onClick={onClick}
|
|
50
|
-
>
|
|
51
|
-
{`${label} ${theState}`}
|
|
52
|
-
</button>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default Button
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.storybook-button {
|
|
2
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
3
|
-
font-weight: 700;
|
|
4
|
-
border: 0;
|
|
5
|
-
border-radius: 3em;
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
display: inline-block;
|
|
8
|
-
line-height: 1;
|
|
9
|
-
}
|
|
10
|
-
.storybook-button--primary {
|
|
11
|
-
color: white;
|
|
12
|
-
background-color: #1ea7fd;
|
|
13
|
-
}
|
|
14
|
-
.storybook-button--secondary {
|
|
15
|
-
color: #333;
|
|
16
|
-
background-color: transparent;
|
|
17
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
18
|
-
}
|
|
19
|
-
.storybook-button--small {
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
padding: 10px 16px;
|
|
22
|
-
}
|
|
23
|
-
.storybook-button--medium {
|
|
24
|
-
font-size: 14px;
|
|
25
|
-
padding: 11px 20px;
|
|
26
|
-
}
|
|
27
|
-
.storybook-button--large {
|
|
28
|
-
font-size: 16px;
|
|
29
|
-
padding: 12px 24px;
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Button";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.will-root {
|
|
2
|
-
z-index: 999;
|
|
3
|
-
width: fit-content;
|
|
4
|
-
min-width: 796px;
|
|
5
|
-
max-height: 100vh;
|
|
6
|
-
position: relative;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.will-root.is-full-width {
|
|
10
|
-
width: 100%;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.will-filter-bar {
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
position: relative;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (max-width: 960px) {
|
|
19
|
-
.will-root {
|
|
20
|
-
width: 100%;
|
|
21
|
-
min-width: auto;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* Common */
|
|
26
|
-
|
|
27
|
-
.will-filter-bar-controls.dark,
|
|
28
|
-
.will-filter-bar-panels.dark {
|
|
29
|
-
box-shadow: var(--will-box-shadow-dark);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.will-filter-bar-controls.light,
|
|
33
|
-
.will-filter-bar-panels.light {
|
|
34
|
-
box-shadow: var(--will-box-shadow-light);
|
|
35
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
-
|
|
4
|
-
import { FilterBar } from './FilterBar'
|
|
5
|
-
import { Filters } from './FilterBarTypes'
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof FilterBar> = {
|
|
8
|
-
title: 'Components/FilterBar',
|
|
9
|
-
component: FilterBar,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default meta
|
|
13
|
-
|
|
14
|
-
type Story = StoryObj<typeof FilterBar>
|
|
15
|
-
|
|
16
|
-
export const Main: Story = {
|
|
17
|
-
args: {
|
|
18
|
-
disableCalendarDates: {
|
|
19
|
-
disabledDatesByPage: [
|
|
20
|
-
{
|
|
21
|
-
page: '/rooms',
|
|
22
|
-
offset: 7,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
page: '/events',
|
|
26
|
-
offset: -1,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
fullWidth: false,
|
|
31
|
-
language: 'en',
|
|
32
|
-
redirectUrl: 'http://localhost:4000/',
|
|
33
|
-
ageCategories: [
|
|
34
|
-
{
|
|
35
|
-
id: '1',
|
|
36
|
-
name: 'Alle 6 vuotiaat',
|
|
37
|
-
minVal: 0,
|
|
38
|
-
sortOrder: 1,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: '2',
|
|
42
|
-
name: '6-16 vuotiaat',
|
|
43
|
-
minVal: 0,
|
|
44
|
-
sortOrder: 2,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: '3',
|
|
48
|
-
name: 'Aikuiset',
|
|
49
|
-
minVal: 1,
|
|
50
|
-
sortOrder: 3,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
palette: {
|
|
54
|
-
primary: '',
|
|
55
|
-
secondary: '',
|
|
56
|
-
error: '#d32f2f',
|
|
57
|
-
},
|
|
58
|
-
mode: 'dark',
|
|
59
|
-
tabs: [
|
|
60
|
-
{
|
|
61
|
-
path: '/rooms',
|
|
62
|
-
label: 'Rooms',
|
|
63
|
-
default: true,
|
|
64
|
-
order: 2,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
path: '/events',
|
|
68
|
-
label: 'Events',
|
|
69
|
-
default: false,
|
|
70
|
-
order: 1,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
outerLoading: false,
|
|
74
|
-
locations: {
|
|
75
|
-
multiSelect: false,
|
|
76
|
-
disabled: false,
|
|
77
|
-
data: [
|
|
78
|
-
{
|
|
79
|
-
id: 1,
|
|
80
|
-
label: 'Helsinki Center',
|
|
81
|
-
description: 'Main training facility in downtown',
|
|
82
|
-
imageUrl: '',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
id: 2,
|
|
86
|
-
label: 'Espoo Campus',
|
|
87
|
-
description: 'Modern facilities with sea views',
|
|
88
|
-
imageUrl: null,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: 3,
|
|
92
|
-
label: 'Tampere Resort',
|
|
93
|
-
description: 'Lakeside retreat with full amenities',
|
|
94
|
-
imageUrl: null,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
id: 4,
|
|
98
|
-
label: 'Turku Harbor',
|
|
99
|
-
description: 'Modern facilities with sea views',
|
|
100
|
-
imageUrl: null,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: 5,
|
|
104
|
-
label: 'Oulu North',
|
|
105
|
-
description: 'Northern location with winter activities',
|
|
106
|
-
imageUrl: null,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
render: (args) => (
|
|
112
|
-
<div style={{ background: 'white', height: '100vh' }}>
|
|
113
|
-
<FilterBar {...args} onSubmit={false ? null : (_val: Filters) => null} />
|
|
114
|
-
</div>
|
|
115
|
-
),
|
|
116
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import { useTheme } from '../../themes/useTheme'
|
|
4
|
-
import { useAwaitRender, useUpdateTranslations } from '../../core/hooks'
|
|
5
|
-
|
|
6
|
-
import { FilterBarTypes } from './FilterBarTypes'
|
|
7
|
-
import { FilterPanels, FilterControls, FilterTabs } from './components'
|
|
8
|
-
import { FilterBarProvider } from './providers'
|
|
9
|
-
|
|
10
|
-
import '../../themes/Default.css'
|
|
11
|
-
import './FilterBar.css'
|
|
12
|
-
|
|
13
|
-
export const FilterBar = ({
|
|
14
|
-
language,
|
|
15
|
-
ageCategories,
|
|
16
|
-
redirectUrl = REDIRECT_URL_FALLBACK,
|
|
17
|
-
palette,
|
|
18
|
-
onSubmit,
|
|
19
|
-
fullWidth,
|
|
20
|
-
disableCalendarDates,
|
|
21
|
-
mode,
|
|
22
|
-
tabs,
|
|
23
|
-
outerLoading,
|
|
24
|
-
locations,
|
|
25
|
-
}: FilterBarTypes) => {
|
|
26
|
-
const themePalette = useTheme({ palette })
|
|
27
|
-
|
|
28
|
-
// Translations
|
|
29
|
-
useUpdateTranslations({ language })
|
|
30
|
-
|
|
31
|
-
// Display component after fully loaded
|
|
32
|
-
useAwaitRender()
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<FilterBarProvider
|
|
36
|
-
language={language}
|
|
37
|
-
ageCategories={ageCategories}
|
|
38
|
-
redirectUrl={redirectUrl}
|
|
39
|
-
palette={palette}
|
|
40
|
-
onSubmit={onSubmit}
|
|
41
|
-
fullWidth={fullWidth}
|
|
42
|
-
disableCalendarDates={disableCalendarDates}
|
|
43
|
-
mode={mode}
|
|
44
|
-
tabs={tabs}
|
|
45
|
-
outerLoading={outerLoading}
|
|
46
|
-
locations={locations}
|
|
47
|
-
>
|
|
48
|
-
<div
|
|
49
|
-
className={`will-root ${fullWidth ? 'is-full-width' : ''}`}
|
|
50
|
-
style={themePalette}
|
|
51
|
-
>
|
|
52
|
-
<FilterTabs />
|
|
53
|
-
|
|
54
|
-
<FilterControls />
|
|
55
|
-
|
|
56
|
-
<FilterPanels />
|
|
57
|
-
</div>
|
|
58
|
-
</FilterBarProvider>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
////////////
|
|
63
|
-
|
|
64
|
-
const REDIRECT_URL_FALLBACK = 'http://localhost:3000/'
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { DisableCalendarDates } from '../../core/components/calendar/CalendarTypes'
|
|
2
|
-
import { Palette } from '../../themes/useTheme'
|
|
3
|
-
|
|
4
|
-
export type FilterBarTypes = {
|
|
5
|
-
language?: string
|
|
6
|
-
ageCategories?: AgeCategoryType[]
|
|
7
|
-
redirectUrl?: string
|
|
8
|
-
palette?: Palette
|
|
9
|
-
onSubmit?: ((val: Filters) => void) | null
|
|
10
|
-
fullWidth?: boolean
|
|
11
|
-
disableCalendarDates?: DisableCalendarDates
|
|
12
|
-
mode?: string
|
|
13
|
-
tabs?: Tab[]
|
|
14
|
-
outerLoading?: boolean
|
|
15
|
-
locations?: Locations
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type AgeCategoryCount = {
|
|
19
|
-
[categoryId: string]: number
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type AgeCategoryType = {
|
|
23
|
-
id: string
|
|
24
|
-
name: string
|
|
25
|
-
minVal: number
|
|
26
|
-
sortOrder: number
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type GuestsCountPropsType = {
|
|
30
|
-
label: string
|
|
31
|
-
id: string
|
|
32
|
-
updateGuestsCount: (arg1: string, arg2: number) => void
|
|
33
|
-
count: number
|
|
34
|
-
minVal: number
|
|
35
|
-
sortOrder: number
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export enum FilterSections {
|
|
39
|
-
CALENDAR = 'calendar',
|
|
40
|
-
GUESTS = 'guests',
|
|
41
|
-
CATEGORIES = 'categories',
|
|
42
|
-
LOCATIONS = 'locations',
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type Filters = { [key: string]: string }
|
|
46
|
-
|
|
47
|
-
export enum Pages {
|
|
48
|
-
ROOMS = '/rooms',
|
|
49
|
-
EVENTS = '/events',
|
|
50
|
-
SALES = '/sales',
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type Tab = {
|
|
54
|
-
path: string
|
|
55
|
-
default?: boolean
|
|
56
|
-
order: number
|
|
57
|
-
label?: string
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type Locations = {
|
|
61
|
-
multiSelect?: boolean
|
|
62
|
-
disabled?: boolean
|
|
63
|
-
data: Location[]
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type Location = {
|
|
67
|
-
id: number
|
|
68
|
-
label: string
|
|
69
|
-
description?: string | null
|
|
70
|
-
imageUrl?: string | null
|
|
71
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.will-filter-bar-divider {
|
|
2
|
-
width: 1px;
|
|
3
|
-
margin: 0 10px;
|
|
4
|
-
background-color: var(--will-charcoal-blue);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
@media (max-width: 960px) {
|
|
8
|
-
.will-filter-bar-divider {
|
|
9
|
-
width: auto;
|
|
10
|
-
margin: 0 10px;
|
|
11
|
-
height: 1px;
|
|
12
|
-
background-color: var(--will-charcoal-blue);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.will-filter-bar-controls {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: space-between;
|
|
4
|
-
padding: 10px;
|
|
5
|
-
position: relative;
|
|
6
|
-
z-index: 222;
|
|
7
|
-
border-radius: 40px;
|
|
8
|
-
background-color: var(--will-white);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@media (max-width: 960px) {
|
|
12
|
-
.will-filter-bar-controls {
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
padding: 20px;
|
|
15
|
-
border-radius: 25px;
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.will-filter-bar-controls.disabled {
|
|
20
|
-
opacity: 0.1;
|
|
21
|
-
}
|
|
22
|
-
}
|