@moda/om 15.11.0 → 15.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -11252,11 +11252,12 @@ var Paginator = function Paginator(_ref) {
11252
11252
  })));
11253
11253
  };
11254
11254
 
11255
- var _excluded$b = ["className", "children", "content", "open", "anchor", "zIndex", "autoPreview"];
11255
+ var _excluded$b = ["className", "children", "content", "open", "anchor", "zIndex", "autoPreview", "smoothTransitioning"];
11256
11256
  var POPOVER_MOUSEOUT_DELAY_MS = 200;
11257
11257
  var Mode;
11258
11258
 
11259
11259
  (function (Mode) {
11260
+ Mode["Opening"] = "opening";
11260
11261
  Mode["Open"] = "open";
11261
11262
  Mode["Closing"] = "closing";
11262
11263
  Mode["AutoOpening"] = "autoOpening";
@@ -11275,10 +11276,16 @@ var Popover = function Popover(_ref) {
11275
11276
  zIndex = _ref.zIndex,
11276
11277
  _ref$autoPreview = _ref.autoPreview,
11277
11278
  autoPreview = _ref$autoPreview === void 0 ? false : _ref$autoPreview,
11279
+ _ref$smoothTransition = _ref.smoothTransitioning,
11280
+ smoothTransitioning = _ref$smoothTransition === void 0 ? false : _ref$smoothTransition,
11278
11281
  rest = _objectWithoutProperties(_ref, _excluded$b);
11279
11282
 
11280
11283
  var _useState = useState(function () {
11281
- if (open) {
11284
+ if (open && smoothTransitioning) {
11285
+ return Mode.Opening;
11286
+ }
11287
+
11288
+ if (open && !smoothTransitioning) {
11282
11289
  return Mode.Open;
11283
11290
  }
11284
11291
 
@@ -11296,16 +11303,15 @@ var Popover = function Popover(_ref) {
11296
11303
  var handleMouseEnter = useCallback(function () {
11297
11304
  if (!open) {
11298
11305
  timeout.current && clearTimeout(timeout.current);
11299
- setMode(Mode.Open);
11306
+ setMode(smoothTransitioning ? Mode.Opening : Mode.Open);
11300
11307
  }
11301
- }, [open]);
11308
+ }, [open, smoothTransitioning]);
11302
11309
  var handleMouseLeave = useCallback(function () {
11303
- if (!open) {
11304
- timeout.current = setTimeout(function () {
11305
- return setMode(Mode.Closing);
11306
- }, POPOVER_MOUSEOUT_DELAY_MS);
11307
- }
11308
- }, [open]);
11310
+ if (open) return;
11311
+ timeout.current = setTimeout(function () {
11312
+ return setMode(smoothTransitioning ? Mode.Closing : Mode.Closed);
11313
+ }, POPOVER_MOUSEOUT_DELAY_MS);
11314
+ }, [open, smoothTransitioning]);
11309
11315
  useEffect(function () {
11310
11316
  if (mode !== Mode.Closing) return;
11311
11317
  var closingTimeout = setTimeout(function () {
@@ -11324,16 +11330,25 @@ var Popover = function Popover(_ref) {
11324
11330
  return clearTimeout(openingTimeout);
11325
11331
  };
11326
11332
  }, [mode]);
11333
+ useEffect(function () {
11334
+ if (mode !== Mode.Opening) return;
11335
+ var openingTimeout = setTimeout(function () {
11336
+ return setMode(Mode.Open);
11337
+ }, 750);
11338
+ return function () {
11339
+ return clearTimeout(openingTimeout);
11340
+ };
11341
+ }, [mode]);
11327
11342
  useEffect(function () {
11328
11343
  if (mode !== Mode.AutoOpen) return;
11329
11344
  var stayingTimeout = setTimeout(function () {
11330
- return setMode(Mode.Closing);
11345
+ return setMode(smoothTransitioning ? Mode.Closing : Mode.Closed);
11331
11346
  }, 5000);
11332
11347
  return function () {
11333
11348
  return clearTimeout(stayingTimeout);
11334
11349
  };
11335
- }, [mode]);
11336
- var isOpen = mode === Mode.AutoOpen || mode === Mode.Open || mode === Mode.Closing;
11350
+ }, [mode, smoothTransitioning]);
11351
+ var isOpen = mode === Mode.AutoOpen || mode === Mode.Opening || mode === Mode.Open || mode === Mode.Closing;
11337
11352
  return /*#__PURE__*/React__default.createElement("div", _extends$3({
11338
11353
  className: classNames("Popover Popover--anchor-".concat(anchor), className),
11339
11354
  onMouseEnter: handleMouseEnter,
@@ -11342,6 +11357,7 @@ var Popover = function Popover(_ref) {
11342
11357
  className: "Popover__trigger"
11343
11358
  }, isOpen && /*#__PURE__*/React__default.createElement("div", {
11344
11359
  className: classNames('Popover__box', {
11360
+ 'Popover__box--opening': mode === Mode.Opening,
11345
11361
  'Popover__box--closing': mode === Mode.Closing
11346
11362
  })
11347
11363
  }, /*#__PURE__*/React__default.createElement("div", {