@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/CHANGELOG.md CHANGED
@@ -11,6 +11,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
11
11
 
12
12
  ### Added
13
13
 
14
+ - startAnimation and stopAnimation functions
15
+ - zIndex prop
16
+
17
+ ### CHANGED
18
+
19
+ - onDragEnd, onMouseOver and onMouseOut event functions
20
+
21
+ ## [0.39.0] - 2025-05-13
22
+
23
+ ### Added
24
+
14
25
  - Enhanced map markers with animation support, including the ability to specify animation duration for each marker. Markers now animate automatically when added to the map.
15
26
 
16
27
  ## [0.38.0] - 2025-05-08
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,26 @@ 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
 
16057
- 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
16059
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
16060
+ if ((_markerRef$current2 = markerRef.current) !== null && _markerRef$current2 !== void 0 && _markerRef$current2.marker) markerRef.current.marker.setAnimation(null);
16061
+ };
16061
16062
 
16062
- if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) {
16063
- 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);
16068
- }
16063
+ var startAnimation = function startAnimation() {
16064
+ if (!markerRef.current) return;
16065
+ stopAnimation();
16066
+ markerRef.current.marker.setAnimation(window.google.maps.Animation[animation === null || animation === void 0 ? void 0 : animation.name]);
16067
+ if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) timeoutRef.current = setTimeout(function () {
16068
+ return stopAnimation();
16069
+ }, animation.duration);
16069
16070
  };
16070
16071
 
16071
16072
  useEffect(function () {
16072
- if (animation && isObject$2(animation)) animate();
16073
+ if (isValidAnimation(animation)) startAnimation();
16073
16074
  return function () {
16074
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
16075
+ stopAnimation();
16075
16076
  };
16076
16077
  }, [animation]);
16077
16078
  var markerProps = {
@@ -16079,6 +16080,7 @@ var Marker = function Marker(_ref) {
16079
16080
  position: position,
16080
16081
  draggable: isDraggable || !readOnly,
16081
16082
  icon: icon,
16083
+ zIndex: zIndex,
16082
16084
  onLoad: function onLoad(instance) {
16083
16085
  return _onLoad({
16084
16086
  prevMarker: marker,
@@ -16092,16 +16094,20 @@ var Marker = function Marker(_ref) {
16092
16094
  return _onDrag(event);
16093
16095
  },
16094
16096
  onDragEnd: function onDragEnd(event) {
16095
- return _onDragEnd(getEventHandlerData(event));
16097
+ if (isValidAnimation(animation)) startAnimation();
16098
+
16099
+ _onDragEnd(getEventHandlerData(event));
16096
16100
  },
16097
16101
  onDragStart: function onDragStart(event) {
16098
16102
  return _onDragStart(getEventHandlerData(event));
16099
16103
  },
16100
16104
  onMouseOver: function onMouseOver() {
16101
- return openInfoWindow();
16105
+ if (isValidAnimation(animation)) stopAnimation();
16106
+ openInfoWindow();
16102
16107
  },
16103
16108
  onMouseOut: function onMouseOut() {
16104
- return delayedInfoWindowHover();
16109
+ if (isValidAnimation(animation)) startAnimation();
16110
+ delayedInfoWindowHover();
16105
16111
  }
16106
16112
  };
16107
16113
  var infoWindowHandles = {