@janiscommerce/ui-web 0.39.0 → 0.40.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.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,28 @@
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
 
16085
+ if ((_markerRef$current2 = markerRef.current) !== null && _markerRef$current2 !== void 0 && _markerRef$current2.marker) markerRef.current.marker.setAnimation(null);
16086
+ };
16087
+
16088
+ var startAnimation = function startAnimation() {
16083
16089
  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
16090
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
16091
+ markerRef.current.marker.setAnimation(window.google.maps.Animation[animation === null || animation === void 0 ? void 0 : animation.name]);
16087
16092
 
16088
16093
  if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) {
16089
16094
  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);
16095
+ return stopAnimation();
16096
+ }, animation.duration);
16094
16097
  }
16095
16098
  };
16096
16099
 
16097
16100
  React.useEffect(function () {
16098
- if (animation && isObject$2(animation)) animate();
16101
+ if (isValidAnimation(animation)) startAnimation();
16099
16102
  return function () {
16100
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
16103
+ stopAnimation();
16101
16104
  };
16102
16105
  }, [animation]);
16103
16106
  var markerProps = {
@@ -16105,6 +16108,7 @@
16105
16108
  position: position,
16106
16109
  draggable: isDraggable || !readOnly,
16107
16110
  icon: icon,
16111
+ zIndex: zIndex,
16108
16112
  onLoad: function onLoad(instance) {
16109
16113
  return _onLoad({
16110
16114
  prevMarker: marker,
@@ -16118,16 +16122,20 @@
16118
16122
  return _onDrag(event);
16119
16123
  },
16120
16124
  onDragEnd: function onDragEnd(event) {
16121
- return _onDragEnd(getEventHandlerData(event));
16125
+ if (isValidAnimation(animation)) startAnimation();
16126
+
16127
+ _onDragEnd(getEventHandlerData(event));
16122
16128
  },
16123
16129
  onDragStart: function onDragStart(event) {
16124
16130
  return _onDragStart(getEventHandlerData(event));
16125
16131
  },
16126
16132
  onMouseOver: function onMouseOver() {
16127
- return openInfoWindow();
16133
+ if (isValidAnimation(animation)) stopAnimation();
16134
+ openInfoWindow();
16128
16135
  },
16129
16136
  onMouseOut: function onMouseOut() {
16130
- return delayedInfoWindowHover();
16137
+ if (isValidAnimation(animation)) startAnimation();
16138
+ delayedInfoWindowHover();
16131
16139
  }
16132
16140
  };
16133
16141
  var infoWindowHandles = {