willba-component-library 0.2.14 → 0.2.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/lib/components/FilterBar/FilterBar.d.ts +1 -1
- package/lib/components/FilterBar/FilterBarTypes.d.ts +2 -2
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
- package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +5 -1
- package/lib/core/components/calendar/Calendar.d.ts +1 -1
- package/lib/core/components/calendar/CalendarTypes.d.ts +22 -5
- package/lib/index.d.ts +30 -13
- package/lib/index.esm.js +225 -72
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +225 -72
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +225 -72
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +11 -3
- package/src/components/FilterBar/FilterBar.tsx +2 -2
- package/src/components/FilterBar/FilterBarTypes.ts +2 -2
- package/src/components/FilterBar/components/divider/Divider.css +2 -2
- package/src/components/FilterCalendar/FilterCalendar.css +13 -2
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +861 -20
- package/src/components/FilterCalendar/FilterCalendar.tsx +24 -6
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +29 -3
- package/src/core/components/calendar/Calendar.css +50 -11
- package/src/core/components/calendar/Calendar.tsx +238 -78
- package/src/core/components/calendar/CalendarTypes.ts +20 -5
- package/src/locales/en/common.json +5 -1
- package/src/locales/en/filterBar.json +4 -2
- package/src/locales/fi/common.json +5 -1
- package/src/locales/fi/filterBar.json +6 -2
- package/src/themes/Default.css +3 -1
|
@@ -2,4 +2,4 @@ import React from 'react';
|
|
|
2
2
|
import '../../themes/Default.css';
|
|
3
3
|
import { FilterBarProps } from './FilterBarTypes';
|
|
4
4
|
import './FilterBar.css';
|
|
5
|
-
export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth,
|
|
5
|
+
export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, }: FilterBarProps): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DisableCalendarDates } from '../../core/components/calendar/CalendarTypes';
|
|
1
2
|
import { Palette } from '../../themes/useTheme';
|
|
2
|
-
import { CalendarOffset } from '../../core/components/calendar/CalendarTypes';
|
|
3
3
|
export type FilterBarProps = {
|
|
4
4
|
language?: string;
|
|
5
5
|
ageCategories?: AgeCategoryType[];
|
|
@@ -7,7 +7,7 @@ export type FilterBarProps = {
|
|
|
7
7
|
palette?: Palette;
|
|
8
8
|
onSubmit?: ((val: Filters) => void) | null;
|
|
9
9
|
fullWidth?: boolean;
|
|
10
|
-
|
|
10
|
+
disableCalendarDates?: DisableCalendarDates;
|
|
11
11
|
mode?: string;
|
|
12
12
|
defaultTab?: string;
|
|
13
13
|
tabs?: Tab[];
|
|
@@ -2,4 +2,4 @@ import React from 'react';
|
|
|
2
2
|
import '../../themes/Default.css';
|
|
3
3
|
import { FilterCalendarTypes } from './FilterCalendarTypes';
|
|
4
4
|
import './FilterCalendar.css';
|
|
5
|
-
export default function FilterCalendar({ calendarOffset, language, palette, onSubmit,
|
|
5
|
+
export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, }: FilterCalendarTypes): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DateRange } from 'react-day-picker';
|
|
2
|
+
import { DateRange, Matcher } from 'react-day-picker';
|
|
3
3
|
type Props = {
|
|
4
4
|
onSubmit: (val: any) => void;
|
|
5
5
|
setToggleCalendar: (val: boolean) => void;
|
|
@@ -8,6 +8,10 @@ export declare const useFilterCalendar: ({ onSubmit, setToggleCalendar }: Props)
|
|
|
8
8
|
handleSubmit: () => void;
|
|
9
9
|
handleClearDates: () => void;
|
|
10
10
|
setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
|
|
11
|
+
setDisabledDates: import("react").Dispatch<import("react").SetStateAction<Matcher[]>>;
|
|
12
|
+
setUpdateCalendar: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
11
13
|
calendarRange: DateRange | undefined;
|
|
14
|
+
disabledDates: Matcher[];
|
|
15
|
+
updateCalendar: boolean;
|
|
12
16
|
};
|
|
13
17
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CalendarTypes } from './CalendarTypes';
|
|
2
3
|
import 'react-day-picker/dist/style.css';
|
|
3
4
|
import './Calendar.css';
|
|
4
|
-
import { CalendarTypes } from './CalendarTypes';
|
|
5
5
|
export declare const Calendar: React.ForwardRefExoticComponent<CalendarTypes & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
import { DateRange } from 'react-day-picker';
|
|
1
|
+
import { DateRange, Matcher } from 'react-day-picker';
|
|
2
2
|
export type CalendarOffset = {
|
|
3
3
|
[key: string]: number;
|
|
4
4
|
};
|
|
5
|
+
export type DisableCalendarDates = {
|
|
6
|
+
availableDates?: {
|
|
7
|
+
checkIn: Date;
|
|
8
|
+
firstCheckOut: Date;
|
|
9
|
+
lastCheckOut: Date;
|
|
10
|
+
}[];
|
|
11
|
+
disabledDates?: {
|
|
12
|
+
to: Date;
|
|
13
|
+
from: Date;
|
|
14
|
+
}[];
|
|
15
|
+
disabledDatesByPage?: {
|
|
16
|
+
page: string;
|
|
17
|
+
offset: number;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
5
20
|
export type CalendarTypes = {
|
|
6
21
|
calendarRange?: DateRange | undefined;
|
|
7
22
|
setCalendarRange: (range: DateRange | undefined) => void;
|
|
8
23
|
calendarOffset?: CalendarOffset;
|
|
9
24
|
selectedPath?: string;
|
|
10
25
|
language?: string;
|
|
11
|
-
|
|
12
|
-
from: Date;
|
|
13
|
-
to: Date;
|
|
14
|
-
}[];
|
|
26
|
+
disableCalendarDates?: DisableCalendarDates;
|
|
15
27
|
requestDates?: (val: Date) => void;
|
|
28
|
+
disabledDates?: Matcher[];
|
|
29
|
+
setDisabledDates?: (arg: Matcher[]) => void;
|
|
30
|
+
updateCalendar?: boolean;
|
|
31
|
+
setUpdateCalendar?: (arg: (prev: boolean) => boolean) => void;
|
|
32
|
+
loadingData?: boolean;
|
|
16
33
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DateRange } from 'react-day-picker';
|
|
2
|
+
import { DateRange, Matcher } from 'react-day-picker';
|
|
3
3
|
|
|
4
4
|
interface ButtonProps {
|
|
5
5
|
/**
|
|
@@ -28,25 +28,42 @@ interface ButtonProps {
|
|
|
28
28
|
*/
|
|
29
29
|
declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => React.JSX.Element;
|
|
30
30
|
|
|
31
|
-
type Palette = {
|
|
32
|
-
primary: string;
|
|
33
|
-
secondary: string;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
31
|
type CalendarOffset = {
|
|
37
32
|
[key: string]: number;
|
|
38
33
|
};
|
|
34
|
+
type DisableCalendarDates = {
|
|
35
|
+
availableDates?: {
|
|
36
|
+
checkIn: Date;
|
|
37
|
+
firstCheckOut: Date;
|
|
38
|
+
lastCheckOut: Date;
|
|
39
|
+
}[];
|
|
40
|
+
disabledDates?: {
|
|
41
|
+
to: Date;
|
|
42
|
+
from: Date;
|
|
43
|
+
}[];
|
|
44
|
+
disabledDatesByPage?: {
|
|
45
|
+
page: string;
|
|
46
|
+
offset: number;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
39
49
|
type CalendarTypes = {
|
|
40
50
|
calendarRange?: DateRange | undefined;
|
|
41
51
|
setCalendarRange: (range: DateRange | undefined) => void;
|
|
42
52
|
calendarOffset?: CalendarOffset;
|
|
43
53
|
selectedPath?: string;
|
|
44
54
|
language?: string;
|
|
45
|
-
|
|
46
|
-
from: Date;
|
|
47
|
-
to: Date;
|
|
48
|
-
}[];
|
|
55
|
+
disableCalendarDates?: DisableCalendarDates;
|
|
49
56
|
requestDates?: (val: Date) => void;
|
|
57
|
+
disabledDates?: Matcher[];
|
|
58
|
+
setDisabledDates?: (arg: Matcher[]) => void;
|
|
59
|
+
updateCalendar?: boolean;
|
|
60
|
+
setUpdateCalendar?: (arg: (prev: boolean) => boolean) => void;
|
|
61
|
+
loadingData?: boolean;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type Palette = {
|
|
65
|
+
primary: string;
|
|
66
|
+
secondary: string;
|
|
50
67
|
};
|
|
51
68
|
|
|
52
69
|
type FilterBarProps = {
|
|
@@ -56,7 +73,7 @@ type FilterBarProps = {
|
|
|
56
73
|
palette?: Palette;
|
|
57
74
|
onSubmit?: ((val: Filters) => void) | null;
|
|
58
75
|
fullWidth?: boolean;
|
|
59
|
-
|
|
76
|
+
disableCalendarDates?: DisableCalendarDates;
|
|
60
77
|
mode?: string;
|
|
61
78
|
defaultTab?: string;
|
|
62
79
|
tabs?: Tab[];
|
|
@@ -82,7 +99,7 @@ type Tab = {
|
|
|
82
99
|
label?: Translations;
|
|
83
100
|
};
|
|
84
101
|
|
|
85
|
-
declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth,
|
|
102
|
+
declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, }: FilterBarProps): React.JSX.Element;
|
|
86
103
|
|
|
87
104
|
interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
88
105
|
palette: Palette;
|
|
@@ -91,6 +108,6 @@ interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
|
91
108
|
setToggleCalendar: (val: boolean) => void;
|
|
92
109
|
}
|
|
93
110
|
|
|
94
|
-
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit,
|
|
111
|
+
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, }: FilterCalendarTypes): React.JSX.Element;
|
|
95
112
|
|
|
96
113
|
export { Button, FilterBar, FilterCalendar, FilterCalendarTypes, Tab };
|