@luminati-io/uikit 6.2.9 → 6.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -34878,7 +34878,9 @@ var Drawer = function Drawer(_ref) {
34878
34878
  cancelProps = _ref.cancelProps,
34879
34879
  _ref$footerVariant = _ref.footerVariant,
34880
34880
  footerVariant = _ref$footerVariant === void 0 ? 'horizontal' : _ref$footerVariant,
34881
- afterOpenChange = _ref.afterOpenChange;
34881
+ afterOpenChange = _ref.afterOpenChange,
34882
+ _ref$mask = _ref.mask,
34883
+ mask = _ref$mask === void 0 ? false : _ref$mask;
34882
34884
  var theme = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__.useTheme)();
34883
34885
  var renderCancel = !footer && !!(onCancel && cancelLabel);
34884
34886
  var renderOk = !footer && !!(onOk && okLabel);
@@ -34915,6 +34917,7 @@ var Drawer = function Drawer(_ref) {
34915
34917
  zIndex: _constants__WEBPACK_IMPORTED_MODULE_4__.Z_INDEX.drawer,
34916
34918
  maskClosable: closable,
34917
34919
  afterOpenChange: afterOpenChange,
34920
+ mask: mask,
34918
34921
  maskMotion: maskMotion,
34919
34922
  motion: motion
34920
34923
  }, closable && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_icon_button__WEBPACK_IMPORTED_MODULE_6__.IconButton, {
@@ -34961,7 +34964,8 @@ Drawer.propTypes = {
34961
34964
  onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
34962
34965
  cancelProps: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().object),
34963
34966
  footerVariant: prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOf(['vertical', 'horizontal', 'horizontal_full']),
34964
- afterOpenChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func)
34967
+ afterOpenChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),
34968
+ mask: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool)
34965
34969
  };
34966
34970
  var DrawerStyle = (0,styled_components__WEBPACK_IMPORTED_MODULE_2__.createGlobalStyle)([".", "{inset:0;position:fixed;pointer-events:none;&-inline{position:absolute;}&-mask{inset:0;position:absolute;background-color:", ";background-color:", ";filter:alpha(opacity=70);pointer-events:auto;}&-content-wrapper{position:absolute;overflow:hidden;&-hidden{display:none;}}&-left &-content-wrapper{top:0;bottom:0;left:0;}&-right &-content-wrapper{top:0;right:0;bottom:0;}&-content{position:relative;display:flex;flex-direction:column;width:100%;height:100%;background:", ";pointer-events:auto;}&-left &-content{border-right:1px solid ", ";}&-right &-content{border-left:1px solid ", ";}&-close{position:absolute;margin-top:16px;inset-inline-end:16px;z-index:1;background:transparent;}&-header{padding-top:", ";padding-right:", ";padding-bottom:", ";padding-left:", ";}&-body{flex:1;overflow:auto;padding-top:", ";padding-right:", ";padding-bottom:", ";padding-left:", ";color:", ";", "}&-footer{padding-top:", ";padding-right:", ";padding-bottom:", ";padding-left:", ";border-top:1px solid ", ";}&-mask-motion{&-enter,&-appear,&-leave{&-start{transition:none;}&-active{transition:all 0.3s;}}&-enter,&-appear{opacity:0;&-active{opacity:1;}}&-leave{opacity:1;&-active{opacity:0;}}}&-panel-motion{&-left,&-right{&-enter,&-appear,&-leave{&-start{transition:none;}&-active{transition:all 0.3s;}}&-enter,&-appear{opacity:0.7;&-active{opacity:1;}}&-leave{opacity:1;&-active{opacity:0.7;}}}&-left{&-enter,&-appear{transform:translateX(-100%);&-active{transform:none;}}&-leave{transform:none;&-active{transform:translateX(-100%);}}}&-right{&-enter,&-appear{transform:translateX(100%);&-active{transform:none;}}&-leave{transform:none;&-active{transform:translateX(100%);}}}}}"], function (_ref2) {
34967
34971
  var $prefixCls = _ref2.$prefixCls;
@@ -35143,29 +35147,28 @@ __webpack_require__.r(__webpack_exports__);
35143
35147
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
35144
35148
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom");
35145
35149
  /* 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");
35150
+ /* harmony import */ var react_popper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-popper */ "./node_modules/react-popper/lib/esm/usePopper.js");
35147
35151
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! styled-components */ "styled-components");
35148
35152
  /* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_2__);
35149
35153
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks */ "./src/hooks/index.js");
35150
35154
  /* 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");
35155
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util */ "./src/hoc/util.js");
35153
35156
  // LICENSE_CODE ZON
35154
35157
 
35155
35158
 
35156
35159
  /*jslint react:true*/
35157
35160
  var _excluded = ["popoverProps", "onOpenChange"],
35158
- _excluded2 = ["portalTarget", "ref"];
35161
+ _excluded2 = ["portalTarget"];
35159
35162
  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); }
35163
+ 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; }
35164
+ 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
35165
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
35161
35166
  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
35167
  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
35168
  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
-
35169
+ 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; } } }; }
35170
+ 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; } }
35171
+ 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
35172
 
35170
35173
 
35171
35174
 
@@ -35175,6 +35178,69 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
35175
35178
 
35176
35179
  var assign = Object.assign;
35177
35180
  var DEFAULT_CLOSE_DELAY = 200;
35181
+ var Observable = function () {
35182
+ var eventMap = new Map();
35183
+ var on = function on(evt, fn) {
35184
+ if (!eventMap.has(evt)) eventMap.set(evt, new Set());
35185
+ eventMap.get(evt).add(fn);
35186
+ return function () {
35187
+ return eventMap.get(evt)["delete"](fn);
35188
+ };
35189
+ };
35190
+ var notify = function notify(evt, data) {
35191
+ if (!eventMap.has(evt)) return;
35192
+ var _iterator = _createForOfIteratorHelper(eventMap.get(evt)),
35193
+ _step;
35194
+ try {
35195
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
35196
+ var fn = _step.value;
35197
+ fn(data);
35198
+ }
35199
+ } catch (err) {
35200
+ _iterator.e(err);
35201
+ } finally {
35202
+ _iterator.f();
35203
+ }
35204
+ };
35205
+ return {
35206
+ on: on,
35207
+ notify: notify
35208
+ };
35209
+ }();
35210
+
35211
+ // tracks all popovers elements currently open, helps useOutsideClick
35212
+ // to determine if the click was outside all of the popovers
35213
+ var usePopoverElements = function usePopoverElements(elm) {
35214
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
35215
+ _useState2 = _slicedToArray(_useState, 2),
35216
+ popovers = _useState2[0],
35217
+ setPopovers = _useState2[1];
35218
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
35219
+ var off_open = Observable.on('popover_open', function (p) {
35220
+ return setPopovers(function (v) {
35221
+ return v.concat(p);
35222
+ });
35223
+ });
35224
+ var off_close = Observable.on('popover_close', function (p) {
35225
+ return setPopovers(function (v) {
35226
+ return v.filter(function (x) {
35227
+ return x !== p;
35228
+ });
35229
+ });
35230
+ });
35231
+ return function () {
35232
+ off_open();
35233
+ off_close();
35234
+ };
35235
+ }, []);
35236
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
35237
+ if (elm) Observable.notify('popover_open', elm);
35238
+ return function () {
35239
+ Observable.notify('popover_close', elm);
35240
+ };
35241
+ }, [elm]);
35242
+ return popovers;
35243
+ };
35178
35244
  var withPopover = function withPopover(Comp, PopoverComp) {
35179
35245
  var popoverOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35180
35246
  var WithPopover = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef(function (props, ref) {
@@ -35183,7 +35249,6 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35183
35249
  onOpenChange = props.onOpenChange,
35184
35250
  compProps = _objectWithoutProperties(props, _excluded);
35185
35251
  var portalTarget = popoverProps.portalTarget,
35186
- popoverRef = popoverProps.ref,
35187
35252
  restPopoverProps = _objectWithoutProperties(popoverProps, _excluded2);
35188
35253
  var placement = popoverOptions.placement,
35189
35254
  zIndex = popoverOptions.zIndex,
@@ -35193,18 +35258,15 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35193
35258
  popoverStyle = popoverOptions.popoverStyle,
35194
35259
  interactive = popoverOptions.interactive,
35195
35260
  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
35261
  var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
35201
35262
  _useState4 = _slicedToArray(_useState3, 2),
35202
- popperElement = _useState4[0],
35203
- setPopperElement = _useState4[1];
35263
+ referenceElement = _useState4[0],
35264
+ setReferenceElement = _useState4[1];
35204
35265
  var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
35205
35266
  _useState6 = _slicedToArray(_useState5, 2),
35206
- popoverCompElement = _useState6[0],
35207
- setPopoverCompElement = _useState6[1];
35267
+ popperElement = _useState6[0],
35268
+ setPopperElement = _useState6[1];
35269
+ var popoverElms = usePopoverElements(popperElement);
35208
35270
  var _useStateWithCallback = useStateWithCallback(false, onOpenChange),
35209
35271
  _useStateWithCallback2 = _slicedToArray(_useStateWithCallback, 2),
35210
35272
  isOpen = _useStateWithCallback2[0],
@@ -35228,7 +35290,7 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35228
35290
  return !v;
35229
35291
  });
35230
35292
  }, []);
35231
- var _usePopper = (0,react_popper__WEBPACK_IMPORTED_MODULE_7__.usePopper)(referenceElement, popperElement, {
35293
+ var _usePopper = (0,react_popper__WEBPACK_IMPORTED_MODULE_6__.usePopper)(referenceElement, popperElement, {
35232
35294
  placement: placement,
35233
35295
  modifiers: [{
35234
35296
  name: 'offset',
@@ -35267,7 +35329,10 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35267
35329
  if (interactive) hidePopover();
35268
35330
  (_compProps$onPointerL = compProps.onPointerLeave) === null || _compProps$onPointerL === void 0 || _compProps$onPointerL.call(compProps, evt);
35269
35331
  }, [interactive, hidePopover, compProps.onPointerLeave]);
35270
- (0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useOutsideClick)([referenceElement, popperElement, popoverCompElement], hideAndStopEvt);
35332
+ var inClickElements = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () {
35333
+ return [referenceElement].concat(popoverElms);
35334
+ }, [referenceElement, popoverElms]);
35335
+ (0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useOutsideClick)(inClickElements, hideAndStopEvt);
35271
35336
  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
35337
  ref: setReferenceElement,
35273
35338
  className: wrapperClassName,
@@ -35287,15 +35352,13 @@ var withPopover = function withPopover(Comp, PopoverComp) {
35287
35352
  visible: isOpen,
35288
35353
  portalTarget: portalTarget,
35289
35354
  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, {
35355
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(PopoverComp, _extends({}, restPopoverProps, {
35293
35356
  onPointerEnter: showPopover,
35294
35357
  onPointerLeave: hidePopover,
35295
35358
  popover: popoverApi
35296
35359
  }))));
35297
35360
  });
35298
- WithPopover.displayName = "WithPopover(".concat((0,_util__WEBPACK_IMPORTED_MODULE_6__.getDisplayName)(Comp), ")");
35361
+ WithPopover.displayName = "WithPopover(".concat((0,_util__WEBPACK_IMPORTED_MODULE_5__.getDisplayName)(Comp), ")");
35299
35362
  return WithPopover;
35300
35363
  };
35301
35364
  var PopoverContainer = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().forwardRef(function (props, ref) {