funda-ui
Version:
React components using pure Bootstrap 5+ which does not contain any external style and script libraries.
1,207 lines (1,147 loc) • 69.9 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["RPB"] = factory(require("react"), require("react-dom"));
else
root["RPB"] = factory(root["React"], root["ReactDOM"]);
})(this, (__WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__156__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 909:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(787), __webpack_require__(156));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787), __webpack_require__(156)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__156__) {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/
var __webpack_modules__ = {
/***/787: /***/function _(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
/***/
},
/***/156: /***/function _(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__156__;
/***/
}
/******/
};
/************************************************************************/
/******/ // The module cache
/******/
var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/
function __nested_webpack_require_1708__(moduleId) {
/******/ // Check if module is in cache
/******/var cachedModule = __webpack_module_cache__[moduleId];
/******/
if (cachedModule !== undefined) {
/******/return cachedModule.exports;
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/
var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/exports: {}
/******/
};
/******/
/******/ // Execute the module function
/******/
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1708__);
/******/
/******/ // Return the exports of the module
/******/
return module.exports;
/******/
}
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/
(function () {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/__nested_webpack_require_1708__.n = function (module) {
/******/var getter = module && module.__esModule ? /******/function () {
return module['default'];
} : /******/function () {
return module;
};
/******/
__nested_webpack_require_1708__.d(getter, {
a: getter
});
/******/
return getter;
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_1708__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_1708__.o(definition, key) && !__nested_webpack_require_1708__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_1708__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_1708__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(function () {
__nested_webpack_require_1708__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_1708__.d(__webpack_exports__, {
/* harmony export */"default": function _default() {
return __WEBPACK_DEFAULT_EXPORT__;
}
/* harmony export */
});
/* harmony import */
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1708__(787);
/* harmony import */
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1708__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */
var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1708__(156);
/* harmony import */
var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_1708__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
var RootPortal = function RootPortal(props) {
var containerClassName = props.containerClassName,
show = props.show,
children = props.children,
_props$usePortal = props.usePortal,
usePortal = _props$usePortal === void 0 ? true : _props$usePortal;
var containerRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
// Move HTML templates to tag end body </body>
// render() don't use "Fragment", in order to avoid error "Failed to execute 'insertBefore' on 'Node'"
// prevent "transform", "filter", "perspective" attribute destruction fixed viewport orientation
// ###
// ###
// Use `containerRef.current` to ensure the correctness of the nextjs framework. It may report an error document as undefined
(0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
if (usePortal) {
containerRef.current = document.createElement('div');
containerRef.current.className = "root-portal-container ".concat(containerClassName || '');
document.body.appendChild(containerRef.current);
}
return function () {
if (usePortal && containerRef.current) {
containerRef.current.remove();
}
};
}, [usePortal]);
if (!usePortal) {
return show ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, children) : null;
}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, containerRef.current && show && /*#__PURE__*/(0, react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, containerRef.current));
};
/* harmony default export */
var __WEBPACK_DEFAULT_EXPORT__ = RootPortal;
})();
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 188:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_993__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_993__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_993__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_993__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_993__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_993__.d(__webpack_exports__, {
/* harmony export */"clsWrite": function clsWrite() {
return (/* binding */_clsWrite
);
},
/* harmony export */"combinedCls": function combinedCls() {
return (/* binding */_combinedCls
);
}
/* harmony export */
});
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
/**
* Output of class name
* @param {*} s - Any
* @param {String} defaultCls - Default string
* @param {?*} targetCls - Any
* @returns {*}
*/
function _clsWrite(s, defaultCls) {
var targetCls = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
return s || s === '' ? typeof targetCls === 'undefined' ? s : targetCls : defaultCls;
}
/**
* Combined classnames
* @param {*} args
* @returns {String|undefined}
*/
/* Usage:
console.log(combinedCls('a-1', 'a-2', 'a-3', {
'p-1': null,
'p-2': undefined,
'p-3': true,
'p-4': false,
'p-5': 'kkk',
'p-6': 0,
'p-7': 1,
'p-8': '',
undefined
})); // a-1 a-2 a-3 p-3 p-5 p-7
*/
function _combinedCls() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args) {
var classes = [];
for (var i = 0; i < args.length; i++) {
var className = args[i];
if (!className) {
continue;
}
var type = _typeof(className);
if (type === 'string' || type === 'number') {
classes.push(className);
} else if (type === 'object') {
var _classes = Array.isArray(className) ? className : Object.entries(className).map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return value ? key : null;
});
classes = _classes.length ? classes.concat(_classes.filter(function (c) {
return !!c;
})) : classes;
}
}
return classes.join(' ').trim();
}
return undefined;
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 767:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_993__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_993__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_993__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_993__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_993__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_993__.d(__webpack_exports__, {
/* harmony export */"getAbsoluteCoordinates": function getAbsoluteCoordinates() {
return (/* binding */_getAbsoluteCoordinates
);
},
/* harmony export */"getAbsolutePositionOfStage": function getAbsolutePositionOfStage() {
return (/* binding */_getAbsolutePositionOfStage
);
},
/* harmony export */"getOffset": function getOffset() {
return (/* binding */_getOffset
);
},
/* harmony export */"getPosition": function getPosition() {
return (/* binding */_getPosition
);
},
/* harmony export */"getTransitionDuration": function getTransitionDuration() {
return (/* binding */_getTransitionDuration
);
}
/* harmony export */
});
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
/**
* Get the -webkit-transition-duration property
*
* @param {HTMLElement} el - A DOM node containing one selector to match against.
* @return {number} - Returns a pure number.
*/
function _getTransitionDuration(el) {
if (_typeof(el) === ( true ? "undefined" : 0)) {
return 0;
}
var style = window.getComputedStyle(el),
duration = style.webkitTransitionDuration,
delay = style.webkitTransitionDelay;
if (_typeof(duration) != ( true ? "undefined" : 0)) {
// fix miliseconds vs seconds
duration = duration.indexOf("ms") > -1 ? parseFloat(duration) : parseFloat(duration) * 1000;
delay = delay.indexOf("ms") > -1 ? parseFloat(delay) : parseFloat(delay) * 1000;
return duration;
} else {
return 0;
}
}
/**
* Get an object's absolute position on the page
*
* @param {HTMLElement} el - A DOM node containing one selector to match against.
* @return {Json} - An object containing the properties top and left.
*/
function _getAbsoluteCoordinates(el) {
var windowWidth = window.innerWidth,
leftPos = null,
topPos = null;
var pEl = el.parentElement;
if (!document.getElementsByTagName('body')[0].className.match(/rtl/)) {
leftPos = el.offsetLeft == 0 ? pEl.offsetLeft : el.offsetLeft;
topPos = el.offsetTop == 0 ? pEl.offsetTop : el.offsetTop;
} else {
// width and height in pixels, including padding and border
// Corresponds to outerWidth(), outerHeight()
leftPos = el.offsetLeft == 0 ? windowWidth - (pEl.offsetLeft + pEl.offsetWidth) : windowWidth - (el.offsetLeft + el.offsetWidth);
topPos = el.offsetTop == 0 ? windowWidth - (pEl.offsetTop + pEl.offsetHeight) : windowWidth - (el.offsetTop + el.offsetHeight);
}
return {
'left': leftPos,
'top': topPos
};
}
/**
* Get the current coordinates of the first element in the set of matched elements, relative to the document.
*
* @param {Element} el - A DOM node containing one selector to match against.
* @return {Json} - An object containing the properties top and left.
*/
function _getOffset(el) {
var res = {
top: 0,
left: 0
};
var box = el.getBoundingClientRect();
var top = 0,
left = 0;
//Include scrollbar and border
top = box.top + window.pageYOffset - document.documentElement.clientTop;
left = box.left + window.pageXOffset - document.documentElement.clientLeft;
res = {
top: top,
left: left
};
return res;
}
/**
* Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
*
* @param {HTMLElement} el - A DOM node containing one selector to match against.
* @return {Json} - An object containing the properties top and left.
*/
function _getPosition(el) {
var res = {
top: 0,
left: 0
};
var top = el.offsetTop ? el.offsetTop : 0,
left = el.offsetLeft ? el.offsetLeft : 0;
res = {
top: top,
left: left
};
return res;
}
/**
* Get the absolute position of the stage element
*
* @param {HTMLElement} domElement - A DOM node
* @param {Number | string} left - left offset
* @param {Number | string} top - top offset
* @returns
*/
function _getAbsolutePositionOfStage(domElement) {
var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
if (!parseInt(left)) {
left = 0;
} else {
left = parseInt(left);
}
if (!parseInt(top)) {
top = 0;
} else {
top = parseInt(top);
}
var box = domElement.getBoundingClientRect();
var body = document.body;
var docElem = document.documentElement;
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
var clientTop = docElem.clientTop || body.clientTop || 0;
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
var attr = {};
attr.y = box.top + scrollTop - clientTop + top;
attr.x = box.left + scrollLeft - clientLeft + left;
attr.width = box.width;
attr.height = box.height;
return attr;
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 954:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_987__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_987__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_987__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_987__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_987__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_987__.d(__webpack_exports__, {
/* harmony export */"actualPropertyValue": function actualPropertyValue() {
return (/* binding */_actualPropertyValue
);
},
/* harmony export */"getElCSS": function getElCSS() {
return (/* binding */_getElCSS
);
},
/* harmony export */"getTextTop": function getTextTop() {
return (/* binding */_getTextTop
);
},
/* harmony export */"getTextWidth": function getTextWidth() {
return (/* binding */_getTextWidth
);
}
/* harmony export */
});
/**
* Gets the relative upside of the text
* @param {Element} el - A DOM node containing one selector to match against.
* @returns {Number} - Returns a pure number.
*/
function _getTextTop(el) {
var styles = window.getComputedStyle(el);
var fontSize = parseFloat(styles.fontSize);
var lineHeight = parseFloat(styles.lineHeight) || fontSize;
var paddingTop = parseFloat(styles.paddingTop);
var borderWidth = parseFloat(styles.borderWidth);
var textTop = paddingTop + (lineHeight - fontSize) / 2 - borderWidth * 2;
return textTop;
}
/**
* Get the actual value with user specific methed
* it can be 'width', 'height', 'outerWidth', 'outerHeight'
* @private
* @param {Element} el - A DOM node containing one selector to match against.
* @param {String} prop - A string naming the property of style.
* @param {?Json} config - Whether or not margin is included. The key `includeMargin`
takes effect when set to true
* @return {Number} - Returns a pure number.
*/
function _actualPropertyValue(el, prop) {
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
if (el === null) return 0;
var style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
display = style.display,
position = style.position,
visibility = style.visibility;
var marginWidth = 0;
var marginHeight = 0;
var maxVal;
var actualVal;
if (config && config.includeMargin === true) {
marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
}
if (prop === 'fontSize') {
actualVal = parseFloat(style.fontSize);
}
if (prop === 'fontFamily') {
actualVal = style.fontFamily;
}
if (prop === 'letterSpacing') {
actualVal = style.letterSpacing;
}
if (prop === 'width') {
maxVal = parseFloat(style.maxWidth);
// if its not hidden we just return normal height
if (display !== 'none' && maxVal !== 0) {
return el.clientWidth;
}
}
if (prop === 'height') {
maxVal = parseFloat(style.maxHeight);
if (display !== 'none' && maxVal !== 0) {
return el.clientHeight;
}
}
if (prop === 'outerWidth') {
maxVal = parseFloat(style.maxWidth);
if (display !== 'none' && maxVal !== 0) {
return el.offsetWidth + marginWidth;
}
}
if (prop === 'outerHeight') {
maxVal = parseFloat(style.maxHeight);
if (display !== 'none' && maxVal !== 0) {
return el.offsetHeight + marginHeight;
}
}
// the element is hidden so:
// making the el block so we can meassure its height but still be hidden
el.style.position = 'absolute';
el.style.visibility = 'hidden';
el.style.display = 'block';
if (prop === 'width') actualVal = el.clientWidth;
if (prop === 'height') actualVal = el.clientHeight;
if (prop === 'outerWidth') actualVal = el.offsetWidth + marginWidth;
if (prop === 'outerHeight') actualVal = el.offsetHeight + marginHeight;
// reverting to the original values
el.style.display = display;
el.style.position = position;
el.style.visibility = visibility;
return actualVal;
}
function _getElCSS(input, prop, isNumber) {
var _document$defaultView;
var val = (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.getComputedStyle(input, null).getPropertyValue(prop);
return isNumber ? isNaN(parseFloat(val)) ? 0 : parseFloat(val) : val;
}
/**
* Get cursor or text position in pixels for input element
*
* @param {HTMLInputElement} input Required HTMLElement with `value` attribute
* @param {HTMLSpanElement} fauxContainer Container of faux.
* @param {HTMLElement} rawTextContainer The raw text container for the comparison
* @returns {Number}
*/
function _getTextWidth(input, fauxContainer, rawTextContainer) {
if (input === null || fauxContainer === null || rawTextContainer === null) return 0;
var _off = input.selectionStart;
var _faux = fauxContainer;
var _fauxContainer = rawTextContainer;
if (_faux && _fauxContainer) {
// Styles to simulate a node in an input field
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
var listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
// default styles
_faux.style.setProperty('white-space', 'pre-wrap');
_faux.style.setProperty('padding', '0');
_faux.style.setProperty('margin', '0');
_faux.style.setProperty('display', 'none');
for (var i = 0; i < listOfModifiers.length; i++) {
var propertyValue = _getElCSS(_fauxContainer, listOfModifiers[i], false);
_faux.style.setProperty(listOfModifiers[i], propertyValue);
}
_faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\xA0");
return _actualPropertyValue(_faux, 'outerWidth');
}
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 761:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/
var __webpack_modules__ = {
/***/787: /***/function _(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
/***/
}
/******/
};
/************************************************************************/
/******/ // The module cache
/******/
var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/
function __nested_webpack_require_1465__(moduleId) {
/******/ // Check if module is in cache
/******/var cachedModule = __webpack_module_cache__[moduleId];
/******/
if (cachedModule !== undefined) {
/******/return cachedModule.exports;
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/
var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/exports: {}
/******/
};
/******/
/******/ // Execute the module function
/******/
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
/******/
/******/ // Return the exports of the module
/******/
return module.exports;
/******/
}
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/
(function () {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/__nested_webpack_require_1465__.n = function (module) {
/******/var getter = module && module.__esModule ? /******/function () {
return module['default'];
} : /******/function () {
return module;
};
/******/
__nested_webpack_require_1465__.d(getter, {
a: getter
});
/******/
return getter;
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_1465__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_1465__.o(definition, key) && !__nested_webpack_require_1465__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_1465__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_1465__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(function () {
__nested_webpack_require_1465__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_1465__.d(__webpack_exports__, {
/* harmony export */"default": function _default() {
return __WEBPACK_DEFAULT_EXPORT__;
}
/* harmony export */
});
/* harmony import */
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
/* harmony import */
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
/**
* Handles the event of clicking outside of the wrapped component
*
* @usage:
const App = () => {
const [show, setShow] = useState<boolean>(false);
const dropdownRef = useRef<HTMLDivElement>(null);
useClickOutside({
enabled: show && dropdownRef.current,
isOutside: (event: any) => {
return event.target.closest(`.test__wrapper`) === null && event.target.closest(`.test__wrapper2`) === null;
},
handle: (event: any) => {
// do something
//...
},
spyElement: document
}, [show, dropdownRef]);
};
*/
function useClickOutside(_ref, deps) {
var enabled = _ref.enabled,
isOutside = _ref.isOutside,
handle = _ref.handle,
_ref$spyElement = _ref.spyElement,
spyElement = _ref$spyElement === void 0 ? typeof document === 'undefined' ? null : document : _ref$spyElement;
var isOutsideRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(isOutside);
var handleRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(handle);
(0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
isOutsideRef.current = isOutside;
// fix possible issue if clicking on a focusable element
handleRef.current = handle;
}, [isOutside, handle]);
(0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
if (enabled) {
var eventHandler = function eventHandler(event) {
var _isOutsideRef$current;
if ((_isOutsideRef$current = isOutsideRef.current) !== null && _isOutsideRef$current !== void 0 && _isOutsideRef$current.call(isOutsideRef, event)) {
var _handleRef$current;
(_handleRef$current = handleRef.current) === null || _handleRef$current === void 0 ? void 0 : _handleRef$current.call(handleRef, event);
}
};
spyElement === null || spyElement === void 0 ? void 0 : spyElement.addEventListener('pointerdown', eventHandler);
return function () {
spyElement === null || spyElement === void 0 ? void 0 : spyElement.removeEventListener('pointerdown', eventHandler);
};
}
}, [enabled].concat(_toConsumableArray(deps)));
}
/* harmony default export */
var __WEBPACK_DEFAULT_EXPORT__ = useClickOutside;
})();
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 85:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/
var __webpack_modules__ = {
/***/787: /***/function _(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
/***/
}
/******/
};
/************************************************************************/
/******/ // The module cache
/******/
var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/
function __nested_webpack_require_1465__(moduleId) {
/******/ // Check if module is in cache
/******/var cachedModule = __webpack_module_cache__[moduleId];
/******/
if (cachedModule !== undefined) {
/******/return cachedModule.exports;
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/
var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/exports: {}
/******/
};
/******/
/******/ // Execute the module function
/******/
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
/******/
/******/ // Return the exports of the module
/******/
return module.exports;
/******/
}
/******