@janiscommerce/ui-web 0.39.0 → 0.40.0

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.umd.js CHANGED
@@ -15992,6 +15992,7 @@
15992
15992
 
15993
15993
  var animation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15994
15994
  var validAnimations = (_window$google = window.google) === null || _window$google === void 0 ? void 0 : (_window$google$maps = _window$google.maps) === null || _window$google$maps === void 0 ? void 0 : _window$google$maps.Animation;
15995
+ if (!animation || !isObject$2(animation)) return false;
15995
15996
  return (animation === null || animation === void 0 ? void 0 : animation.name) && validAnimations && validAnimations[animation === null || animation === void 0 ? void 0 : animation.name] !== undefined;
15996
15997
  };
15997
15998
 
@@ -16014,7 +16015,8 @@
16014
16015
  animation = _ref2.animation,
16015
16016
  overlay = _ref2.overlay,
16016
16017
  infoWindowChildren = _ref2.infoWindowChildren,
16017
- isDraggable = _ref2.isDraggable;
16018
+ isDraggable = _ref2.isDraggable,
16019
+ zIndex = _ref2.zIndex;
16018
16020
 
16019
16021
  var _markerOptions$onLoad = markerOptions.onLoad,
16020
16022
  _onLoad = _markerOptions$onLoad === void 0 ? function () {} : _markerOptions$onLoad,
@@ -16077,27 +16079,26 @@
16077
16079
  };
16078
16080
  };
16079
16081
 
16080
- var animate = function animate() {
16081
- var _markerRef$current2, _markerRef$current2$m;
16082
+ var stopAnimation = function stopAnimation() {
16083
+ var _markerRef$current2;
16082
16084
 
16083
- if (!markerRef.current) return;
16084
- if (!isValidAnimation(animation)) return;
16085
- (_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : (_markerRef$current2$m = _markerRef$current2.marker) === null || _markerRef$current2$m === void 0 ? void 0 : _markerRef$current2$m.setAnimation(window.google.maps.Animation[animation === null || animation === void 0 ? void 0 : animation.name]);
16086
16085
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
16086
+ if ((_markerRef$current2 = markerRef.current) !== null && _markerRef$current2 !== void 0 && _markerRef$current2.marker) markerRef.current.marker.setAnimation(null);
16087
+ };
16087
16088
 
16088
- if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) {
16089
- timeoutRef.current = setTimeout(function () {
16090
- var _markerRef$current3, _markerRef$current3$m;
16091
-
16092
- (_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : (_markerRef$current3$m = _markerRef$current3.marker) === null || _markerRef$current3$m === void 0 ? void 0 : _markerRef$current3$m.setAnimation(null);
16093
- }, animation === null || animation === void 0 ? void 0 : animation.duration);
16094
- }
16089
+ var startAnimation = function startAnimation() {
16090
+ if (!markerRef.current) return;
16091
+ stopAnimation();
16092
+ markerRef.current.marker.setAnimation(window.google.maps.Animation[animation === null || animation === void 0 ? void 0 : animation.name]);
16093
+ if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) timeoutRef.current = setTimeout(function () {
16094
+ return stopAnimation();
16095
+ }, animation.duration);
16095
16096
  };
16096
16097
 
16097
16098
  React.useEffect(function () {
16098
- if (animation && isObject$2(animation)) animate();
16099
+ if (isValidAnimation(animation)) startAnimation();
16099
16100
  return function () {
16100
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
16101
+ stopAnimation();
16101
16102
  };
16102
16103
  }, [animation]);
16103
16104
  var markerProps = {
@@ -16105,6 +16106,7 @@
16105
16106
  position: position,
16106
16107
  draggable: isDraggable || !readOnly,
16107
16108
  icon: icon,
16109
+ zIndex: zIndex,
16108
16110
  onLoad: function onLoad(instance) {
16109
16111
  return _onLoad({
16110
16112
  prevMarker: marker,
@@ -16118,16 +16120,20 @@
16118
16120
  return _onDrag(event);
16119
16121
  },
16120
16122
  onDragEnd: function onDragEnd(event) {
16121
- return _onDragEnd(getEventHandlerData(event));
16123
+ if (isValidAnimation(animation)) startAnimation();
16124
+
16125
+ _onDragEnd(getEventHandlerData(event));
16122
16126
  },
16123
16127
  onDragStart: function onDragStart(event) {
16124
16128
  return _onDragStart(getEventHandlerData(event));
16125
16129
  },
16126
16130
  onMouseOver: function onMouseOver() {
16127
- return openInfoWindow();
16131
+ if (isValidAnimation(animation)) stopAnimation();
16132
+ openInfoWindow();
16128
16133
  },
16129
16134
  onMouseOut: function onMouseOut() {
16130
- return delayedInfoWindowHover();
16135
+ if (isValidAnimation(animation)) startAnimation();
16136
+ delayedInfoWindowHover();
16131
16137
  }
16132
16138
  };
16133
16139
  var infoWindowHandles = {