@stenajs-webui/calendar 15.0.0-alpha.7 → 15.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # v15.0.1 (Thu Feb 17 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Increase width of DateTimeInput [#429](https://github.com/StenaIT/stenajs-webui/pull/429) ([@lindskogen](https://github.com/lindskogen))
6
+
7
+ #### ⚠️ Pushed to `master`
8
+
9
+ - Fix exact version reference ([@lindskogen](https://github.com/lindskogen))
10
+
11
+ #### Authors: 1
12
+
13
+ - Johan Lindskogen ([@lindskogen](https://github.com/lindskogen))
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { ValueAndOnValueChangeProps } from "@stenajs-webui/forms";
3
+ import { DualTextInputProps } from "../../../features/dual-text-input/DualTextInput";
3
4
  import { DateRangeInputCalendarProps } from "../../calendar-types/date-range-calendar/DateRangeCalendar";
4
5
  import { OptionalMinMaxDatesAsString } from "../../../types/CalendarTypes";
5
6
  import { DateRange } from "../../../types/DateRange";
6
- export interface DateRangeDualTextInputProps<TData = unknown> extends ValueAndOnValueChangeProps<DateRange>, OptionalMinMaxDatesAsString {
7
+ export interface DateRangeDualTextInputProps<TData = unknown> extends ValueAndOnValueChangeProps<DateRange>, OptionalMinMaxDatesAsString, Pick<DualTextInputProps, "widthLeft" | "widthRight"> {
7
8
  onEsc?: () => void;
8
9
  onEnter?: () => void;
9
10
  onBlur?: () => void;
10
11
  autoFocus?: boolean;
11
12
  calendarProps?: DateRangeInputCalendarProps<TData>;
12
13
  }
13
- export declare const DateRangeDualTextInput: <TData extends {}>({ value, onValueChange, autoFocus, onBlur, onEnter, onEsc, minDate, maxDate, calendarProps, }: DateRangeDualTextInputProps<TData>) => JSX.Element;
14
+ export declare const DateRangeDualTextInput: <TData extends {}>({ value, onValueChange, autoFocus, onBlur, onEnter, onEsc, minDate, maxDate, calendarProps, widthLeft, widthRight, }: DateRangeDualTextInputProps<TData>) => JSX.Element;
@@ -2,7 +2,7 @@
2
2
  import { Story } from "@storybook/react";
3
3
  declare const _default: {
4
4
  title: string;
5
- component: <TData extends {}>({ value, onValueChange, autoFocus, onBlur, onEnter, onEsc, minDate, maxDate, calendarProps, }: import("./DateRangeDualTextInput").DateRangeDualTextInputProps<TData>) => JSX.Element;
5
+ component: <TData extends {}>({ value, onValueChange, autoFocus, onBlur, onEnter, onEsc, minDate, maxDate, calendarProps, widthLeft, widthRight, }: import("./DateRangeDualTextInput").DateRangeDualTextInputProps<TData>) => JSX.Element;
6
6
  decorators: ((TheStory: Story) => JSX.Element)[];
7
7
  };
8
8
  export default _default;
@@ -13,3 +13,4 @@ export declare const EndSelected: () => JSX.Element;
13
13
  export declare const RangeSelected: () => JSX.Element;
14
14
  export declare const WithHiddenYearPagination: () => JSX.Element;
15
15
  export declare const MinMaxDates: () => JSX.Element;
16
+ export declare const FieldWidth: () => JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { ValueAndOnValueChangeProps } from "@stenajs-webui/forms";
2
2
  import * as React from "react";
3
+ import { DualTextInputProps } from "../../../features/dual-text-input/DualTextInput";
3
4
  import { OptionalMinMaxDatesAsString } from "../../../types/CalendarTypes";
4
- export interface DateTimeInputProps extends ValueAndOnValueChangeProps<Date | null>, OptionalMinMaxDatesAsString {
5
+ export interface DateTimeInputProps extends ValueAndOnValueChangeProps<Date | null>, OptionalMinMaxDatesAsString, Pick<DualTextInputProps, "widthLeft" | "widthRight"> {
5
6
  onEsc?: () => void;
6
7
  onEnter?: () => void;
7
8
  onBlur?: () => void;
package/dist/index.es.js CHANGED
@@ -1773,13 +1773,13 @@ var useUserInputHandlers$1 = function (onChangeDate, dateInputRef, showCalendar,
1773
1773
  };
1774
1774
 
1775
1775
  var DateTimeInput = function (_a) {
1776
- var value = _a.value, onValueChange = _a.onValueChange, onEnter = _a.onEnter, onEsc = _a.onEsc, onBlur = _a.onBlur, autoFocus = _a.autoFocus, minDate = _a.minDate, _b = _a.maxDate, maxDate = _b === void 0 ? defaultMaxDate : _b;
1776
+ 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;
1777
1777
  var dateInputRef = useRef(null);
1778
1778
  var timeInputRef = useRef(null);
1779
1779
  var states = useInputStates$1(value);
1780
1780
  var setCurrentPanel = states.setCurrentPanel, currentPanel = states.currentPanel, isCalendarVisible = states.isCalendarVisible, dateInFocus = states.dateInFocus, setDateInFocus = states.setDateInFocus, isTimePickerVisible = states.isTimePickerVisible, hideTimePicker = states.hideTimePicker, localTime = states.localTime, localDate = states.localDate;
1781
- var _c = useDateRangeHandlers$1(value, onValueChange, states, dateInputRef), showCalendar = _c.showCalendar, hideCalendar = _c.hideCalendar, inputLeftChangeHandler = _c.inputLeftChangeHandler, inputRightChangeHandler = _c.inputRightChangeHandler, onChangeTime = _c.onChangeTime, onChangeDate = _c.onChangeDate;
1782
- var _d = useUserInputHandlers$1(onChangeDate, dateInputRef, showCalendar, hideCalendar, states), onKeyDownHandler = _d.onKeyDownHandler, onFocusRight = _d.onFocusRight, onFocusLeft = _d.onFocusLeft, onClickDay = _d.onClickDay, onClickCalendarButton = _d.onClickCalendarButton, onClickArrowButton = _d.onClickArrowButton;
1781
+ var _e = useDateRangeHandlers$1(value, onValueChange, states, dateInputRef), showCalendar = _e.showCalendar, hideCalendar = _e.hideCalendar, inputLeftChangeHandler = _e.inputLeftChangeHandler, inputRightChangeHandler = _e.inputRightChangeHandler, onChangeTime = _e.onChangeTime, onChangeDate = _e.onChangeDate;
1782
+ var _f = useUserInputHandlers$1(onChangeDate, dateInputRef, showCalendar, hideCalendar, states), onKeyDownHandler = _f.onKeyDownHandler, onFocusRight = _f.onFocusRight, onFocusLeft = _f.onFocusLeft, onClickDay = _f.onClickDay, onClickCalendarButton = _f.onClickCalendarButton, onClickArrowButton = _f.onClickArrowButton;
1783
1783
  useDateRangeEffects$1(value, setDateInFocus, dateInputRef);
1784
1784
  var statePerMonth = useMemo(function () {
1785
1785
  var dateToHighlight = value || localDate;
@@ -1805,7 +1805,7 @@ var DateTimeInput = function (_a) {
1805
1805
  React.createElement(Space, null),
1806
1806
  React.createElement(Row, { justifyContent: "flex-end" },
1807
1807
  React.createElement(PrimaryButton, { label: "Done", onClick: hideTimePicker })))) : null)) },
1808
- React.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, separatorIcon: faClock$1, 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: "104px", widthRight: "64px", minLeft: minDate, maxLeft: maxDate }))));
1808
+ React.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, separatorIcon: faClock$1, 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 }))));
1809
1809
  };
1810
1810
 
1811
1811
  var useDateRangeEffects = function (startDate, endDate, setDateInFocus, startDateInputRef, endDateInputRef) {
@@ -2056,14 +2056,14 @@ var useUserInputHandlers = function (startDate, endDate, onValueChange, startDat
2056
2056
  };
2057
2057
 
2058
2058
  var DateRangeDualTextInput = function (_a) {
2059
- 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;
2060
- var _c = value || {}, startDate = _c.startDate, endDate = _c.endDate;
2059
+ 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;
2060
+ var _e = value || {}, startDate = _e.startDate, endDate = _e.endDate;
2061
2061
  var startDateInputRef = useRef(null);
2062
2062
  var endDateInputRef = useRef(null);
2063
2063
  var states = useInputStates(startDate, endDate);
2064
2064
  var dateInFocus = states.dateInFocus, setDateInFocus = states.setDateInFocus, isCalendarVisible = states.isCalendarVisible, currentPanel = states.currentPanel, setCurrentPanel = states.setCurrentPanel;
2065
- var _d = useDateRangeHandlers(startDate, endDate, onValueChange, states), showCalendar = _d.showCalendar, hideCalendar = _d.hideCalendar, inputLeftChangeHandler = _d.inputLeftChangeHandler, inputRightChangeHandler = _d.inputRightChangeHandler;
2066
- var _e = useUserInputHandlers(startDate, endDate, onValueChange, startDateInputRef, endDateInputRef, showCalendar, hideCalendar, states), onKeyDownHandler = _e.onKeyDownHandler, onFocusRight = _e.onFocusRight, onFocusLeft = _e.onFocusLeft, onClickDay = _e.onClickDay, onClickCalendarButton = _e.onClickCalendarButton, onClickArrowButton = _e.onClickArrowButton;
2065
+ var _f = useDateRangeHandlers(startDate, endDate, onValueChange, states), showCalendar = _f.showCalendar, hideCalendar = _f.hideCalendar, inputLeftChangeHandler = _f.inputLeftChangeHandler, inputRightChangeHandler = _f.inputRightChangeHandler;
2066
+ var _g = useUserInputHandlers(startDate, endDate, onValueChange, startDateInputRef, endDateInputRef, showCalendar, hideCalendar, states), onKeyDownHandler = _g.onKeyDownHandler, onFocusRight = _g.onFocusRight, onFocusLeft = _g.onFocusLeft, onClickDay = _g.onClickDay, onClickCalendarButton = _g.onClickCalendarButton, onClickArrowButton = _g.onClickArrowButton;
2067
2067
  useDateRangeEffects(startDate, endDate, setDateInFocus, startDateInputRef, endDateInputRef);
2068
2068
  var startDateIsAfterEnd = useMemo(function () { return startDate && endDate && isAfter(startDate, endDate); }, [startDate, endDate]);
2069
2069
  var statePerMonth = useMemo(function () {
@@ -2072,7 +2072,7 @@ var DateRangeDualTextInput = function (_a) {
2072
2072
  var delayedIsCalendarVisible = useDelayedFalse(isCalendarVisible, 300);
2073
2073
  return (React.createElement(Box, { onKeyDown: onKeyDownHandler },
2074
2074
  React.createElement(Popover, { arrow: false, lazy: true, placement: defaultPopoverPlacement, onClickOutside: hideCalendar, visible: isCalendarVisible, content: delayedIsCalendarVisible && (React.createElement(CalendarWithMonthSwitcher, __assign({ onClickDay: onClickDay, dateInFocus: dateInFocus, setDateInFocus: setDateInFocus, currentPanel: currentPanel, setCurrentPanel: setCurrentPanel, minDate: minDate, maxDate: maxDate }, calendarProps, { statePerMonth: statePerMonth }))) },
2075
- React.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, separatorIcon: 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: "104px", widthRight: "104px", minLeft: minDate, maxLeft: maxDate, minRight: minDate, maxRight: maxDate }))));
2075
+ React.createElement(DualTextInput, { autoFocusLeft: autoFocus, onEsc: onEsc, onEnter: onEnter, onBlur: onBlur, separatorIcon: 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 }))));
2076
2076
  };
2077
2077
 
2078
2078
  export { Calendar, CalendarDay, DateInput, DateRangeCalendar, DateRangeDualTextInput, DateRangeExclusionCalendar, DateRangeInput, DateTextInput, DateTimeInput, Month, MonthPicker, MultiDateCalendar, PresetPicker, SingleDateCalendar, SingleWeekCalendar, TimeTextInput, WeekDay, WeekDayCell, WeekNumberCell, YearPicker, addDayStateHighlights, addDayStateHighlightsOnSingleDay, addWeekRangeHighlights, addWeekStateHighlights, buildDayStateForDateRange, buildDayStateForRange, buildDayStateForSingleMonth, calculateOverflowingMonth, createDay, dateRangeToStrings, dayHasHighlight, dayHighlightSelect, defaultCalendarTheme, defaultTextPropsProvider, defaultWrapperStyleProvider, extranetCalendarTheme, getDaysForWeekForDate, getMonthInYear, getMonthsInYear, getStartDateOfISOWeek, getWeekForDate, getWeeksForMonth, isDateRangeInvalid, setDayStateValue, setDayStateValueFunction, stringsToDateRange, toggleDateStringsIfEndIsEarlierThanStart, toggleDatesIfEndIsEarlierThanStart, useDateRangeCalendarState, useDateRangeExclusionSelection, useDateRangeSelection, useMultiDateSelection, useSingleDateSelection, useSingleWeekSelection };