willba-component-library 0.2.79 → 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.
- package/lib/assets/SpinnerSvg.d.ts +5 -0
- package/lib/components/FilterBar/FilterBar.stories.d.ts +1 -1
- package/lib/components/FilterBar/components/buttons/close-button/CloseButton.d.ts +7 -0
- package/lib/components/FilterBar/components/buttons/submit-button/SubmitButton.d.ts +3 -0
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +14 -0
- package/lib/components/FilterBar/hooks/useCloseFilterSection.d.ts +8 -0
- package/lib/components/FilterBar/hooks/useUpdateTranslations.d.ts +5 -0
- package/lib/components/FilterBar/utils/parseDates.d.ts +6 -0
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -1
- package/lib/components/FilterCalendar/FilterCalendar.stories.d.ts +1 -3
- package/lib/components/FilterCalendar/hooks/useFilterCalendar.d.ts +3 -10
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +1 -3
- package/lib/core/components/calendar/CalendarTypes.d.ts +2 -9
- package/lib/core/utils/handleOverlappingDates.d.ts +1 -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 +7 -0
- package/lib/core/utils/parseDates.d.ts +6 -0
- package/lib/index.d.ts +3 -11
- package/lib/index.esm.js +267 -894
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +267 -894
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +267 -894
- package/lib/index.umd.js.map +1 -1
- package/lib/themes/useTheme.d.ts +0 -2
- package/package.json +1 -1
- package/src/assets/SpinnerSvg.tsx +40 -0
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -2
- package/src/components/FilterBar/FilterBar.tsx +1 -1
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +1 -1
- package/src/components/FilterCalendar/FilterCalendar.css +10 -26
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +153 -522
- package/src/components/FilterCalendar/FilterCalendar.tsx +54 -25
- package/src/components/FilterCalendar/FilterCalendarTypes.ts +1 -0
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +4 -94
- package/src/core/components/buttons/submit-button/SubmitButton.css +2 -16
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +5 -6
- package/src/core/components/calendar/Calendar.css +18 -71
- package/src/core/components/calendar/Calendar.tsx +342 -132
- package/src/core/components/calendar/CalendarTypes.ts +3 -10
- package/src/core/utils/index.ts +3 -0
- package/src/locales/en/common.json +1 -7
- package/src/locales/en/filterBar.json +1 -2
- package/src/locales/fi/common.json +1 -7
- package/src/locales/fi/filterBar.json +1 -2
- package/src/themes/Default.css +3 -12
- package/src/themes/useTheme.tsx +0 -3
- package/src/assets/IconsSvg.tsx +0 -68
- package/src/components/FilterCalendar/components/Footer.tsx +0 -96
- package/src/core/components/calendar/hooks/index.ts +0 -3
- package/src/core/components/calendar/hooks/useCalendarLoadingSpinner.tsx +0 -19
- package/src/core/components/calendar/hooks/useCalendarTooltips.tsx +0 -125
- package/src/core/components/calendar/hooks/useUpdateDisabledDates.tsx +0 -107
- package/src/core/components/calendar/utils/calendarSelectionRules.tsx +0 -228
- package/src/core/components/calendar/utils/checkForContinuousSelection.tsx +0 -86
- package/src/core/components/calendar/utils/disabledDatesByPage.tsx +0 -36
- package/src/core/components/calendar/utils/handleCalendarModifiers.tsx +0 -147
- package/src/core/components/calendar/utils/handleRangeContextDisabledDates.tsx +0 -75
- package/src/core/components/calendar/utils/index.ts +0 -8
- /package/src/core/{components/calendar/utils → utils}/nightsCount.tsx +0 -0
- /package/src/core/{components/calendar/utils → utils}/parseDate.tsx +0 -0
- /package/src/core/{components/calendar/utils → utils}/parseDates.tsx +0 -0
|
@@ -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
|
+
/// <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 {};
|
|
@@ -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, disableCalendarDates
|
|
5
|
+
export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, }: FilterCalendarTypes): React.JSX.Element;
|
|
@@ -3,6 +3,4 @@ import FilterCalendar from './FilterCalendar';
|
|
|
3
3
|
declare const meta: Meta<typeof FilterCalendar>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof FilterCalendar>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const RangeContext: Story;
|
|
8
|
-
export declare const DisabledRangeContextDates: Story;
|
|
6
|
+
export declare const Primary: Story;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DateRange, Matcher } from 'react-day-picker';
|
|
3
|
-
import { DisableCalendarDates, RangeContext } from 'src/core/components/calendar/CalendarTypes';
|
|
4
3
|
type Props = {
|
|
5
4
|
onSubmit: (val: any) => void;
|
|
6
5
|
setToggleCalendar: (val: boolean) => void;
|
|
7
6
|
noActiveSelection?: boolean;
|
|
8
7
|
toggleCalendar?: boolean;
|
|
9
|
-
outerRangeContext?: RangeContext;
|
|
10
|
-
outerDisableCalendarDates?: DisableCalendarDates;
|
|
11
8
|
};
|
|
12
|
-
export declare const useFilterCalendar: ({ onSubmit, setToggleCalendar, noActiveSelection, toggleCalendar,
|
|
9
|
+
export declare const useFilterCalendar: ({ onSubmit, setToggleCalendar, noActiveSelection, toggleCalendar, }: Props) => {
|
|
13
10
|
handleSubmit: () => void;
|
|
14
11
|
handleClearDates: () => void;
|
|
15
12
|
setCalendarRange: import("react").Dispatch<import("react").SetStateAction<DateRange | undefined>>;
|
|
@@ -18,11 +15,7 @@ export declare const useFilterCalendar: ({ onSubmit, setToggleCalendar, noActive
|
|
|
18
15
|
calendarRange: DateRange | undefined;
|
|
19
16
|
disabledDates: Matcher[];
|
|
20
17
|
updateCalendarMonthNavigation: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setCalendarHasError: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
24
|
-
setUpdatedForSubmit: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
25
|
-
rangeContext: RangeContext | undefined;
|
|
26
|
-
disableCalendarDates: DisableCalendarDates | undefined;
|
|
18
|
+
updateCalendarDefaultMoth: number;
|
|
19
|
+
initialCalendarRange: DateRange | undefined;
|
|
27
20
|
};
|
|
28
21
|
export {};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import './SubmitButton.css';
|
|
3
|
-
type SubmitButtonVariant = 'text' | 'full';
|
|
4
3
|
type Props = {
|
|
5
4
|
onClick?: () => void;
|
|
6
5
|
startIcon?: ReactNode;
|
|
7
6
|
label?: string;
|
|
8
7
|
disabled?: boolean;
|
|
9
8
|
isLoading?: boolean;
|
|
10
|
-
variant?: SubmitButtonVariant;
|
|
11
9
|
};
|
|
12
|
-
export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading,
|
|
10
|
+
export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, }: Props) => React.JSX.Element;
|
|
13
11
|
export {};
|
|
@@ -18,10 +18,6 @@ export type DisableCalendarDates = {
|
|
|
18
18
|
offset: number;
|
|
19
19
|
}[];
|
|
20
20
|
};
|
|
21
|
-
export type RangeContext = {
|
|
22
|
-
from: Date;
|
|
23
|
-
to: Date;
|
|
24
|
-
};
|
|
25
21
|
export type CalendarTypes = {
|
|
26
22
|
calendarRange?: DateRange | undefined;
|
|
27
23
|
setCalendarRange: (range: DateRange | undefined) => void;
|
|
@@ -33,14 +29,11 @@ export type CalendarTypes = {
|
|
|
33
29
|
disabledDates?: Matcher[];
|
|
34
30
|
setDisabledDates?: (arg: Matcher[]) => void;
|
|
35
31
|
loadingData?: boolean;
|
|
32
|
+
initialCalendarRange?: DateRange | undefined;
|
|
36
33
|
showFeedback?: boolean;
|
|
37
34
|
noActiveSelection?: boolean;
|
|
38
35
|
palette?: Palette;
|
|
39
36
|
updateCalendarMonthNavigation?: boolean;
|
|
40
37
|
setUpdateCalendarMonthNavigation?: (arg: (prev: boolean) => boolean) => void;
|
|
41
|
-
|
|
42
|
-
setCalendarHasError?: (arg: boolean) => void;
|
|
43
|
-
setUpdatedForSubmit?: (arg: boolean) => void;
|
|
44
|
-
rangeContext?: RangeContext;
|
|
45
|
-
calendarHasError?: boolean;
|
|
38
|
+
updateCalendarDefaultMoth?: number;
|
|
46
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handleOverlappingDates: () => void;
|
package/lib/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps)
|
|
|
31
31
|
type Palette = {
|
|
32
32
|
primary: string;
|
|
33
33
|
secondary: string;
|
|
34
|
-
error: string;
|
|
35
34
|
};
|
|
36
35
|
|
|
37
36
|
type CalendarOffset = {
|
|
@@ -52,10 +51,6 @@ type DisableCalendarDates = {
|
|
|
52
51
|
offset: number;
|
|
53
52
|
}[];
|
|
54
53
|
};
|
|
55
|
-
type RangeContext = {
|
|
56
|
-
from: Date;
|
|
57
|
-
to: Date;
|
|
58
|
-
};
|
|
59
54
|
type CalendarTypes = {
|
|
60
55
|
calendarRange?: DateRange | undefined;
|
|
61
56
|
setCalendarRange: (range: DateRange | undefined) => void;
|
|
@@ -67,16 +62,13 @@ type CalendarTypes = {
|
|
|
67
62
|
disabledDates?: Matcher[];
|
|
68
63
|
setDisabledDates?: (arg: Matcher[]) => void;
|
|
69
64
|
loadingData?: boolean;
|
|
65
|
+
initialCalendarRange?: DateRange | undefined;
|
|
70
66
|
showFeedback?: boolean;
|
|
71
67
|
noActiveSelection?: boolean;
|
|
72
68
|
palette?: Palette;
|
|
73
69
|
updateCalendarMonthNavigation?: boolean;
|
|
74
70
|
setUpdateCalendarMonthNavigation?: (arg: (prev: boolean) => boolean) => void;
|
|
75
|
-
|
|
76
|
-
setCalendarHasError?: (arg: boolean) => void;
|
|
77
|
-
setUpdatedForSubmit?: (arg: boolean) => void;
|
|
78
|
-
rangeContext?: RangeContext;
|
|
79
|
-
calendarHasError?: boolean;
|
|
71
|
+
updateCalendarDefaultMoth?: number;
|
|
80
72
|
};
|
|
81
73
|
|
|
82
74
|
type FilterBarProps = {
|
|
@@ -122,6 +114,6 @@ interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
|
122
114
|
setToggleCalendar: (val: boolean) => void;
|
|
123
115
|
}
|
|
124
116
|
|
|
125
|
-
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates
|
|
117
|
+
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, }: FilterCalendarTypes): React.JSX.Element;
|
|
126
118
|
|
|
127
119
|
export { Button, FilterBar, FilterCalendar, FilterCalendarTypes, Tab };
|