@luminati-io/uikit 6.2.9-beta.0 → 6.2.10-beta.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35143,29 +35143,28 @@ __webpack_require__.r(__webpack_exports__);
35143
35143
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
35144
35144
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom");
35145
35145
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
35146
- /* harmony import */ var react_popper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-popper */ "./node_modules/react-popper/lib/esm/usePopper.js");
35146
+ /* harmony import */ var react_popper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-popper */ "./node_modules/react-popper/lib/esm/usePopper.js");
35147
35147
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! styled-components */ "styled-components");
35148
35148
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_2__);
35149
35149
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks */ "./src/hooks/index.js");
35150
35150
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants */ "./src/constants.js");
35151
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util */ "./src/util/index.js");
35152
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util */ "./src/hoc/util.js");
35151
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util */ "./src/hoc/util.js");
35153
35152
  // LICENSE_CODE ZON
35154
35153
 
35155
35154
 
35156
35155
  /*jslint react:true*/
35157
35156
  var _excluded = ["popoverProps", "onOpenChange"],
35158
- _excluded2 = ["portalTarget", "ref"];
35157
+ _excluded2 = ["portalTarget"];
35159
35158
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
35159
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
35160
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
35160
35161
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
35161
35162
  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."); }
35162
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
35163
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
35164
35163
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
35165
35164
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
35166
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
35167
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
35168
-
35165
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
35166
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
35167
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
35169
35168
 
35170
35169
 
35171
35170
 
@@ -35175,6 +35174,69 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
35175
35174
 
35176
35175
  var assign = Object.assign;
35177
35176
  var DEFAULT_CLOSE_DELAY = 200;
35177
+ var Observable = function () {
35178
+ var eventMap = new Map();
35179
+ var on = function on(evt, fn) {
35180
+ if (!eventMap.has(evt)) eventMap.set(evt, new Set());
35181
+ eventMap.get(evt).add(fn);
35182
+ return function () {
35183
+ return eventMap.get(evt)["delete"](fn);
35184
+ };
35185
+ };
35186
+ var notify = function notify(evt, data) {
35187
+ if (!eventMap.has(evt)) return;
35188
+ var _iterator = _createForOfIteratorHelper(eventMap.get(evt)),
35189
+ _step;
35190
+ try {
35191
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
35192
+ var fn = _step.value;
35193
+ fn(data);
35194
+ }
35195
+ } catch (err) {
35196
+ _iterator.e(err);
35197
+ } finally {
35198
+ _iterator.f();
35199
+ }
35200
+ };
35201
+ return {
35202
+ on: on,
35203
+ notify: notify
35204
+ };
35205
+ }();
35206
+
35207
+ // tracks all popovers elements currently open, helps useOutsideClick
35208
+ // to determine if the click was outside all of the popovers
35209
+ var usePopoverElements = function usePopoverElements(elm) {
35210
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
35211
+ _useState2 = _slicedToArray(_useState, 2),
35212
+ popovers = _useState2[0],
35213
+ setPopovers = _useState2[1];
35214
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
35215
+ var off_open = Observable.on('popover_open', function (p) {
35216
+ return setPopovers(function (v) {
35217
+ return v.concat(p);
35218
+ });
35219
+ });
35220
+ var off_close = Observable.on('popover_close', function (p) {
35221
+ return setPopovers(function (v) {
35222
+ return v.filter(function (x) {
35223
+ return x !== p;
35224
+ });
35225
+ });
35226
+ });
35227
+ return function () {
35228
+ off_open();
35229
+ off_close();
35230
+ };
35231
+ }, []);
35232
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
35233
+ if (elm) Observable.notify('popover_open', elm);
35234
+ return function () {
35235
+ Observable.notify('popover_close', elm);
35236
+ };
35237
+ }, [elm]);
35238
+ return popovers;
35239
+ };
35178
35240
  var withPopover = function withPopover(Comp, PopoverComp) {
35179
35241
  var popoverOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35180
35242
  var WithPopover = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef(function (props, ref) {
@@ -35183,7 +35245,6 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35183
35245
  onOpenChange = props.onOpenChange,
35184
35246
  compProps = _objectWithoutProperties(props, _excluded);
35185
35247
  var portalTarget = popoverProps.portalTarget,
35186
- popoverRef = popoverProps.ref,
35187
35248
  restPopoverProps = _objectWithoutProperties(popoverProps, _excluded2);
35188
35249
  var placement = popoverOptions.placement,
35189
35250
  zIndex = popoverOptions.zIndex,
@@ -35193,18 +35254,15 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35193
35254
  popoverStyle = popoverOptions.popoverStyle,
35194
35255
  interactive = popoverOptions.interactive,
35195
35256
  delay = popoverOptions.delay;
35196
- var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
35197
- _useState2 = _slicedToArray(_useState, 2),
35198
- referenceElement = _useState2[0],
35199
- setReferenceElement = _useState2[1];
35200
35257
  var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
35201
35258
  _useState4 = _slicedToArray(_useState3, 2),
35202
- popperElement = _useState4[0],
35203
- setPopperElement = _useState4[1];
35259
+ referenceElement = _useState4[0],
35260
+ setReferenceElement = _useState4[1];
35204
35261
  var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
35205
35262
  _useState6 = _slicedToArray(_useState5, 2),
35206
- popoverCompElement = _useState6[0],
35207
- setPopoverCompElement = _useState6[1];
35263
+ popperElement = _useState6[0],
35264
+ setPopperElement = _useState6[1];
35265
+ var popoverElms = usePopoverElements(popperElement);
35208
35266
  var _useStateWithCallback = useStateWithCallback(false, onOpenChange),
35209
35267
  _useStateWithCallback2 = _slicedToArray(_useStateWithCallback, 2),
35210
35268
  isOpen = _useStateWithCallback2[0],
@@ -35228,7 +35286,7 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35228
35286
  return !v;
35229
35287
  });
35230
35288
  }, []);
35231
- var _usePopper = (0,react_popper__WEBPACK_IMPORTED_MODULE_7__.usePopper)(referenceElement, popperElement, {
35289
+ var _usePopper = (0,react_popper__WEBPACK_IMPORTED_MODULE_6__.usePopper)(referenceElement, popperElement, {
35232
35290
  placement: placement,
35233
35291
  modifiers: [{
35234
35292
  name: 'offset',
@@ -35267,7 +35325,10 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35267
35325
  if (interactive) hidePopover();
35268
35326
  (_compProps$onPointerL = compProps.onPointerLeave) === null || _compProps$onPointerL === void 0 || _compProps$onPointerL.call(compProps, evt);
35269
35327
  }, [interactive, hidePopover, compProps.onPointerLeave]);
35270
- (0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useOutsideClick)([referenceElement, popperElement, popoverCompElement], hideAndStopEvt);
35328
+ var inClickElements = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
35329
+ return [referenceElement].concat(popoverElms);
35330
+ }, [referenceElement, popoverElms]);
35331
+ (0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useOutsideClick)(inClickElements, hideAndStopEvt);
35271
35332
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(RefCompContainer, {
35272
35333
  ref: setReferenceElement,
35273
35334
  className: wrapperClassName,
@@ -35287,15 +35348,13 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35287
35348
  visible: isOpen,
35288
35349
  portalTarget: portalTarget,
35289
35350
  zIndex: zIndex
35290
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PopoverComp, _extends({
35291
- ref: (0,_util__WEBPACK_IMPORTED_MODULE_5__.mergeRefs)(popoverRef, setPopoverCompElement)
35292
- }, restPopoverProps, {
35351
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PopoverComp, _extends({}, restPopoverProps, {
35293
35352
  onPointerEnter: showPopover,
35294
35353
  onPointerLeave: hidePopover,
35295
35354
  popover: popoverApi
35296
35355
  }))));
35297
35356
  });
35298
- WithPopover.displayName = "WithPopover(".concat((0,_util__WEBPACK_IMPORTED_MODULE_6__.getDisplayName)(Comp), ")");
35357
+ WithPopover.displayName = "WithPopover(".concat((0,_util__WEBPACK_IMPORTED_MODULE_5__.getDisplayName)(Comp), ")");
35299
35358
  return WithPopover;
35300
35359
  };
35301
35360
  var PopoverContainer = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef(function (props, ref) {