"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _omit = _interopRequireDefault(require("lodash/omit"));

var _pick = _interopRequireDefault(require("lodash/pick"));

var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));

var _dateUtils = require("../utils/dateUtils");

var disabledDateUtils = _interopRequireWildcard(require("./disabledDateUtils"));

var _CustomProvider = require("../CustomProvider");

var _Toolbar = _interopRequireDefault(require("../DatePicker/Toolbar"));

var _Panel = _interopRequireDefault(require("./Panel"));

var _utils = require("./utils");

var _utils2 = require("../utils");

var _Picker = require("../Picker");

var _timeZone = require("../utils/timeZone");

var _partial = _interopRequireDefault(require("lodash/partial"));

var _useUpdateEffect = _interopRequireDefault(require("../utils/useUpdateEffect"));

var _Calendar = _interopRequireDefault(require("@rsuite/icons/legacy/Calendar"));

var defaultProps = (0, _extends2.default)({}, _Picker.pickerDefaultProps, {
  as: 'div',
  classPrefix: 'picker',
  cleanable: true,
  placement: 'bottomStart',
  appearance: 'default',
  format: 'yyyy-MM-dd',
  limitEndYear: 1000,
  placeholder: '',
  showOneCalendar: false,
  character: ' ~ '
});

var DateRangePicker = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
  var _ref;

  var Component = props.as,
      classPrefix = props.classPrefix,
      className = props.className,
      cleanable = props.cleanable,
      character = props.character,
      defaultCalendarValue = props.defaultCalendarValue,
      defaultValue = props.defaultValue,
      disabled = props.disabled,
      disabledDateProp = props.disabledDate,
      formatStr = props.format,
      hoverRange = props.hoverRange,
      isoWeek = props.isoWeek,
      limitEndYear = props.limitEndYear,
      overrideLocale = props.locale,
      menuClassName = props.menuClassName,
      menuStyle = props.menuStyle,
      oneTap = props.oneTap,
      placeholder = props.placeholder,
      placement = props.placement,
      ranges = props.ranges,
      renderValue = props.renderValue,
      showOneCalendar = props.showOneCalendar,
      showWeekNumbers = props.showWeekNumbers,
      style = props.style,
      timeZone = props.timeZone,
      toggleAs = props.toggleAs,
      valueProp = props.value,
      onChange = props.onChange,
      onClean = props.onClean,
      onClose = props.onClose,
      onEnter = props.onEnter,
      onEntered = props.onEntered,
      onExited = props.onExited,
      onOk = props.onOk,
      onOpen = props.onOpen,
      onSelect = props.onSelect,
      rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["as", "classPrefix", "className", "cleanable", "character", "defaultCalendarValue", "defaultValue", "disabled", "disabledDate", "format", "hoverRange", "isoWeek", "limitEndYear", "locale", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "renderValue", "showOneCalendar", "showWeekNumbers", "style", "timeZone", "toggleAs", "value", "onChange", "onClean", "onClose", "onEnter", "onEntered", "onExited", "onOk", "onOpen", "onSelect"]);

  var _useClassNames = (0, _utils2.useClassNames)(classPrefix),
      merge = _useClassNames.merge,
      prefix = _useClassNames.prefix;

  var _useCustom = (0, _utils2.useCustom)('DateRangePicker', overrideLocale),
      locale = _useCustom.locale,
      formatDate = _useCustom.formatDate;

  var rangeFormatStr = "" + formatStr + character + formatStr; // Temporary store `value` prop in a specific time zone. if `timeZone` prop not passed, use current time zone.

  var zonedValue = (0, _react.useMemo)(function () {
    return (0, _utils.toZonedValue)(valueProp, timeZone);
  }, [timeZone, valueProp]); // Temporary store `defaultValue` prop in a specific time zone. if `timeZone` prop not passed, use current time zone.

  var zonedDefaultValue = (0, _react.useMemo)(function () {
    return (0, _utils.toZonedValue)(defaultValue || [], timeZone);
  }, [defaultValue, timeZone]);

  var _useControlled = (0, _utils2.useControlled)(zonedValue, zonedDefaultValue),
      value = _useControlled[0],
      setValue = _useControlled[1];
  /**
   * Whether to complete the selection.
   * Everytime selection will change this value. If the value is false, it means that the selection has not been completed.
   *
   * In `oneTap` mode, select action will not change this value, its value should be true always.
   */


  var hasDoneSelect = (0, _react.useRef)(true);
  /**
   * The currently selected date range.
   *
   * The time range is selected by two clicks. After the first click,
   * the cursor will store a temporary event date in the process until
   * the second click to determine the end date of the date range.
   *
   */

  var _useState = (0, _react.useState)((_ref = zonedValue !== null && zonedValue !== void 0 ? zonedValue : zonedDefaultValue) !== null && _ref !== void 0 ? _ref : []),
      selectValue = _useState[0],
      setSelectValue = _useState[1]; // The date of the current hover, used to reduce the calculation of `handleMouseMove`


  var _useState2 = (0, _react.useState)([]),
      hoverValue = _useState2[0],
      setHoverValue = _useState2[1]; // The displayed calendar panel is rendered based on this value.


  var _useState3 = (0, _react.useState)((0, _utils.getCalendarDate)({
    value: zonedValue !== null && zonedValue !== void 0 ? zonedValue : (0, _utils.toZonedValue)(defaultCalendarValue, timeZone),
    timeZone: timeZone
  })),
      calendarDate = _useState3[0],
      setCalendarDate = _useState3[1];

  var _useState4 = (0, _react.useState)(),
      inputState = _useState4[0],
      setInputState = _useState4[1];
  /**
   * Call this function to update the calendar panel rendering benchmark value.
   *
   * If params `value` is not passed, it defaults to [new Date(), addMonth(new Date(), 1)].
   */


  var updateCalendarDate = (0, _react.useCallback)(function (value) {
    setCalendarDate((0, _utils.getCalendarDate)({
      value: value,
      timeZone: timeZone
    }));
  }, [timeZone]); // if valueProp changed then update selectValue/hoverValue

  (0, _react.useEffect)(function () {
    setSelectValue(zonedValue !== null && zonedValue !== void 0 ? zonedValue : []);
    setHoverValue(zonedValue !== null && zonedValue !== void 0 ? zonedValue : []);
  }, [valueProp, zonedValue]); // if selectValue changed then update calendarDate/localZonedSelectValue

  (0, _useUpdateEffect.default)(function () {
    updateCalendarDate(selectValue);
  }, [selectValue, updateCalendarDate]);

  var _useState5 = (0, _react.useState)(false),
      isPickerToggleActive = _useState5[0],
      setPickerToggleActive = _useState5[1];

  var rootRef = (0, _react.useRef)();
  var overlayRef = (0, _react.useRef)();
  var targetRef = (0, _react.useRef)();
  var triggerRef = (0, _react.useRef)();
  var handleCloseDropdown = (0, _react.useCallback)(function () {
    var _triggerRef$current, _triggerRef$current$c;

    (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$c = _triggerRef$current.close) === null || _triggerRef$current$c === void 0 ? void 0 : _triggerRef$current$c.call(_triggerRef$current);
  }, []);
  (0, _Picker.usePublicMethods)(ref, {
    triggerRef: triggerRef,
    overlayRef: overlayRef,
    targetRef: targetRef,
    rootRef: rootRef
  });
  var getDisplayString = (0, _react.useCallback)(function (nextValue, isPlaintext) {
    var _nextValue, _nextValue2;

    if (nextValue === void 0) {
      nextValue = value;
    }

    var startDate = (_nextValue = nextValue) === null || _nextValue === void 0 ? void 0 : _nextValue[0];
    var endDate = (_nextValue2 = nextValue) === null || _nextValue2 === void 0 ? void 0 : _nextValue2[1];

    if (startDate && endDate) {
      var displayValue = [startDate, endDate].sort(_dateUtils.compareAsc);

      if (isPlaintext) {
        return formatDate(displayValue[0], formatStr) + character + formatDate(displayValue[1], formatStr);
      }

      return renderValue ? renderValue((0, _utils.toLocalValue)(displayValue, timeZone), formatStr) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CustomProvider.FormattedDate, {
        date: displayValue[0],
        formatStr: formatStr
      }), character, /*#__PURE__*/_react.default.createElement(_CustomProvider.FormattedDate, {
        date: displayValue[1],
        formatStr: formatStr
      }));
    }

    return isPlaintext ? '' : placeholder || rangeFormatStr;
  }, [character, formatDate, formatStr, placeholder, rangeFormatStr, renderValue, timeZone, value]);
  /**
   * preset hover range
   */

  var getHoverRange = (0, _react.useCallback)(function (date) {
    if (!hoverRange) {
      return [];
    }

    var hoverRangeFunc = hoverRange;

    if (hoverRange === 'week') {
      hoverRangeFunc = (0, _partial.default)(_utils.getWeekHoverRange, isoWeek);
    }

    if (hoverRangeFunc === 'month') {
      hoverRangeFunc = _utils.getMonthHoverRange;
    }

    if (typeof hoverRangeFunc !== 'function') {
      return [];
    }

    var hoverValues = (0, _utils.toZonedValue)(hoverRangeFunc(_utils2.TimeZone.toLocalTimeZone(date, timeZone)), timeZone);
    var isHoverRangeValid = hoverValues instanceof Array && hoverValues.length === 2;

    if (!isHoverRangeValid) {
      return [];
    }

    if (_utils2.DateUtils.isAfter(hoverValues[0], hoverValues[1])) {
      hoverValues.reverse();
    }

    return hoverValues;
  }, [hoverRange, isoWeek, timeZone]);
  var handleValueUpdate = (0, _react.useCallback)(function (event, nextSelectValue, closeOverlay) {
    if (closeOverlay === void 0) {
      closeOverlay = true;
    }

    var nextValue = !(0, _isUndefined.default)(nextSelectValue) ? nextSelectValue : selectValue;
    setSelectValue(nextValue || []);

    if (!(0, _dateUtils.isSameDay)(nextValue[0], value[0]) || !(0, _dateUtils.isSameDay)(nextValue[1], value[1])) {
      setValue(nextValue);
      onChange === null || onChange === void 0 ? void 0 : onChange((0, _utils.toLocalValue)(nextValue, timeZone), event);
    } // `closeOverlay` default value is `true`


    if (closeOverlay !== false) {
      handleCloseDropdown();
    }
  }, [handleCloseDropdown, onChange, selectValue, setSelectValue, setValue, timeZone, value]);
  var handleMouseMove = (0, _react.useCallback)(function (date) {
    var hoverRange = getHoverRange(date);

    if (!hasDoneSelect.current) {
      setHoverValue(function (prevHoverValue) {
        var nextHoverValue = Array.from(prevHoverValue);
        nextHoverValue[+!hasDoneSelect.current] = date;
        return nextHoverValue;
      });
    } else if (hoverRange.length) {
      setHoverValue(hoverRange);
    }
  }, [getHoverRange]);
  var handleSelectValueChange = (0, _react.useCallback)(function (date, event) {
    var nextSelectValue = Array.from(hoverValue);
    var hoverRange = getHoverRange(date);
    var noHoverRangeValid = hoverRange.length !== 2; // no preset hover range can use

    if (noHoverRangeValid) {
      // start select
      if (hasDoneSelect.current) {
        nextSelectValue = [date];
      } else {
        // finish select
        nextSelectValue[1] = date;
      }
    } else {
      // use preset hover range as select value
      nextSelectValue = hoverRange;
    } // in `oneTap` mode


    if (hasDoneSelect.current && oneTap) {
      handleValueUpdate(event, noHoverRangeValid ? [(0, _utils.setTimingMargin)(date), (0, _utils.setTimingMargin)(date, 'right')] : hoverRange);
      return;
    } // If user have completed the selection, then sort


    if (nextSelectValue.length === 2 && _utils2.DateUtils.isAfter(nextSelectValue[0], nextSelectValue[1])) {
      nextSelectValue.reverse();
    }

    setHoverValue(nextSelectValue);
    setSelectValue(nextSelectValue);
    onSelect === null || onSelect === void 0 ? void 0 : onSelect((0, _timeZone.toLocalTimeZone)(date, timeZone), event);
  }, [getHoverRange, handleValueUpdate, hoverValue, onSelect, oneTap, timeZone]);
  /**
   * If `selectValue` changed, there will be the following effects.
   * 1. Check if the selection is completed.
   * 2. if the selection is completed, set the temporary `hoverValue` empty.
   */

  (0, _react.useEffect)(function () {
    var _selectValue$length;

    var selectValueLength = (_selectValue$length = selectValue === null || selectValue === void 0 ? void 0 : selectValue.length) !== null && _selectValue$length !== void 0 ? _selectValue$length : 0;
    var doneSelected = selectValueLength === 0 || selectValueLength === 2;
    hasDoneSelect.current = doneSelected;
    doneSelected && setHoverValue([]);
  }, [selectValue]);
  var handleChangeCalendarDate = (0, _react.useCallback)(function (index, date) {
    var nextCalendarDate = Array.from(calendarDate);
    nextCalendarDate[index] = date;
    updateCalendarDate(nextCalendarDate);
  }, [calendarDate, updateCalendarDate]);
  /**
   * Toolbar operation callback function
   */

  var handleShortcutPageDate = (0, _react.useCallback)(function (value, closeOverlay, event) {
    handleValueUpdate(event, value, closeOverlay);
  }, [handleValueUpdate]);
  var handleOK = (0, _react.useCallback)(function (event) {
    handleValueUpdate(event);
    onOk === null || onOk === void 0 ? void 0 : onOk((0, _utils.toLocalValue)(selectValue, timeZone), event);
  }, [handleValueUpdate, onOk, selectValue, timeZone]);
  var handleClean = (0, _react.useCallback)(function (event) {
    updateCalendarDate();
    handleValueUpdate(event, []);
  }, [handleValueUpdate, updateCalendarDate]);
  /**
   * Callback after the input box value is changed.
   */

  var handleInputChange = (0, _react.useCallback)(function (value) {
    setInputState('Typing');
    var rangeValue = value.split(character); // isMatch('01/11/2020', 'MM/dd/yyyy') ==> true
    // isMatch('2020-11-01', 'MM/dd/yyyy') ==> false

    if (!_utils2.DateUtils.isMatch(rangeValue[0], formatStr) || !_utils2.DateUtils.isMatch(rangeValue[1], formatStr)) {
      setInputState('Error');
      return;
    }

    var startDate = new Date(rangeValue[0]);
    var endDate = new Date(rangeValue[1]);
    var selectValue = [startDate, endDate];

    if (!_utils2.DateUtils.isValid(startDate) || !_utils2.DateUtils.isValid(endDate)) {
      setInputState('Error');
      return;
    }

    if (disabledDate(startDate, selectValue, true, _utils2.DATERANGE_DISABLED_TARGET.CALENDAR)) {
      setInputState('Error');
      return;
    }

    setHoverValue(selectValue);
    setSelectValue(selectValue);
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
  [character, rangeFormatStr]);
  /**
   * The callback after the enter key is triggered on the input
   */

  var handleInputBlur = (0, _react.useCallback)(function (event) {
    if (inputState === 'Typing') {
      handleValueUpdate(event, selectValue);
    }

    setInputState('Initial');
  }, [handleValueUpdate, selectValue, inputState]);
  var handleEnter = (0, _react.useCallback)(function () {
    var nextCalendarDate;

    if (value && value.length) {
      var _startDate = value[0],
          endData = value[1];
      nextCalendarDate = [_startDate, (0, _dateUtils.isSameMonth)(_startDate, endData) ? (0, _dateUtils.addMonths)(endData, 1) : endData];
    } else {
      nextCalendarDate = (0, _utils.getCalendarDate)({
        value: (0, _utils.toZonedValue)(defaultCalendarValue, timeZone),
        timeZone: timeZone
      });
    }

    setSelectValue(value);
    updateCalendarDate(nextCalendarDate);
  }, [defaultCalendarValue, updateCalendarDate, setSelectValue, timeZone, value]);
  var handleEntered = (0, _react.useCallback)(function () {
    onOpen === null || onOpen === void 0 ? void 0 : onOpen();
    setPickerToggleActive(true);
  }, [onOpen]);
  var handleExited = (0, _react.useCallback)(function () {
    setPickerToggleActive(false);
    hasDoneSelect.current = true;
    onClose === null || onClose === void 0 ? void 0 : onClose();
  }, [onClose]);
  var disabledDate = (0, _react.useCallback)(function (date, selectDate, selectedDone, target) {
    return disabledDateProp === null || disabledDateProp === void 0 ? void 0 : disabledDateProp((0, _timeZone.toLocalTimeZone)(date, timeZone), (0, _utils.toLocalValue)(selectDate, timeZone), selectedDone, target);
  }, [disabledDateProp, timeZone]);
  var disabledByBetween = (0, _react.useCallback)(function (start, end, type) {
    var selectStartDate = selectValue[0],
        selectEndDate = selectValue[1];
    var nextSelectValue = [selectStartDate, selectEndDate]; // If the date is between the start and the end
    // the button is disabled

    while (_utils2.DateUtils.isBefore(start, end) || _utils2.DateUtils.isSameDay(start, end)) {
      if (disabledDate(start, nextSelectValue, hasDoneSelect.current, type)) {
        return true;
      }

      start = _utils2.DateUtils.addDays(start, 1);
    }

    return false;
  }, [disabledDate, selectValue]);
  var disabledOkButton = (0, _react.useCallback)(function () {
    var start = selectValue[0],
        end = selectValue[1];

    if (!start || !end || !hasDoneSelect.current) {
      return true;
    }

    return disabledByBetween(start, end, _utils2.DATERANGE_DISABLED_TARGET.TOOLBAR_BUTTON_OK);
  }, [disabledByBetween, selectValue]);
  var disabledShortcutButton = (0, _react.useCallback)(function (value) {
    if (value === void 0) {
      value = [];
    }

    var _value = value,
        start = _value[0],
        end = _value[1];

    if (!start || !end) {
      return true;
    }

    return disabledByBetween(start, end, _utils2.DATERANGE_DISABLED_TARGET.TOOLBAR_SHORTCUT);
  }, [disabledByBetween]);
  var handleDisabledDate = (0, _react.useCallback)(function (date, values, type) {
    return !!disabledDate(date, values, hasDoneSelect.current, type);
  }, [disabledDate]);
  var onPickerKeyDown = (0, _Picker.useToggleKeyDownEvent)((0, _extends2.default)({
    triggerRef: triggerRef,
    targetRef: targetRef,
    active: isPickerToggleActive,
    onExit: handleClean
  }, rest));
  var renderDropdownMenu = (0, _react.useCallback)(function (positionProps, speakerRef) {
    var left = positionProps.left,
        top = positionProps.top,
        className = positionProps.className;
    var classes = merge(className, menuClassName, prefix('daterange-menu'));
    var panelClasses = prefix('daterange-panel', {
      'daterange-panel-show-one-calendar': showOneCalendar
    });
    var styles = (0, _extends2.default)({}, menuStyle, {
      left: left,
      top: top
    });
    var panelProps = {
      calendarDate: calendarDate,
      disabledDate: handleDisabledDate,
      format: formatStr,
      hoverRangeValue: hoverValue,
      isoWeek: isoWeek,
      limitEndYear: limitEndYear,
      locale: locale,
      showOneCalendar: showOneCalendar,
      showWeekNumbers: showWeekNumbers,
      timeZone: timeZone,
      value: selectValue,
      onChangeCalendarDate: handleChangeCalendarDate,
      onMouseMove: handleMouseMove,
      onSelect: handleSelectValueChange
    };
    return /*#__PURE__*/_react.default.createElement(_Picker.PickerOverlay, {
      className: classes,
      ref: (0, _utils2.mergeRefs)(overlayRef, speakerRef),
      target: triggerRef,
      style: styles
    }, /*#__PURE__*/_react.default.createElement("div", {
      className: panelClasses
    }, /*#__PURE__*/_react.default.createElement("div", {
      className: prefix('daterange-content')
    }, /*#__PURE__*/_react.default.createElement("div", {
      className: prefix('daterange-header')
    }, getDisplayString(selectValue)), /*#__PURE__*/_react.default.createElement("div", {
      className: prefix("daterange-calendar-" + (showOneCalendar ? 'single' : 'group'))
    }, /*#__PURE__*/_react.default.createElement(_Panel.default, (0, _extends2.default)({
      index: 0
    }, panelProps)), !showOneCalendar && /*#__PURE__*/_react.default.createElement(_Panel.default, (0, _extends2.default)({
      index: 1
    }, panelProps)))), /*#__PURE__*/_react.default.createElement(_Toolbar.default, {
      locale: locale,
      pageDate: selectValue,
      disabledOkBtn: disabledOkButton,
      disabledShortcut: disabledShortcutButton,
      hideOkBtn: oneTap,
      onOk: handleOK,
      onClickShortcut: handleShortcutPageDate,
      ranges: ranges,
      timeZone: timeZone
    })));
  }, [menuStyle, merge, menuClassName, prefix, showOneCalendar, calendarDate, handleDisabledDate, formatStr, hoverValue, isoWeek, limitEndYear, locale, handleChangeCalendarDate, handleMouseMove, handleSelectValueChange, showWeekNumbers, timeZone, selectValue, getDisplayString, disabledOkButton, disabledShortcutButton, oneTap, handleOK, handleShortcutPageDate, ranges]);
  var hasValue = value && value.length > 1;

  var _usePickerClassName = (0, _Picker.usePickerClassName)((0, _extends2.default)({}, props, {
    name: 'daterange',
    hasValue: hasValue
  })),
      classes = _usePickerClassName[0],
      usedClassNamePropKeys = _usePickerClassName[1];

  return /*#__PURE__*/_react.default.createElement(_Picker.PickerToggleTrigger, {
    pickerProps: (0, _pick.default)(props, _Picker.pickTriggerPropKeys),
    ref: triggerRef,
    placement: placement,
    onEnter: (0, _utils2.createChainedFunction)(handleEnter, onEnter),
    onEntered: (0, _utils2.createChainedFunction)(handleEntered, onEntered),
    onExited: (0, _utils2.createChainedFunction)(handleExited, onExited),
    speaker: renderDropdownMenu
  }, /*#__PURE__*/_react.default.createElement(Component, {
    ref: rootRef,
    className: merge(className, classes),
    style: style
  }, /*#__PURE__*/_react.default.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, (0, _omit.default)(rest, [].concat(_Picker.omitTriggerPropKeys, usedClassNamePropKeys, _utils2.DateUtils.calendarOnlyProps)), {
    as: toggleAs,
    ref: targetRef,
    input: true,
    inputMask: _utils2.DateUtils.getDateMask(rangeFormatStr),
    inputValue: value ? getDisplayString(value, true) : '',
    inputPlaceholder: typeof placeholder === 'string' && placeholder ? placeholder : rangeFormatStr,
    onInputChange: handleInputChange,
    onInputBlur: handleInputBlur,
    onKeyDown: onPickerKeyDown,
    onClean: (0, _utils2.createChainedFunction)(handleClean, onClean),
    cleanable: cleanable && !disabled,
    hasValue: hasValue,
    active: isPickerToggleActive,
    placement: placement,
    caretComponent: _Calendar.default,
    disabled: disabled
  }), getDisplayString())));
});

DateRangePicker.after = disabledDateUtils.after;
DateRangePicker.afterToday = disabledDateUtils.afterToday;
DateRangePicker.allowedDays = disabledDateUtils.allowedDays;
DateRangePicker.allowedMaxDays = disabledDateUtils.allowedMaxDays;
DateRangePicker.allowedRange = disabledDateUtils.allowedRange;
DateRangePicker.before = disabledDateUtils.before;
DateRangePicker.beforeToday = disabledDateUtils.beforeToday;
DateRangePicker.combine = disabledDateUtils.combine;
DateRangePicker.displayName = 'DateRangePicker';
DateRangePicker.defaultProps = defaultProps;
DateRangePicker.propTypes = (0, _extends2.default)({}, _Picker.pickerPropTypes, {
  ranges: _propTypes.default.array,
  value: _propTypes.default.arrayOf(_propTypes.default.instanceOf(Date)),
  defaultValue: _propTypes.default.arrayOf(_propTypes.default.instanceOf(Date)),
  defaultCalendarValue: _propTypes.default.arrayOf(_propTypes.default.instanceOf(Date)),
  hoverRange: _propTypes.default.oneOfType([_propTypes.default.oneOf(['week', 'month']), _propTypes.default.func]),
  format: _propTypes.default.string,
  timeZone: _propTypes.default.string,
  isoWeek: _propTypes.default.bool,
  oneTap: _propTypes.default.bool,
  limitEndYear: _propTypes.default.number,
  showWeekNumbers: _propTypes.default.bool,
  onChange: _propTypes.default.func,
  onOk: _propTypes.default.func,
  disabledDate: _propTypes.default.func,
  onSelect: _propTypes.default.func,
  showOneCalendar: _propTypes.default.bool
});
var _default = DateRangePicker;
exports.default = _default;