willba-component-library 0.3.11 → 0.3.13
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/README.md +6 -18
- package/lib/assets/IconsSvg.d.ts +1 -2
- package/lib/components/Button/Button.d.ts +6 -6
- package/lib/components/FilterBar/FilterBar.d.ts +1 -1
- package/lib/components/FilterBar/FilterBarTypes.d.ts +1 -1
- package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +1 -2
- package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +1 -2
- package/lib/components/FilterBar/components/cards/image-card/ImageCard.d.ts +1 -2
- package/lib/components/FilterBar/components/categories/Categories.d.ts +1 -2
- package/lib/components/FilterBar/components/common/FilterSectionHeader.d.ts +2 -2
- package/lib/components/FilterBar/components/dates/Dates.d.ts +4 -4
- package/lib/components/FilterBar/components/divider/Divider.d.ts +1 -2
- package/lib/components/FilterBar/components/guests/Guests.d.ts +1 -2
- package/lib/components/FilterBar/components/locations/Locations.d.ts +1 -2
- package/lib/components/FilterCalendar/FilterCalendar.d.ts +1 -2
- package/lib/components/FilterCalendar/components/Footer.d.ts +1 -2
- package/lib/core/components/buttons/close-button/CloseButton.d.ts +1 -2
- package/lib/core/components/buttons/submit-button/SubmitButton.d.ts +2 -2
- package/lib/core/components/calendar/Calendar.d.ts +1 -2
- package/lib/index.d.ts +9 -9
- package/lib/index.esm.js +204 -290
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +291 -377
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +293 -380
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/rollup.config.mjs +1 -1
- package/src/components/Button/Button.stories.tsx +16 -16
- package/src/components/Button/Button.tsx +15 -15
- package/src/components/FilterBar/FilterBar.tsx +1 -1
- package/src/components/FilterBar/FilterBarTypes.ts +1 -1
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +12 -1
- package/src/components/FilterBar/components/common/FilterSectionHeader.tsx +1 -0
- package/src/components/FilterBar/components/dates/Dates.tsx +3 -4
- package/src/components/FilterBar/components/guests/Guests.tsx +10 -1
- package/src/components/FilterBar/utils/calculateDropdownPosition.tsx +0 -10
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +1 -1
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +2 -1
- package/src/core/components/calendar/Calendar.tsx +6 -3
- package/stories/Button.tsx +16 -11
- package/stories/Header.tsx +28 -14
- package/stories/Page.tsx +39 -21
package/README.md
CHANGED
|
@@ -66,19 +66,13 @@ function App() {
|
|
|
66
66
|
]}
|
|
67
67
|
tabs={[
|
|
68
68
|
{
|
|
69
|
-
label:
|
|
70
|
-
en: 'Rooms',
|
|
71
|
-
fi: 'Hilat',
|
|
72
|
-
},
|
|
69
|
+
label: 'Rooms',
|
|
73
70
|
path: '/rooms',
|
|
74
71
|
default: true,
|
|
75
72
|
order: 2,
|
|
76
73
|
},
|
|
77
74
|
{
|
|
78
|
-
label:
|
|
79
|
-
en: 'Events',
|
|
80
|
-
fi: 'Tapahtumat',
|
|
81
|
-
},
|
|
75
|
+
label: 'Events',
|
|
82
76
|
path: '/events',
|
|
83
77
|
default: false,
|
|
84
78
|
order: 1,
|
|
@@ -90,14 +84,8 @@ function App() {
|
|
|
90
84
|
data: [
|
|
91
85
|
{
|
|
92
86
|
id: 1,
|
|
93
|
-
label:
|
|
94
|
-
|
|
95
|
-
{ content: 'Helsinki', locale: 'fi' },
|
|
96
|
-
],
|
|
97
|
-
description: [
|
|
98
|
-
{ content: 'Capital of Finland', locale: 'en' },
|
|
99
|
-
{ content: 'Suomen pääkaupunki', locale: 'fi' },
|
|
100
|
-
],
|
|
87
|
+
label: 'Helsinki',
|
|
88
|
+
description: 'Capital of Finland',
|
|
101
89
|
imageUrl: 'https://example.com/helsinki.jpg',
|
|
102
90
|
},
|
|
103
91
|
],
|
|
@@ -182,5 +170,5 @@ ReactDOM.render(<App />, document.querySelector('#app'))
|
|
|
182
170
|
| mode | `"string"` | Specify the color theme for the filter bar tabs as either light or dark using the following format: `'dark'` or `'light'` |
|
|
183
171
|
| ageCategories | `[{}]` | The ageCategories prop will determine the types of guests that can be selected. Specify the age categories for guests using the following format: `[{ id: string, name: string, minVal: number, sortOrder: number }]`. For example: `[{ id: '1', name: 'Aikuiset', minVal: 1, sortOrder: 1 }]` |
|
|
184
172
|
| fullWidth | `true` | Specify whether the filter bar width should be dynamic or fixed. |
|
|
185
|
-
| tabs | `[{}]` | Manage the filter bar tabs using the following format: `[{path: string, default: boolean, order: number, label
|
|
186
|
-
| locations | `{}` | Configures location filter. Format: `{ multiSelect: boolean, disabled?: boolean, data: Location[] }` where Location = `{ id: number, label:
|
|
173
|
+
| tabs | `[{}]` | Manage the filter bar tabs using the following format: `[{path: string, default: boolean, order: number, label?: string}]`. The label should be pre-localized. For example: `[{ path: '/rooms', default: true, order: 2, label: 'Rooms' }]` |
|
|
174
|
+
| locations | `{}` | Configures location filter. Format: `{ multiSelect: boolean, disabled?: boolean, data: Location[] }` where Location = `{ id: number, label: string, description?: string \| null, imageUrl?: string \| null }`. The label and description should be pre-localized. `multiSelect` enables multi-selection, `disabled` disables the filter, `description` shows under title, `imageUrl` displays location image. Example: `{ multiSelect: false, disabled: false, data: [{ id: 1, label: 'Helsinki', description: 'Capital of Finland', imageUrl: 'https://example.com/helsinki.jpg' }] }` |
|
package/lib/assets/IconsSvg.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
type Icon = 'spinner' | 'warning';
|
|
3
2
|
type Props = {
|
|
4
3
|
fill?: string;
|
|
5
4
|
size?: number;
|
|
6
5
|
icon: Icon;
|
|
7
6
|
};
|
|
8
|
-
export declare const IconsSvg: ({ fill, size, icon }: Props) =>
|
|
7
|
+
export declare const IconsSvg: ({ fill, size, icon }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
8
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import './button.css';
|
|
3
3
|
export interface ButtonProps {
|
|
4
4
|
/**
|
|
5
5
|
* Is this the principal call to action on the page?
|
|
6
6
|
*/
|
|
7
|
-
type?:
|
|
7
|
+
type?: 'primary' | 'secondary';
|
|
8
8
|
/**
|
|
9
9
|
* What background color to use
|
|
10
10
|
*/
|
|
@@ -12,7 +12,7 @@ export interface ButtonProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* How large should the button be?
|
|
14
14
|
*/
|
|
15
|
-
size?:
|
|
15
|
+
size?: 'small' | 'medium' | 'large';
|
|
16
16
|
/**
|
|
17
17
|
* Button contents
|
|
18
18
|
*/
|
|
@@ -20,10 +20,10 @@ export interface ButtonProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* Optional click handler
|
|
22
22
|
*/
|
|
23
|
-
onClick?: (event:
|
|
23
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Primary UI component for user interaction
|
|
27
27
|
*/
|
|
28
|
-
declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) =>
|
|
28
|
+
declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export default Button;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../themes/Default.css';
|
|
2
2
|
import { FilterBarTypes } from './FilterBarTypes';
|
|
3
3
|
import './FilterBar.css';
|
|
4
|
-
export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes): import("react").JSX.Element;
|
|
4
|
+
export default function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './SelectButton.css';
|
|
3
2
|
type Props = {
|
|
4
3
|
label: string;
|
|
@@ -9,5 +8,5 @@ type Props = {
|
|
|
9
8
|
ariaExpanded?: boolean;
|
|
10
9
|
ariaControls?: string;
|
|
11
10
|
};
|
|
12
|
-
export declare const SelectButton:
|
|
11
|
+
export declare const SelectButton: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLButtonElement>>;
|
|
13
12
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './TabButton.css';
|
|
3
2
|
type Props = {
|
|
4
3
|
onClick?: () => void;
|
|
@@ -6,5 +5,5 @@ type Props = {
|
|
|
6
5
|
active?: boolean;
|
|
7
6
|
mode?: string;
|
|
8
7
|
};
|
|
9
|
-
export declare const TabButton: ({ onClick, label, active, mode }: Props) =>
|
|
8
|
+
export declare const TabButton: ({ onClick, label, active, mode }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './ImageCard.css';
|
|
3
2
|
type Props = {
|
|
4
3
|
title?: string;
|
|
@@ -7,5 +6,5 @@ type Props = {
|
|
|
7
6
|
isSelected: boolean;
|
|
8
7
|
onClick?: () => void;
|
|
9
8
|
};
|
|
10
|
-
export declare const ImageCard:
|
|
9
|
+
export declare const ImageCard: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
10
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './Categories.css';
|
|
3
2
|
type Props = {
|
|
4
3
|
categories: any;
|
|
5
4
|
setCategories: any;
|
|
6
5
|
};
|
|
7
|
-
export declare const Categories: ({ categories, setCategories }: Props) =>
|
|
6
|
+
export declare const Categories: ({ categories, setCategories }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import './FilterSectionHeader.css';
|
|
3
3
|
type Props = {
|
|
4
4
|
title: string;
|
|
5
5
|
action?: ReactNode;
|
|
6
6
|
};
|
|
7
|
-
export declare const FilterSectionHeader: ({ title, action }: Props) =>
|
|
7
|
+
export declare const FilterSectionHeader: ({ title, action }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
2
|
import { DateRange } from 'react-day-picker';
|
|
3
3
|
import { DisableCalendarDates } from '../../../../core/components/calendar/CalendarTypes';
|
|
4
4
|
import './Dates.css';
|
|
5
5
|
type Props = {
|
|
6
|
-
ref:
|
|
6
|
+
ref: RefObject<HTMLDivElement>;
|
|
7
7
|
onClose?: () => void;
|
|
8
8
|
autoFocus?: boolean;
|
|
9
9
|
calendarRange: DateRange | undefined;
|
|
@@ -11,7 +11,7 @@ type Props = {
|
|
|
11
11
|
disableCalendarDates?: DisableCalendarDates;
|
|
12
12
|
selectedPath?: string;
|
|
13
13
|
language?: string;
|
|
14
|
-
filtersRef?:
|
|
14
|
+
filtersRef?: RefObject<HTMLDivElement>;
|
|
15
15
|
};
|
|
16
|
-
export declare const Dates:
|
|
16
|
+
export declare const Dates: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { AgeCategoryCount, AgeCategoryType } from '../../FilterBarTypes';
|
|
3
2
|
import './Guests.css';
|
|
4
3
|
type Props = {
|
|
@@ -8,5 +7,5 @@ type Props = {
|
|
|
8
7
|
autoFocus?: boolean;
|
|
9
8
|
onClose?: () => void;
|
|
10
9
|
};
|
|
11
|
-
export declare const Guests:
|
|
10
|
+
export declare const Guests: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
11
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './Locations.css';
|
|
3
2
|
import { Location } from '../../FilterBarTypes';
|
|
4
3
|
type Props = {
|
|
@@ -10,5 +9,5 @@ type Props = {
|
|
|
10
9
|
multiSelect?: boolean;
|
|
11
10
|
onClose?: () => void;
|
|
12
11
|
};
|
|
13
|
-
export declare const Locations:
|
|
12
|
+
export declare const Locations: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
13
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import '../../themes/Default.css';
|
|
3
2
|
import { FilterCalendarTypes } from './FilterCalendarTypes';
|
|
4
3
|
import './FilterCalendar.css';
|
|
5
|
-
export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes):
|
|
4
|
+
export default function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { DateRange } from 'react-day-picker';
|
|
3
2
|
import { Palette } from '../../../themes/useTheme';
|
|
4
3
|
export declare const Footer: ({ calendarHasError, calendarRange, handleClearDates, language, palette, }: {
|
|
@@ -7,4 +6,4 @@ export declare const Footer: ({ calendarHasError, calendarRange, handleClearDate
|
|
|
7
6
|
handleClearDates: () => void;
|
|
8
7
|
language?: string;
|
|
9
8
|
palette: Palette;
|
|
10
|
-
}) =>
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './CloseButton.css';
|
|
3
2
|
interface CloseButtonPropsType {
|
|
4
3
|
handleClose: () => void;
|
|
5
4
|
}
|
|
6
|
-
export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) =>
|
|
5
|
+
export declare const CloseButton: ({ handleClose }: CloseButtonPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import './SubmitButton.css';
|
|
3
3
|
type SubmitButtonVariant = 'text' | 'full';
|
|
4
4
|
type Props = {
|
|
@@ -9,5 +9,5 @@ type Props = {
|
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
variant?: SubmitButtonVariant;
|
|
11
11
|
};
|
|
12
|
-
export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, variant, }: Props) =>
|
|
12
|
+
export declare const SubmitButton: ({ onClick, startIcon, label, disabled, isLoading, variant, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { CalendarTypes } from './CalendarTypes';
|
|
3
2
|
import 'react-day-picker/dist/style.css';
|
|
4
3
|
import './Calendar.css';
|
|
5
|
-
export declare const Calendar:
|
|
4
|
+
export declare const Calendar: import("react").ForwardRefExoticComponent<CalendarTypes & import("react").RefAttributes<HTMLDivElement>>;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { MouseEvent } from 'react';
|
|
3
3
|
import { DateRange, Matcher } from 'react-day-picker';
|
|
4
4
|
|
|
5
5
|
interface ButtonProps {
|
|
6
6
|
/**
|
|
7
7
|
* Is this the principal call to action on the page?
|
|
8
8
|
*/
|
|
9
|
-
type?:
|
|
9
|
+
type?: 'primary' | 'secondary';
|
|
10
10
|
/**
|
|
11
11
|
* What background color to use
|
|
12
12
|
*/
|
|
@@ -14,7 +14,7 @@ interface ButtonProps {
|
|
|
14
14
|
/**
|
|
15
15
|
* How large should the button be?
|
|
16
16
|
*/
|
|
17
|
-
size?:
|
|
17
|
+
size?: 'small' | 'medium' | 'large';
|
|
18
18
|
/**
|
|
19
19
|
* Button contents
|
|
20
20
|
*/
|
|
@@ -22,12 +22,12 @@ interface ButtonProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* Optional click handler
|
|
24
24
|
*/
|
|
25
|
-
onClick?: (event:
|
|
25
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Primary UI component for user interaction
|
|
29
29
|
*/
|
|
30
|
-
declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) =>
|
|
30
|
+
declare const Button: ({ type, textColor, size, onClick, label, }: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
31
31
|
|
|
32
32
|
type Palette = {
|
|
33
33
|
primary: string;
|
|
@@ -117,11 +117,11 @@ type Locations = {
|
|
|
117
117
|
type Location = {
|
|
118
118
|
id: number;
|
|
119
119
|
label: string;
|
|
120
|
-
description?: string;
|
|
120
|
+
description?: string | null;
|
|
121
121
|
imageUrl?: string | null;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes):
|
|
124
|
+
declare function FilterBar({ language, ageCategories, redirectUrl, palette, onSubmit, fullWidth, disableCalendarDates, mode, tabs, outerLoading, locations, }: FilterBarTypes): react_jsx_runtime.JSX.Element;
|
|
125
125
|
|
|
126
126
|
interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
127
127
|
palette: Palette;
|
|
@@ -130,6 +130,6 @@ interface FilterCalendarTypes extends Partial<CalendarTypes> {
|
|
|
130
130
|
setToggleCalendar: (val: boolean) => void;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes):
|
|
133
|
+
declare function FilterCalendar({ calendarOffset, language, palette, onSubmit, disableCalendarDates: outerDisableCalendarDates, toggleCalendar, loadingData, setToggleCalendar, requestDates, showFeedback, noActiveSelection, rangeContext: outerRangeContext, }: FilterCalendarTypes): react_jsx_runtime.JSX.Element;
|
|
134
134
|
|
|
135
135
|
export { Button, FilterBar, FilterBarTypes, FilterCalendar, FilterCalendarTypes };
|