UNPKG

@opuscapita/react-dates

Version:

Start write new project with no effort.

1,620 lines (1,356 loc) 176 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("prop-types"), require("dayjs"), require("lodash/isEqual"), require("react-motion"), require("@opuscapita/i18n/lib/converters/DateConverter"), require("@opuscapita/react-autocompletes"), require("react-day-picker"), require("react-day-picker/lib/src/DayPicker"), require("react-day-picker/lib/style.css")); else if(typeof define === 'function' && define.amd) define(["react", "prop-types", "dayjs", "lodash/isEqual", "react-motion", "@opuscapita/i18n/lib/converters/DateConverter", "@opuscapita/react-autocompletes", "react-day-picker", "react-day-picker/lib/src/DayPicker", "react-day-picker/lib/style.css"], factory); else if(typeof exports === 'object') exports["ReactDates"] = factory(require("react"), require("prop-types"), require("dayjs"), require("lodash/isEqual"), require("react-motion"), require("@opuscapita/i18n/lib/converters/DateConverter"), require("@opuscapita/react-autocompletes"), require("react-day-picker"), require("react-day-picker/lib/src/DayPicker"), require("react-day-picker/lib/style.css")); else root["ReactDates"] = factory(root["React"], root["prop-types"], root["dayjs"], root["lodash/isEqual"], root["react-motion"], root["@opuscapita/i18n/lib/converters/DateConverter"], root["@opuscapita/react-autocompletes"], root["react-day-picker"], root["react-day-picker/lib/src/DayPicker"], root["react-day-picker/lib/style.css"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_9__, __WEBPACK_EXTERNAL_MODULE_32__, __WEBPACK_EXTERNAL_MODULE_33__, __WEBPACK_EXTERNAL_MODULE_34__, __WEBPACK_EXTERNAL_MODULE_125__, __WEBPACK_EXTERNAL_MODULE_126__, __WEBPACK_EXTERNAL_MODULE_127__, __WEBPACK_EXTERNAL_MODULE_128__, __WEBPACK_EXTERNAL_MODULE_129__) { return /******/ (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] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = 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; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 130); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__(87)('wks') , uid = __webpack_require__(45) , Symbol = __webpack_require__(2).Symbol; module.exports = function(name){ return store[name] || (store[name] = Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); }; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2) , core = __webpack_require__(4) , hide = __webpack_require__(5) , redefine = __webpack_require__(17) , ctx = __webpack_require__(14) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S , IS_PROTO = type & $export.P , IS_BIND = type & $export.B , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE] , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) , key, own, out, exp; if(IS_GLOBAL)source = name; for(key in source){ // contains in native own = !IS_FORCED && target && key in target; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if(target && !own)redefine(target, key, out); // export if(exports[key] != out)hide(exports, key, exp); if(IS_PROTO && expProto[key] != out)expProto[key] = out; } }; global.core = core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap module.exports = $export; /***/ }), /* 2 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }), /* 4 */ /***/ (function(module, exports) { var core = module.exports = {version: '1.2.6'}; if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(6) , createDesc = __webpack_require__(42); module.exports = __webpack_require__(26) ? function(object, key, value){ return $.setDesc(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; /***/ }), /* 6 */ /***/ (function(module, exports) { var $Object = Object; module.exports = { create: $Object.create, getProto: $Object.getPrototypeOf, isEnum: {}.propertyIsEnumerable, getDesc: $Object.getOwnPropertyDescriptor, setDesc: $Object.defineProperty, setDescs: $Object.defineProperties, getKeys: $Object.keys, getNames: $Object.getOwnPropertyNames, getSymbols: $Object.getOwnPropertySymbols, each: [].forEach }; /***/ }), /* 7 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function() { var list = []; // return the list of modules as css string list.toString = function toString() { var result = []; for(var i = 0; i < this.length; i++) { var item = this[i]; if(item[2]) { result.push("@media " + item[2] + "{" + item[1] + "}"); } else { result.push(item[1]); } } return result.join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; /***/ }), /* 8 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}, memoize = function(fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }, isOldIE = memoize(function() { return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase()); }), getHeadElement = memoize(function () { return document.head || document.getElementsByTagName("head")[0]; }), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = []; module.exports = function(list, options) { if(typeof DEBUG !== "undefined" && DEBUG) { if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (typeof options.singleton === "undefined") options.singleton = isOldIE(); // By default, add <style> tags to the bottom of <head>. if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; var styles = listToStyles(list); addStylesToDom(styles, options); return function update(newList) { var mayRemove = []; for(var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if(newList) { var newStyles = listToStyles(newList); addStylesToDom(newStyles, options); } for(var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if(domStyle.refs === 0) { for(var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; } function addStylesToDom(styles, options) { for(var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if(domStyle) { domStyle.refs++; for(var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for(; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles(list) { var styles = []; var newStyles = {}; for(var i = 0; i < list.length; i++) { var item = list[i]; var id = item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement(options, styleElement) { var head = getHeadElement(); var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; if (options.insertAt === "top") { if(!lastStyleElementInsertedAtTop) { head.insertBefore(styleElement, head.firstChild); } else if(lastStyleElementInsertedAtTop.nextSibling) { head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); } else { head.appendChild(styleElement); } styleElementsInsertedAtTop.push(styleElement); } else if (options.insertAt === "bottom") { head.appendChild(styleElement); } else { throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); } } function removeStyleElement(styleElement) { styleElement.parentNode.removeChild(styleElement); var idx = styleElementsInsertedAtTop.indexOf(styleElement); if(idx >= 0) { styleElementsInsertedAtTop.splice(idx, 1); } } function createStyleElement(options) { var styleElement = document.createElement("style"); styleElement.type = "text/css"; insertStyleElement(options, styleElement); return styleElement; } function createLinkElement(options) { var linkElement = document.createElement("link"); linkElement.rel = "stylesheet"; insertStyleElement(options, linkElement); return linkElement; } function addStyle(obj, options) { var styleElement, update, remove; if (options.singleton) { var styleIndex = singletonCounter++; styleElement = singletonElement || (singletonElement = createStyleElement(options)); update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); } else if(obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function") { styleElement = createLinkElement(options); update = updateLink.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); if(styleElement.href) URL.revokeObjectURL(styleElement.href); }; } else { styleElement = createStyleElement(options); update = applyToTag.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); }; } update(obj); return function updateStyle(newObj) { if(newObj) { if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return; update(obj = newObj); } else { remove(); } }; } var replaceText = (function () { var textStore = []; return function (index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; })(); function applyToSingletonTag(styleElement, index, remove, obj) { var css = remove ? "" : obj.css; if (styleElement.styleSheet) { styleElement.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = styleElement.childNodes; if (childNodes[index]) styleElement.removeChild(childNodes[index]); if (childNodes.length) { styleElement.insertBefore(cssNode, childNodes[index]); } else { styleElement.appendChild(cssNode); } } } function applyToTag(styleElement, obj) { var css = obj.css; var media = obj.media; if(media) { styleElement.setAttribute("media", media) } if(styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while(styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } function updateLink(linkElement, obj) { var css = obj.css; var sourceMap = obj.sourceMap; if(sourceMap) { // http://stackoverflow.com/a/26603875 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = linkElement.href; linkElement.href = URL.createObjectURL(blob); if(oldSrc) URL.revokeObjectURL(oldSrc); } /***/ }), /* 9 */ /***/ (function(module, exports) { module.exports = require("prop-types"); /***/ }), /* 10 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function(it){ if(it == undefined)throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.locales = undefined; var _dayjs = __webpack_require__(32); var _dayjs2 = _interopRequireDefault(_dayjs); var _en = __webpack_require__(63); var _en2 = _interopRequireDefault(_en); var _es = __webpack_require__(64); var _es2 = _interopRequireDefault(_es); var _de = __webpack_require__(62); var _de2 = _interopRequireDefault(_de); var _fi = __webpack_require__(65); var _fi2 = _interopRequireDefault(_fi); var _no = __webpack_require__(66); var _no2 = _interopRequireDefault(_no); var _ru = __webpack_require__(67); var _ru2 = _interopRequireDefault(_ru); var _sv = __webpack_require__(68); var _sv2 = _interopRequireDefault(_sv); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var locales = { en: _en2.default, es: _es2.default, de: _de2.default, fi: _fi2.default, no: _no2.default, ru: _ru2.default, sv: _sv2.default }; Object.keys(locales).forEach(function (name) { return _dayjs2.default.locale(locales[name], null, true); }); exports.locales = locales; exports.default = _dayjs2.default; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(15); module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 13 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = function(it){ return toString.call(it).slice(8, -1); }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(24); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; /***/ }), /* 15 */ /***/ (function(module, exports) { module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 16 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { // add fake Function#toString // for correct work wrapped methods / constructors with methods like LoDash isNative var global = __webpack_require__(2) , hide = __webpack_require__(5) , SRC = __webpack_require__(45)('src') , TO_STRING = 'toString' , $toString = Function[TO_STRING] , TPL = ('' + $toString).split(TO_STRING); __webpack_require__(4).inspectSource = function(it){ return $toString.call(it); }; (module.exports = function(O, key, val, safe){ if(typeof val == 'function'){ val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); val.hasOwnProperty('name') || hide(val, 'name', key); } if(O === global){ O[key] = val; } else { if(!safe)delete O[key]; hide(O, key, val); } })(Function.prototype, TO_STRING, function toString(){ return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(21) , min = Math.min; module.exports = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; 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; }; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var overlayOffsetV = 4; var getCoords = exports.getCoords = function getCoords(elem, showToTop, showToLeft) { if (!elem) { return { top: 0, left: 0 }; } var rect = elem.getBoundingClientRect(); return { top: showToTop ? rect.top - overlayOffsetV + window.pageYOffset : rect.top + rect.height + overlayOffsetV + window.pageYOffset, left: showToLeft ? rect.left + rect.width + document.body.scrollLeft : rect.left + document.body.scrollLeft, alwaysLeft: rect.left + rect.width + document.body.scrollLeft }; }; var splitProps = exports.splitProps = function splitProps(props) { var specificPropNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; return Object.keys(props).reduce(function (result, propName) { var isPropSpecific = specificPropNames.indexOf(propName) >= 0; if (isPropSpecific) { var _commonProps = _extends({}, result[0]); var _specificProps = _extends({}, result[1], _defineProperty({}, propName, props[propName])); return [_commonProps, _specificProps]; } var commonProps = _extends({}, result[0], _defineProperty({}, propName, props[propName])); var specificProps = _extends({}, result[1]); return [commonProps, specificProps]; }, [{}, {}]); }; var zeroTime = exports.zeroTime = function zeroTime(date) { if (date instanceof Date) { date.setHours(0, 0, 0); } return date; }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var hide = __webpack_require__(5) , redefine = __webpack_require__(17) , fails = __webpack_require__(28) , defined = __webpack_require__(10) , wks = __webpack_require__(0); module.exports = function(KEY, length, exec){ var SYMBOL = wks(KEY) , original = ''[KEY]; if(fails(function(){ var O = {}; O[SYMBOL] = function(){ return 7; }; return ''[KEY](O) != 7; })){ redefine(String.prototype, KEY, exec(defined, SYMBOL, original)); hide(RegExp.prototype, SYMBOL, length == 2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) // 21.2.5.11 RegExp.prototype[@@split](string, limit) ? function(string, arg){ return original.call(string, this, arg); } // 21.2.5.6 RegExp.prototype[@@match](string) // 21.2.5.9 RegExp.prototype[@@search](string) : function(string){ return original.call(string, this); } ); } }; /***/ }), /* 21 */ /***/ (function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil , floor = Math.floor; module.exports = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = __webpack_require__(60).default; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getMessage; var translations = { en: { 'common.DateInput.today': 'Today', 'common.DateInput.yesterday': 'Yesterday', 'common.DateInput.tomorrow': 'Tomorrow', 'common.DateRangeInput.previousWeek': 'Previous week', 'common.DateRangeInput.nextWeek': 'Next week', 'common.DateRangeInput.thisWeek': 'This week', 'common.DateRangeInput.previousMonth': 'Previous month', 'common.DateRangeInput.last30Days': 'Last 30 days', 'common.DateRangeInput.thisMonth': 'This month', 'common.DateRangeInput.nextMonth': 'Next month', 'common.DateInput.clearValue': 'Clear value' }, de: { 'common.DateInput.today': 'Heute', 'common.DateInput.yesterday': 'Gestern', 'common.DateInput.tomorrow': 'Morgen', 'common.DateRangeInput.previousWeek': 'Vorherige Woche', 'common.DateRangeInput.nextWeek': 'Nächste Woche', 'common.DateRangeInput.thisWeek': 'Diese Woche', 'common.DateRangeInput.previousMonth': 'Vorheriger Monat', 'common.DateRangeInput.last30Days': 'Letzte 30 Tagen', 'common.DateRangeInput.thisMonth': 'Dieser Monat', 'common.DateRangeInput.nextMonth': 'Nächster Monat', 'common.DateInput.clearValue': 'Inhalt löschen' }, ru: { 'common.DateInput.today': 'Сегодня', 'common.DateInput.yesterday': 'Вчера', 'common.DateInput.tomorrow': 'Завтра', 'common.DateRangeInput.previousWeek': 'Предыдущая неделя', 'common.DateRangeInput.nextWeek': 'Следующая неделя', 'common.DateRangeInput.thisWeek': 'Эта неделя', 'common.DateRangeInput.previousMonth': 'Предыдущий месяц', 'common.DateRangeInput.last30Days': 'Последние 30 дней', 'common.DateRangeInput.thisMonth': 'Этот месяц', 'common.DateRangeInput.nextMonth': 'Следующий месяц', 'common.DateInput.clearValue': '' }, fi: { 'common.DateInput.today': 'Tänään', 'common.DateInput.yesterday': 'Eilen', 'common.DateInput.tomorrow': 'Huomenna', 'common.DateRangeInput.previousWeek': 'Edellinen viikko', 'common.DateRangeInput.nextWeek': 'Seuraava viikko', 'common.DateRangeInput.thisWeek': 'Tämä viikko', 'common.DateRangeInput.previousMonth': 'Edellinen kuukausi', 'common.DateRangeInput.last30Days': 'Edelliset 30 päivää', 'common.DateRangeInput.thisMonth': 'Tämä kuukausi', 'common.DateRangeInput.nextMonth': 'Seuraava kuukausi', 'common.DateInput.clearValue': '' }, no: { 'common.DateInput.today': 'I dag', 'common.DateInput.yesterday': 'I går', 'common.DateInput.tomorrow': 'I morgen', 'common.DateRangeInput.previousWeek': 'Forrige uke', 'common.DateRangeInput.nextWeek': 'Neste uke', 'common.DateRangeInput.thisWeek': 'Denne uken', 'common.DateRangeInput.previousMonth': 'Foregående måned', 'common.DateRangeInput.last30Days': 'Siste 30 dager', 'common.DateRangeInput.thisMonth': 'Denne måneden', 'common.DateRangeInput.nextMonth': 'Neste måned', 'common.DateInput.clearValue': '' }, sv: { 'common.DateInput.today': 'Idag', 'common.DateInput.yesterday': 'Igår', 'common.DateInput.tomorrow': 'Imorgon', 'common.DateRangeInput.previousWeek': 'Föregående vecka', 'common.DateRangeInput.nextWeek': 'Nästa vecka', 'common.DateRangeInput.thisWeek': 'Denna vecka', 'common.DateRangeInput.previousMonth': 'Föregående månad', 'common.DateRangeInput.last30Days': 'SSenaste 30 dagarna', 'common.DateRangeInput.thisMonth': 'Denna månad', 'common.DateRangeInput.nextMonth': 'Nästa månad', 'common.DateInput.clearValue': '' } }; function getMessage(locale, key) { var translationExists = translations[locale] && translations[locale][key]; if (!translationExists) { return translations['en'][key]; } return translations[locale][key]; } /***/ }), /* 24 */ /***/ (function(module, exports) { module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(13) , TAG = __webpack_require__(0)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = (O = Object(it))[TAG]) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(28)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { var MATCH = __webpack_require__(0)('match'); module.exports = function(KEY){ var re = /./; try { '/./'[KEY](re); } catch(e){ try { re[MATCH] = false; return !'/./'[KEY](re); } catch(f){ /* empty */ } } return true; }; /***/ }), /* 28 */ /***/ (function(module, exports) { module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } }; /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { var def = __webpack_require__(6).setDesc , has = __webpack_require__(39) , TAG = __webpack_require__(0)('toStringTag'); module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); }; /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { // helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(77) , defined = __webpack_require__(10); module.exports = function(that, searchString, NAME){ if(isRegExp(searchString))throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(75) , defined = __webpack_require__(10); module.exports = function(it){ return IObject(defined(it)); }; /***/ }), /* 32 */ /***/ (function(module, exports) { module.exports = require("dayjs"); /***/ }), /* 33 */ /***/ (function(module, exports) { module.exports = require("lodash/isEqual"); /***/ }), /* 34 */ /***/ (function(module, exports) { module.exports = require("react-motion"); /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = __webpack_require__(53).default; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = __webpack_require__(58).default; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = __webpack_require__(61).default; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = __webpack_require__(0)('unscopables') , ArrayProto = Array.prototype; if(ArrayProto[UNSCOPABLES] == undefined)__webpack_require__(5)(ArrayProto, UNSCOPABLES, {}); module.exports = function(key){ ArrayProto[UNSCOPABLES][key] = true; }; /***/ }), /* 39 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function(it, key){ return hasOwnProperty.call(it, key); }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(41) , $export = __webpack_require__(1) , redefine = __webpack_require__(17) , hide = __webpack_require__(5) , has = __webpack_require__(39) , Iterators = __webpack_require__(16) , $iterCreate = __webpack_require__(79) , setToStringTag = __webpack_require__(29) , getProto = __webpack_require__(6).getProto , ITERATOR = __webpack_require__(0)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' , KEYS = 'keys' , VALUES = 'values'; var returnThis = function(){ return this; }; module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto)return proto[kind]; switch(kind){ case KEYS: return function keys(){ return new Constructor(this, kind); }; case VALUES: return function values(){ return new Constructor(this, kind); }; } return function entries(){ return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator' , DEF_VALUES = DEFAULT == VALUES , VALUES_BUG = false , proto = Base.prototype , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] , $default = $native || getMethod(DEFAULT) , methods, key; // Fix native if($native){ var IteratorPrototype = getProto($default.call(new Base)); // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // FF fix if(!LIBRARY && has(proto, FF_ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); // fix Array#{values, @@iterator}.name in V8 / FF if(DEF_VALUES && $native.name !== VALUES){ VALUES_BUG = true; $default = function values(){ return $native.call(this); }; } } // Define iterator if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if(DEFAULT){ methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: !DEF_VALUES ? $default : getMethod('entries') }; if(FORCED)for(key in methods){ if(!(key in proto))redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /* 41 */ /***/ (function(module, exports) { module.exports = false; /***/ }), /* 42 */ /***/ (function(module, exports) { module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(21) , defined = __webpack_require__(10); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ return function(that, pos){ var s = String(defined(that)) , i = toInteger(pos) , l = s.length , a, b; if(i < 0 || i >= l)return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(21) , max = Math.max , min = Math.min; module.exports = function(index, length){ index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }), /* 45 */ /***/ (function(module, exports) { var id = 0 , px = Math.random(); module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $at = __webpack_require__(43)(true); // 21.1.3.27 String.prototype[@@iterator]() __webpack_require__(40)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var O = this._t , index = this._i , point; if(index >= O.length)return {value: undefined, done: true}; point = $at(O, index); this._i += point.length; return {value: point, done: false}; }); /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Here should be es2016 or CommonJS exports. module.exports = { DateInput: __webpack_require__(52).default, DateRangeInput: __webpack_require__(57).default, DatePicker: __webpack_require__(55).default, ModifiersUtils: __webpack_require__(127).ModifiersUtils }; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(95); __webpack_require__(46); __webpack_require__(110); __webpack_require__(96); module.exports = __webpack_require__(4).Promise; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(103); __webpack_require__(105); __webpack_require__(108); __webpack_require__(46); __webpack_require__(101); __webpack_require__(102); __webpack_require__(104); __webpack_require__(106); __webpack_require__(107); __webpack_require__(97); __webpack_require__(98); __webpack_require__(99); __webpack_require__(100); module.exports = __webpack_require__(4).String; /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(109); module.exports = __webpack_require__(4).Array; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; 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 _propTypes = __webpack_require__(9); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); __webpack_require__(118); var _DateInputField = __webpack_require__(35); var _DateInputField2 = _interopRequireDefault(_DateInputField); var _DayPicker = __webpack_require__(22); var _DayPicker2 = _interopRequireDefault(_DayPicker); var _DateVariants = __webpack_require__(36); var _DateVariants2 = _interopRequireDefault(_DateVariants); var _InputAddonButton = __webpack_require__(37); var _InputAddonButton2 = _interopRequireDefault(_InputAddonButton); var _reactMotion = __webpack_require__(34); var _dayjs = __webpack_require__(11); var _dayjs2 = _interopRequireDefault(_dayjs); var _translations = __webpack_require__(23); var _translations2 = _interopRequireDefault(_translations); var _isEqual = __webpack_require__(33); var _isEqual2 = _interopRequireDefault(_isEqual); var _utils = __webpack_require__(19); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } 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 springPreset = _reactMotion.presets.gentle; var easeOutCubic = function easeOutCubic(t) { return --t * t * t + 1; }; // eslint-disable-line no-param-reassign var propTypes = { className: _propTypes2.default.string, dateFormat: _propTypes2.default.string, disabled: _propTypes2.default.bool, isValid: _propTypes2.default.bool, locale: _propTypes2.default.string, modifiers: _propTypes2.default.object, onBlur: _propTypes2.default.func, onChange: _propTypes2.default.func, onFocus: _propTypes2.default.func, showToLeft: _propTypes2.default.bool, showToTop: _propTypes2.default.bool, showVariants: _propTypes2.default.bool, tabIndex: _propTypes2.default.number, value: _propTypes2.default.object, variants: _propTypes2.default.arrayOf(_propTypes2.default.shape({ getLabel: _propTypes2.default.func, getValue: _propTypes2.default.func })) }; var defaultProps = { className: '', dateFormat: 'dd/MM/yyyy', disabled: false, isValid: true, locale: 'en', modifiers: {}, onBlur: function onBlur() {}, onFocus: function onFocus() {}, onChange: function onChange() {}, showToLeft: false, showToTop: false, tabIndex: 0, value: null, variants: [{ getLabel: function getLabel(locale) { return (0, _translations2.default)(locale, 'common.DateInput.yesterday'); }, getValue: function getValue(locale) { return (0, _dayjs2.default)().locale(locale).subtract(1, 'days').toDate(); } }, { getLabel: function getLabel(locale) { return (0, _translations2.default)(locale, 'common.DateInput.today'); }, getValue: function getValue(locale) { return (0, _dayjs2.default)().locale(locale).toDate(); } }, { getLabel: function getLabel(locale) { return (0, _translations2.default)(locale, 'common.DateInput.tomorrow'); }, getValue: function getValue(locale) { return (0, _dayjs2.default)().locale(locale).add(1, 'days').toDate(); } }] }; var DateInput = function (_Component) { _inherits(DateInput, _Component); function DateInput(props) { _classCallCheck(this, DateInput); var _this = _possibleConstructorReturn(this, (DateInput.__proto__ || Object.getPrototypeOf(DateInput)).call(this, props)); _this.handleBodyClick = function (event) { var clickedOutside = !_this.container.contains(event.target) && !_this.pickerContainer.contains(event.target); if (_this.variantsContainer) { clickedOutside = clickedOutside && !_this.variantsContainer.contains(event.target); } if (clickedOutside) { _this.hideVariants(); _this.hidePicker(); } }; _this.handleBodyKeyDown = function (event) { if (event.which === 9) { _this.hideVariants(); _this.hidePicker(); } if (event.which === 27) { // ESC key _this.hideVariants(); _this.hidePicker(); } }; _this.handleVariantsButtonClick = function () { var _ret2; if (_this.state.showVariants) { var _ret; return _ret = _this.hideVariants(), _possibleConstructorReturn(_this, _ret); } return _ret2 = _this.showVariants(), _possibleConstructorReturn(_this, _ret2); }; _this.handleVariantSelect = function (value) { _this.hideVariants(); _this.handleDateChange(value); }; _this.handleError = function (error) { _this.setState({ error: error }); }; _this.handleDateChange = function (value) { _this.props.onChange((0, _utils.zeroTime)(value)); _this.hidePicker(); _this.setState({ error: null }); }; _this.handleDayClick = function (value, modifiers) { if (modifiers.disabled) { return _possibleConstructorReturn(_this); } _this.handleDateChange(value); }; _this.handleInputFocus = function (event) { _this.props.onFocus(event); _this.showPicker(); }; _this.handleInputClick = function () { if (!_this.props.disabled) { _this.showPicker(); } }; _this.handleReset = function () { _this.setState({ error: null }); _this.dateInputField.clear(); _this.hidePicker(); _this.props.onChange(null); }; _this.handleBlur = function (e) { if (_this.state.error) { _this.handleReset(); } _this.props.onBlur(e); }; _this.state = { error: null, showPicker: false, showVariants: false }; return _this; } _createClass(DateInput, [{ key: 'componentDidMount', value: function componentDidMount() { document.body.addEventListener('click', this.handleBodyClick); document.body.addEventListener('keydown', this.handleBodyKeyDown); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if (this.props.value !== nextProps.value) { var month = nextProps.value || new Date(); if (this.reactDayPicker) { this.reactDayPicker.showMonth(month); } } } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps, nextState) { return this.state.error !== nextState.error || this.state.showPicker !== nextState.showPicker || this.state.showVariants !== nextState.showVariants || this.props.className !== nextProps.className || this.props.dateFormat !== nextProps.dateFormat || this.props.disabled !== nextProps.disabled || this.props.isValid !== nextProps.isValid || this.props.locale !== nextProps.locale || this.props.showToLeft !== nextProps.showToLeft || this.props.showToTop !== nextProps.showToTop || this.props.tabIndex !== nextProps.tabIndex || !(0, _isEqual2.default)(this.props.value, nextProps.value) || !(0, _isEqual2.default)(this.props.variants, nextProps.variants); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { document.body.removeEventListener('click', this.handleBodyClick); document.body.removeEventListener('keydown', this.handleBodyKeyDown); } }, { key: 'showVariants', value: function showVariants() { this.setState({ showVariants: true, showPicker: false }); } }, { key: 'hideVariants', value: function hideVariants() { this.setState({ showVariants: false }); } }, { key: 'showPicker', value: function showPicker() { var month = this.props.value || new Date(); this.reactDayPicker.showMonth(month); this.hideVariants(); this.setState({ showPicker: true }); } }, { key: 'hidePicker', value: function hidePicker() { this.setState({ showPicker: false }); } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, className = _props.className, dateFormat = _props.dateFormat, disabled = _props.disabled, isValid = _props.isValid, locale = _props.locale, onBlur = _props.onBlur, onChange = _props.onChange, onFocus = _props.onFocus, showToLeft = _props.showToLeft, showToTop = _props.showToTop, tabIndex = _props.tabIndex, value = _props.value, variants = _props.variants, restProps = _objectWithoutProperties(_props, ['className', 'dateFormat', 'disabled', 'isValid', 'locale', 'onBlur', 'onChange', 'onFocus', 'showToLeft', 'showToTop', 'tabIndex', 'value', 'variants']); var _state = this.state, error = _state.error, showPicker = _state.showPicker, showVariants = _state.showVariants; var dayjsCompatibleDateFormat = dateFormat.replace(/d/g, 'D').replace(/y/g, 'Y'); var splittedProps = (0, _utils.splitProps)(restProps, Object.keys(_DayPicker2.default.propTypes)); var dayPickerSpecificProps = splittedProps[1]; var pickerElement = _react2.default.createElement(_DayPicker2.default, _extends({ dayPickerRef: function dayPickerRef(el) { return _this2.reactDayPicker = el; }, locale: locale, month: value, selectedDays: value, tabIndex: -1, fixedWeeks: true, onDayClick: this.handleDayClick, onDayKeyDown: this.handleDateChange, onDayTouchEnd: this.handleDateChange, onChange: this.handleDateChange }, dayPickerSpecificProps)); var showToTopClassName = showToTop ? 'opuscapita_date-input__picker-container--to-top' : ''; var showToLeftClassName = showToLeft ? 'opuscapita_date-input__picker-container--to-left' : ''; var hasErrorClassName = error === null && isValid ? '' : 'has-error'; var pickerMotionElement = _react2.default.createElement( _reactMotion.Motion, { defaultStyle: { x: showPicker ? 1 : 0 }, style: {