willba-component-library 0.4.2 → 0.4.4

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/index.d.ts CHANGED
@@ -129,6 +129,6 @@ interface FilterCalendarTypes extends Partial<CalendarTypes> {
129
129
  setToggleCalendar: (val: boolean) => void;
130
130
  }
131
131
 
132
- declare function FilterCalendar(props: FilterCalendarTypes): React.JSX.Element;
132
+ declare const FilterCalendar: (props: FilterCalendarTypes) => React.JSX.Element;
133
133
 
134
134
  export { Button, FilterBar, FilterBarTypes, FilterCalendar, FilterCalendarTypes };
package/lib/index.esm.js CHANGED
@@ -3073,21 +3073,17 @@ var fiCommon = {
3073
3073
  errors: errors
3074
3074
  };
3075
3075
 
3076
+ var DEFAULT_LANGUAGE = 'fi';
3076
3077
  var resources = {
3077
3078
  en: { filterBar: enFilterBar, common: enCommon },
3078
3079
  fi: { filterBar: fiFilterBar, common: fiCommon },
3079
3080
  };
3080
- var readLocaleFromUrl = function () {
3081
- if (typeof window === 'undefined')
3082
- return null;
3083
- return new URLSearchParams(window.location.search).get('locale');
3084
- };
3085
3081
  var createI18nInstance = function (language) {
3086
3082
  var instance$1 = instance.createInstance();
3087
3083
  instance$1.use(initReactI18next).init({
3088
3084
  resources: resources,
3089
- lng: language || readLocaleFromUrl() || 'fi',
3090
- fallbackLng: 'fi',
3085
+ lng: language || DEFAULT_LANGUAGE,
3086
+ fallbackLng: DEFAULT_LANGUAGE,
3091
3087
  interpolation: { escapeValue: false },
3092
3088
  });
3093
3089
  return instance$1;
@@ -3095,7 +3091,7 @@ var createI18nInstance = function (language) {
3095
3091
 
3096
3092
  var I18nProvider = function (_a) {
3097
3093
  var language = _a.language, children = _a.children;
3098
- var i18n = useMemo(function () { return createI18nInstance(language); }, []);
3094
+ var i18n = useMemo(function () { return createI18nInstance(language); }, [language]);
3099
3095
  return React__default.createElement(I18nextProvider, { i18n: i18n }, children);
3100
3096
  };
3101
3097
 
@@ -12627,11 +12623,9 @@ var renderCalendarErrorMessage = function (_a) {
12627
12623
  var css_248z = ".will-root .will-calendar-wrapper {\n box-shadow: var(--will-box-shadow-dark);\n border-radius: 20px;\n background-color: var(--will-white);\n position: absolute;\n top: 0;\n left: 0;\n \n}\n\n.will-root .will-calendar-wrapper .will-calendar-header,\n.will-root .will-calendar-wrapper .will-calendar-main,\n.will-root .will-calendar-wrapper .will-calendar-footer {\n padding: 20px;\n}\n\n/* Header */\n\n.will-root .will-calendar-wrapper .will-calendar-header {\n display: flex;\n justify-content: space-between;\n border-bottom: 1px solid var(--will-grey);\n align-items: center;\n}\n\n/* Footer */\n\n.will-root .will-calendar-wrapper .will-calendar-footer {\n border-top: 1px solid var(--will-grey);\n}\n\n/* Footer actions */\n\n.will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {\n display: flex;\n justify-content: space-between;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-dates > div {\n margin-bottom: 5px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-dates-separator {\n margin: 0 15px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-dates .will-calendar-footer-booked {\n display: flex;\n min-height: 20.5px;\n margin-top: 10px;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-error {\n display: flex;\n max-width: 80%;\n}\n\n.will-root .will-calendar-wrapper .will-calendar-footer-error span {\n display: inline-block;\n margin-left: 10px;\n}\n\n@media (max-width: 960px) {\n .will-root .will-calendar-wrapper {\n width: -webkit-fill-available;\n margin: 0 -6%;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-header,\n .will-root .will-calendar-wrapper .will-calendar-main,\n .will-root .will-calendar-wrapper .will-calendar-footer {\n padding: 20px 10px;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-actions-wrapper {\n flex-direction: column;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-dates {\n text-align: center;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-dates .will-calendar-footer-booked {\n justify-content: center;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-actions {\n flex-direction: column;\n width: 100%;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-actions button{\n width: 100%;\n margin-top: 10px;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-error {\n max-width: 100%;\n }\n\n .will-root .will-calendar-wrapper .will-calendar-footer-error span {\n text-align: center;\n margin-left: 5px;\n }\n }\n\n.will-root .will-calendar-wrapper .will-calendar-header .will-filter-bar-close-button {\n position: initial;\n}";
12628
12624
  styleInject(css_248z);
12629
12625
 
12630
- function FilterCalendar(props) {
12631
- return (React__default.createElement(I18nProvider, { language: props.language },
12632
- React__default.createElement(FilterCalendarInner, __assign$2({}, props))));
12633
- }
12634
- function FilterCalendarInner(_a) {
12626
+ var FilterCalendar = function (props) { return (React__default.createElement(I18nProvider, { language: props.language },
12627
+ React__default.createElement(FilterCalendarInner, __assign$2({}, props)))); };
12628
+ var FilterCalendarInner = function (_a) {
12635
12629
  var calendarOffset = _a.calendarOffset, language = _a.language, palette = _a.palette, onSubmit = _a.onSubmit, outerDisableCalendarDates = _a.disableCalendarDates, toggleCalendar = _a.toggleCalendar, loadingData = _a.loadingData, setToggleCalendar = _a.setToggleCalendar, requestDates = _a.requestDates, showFeedback = _a.showFeedback, noActiveSelection = _a.noActiveSelection, outerRangeContext = _a.rangeContext;
12636
12630
  var themePalette = useTheme({ palette: palette });
12637
12631
  // Translations
@@ -12659,7 +12653,7 @@ function FilterCalendarInner(_a) {
12659
12653
  React__default.createElement(Calendar, { calendarRange: calendarRange, setCalendarRange: setCalendarRange, calendarOffset: calendarOffset, selectedPath: '/rooms', language: language, disableCalendarDates: disableCalendarDates, requestDates: requestDates, disabledDates: disabledDates, updateCalendarMonthNavigation: updateCalendarMonthNavigation, setUpdateCalendarMonthNavigation: setUpdateCalendarMonthNavigation, updateCalendarDefaultMonth: updateCalendarDefaultMonth, loadingData: loadingData, showFeedback: showFeedback, noActiveSelection: noActiveSelection, palette: palette, setCalendarHasError: setCalendarHasError, setUpdatedForSubmit: setUpdatedForSubmit, rangeContext: rangeContext, calendarHasError: calendarHasError })),
12660
12654
  React__default.createElement("div", { className: "will-calendar-footer" },
12661
12655
  React__default.createElement(Footer, { calendarHasError: calendarHasError, calendarRange: calendarRange, handleClearDates: handleClearDates, language: language, palette: palette }))))));
12662
- }
12656
+ };
12663
12657
 
12664
12658
  export { Button$1 as Button, FilterBar, FilterCalendar };
12665
12659
  //# sourceMappingURL=index.esm.js.map