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