willba-component-library 0.3.13 → 0.3.15

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.
Files changed (110) hide show
  1. package/README.md +12 -12
  2. package/lib/assets/IconsSvg.d.ts +2 -1
  3. package/lib/components/Button/Button.d.ts +2 -2
  4. package/lib/components/FilterBar/FilterBar.d.ts +3 -2
  5. package/lib/components/FilterBar/components/FilterControls/FilterControls.d.ts +3 -0
  6. package/lib/components/FilterBar/components/FilterPanels/Categories/Categories.d.ts +11 -0
  7. package/lib/components/FilterBar/components/FilterPanels/Dates/Dates.d.ts +16 -0
  8. package/lib/components/FilterBar/components/FilterPanels/FilterPanels.d.ts +3 -0
  9. package/lib/components/FilterBar/components/FilterPanels/Guests/GuestCount/GuestCount.d.ts +4 -0
  10. package/lib/components/FilterBar/components/FilterPanels/Guests/Guests.d.ts +12 -0
  11. package/lib/components/FilterBar/components/FilterPanels/Locations/Locations.d.ts +14 -0
  12. package/lib/components/FilterBar/components/FilterPanels/SectionHeader/SectionHeader.d.ts +8 -0
  13. package/lib/components/FilterBar/components/FilterTabs/FilterTabs.d.ts +3 -0
  14. package/lib/components/FilterBar/components/ImageCard/ImageCard.d.ts +11 -0
  15. package/lib/components/FilterBar/components/SelectButton/SelectButton.d.ts +13 -0
  16. package/lib/components/FilterBar/components/TabButton/TabButton.d.ts +10 -0
  17. package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +2 -1
  18. package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +2 -1
  19. package/lib/components/FilterBar/components/cards/image-card/ImageCard.d.ts +2 -1
  20. package/lib/components/FilterBar/components/categories/Categories.d.ts +2 -1
  21. package/lib/components/FilterBar/components/common/FilterSectionHeader.d.ts +2 -2
  22. package/lib/components/FilterBar/components/dates/Dates.d.ts +2 -2
  23. package/lib/components/FilterBar/components/divider/Divider.d.ts +2 -1
  24. package/lib/components/FilterBar/components/guests/Guests.d.ts +2 -1
  25. package/lib/components/FilterBar/components/index.d.ts +6 -5
  26. package/lib/components/FilterBar/components/locations/Locations.d.ts +2 -1
  27. package/lib/components/FilterBar/hooks/index.d.ts +4 -1
  28. package/lib/components/FilterBar/hooks/useFilterActions.d.ts +25 -0
  29. package/lib/components/FilterBar/hooks/useFilterState.d.ts +22 -0
  30. package/lib/components/FilterBar/hooks/useFilterUi.d.ts +7 -0
  31. package/lib/components/FilterBar/hooks/usePanelPosition.d.ts +12 -0
  32. package/lib/components/FilterBar/index.d.ts +1 -1
  33. package/lib/components/FilterBar/providers/FilterBarProvider.d.ts +31 -0
  34. package/lib/components/FilterBar/providers/index.d.ts +1 -0
  35. package/lib/components/FilterBar/utils/ageCategoriesRules.d.ts +7 -0
  36. package/lib/components/FilterBar/utils/index.d.ts +1 -1
  37. package/lib/components/FilterBar/utils/parseGuests.d.ts +5 -1
  38. package/lib/components/FilterCalendar/FilterCalendar.d.ts +3 -2
  39. package/lib/components/FilterCalendar/components/Footer.d.ts +2 -1
  40. package/lib/core/components/buttons/CloseButton/CloseButton.d.ts +7 -0
  41. package/lib/core/components/buttons/SubmitButton/SubmitButton.d.ts +14 -0
  42. package/lib/core/components/buttons/close-button/CloseButton.d.ts +2 -1
  43. package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +2 -1
  44. package/lib/core/components/calendar/Calendar.d.ts +2 -1
  45. package/lib/core/components/index.d.ts +4 -2
  46. package/lib/index.d.ts +4 -5
  47. package/lib/index.esm.js +1593 -1480
  48. package/lib/index.esm.js.map +1 -1
  49. package/lib/index.js +2156 -2043
  50. package/lib/index.js.map +1 -1
  51. package/lib/index.umd.js +2159 -2045
  52. package/lib/index.umd.js.map +1 -1
  53. package/lib/themes/useTheme.d.ts +1 -1
  54. package/package.json +1 -1
  55. package/rollup.config.mjs +1 -1
  56. package/src/components/FilterBar/FilterBar.css +4 -70
  57. package/src/components/FilterBar/FilterBar.stories.tsx +1 -1
  58. package/src/components/FilterBar/FilterBar.tsx +28 -283
  59. package/src/components/FilterBar/components/FilterControls/FilterControls.css +18 -0
  60. package/src/components/FilterBar/components/FilterControls/FilterControls.tsx +135 -0
  61. package/src/components/FilterBar/components/{categories → FilterPanels/Categories}/Categories.css +1 -1
  62. package/src/components/FilterBar/components/{categories → FilterPanels/Categories}/Categories.tsx +3 -1
  63. package/src/components/FilterBar/components/{dates → FilterPanels/Dates}/Dates.tsx +11 -11
  64. package/src/components/FilterBar/components/FilterPanels/FilterPanels.css +24 -0
  65. package/src/components/FilterBar/components/FilterPanels/FilterPanels.tsx +115 -0
  66. package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/GuestCount/GuestCount.tsx +1 -1
  67. package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/Guests.css +5 -6
  68. package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/Guests.tsx +7 -7
  69. package/src/components/FilterBar/components/{locations → FilterPanels/Locations}/Locations.css +1 -1
  70. package/src/components/FilterBar/components/{locations → FilterPanels/Locations}/Locations.tsx +7 -6
  71. package/src/components/FilterBar/components/{common/FilterSectionHeader.tsx → FilterPanels/SectionHeader/SectionHeader.tsx} +2 -2
  72. package/src/components/FilterBar/components/FilterTabs/FilterTabs.css +10 -0
  73. package/src/components/FilterBar/components/FilterTabs/FilterTabs.tsx +47 -0
  74. package/src/components/FilterBar/components/{buttons/select-button → SelectButton}/SelectButton.css +1 -0
  75. package/src/components/FilterBar/components/{buttons/select-button → SelectButton}/SelectButton.tsx +7 -6
  76. package/src/components/FilterBar/components/index.ts +6 -6
  77. package/src/components/FilterBar/hooks/index.ts +4 -1
  78. package/src/components/FilterBar/hooks/useFilterActions.tsx +126 -0
  79. package/src/components/FilterBar/hooks/useFilterState.tsx +86 -0
  80. package/src/components/FilterBar/hooks/useFilterUi.tsx +19 -0
  81. package/src/components/FilterBar/hooks/usePanelPosition.tsx +66 -0
  82. package/src/components/FilterBar/index.ts +1 -1
  83. package/src/components/FilterBar/providers/FilterBarProvider.tsx +169 -0
  84. package/src/components/FilterBar/providers/index.ts +1 -0
  85. package/src/components/FilterBar/utils/ageCategoriesRules.ts +27 -0
  86. package/src/components/FilterBar/utils/index.tsx +1 -1
  87. package/src/components/FilterBar/utils/parseGuests.tsx +20 -9
  88. package/src/components/FilterBar/utils/{parseLocations.tsx → parseLocations.ts} +3 -4
  89. package/src/components/FilterCalendar/FilterCalendar.tsx +2 -2
  90. package/src/core/components/index.ts +5 -2
  91. package/src/index.ts +1 -1
  92. package/src/themes/useTheme.tsx +1 -1
  93. package/src/components/FilterBar/components/buttons/index.ts +0 -5
  94. package/src/components/FilterBar/components/cards/index.ts +0 -1
  95. package/src/components/FilterBar/components/dates/index.ts +0 -1
  96. package/src/components/FilterBar/hooks/useFilterBar.tsx +0 -208
  97. package/src/components/FilterBar/utils/calculateDropdownPosition.tsx +0 -96
  98. /package/src/components/FilterBar/components/{divider → Divider}/Divider.css +0 -0
  99. /package/src/components/FilterBar/components/{divider → Divider}/Divider.tsx +0 -0
  100. /package/src/components/FilterBar/components/{dates → FilterPanels/Dates}/Dates.css +0 -0
  101. /package/src/components/FilterBar/components/{guests → FilterPanels/Guests}/GuestCount/GuestCount.css +0 -0
  102. /package/src/components/FilterBar/components/{common/FilterSectionHeader.css → FilterPanels/SectionHeader/SectionHeader.css} +0 -0
  103. /package/src/components/FilterBar/components/{cards/image-card → ImageCard}/ImageCard.css +0 -0
  104. /package/src/components/FilterBar/components/{cards/image-card → ImageCard}/ImageCard.tsx +0 -0
  105. /package/src/components/FilterBar/components/{buttons/tab-button → TabButton}/TabButton.css +0 -0
  106. /package/src/components/FilterBar/components/{buttons/tab-button → TabButton}/TabButton.tsx +0 -0
  107. /package/src/core/components/buttons/{close-button → CloseButton}/CloseButton.css +0 -0
  108. /package/src/core/components/buttons/{close-button → CloseButton}/CloseButton.tsx +0 -0
  109. /package/src/core/components/buttons/{submit-button → SubmitButton}/SubmitButton.css +0 -0
  110. /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.10/lib/index.umd.js"></script>
110
+ <script src="https://cdn.jsdelivr.net/npm/willba-component-library@0.3.15/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,8 +1,9 @@
1
+ import React from 'react';
1
2
  type Icon = 'spinner' | 'warning';
2
3
  type Props = {
3
4
  fill?: string;
4
5
  size?: number;
5
6
  icon: Icon;
6
7
  };
7
- export declare const IconsSvg: ({ fill, size, icon }: Props) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const IconsSvg: ({ fill, size, icon }: Props) => React.JSX.Element | null;
8
9
  export {};
@@ -1,4 +1,4 @@
1
- import { MouseEvent } from 'react';
1
+ import React, { MouseEvent } from 'react';
2
2
  import './button.css';
3
3
  export interface ButtonProps {
4
4
  /**
@@ -25,5 +25,5 @@ export interface ButtonProps {
25
25
  /**
26
26
  * Primary UI component for user interaction
27
27
  */
28
- declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
28
+ declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => React.JSX.Element;
29
29
  export default Button;
@@ -1,4 +1,5 @@
1
- import '../../themes/Default.css';
1
+ import React from 'react';
2
2
  import { FilterBarTypes } from './FilterBarTypes';
3
+ import '../../themes/Default.css';
3
4
  import './FilterBar.css';
4
- export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes): import("react/jsx-runtime").JSX.Element;
5
+ export declare const FilterBar: ({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './FilterControls.css';
3
+ export declare const FilterControls: () => 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,3 @@
1
+ import React from 'react';
2
+ import './FilterPanels.css';
3
+ export declare const FilterPanels: () => false | "" | React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { GuestsCountPropsType } from '../../../../FilterBarTypes';
3
+ import './GuestCount.css';
4
+ export declare const GuestCount: FC<GuestsCountPropsType>;
@@ -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,8 @@
1
+ import React, { ReactNode } from 'react';
2
+ import './SectionHeader.css';
3
+ type Props = {
4
+ title: string;
5
+ action?: ReactNode;
6
+ };
7
+ export declare const SectionHeader: ({ title, action }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './FilterTabs.css';
3
+ export declare const FilterTabs: () => false | React.JSX.Element | undefined;
@@ -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,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './SelectButton.css';
2
3
  type Props = {
3
4
  label: string;
@@ -8,5 +9,5 @@ type Props = {
8
9
  ariaExpanded?: boolean;
9
10
  ariaControls?: string;
10
11
  };
11
- export declare const SelectButton: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLButtonElement>>;
12
+ export declare const SelectButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
12
13
  export {};
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './TabButton.css';
2
3
  type Props = {
3
4
  onClick?: () => void;
@@ -5,5 +6,5 @@ type Props = {
5
6
  active?: boolean;
6
7
  mode?: string;
7
8
  };
8
- export declare const TabButton: ({ onClick, label, active, mode }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const TabButton: ({ onClick, label, active, mode }: Props) => React.JSX.Element;
9
10
  export {};
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './ImageCard.css';
2
3
  type Props = {
3
4
  title?: string;
@@ -6,5 +7,5 @@ type Props = {
6
7
  isSelected: boolean;
7
8
  onClick?: () => void;
8
9
  };
9
- export declare const ImageCard: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
10
+ export declare const ImageCard: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
10
11
  export {};
@@ -1,7 +1,8 @@
1
+ import React from 'react';
1
2
  import './Categories.css';
2
3
  type Props = {
3
4
  categories: any;
4
5
  setCategories: any;
5
6
  };
6
- export declare const Categories: ({ categories, setCategories }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Categories: ({ categories, setCategories }: Props) => React.JSX.Element;
7
8
  export {};
@@ -1,8 +1,8 @@
1
- import { ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import './FilterSectionHeader.css';
3
3
  type Props = {
4
4
  title: string;
5
5
  action?: ReactNode;
6
6
  };
7
- export declare const FilterSectionHeader: ({ title, action }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const FilterSectionHeader: ({ title, action }: Props) => React.JSX.Element;
8
8
  export {};
@@ -1,4 +1,4 @@
1
- import { RefObject } from 'react';
1
+ import React, { RefObject } from 'react';
2
2
  import { DateRange } from 'react-day-picker';
3
3
  import { DisableCalendarDates } from '../../../../core/components/calendar/CalendarTypes';
4
4
  import './Dates.css';
@@ -13,5 +13,5 @@ type Props = {
13
13
  language?: string;
14
14
  filtersRef?: RefObject<HTMLDivElement>;
15
15
  };
16
- export declare const Dates: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
16
+ export declare const Dates: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
17
  export {};
@@ -1,2 +1,3 @@
1
+ import React from 'react';
1
2
  import './Divider.css';
2
- export declare const Divider: () => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Divider: () => React.JSX.Element;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { AgeCategoryCount, AgeCategoryType } from '../../FilterBarTypes';
2
3
  import './Guests.css';
3
4
  type Props = {
@@ -7,5 +8,5 @@ type Props = {
7
8
  autoFocus?: boolean;
8
9
  onClose?: () => void;
9
10
  };
10
- export declare const Guests: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
11
+ export declare const Guests: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
11
12
  export {};
@@ -1,5 +1,6 @@
1
- export { CloseButton, SelectButton, SubmitButton, TabButton } from './buttons';
2
- export { Guests } from './guests/Guests';
3
- export { Divider } from './divider/Divider';
4
- export { Categories } from './categories/Categories';
5
- export { Locations } from './locations/Locations';
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,3 +1,4 @@
1
+ import React from 'react';
1
2
  import './Locations.css';
2
3
  import { Location } from '../../FilterBarTypes';
3
4
  type Props = {
@@ -9,5 +10,5 @@ type Props = {
9
10
  multiSelect?: boolean;
10
11
  onClose?: () => void;
11
12
  };
12
- export declare const Locations: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
13
+ export declare const Locations: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
13
14
  export {};
@@ -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 { default } from './FilterBar';
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,3 +1,3 @@
1
1
  export { parseGuests } from './parseGuests';
2
2
  export { parseLocations } from './parseLocations';
3
- export { calculateDropdownPosition } from './calculateDropdownPosition';
3
+ export { ageCategoryRules } from './ageCategoriesRules';
@@ -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: AgeCategoryType[];
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,4 +1,5 @@
1
- import '../../themes/Default.css';
1
+ import React from 'react';
2
2
  import { FilterCalendarTypes } from './FilterCalendarTypes';
3
+ import '../../themes/Default.css';
3
4
  import './FilterCalendar.css';
4
- export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes): import("react/jsx-runtime").JSX.Element;
5
+ export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes): React.JSX.Element;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { DateRange } from 'react-day-picker';
2
3
  import { Palette } from '../../../themes/useTheme';
3
4
  export declare const Footer: ({ calendarHasError, calendarRange, handleClearDates, language, palette, }: {
@@ -6,4 +7,4 @@ export declare const Footer: ({ calendarHasError, calendarRange, handleClearDate
6
7
  handleClearDates: () => void;
7
8
  language?: string;
8
9
  palette: Palette;
9
- }) => import("react/jsx-runtime").JSX.Element;
10
+ }) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './CloseButton.css';
3
+ interface CloseButtonPropsType {
4
+ handleClose: () => void;
5
+ }
6
+ export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) => React.JSX.Element;
7
+ export {};
@@ -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,6 +1,7 @@
1
+ import React from 'react';
1
2
  import './CloseButton.css';
2
3
  interface CloseButtonPropsType {
3
4
  handleClose: () => void;
4
5
  }
5
- export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) => React.JSX.Element;
6
7
  export {};
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { ReactNode } from 'react';
2
3
  import './SubmitButton.css';
3
4
  type SubmitButtonVariant = 'text' | 'full';
@@ -9,5 +10,5 @@ type Props = {
9
10
  isLoading?: boolean;
10
11
  variant?: SubmitButtonVariant;
11
12
  };
12
- export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, variant, }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, variant, }: Props) => React.JSX.Element;
13
14
  export {};
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import { CalendarTypes } from './CalendarTypes';
2
3
  import 'react-day-picker/dist/style.css';
3
4
  import './Calendar.css';
4
- export declare const Calendar: import("react").ForwardRefExoticComponent<CalendarTypes & import("react").RefAttributes<HTMLDivElement>>;
5
+ export declare const Calendar: React.ForwardRefExoticComponent<CalendarTypes & React.RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,5 @@
1
- export { SubmitButton } from './buttons/submit-button/SubmitButton';
2
- export { CloseButton } from './buttons/close-button/CloseButton';
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';