willba-component-library 0.2.9 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/FilterBar/FilterBar.d.ts +2 -15
- package/lib/components/FilterBar/FilterBarTypes.d.ts +14 -3
- package/lib/components/FilterBar/components/buttons/index.d.ts +2 -2
- package/lib/components/FilterBar/components/index.d.ts +0 -1
- package/lib/components/FilterBar/hooks/index.d.ts +0 -2
- package/lib/components/FilterBar/utils/index.d.ts +0 -1
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +5 -0
- package/lib/components/FilterCalendar/FilterCalendar.stories.d.ts +6 -0
- package/lib/components/FilterCalendar/FilterCalendarTypes.d.ts +9 -0
- package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +13 -0
- package/lib/components/FilterCalendar/index.d.ts +2 -0
- package/lib/core/components/buttons/close-button/CloseButton.d.ts +7 -0
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +10 -0
- package/lib/core/components/calendar/Calendar.d.ts +5 -0
- package/lib/core/components/calendar/CalendarTypes.d.ts +15 -0
- package/lib/core/components/index.d.ts +3 -0
- package/lib/core/hooks/index.d.ts +3 -0
- package/lib/core/hooks/useAwaitRender.d.ts +1 -0
- package/lib/core/hooks/useCloseFilterSection.d.ts +8 -0
- package/lib/core/hooks/useUpdateTranslations.d.ts +5 -0
- package/lib/core/utils/index.d.ts +3 -0
- package/lib/core/utils/nightsCount.d.ts +6 -0
- package/lib/core/utils/parseDate.d.ts +6 -0
- package/lib/core/utils/parseDates.d.ts +6 -0
- package/lib/index.d.ts +41 -19
- package/lib/index.esm.js +6144 -6051
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +6141 -6047
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +6141 -6047
- package/lib/index.umd.js.map +1 -1
- package/lib/themes/useTheme.d.ts +4 -4
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +18 -42
- package/src/components/FilterBar/FilterBarTypes.ts +16 -4
- package/src/components/FilterBar/components/buttons/index.ts +3 -2
- package/src/components/FilterBar/components/index.ts +0 -1
- package/src/components/FilterBar/hooks/index.ts +0 -2
- package/src/components/FilterBar/utils/index.tsx +0 -1
- package/src/components/FilterCalendar/FilterCalendar.css +71 -0
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +49 -0
- package/src/components/FilterCalendar/FilterCalendar.tsx +103 -0
- package/src/components/FilterCalendar/FilterCalendarTypes.ts +12 -0
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +28 -0
- package/src/components/FilterCalendar/index.ts +3 -0
- package/src/{components/FilterBar → core}/components/buttons/submit-button/SubmitButton.css +6 -0
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +28 -0
- package/src/{components/FilterBar → core}/components/calendar/Calendar.css +1 -12
- package/src/{components/FilterBar → core}/components/calendar/Calendar.tsx +15 -21
- package/src/core/components/calendar/CalendarTypes.ts +17 -0
- package/src/core/components/index.ts +4 -0
- package/src/core/hooks/index.ts +3 -0
- package/src/core/hooks/useAwaitRender.tsx +12 -0
- package/src/{components/FilterBar → core}/hooks/useCloseFilterSection.tsx +1 -0
- package/src/{components/FilterBar → core}/hooks/useUpdateTranslations.tsx +1 -1
- package/src/core/utils/index.ts +3 -0
- package/src/core/utils/nightsCount.tsx +19 -0
- package/src/core/utils/parseDate.tsx +9 -0
- package/src/i18n.ts +4 -2
- package/src/index.ts +4 -1
- package/src/locales/en/common.json +7 -0
- package/src/locales/en/filterBar.json +0 -3
- package/src/locales/fi/common.json +8 -0
- package/src/locales/fi/filterBar.json +0 -3
- package/src/themes/useTheme.tsx +2 -2
- package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.tsx +0 -18
- /package/src/{components/FilterBar → core}/components/buttons/close-button/CloseButton.css +0 -0
- /package/src/{components/FilterBar → core}/components/buttons/close-button/CloseButton.tsx +0 -0
- /package/src/{components/FilterBar → core}/utils/parseDates.tsx +0 -0
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Palette } from '../../themes/useTheme';
|
|
3
2
|
import '../../themes/Default.css';
|
|
4
|
-
import {
|
|
3
|
+
import { FilterBarProps } from './FilterBarTypes';
|
|
5
4
|
import './FilterBar.css';
|
|
6
|
-
export
|
|
7
|
-
language?: string;
|
|
8
|
-
ageCategories?: AgeCategoryType[];
|
|
9
|
-
redirectUrl?: string;
|
|
10
|
-
palette?: Palette;
|
|
11
|
-
onSubmit?: ((val: Filters) => void) | null;
|
|
12
|
-
fullWidth?: boolean;
|
|
13
|
-
calendarOffset?: CalendarOffset;
|
|
14
|
-
mode?: string;
|
|
15
|
-
defaultTab?: string;
|
|
16
|
-
tabs?: Tab[];
|
|
17
|
-
};
|
|
18
|
-
export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, calendarOffset, mode, tabs, }: FilterBarProps): React.JSX.Element | null;
|
|
5
|
+
export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, calendarOffset, mode, tabs, }: FilterBarProps): React.JSX.Element;
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
import { Palette } from '../../themes/useTheme';
|
|
2
|
+
import { CalendarOffset } from '../../core/components/calendar/CalendarTypes';
|
|
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
|
+
calendarOffset?: CalendarOffset;
|
|
11
|
+
mode?: string;
|
|
12
|
+
defaultTab?: string;
|
|
13
|
+
tabs?: Tab[];
|
|
14
|
+
};
|
|
1
15
|
export type AgeCategoryCount = {
|
|
2
16
|
[categoryId: string]: number;
|
|
3
17
|
};
|
|
@@ -27,9 +41,6 @@ export declare enum Pages {
|
|
|
27
41
|
ROOMS = "/rooms",
|
|
28
42
|
EVENTS = "/events"
|
|
29
43
|
}
|
|
30
|
-
export type CalendarOffset = {
|
|
31
|
-
[key: string]: number;
|
|
32
|
-
};
|
|
33
44
|
type Translations = {
|
|
34
45
|
en: string;
|
|
35
46
|
fi: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CloseButton } from '
|
|
1
|
+
export { CloseButton } from '../../../../core/components/buttons/close-button/CloseButton';
|
|
2
|
+
export { SubmitButton } from '../../../../core/components/buttons/submit-button/SubmitButton';
|
|
2
3
|
export { SelectButton } from './select-button/SelectButton';
|
|
3
|
-
export { SubmitButton } from './submit-button/SubmitButton';
|
|
4
4
|
export { TabButton } from './tab-button/TabButton';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { CloseButton, SelectButton, SubmitButton, TabButton } from './buttons';
|
|
2
2
|
export { Guests } from './guests/Guests';
|
|
3
|
-
export { Calendar } from './calendar/Calendar';
|
|
4
3
|
export { Divider } from './divider/Divider';
|
|
5
4
|
export { Categories } from './categories/Categories';
|
|
@@ -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, calendarOffsetGroup, toggleCalendar, setToggleCalendar, }: FilterCalendarTypes): React.JSX.Element;
|
|
@@ -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,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
3
|
+
type Props = {
|
|
4
|
+
onSubmit: (val: any) => void;
|
|
5
|
+
setToggleCalendar: (val: boolean) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const useFilterCalendar: ({ onSubmit, setToggleCalendar }: Props) => {
|
|
8
|
+
handleSubmit: () => void;
|
|
9
|
+
handleClearDates: () => void;
|
|
10
|
+
setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
|
|
11
|
+
calendarRange: DateRange | undefined;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
};
|
|
9
|
+
export declare const SubmitButton: ({ onClick, startIcon, label, disabled, }: Props) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DateRange } from 'react-day-picker';
|
|
2
|
+
export type CalendarOffset = {
|
|
3
|
+
[key: string]: number;
|
|
4
|
+
};
|
|
5
|
+
export type CalendarTypes = {
|
|
6
|
+
calendarRange?: DateRange | undefined;
|
|
7
|
+
setCalendarRange: (range: DateRange | undefined) => void;
|
|
8
|
+
calendarOffset?: CalendarOffset;
|
|
9
|
+
selectedPath?: string;
|
|
10
|
+
language?: string;
|
|
11
|
+
calendarOffsetGroup?: {
|
|
12
|
+
from: Date;
|
|
13
|
+
to: Date;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAwaitRender: () => null | undefined;
|
|
@@ -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 {};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { DateRange } from 'react-day-picker';
|
|
2
3
|
|
|
3
4
|
interface ButtonProps {
|
|
4
5
|
/**
|
|
@@ -27,11 +28,38 @@ interface ButtonProps {
|
|
|
27
28
|
*/
|
|
28
29
|
declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => React.JSX.Element;
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
type Palette = {
|
|
31
32
|
primary: string;
|
|
32
33
|
secondary: string;
|
|
33
|
-
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type CalendarOffset = {
|
|
37
|
+
[key: string]: number;
|
|
38
|
+
};
|
|
39
|
+
type CalendarTypes = {
|
|
40
|
+
calendarRange?: DateRange | undefined;
|
|
41
|
+
setCalendarRange: (range: DateRange | undefined) => void;
|
|
42
|
+
calendarOffset?: CalendarOffset;
|
|
43
|
+
selectedPath?: string;
|
|
44
|
+
language?: string;
|
|
45
|
+
calendarOffsetGroup?: {
|
|
46
|
+
from: Date;
|
|
47
|
+
to: Date;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
34
50
|
|
|
51
|
+
type FilterBarProps = {
|
|
52
|
+
language?: string;
|
|
53
|
+
ageCategories?: AgeCategoryType[];
|
|
54
|
+
redirectUrl?: string;
|
|
55
|
+
palette?: Palette;
|
|
56
|
+
onSubmit?: ((val: Filters) => void) | null;
|
|
57
|
+
fullWidth?: boolean;
|
|
58
|
+
calendarOffset?: CalendarOffset;
|
|
59
|
+
mode?: string;
|
|
60
|
+
defaultTab?: string;
|
|
61
|
+
tabs?: Tab[];
|
|
62
|
+
};
|
|
35
63
|
type AgeCategoryType = {
|
|
36
64
|
id: string;
|
|
37
65
|
name: string;
|
|
@@ -41,9 +69,6 @@ type AgeCategoryType = {
|
|
|
41
69
|
type Filters = {
|
|
42
70
|
[key: string]: string;
|
|
43
71
|
};
|
|
44
|
-
type CalendarOffset = {
|
|
45
|
-
[key: string]: number;
|
|
46
|
-
};
|
|
47
72
|
type Translations = {
|
|
48
73
|
en: string;
|
|
49
74
|
fi: string;
|
|
@@ -56,18 +81,15 @@ type Tab = {
|
|
|
56
81
|
label?: Translations;
|
|
57
82
|
};
|
|
58
83
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
tabs?: Tab[];
|
|
70
|
-
};
|
|
71
|
-
declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, calendarOffset, mode, tabs, }: FilterBarProps): React.JSX.Element | null;
|
|
84
|
+
declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, calendarOffset, mode, tabs, }: FilterBarProps): React.JSX.Element;
|
|
85
|
+
|
|
86
|
+
interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
87
|
+
palette: Palette;
|
|
88
|
+
onSubmit: (val: DateRange) => void;
|
|
89
|
+
toggleCalendar: boolean;
|
|
90
|
+
setToggleCalendar: (val: boolean) => void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit, calendarOffsetGroup, toggleCalendar, setToggleCalendar, }: FilterCalendarTypes): React.JSX.Element;
|
|
72
94
|
|
|
73
|
-
export { Button, FilterBar, Tab };
|
|
95
|
+
export { Button, FilterBar, FilterCalendar, FilterCalendarTypes, Tab };
|