@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/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.40.1] - 2025-05-21
11
+
12
+ ### Fixed
13
+
14
+ - stop animation fn on hover marker
15
+
16
+ ## [0.40.0] - 2025-05-13
17
+
18
+ ### Added
19
+
20
+ - startAnimation and stopAnimation functions
21
+ - zIndex prop
22
+
23
+ ### CHANGED
24
+
25
+ - onDragEnd, onMouseOver and onMouseOut event functions
26
+
10
27
  ## [0.39.0] - 2025-05-13
11
28
 
12
29
  ### Added
package/dist/index.esm.js CHANGED
@@ -15966,6 +15966,7 @@ var isValidAnimation = function isValidAnimation() {
15966
15966
 
15967
15967
  var animation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15968
15968
  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;
15969
+ if (!animation || !isObject$2(animation)) return false;
15969
15970
  return (animation === null || animation === void 0 ? void 0 : animation.name) && validAnimations && validAnimations[animation === null || animation === void 0 ? void 0 : animation.name] !== undefined;
15970
15971
  };
15971
15972
 
@@ -15988,7 +15989,8 @@ var Marker = function Marker(_ref) {
15988
15989
  animation = _ref2.animation,
15989
15990
  overlay = _ref2.overlay,
15990
15991
  infoWindowChildren = _ref2.infoWindowChildren,
15991
- isDraggable = _ref2.isDraggable;
15992
+ isDraggable = _ref2.isDraggable,
15993
+ zIndex = _ref2.zIndex;
15992
15994
 
15993
15995
  var _markerOptions$onLoad = markerOptions.onLoad,
15994
15996
  _onLoad = _markerOptions$onLoad === void 0 ? function () {} : _markerOptions$onLoad,
@@ -16051,27 +16053,28 @@ var Marker = function Marker(_ref) {
16051
16053
  };
16052
16054
  };
16053
16055
 
16054
- var animate = function animate() {
16055
- var _markerRef$current2, _markerRef$current2$m;
16056
+ var stopAnimation = function stopAnimation() {
16057
+ var _markerRef$current2;
16056
16058
 
16059
+ if ((_markerRef$current2 = markerRef.current) !== null && _markerRef$current2 !== void 0 && _markerRef$current2.marker) markerRef.current.marker.setAnimation(null);
16060
+ };
16061
+
16062
+ var startAnimation = function startAnimation() {
16057
16063
  if (!markerRef.current) return;
16058
- if (!isValidAnimation(animation)) return;
16059
- (_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]);
16060
16064
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
16065
+ markerRef.current.marker.setAnimation(window.google.maps.Animation[animation === null || animation === void 0 ? void 0 : animation.name]);
16061
16066
 
16062
16067
  if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) {
16063
16068
  timeoutRef.current = setTimeout(function () {
16064
- var _markerRef$current3, _markerRef$current3$m;
16065
-
16066
- (_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);
16067
- }, animation === null || animation === void 0 ? void 0 : animation.duration);
16069
+ return stopAnimation();
16070
+ }, animation.duration);
16068
16071
  }
16069
16072
  };
16070
16073
 
16071
16074
  useEffect(function () {
16072
- if (animation && isObject$2(animation)) animate();
16075
+ if (isValidAnimation(animation)) startAnimation();
16073
16076
  return function () {
16074
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
16077
+ stopAnimation();
16075
16078
  };
16076
16079
  }, [animation]);
16077
16080
  var markerProps = {
@@ -16079,6 +16082,7 @@ var Marker = function Marker(_ref) {
16079
16082
  position: position,
16080
16083
  draggable: isDraggable || !readOnly,
16081
16084
  icon: icon,
16085
+ zIndex: zIndex,
16082
16086
  onLoad: function onLoad(instance) {
16083
16087
  return _onLoad({
16084
16088
  prevMarker: marker,
@@ -16092,16 +16096,20 @@ var Marker = function Marker(_ref) {
16092
16096
  return _onDrag(event);
16093
16097
  },
16094
16098
  onDragEnd: function onDragEnd(event) {
16095
- return _onDragEnd(getEventHandlerData(event));
16099
+ if (isValidAnimation(animation)) startAnimation();
16100
+
16101
+ _onDragEnd(getEventHandlerData(event));
16096
16102
  },
16097
16103
  onDragStart: function onDragStart(event) {
16098
16104
  return _onDragStart(getEventHandlerData(event));
16099
16105
  },
16100
16106
  onMouseOver: function onMouseOver() {
16101
- return openInfoWindow();
16107
+ if (isValidAnimation(animation)) stopAnimation();
16108
+ openInfoWindow();
16102
16109
  },
16103
16110
  onMouseOut: function onMouseOut() {
16104
- return delayedInfoWindowHover();
16111
+ if (isValidAnimation(animation)) startAnimation();
16112
+ delayedInfoWindowHover();
16105
16113
  }
16106
16114
  };
16107
16115
  var infoWindowHandles = {