willba-component-library 0.4.2 → 0.4.3

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.js CHANGED
@@ -3093,21 +3093,17 @@ var fiCommon = {
3093
3093
  errors: errors
3094
3094
  };
3095
3095
 
3096
+ var DEFAULT_LANGUAGE = 'fi';
3096
3097
  var resources = {
3097
3098
  en: { filterBar: enFilterBar, common: enCommon },
3098
3099
  fi: { filterBar: fiFilterBar, common: fiCommon },
3099
3100
  };
3100
- var readLocaleFromUrl = function () {
3101
- if (typeof window === 'undefined')
3102
- return null;
3103
- return new URLSearchParams(window.location.search).get('locale');
3104
- };
3105
3101
  var createI18nInstance = function (language) {
3106
3102
  var instance$1 = instance.createInstance();
3107
3103
  instance$1.use(initReactI18next).init({
3108
3104
  resources: resources,
3109
- lng: language || readLocaleFromUrl() || 'fi',
3110
- fallbackLng: 'fi',
3105
+ lng: language || DEFAULT_LANGUAGE,
3106
+ fallbackLng: DEFAULT_LANGUAGE,
3111
3107
  interpolation: { escapeValue: false },
3112
3108
  });
3113
3109
  return instance$1;
@@ -3115,7 +3111,7 @@ var createI18nInstance = function (language) {
3115
3111
 
3116
3112
  var I18nProvider = function (_a) {
3117
3113
  var language = _a.language, children = _a.children;
3118
- var i18n = React.useMemo(function () { return createI18nInstance(language); }, []);
3114
+ var i18n = React.useMemo(function () { return createI18nInstance(language); }, [language]);
3119
3115
  return React.createElement(I18nextProvider, { i18n: i18n }, children);
3120
3116
  };
3121
3117
 
@@ -12647,11 +12643,9 @@ var renderCalendarErrorMessage = function (_a) {
12647
12643
  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}";
12648
12644
  styleInject(css_248z);
12649
12645
 
12650
- function FilterCalendar(props) {
12651
- return (React.createElement(I18nProvider, { language: props.language },
12652
- React.createElement(FilterCalendarInner, __assign$2({}, props))));
12653
- }
12654
- function FilterCalendarInner(_a) {
12646
+ var FilterCalendar = function (props) { return (React.createElement(I18nProvider, { language: props.language },
12647
+ React.createElement(FilterCalendarInner, __assign$2({}, props)))); };
12648
+ var FilterCalendarInner = function (_a) {
12655
12649
  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;
12656
12650
  var themePalette = useTheme({ palette: palette });
12657
12651
  // Translations
@@ -12679,7 +12673,7 @@ function FilterCalendarInner(_a) {
12679
12673
  React.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 })),
12680
12674
  React.createElement("div", { className: "will-calendar-footer" },
12681
12675
  React.createElement(Footer, { calendarHasError: calendarHasError, calendarRange: calendarRange, handleClearDates: handleClearDates, language: language, palette: palette }))))));
12682
- }
12676
+ };
12683
12677
 
12684
12678
  exports.Button = Button$1;
12685
12679
  exports.FilterBar = FilterBar;