willba-component-library 0.2.78 → 0.2.80

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 (107) hide show
  1. package/lib/assets/IconsSvg.d.ts +9 -0
  2. package/lib/assets/SpinnerSvg.d.ts +5 -0
  3. package/lib/components/Button/Button.d.ts +29 -0
  4. package/lib/components/Button/Button.stories.d.ts +7 -0
  5. package/lib/components/Button/index.d.ts +1 -0
  6. package/lib/components/FilterBar/FilterBar.d.ts +5 -0
  7. package/lib/components/FilterBar/FilterBar.stories.d.ts +6 -0
  8. package/lib/components/FilterBar/FilterBarTypes.d.ts +56 -0
  9. package/lib/components/FilterBar/components/buttons/close-button/CloseButton.d.ts +7 -0
  10. package/lib/components/FilterBar/components/buttons/index.d.ts +4 -0
  11. package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +10 -0
  12. package/lib/components/FilterBar/components/buttons/submit-button/SubmitButton.d.ts +3 -0
  13. package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +10 -0
  14. package/lib/components/FilterBar/components/calendar/Calendar.d.ts +14 -0
  15. package/lib/components/FilterBar/components/categories/Categories.d.ts +8 -0
  16. package/lib/components/FilterBar/components/divider/Divider.d.ts +3 -0
  17. package/lib/components/FilterBar/components/guests/GuestCount/GuestCount.d.ts +4 -0
  18. package/lib/components/FilterBar/components/guests/Guests.d.ts +10 -0
  19. package/lib/components/FilterBar/components/index.d.ts +4 -0
  20. package/lib/components/FilterBar/hooks/index.d.ts +2 -0
  21. package/lib/components/FilterBar/hooks/useCloseFilterSection.d.ts +8 -0
  22. package/lib/components/FilterBar/hooks/useFilterBar.d.ts +27 -0
  23. package/lib/components/FilterBar/hooks/useScrollInToView.d.ts +9 -0
  24. package/lib/components/FilterBar/hooks/useUpdateTranslations.d.ts +5 -0
  25. package/lib/components/FilterBar/index.d.ts +2 -0
  26. package/lib/components/FilterBar/utils/index.d.ts +1 -0
  27. package/lib/components/FilterBar/utils/parseDates.d.ts +6 -0
  28. package/lib/components/FilterBar/utils/parseGuests.d.ts +17 -0
  29. package/lib/components/FilterCalendar/FilterCalendar.d.ts +5 -0
  30. package/lib/components/FilterCalendar/FilterCalendar.stories.d.ts +6 -0
  31. package/lib/components/FilterCalendar/FilterCalendarTypes.d.ts +9 -0
  32. package/lib/components/FilterCalendar/components/Footer.d.ts +10 -0
  33. package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +21 -0
  34. package/lib/components/FilterCalendar/index.d.ts +2 -0
  35. package/lib/core/components/buttons/close-button/CloseButton.d.ts +7 -0
  36. package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +11 -0
  37. package/lib/core/components/calendar/Calendar.d.ts +5 -0
  38. package/lib/core/components/calendar/CalendarTypes.d.ts +39 -0
  39. package/{src/core/components/calendar/hooks/index.ts → lib/core/components/calendar/hooks/index.d.ts} +3 -3
  40. package/lib/core/components/calendar/hooks/useCalendarLoadingSpinner.d.ts +5 -0
  41. package/lib/core/components/calendar/hooks/useCalendarTooltips.d.ts +5 -0
  42. package/lib/core/components/calendar/hooks/useUpdateDisabledDates.d.ts +14 -0
  43. package/lib/core/components/calendar/utils/calendarSelectionRules.d.ts +15 -0
  44. package/lib/core/components/calendar/utils/checkForContinuousSelection.d.ts +11 -0
  45. package/lib/core/components/calendar/utils/disabledDatesByPage.d.ts +9 -0
  46. package/lib/core/components/calendar/utils/handleCalendarModifiers.d.ts +47 -0
  47. package/lib/core/components/calendar/utils/handleRangeContextDisabledDates.d.ts +27 -0
  48. package/{src/core/components/calendar/utils/index.ts → lib/core/components/calendar/utils/index.d.ts} +8 -8
  49. package/lib/core/components/calendar/utils/nightsCount.d.ts +6 -0
  50. package/lib/core/components/calendar/utils/parseDate.d.ts +7 -0
  51. package/lib/core/components/calendar/utils/parseDates.d.ts +6 -0
  52. package/lib/core/components/index.d.ts +3 -0
  53. package/lib/core/hooks/index.d.ts +3 -0
  54. package/lib/core/hooks/useAwaitRender.d.ts +1 -0
  55. package/lib/core/hooks/useCloseFilterSection.d.ts +8 -0
  56. package/lib/core/hooks/useUpdateTranslations.d.ts +5 -0
  57. package/lib/core/utils/handleOverlappingDates.d.ts +1 -0
  58. package/lib/core/utils/index.d.ts +3 -0
  59. package/lib/core/utils/nightsCount.d.ts +6 -0
  60. package/lib/core/utils/parseDate.d.ts +7 -0
  61. package/lib/core/utils/parseDates.d.ts +6 -0
  62. package/lib/i18n.d.ts +2 -0
  63. package/lib/index.d.ts +119 -0
  64. package/lib/index.esm.js +11576 -0
  65. package/lib/index.esm.js.map +1 -0
  66. package/lib/index.js +11598 -0
  67. package/lib/index.js.map +1 -0
  68. package/lib/index.umd.js +11602 -0
  69. package/lib/index.umd.js.map +1 -0
  70. package/lib/themes/useTheme.d.ts +13 -0
  71. package/package.json +1 -1
  72. package/src/assets/SpinnerSvg.tsx +40 -0
  73. package/src/components/FilterBar/FilterBar.stories.tsx +1 -2
  74. package/src/components/FilterBar/FilterBar.tsx +1 -1
  75. package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +1 -1
  76. package/src/components/FilterBar/hooks/useFilterBar.tsx +1 -1
  77. package/src/components/FilterCalendar/FilterCalendar.css +10 -26
  78. package/src/components/FilterCalendar/FilterCalendar.stories.tsx +153 -522
  79. package/src/components/FilterCalendar/FilterCalendar.tsx +54 -25
  80. package/src/components/FilterCalendar/FilterCalendarTypes.ts +1 -0
  81. package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +4 -94
  82. package/src/core/components/buttons/submit-button/SubmitButton.css +2 -16
  83. package/src/core/components/buttons/submit-button/SubmitButton.tsx +5 -6
  84. package/src/core/components/calendar/Calendar.css +18 -71
  85. package/src/core/components/calendar/Calendar.tsx +342 -132
  86. package/src/core/components/calendar/CalendarTypes.ts +3 -10
  87. package/src/core/utils/index.ts +3 -0
  88. package/src/locales/en/common.json +1 -7
  89. package/src/locales/en/filterBar.json +1 -2
  90. package/src/locales/fi/common.json +1 -7
  91. package/src/locales/fi/filterBar.json +1 -2
  92. package/src/themes/Default.css +3 -12
  93. package/src/themes/useTheme.tsx +0 -3
  94. package/src/assets/IconsSvg.tsx +0 -68
  95. package/src/components/FilterCalendar/components/Footer.tsx +0 -96
  96. package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +0 -19
  97. package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +0 -125
  98. package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +0 -107
  99. package/src/core/components/calendar/utils/calendarSelectionRules.tsx +0 -228
  100. package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +0 -86
  101. package/src/core/components/calendar/utils/disabledDatesByPage.tsx +0 -36
  102. package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +0 -147
  103. package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +0 -75
  104. package/willba-component-library-0.2.77.tgz +0 -0
  105. /package/src/core/{components/calendar/utils → utils}/nightsCount.tsx +0 -0
  106. /package/src/core/{components/calendar/utils → utils}/parseDate.tsx +0 -0
  107. /package/src/core/{components/calendar/utils → utils}/parseDates.tsx +0 -0
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ type Icon = 'spinner' | 'warning';
3
+ type Props = {
4
+ fill?: string;
5
+ size?: number;
6
+ icon: Icon;
7
+ };
8
+ export declare const IconsSvg: ({ fill, size, icon }: Props) => React.JSX.Element | undefined;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const SpinnerSVG: ({ fill, size, }: {
3
+ fill?: string | undefined;
4
+ size?: number | undefined;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import "./button.css";
3
+ export interface ButtonProps {
4
+ /**
5
+ * Is this the principal call to action on the page?
6
+ */
7
+ type?: "primary" | "secondary";
8
+ /**
9
+ * What background color to use
10
+ */
11
+ textColor?: string;
12
+ /**
13
+ * How large should the button be?
14
+ */
15
+ size?: "small" | "medium" | "large";
16
+ /**
17
+ * Button contents
18
+ */
19
+ label: string;
20
+ /**
21
+ * Optional click handler
22
+ */
23
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
24
+ }
25
+ /**
26
+ * Primary UI component for user interaction
27
+ */
28
+ declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => React.JSX.Element;
29
+ export default Button;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Button from "./Button";
3
+ declare const meta: Meta<typeof Button>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Button>;
6
+ export declare const Primary: Story;
7
+ export declare const Secondary: Story;
@@ -0,0 +1 @@
1
+ export { default } from "./Button";
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import '../../themes/Default.css';
3
+ import { FilterBarProps } from './FilterBarTypes';
4
+ import './FilterBar.css';
5
+ export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, }: FilterBarProps): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import FilterBar from './FilterBar';
3
+ declare const meta: Meta<typeof FilterBar>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof FilterBar>;
6
+ export declare const Primary: Story;
@@ -0,0 +1,56 @@
1
+ import { DisableCalendarDates } from '../../core/components/calendar/CalendarTypes';
2
+ import { Palette } from '../../themes/useTheme';
3
+ export type FilterBarProps = {
4
+ language?: string;
5
+ ageCategories?: AgeCategoryType[];
6
+ redirectUrl?: string;
7
+ palette?: Palette;
8
+ onSubmit?: ((val: Filters) => void) | null;
9
+ fullWidth?: boolean;
10
+ disableCalendarDates?: DisableCalendarDates;
11
+ mode?: string;
12
+ defaultTab?: string;
13
+ tabs?: Tab[];
14
+ outerLoading?: boolean;
15
+ };
16
+ export type AgeCategoryCount = {
17
+ [categoryId: string]: number;
18
+ };
19
+ export type AgeCategoryType = {
20
+ id: string;
21
+ name: string;
22
+ minVal: number;
23
+ sortOrder: number;
24
+ };
25
+ export type GuestsCountPropsType = {
26
+ label: string;
27
+ id: number;
28
+ updateGuestsCount: (arg1: string, arg2: number) => void;
29
+ count: number;
30
+ minVal: number;
31
+ sortOrder: number;
32
+ };
33
+ export declare enum FilterSections {
34
+ CALENDAR = "calendar",
35
+ GUESTS = "guests",
36
+ CATEGORIES = "categories"
37
+ }
38
+ export type Filters = {
39
+ [key: string]: string;
40
+ };
41
+ export declare enum Pages {
42
+ ROOMS = "/rooms",
43
+ EVENTS = "/events"
44
+ }
45
+ type Translations = {
46
+ en: string;
47
+ fi: string;
48
+ [key: string]: string;
49
+ };
50
+ export type Tab = {
51
+ path: string;
52
+ default?: boolean;
53
+ order: number;
54
+ label?: Translations;
55
+ };
56
+ export {};
@@ -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,4 @@
1
+ export { CloseButton } from '../../../../core/components/buttons/close-button/CloseButton';
2
+ export { SubmitButton } from '../../../../core/components/buttons/submit-button/SubmitButton';
3
+ export { SelectButton } from './select-button/SelectButton';
4
+ export { TabButton } from './tab-button/TabButton';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './SelectButton.css';
3
+ type Props = {
4
+ label: string;
5
+ onClick: () => void;
6
+ description: string;
7
+ active?: boolean;
8
+ };
9
+ export declare const SelectButton: ({ active, label, onClick, description, }: Props) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './SubmitButton.css';
3
+ export declare const SubmitButton: ({ onClick }: any) => React.JSX.Element;
@@ -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 {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { DateRange } from 'react-day-picker';
3
+ import { CalendarOffset } from '../../FilterBarTypes';
4
+ import 'react-day-picker/dist/style.css';
5
+ import './Calendar.css';
6
+ type Props = {
7
+ calendarRange: DateRange | undefined;
8
+ setCalendarRange: (range: DateRange | undefined) => void;
9
+ calendarOffset?: CalendarOffset;
10
+ selectedPath: string;
11
+ locale?: string;
12
+ };
13
+ export declare const Calendar: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './Categories.css';
3
+ type Props = {
4
+ categories: any;
5
+ setCategories: any;
6
+ };
7
+ export declare const Categories: ({ categories, setCategories }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './Divider.css';
3
+ export declare const Divider: () => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { GuestsCountPropsType } from '../../../FilterBarTypes';
3
+ import './GuestCount.css';
4
+ export default function GuestCount({ label, sortOrder, id, updateGuestsCount, count, minVal, }: GuestsCountPropsType): React.JSX.Element;
@@ -0,0 +1,10 @@
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
+ };
9
+ export declare const Guests: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
10
+ export {};
@@ -0,0 +1,4 @@
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';
@@ -0,0 +1,2 @@
1
+ export { useFilterBar } from './useFilterBar';
2
+ export { useScrollInToView } from './useScrollInToView';
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ handleSelectedFilter: (arg: boolean) => void;
4
+ };
5
+ export declare const useCloseFilterSection: ({ handleSelectedFilter }: Props) => {
6
+ filtersRef: import("react").MutableRefObject<HTMLDivElement | null>;
7
+ };
8
+ export {};
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ import { DateRange } from 'react-day-picker';
3
+ import { AgeCategoryCount, AgeCategoryType, Filters, Tab } from '../FilterBarTypes';
4
+ type Props = {
5
+ redirectUrl?: string;
6
+ ageCategories?: AgeCategoryType[];
7
+ onSubmit?: ((val: Filters) => void) | null;
8
+ tabs?: Tab[];
9
+ };
10
+ export declare const useFilterBar: ({ redirectUrl, ageCategories, onSubmit, tabs, }: Props) => {
11
+ selectedFilter: string | boolean;
12
+ ageCategoryCounts: AgeCategoryCount;
13
+ categories: number;
14
+ calendarRange: DateRange | undefined;
15
+ selectedPath: string;
16
+ innerLoading: boolean;
17
+ setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
18
+ setSelectedFilter: import("react").Dispatch<import("react").SetStateAction<string | boolean>>;
19
+ setAgeCategoryCounts: import("react").Dispatch<import("react").SetStateAction<AgeCategoryCount>>;
20
+ setCategories: import("react").Dispatch<import("react").SetStateAction<number>>;
21
+ handleSelectedFilter: (id: string | boolean) => void;
22
+ handleSubmit: () => void;
23
+ updateGuestsCount: (id: string, newCount: number) => void;
24
+ handleResetFilters: () => void;
25
+ setSelectedPath: import("react").Dispatch<import("react").SetStateAction<string>>;
26
+ };
27
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ selectedFilter: string | boolean;
4
+ };
5
+ export declare const useScrollInToView: ({ selectedFilter }: Props) => {
6
+ isMobile: boolean;
7
+ targetFilterBarRef: import("react").MutableRefObject<HTMLDivElement | null>;
8
+ };
9
+ export {};
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ language?: string;
3
+ };
4
+ export declare const useUpdateTranslations: ({ language }: Props) => void;
5
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './FilterBar';
2
+ export * from './FilterBarTypes';
@@ -0,0 +1 @@
1
+ export { parseGuests } from './parseGuests';
@@ -0,0 +1,6 @@
1
+ import { DateRange } from 'react-day-picker';
2
+ type Props = {
3
+ calendarRange?: DateRange;
4
+ };
5
+ export declare const parseDates: ({ calendarRange }: Props) => string | null;
6
+ export {};
@@ -0,0 +1,17 @@
1
+ import { AgeCategoryCount, AgeCategoryType } from '../FilterBarTypes';
2
+ type Props = {
3
+ ageCategoryCounts: AgeCategoryCount;
4
+ ageCategories: AgeCategoryType[];
5
+ guestLabel: string;
6
+ guestsLabel: string;
7
+ guestsPlaceholder: string;
8
+ };
9
+ type AccType = {
10
+ total: number;
11
+ html: string[];
12
+ };
13
+ export declare const parseGuests: ({ guestLabel, guestsLabel, guestsPlaceholder, ageCategoryCounts, ageCategories, }: Props) => {
14
+ content: string;
15
+ data: AccType;
16
+ };
17
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import '../../themes/Default.css';
3
+ import { FilterCalendarTypes } from './FilterCalendarTypes';
4
+ import './FilterCalendar.css';
5
+ export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, }: FilterCalendarTypes): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import FilterCalendar from './FilterCalendar';
3
+ declare const meta: Meta<typeof FilterCalendar>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof FilterCalendar>;
6
+ export declare const Primary: Story;
@@ -0,0 +1,9 @@
1
+ import { DateRange } from 'react-day-picker';
2
+ import { Palette } from '../../themes/useTheme';
3
+ import { CalendarTypes } from '../../core/components/calendar/CalendarTypes';
4
+ export interface FilterCalendarTypes extends Partial<CalendarTypes> {
5
+ palette: Palette;
6
+ onSubmit: (val: DateRange) => void;
7
+ toggleCalendar: boolean;
8
+ setToggleCalendar: (val: boolean) => void;
9
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { DateRange } from 'react-day-picker';
3
+ import { Palette } from '../../../themes/useTheme';
4
+ export declare const Footer: ({ calendarHasError, calendarRange, handleClearDates, language, palette, }: {
5
+ calendarHasError: boolean;
6
+ calendarRange?: DateRange | undefined;
7
+ handleClearDates: () => void;
8
+ language?: string | undefined;
9
+ palette: Palette;
10
+ }) => React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { DateRange, Matcher } from 'react-day-picker';
3
+ type Props = {
4
+ onSubmit: (val: any) => void;
5
+ setToggleCalendar: (val: boolean) => void;
6
+ noActiveSelection?: boolean;
7
+ toggleCalendar?: boolean;
8
+ };
9
+ export declare const useFilterCalendar: ({ onSubmit, setToggleCalendar, noActiveSelection, toggleCalendar, }: Props) => {
10
+ handleSubmit: () => void;
11
+ handleClearDates: () => void;
12
+ setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
13
+ setDisabledDates: import("react").Dispatch<import("react").SetStateAction<Matcher[]>>;
14
+ setUpdateCalendarMonthNavigation: import("react").Dispatch<import("react").SetStateAction<boolean>>;
15
+ calendarRange: DateRange | undefined;
16
+ disabledDates: Matcher[];
17
+ updateCalendarMonthNavigation: boolean;
18
+ updateCalendarDefaultMoth: number;
19
+ initialCalendarRange: DateRange | undefined;
20
+ };
21
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './FilterCalendar';
2
+ export * from './FilterCalendarTypes';
@@ -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,11 @@
1
+ import React, { ReactNode } from 'react';
2
+ import './SubmitButton.css';
3
+ type Props = {
4
+ onClick?: () => void;
5
+ startIcon?: ReactNode;
6
+ label?: string;
7
+ disabled?: boolean;
8
+ isLoading?: boolean;
9
+ };
10
+ export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, }: Props) => React.JSX.Element;
11
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CalendarTypes } from './CalendarTypes';
3
+ import 'react-day-picker/dist/style.css';
4
+ import './Calendar.css';
5
+ export declare const Calendar: React.ForwardRefExoticComponent<CalendarTypes & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,39 @@
1
+ import { DateRange, Matcher } from 'react-day-picker';
2
+ import { Palette } from '../../../themes/useTheme';
3
+ export type CalendarOffset = {
4
+ [key: string]: number;
5
+ };
6
+ export type DisableCalendarDates = {
7
+ availableDates?: {
8
+ checkIn: Date;
9
+ firstCheckOut: Date;
10
+ lastCheckOut: Date;
11
+ }[];
12
+ disabledDates?: {
13
+ to: Date;
14
+ from: Date;
15
+ }[];
16
+ disabledDatesByPage?: {
17
+ page: string;
18
+ offset: number;
19
+ }[];
20
+ };
21
+ export type CalendarTypes = {
22
+ calendarRange?: DateRange | undefined;
23
+ setCalendarRange: (range: DateRange | undefined) => void;
24
+ calendarOffset?: CalendarOffset;
25
+ selectedPath?: string;
26
+ language?: string;
27
+ disableCalendarDates?: DisableCalendarDates;
28
+ requestDates?: (val: Date) => void;
29
+ disabledDates?: Matcher[];
30
+ setDisabledDates?: (arg: Matcher[]) => void;
31
+ loadingData?: boolean;
32
+ initialCalendarRange?: DateRange | undefined;
33
+ showFeedback?: boolean;
34
+ noActiveSelection?: boolean;
35
+ palette?: Palette;
36
+ updateCalendarMonthNavigation?: boolean;
37
+ setUpdateCalendarMonthNavigation?: (arg: (prev: boolean) => boolean) => void;
38
+ updateCalendarDefaultMoth?: number;
39
+ };
@@ -1,3 +1,3 @@
1
- export { useCalendarTooltips } from './useCalendarTooltips'
2
- export { useCalendarLoadingSpinner } from './useCalendarLoadingSpinner'
3
- export { useUpdateDisabledDates } from './useUpdateDisabledDates'
1
+ export { useCalendarTooltips } from './useCalendarTooltips';
2
+ export { useCalendarLoadingSpinner } from './useCalendarLoadingSpinner';
3
+ export { useUpdateDisabledDates } from './useUpdateDisabledDates';
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ loadingData?: boolean;
3
+ };
4
+ export declare const useCalendarLoadingSpinner: ({ loadingData }: Props) => void;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ showFeedback?: boolean;
3
+ };
4
+ export declare const useCalendarTooltips: ({ showFeedback }: Props) => void;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ import { DateRange, Matcher } from 'react-day-picker';
2
+ import { DisableCalendarDates } from '../CalendarTypes';
3
+ type Props = {
4
+ disableCalendarDates?: DisableCalendarDates;
5
+ calendarRange?: DateRange;
6
+ updateCalendarMonthNavigation?: boolean;
7
+ updateCalendarDefaultMonth?: number;
8
+ };
9
+ export declare const useUpdateDisabledDates: ({ disableCalendarDates, calendarRange, updateCalendarMonthNavigation, updateCalendarDefaultMonth, }: Props) => {
10
+ newDisableCalendarDates: DisableCalendarDates | undefined;
11
+ overlappingDate: DateRange[] | undefined;
12
+ lastPossibleCheckout: Matcher;
13
+ };
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import { DateRange, Matcher } from 'react-day-picker';
2
+ import { DisableCalendarDates, RangeContext } from '../CalendarTypes';
3
+ type Props = {
4
+ range: DateRange | undefined;
5
+ newDisableCalendarDates?: DisableCalendarDates;
6
+ setCalendarRange: (range: DateRange | undefined) => void;
7
+ setDisabledDates?: (arg: Matcher[]) => void;
8
+ setCalendarHasError?: (arg: boolean) => void;
9
+ calendarRange?: DateRange;
10
+ overlappingDate?: DateRange[];
11
+ calendarHasError?: boolean;
12
+ rangeContext?: RangeContext;
13
+ };
14
+ export declare const calendarSelectionRules: ({ range, newDisableCalendarDates, setCalendarRange, setDisabledDates, calendarRange, overlappingDate, setCalendarHasError, rangeContext, }: Props) => void;
15
+ export {};
@@ -0,0 +1,11 @@
1
+ import { DateRange } from 'react-day-picker';
2
+ import { DisableCalendarDates, RangeContext } from '../CalendarTypes';
3
+ type Props = {
4
+ setCalendarHasError?: (arg: boolean) => void;
5
+ rangeContext?: RangeContext;
6
+ calendarRange?: DateRange;
7
+ calendarHasError?: boolean;
8
+ disabledDates?: DisableCalendarDates['disabledDates'];
9
+ };
10
+ export declare const checkForContinuousSelection: ({ setCalendarHasError, rangeContext, calendarRange, calendarHasError, disabledDates, }: Props) => void;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { DisableCalendarDates } from '../CalendarTypes';
2
+ export declare const disabledDatesByPage: ({ newDisableCalendarDates, selectedPath, today, }: {
3
+ newDisableCalendarDates?: DisableCalendarDates | undefined;
4
+ selectedPath?: string | undefined;
5
+ today: Date;
6
+ }) => {
7
+ from: Date;
8
+ to: Date;
9
+ }[];
@@ -0,0 +1,47 @@
1
+ import { DateRange, Matcher } from 'react-day-picker';
2
+ import { DisableCalendarDates, RangeContext } from '../CalendarTypes';
3
+ type Props = {
4
+ newDisableCalendarDates?: DisableCalendarDates;
5
+ calendarRange?: DateRange;
6
+ disabledDatesByPage: {
7
+ from: Date;
8
+ to: Date;
9
+ }[];
10
+ disabledDates?: Matcher[];
11
+ lastPossibleCheckout?: Matcher;
12
+ overlappingDate?: DateRange[];
13
+ rangeContext?: RangeContext;
14
+ findFirstPossibleRangeContextCheckIn?: NonNullable<DisableCalendarDates['availableDates']>['0'];
15
+ findLastPossibleRangeContextCheckOut?: NonNullable<DisableCalendarDates['availableDates']>['0'];
16
+ firstPossibleRangeContextCheckIn: Matcher[];
17
+ lastPossibleRangeContextCheckOut: Matcher[];
18
+ currentSelectionLastCheckoutDate?: NonNullable<DisableCalendarDates['availableDates']>['0'];
19
+ };
20
+ export declare const handleCalendarModifiers: ({ newDisableCalendarDates, calendarRange, disabledDatesByPage, disabledDates, overlappingDate, rangeContext, firstPossibleRangeContextCheckIn, lastPossibleRangeContextCheckOut, findFirstPossibleRangeContextCheckIn, findLastPossibleRangeContextCheckOut, currentSelectionLastCheckoutDate, lastPossibleCheckout, }: Props) => {
21
+ booked: Matcher[];
22
+ disabledAfterCheckIn: {
23
+ after: Date;
24
+ }[];
25
+ overlappingDate: {
26
+ from: Date | undefined;
27
+ }[];
28
+ noActiveSelectionStart: never[] | Date;
29
+ noActiveSelectionMid: (never[] | {
30
+ after: Date;
31
+ before: Date;
32
+ })[];
33
+ noActiveSelectionEnd: never[] | Date;
34
+ checkoutOptionsMid: {
35
+ after: Date;
36
+ before: Date;
37
+ }[];
38
+ checkInOnly: {
39
+ from: Date;
40
+ to: Date;
41
+ }[];
42
+ checkOutOnly: {
43
+ from: Date;
44
+ to: Date;
45
+ }[];
46
+ };
47
+ export {};
@@ -0,0 +1,27 @@
1
+ import { DateRange, Matcher } from 'react-day-picker';
2
+ import { DisableCalendarDates, RangeContext } from '../CalendarTypes';
3
+ type Props = {
4
+ rangeContext?: RangeContext;
5
+ availableDates?: DisableCalendarDates['availableDates'];
6
+ calendarRange?: DateRange;
7
+ };
8
+ export declare const handleRangeContextDisabledDates: ({ rangeContext, availableDates, calendarRange, }: Props) => {
9
+ findFirstPossibleRangeContextCheckIn: {
10
+ checkIn: Date;
11
+ firstCheckOut: Date;
12
+ lastCheckOut: Date;
13
+ } | undefined;
14
+ findLastPossibleRangeContextCheckOut: {
15
+ checkIn: Date;
16
+ firstCheckOut: Date;
17
+ lastCheckOut: Date;
18
+ } | undefined;
19
+ firstPossibleRangeContextCheckIn: Matcher[];
20
+ lastPossibleRangeContextCheckOut: Matcher[];
21
+ currentSelectionLastCheckoutDate: {
22
+ checkIn: Date;
23
+ firstCheckOut: Date;
24
+ lastCheckOut: Date;
25
+ } | undefined;
26
+ };
27
+ export {};
@@ -1,8 +1,8 @@
1
- export { parseDates } from './parseDates'
2
- export { parseDate } from './parseDate'
3
- export { nightsCount } from './nightsCount'
4
- export { calendarSelectionRules } from './calendarSelectionRules'
5
- export { disabledDatesByPage } from './disabledDatesByPage'
6
- export { handleCalendarModifiers } from './handleCalendarModifiers'
7
- export { handleRangeContextDisabledDates } from './handleRangeContextDisabledDates'
8
- export { checkForContinuousSelection } from './checkForContinuousSelection'
1
+ export { parseDates } from './parseDates';
2
+ export { parseDate } from './parseDate';
3
+ export { nightsCount } from './nightsCount';
4
+ export { calendarSelectionRules } from './calendarSelectionRules';
5
+ export { disabledDatesByPage } from './disabledDatesByPage';
6
+ export { handleCalendarModifiers } from './handleCalendarModifiers';
7
+ export { handleRangeContextDisabledDates } from './handleRangeContextDisabledDates';
8
+ export { checkForContinuousSelection } from './checkForContinuousSelection';
@@ -0,0 +1,6 @@
1
+ import { DateRange } from 'react-day-picker';
2
+ type Props = {
3
+ calendarRange?: DateRange;
4
+ };
5
+ export declare const nightsCount: ({ calendarRange }: Props) => number | undefined;
6
+ export {};