willba-component-library 0.1.70 → 0.1.73
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 +4 -3
- package/lib/components/FilterBar/components/buttons/tab-button/TabButton.d.ts +2 -1
- package/lib/components/FilterBar/components/calendar/Calendar.d.ts +1 -1
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +2 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.esm.js +23 -21
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +23 -21
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +23 -21
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +15 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +3 -1
- package/src/components/FilterBar/FilterBar.tsx +10 -4
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +15 -5
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.tsx +5 -2
- package/src/components/FilterBar/components/calendar/Calendar.tsx +10 -8
- package/src/components/FilterBar/hooks/useFilterBar.tsx +11 -6
- package/src/themes/Default.css +3 -1
|
@@ -4,7 +4,6 @@ import '../../themes/Default.css';
|
|
|
4
4
|
import { AgeCategoryType, CalendarOffset, Filters } from './FilterBarTypes';
|
|
5
5
|
import './FilterBar.css';
|
|
6
6
|
export type FilterBarProps = {
|
|
7
|
-
vendor?: string;
|
|
8
7
|
language?: string;
|
|
9
8
|
ageCategories?: AgeCategoryType[];
|
|
10
9
|
redirectUrl?: string;
|
|
@@ -12,6 +11,8 @@ export type FilterBarProps = {
|
|
|
12
11
|
currentViewApply?: string;
|
|
13
12
|
onSubmit?: ((val: Filters) => void) | null;
|
|
14
13
|
fullWidth?: boolean;
|
|
15
|
-
calendarOffset
|
|
14
|
+
calendarOffset?: CalendarOffset;
|
|
15
|
+
mode?: string;
|
|
16
|
+
defaultTab?: string;
|
|
16
17
|
};
|
|
17
|
-
export default function FilterBar({ language, ageCategories, redirectUrl, palette, currentViewApply, onSubmit, fullWidth, calendarOffset, }: FilterBarProps): React.JSX.Element | null;
|
|
18
|
+
export default function FilterBar({ language, ageCategories, redirectUrl, palette, currentViewApply, onSubmit, fullWidth, calendarOffset, mode, defaultTab, }: FilterBarProps): React.JSX.Element | null;
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
onClick?: () => void;
|
|
5
5
|
label: string;
|
|
6
6
|
active?: boolean;
|
|
7
|
+
mode?: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const TabButton: ({ onClick, label, active }: Props) => React.JSX.Element;
|
|
9
|
+
export declare const TabButton: ({ onClick, label, active, mode }: Props) => React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -6,8 +6,9 @@ type Props = {
|
|
|
6
6
|
currentViewApply?: string;
|
|
7
7
|
ageCategories?: AgeCategoryType[];
|
|
8
8
|
onSubmit?: ((val: Filters) => void) | null;
|
|
9
|
+
defaultTab?: string;
|
|
9
10
|
};
|
|
10
|
-
export declare const useFilterBar: ({ redirectUrl, currentViewApply, ageCategories, onSubmit, }: Props) => {
|
|
11
|
+
export declare const useFilterBar: ({ redirectUrl, currentViewApply, ageCategories, onSubmit, defaultTab, }: Props) => {
|
|
11
12
|
selectedFilter: string | boolean;
|
|
12
13
|
ageCategoryCounts: AgeCategoryCount;
|
|
13
14
|
categories: number;
|
package/lib/index.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ type CalendarOffset = {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
type FilterBarProps = {
|
|
49
|
-
vendor?: string;
|
|
50
49
|
language?: string;
|
|
51
50
|
ageCategories?: AgeCategoryType[];
|
|
52
51
|
redirectUrl?: string;
|
|
@@ -54,8 +53,10 @@ type FilterBarProps = {
|
|
|
54
53
|
currentViewApply?: string;
|
|
55
54
|
onSubmit?: ((val: Filters) => void) | null;
|
|
56
55
|
fullWidth?: boolean;
|
|
57
|
-
calendarOffset
|
|
56
|
+
calendarOffset?: CalendarOffset;
|
|
57
|
+
mode?: string;
|
|
58
|
+
defaultTab?: string;
|
|
58
59
|
};
|
|
59
|
-
declare function FilterBar({ language, ageCategories, redirectUrl, palette, currentViewApply, onSubmit, fullWidth, calendarOffset, }: FilterBarProps): React.JSX.Element | null;
|
|
60
|
+
declare function FilterBar({ language, ageCategories, redirectUrl, palette, currentViewApply, onSubmit, fullWidth, calendarOffset, mode, defaultTab, }: FilterBarProps): React.JSX.Element | null;
|
|
60
61
|
|
|
61
62
|
export { Button, FilterBar };
|
package/lib/index.esm.js
CHANGED
|
@@ -448,7 +448,7 @@ function useTheme(_a) {
|
|
|
448
448
|
return themePalette;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
var css_248z$b = "@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n.will-root * {\n font-family: 'Montserrat', sans-serif;\n}\n\n.will-root {\n \n box-sizing: border-box;\n font-size: 14px;\n \n color: #1E1E1E;\n\n /* Palette */\n --will-primary: #374269;\n --will-secondary: #374269;\n --will-grey: #ABA7AF;\n --will-white: #fff;\n --will-black: #000;\n --will-onahau: #CDEEFF;\n --will-text: #5A5959;\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n\n /* Confines */\n --will-box-shadow: 0px
|
|
451
|
+
var css_248z$b = "@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');\n\n.will-root * {\n font-family: 'Montserrat', sans-serif;\n}\n\n.will-root {\n \n box-sizing: border-box;\n font-size: 14px;\n \n color: #1E1E1E;\n\n /* Palette */\n --will-primary: #374269;\n --will-secondary: #374269;\n --will-grey: #ABA7AF;\n --will-white: #fff;\n --will-black: #000;\n --will-onahau: #CDEEFF;\n --will-text: #5A5959;\n --will-transparent-white: rgba(255, 255, 255, 0.30);\n --will-transparent-black: rgba(171, 167, 175, 0.30);\n\n /* Confines */\n --will-box-shadow-dark: 0px 2px 12px 2px #a1a1a180;\n --will-box-shadow-light: 0px 2px 12px 2px #bcb9b980;\n\n /* Breakpoints */\n\n --will-lg: 1140px;\n --will-md: 960px;\n --will-sm: 600px;\n --will-xl: 1280px;\n --will-xs: 0px;\n}\n\n/* Typography */\n\n.will-root h1, h2, h3, h4, h5, h6 {\n font-weight: 700;\n} \n\n.will-root p, h1, h2, h3, h4, h5, h6, span {\n margin: 0;\n padding: 0;\n}";
|
|
452
452
|
styleInject(css_248z$b);
|
|
453
453
|
|
|
454
454
|
function _typeof(o) {
|
|
@@ -3938,7 +3938,7 @@ var Pages;
|
|
|
3938
3938
|
})(Pages || (Pages = {}));
|
|
3939
3939
|
|
|
3940
3940
|
var useFilterBar = function (_a) {
|
|
3941
|
-
var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply, ageCategories = _a.ageCategories, onSubmit = _a.onSubmit;
|
|
3941
|
+
var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply, ageCategories = _a.ageCategories, onSubmit = _a.onSubmit, defaultTab = _a.defaultTab;
|
|
3942
3942
|
var _b = __read(useState(Pages.EVENTS), 2), selectedPath = _b[0], setSelectedPath = _b[1];
|
|
3943
3943
|
var _c = __read(useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
|
|
3944
3944
|
var _d = __read(useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
|
|
@@ -3973,9 +3973,12 @@ var useFilterBar = function (_a) {
|
|
|
3973
3973
|
// Handle default selected tab
|
|
3974
3974
|
if (typeof window === 'undefined')
|
|
3975
3975
|
return;
|
|
3976
|
-
|
|
3976
|
+
console.log(defaultTab);
|
|
3977
|
+
var currentPath = defaultTab === Pages.EVENTS ||
|
|
3978
|
+
window.location.pathname.includes(Pages.EVENTS)
|
|
3977
3979
|
? Pages.EVENTS
|
|
3978
|
-
:
|
|
3980
|
+
: defaultTab === Pages.ROOMS ||
|
|
3981
|
+
window.location.pathname.includes(Pages.ROOMS)
|
|
3979
3982
|
? Pages.ROOMS
|
|
3980
3983
|
: Pages.EVENTS;
|
|
3981
3984
|
setSelectedPath(currentPath);
|
|
@@ -6634,12 +6637,12 @@ var SubmitButton = function (_a) {
|
|
|
6634
6637
|
t('submit.label')));
|
|
6635
6638
|
};
|
|
6636
6639
|
|
|
6637
|
-
var css_248z$7 = ".will-filter-bar-tab-button {\n width: auto;\n height: auto;\n padding: 10px 20px;\n cursor: pointer;\n border: none;\n white-space: nowrap;\n font-size: 16px;\n display: flex;\n align-items: center;\n background-color: transparent;\n user-select: none;\n font-weight: 600;\n border-radius: 50px;\n color: var(--will-white)\n }\n\n \n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-white);\n }\n\n .will-filter-bar-tab-button.active {\n background-color: var(--will-transparent-
|
|
6640
|
+
var css_248z$7 = ".will-filter-bar-tab-button {\n width: auto;\n height: auto;\n padding: 10px 20px;\n cursor: pointer;\n border: none;\n white-space: nowrap;\n font-size: 16px;\n display: flex;\n align-items: center;\n background-color: transparent;\n user-select: none;\n font-weight: 600;\n border-radius: 50px;\n }\n\n .will-filter-bar-tab-button.light {\n color: var(--will-white)\n }\n\n .will-filter-bar-tab-button.dark {\n color: var(--will-black)\n }\n\n .will-filter-bar-tab-button.light.active,\n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-white);\n }\n\n .will-filter-bar-tab-button.dark.active,\n .will-filter-bar-tab-button:hover {\n background-color: var(--will-transparent-black);\n }\n\n \n\n";
|
|
6638
6641
|
styleInject(css_248z$7);
|
|
6639
6642
|
|
|
6640
6643
|
var TabButton = function (_a) {
|
|
6641
|
-
var onClick = _a.onClick, label = _a.label, active = _a.active;
|
|
6642
|
-
return (React__default__default.createElement("button", { className: "will-filter-bar-tab-button ".concat(active && 'active'), onClick: onClick }, label));
|
|
6644
|
+
var onClick = _a.onClick, label = _a.label, active = _a.active, mode = _a.mode;
|
|
6645
|
+
return (React__default__default.createElement("button", { className: "will-filter-bar-tab-button ".concat(mode || 'dark', " ").concat(active && 'active', " "), onClick: onClick }, label));
|
|
6643
6646
|
};
|
|
6644
6647
|
|
|
6645
6648
|
var css_248z$6 = ".will-guests-filter-label, .will-guests-filter-count {\n font-size: 18px;\n color: var(--will-text)\n}\n\n.will-guests-filter-inner {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-top: 30px;\n}\n\n.will-guests-filter-label {\n display: block;\n font-weight: 600;\n margin-bottom: 10px;\n \n}\n\n.will-guests-filter-inner .will-guests-filter-counter {\n display: flex;\n align-items: center;\n}\n\n.will-guests-filter-count {\n margin: 0 10px;\n min-width: 30px;\n text-align: center;\n}\n\n.will-guests-filter-counter-button {\n border-radius: 50%;\n border: none;\n background-color: transparent;\n border: 1px solid var(--will-grey);\n width: 30px;\n height: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 20px;\n cursor: pointer;\n}\n\n.will-guests-filter-counter-button:hover {\n background-color: var(--will-onahau);\n}\n\n@media (max-width: 960px) {\n\n .will-guests-filter-inner {\n width: 100%;\n margin: 15px 0;\n justify-content: space-between;\n }\n}";
|
|
@@ -11045,22 +11048,20 @@ var css_248z$3 = ".will-calendar-filter-header {\n padding: 15px 0;\n border-b
|
|
|
11045
11048
|
styleInject(css_248z$3);
|
|
11046
11049
|
|
|
11047
11050
|
var Calendar = forwardRef(function (_a, ref) {
|
|
11048
|
-
var
|
|
11051
|
+
var _b;
|
|
11052
|
+
var calendarRange = _a.calendarRange, setCalendarRange = _a.setCalendarRange, calendarOffset = _a.calendarOffset, selectedPath = _a.selectedPath, locale = _a.locale;
|
|
11049
11053
|
var isTablet = reactResponsiveExports.useMediaQuery({ maxWidth: 960 });
|
|
11050
11054
|
useEffect(function () {
|
|
11051
11055
|
if (!calendarRange)
|
|
11052
11056
|
setCalendarRange(undefined);
|
|
11053
11057
|
}, []);
|
|
11054
11058
|
var today = startOfDay(new Date());
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
// (page) => selectedPath.substring(1) === page[0]
|
|
11059
|
-
// )
|
|
11060
|
-
// : null
|
|
11059
|
+
var daysToOffsetCalendar = calendarOffset
|
|
11060
|
+
? (_b = Object.entries(calendarOffset)) === null || _b === void 0 ? void 0 : _b.find(function (page) { return selectedPath.substring(1) === page[0]; })
|
|
11061
|
+
: null;
|
|
11061
11062
|
var disabledDays = [
|
|
11062
11063
|
{
|
|
11063
|
-
from: addDays(today, -2),
|
|
11064
|
+
from: addDays(today, !!(daysToOffsetCalendar === null || daysToOffsetCalendar === void 0 ? void 0 : daysToOffsetCalendar.length) ? daysToOffsetCalendar[1] : -2),
|
|
11064
11065
|
to: addDays(today, -100),
|
|
11065
11066
|
},
|
|
11066
11067
|
];
|
|
@@ -11105,11 +11106,11 @@ var Categories = function (_a) {
|
|
|
11105
11106
|
React__default__default.createElement("span", null, itm))); }))));
|
|
11106
11107
|
};
|
|
11107
11108
|
|
|
11108
|
-
var css_248z = ".will-root {\n z-index: 999;\n width: fit-content;\n min-width: 796px;\n max-height: 100vh;\n position: relative;\n}\n\n.will-root.is-full-width {\n width: 100%;\n min-width: auto;\n}\n\n.will-filter-bar {\n box-sizing: border-box;\n position: relative;\n}\n\n/* Tabs */\n\n.will-filter-bar-tabs {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 222;\n background: transparent;\n padding: 10px;\n gap: 10px\n}\n\n/* Header */\n.will-filter-bar-header {\n display: flex;\n justify-content: space-between;\n padding: 10px;\n position: relative;\n z-index: 222;\n border-radius: 40px;\n background-color: var(--will-white);\n
|
|
11109
|
+
var css_248z = ".will-root {\n z-index: 999;\n width: fit-content;\n min-width: 796px;\n max-height: 100vh;\n position: relative;\n}\n\n.will-root.is-full-width {\n width: 100%;\n min-width: auto;\n}\n\n.will-filter-bar {\n box-sizing: border-box;\n position: relative;\n}\n\n/* Tabs */\n\n.will-filter-bar-tabs {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 222;\n background: transparent;\n padding: 10px;\n gap: 10px\n}\n\n/* Header */\n.will-filter-bar-header {\n display: flex;\n justify-content: space-between;\n padding: 10px;\n position: relative;\n z-index: 222;\n border-radius: 40px;\n background-color: var(--will-white);\n \n}\n\n\n\n@media (max-width: 960px) {\n .will-filter-bar-header {\n flex-direction: column;\n padding: 20px;\n border-radius: 25px;\n }\n}\n\n/* Container */\n\n.will-filter-bar-container {\n background-color: var(--will-white);\n min-height: 100px;\n padding: 40px 20px ;\n position: absolute;\n top: 125px;\n z-index: 111;\n border-radius: 25px;\n box-shadow: var(--will-box-shadow);\n}\n\n@media (max-width: 960px) {\n .will-root { \n width: 100%;\n min-width: auto;\n max-height: 100vh; \n z-index: 3;\n }\n\n .will-filter-bar-container {\n margin-top: 10px;\n top:0;\n padding: 30px 20px;\n position: relative;\n }\n}\n\n/* Common */\n\n.will-filter-bar-header.dark,\n.will-filter-bar-container.dark {\n box-shadow: var(--will-box-shadow-dark)\n}\n\n.will-filter-bar-header.light,\n.will-filter-bar-container.light {\n box-shadow: var(--will-box-shadow-light)\n}\n\n";
|
|
11109
11110
|
styleInject(css_248z);
|
|
11110
11111
|
|
|
11111
11112
|
function FilterBar(_a) {
|
|
11112
|
-
var language = _a.language, _b = _a.ageCategories, ageCategories = _b === void 0 ? AGE_CATEGORIES_FALLBACK : _b, _c = _a.redirectUrl, redirectUrl = _c === void 0 ? REDIRECT_URL_FALLBACK : _c, palette = _a.palette, currentViewApply = _a.currentViewApply, onSubmit = _a.onSubmit, fullWidth = _a.fullWidth, calendarOffset = _a.calendarOffset;
|
|
11113
|
+
var language = _a.language, _b = _a.ageCategories, ageCategories = _b === void 0 ? AGE_CATEGORIES_FALLBACK : _b, _c = _a.redirectUrl, redirectUrl = _c === void 0 ? REDIRECT_URL_FALLBACK : _c, palette = _a.palette, currentViewApply = _a.currentViewApply, onSubmit = _a.onSubmit, fullWidth = _a.fullWidth, calendarOffset = _a.calendarOffset, mode = _a.mode, defaultTab = _a.defaultTab;
|
|
11113
11114
|
var themePalette = useTheme({ palette: palette });
|
|
11114
11115
|
// Translations
|
|
11115
11116
|
useUpdateTranslations({ language: language });
|
|
@@ -11120,6 +11121,7 @@ function FilterBar(_a) {
|
|
|
11120
11121
|
currentViewApply: currentViewApply,
|
|
11121
11122
|
ageCategories: ageCategories,
|
|
11122
11123
|
onSubmit: onSubmit,
|
|
11124
|
+
defaultTab: defaultTab,
|
|
11123
11125
|
}), selectedFilter = _d.selectedFilter, ageCategoryCounts = _d.ageCategoryCounts, categories = _d.categories, calendarRange = _d.calendarRange, selectedPath = _d.selectedPath, setCalendarRange = _d.setCalendarRange, setCategories = _d.setCategories, handleSelectedFilter = _d.handleSelectedFilter, handleSubmit = _d.handleSubmit, updateGuestsCount = _d.updateGuestsCount, setSelectedPath = _d.setSelectedPath, handleResetFilters = _d.handleResetFilters;
|
|
11124
11126
|
// Default selected tab when tabs are hidden
|
|
11125
11127
|
useEffect(function () {
|
|
@@ -11152,11 +11154,11 @@ function FilterBar(_a) {
|
|
|
11152
11154
|
!currentViewApply && (React__default__default.createElement("div", { className: "will-filter-bar-tabs", ref: !currentViewApply ? targetFilterBarRef : null },
|
|
11153
11155
|
React__default__default.createElement(TabButton, { label: t('tabs.events'), onClick: function () {
|
|
11154
11156
|
setSelectedPath(Pages.EVENTS), handleResetFilters();
|
|
11155
|
-
}, active: selectedPath === Pages.EVENTS }),
|
|
11157
|
+
}, active: selectedPath === Pages.EVENTS, mode: mode }),
|
|
11156
11158
|
React__default__default.createElement(TabButton, { label: t('tabs.rooms'), onClick: function () {
|
|
11157
11159
|
setSelectedPath(Pages.ROOMS), handleResetFilters();
|
|
11158
|
-
}, active: selectedPath === Pages.ROOMS }))),
|
|
11159
|
-
React__default__default.createElement("div", { className: "will-filter-bar-header", ref: currentViewApply ? targetFilterBarRef : null },
|
|
11160
|
+
}, active: selectedPath === Pages.ROOMS, mode: mode }))),
|
|
11161
|
+
React__default__default.createElement("div", { className: "will-filter-bar-header ".concat(mode || 'dark'), ref: currentViewApply ? targetFilterBarRef : null },
|
|
11160
11162
|
React__default__default.createElement(SelectButton, { label: t('calendar.label'), description: parsedDates
|
|
11161
11163
|
? parsedDates
|
|
11162
11164
|
: selectedPath === Pages.ROOMS
|
|
@@ -11166,7 +11168,7 @@ function FilterBar(_a) {
|
|
|
11166
11168
|
React__default__default.createElement(Divider, null),
|
|
11167
11169
|
React__default__default.createElement(SelectButton, { label: t('guests.label'), description: parsedGuests.content, onClick: function () { return handleSelectedFilter(FilterSections.GUESTS); }, active: !!parsedGuests.data.total }))),
|
|
11168
11170
|
React__default__default.createElement(SubmitButton, { onClick: handleSubmit })),
|
|
11169
|
-
selectedFilter && (React__default__default.createElement("div", { className: "will-filter-bar-container", style: currentViewApply && !isMobile ? { top: 66 } : {} },
|
|
11171
|
+
selectedFilter && (React__default__default.createElement("div", { className: "will-filter-bar-container ".concat(mode || 'dark'), style: currentViewApply && !isMobile ? { top: 66 } : {} },
|
|
11170
11172
|
React__default__default.createElement(CloseButton, { handleClose: function () { return handleSelectedFilter(false); } }),
|
|
11171
11173
|
selectedFilter === FilterSections.CALENDAR && (React__default__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, ref: filtersRef, calendarOffset: calendarOffset, selectedPath: selectedPath, locale: language })),
|
|
11172
11174
|
selectedFilter === FilterSections.GUESTS && (React__default__default.createElement(Guests, { updateGuestsCount: updateGuestsCount, ageCategories: ageCategories, ageCategoryCounts: ageCategoryCounts, ref: filtersRef })),
|