Skip to content

Instantly share code, notes, and snippets.

@andrewhr
Created October 27, 2016 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhr/f3bed769aae094d37f12deb32d2d170b to your computer and use it in GitHub Desktop.
Save andrewhr/f3bed769aae094d37f12deb32d2d170b to your computer and use it in GitHub Desktop.
var ReactDates =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/build/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
var DateRangePicker = __webpack_require__(1)['default'];
var DateRangePickerInput = __webpack_require__(68)['default'];
var SingleDatePicker = __webpack_require__(85)['default'];
var SingleDatePickerInput = __webpack_require__(86)['default'];
var DayPicker = __webpack_require__(70)['default'];
var CalendarMonthGrid = __webpack_require__(75)['default'];
var CalendarMonth = __webpack_require__(78)['default'];
var CalendarDay = __webpack_require__(79)['default'];
var DateRangePickerShape = __webpack_require__(82)['default'];
var SingleDatePickerShape = __webpack_require__(87)['default'];
var isInclusivelyAfterDay = __webpack_require__(64)['default'];
var isInclusivelyBeforeDay = __webpack_require__(66)['default'];
var isNextDay = __webpack_require__(67)['default'];
var isSameDay = __webpack_require__(65)['default'];
var toISODateString = __webpack_require__(88)['default'];
var toLocalizedDateString = __webpack_require__(63)['default'];
var toMomentObject = __webpack_require__(62)['default'];
module.exports = {
DateRangePicker: DateRangePicker,
SingleDatePicker: SingleDatePicker,
DateRangePickerInput: DateRangePickerInput,
SingleDatePickerInput: SingleDatePickerInput,
DayPicker: DayPicker,
CalendarMonthGrid: CalendarMonthGrid,
CalendarMonth: CalendarMonth,
CalendarDay: CalendarDay,
DateRangePickerShape: DateRangePickerShape,
SingleDatePickerShape: SingleDatePickerShape,
isInclusivelyAfterDay: isInclusivelyAfterDay,
isInclusivelyBeforeDay: isInclusivelyBeforeDay,
isNextDay: isNextDay,
isSameDay: isSameDay,
toISODateString: toISODateString,
toLocalizedDateString: toLocalizedDateString,
toMomentObject: toMomentObject
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
module.exports =
/******/function (modules) {
// webpackBootstrap
/******/ // The module cache
/******/var installedModules = {};
/******/ // The require function
/******/function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/if (installedModules[moduleId])
/******/return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/var module = installedModules[moduleId] = {
/******/exports: {},
/******/id: moduleId,
/******/loaded: false
/******/ };
/******/ // Execute the module function
/******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/module.loaded = true;
/******/ // Return the exports of the module
/******/return module.exports;
/******/
}
/******/ // expose the modules object (__webpack_modules__)
/******/__webpack_require__.m = modules;
/******/ // expose the module cache
/******/__webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/__webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/return __webpack_require__(0);
/******/
}(
/************************************************************************/
/******/[
/* 0 */
/***/function (module, exports, __webpack_require__) {
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _moment = __webpack_require__(4);
var _moment2 = _interopRequireDefault(_moment);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _reactPortal = __webpack_require__(15);
var _reactPortal2 = _interopRequireDefault(_reactPortal);
var _arrayIncludes = __webpack_require__(16);
var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
var _reactTether = __webpack_require__(17);
var _reactTether2 = _interopRequireDefault(_reactTether);
var _isTouchDevice = __webpack_require__(14);
var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
var _toMomentObject = __webpack_require__(18);
var _toMomentObject2 = _interopRequireDefault(_toMomentObject);
var _toLocalizedDateString = __webpack_require__(19);
var _toLocalizedDateString2 = _interopRequireDefault(_toLocalizedDateString);
var _isInclusivelyAfterDay = __webpack_require__(20);
var _isInclusivelyAfterDay2 = _interopRequireDefault(_isInclusivelyAfterDay);
var _isInclusivelyBeforeDay = __webpack_require__(21);
var _isInclusivelyBeforeDay2 = _interopRequireDefault(_isInclusivelyBeforeDay);
var _isNextDay = __webpack_require__(22);
var _isNextDay2 = _interopRequireDefault(_isNextDay);
var _isSameDay = __webpack_require__(23);
var _isSameDay2 = _interopRequireDefault(_isSameDay);
var _DateRangePickerInput = __webpack_require__(24);
var _DateRangePickerInput2 = _interopRequireDefault(_DateRangePickerInput);
var _DayPicker = __webpack_require__(25);
var _DayPicker2 = _interopRequireDefault(_DayPicker);
var _close = __webpack_require__(26);
var _close2 = _interopRequireDefault(_close);
var _DateRangePickerShape = __webpack_require__(27);
var _DateRangePickerShape2 = _interopRequireDefault(_DateRangePickerShape);
var _constants = __webpack_require__(9);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var propTypes = _DateRangePickerShape2['default'];
var defaultProps = {
startDateId: _constants.START_DATE,
endDateId: _constants.END_DATE,
focusedInput: null,
minimumNights: 1,
isDayBlocked: function () {
function isDayBlocked() {
return false;
}
return isDayBlocked;
}(),
disabledDays: [],
isOutsideRange: function () {
function isOutsideRange(day) {
return !(0, _isInclusivelyAfterDay2['default'])(day, (0, _moment2['default'])());
}
return isOutsideRange;
}(),
enableOutsideDays: false,
numberOfMonths: 2,
showClearDates: false,
disabled: false,
required: false,
reopenPickerOnClearDates: false,
initialVisibleMonth: function () {
function initialVisibleMonth() {
return (0, _moment2['default'])();
}
return initialVisibleMonth;
}(),
orientation: _constants.HORIZONTAL_ORIENTATION,
anchorDirection: _constants.ANCHOR_LEFT,
withPortal: false,
withFullScreenPortal: false,
onDatesChange: function () {
function onDatesChange() {}
return onDatesChange;
}(),
onFocusChange: function () {
function onFocusChange() {}
return onFocusChange;
}(),
onPrevMonthClick: function () {
function onPrevMonthClick() {}
return onPrevMonthClick;
}(),
onNextMonthClick: function () {
function onNextMonthClick() {}
return onNextMonthClick;
}(),
// i18n
displayFormat: function () {
function displayFormat() {
return _moment2['default'].localeData().longDateFormat('L');
}
return displayFormat;
}(),
monthFormat: 'MMMM YYYY',
phrases: {
closeDatePicker: 'Close',
clearDates: 'Clear Dates'
}
};
var DateRangePicker = function (_React$Component) {
_inherits(DateRangePicker, _React$Component);
function DateRangePicker(props) {
_classCallCheck(this, DateRangePicker);
var _this = _possibleConstructorReturn(this, (DateRangePicker.__proto__ || Object.getPrototypeOf(DateRangePicker)).call(this, props));
_this.state = {
hoverDate: null
};
_this.isTouchDevice = (0, _isTouchDevice2['default'])();
_this.onOutsideClick = _this.onOutsideClick.bind(_this);
_this.onDayMouseEnter = _this.onDayMouseEnter.bind(_this);
_this.onDayMouseLeave = _this.onDayMouseLeave.bind(_this);
_this.onDayClick = _this.onDayClick.bind(_this);
_this.onClearFocus = _this.onClearFocus.bind(_this);
_this.onStartDateChange = _this.onStartDateChange.bind(_this);
_this.onStartDateFocus = _this.onStartDateFocus.bind(_this);
_this.onEndDateChange = _this.onEndDateChange.bind(_this);
_this.onEndDateFocus = _this.onEndDateFocus.bind(_this);
_this.clearDates = _this.clearDates.bind(_this);
return _this;
}
_createClass(DateRangePicker, [{
key: 'onClearFocus',
value: function () {
function onClearFocus() {
this.props.onFocusChange(null);
}
return onClearFocus;
}()
}, {
key: 'onDayClick',
value: function () {
function onDayClick(day, modifiers, e) {
var minimumNights = this.props.minimumNights;
if (e) e.preventDefault();
if ((0, _arrayIncludes2['default'])(modifiers, 'blocked')) return;
var focusedInput = this.props.focusedInput;
var _props = this.props,
startDate = _props.startDate,
endDate = _props.endDate;
if (focusedInput === _constants.START_DATE) {
this.props.onFocusChange(_constants.END_DATE);
startDate = day;
if ((0, _isInclusivelyAfterDay2['default'])(day, endDate)) {
endDate = null;
}
} else if (focusedInput === _constants.END_DATE) {
var firstAllowedEndDate = startDate && startDate.clone().add(minimumNights, 'days');
if (!startDate) {
endDate = day;
this.props.onFocusChange(_constants.START_DATE);
} else if ((0, _isInclusivelyAfterDay2['default'])(day, firstAllowedEndDate)) {
endDate = day;
this.props.onFocusChange(null);
} else {
startDate = day;
endDate = null;
}
}
this.props.onDatesChange({ startDate: startDate, endDate: endDate });
}
return onDayClick;
}()
}, {
key: 'onDayMouseEnter',
value: function () {
function onDayMouseEnter(day) {
if (this.isTouchDevice) return;
this.setState({
hoverDate: day
});
}
return onDayMouseEnter;
}()
}, {
key: 'onDayMouseLeave',
value: function () {
function onDayMouseLeave() {
if (this.isTouchDevice) return;
this.setState({
hoverDate: null
});
}
return onDayMouseLeave;
}()
}, {
key: 'onEndDateChange',
value: function () {
function onEndDateChange(endDateString) {
var _props2 = this.props,
startDate = _props2.startDate,
isOutsideRange = _props2.isOutsideRange,
onDatesChange = _props2.onDatesChange,
onFocusChange = _props2.onFocusChange;
var endDate = (0, _toMomentObject2['default'])(endDateString, this.getDisplayFormat());
var isEndDateValid = endDate && !isOutsideRange(endDate) && !(0, _isInclusivelyBeforeDay2['default'])(endDate, startDate);
if (isEndDateValid) {
onDatesChange({ startDate: startDate, endDate: endDate });
onFocusChange(null);
} else {
onDatesChange({
startDate: startDate,
endDate: null
});
}
}
return onEndDateChange;
}()
}, {
key: 'onEndDateFocus',
value: function () {
function onEndDateFocus() {
var _props3 = this.props,
startDate = _props3.startDate,
onFocusChange = _props3.onFocusChange,
orientation = _props3.orientation,
disabled = _props3.disabled;
if (!startDate && orientation === _constants.VERTICAL_ORIENTATION && !disabled) {
// Since the vertical datepicker is full screen, we never want to focus the end date first
// because there's no indication that that is the case once the datepicker is open and it
// might confuse the user
onFocusChange(_constants.START_DATE);
} else if (!disabled) {
onFocusChange(_constants.END_DATE);
}
}
return onEndDateFocus;
}()
}, {
key: 'onOutsideClick',
value: function () {
function onOutsideClick() {
var _props4 = this.props,
focusedInput = _props4.focusedInput,
onFocusChange = _props4.onFocusChange;
if (!focusedInput) return;
onFocusChange(null);
}
return onOutsideClick;
}()
}, {
key: 'onStartDateChange',
value: function () {
function onStartDateChange(startDateString) {
var startDate = (0, _toMomentObject2['default'])(startDateString, this.getDisplayFormat());
var endDate = this.props.endDate;
var _props5 = this.props,
isOutsideRange = _props5.isOutsideRange,
onDatesChange = _props5.onDatesChange,
onFocusChange = _props5.onFocusChange;
var isStartDateValid = startDate && !isOutsideRange(startDate);
if (isStartDateValid) {
if ((0, _isInclusivelyBeforeDay2['default'])(endDate, startDate)) {
endDate = null;
}
onDatesChange({ startDate: startDate, endDate: endDate });
onFocusChange(_constants.END_DATE);
} else {
onDatesChange({
startDate: null,
endDate: endDate
});
}
}
return onStartDateChange;
}()
}, {
key: 'onStartDateFocus',
value: function () {
function onStartDateFocus() {
if (!this.props.disabled) {
this.props.onFocusChange(_constants.START_DATE);
}
}
return onStartDateFocus;
}()
}, {
key: 'getDateString',
value: function () {
function getDateString(date) {
var displayFormat = this.getDisplayFormat();
if (date && displayFormat) {
return date && date.format(displayFormat);
}
return (0, _toLocalizedDateString2['default'])(date);
}
return getDateString;
}()
}, {
key: 'getDayPickerContainerClasses',
value: function () {
function getDayPickerContainerClasses() {
var _props6 = this.props,
orientation = _props6.orientation,
withPortal = _props6.withPortal,
withFullScreenPortal = _props6.withFullScreenPortal,
anchorDirection = _props6.anchorDirection;
var hoverDate = this.state.hoverDate;
var dayPickerClassName = (0, _classnames2['default'])('DateRangePicker__picker', {
'DateRangePicker__picker--direction-left': anchorDirection === _constants.ANCHOR_LEFT,
'DateRangePicker__picker--direction-right': anchorDirection === _constants.ANCHOR_RIGHT,
'DateRangePicker__picker--horizontal': orientation === _constants.HORIZONTAL_ORIENTATION,
'DateRangePicker__picker--vertical': orientation === _constants.VERTICAL_ORIENTATION,
'DateRangePicker__picker--portal': withPortal || withFullScreenPortal,
'DateRangePicker__picker--full-screen-portal': withFullScreenPortal,
'DateRangePicker__picker--valid-date-hovered': hoverDate && !this.isBlocked(hoverDate)
});
return dayPickerClassName;
}
return getDayPickerContainerClasses;
}()
}, {
key: 'getDayPickerDOMNode',
value: function () {
function getDayPickerDOMNode() {
return _reactDom2['default'].findDOMNode(this.dayPicker);
}
return getDayPickerDOMNode;
}()
}, {
key: 'getDisplayFormat',
value: function () {
function getDisplayFormat() {
var displayFormat = this.props.displayFormat;
return typeof displayFormat === 'string' ? displayFormat : displayFormat();
}
return getDisplayFormat;
}()
}, {
key: 'clearDates',
value: function () {
function clearDates() {
var _props7 = this.props,
onDatesChange = _props7.onDatesChange,
reopenPickerOnClearDates = _props7.reopenPickerOnClearDates,
onFocusChange = _props7.onFocusChange;
onDatesChange({ startDate: null, endDate: null });
if (reopenPickerOnClearDates) {
onFocusChange(_constants.START_DATE);
}
}
return clearDates;
}()
}, {
key: 'doesNotMeetMinimumNights',
value: function () {
function doesNotMeetMinimumNights(day) {
var _props8 = this.props,
startDate = _props8.startDate,
isOutsideRange = _props8.isOutsideRange,
focusedInput = _props8.focusedInput,
minimumNights = _props8.minimumNights;
if (focusedInput !== _constants.END_DATE) return false;
if (startDate) {
var dayDiff = day.diff(startDate, 'days');
return dayDiff < minimumNights && dayDiff >= 0;
}
return isOutsideRange((0, _moment2['default'])(day).subtract(minimumNights, 'days'));
}
return doesNotMeetMinimumNights;
}()
}, {
key: 'isDayAfterHoveredStartDate',
value: function () {
function isDayAfterHoveredStartDate(day) {
var _props9 = this.props,
startDate = _props9.startDate,
endDate = _props9.endDate,
minimumNights = _props9.minimumNights;
var hoverDate = this.state.hoverDate;
return !!startDate && !endDate && (0, _isNextDay2['default'])(hoverDate, day) && minimumNights > 0 && (0, _isSameDay2['default'])(hoverDate, startDate);
}
return isDayAfterHoveredStartDate;
}()
}, {
key: 'isEndDate',
value: function () {
function isEndDate(day) {
return (0, _isSameDay2['default'])(day, this.props.endDate);
}
return isEndDate;
}()
}, {
key: 'isHovered',
value: function () {
function isHovered(day) {
return (0, _isSameDay2['default'])(day, this.state.hoverDate);
}
return isHovered;
}()
}, {
key: 'isInHoveredSpan',
value: function () {
function isInHoveredSpan(day) {
var _props10 = this.props,
startDate = _props10.startDate,
endDate = _props10.endDate;
var hoverDate = this.state.hoverDate;
var isForwardRange = !!startDate && !endDate && (day.isBetween(startDate, hoverDate) || (0, _isSameDay2['default'])(hoverDate, day));
var isBackwardRange = !!endDate && !startDate && (day.isBetween(hoverDate, endDate) || (0, _isSameDay2['default'])(hoverDate, day));
return isForwardRange || isBackwardRange;
}
return isInHoveredSpan;
}()
}, {
key: 'isInSelectedSpan',
value: function () {
function isInSelectedSpan(day) {
var _props11 = this.props,
startDate = _props11.startDate,
endDate = _props11.endDate;
return day.isBetween(startDate, endDate);
}
return isInSelectedSpan;
}()
}, {
key: 'isLastInRange',
value: function () {
function isLastInRange(day) {
return this.isInSelectedSpan(day) && (0, _isNextDay2['default'])(day, this.props.endDate);
}
return isLastInRange;
}()
}, {
key: 'isStartDate',
value: function () {
function isStartDate(day) {
return (0, _isSameDay2['default'])(day, this.props.startDate);
}
return isStartDate;
}()
}, {
key: 'isBlocked',
value: function () {
function isBlocked(day) {
var _props12 = this.props,
isDayBlocked = _props12.isDayBlocked,
isOutsideRange = _props12.isOutsideRange;
return isDayBlocked(day) || isOutsideRange(day) || this.doesNotMeetMinimumNights(day);
}
return isBlocked;
}()
}, {
key: 'maybeRenderDayPickerWithPortal',
value: function () {
function maybeRenderDayPickerWithPortal() {
var _props13 = this.props,
focusedInput = _props13.focusedInput,
withPortal = _props13.withPortal,
withFullScreenPortal = _props13.withFullScreenPortal;
if (withPortal || withFullScreenPortal) {
return _react2['default'].createElement(_reactPortal2['default'], { isOpened: focusedInput !== null }, this.renderDayPicker());
}
return this.renderDayPicker();
}
return maybeRenderDayPickerWithPortal;
}()
}, {
key: 'renderDayPicker',
value: function () {
function renderDayPicker() {
var _this2 = this;
var _props14 = this.props,
isDayBlocked = _props14.isDayBlocked,
isOutsideRange = _props14.isOutsideRange,
numberOfMonths = _props14.numberOfMonths,
orientation = _props14.orientation,
monthFormat = _props14.monthFormat,
onPrevMonthClick = _props14.onPrevMonthClick,
onNextMonthClick = _props14.onNextMonthClick,
withPortal = _props14.withPortal,
withFullScreenPortal = _props14.withFullScreenPortal,
enableOutsideDays = _props14.enableOutsideDays,
initialVisibleMonth = _props14.initialVisibleMonth,
focusedInput = _props14.focusedInput;
var modifiers = {
blocked: function () {
function blocked(day) {
return _this2.isBlocked(day);
}
return blocked;
}(),
'blocked-calendar': function () {
function blockedCalendar(day) {
return isDayBlocked(day);
}
return blockedCalendar;
}(),
'blocked-out-of-range': function () {
function blockedOutOfRange(day) {
return isOutsideRange(day);
}
return blockedOutOfRange;
}(),
'blocked-minimum-nights': function () {
function blockedMinimumNights(day) {
return _this2.doesNotMeetMinimumNights(day);
}
return blockedMinimumNights;
}(),
valid: function () {
function valid(day) {
return !_this2.isBlocked(day);
}
return valid;
}(),
// before anything has been set or after both are set
hovered: function () {
function hovered(day) {
return _this2.isHovered(day);
}
return hovered;
}(),
// while start date has been set, but end date has not been
'hovered-span': function () {
function hoveredSpan(day) {
return _this2.isInHoveredSpan(day);
}
return hoveredSpan;
}(),
'after-hovered-start': function () {
function afterHoveredStart(day) {
return _this2.isDayAfterHoveredStartDate(day);
}
return afterHoveredStart;
}(),
'last-in-range': function () {
function lastInRange(day) {
return _this2.isLastInRange(day);
}
return lastInRange;
}(),
// once a start date and end date have been set
'selected-start': function () {
function selectedStart(day) {
return _this2.isStartDate(day);
}
return selectedStart;
}(),
'selected-end': function () {
function selectedEnd(day) {
return _this2.isEndDate(day);
}
return selectedEnd;
}(),
'selected-span': function () {
function selectedSpan(day) {
return _this2.isInSelectedSpan(day);
}
return selectedSpan;
}()
};
var onOutsideClick = !withFullScreenPortal ? this.onOutsideClick : undefined;
return _react2['default'].createElement('div', { className: this.getDayPickerContainerClasses() }, _react2['default'].createElement(_DayPicker2['default'], {
ref: function () {
function ref(_ref) {
_this2.dayPicker = _ref;
}
return ref;
}(),
orientation: orientation,
enableOutsideDays: enableOutsideDays,
modifiers: modifiers,
numberOfMonths: numberOfMonths,
onDayMouseEnter: this.onDayMouseEnter,
onDayMouseLeave: this.onDayMouseLeave,
onDayMouseDown: this.onDayClick,
onDayTouchTap: this.onDayClick,
onPrevMonthClick: onPrevMonthClick,
onNextMonthClick: onNextMonthClick,
monthFormat: monthFormat,
withPortal: withPortal || withFullScreenPortal,
hidden: !focusedInput,
initialVisibleMonth: initialVisibleMonth,
onOutsideClick: onOutsideClick
}), withFullScreenPortal && _react2['default'].createElement('button', {
className: 'DateRangePicker__close',
type: 'button',
onClick: this.onOutsideClick
}, _react2['default'].createElement('span', { className: 'screen-reader-only' }, this.props.phrases.closeDatePicker), _react2['default'].createElement(_close2['default'], null)));
}
return renderDayPicker;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this3 = this;
var _props15 = this.props,
startDate = _props15.startDate,
endDate = _props15.endDate,
focusedInput = _props15.focusedInput,
showClearDates = _props15.showClearDates,
disabled = _props15.disabled,
required = _props15.required,
startDateId = _props15.startDateId,
endDateId = _props15.endDateId,
phrases = _props15.phrases,
anchorDirection = _props15.anchorDirection,
withPortal = _props15.withPortal,
withFullScreenPortal = _props15.withFullScreenPortal;
var startDateString = this.getDateString(startDate);
var endDateString = this.getDateString(endDate);
var showDatepicker = focusedInput === _constants.START_DATE || focusedInput === _constants.END_DATE;
var tetherPinDirection = anchorDirection === _constants.ANCHOR_LEFT ? _constants.ANCHOR_RIGHT : _constants.ANCHOR_LEFT;
return _react2['default'].createElement('div', { className: 'DateRangePicker' }, _react2['default'].createElement(_reactTether2['default'], {
classPrefix: 'DateRangePicker__tether',
className: (0, _classnames2['default'])({
'DateRangePicker__tether--show': showDatepicker,
'DateRangePicker__tether--invisible': !showDatepicker
}),
attachment: 'top ' + String(anchorDirection),
targetAttachment: 'bottom ' + String(anchorDirection),
offset: '-23px 0',
constraints: [{
to: 'scrollParent',
attachment: 'none',
pin: [tetherPinDirection]
}]
}, _react2['default'].createElement(_DateRangePickerInput2['default'], {
ref: function () {
function ref(_ref2) {
_this3.input = _ref2;
}
return ref;
}(),
startDateId: startDateId,
startDatePlaceholderText: this.props.startDatePlaceholderText,
isStartDateFocused: focusedInput === _constants.START_DATE,
endDateId: endDateId,
endDatePlaceholderText: this.props.endDatePlaceholderText,
isEndDateFocused: focusedInput === _constants.END_DATE,
onStartDateChange: this.onStartDateChange,
onStartDateFocus: this.onStartDateFocus,
onStartDateShiftTab: this.onClearFocus,
onEndDateChange: this.onEndDateChange,
onEndDateFocus: this.onEndDateFocus,
onEndDateTab: this.onClearFocus,
startDate: startDateString,
endDate: endDateString,
showClearDates: showClearDates,
onClearDates: this.clearDates,
disabled: disabled,
required: required,
showCaret: !withPortal && !withFullScreenPortal,
phrases: phrases
}), this.maybeRenderDayPickerWithPortal()));
}
return render;
}()
}]);
return DateRangePicker;
}(_react2['default'].Component);
exports['default'] = DateRangePicker;
DateRangePicker.propTypes = propTypes;
DateRangePicker.defaultProps = defaultProps;
/***/
},
/* 1 */
/***/function (module, exports) {
module.exports = __webpack_require__(2);
/***/
},,,
/* 2 */
/* 3 */
/* 4 */
/***/function (module, exports) {
module.exports = __webpack_require__(3);
/***/
},
/* 5 */
/***/function (module, exports) {
module.exports = __webpack_require__(4);
/***/
},,,,
/* 6 */
/* 7 */
/* 8 */
/* 9 */
/***/function (module, exports) {
module.exports = __webpack_require__(5);
/***/
},
/* 10 */
/***/function (module, exports) {
module.exports = __webpack_require__(6);
/***/
},,,,
/* 11 */
/* 12 */
/* 13 */
/* 14 */
/***/function (module, exports) {
module.exports = __webpack_require__(7);
/***/
},
/* 15 */
/***/function (module, exports) {
module.exports = __webpack_require__(8);
/***/
},
/* 16 */
/***/function (module, exports) {
module.exports = __webpack_require__(34);
/***/
},
/* 17 */
/***/function (module, exports) {
module.exports = __webpack_require__(59);
/***/
},
/* 18 */
/***/function (module, exports) {
module.exports = __webpack_require__(62);
/***/
},
/* 19 */
/***/function (module, exports) {
module.exports = __webpack_require__(63);
/***/
},
/* 20 */
/***/function (module, exports) {
module.exports = __webpack_require__(64);
/***/
},
/* 21 */
/***/function (module, exports) {
module.exports = __webpack_require__(66);
/***/
},
/* 22 */
/***/function (module, exports) {
module.exports = __webpack_require__(67);
/***/
},
/* 23 */
/***/function (module, exports) {
module.exports = __webpack_require__(65);
/***/
},
/* 24 */
/***/function (module, exports) {
module.exports = __webpack_require__(68);
/***/
},
/* 25 */
/***/function (module, exports) {
module.exports = __webpack_require__(70);
/***/
},
/* 26 */
/***/function (module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof2(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _typeof2(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var SVG = function (_React$Component) {
_inherits(SVG, _React$Component);
function SVG() {
_classCallCheck(this, SVG);
return _possibleConstructorReturn(this, (SVG.__proto__ || Object.getPrototypeOf(SVG)).apply(this, arguments));
}
_createClass(SVG, [{
key: "render",
value: function () {
function render() {
return _react2["default"].createElement("svg", _extends({ viewBox: "0 0 12 12" }, this.props), _react2["default"].createElement("path", { fillRule: "evenodd", d: "M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z" }));
}
return render;
}()
}]);
return SVG;
}(_react2["default"].Component);
exports["default"] = SVG;
/***/
},
/* 27 */
/***/function (module, exports) {
module.exports = __webpack_require__(82);
/***/
}
/******/]);
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = React;
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = moment;
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ },
/* 5 */
/***/ function(module, exports) {
module.exports = {
DISPLAY_FORMAT: 'L',
ISO_FORMAT: 'YYYY-MM-DD',
START_DATE: 'startDate',
END_DATE: 'endDate',
HORIZONTAL_ORIENTATION: 'horizontal',
VERTICAL_ORIENTATION: 'vertical',
ANCHOR_LEFT: 'left',
ANCHOR_RIGHT: 'right'
};
/***/ },
/* 6 */
/***/ function(module, exports) {
module.exports = ReactDOM;
/***/ },
/* 7 */
/***/ function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isTouchDevice;
function isTouchDevice() {
return !!(typeof window !== 'undefined' && 'ontouchstart' in window) || !!(typeof navigator !== 'undefined' && navigator.maxTouchPoints);
}
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(2);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(6);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _CSSPropertyOperations = __webpack_require__(9);
var _CSSPropertyOperations2 = _interopRequireDefault(_CSSPropertyOperations);
var _shallowCompare = __webpack_require__(32);
var _shallowCompare2 = _interopRequireDefault(_shallowCompare);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var KEYCODES = {
ESCAPE: 27
};
var Portal = function (_React$Component) {
_inherits(Portal, _React$Component);
function Portal() {
_classCallCheck(this, Portal);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Portal).call(this));
_this.state = { active: false };
_this.handleWrapperClick = _this.handleWrapperClick.bind(_this);
_this.closePortal = _this.closePortal.bind(_this);
_this.handleOutsideMouseClick = _this.handleOutsideMouseClick.bind(_this);
_this.handleKeydown = _this.handleKeydown.bind(_this);
_this.portal = null;
_this.node = null;
return _this;
}
_createClass(Portal, [{
key: 'componentDidMount',
value: function componentDidMount() {
if (this.props.closeOnEsc) {
document.addEventListener('keydown', this.handleKeydown);
}
if (this.props.closeOnOutsideClick) {
document.addEventListener('mouseup', this.handleOutsideMouseClick);
document.addEventListener('touchstart', this.handleOutsideMouseClick);
}
if (this.props.isOpened) {
this.openPortal();
}
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(newProps) {
// portal's 'is open' state is handled through the prop isOpened
if (typeof newProps.isOpened !== 'undefined') {
if (newProps.isOpened) {
if (this.state.active) {
this.renderPortal(newProps);
} else {
this.openPortal(newProps);
}
}
if (!newProps.isOpened && this.state.active) {
this.closePortal();
}
}
// portal handles its own 'is open' state
if (typeof newProps.isOpened === 'undefined' && this.state.active) {
this.renderPortal(newProps);
}
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return (0, _shallowCompare2.default)(this, nextProps, nextState);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (this.props.closeOnEsc) {
document.removeEventListener('keydown', this.handleKeydown);
}
if (this.props.closeOnOutsideClick) {
document.removeEventListener('mouseup', this.handleOutsideMouseClick);
document.removeEventListener('touchstart', this.handleOutsideMouseClick);
}
this.closePortal(true);
}
}, {
key: 'handleWrapperClick',
value: function handleWrapperClick(e) {
e.preventDefault();
e.stopPropagation();
if (this.state.active) {
return;
}
this.openPortal();
}
}, {
key: 'openPortal',
value: function openPortal() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
this.setState({ active: true });
this.renderPortal(props);
this.props.onOpen(this.node);
}
}, {
key: 'closePortal',
value: function closePortal() {
var _this2 = this;
var isUnmounted = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
var resetPortalState = function resetPortalState() {
if (_this2.node) {
_reactDom2.default.unmountComponentAtNode(_this2.node);
document.body.removeChild(_this2.node);
}
_this2.portal = null;
_this2.node = null;
if (isUnmounted !== true) {
_this2.setState({ active: false });
}
};
if (this.state.active) {
if (this.props.beforeClose) {
this.props.beforeClose(this.node, resetPortalState);
} else {
resetPortalState();
}
this.props.onClose();
}
}
}, {
key: 'handleOutsideMouseClick',
value: function handleOutsideMouseClick(e) {
if (!this.state.active) {
return;
}
var root = (0, _reactDom.findDOMNode)(this.portal);
if (root.contains(e.target) || e.button && e.button !== 0) {
return;
}
e.stopPropagation();
this.closePortal();
}
}, {
key: 'handleKeydown',
value: function handleKeydown(e) {
if (e.keyCode === KEYCODES.ESCAPE && this.state.active) {
this.closePortal();
}
}
}, {
key: 'applyClassNameAndStyle',
value: function applyClassNameAndStyle(props) {
if (props.className) {
this.node.className = props.className;
}
if (props.style) {
// React 15.1.0+ requires third parameter in debug mode
/* eslint-disable no-underscore-dangle */
_CSSPropertyOperations2.default.setValueForStyles(this.node, props.style, this._reactInternalInstance);
/* eslint-enable no-underscore-dangle */
}
}
}, {
key: 'renderPortal',
value: function renderPortal(props) {
if (!this.node) {
this.node = document.createElement('div');
// apply CSS before the node is added to the DOM to avoid needless reflows
this.applyClassNameAndStyle(props);
document.body.appendChild(this.node);
} else {
// update CSS when new props arrive
this.applyClassNameAndStyle(props);
}
var children = props.children;
// https://gist.github.com/jimfb/d99e0678e9da715ccf6454961ef04d1b
if (typeof props.children.type === 'function') {
children = _react2.default.cloneElement(props.children, { closePortal: this.closePortal });
}
this.portal = _reactDom2.default.unstable_renderSubtreeIntoContainer(this, children, this.node, this.props.onUpdate);
}
}, {
key: 'render',
value: function render() {
if (this.props.openByClickOn) {
return _react2.default.cloneElement(this.props.openByClickOn, { onClick: this.handleWrapperClick });
}
return null;
}
}]);
return Portal;
}(_react2.default.Component);
exports.default = Portal;
Portal.propTypes = {
className: _react2.default.PropTypes.string,
style: _react2.default.PropTypes.object,
children: _react2.default.PropTypes.element.isRequired,
openByClickOn: _react2.default.PropTypes.element,
closeOnEsc: _react2.default.PropTypes.bool,
closeOnOutsideClick: _react2.default.PropTypes.bool,
isOpened: _react2.default.PropTypes.bool,
onOpen: _react2.default.PropTypes.func,
onClose: _react2.default.PropTypes.func,
beforeClose: _react2.default.PropTypes.func,
onUpdate: _react2.default.PropTypes.func
};
Portal.defaultProps = {
onOpen: function onOpen() {},
onClose: function onClose() {},
onUpdate: function onUpdate() {}
};
module.exports = exports['default'];
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSPropertyOperations
*/
'use strict';
var CSSProperty = __webpack_require__(11);
var ExecutionEnvironment = __webpack_require__(12);
var ReactInstrumentation = __webpack_require__(13);
var camelizeStyleName = __webpack_require__(26);
var dangerousStyleValue = __webpack_require__(28);
var hyphenateStyleName = __webpack_require__(29);
var memoizeStringOnly = __webpack_require__(31);
var warning = __webpack_require__(16);
var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if (process.env.NODE_ENV !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnedForNaNValue = false;
var warnHyphenatedStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
};
var warnBadVendoredStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
};
var warnStyleValueWithSemicolon = function (name, value, owner) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
};
var warnStyleValueIsNaN = function (name, value, owner) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
};
var checkRenderMessage = function (owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
};
/**
* @param {string} name
* @param {*} value
* @param {ReactDOMComponent} component
*/
var warnValidStyle = function (name, value, component) {
var owner;
if (component) {
owner = component._currentElement._owner;
}
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name, owner);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name, owner);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value, owner);
}
if (typeof value === 'number' && isNaN(value)) {
warnStyleValueIsNaN(name, value, owner);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @param {ReactDOMComponent} component
* @return {?string}
*/
createMarkupForStyles: function (styles, component) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styleValue, component);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
* @param {ReactDOMComponent} component
*/
setValueForStyles: function (node, styles, component) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onHostOperation(component._debugID, 'update styles', styles);
}
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styles[styleName], component);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
if (styleName === 'float' || styleName === 'cssFloat') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
module.exports = CSSPropertyOperations;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 10 */
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ },
/* 11 */
/***/ function(module, exports) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSProperty
*/
'use strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
borderImageOutset: true,
borderImageSlice: true,
borderImageWidth: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
gridRow: true,
gridColumn: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeDasharray: true,
strokeDashoffset: true,
strokeMiterlimit: true,
strokeOpacity: true,
strokeWidth: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
/***/ },
/* 12 */
/***/ function(module, exports) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstrumentation
*/
'use strict';
var debugTool = null;
if (process.env.NODE_ENV !== 'production') {
var ReactDebugTool = __webpack_require__(14);
debugTool = ReactDebugTool;
}
module.exports = { debugTool: debugTool };
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDebugTool
*/
'use strict';
var ReactInvalidSetStateWarningHook = __webpack_require__(15);
var ReactHostOperationHistoryHook = __webpack_require__(18);
var ReactComponentTreeHook = __webpack_require__(19);
var ReactChildrenMutationWarningHook = __webpack_require__(23);
var ExecutionEnvironment = __webpack_require__(12);
var performanceNow = __webpack_require__(24);
var warning = __webpack_require__(16);
var hooks = [];
var didHookThrowForEvent = {};
function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
try {
fn.call(context, arg1, arg2, arg3, arg4, arg5);
} catch (e) {
process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
didHookThrowForEvent[event] = true;
}
}
function emitEvent(event, arg1, arg2, arg3, arg4, arg5) {
for (var i = 0; i < hooks.length; i++) {
var hook = hooks[i];
var fn = hook[event];
if (fn) {
callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
}
}
}
var isProfiling = false;
var flushHistory = [];
var lifeCycleTimerStack = [];
var currentFlushNesting = 0;
var currentFlushMeasurements = null;
var currentFlushStartTime = null;
var currentTimerDebugID = null;
var currentTimerStartTime = null;
var currentTimerNestedFlushDuration = null;
var currentTimerType = null;
var lifeCycleTimerHasWarned = false;
function clearHistory() {
ReactComponentTreeHook.purgeUnmountedComponents();
ReactHostOperationHistoryHook.clearHistory();
}
function getTreeSnapshot(registeredIDs) {
return registeredIDs.reduce(function (tree, id) {
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var parentID = ReactComponentTreeHook.getParentID(id);
tree[id] = {
displayName: ReactComponentTreeHook.getDisplayName(id),
text: ReactComponentTreeHook.getText(id),
updateCount: ReactComponentTreeHook.getUpdateCount(id),
childIDs: ReactComponentTreeHook.getChildIDs(id),
// Text nodes don't have owners but this is close enough.
ownerID: ownerID || ReactComponentTreeHook.getOwnerID(parentID),
parentID: parentID
};
return tree;
}, {});
}
function resetMeasurements() {
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements || [];
var previousOperations = ReactHostOperationHistoryHook.getHistory();
if (currentFlushNesting === 0) {
currentFlushStartTime = null;
currentFlushMeasurements = null;
clearHistory();
return;
}
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
}
function checkDebugID(debugID) {
var allowRoot = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
if (allowRoot && debugID === 0) {
return;
}
if (!debugID) {
process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
}
}
function beginLifeCycleTimer(debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
currentTimerStartTime = performanceNow();
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = debugID;
currentTimerType = timerType;
}
function endLifeCycleTimer(debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
lifeCycleTimerHasWarned = true;
}
if (isProfiling) {
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
}
currentTimerStartTime = null;
currentTimerNestedFlushDuration = null;
currentTimerDebugID = null;
currentTimerType = null;
}
function pauseCurrentLifeCycleTimer() {
var currentTimer = {
startTime: currentTimerStartTime,
nestedFlushStartTime: performanceNow(),
debugID: currentTimerDebugID,
timerType: currentTimerType
};
lifeCycleTimerStack.push(currentTimer);
currentTimerStartTime = null;
currentTimerNestedFlushDuration = null;
currentTimerDebugID = null;
currentTimerType = null;
}
function resumeCurrentLifeCycleTimer() {
var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop();
var startTime = _lifeCycleTimerStack$.startTime;
var nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime;
var debugID = _lifeCycleTimerStack$.debugID;
var timerType = _lifeCycleTimerStack$.timerType;
var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
currentTimerStartTime = startTime;
currentTimerNestedFlushDuration += nestedFlushDuration;
currentTimerDebugID = debugID;
currentTimerType = timerType;
}
var ReactDebugTool = {
addHook: function (hook) {
hooks.push(hook);
},
removeHook: function (hook) {
for (var i = 0; i < hooks.length; i++) {
if (hooks[i] === hook) {
hooks.splice(i, 1);
i--;
}
}
},
isProfiling: function () {
return isProfiling;
},
beginProfiling: function () {
if (isProfiling) {
return;
}
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
ReactDebugTool.addHook(ReactHostOperationHistoryHook);
},
endProfiling: function () {
if (!isProfiling) {
return;
}
isProfiling = false;
resetMeasurements();
ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
},
getFlushHistory: function () {
return flushHistory;
},
onBeginFlush: function () {
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
emitEvent('onBeginFlush');
},
onEndFlush: function () {
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
emitEvent('onEndFlush');
},
onBeginLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onBeginLifeCycleTimer', debugID, timerType);
beginLifeCycleTimer(debugID, timerType);
},
onEndLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
endLifeCycleTimer(debugID, timerType);
emitEvent('onEndLifeCycleTimer', debugID, timerType);
},
onBeginProcessingChildContext: function () {
emitEvent('onBeginProcessingChildContext');
},
onEndProcessingChildContext: function () {
emitEvent('onEndProcessingChildContext');
},
onHostOperation: function (debugID, type, payload) {
checkDebugID(debugID);
emitEvent('onHostOperation', debugID, type, payload);
},
onSetState: function () {
emitEvent('onSetState');
},
onSetChildren: function (debugID, childDebugIDs) {
checkDebugID(debugID);
childDebugIDs.forEach(checkDebugID);
emitEvent('onSetChildren', debugID, childDebugIDs);
},
onBeforeMountComponent: function (debugID, element, parentDebugID) {
checkDebugID(debugID);
checkDebugID(parentDebugID, true);
emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
},
onMountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onMountComponent', debugID);
},
onBeforeUpdateComponent: function (debugID, element) {
checkDebugID(debugID);
emitEvent('onBeforeUpdateComponent', debugID, element);
},
onUpdateComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onUpdateComponent', debugID);
},
onBeforeUnmountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onBeforeUnmountComponent', debugID);
},
onUnmountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onUnmountComponent', debugID);
},
onTestEvent: function () {
emitEvent('onTestEvent');
}
};
// TODO remove these when RN/www gets updated
ReactDebugTool.addDevtool = ReactDebugTool.addHook;
ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
ReactDebugTool.addHook(ReactComponentTreeHook);
ReactDebugTool.addHook(ReactChildrenMutationWarningHook);
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
module.exports = ReactDebugTool;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInvalidSetStateWarningHook
*/
'use strict';
var warning = __webpack_require__(16);
if (process.env.NODE_ENV !== 'production') {
var processingChildContext = false;
var warnInvalidSetState = function () {
process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
};
}
var ReactInvalidSetStateWarningHook = {
onBeginProcessingChildContext: function () {
processingChildContext = true;
},
onEndProcessingChildContext: function () {
processingChildContext = false;
},
onSetState: function () {
warnInvalidSetState();
}
};
module.exports = ReactInvalidSetStateWarningHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
var emptyFunction = __webpack_require__(17);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
(function () {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
})();
}
module.exports = warning;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 17 */
/***/ function(module, exports) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ },
/* 18 */
/***/ function(module, exports) {
/**
* Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactHostOperationHistoryHook
*/
'use strict';
var history = [];
var ReactHostOperationHistoryHook = {
onHostOperation: function (debugID, type, payload) {
history.push({
instanceID: debugID,
type: type,
payload: payload
});
},
clearHistory: function () {
if (ReactHostOperationHistoryHook._preventClearing) {
// Should only be used for tests.
return;
}
history = [];
},
getHistory: function () {
return history;
}
};
module.exports = ReactHostOperationHistoryHook;
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentTreeHook
*/
'use strict';
var _prodInvariant = __webpack_require__(20);
var ReactCurrentOwner = __webpack_require__(21);
var invariant = __webpack_require__(22);
var warning = __webpack_require__(16);
function isNative(fn) {
// Based on isNative() from Lodash
var funcToString = Function.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var reIsNative = RegExp('^' + funcToString
// Take an example native function source for comparison
.call(hasOwnProperty)
// Strip regex characters so we can use it for regex
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
// Remove hasOwnProperty from the template to make it generic
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
try {
var source = funcToString.call(fn);
return reIsNative.test(source);
} catch (err) {
return false;
}
}
var canUseCollections =
// Array.from
typeof Array.from === 'function' &&
// Map
typeof Map === 'function' && isNative(Map) &&
// Map.prototype.keys
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
// Set
typeof Set === 'function' && isNative(Set) &&
// Set.prototype.keys
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
var itemMap;
var rootIDSet;
var itemByKey;
var rootByKey;
if (canUseCollections) {
itemMap = new Map();
rootIDSet = new Set();
} else {
itemByKey = {};
rootByKey = {};
}
var unmountedIDs = [];
// Use non-numeric keys to prevent V8 performance issues:
// https://github.com/facebook/react/pull/7232
function getKeyFromID(id) {
return '.' + id;
}
function getIDFromKey(key) {
return parseInt(key.substr(1), 10);
}
function get(id) {
if (canUseCollections) {
return itemMap.get(id);
} else {
var key = getKeyFromID(id);
return itemByKey[key];
}
}
function remove(id) {
if (canUseCollections) {
itemMap['delete'](id);
} else {
var key = getKeyFromID(id);
delete itemByKey[key];
}
}
function create(id, element, parentID) {
var item = {
element: element,
parentID: parentID,
text: null,
childIDs: [],
isMounted: false,
updateCount: 0
};
if (canUseCollections) {
itemMap.set(id, item);
} else {
var key = getKeyFromID(id);
itemByKey[key] = item;
}
}
function addRoot(id) {
if (canUseCollections) {
rootIDSet.add(id);
} else {
var key = getKeyFromID(id);
rootByKey[key] = true;
}
}
function removeRoot(id) {
if (canUseCollections) {
rootIDSet['delete'](id);
} else {
var key = getKeyFromID(id);
delete rootByKey[key];
}
}
function getRegisteredIDs() {
if (canUseCollections) {
return Array.from(itemMap.keys());
} else {
return Object.keys(itemByKey).map(getIDFromKey);
}
}
function getRootIDs() {
if (canUseCollections) {
return Array.from(rootIDSet.keys());
} else {
return Object.keys(rootByKey).map(getIDFromKey);
}
}
function purgeDeep(id) {
var item = get(id);
if (item) {
var childIDs = item.childIDs;
remove(id);
childIDs.forEach(purgeDeep);
}
}
function describeComponentFrame(name, source, ownerName) {
return '\n in ' + name + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
}
function getDisplayName(element) {
if (element == null) {
return '#empty';
} else if (typeof element === 'string' || typeof element === 'number') {
return '#text';
} else if (typeof element.type === 'string') {
return element.type;
} else {
return element.type.displayName || element.type.name || 'Unknown';
}
}
function describeID(id) {
var name = ReactComponentTreeHook.getDisplayName(id);
var element = ReactComponentTreeHook.getElement(id);
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var ownerName;
if (ownerID) {
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
}
process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
return describeComponentFrame(name, element && element._source, ownerName);
}
var ReactComponentTreeHook = {
onSetChildren: function (id, nextChildIDs) {
var item = get(id);
item.childIDs = nextChildIDs;
for (var i = 0; i < nextChildIDs.length; i++) {
var nextChildID = nextChildIDs[i];
var nextChild = get(nextChildID);
!nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
!nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
if (nextChild.parentID == null) {
nextChild.parentID = id;
// TODO: This shouldn't be necessary but mounting a new root during in
// componentWillMount currently causes not-yet-mounted components to
// be purged from our tree data so their parent ID is missing.
}
!(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
}
},
onBeforeMountComponent: function (id, element, parentID) {
create(id, element, parentID);
},
onBeforeUpdateComponent: function (id, element) {
var item = get(id);
if (!item || !item.isMounted) {
// We may end up here as a result of setState() in componentWillUnmount().
// In this case, ignore the element.
return;
}
item.element = element;
},
onMountComponent: function (id) {
var item = get(id);
item.isMounted = true;
var isRoot = item.parentID === 0;
if (isRoot) {
addRoot(id);
}
},
onUpdateComponent: function (id) {
var item = get(id);
if (!item || !item.isMounted) {
// We may end up here as a result of setState() in componentWillUnmount().
// In this case, ignore the element.
return;
}
item.updateCount++;
},
onUnmountComponent: function (id) {
var item = get(id);
if (item) {
// We need to check if it exists.
// `item` might not exist if it is inside an error boundary, and a sibling
// error boundary child threw while mounting. Then this instance never
// got a chance to mount, but it still gets an unmounting event during
// the error boundary cleanup.
item.isMounted = false;
var isRoot = item.parentID === 0;
if (isRoot) {
removeRoot(id);
}
}
unmountedIDs.push(id);
},
purgeUnmountedComponents: function () {
if (ReactComponentTreeHook._preventPurging) {
// Should only be used for testing.
return;
}
for (var i = 0; i < unmountedIDs.length; i++) {
var id = unmountedIDs[i];
purgeDeep(id);
}
unmountedIDs.length = 0;
},
isMounted: function (id) {
var item = get(id);
return item ? item.isMounted : false;
},
getCurrentStackAddendum: function (topElement) {
var info = '';
if (topElement) {
var type = topElement.type;
var name = typeof type === 'function' ? type.displayName || type.name : type;
var owner = topElement._owner;
info += describeComponentFrame(name || 'Unknown', topElement._source, owner && owner.getName());
}
var currentOwner = ReactCurrentOwner.current;
var id = currentOwner && currentOwner._debugID;
info += ReactComponentTreeHook.getStackAddendumByID(id);
return info;
},
getStackAddendumByID: function (id) {
var info = '';
while (id) {
info += describeID(id);
id = ReactComponentTreeHook.getParentID(id);
}
return info;
},
getChildIDs: function (id) {
var item = get(id);
return item ? item.childIDs : [];
},
getDisplayName: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (!element) {
return null;
}
return getDisplayName(element);
},
getElement: function (id) {
var item = get(id);
return item ? item.element : null;
},
getOwnerID: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (!element || !element._owner) {
return null;
}
return element._owner._debugID;
},
getParentID: function (id) {
var item = get(id);
return item ? item.parentID : null;
},
getSource: function (id) {
var item = get(id);
var element = item ? item.element : null;
var source = element != null ? element._source : null;
return source;
},
getText: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (typeof element === 'string') {
return element;
} else if (typeof element === 'number') {
return '' + element;
} else {
return null;
}
},
getUpdateCount: function (id) {
var item = get(id);
return item ? item.updateCount : 0;
},
getRegisteredIDs: getRegisteredIDs,
getRootIDs: getRootIDs
};
module.exports = ReactComponentTreeHook;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 20 */
/***/ function(module, exports) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule reactProdInvariant
*
*/
'use strict';
/**
* WARNING: DO NOT manually require this module.
* This is a replacement for `invariant(...)` used by the error code system
* and will _only_ be required by the corresponding babel pass.
* It always throws.
*/
function reactProdInvariant(code) {
var argCount = arguments.length - 1;
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
for (var argIdx = 0; argIdx < argCount; argIdx++) {
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
}
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
var error = new Error(message);
error.name = 'Invariant Violation';
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
throw error;
}
module.exports = reactProdInvariant;
/***/ },
/* 21 */
/***/ function(module, exports) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCurrentOwner
*/
'use strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/