willba-component-library 0.3.12 → 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/package.json +1 -1
- package/src/assets/IconsSvg.tsx +2 -0
- package/src/components/Button/Button.stories.tsx +1 -0
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -0
- package/src/components/FilterBar/FilterBar.tsx +1 -1
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +1 -1
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.tsx +2 -0
- package/src/components/FilterBar/components/cards/image-card/ImageCard.tsx +1 -1
- package/src/components/FilterBar/components/categories/Categories.tsx +1 -2
- package/src/components/FilterBar/components/common/FilterSectionHeader.tsx +1 -1
- package/src/components/FilterBar/components/dates/Dates.tsx +1 -1
- package/src/components/FilterBar/components/divider/Divider.tsx +2 -0
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +1 -1
- package/src/components/FilterBar/components/guests/Guests.tsx +1 -1
- package/src/components/FilterBar/components/locations/Locations.tsx +1 -1
- package/src/components/FilterBar/utils/calculateDropdownPosition.tsx +0 -10
- package/src/components/FilterCalendar/FilterCalendar.tsx +1 -0
- package/src/components/FilterCalendar/components/Footer.tsx +1 -0
- package/src/core/components/buttons/close-button/CloseButton.tsx +1 -0
- package/src/core/components/buttons/submit-button/SubmitButton.tsx +1 -0
- package/src/core/components/calendar/Calendar.tsx +1 -1
- package/stories/Button.tsx +2 -0
- package/stories/Header.tsx +1 -0
- package/stories/Page.tsx +1 -1
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/package.json
CHANGED
package/src/assets/IconsSvg.tsx
CHANGED
|
@@ -18,8 +18,6 @@ export const calculateDropdownPosition = ({
|
|
|
18
18
|
guestsButtonRef,
|
|
19
19
|
isMobile,
|
|
20
20
|
}: CalculateDropdownPositionParams): CSSProperties => {
|
|
21
|
-
// On mobile, don't apply any positioning - let CSS handle it naturally
|
|
22
|
-
// Dropdowns will start from leftmost point with position: relative
|
|
23
21
|
if (isMobile) {
|
|
24
22
|
return {}
|
|
25
23
|
}
|
|
@@ -31,7 +29,6 @@ export const calculateDropdownPosition = ({
|
|
|
31
29
|
|
|
32
30
|
switch (filterSection) {
|
|
33
31
|
case FilterSections.LOCATIONS:
|
|
34
|
-
// Locations: Start from beginning, hug content
|
|
35
32
|
if (locationsButtonRef.current) {
|
|
36
33
|
const buttonRect = locationsButtonRef.current.getBoundingClientRect()
|
|
37
34
|
const relativeLeft = buttonRect.left - containerRect.left
|
|
@@ -44,8 +41,6 @@ export const calculateDropdownPosition = ({
|
|
|
44
41
|
break
|
|
45
42
|
|
|
46
43
|
case FilterSections.CALENDAR:
|
|
47
|
-
// Calendar: Two months side-by-side, needs ~650-700px
|
|
48
|
-
// Start from dates button, but push left if not enough space
|
|
49
44
|
if (datesButtonRef.current) {
|
|
50
45
|
const buttonRect = datesButtonRef.current.getBoundingClientRect()
|
|
51
46
|
const relativeLeft = buttonRect.left - containerRect.left
|
|
@@ -53,7 +48,6 @@ export const calculateDropdownPosition = ({
|
|
|
53
48
|
const calendarMinWidth = 650
|
|
54
49
|
|
|
55
50
|
if (availableWidth < calendarMinWidth) {
|
|
56
|
-
// Not enough space, align to the right edge
|
|
57
51
|
return {
|
|
58
52
|
left: 'auto',
|
|
59
53
|
right: containerLeft,
|
|
@@ -61,7 +55,6 @@ export const calculateDropdownPosition = ({
|
|
|
61
55
|
maxWidth: `${containerRect.width}px`,
|
|
62
56
|
}
|
|
63
57
|
} else {
|
|
64
|
-
// Enough space, start from dates button
|
|
65
58
|
return {
|
|
66
59
|
left: relativeLeft,
|
|
67
60
|
right: 'auto',
|
|
@@ -72,7 +65,6 @@ export const calculateDropdownPosition = ({
|
|
|
72
65
|
break
|
|
73
66
|
|
|
74
67
|
case FilterSections.GUESTS:
|
|
75
|
-
// Guests: Start from guests button, push left if not enough space
|
|
76
68
|
if (guestsButtonRef.current) {
|
|
77
69
|
const buttonRect = guestsButtonRef.current.getBoundingClientRect()
|
|
78
70
|
const relativeLeft = buttonRect.left - containerRect.left
|
|
@@ -80,7 +72,6 @@ export const calculateDropdownPosition = ({
|
|
|
80
72
|
const dropdownMinWidth = 350
|
|
81
73
|
|
|
82
74
|
if (availableWidth < dropdownMinWidth) {
|
|
83
|
-
// Not enough space, align to the right
|
|
84
75
|
return {
|
|
85
76
|
left: 'auto',
|
|
86
77
|
right: containerLeft,
|
|
@@ -88,7 +79,6 @@ export const calculateDropdownPosition = ({
|
|
|
88
79
|
maxWidth: `${containerRect.width}px`,
|
|
89
80
|
}
|
|
90
81
|
} else {
|
|
91
|
-
// Enough space, start from button
|
|
92
82
|
return {
|
|
93
83
|
left: relativeLeft,
|
|
94
84
|
right: 'auto',
|
package/stories/Button.tsx
CHANGED
package/stories/Header.tsx
CHANGED
package/stories/Page.tsx
CHANGED