willba-component-library 0.3.14 → 0.3.16
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 +12 -12
- package/lib/components/FilterBar/FilterBar.d.ts +2 -2
- package/lib/components/FilterBar/components/FilterControls/FilterControls.d.ts +3 -0
- package/lib/components/FilterBar/components/FilterPanels/Categories/Categories.d.ts +11 -0
- package/lib/components/FilterBar/components/FilterPanels/Dates/Dates.d.ts +16 -0
- package/lib/components/FilterBar/components/FilterPanels/FilterPanels.d.ts +3 -0
- package/lib/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.d.ts +4 -0
- package/lib/components/FilterBar/components/FilterPanels/Guests/Guests.d.ts +12 -0
- package/lib/components/FilterBar/components/FilterPanels/Locations/Locations.d.ts +14 -0
- package/lib/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.d.ts +8 -0
- package/lib/components/FilterBar/components/FilterTabs/FilterTabs.d.ts +3 -0
- package/lib/components/FilterBar/components/ImageCard/ImageCard.d.ts +11 -0
- package/lib/components/FilterBar/components/SelectButton/SelectButton.d.ts +13 -0
- package/lib/components/FilterBar/components/TabButton/TabButton.d.ts +10 -0
- package/lib/components/FilterBar/components/index.d.ts +6 -5
- package/lib/components/FilterBar/hooks/index.d.ts +4 -1
- package/lib/components/FilterBar/hooks/useFilterActions.d.ts +25 -0
- package/lib/components/FilterBar/hooks/useFilterState.d.ts +22 -0
- package/lib/components/FilterBar/hooks/useFilterUi.d.ts +7 -0
- package/lib/components/FilterBar/hooks/usePanelPosition.d.ts +12 -0
- package/lib/components/FilterBar/index.d.ts +1 -1
- package/lib/components/FilterBar/providers/FilterBarProvider.d.ts +31 -0
- package/lib/components/FilterBar/providers/index.d.ts +1 -0
- package/lib/components/FilterBar/utils/ageCategoriesRules.d.ts +7 -0
- package/lib/components/FilterBar/utils/index.d.ts +1 -1
- package/lib/components/FilterBar/utils/parseGuests.d.ts +5 -1
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
- package/lib/core/components/buttons/CloseButton/CloseButton.d.ts +7 -0
- package/lib/core/components/buttons/SubmitButton/SubmitButton.d.ts +14 -0
- package/lib/core/components/index.d.ts +4 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +1142 -1117
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1141 -1116
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +1141 -1116
- package/lib/index.umd.js.map +1 -1
- package/lib/themes/useTheme.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +4 -70
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -1
- package/src/components/FilterBar/FilterBar.tsx +28 -283
- package/src/components/FilterBar/components/FilterControls/FilterControls.css +18 -0
- package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +135 -0
- package/src/components/FilterBar/components/{categories → FilterPanels/Categories}/Categories.css +1 -1
- package/src/components/FilterBar/components/{categories → FilterPanels/Categories}/Categories.tsx +3 -1
- package/src/components/FilterBar/components/{dates → FilterPanels/Dates}/Dates.css +1 -1
- package/src/components/FilterBar/components/{dates → FilterPanels/Dates}/Dates.tsx +11 -11
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +24 -0
- package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +115 -0
- package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/GuestCount/GuestCount.tsx +1 -1
- package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/Guests.css +9 -4
- package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/Guests.tsx +7 -7
- package/src/components/FilterBar/components/{locations → FilterPanels/Locations}/Locations.css +2 -3
- package/src/components/FilterBar/components/{locations → FilterPanels/Locations}/Locations.tsx +7 -6
- package/src/components/FilterBar/components/{common/FilterSectionHeader.tsx → FilterPanels/SectionHeader/SectionHeader.tsx} +2 -2
- package/src/components/FilterBar/components/FilterTabs/FilterTabs.css +10 -0
- package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +47 -0
- package/src/components/FilterBar/components/{buttons/select-button → SelectButton}/SelectButton.css +1 -0
- package/src/components/FilterBar/components/{buttons/select-button → SelectButton}/SelectButton.tsx +7 -6
- package/src/components/FilterBar/components/index.ts +6 -6
- package/src/components/FilterBar/hooks/index.ts +4 -1
- package/src/components/FilterBar/hooks/useFilterActions.tsx +126 -0
- package/src/components/FilterBar/hooks/useFilterState.tsx +86 -0
- package/src/components/FilterBar/hooks/useFilterUi.tsx +19 -0
- package/src/components/FilterBar/hooks/usePanelPosition.tsx +53 -0
- package/src/components/FilterBar/index.ts +1 -1
- package/src/components/FilterBar/providers/FilterBarProvider.tsx +169 -0
- package/src/components/FilterBar/providers/index.ts +1 -0
- package/src/components/FilterBar/utils/ageCategoriesRules.ts +27 -0
- package/src/components/FilterBar/utils/index.tsx +1 -1
- package/src/components/FilterBar/utils/parseGuests.tsx +20 -9
- package/src/components/FilterBar/utils/{parseLocations.tsx → parseLocations.ts} +3 -4
- package/src/components/FilterCalendar/FilterCalendar.tsx +2 -2
- package/src/core/components/index.ts +5 -2
- package/src/index.ts +1 -1
- package/src/themes/useTheme.tsx +1 -1
- package/src/components/FilterBar/components/buttons/index.ts +0 -5
- package/src/components/FilterBar/components/cards/index.ts +0 -1
- package/src/components/FilterBar/components/dates/index.ts +0 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +0 -208
- package/src/components/FilterBar/utils/calculateDropdownPosition.tsx +0 -96
- /package/src/components/FilterBar/components/{divider → Divider}/Divider.css +0 -0
- /package/src/components/FilterBar/components/{divider → Divider}/Divider.tsx +0 -0
- /package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/GuestCount/GuestCount.css +0 -0
- /package/src/components/FilterBar/components/{common/FilterSectionHeader.css → FilterPanels/SectionHeader/SectionHeader.css} +0 -0
- /package/src/components/FilterBar/components/{cards/image-card → ImageCard}/ImageCard.css +0 -0
- /package/src/components/FilterBar/components/{cards/image-card → ImageCard}/ImageCard.tsx +0 -0
- /package/src/components/FilterBar/components/{buttons/tab-button → TabButton}/TabButton.css +0 -0
- /package/src/components/FilterBar/components/{buttons/tab-button → TabButton}/TabButton.tsx +0 -0
- /package/src/core/components/buttons/{close-button → CloseButton}/CloseButton.css +0 -0
- /package/src/core/components/buttons/{close-button → CloseButton}/CloseButton.tsx +0 -0
- /package/src/core/components/buttons/{submit-button → SubmitButton}/SubmitButton.css +0 -0
- /package/src/core/components/buttons/{submit-button → SubmitButton}/SubmitButton.tsx +0 -0
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ ReactDOM.render(<App />, document.querySelector('#app'))
|
|
|
107
107
|
|
|
108
108
|
<script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
|
|
109
109
|
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
|
|
110
|
-
<script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.
|
|
110
|
+
<script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.16/lib/index.umd.js"></script>
|
|
111
111
|
|
|
112
112
|
<script>
|
|
113
113
|
const renderFilterBar = async () => {
|
|
@@ -161,14 +161,14 @@ ReactDOM.render(<App />, document.querySelector('#app'))
|
|
|
161
161
|
|
|
162
162
|
## Props of FilterBar
|
|
163
163
|
|
|
164
|
-
| Name | Value | Description
|
|
165
|
-
| -------------------- | ---------- |
|
|
166
|
-
| redirectUrl | `"string"` | Specifies the base URL to which the component should redirect after submitting the filters. For example: `'https://store.vendor.willba.app/'`
|
|
167
|
-
| language | `"string"` | Specifies the language of the filter bar. Available options are Finnish ("fi") and English ("en"). For example: `'en'`
|
|
168
|
-
| palette | `{}` | The palette defines the colors of the filter bar. Override the colors using the following format: `{ primary: string, secondary: string, error: string }`. For example: `{ primary: '#2a5a44', secondary: '#2a5a44', error: '#ff0000' }`
|
|
169
|
-
| disableCalendarDates | `{}` | Disable dates on the calendar by page using the following format: `{ disabledDatesByPage: [{ offset: number, page: string }] }`. For example: `{ disabledDatesByPage: [{ offset: 7, page: '/rooms' }, { offset: -1, page: '/events' }] }`
|
|
170
|
-
| mode | `"string"` | Specify the color theme for the filter bar tabs as either light or dark using the following format: `'dark'` or `'light'`
|
|
171
|
-
| ageCategories | `[{}]` | The ageCategories prop will determine the types of guests that can be selected. Specify the age categories for guests using the following format: `[{ id: string, name: string, minVal: number, sortOrder: number }]`. For example: `[{ id: '1', name: 'Aikuiset', minVal: 1, sortOrder: 1 }]`
|
|
172
|
-
| fullWidth | `true` | Specify whether the filter bar width should be dynamic or fixed.
|
|
173
|
-
| tabs | `[{}]` | Manage the filter bar tabs using the following format: `[{path: string, default: boolean, order: number, label?: string}]`. The label should be pre-localized. For example: `[{ path: '/rooms', default: true, order: 2, label: 'Rooms' }]`
|
|
174
|
-
| locations | `{}` | Configures location filter. Format: `{ multiSelect: boolean, disabled?: boolean, data: Location[] }` where Location = `{ id: number, label: string, description?: string \| null, imageUrl?: string \| null }`. The label and description should be pre-localized. `multiSelect` enables multi-selection, `disabled` disables the filter, `description` shows under title, `imageUrl` displays location image. Example: `{ multiSelect: false, disabled: false, data: [{ id: 1, label: 'Helsinki', description: 'Capital of Finland', imageUrl: 'https://example.com/helsinki.jpg' }] }`
|
|
164
|
+
| Name | Value | Description |
|
|
165
|
+
| -------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
166
|
+
| redirectUrl | `"string"` | Specifies the base URL to which the component should redirect after submitting the filters. For example: `'https://store.vendor.willba.app/'` |
|
|
167
|
+
| language | `"string"` | Specifies the language of the filter bar. Available options are Finnish ("fi") and English ("en"). For example: `'en'` |
|
|
168
|
+
| palette | `{}` | The palette defines the colors of the filter bar. Override the colors using the following format: `{ primary: string, secondary: string, error: string }`. For example: `{ primary: '#2a5a44', secondary: '#2a5a44', error: '#ff0000' }` |
|
|
169
|
+
| disableCalendarDates | `{}` | Disable dates on the calendar by page using the following format: `{ disabledDatesByPage: [{ offset: number, page: string }] }`. For example: `{ disabledDatesByPage: [{ offset: 7, page: '/rooms' }, { offset: -1, page: '/events' }] }` |
|
|
170
|
+
| mode | `"string"` | Specify the color theme for the filter bar tabs as either light or dark using the following format: `'dark'` or `'light'` |
|
|
171
|
+
| ageCategories | `[{}]` | The ageCategories prop will determine the types of guests that can be selected. Specify the age categories for guests using the following format: `[{ id: string, name: string, minVal: number, sortOrder: number }]`. For example: `[{ id: '1', name: 'Aikuiset', minVal: 1, sortOrder: 1 }]` |
|
|
172
|
+
| fullWidth | `true` | Specify whether the filter bar width should be dynamic or fixed. |
|
|
173
|
+
| tabs | `[{}]` | Manage the filter bar tabs using the following format: `[{path: string, default: boolean, order: number, label?: string}]`. The label should be pre-localized. For example: `[{ path: '/rooms', default: true, order: 2, label: 'Rooms' }]` |
|
|
174
|
+
| locations | `{}` | Configures location filter. Format: `{ multiSelect: boolean, disabled?: boolean, data: Location[] }` where Location = `{ id: number, label: string, description?: string \| null, imageUrl?: string \| null }`. The label and description should be pre-localized. `multiSelect` enables multi-selection, `disabled` disables the filter, `description` shows under title, `imageUrl` displays location image. Example: `{ multiSelect: false, disabled: false, data: [{ id: 1, label: 'Helsinki', description: 'Capital of Finland', imageUrl: 'https://example.com/helsinki.jpg' }] }` |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import '../../themes/Default.css';
|
|
3
2
|
import { FilterBarTypes } from './FilterBarTypes';
|
|
3
|
+
import '../../themes/Default.css';
|
|
4
4
|
import './FilterBar.css';
|
|
5
|
-
export
|
|
5
|
+
export declare const FilterBar: ({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes) => React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './Categories.css';
|
|
3
|
+
type Props = {
|
|
4
|
+
categories: any;
|
|
5
|
+
setCategories: any;
|
|
6
|
+
};
|
|
7
|
+
export declare const Categories: {
|
|
8
|
+
({ categories, setCategories }: Props): React.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
import { CalendarTypes } from '../../../../../core/components';
|
|
4
|
+
import './Dates.css';
|
|
5
|
+
type Props = {
|
|
6
|
+
ref: RefObject<HTMLDivElement>;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
calendarRange: DateRange | undefined;
|
|
10
|
+
setCalendarRange: (range: DateRange | undefined) => void;
|
|
11
|
+
disableCalendarDates?: CalendarTypes['disableCalendarDates'];
|
|
12
|
+
selectedPath?: string;
|
|
13
|
+
language?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const Dates: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AgeCategoryCount, AgeCategoryType } from '../../../FilterBarTypes';
|
|
3
|
+
import './Guests.css';
|
|
4
|
+
type Props = {
|
|
5
|
+
ageCategories?: AgeCategoryType[];
|
|
6
|
+
updateGuestsCount: (arg1: string, arg2: number) => void;
|
|
7
|
+
ageCategoryCounts: AgeCategoryCount;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const Guests: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Location } from '../../../FilterBarTypes';
|
|
3
|
+
import './Locations.css';
|
|
4
|
+
type Props = {
|
|
5
|
+
locations?: Location[];
|
|
6
|
+
language?: string;
|
|
7
|
+
selectedLocations: Location[];
|
|
8
|
+
setSelectedLocations: (locations: Location[]) => void;
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
multiSelect?: boolean;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const Locations: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './ImageCard.css';
|
|
3
|
+
type Props = {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
imageUrl?: string | null;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ImageCard: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ReactNode, MouseEvent } from 'react';
|
|
2
|
+
import './SelectButton.css';
|
|
3
|
+
type Props = {
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
6
|
+
description: ReactNode;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
ariaExpanded?: boolean;
|
|
10
|
+
ariaControls?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const SelectButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './TabButton.css';
|
|
3
|
+
type Props = {
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
label: string;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
mode?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const TabButton: ({ onClick, label, active, mode }: Props) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { Divider } from './
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { SelectButton } from './SelectButton/SelectButton';
|
|
2
|
+
export { TabButton } from './TabButton/TabButton';
|
|
3
|
+
export { Divider } from './Divider/Divider';
|
|
4
|
+
export { FilterPanels } from './FilterPanels/FilterPanels';
|
|
5
|
+
export { FilterControls } from './FilterControls/FilterControls';
|
|
6
|
+
export { FilterTabs } from './FilterTabs/FilterTabs';
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { useFilterBar } from './useFilterBar';
|
|
2
1
|
export { useScrollInToView } from './useScrollInToView';
|
|
2
|
+
export { useFilterState } from './useFilterState';
|
|
3
|
+
export { useFilterActions } from './useFilterActions';
|
|
4
|
+
export { useFilterUi } from './useFilterUi';
|
|
5
|
+
export { usePanelPosition } from './usePanelPosition';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
import { AgeCategoryCount, FilterBarTypes, Locations } from '../FilterBarTypes';
|
|
4
|
+
type Props = {
|
|
5
|
+
tabs: FilterBarTypes['tabs'];
|
|
6
|
+
ageCategories: FilterBarTypes['ageCategories'];
|
|
7
|
+
redirectUrl: FilterBarTypes['redirectUrl'];
|
|
8
|
+
ageCategoryCounts: AgeCategoryCount;
|
|
9
|
+
selectedLocations: Locations['data'];
|
|
10
|
+
calendarRange?: DateRange;
|
|
11
|
+
selectedPath: string;
|
|
12
|
+
setSelectedPath: (val: string) => void;
|
|
13
|
+
setAgeCategoryCounts: Dispatch<SetStateAction<AgeCategoryCount>>;
|
|
14
|
+
setSelectedFilter: (val: string | boolean) => void;
|
|
15
|
+
setCalendarRange: (val: DateRange | undefined) => void;
|
|
16
|
+
onSubmit: FilterBarTypes['onSubmit'];
|
|
17
|
+
setInnerLoading: (val: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const useFilterActions: ({ tabs, calendarRange, ageCategoryCounts, ageCategories, selectedLocations, selectedPath, redirectUrl, setSelectedPath, setAgeCategoryCounts, setSelectedFilter, setCalendarRange, onSubmit, setInnerLoading, }: Props) => {
|
|
20
|
+
updateGuestsCount: (id: string, newCount: number) => void;
|
|
21
|
+
handleSelectedFilter: (id: string | boolean) => void;
|
|
22
|
+
handleSubmit: () => void;
|
|
23
|
+
handleResetFilters: () => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DateRange } from 'react-day-picker';
|
|
2
|
+
import { AgeCategoryCount, FilterBarTypes } from '../FilterBarTypes';
|
|
3
|
+
type Props = {
|
|
4
|
+
locations: FilterBarTypes['locations'];
|
|
5
|
+
};
|
|
6
|
+
export declare const useFilterState: ({ locations }: Props) => {
|
|
7
|
+
selectedPath: string;
|
|
8
|
+
selectedFilter: string | boolean;
|
|
9
|
+
calendarRange: DateRange | undefined;
|
|
10
|
+
innerLoading: boolean;
|
|
11
|
+
categories: number;
|
|
12
|
+
ageCategoryCounts: AgeCategoryCount;
|
|
13
|
+
selectedLocations: import("..").Location[];
|
|
14
|
+
setSelectedLocations: import("react").Dispatch<import("react").SetStateAction<import("..").Location[]>>;
|
|
15
|
+
setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
|
|
16
|
+
setAgeCategoryCounts: import("react").Dispatch<import("react").SetStateAction<AgeCategoryCount>>;
|
|
17
|
+
setCategories: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
18
|
+
setSelectedPath: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
19
|
+
setSelectedFilter: import("react").Dispatch<import("react").SetStateAction<string | boolean>>;
|
|
20
|
+
setInnerLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useFilterUi: (selectedFilter: string | boolean) => {
|
|
2
|
+
previouslyFocusedButtonRef: import("react").MutableRefObject<HTMLButtonElement | null>;
|
|
3
|
+
isMobile: boolean;
|
|
4
|
+
targetFilterBarRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
5
|
+
panelRef: import("react").MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
buttonRefs: import("react").MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties, MutableRefObject, RefObject } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
selectedFilter: string | boolean;
|
|
4
|
+
panelRef: RefObject<HTMLDivElement | null>;
|
|
5
|
+
targetFilterBarRef: RefObject<HTMLDivElement | null>;
|
|
6
|
+
buttonRefs: MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const usePanelPosition: ({ selectedFilter, panelRef, targetFilterBarRef, buttonRefs, isMobile, }: Props) => {
|
|
10
|
+
localStyles: CSSProperties;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { FilterBar } from './FilterBar';
|
|
2
2
|
export * from './FilterBarTypes';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { PropsWithChildren, RefObject, MutableRefObject } from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
import { AgeCategoryCount, Location, FilterBarTypes } from '../FilterBarTypes';
|
|
4
|
+
type FilterBarProviderProps = PropsWithChildren<FilterBarTypes>;
|
|
5
|
+
type FilterBarContextType = FilterBarTypes & {
|
|
6
|
+
selectedFilter: string | boolean;
|
|
7
|
+
ageCategoryCounts: AgeCategoryCount;
|
|
8
|
+
categories: number;
|
|
9
|
+
calendarRange?: DateRange;
|
|
10
|
+
selectedPath: string;
|
|
11
|
+
innerLoading: boolean;
|
|
12
|
+
selectedLocations: Location[];
|
|
13
|
+
setSelectedLocations: (val: Location[]) => void;
|
|
14
|
+
setCalendarRange: (val: DateRange | undefined) => void;
|
|
15
|
+
setSelectedFilter: (val: string | boolean) => void;
|
|
16
|
+
setAgeCategoryCounts: (val: AgeCategoryCount) => void;
|
|
17
|
+
setCategories: (val: number) => void;
|
|
18
|
+
setSelectedPath: (val: string) => void;
|
|
19
|
+
handleSelectedFilter: (id: string | boolean) => void;
|
|
20
|
+
handleSubmit: () => void;
|
|
21
|
+
updateGuestsCount: (id: string, newCount: number) => void;
|
|
22
|
+
handleResetFilters: () => void;
|
|
23
|
+
previouslyFocusedButtonRef: MutableRefObject<HTMLButtonElement | null>;
|
|
24
|
+
panelRef: MutableRefObject<HTMLDivElement | null>;
|
|
25
|
+
buttonRefs: MutableRefObject<Record<string, HTMLButtonElement | null>>;
|
|
26
|
+
isMobile: boolean;
|
|
27
|
+
targetFilterBarRef: RefObject<HTMLDivElement>;
|
|
28
|
+
};
|
|
29
|
+
export declare const FilterBarProvider: ({ children, language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarProviderProps) => React.JSX.Element;
|
|
30
|
+
export declare const useFilterBar: () => FilterBarContextType;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FilterBarProvider, useFilterBar } from './FilterBarProvider';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AgeCategoryCount, AgeCategoryType } from '../FilterBarTypes';
|
|
2
|
+
type Props = {
|
|
3
|
+
ageCategoryCounts: AgeCategoryCount;
|
|
4
|
+
ageCategories?: AgeCategoryType[];
|
|
5
|
+
};
|
|
6
|
+
export declare const ageCategoryRules: ({ ageCategoryCounts, ageCategories, }: Props) => string;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { AgeCategoryCount, AgeCategoryType } from '../FilterBarTypes';
|
|
2
3
|
type Props = {
|
|
3
4
|
ageCategoryCounts: AgeCategoryCount;
|
|
4
|
-
ageCategories
|
|
5
|
+
ageCategories?: AgeCategoryType[];
|
|
5
6
|
guestLabel: string;
|
|
6
7
|
guestsLabel: string;
|
|
7
8
|
guestsPlaceholder: string;
|
|
@@ -13,5 +14,8 @@ type AccType = {
|
|
|
13
14
|
export declare const parseGuests: ({ guestLabel, guestsLabel, guestsPlaceholder, ageCategoryCounts, ageCategories, }: Props) => {
|
|
14
15
|
content: string;
|
|
15
16
|
data: AccType;
|
|
17
|
+
} | {
|
|
18
|
+
content: React.JSX.Element;
|
|
19
|
+
data: AccType;
|
|
16
20
|
};
|
|
17
21
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import '../../themes/Default.css';
|
|
3
2
|
import { FilterCalendarTypes } from './FilterCalendarTypes';
|
|
3
|
+
import '../../themes/Default.css';
|
|
4
4
|
import './FilterCalendar.css';
|
|
5
5
|
export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import './SubmitButton.css';
|
|
4
|
+
type SubmitButtonVariant = 'text' | 'full';
|
|
5
|
+
type Props = {
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
startIcon?: ReactNode;
|
|
8
|
+
label?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
variant?: SubmitButtonVariant;
|
|
12
|
+
};
|
|
13
|
+
export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, variant, }: Props) => React.JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { SubmitButton } from './buttons/
|
|
2
|
-
export { CloseButton } from './buttons/
|
|
1
|
+
export { SubmitButton } from './buttons/SubmitButton/SubmitButton';
|
|
2
|
+
export { CloseButton } from './buttons/CloseButton/CloseButton';
|
|
3
3
|
export { Calendar } from './calendar/Calendar';
|
|
4
|
+
export type { CalendarTypes } from './calendar/CalendarTypes';
|
|
5
|
+
export { parseDates } from './calendar/utils';
|
package/lib/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ type Location = {
|
|
|
120
120
|
imageUrl?: string | null;
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
declare
|
|
123
|
+
declare const FilterBar: ({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes) => React.JSX.Element;
|
|
124
124
|
|
|
125
125
|
interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
126
126
|
palette: Palette;
|