@stenajs-webui/calendar 15.7.0 → 17.0.0

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/dist/index.js CHANGED
@@ -169,7 +169,7 @@ var setDayStateValueFunction = function (state, date, setter) {
169
169
  var addDayStateHighlights = function (calendarState, date, highlights) {
170
170
  var _a, _b, _c;
171
171
  var month = date.getMonth() + 1;
172
- var monthString = date.getFullYear() + "-" + (month < 10 ? "0" : "") + month;
172
+ var monthString = "".concat(date.getFullYear(), "-").concat(month < 10 ? "0" : "").concat(month);
173
173
  var weekNumber = dateFns.getISOWeek(date);
174
174
  var dayInMonth = dateFns.getDate(date);
175
175
  var dayState = calendarState &&
@@ -188,7 +188,7 @@ var addWeekStateHighlights = function (calendarState, week, highlights) {
188
188
  var _a, _b;
189
189
  var date = week.days[0].date;
190
190
  var month = date.getMonth() + 1;
191
- var monthString = date.getFullYear() + "-" + (month < 10 ? "0" : "") + month;
191
+ var monthString = "".concat(date.getFullYear(), "-").concat(month < 10 ? "0" : "").concat(month);
192
192
  var weekNumber = week.weekNumber;
193
193
  var state = calendarState;
194
194
  week.days.forEach(function (day) {
@@ -1045,7 +1045,7 @@ var getWeekStringFromWeekData = function (week) {
1045
1045
  if (!week) {
1046
1046
  return undefined;
1047
1047
  }
1048
- return week.endYear + "-" + week.weekNumber;
1048
+ return "".concat(week.endYear, "-").concat(week.weekNumber);
1049
1049
  };
1050
1050
  var getWeekDataFromWeekString = function (week) {
1051
1051
  if (!week) {
@@ -1274,7 +1274,7 @@ var DateRangeInput = function (_a) {
1274
1274
  };
1275
1275
 
1276
1276
  var DateTextInput = function (_a) {
1277
- var calendarProps = _a.calendarProps, _b = _a.closeOnCalendarSelectDate, closeOnCalendarSelectDate = _b === void 0 ? true : _b, _c = _a.dateFormat, dateFormat = _c === void 0 ? DateFormats.fullDate : _c; _a.disableCalender; var onValueChange = _a.onValueChange, _e = _a.placeholder, placeholder = _e === void 0 ? "yyyy-mm-dd" : _e, portalTarget = _a.portalTarget, value = _a.value, _f = _a.width, width = _f === void 0 ? "130px" : _f, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.calendarTheme, calendarTheme = _h === void 0 ? defaultCalendarTheme : _h, _j = _a.hideCalenderIcon, hideCalenderIcon = _j === void 0 ? false : _j, minDate = _a.minDate, _k = _a.maxDate, maxDate = _k === void 0 ? defaultMaxDate : _k, props = __rest(_a, ["calendarProps", "closeOnCalendarSelectDate", "dateFormat", "disableCalender", "onValueChange", "placeholder", "portalTarget", "value", "width", "zIndex", "calendarTheme", "hideCalenderIcon", "minDate", "maxDate"]);
1277
+ var calendarProps = _a.calendarProps, _b = _a.closeOnCalendarSelectDate, closeOnCalendarSelectDate = _b === void 0 ? true : _b, _c = _a.dateFormat, dateFormat = _c === void 0 ? DateFormats.fullDate : _c; _a.disableCalender; var onValueChange = _a.onValueChange, _e = _a.placeholder, placeholder = _e === void 0 ? "yyyy-mm-dd" : _e, portalTarget = _a.portalTarget, value = _a.value, _f = _a.width, width = _f === void 0 ? "130px" : _f, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.calendarTheme, calendarTheme = _h === void 0 ? defaultCalendarTheme : _h, _j = _a.hideCalenderIcon, hideCalenderIcon = _j === void 0 ? false : _j, minDate = _a.minDate, _k = _a.maxDate, maxDate = _k === void 0 ? defaultMaxDate : _k, variant = _a.variant, props = __rest(_a, ["calendarProps", "closeOnCalendarSelectDate", "dateFormat", "disableCalender", "onValueChange", "placeholder", "portalTarget", "value", "width", "zIndex", "calendarTheme", "hideCalenderIcon", "minDate", "maxDate", "variant"]);
1278
1278
  var _l = React.useState(false), open = _l[0], setOpen = _l[1];
1279
1279
  var _m = useCalendarPopoverUpdater(), tippyRef = _m.tippyRef, onChangePanel = _m.onChangePanel;
1280
1280
  var toggleCalendar = React.useCallback(function () {
@@ -1304,7 +1304,7 @@ var DateTextInput = function (_a) {
1304
1304
  React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, visible: open, zIndex: zIndex, appendTo: portalTarget !== null && portalTarget !== void 0 ? portalTarget : "parent", placement: defaultPopoverPlacement, onClickOutside: hideCalendar, tippyRef: tippyRef, content: React__namespace.createElement(SingleDateCalendar, __assign({}, calendarProps, { onChange: onCalendarSelectDate, onChangePanel: onChangePanel, value: value && dateIsValid
1305
1305
  ? dateFns.parse(value, dateFormat, new Date())
1306
1306
  : undefined, minDate: minDate, maxDate: maxDate, theme: calendarTheme })) },
1307
- React__namespace.createElement(forms.TextInput, __assign({}, props, { variant: invalid ? "error" : "standard", disableContentPaddingRight: true, contentRight: !hideCalenderIcon ? (React__namespace.createElement(core.Row, { alignItems: "center", indent: 0.5 },
1307
+ React__namespace.createElement(forms.TextInput, __assign({}, props, { variant: invalid ? "error" : variant, disableContentPaddingRight: true, contentRight: !hideCalenderIcon ? (React__namespace.createElement(core.Row, { alignItems: "center", indent: 0.5 },
1308
1308
  React__namespace.createElement(elements.FlatButton, { size: "small", disabled: props.disabled, leftIcon: faCalendarAlt$1.faCalendarAlt, onClick: toggleCalendar }))) : undefined, onValueChange: onValueChangeHandler, placeholder: placeholder, value: value || "", min: minDate, max: maxDate, size: 10 })))));
1309
1309
  };
1310
1310
 
@@ -1321,7 +1321,7 @@ var formatHours = function (hours) {
1321
1321
  }
1322
1322
  switch (hours.length) {
1323
1323
  case 1:
1324
- return "0" + h;
1324
+ return "0".concat(h);
1325
1325
  case 2:
1326
1326
  return hours;
1327
1327
  default:
@@ -1341,7 +1341,7 @@ var formatMinutes = function (minutes) {
1341
1341
  }
1342
1342
  switch (minutes.length) {
1343
1343
  case 1:
1344
- return "0" + m;
1344
+ return "0".concat(m);
1345
1345
  case 2:
1346
1346
  return minutes;
1347
1347
  default:
@@ -1357,7 +1357,7 @@ var formatTimeString = function (time) {
1357
1357
  try {
1358
1358
  var hours = formatHours(arr[0]);
1359
1359
  var minutes = formatMinutes(arr[1]);
1360
- return { time: hours + ":" + minutes, success: true };
1360
+ return { time: "".concat(hours, ":").concat(minutes), success: true };
1361
1361
  }
1362
1362
  catch (_a) {
1363
1363
  return { time: time, success: false };
@@ -1368,21 +1368,21 @@ var formatTimeString = function (time) {
1368
1368
  var minutes = 0;
1369
1369
  switch (time.length) {
1370
1370
  case 1:
1371
- return { time: "0" + time + ":00", success: true };
1371
+ return { time: "0".concat(time, ":00"), success: true };
1372
1372
  case 2:
1373
1373
  var timeNumber = parseInt(arr[0], 10);
1374
1374
  if (timeNumber >= 0 && timeNumber < 24) {
1375
- return { time: time + ":00", success: true };
1375
+ return { time: "".concat(time, ":00"), success: true };
1376
1376
  }
1377
1377
  else if (timeNumber >= 24 && timeNumber < 59) {
1378
- return { time: "00:" + time, success: true };
1378
+ return { time: "00:".concat(time), success: true };
1379
1379
  }
1380
1380
  return { time: time, success: false };
1381
1381
  case 3:
1382
1382
  minutes = parseInt(time.substr(1, 2), 10);
1383
1383
  if (minutes >= 0 && minutes <= 59) {
1384
1384
  return {
1385
- time: "0" + time.substr(0, 1) + ":" + time.substr(1, 2),
1385
+ time: "0".concat(time.substr(0, 1), ":").concat(time.substr(1, 2)),
1386
1386
  success: true,
1387
1387
  };
1388
1388
  }
@@ -1397,7 +1397,7 @@ var formatTimeString = function (time) {
1397
1397
  return { time: time, success: false };
1398
1398
  }
1399
1399
  return {
1400
- time: time.substr(0, 2) + ":" + time.substr(2, 2),
1400
+ time: "".concat(time.substr(0, 2), ":").concat(time.substr(2, 2)),
1401
1401
  success: true,
1402
1402
  };
1403
1403
  default:
@@ -1553,7 +1553,7 @@ var getHoursAndMinutesFromTimeString = function (value) {
1553
1553
  };
1554
1554
  };
1555
1555
  var transformTimeInDateToTimeString = function (date) {
1556
- return formatHours(String(date.getHours())) + ":" + formatMinutes(String(date.getMinutes()));
1556
+ return "".concat(formatHours(String(date.getHours())), ":").concat(formatMinutes(String(date.getMinutes())));
1557
1557
  };
1558
1558
 
1559
1559
  var css_248z = ".TimePicker-module_timePicker__1ElGu {\n overflow: hidden;\n width: 180px;\n}\n\n.TimePicker-module_timePickerColumn__2vfuE {\n overflow-y: hidden;\n flex: 1;\n}\n\n.TimePicker-module_timePickerColumn__2vfuE:hover {\n overflow-y: scroll;\n }\n";
@@ -1598,11 +1598,11 @@ var TimePicker = function (_a) {
1598
1598
  }, [value]);
1599
1599
  var onClickHour = React.useCallback(function (h) {
1600
1600
  setHour(h);
1601
- onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(formatHours(String(h !== null && h !== void 0 ? h : 0)) + ":" + formatMinutes(String(minute !== null && minute !== void 0 ? minute : 0)));
1601
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("".concat(formatHours(String(h !== null && h !== void 0 ? h : 0)), ":").concat(formatMinutes(String(minute !== null && minute !== void 0 ? minute : 0))));
1602
1602
  }, [minute, onValueChange]);
1603
1603
  var onClickMinutes = React.useCallback(function (m) {
1604
1604
  setMinute(m);
1605
- onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(formatHours(String(hour !== null && hour !== void 0 ? hour : 0)) + ":" + formatMinutes(String(m !== null && m !== void 0 ? m : 0)));
1605
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("".concat(formatHours(String(hour !== null && hour !== void 0 ? hour : 0)), ":").concat(formatMinutes(String(m !== null && m !== void 0 ? m : 0))));
1606
1606
  }, [hour, onValueChange]);
1607
1607
  return (React__namespace.createElement(core.Row, { className: styles.timePicker },
1608
1608
  React__namespace.createElement(TimePickerColumn, { items: hours, onClick: onClickHour, selectedItem: hour, canScrollRef: canScrollRef }),
@@ -1799,7 +1799,7 @@ var useUserInputHandlers$1 = function (onChangeDate, dateInputRef, showCalendar,
1799
1799
  };
1800
1800
 
1801
1801
  var DateTimeInput = function (_a) {
1802
- var value = _a.value, onValueChange = _a.onValueChange, onEnter = _a.onEnter, onEsc = _a.onEsc, onBlur = _a.onBlur, autoFocus = _a.autoFocus, minDate = _a.minDate, _b = _a.widthLeft, widthLeft = _b === void 0 ? 128 : _b, _c = _a.widthRight, widthRight = _c === void 0 ? 80 : _c, _d = _a.maxDate, maxDate = _d === void 0 ? defaultMaxDate : _d, disabled = _a.disabled;
1802
+ var value = _a.value, onValueChange = _a.onValueChange, onEnter = _a.onEnter, onEsc = _a.onEsc, onBlur = _a.onBlur, autoFocus = _a.autoFocus, minDate = _a.minDate, _b = _a.widthLeft, widthLeft = _b === void 0 ? 128 : _b, _c = _a.widthRight, widthRight = _c === void 0 ? 80 : _c, _d = _a.maxDate, maxDate = _d === void 0 ? defaultMaxDate : _d, variant = _a.variant, disabled = _a.disabled;
1803
1803
  var dateInputRef = React.useRef(null);
1804
1804
  var timeInputRef = React.useRef(null);
1805
1805
  var states = useInputStates$1(value);
@@ -1831,7 +1831,7 @@ var DateTimeInput = function (_a) {
1831
1831
  React__namespace.createElement(core.Space, null),
1832
1832
  React__namespace.createElement(core.Row, { justifyContent: "flex-end" },
1833
1833
  React__namespace.createElement(elements.PrimaryButton, { label: "Done", onClick: hideTimePicker })))) : null)) },
1834
- React__namespace.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: faClock$1.faClock, typeLeft: "date", typeRight: "time", placeholderLeft: "yyyy-mm-dd", placeholderRight: "hh:mm", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: dateInputRef, inputRefRight: timeInputRef, valueRight: timeValue !== null && timeValue !== void 0 ? timeValue : "", widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate }))));
1834
+ React__namespace.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: faClock$1.faClock, typeLeft: "date", typeRight: "time", placeholderLeft: "yyyy-mm-dd", placeholderRight: "hh:mm", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: dateInputRef, inputRefRight: timeInputRef, valueRight: timeValue !== null && timeValue !== void 0 ? timeValue : "", widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate, variant: variant }))));
1835
1835
  };
1836
1836
 
1837
1837
  var useDateRangeEffects = function (startDate, endDate, setDateInFocus, startDateInputRef, endDateInputRef) {
@@ -2082,7 +2082,7 @@ var useUserInputHandlers = function (startDate, endDate, onValueChange, startDat
2082
2082
  };
2083
2083
 
2084
2084
  var DateRangeDualTextInput = function (_a) {
2085
- var value = _a.value, onValueChange = _a.onValueChange, autoFocus = _a.autoFocus, onBlur = _a.onBlur, onEnter = _a.onEnter, onEsc = _a.onEsc, minDate = _a.minDate, _b = _a.maxDate, maxDate = _b === void 0 ? defaultMaxDate : _b, calendarProps = _a.calendarProps, _c = _a.widthLeft, widthLeft = _c === void 0 ? 128 : _c, _d = _a.widthRight, widthRight = _d === void 0 ? 128 : _d, disabled = _a.disabled;
2085
+ var value = _a.value, onValueChange = _a.onValueChange, autoFocus = _a.autoFocus, onBlur = _a.onBlur, onEnter = _a.onEnter, onEsc = _a.onEsc, minDate = _a.minDate, _b = _a.maxDate, maxDate = _b === void 0 ? defaultMaxDate : _b, calendarProps = _a.calendarProps, _c = _a.widthLeft, widthLeft = _c === void 0 ? 128 : _c, _d = _a.widthRight, widthRight = _d === void 0 ? 128 : _d, variant = _a.variant, disabled = _a.disabled;
2086
2086
  var _e = value || {}, startDate = _e.startDate, endDate = _e.endDate;
2087
2087
  var startDateInputRef = React.useRef(null);
2088
2088
  var endDateInputRef = React.useRef(null);
@@ -2098,7 +2098,7 @@ var DateRangeDualTextInput = function (_a) {
2098
2098
  var delayedIsCalendarVisible = core.useDelayedFalse(isCalendarVisible, 300);
2099
2099
  return (React__namespace.createElement(core.Box, { onKeyDown: onKeyDownHandler },
2100
2100
  React__namespace.createElement(tooltip.Popover, { arrow: false, lazy: true, disabled: disabled, placement: defaultPopoverPlacement, onClickOutside: hideCalendar, visible: isCalendarVisible, content: delayedIsCalendarVisible && (React__namespace.createElement(CalendarWithMonthSwitcher, __assign({ onClickDay: onClickDay, dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, minDate: minDate, maxDate: maxDate }, calendarProps, { statePerMonth: statePerMonth }))) },
2101
- React__namespace.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: elements.stenaArrowRight, typeLeft: "date", typeRight: "date", placeholderLeft: "Start date", placeholderRight: "End date", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: startDateInputRef, inputRefRight: endDateInputRef, variant: startDateIsAfterEnd ? "error" : undefined, widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate, minRight: minDate, maxRight: maxDate }))));
2101
+ React__namespace.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, disabled: disabled, separatorIcon: elements.stenaArrowRight, typeLeft: "date", typeRight: "date", placeholderLeft: "Start date", placeholderRight: "End date", onChangeLeft: inputLeftChangeHandler, onChangeRight: inputRightChangeHandler, onClickArrowDown: onClickArrowButton, onClickCalendar: onClickCalendarButton, onFocusLeft: onFocusLeft, onFocusRight: onFocusRight, onClickLeft: onFocusLeft, onClickRight: onFocusRight, inputRefLeft: startDateInputRef, inputRefRight: endDateInputRef, variant: startDateIsAfterEnd ? "error" : variant, widthLeft: widthLeft, widthRight: widthRight, minLeft: minDate, maxLeft: maxDate, minRight: minDate, maxRight: maxDate }))));
2102
2102
  };
2103
2103
 
2104
2104
  exports.Calendar = Calendar;