@janiscommerce/ui-web 0.36.0 → 0.38.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
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.38.0] - 2025-05-08
11
+
12
+ ### ADDED
13
+
14
+ - forwardRef, useImperativeHandle and useEffect for set bounds and zoom in Map component
15
+
16
+ ### REMOVED
17
+
18
+ - getCenterByGeolocationOrCenter, getGeolocationCoordinates map utils
19
+
20
+ ## [0.37.0] - 2025-05-02
21
+
22
+ ### Removed
23
+
24
+ - Prop iconSize to chip and format styles
25
+
10
26
  ## [0.36.0] - 2025-04-30
11
27
 
12
28
  ### Added
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, useEffect, useRef, PureComponent, useMemo, useCallback, useLayoutEffect, createContext } from 'react';
2
+ import React__default, { useState, useEffect, useRef, PureComponent, useMemo, useCallback, useLayoutEffect, createContext, forwardRef, useImperativeHandle } from 'react';
3
3
  import styled$g, { css, keyframes } from 'styled-components';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import ReactDOM__default from 'react-dom';
@@ -489,7 +489,7 @@ var isCallable$k = function (argument) {
489
489
 
490
490
  var isCallable$j = isCallable$k;
491
491
 
492
- var isObject$d = function (it) {
492
+ var isObject$c = function (it) {
493
493
  return typeof it == 'object' ? it !== null : isCallable$j(it);
494
494
  };
495
495
 
@@ -614,7 +614,7 @@ var getMethod$5 = function (V, P) {
614
614
  var global$L = global$T;
615
615
  var call$f = functionCall;
616
616
  var isCallable$f = isCallable$k;
617
- var isObject$c = isObject$d;
617
+ var isObject$b = isObject$c;
618
618
 
619
619
  var TypeError$k = global$L.TypeError;
620
620
 
@@ -622,9 +622,9 @@ var TypeError$k = global$L.TypeError;
622
622
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
623
623
  var ordinaryToPrimitive$1 = function (input, pref) {
624
624
  var fn, val;
625
- if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$c(val = call$f(fn, input))) return val;
626
- if (isCallable$f(fn = input.valueOf) && !isObject$c(val = call$f(fn, input))) return val;
627
- if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$c(val = call$f(fn, input))) return val;
625
+ if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$b(val = call$f(fn, input))) return val;
626
+ if (isCallable$f(fn = input.valueOf) && !isObject$b(val = call$f(fn, input))) return val;
627
+ if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$b(val = call$f(fn, input))) return val;
628
628
  throw TypeError$k("Can't convert object to primitive value");
629
629
  };
630
630
 
@@ -724,7 +724,7 @@ var wellKnownSymbol$m = function (name) {
724
724
 
725
725
  var global$G = global$T;
726
726
  var call$e = functionCall;
727
- var isObject$b = isObject$d;
727
+ var isObject$a = isObject$c;
728
728
  var isSymbol$2 = isSymbol$3;
729
729
  var getMethod$4 = getMethod$5;
730
730
  var ordinaryToPrimitive = ordinaryToPrimitive$1;
@@ -736,13 +736,13 @@ var TO_PRIMITIVE = wellKnownSymbol$l('toPrimitive');
736
736
  // `ToPrimitive` abstract operation
737
737
  // https://tc39.es/ecma262/#sec-toprimitive
738
738
  var toPrimitive$2 = function (input, pref) {
739
- if (!isObject$b(input) || isSymbol$2(input)) return input;
739
+ if (!isObject$a(input) || isSymbol$2(input)) return input;
740
740
  var exoticToPrim = getMethod$4(input, TO_PRIMITIVE);
741
741
  var result;
742
742
  if (exoticToPrim) {
743
743
  if (pref === undefined) pref = 'default';
744
744
  result = call$e(exoticToPrim, input, pref);
745
- if (!isObject$b(result) || isSymbol$2(result)) return result;
745
+ if (!isObject$a(result) || isSymbol$2(result)) return result;
746
746
  throw TypeError$j("Can't convert object to primitive value");
747
747
  }
748
748
  if (pref === undefined) pref = 'number';
@@ -760,11 +760,11 @@ var toPropertyKey$3 = function (argument) {
760
760
  };
761
761
 
762
762
  var global$F = global$T;
763
- var isObject$a = isObject$d;
763
+ var isObject$9 = isObject$c;
764
764
 
765
765
  var document$3 = global$F.document;
766
766
  // typeof document.createElement is 'object' in old IE
767
- var EXISTS$1 = isObject$a(document$3) && isObject$a(document$3.createElement);
767
+ var EXISTS$1 = isObject$9(document$3) && isObject$9(document$3.createElement);
768
768
 
769
769
  var documentCreateElement$2 = function (it) {
770
770
  return EXISTS$1 ? document$3.createElement(it) : {};
@@ -821,14 +821,14 @@ var v8PrototypeDefineBug = DESCRIPTORS$a && fails$k(function () {
821
821
  });
822
822
 
823
823
  var global$E = global$T;
824
- var isObject$9 = isObject$d;
824
+ var isObject$8 = isObject$c;
825
825
 
826
826
  var String$4 = global$E.String;
827
827
  var TypeError$i = global$E.TypeError;
828
828
 
829
829
  // `Assert: Type(argument) is Object`
830
830
  var anObject$h = function (argument) {
831
- if (isObject$9(argument)) return argument;
831
+ if (isObject$8(argument)) return argument;
832
832
  throw TypeError$i(String$4(argument) + ' is not an object');
833
833
  };
834
834
 
@@ -927,7 +927,7 @@ var hiddenKeys$4 = {};
927
927
  var NATIVE_WEAK_MAP = nativeWeakMap;
928
928
  var global$B = global$T;
929
929
  var uncurryThis$o = functionUncurryThis;
930
- var isObject$8 = isObject$d;
930
+ var isObject$7 = isObject$c;
931
931
  var createNonEnumerableProperty$6 = createNonEnumerableProperty$7;
932
932
  var hasOwn$a = hasOwnProperty_1;
933
933
  var shared$1 = sharedStore;
@@ -946,7 +946,7 @@ var enforce = function (it) {
946
946
  var getterFor = function (TYPE) {
947
947
  return function (it) {
948
948
  var state;
949
- if (!isObject$8(it) || (state = get(it)).type !== TYPE) {
949
+ if (!isObject$7(it) || (state = get(it)).type !== TYPE) {
950
950
  throw TypeError$g('Incompatible receiver, ' + TYPE + ' required');
951
951
  } return state;
952
952
  };
@@ -1411,7 +1411,7 @@ var isConstructor$3 = !construct || fails$i(function () {
1411
1411
  var global$x = global$T;
1412
1412
  var isArray$2 = isArray$3;
1413
1413
  var isConstructor$2 = isConstructor$3;
1414
- var isObject$7 = isObject$d;
1414
+ var isObject$6 = isObject$c;
1415
1415
  var wellKnownSymbol$i = wellKnownSymbol$m;
1416
1416
 
1417
1417
  var SPECIES$5 = wellKnownSymbol$i('species');
@@ -1425,7 +1425,7 @@ var arraySpeciesConstructor$1 = function (originalArray) {
1425
1425
  C = originalArray.constructor;
1426
1426
  // cross-realm fallback
1427
1427
  if (isConstructor$2(C) && (C === Array$3 || isArray$2(C.prototype))) C = undefined;
1428
- else if (isObject$7(C)) {
1428
+ else if (isObject$6(C)) {
1429
1429
  C = C[SPECIES$5];
1430
1430
  if (C === null) C = undefined;
1431
1431
  }
@@ -1464,7 +1464,7 @@ var $$i = _export;
1464
1464
  var global$w = global$T;
1465
1465
  var fails$g = fails$q;
1466
1466
  var isArray$1 = isArray$3;
1467
- var isObject$6 = isObject$d;
1467
+ var isObject$5 = isObject$c;
1468
1468
  var toObject$7 = toObject$9;
1469
1469
  var lengthOfArrayLike$7 = lengthOfArrayLike$9;
1470
1470
  var createProperty$2 = createProperty$3;
@@ -1490,7 +1490,7 @@ var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION$1 >= 51 || !fails$g(function () {
1490
1490
  var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$1('concat');
1491
1491
 
1492
1492
  var isConcatSpreadable = function (O) {
1493
- if (!isObject$6(O)) return false;
1493
+ if (!isObject$5(O)) return false;
1494
1494
  var spreadable = O[IS_CONCAT_SPREADABLE];
1495
1495
  return spreadable !== undefined ? !!spreadable : isArray$1(O);
1496
1496
  };
@@ -3103,7 +3103,7 @@ var hasOwn$3 = hasOwnProperty_1;
3103
3103
  var bind$7 = functionBindContext;
3104
3104
  var classof$2 = classof$8;
3105
3105
  var anObject$5 = anObject$h;
3106
- var isObject$5 = isObject$d;
3106
+ var isObject$4 = isObject$c;
3107
3107
  var $toString$2 = toString$9;
3108
3108
  var create = objectCreate;
3109
3109
  var createPropertyDescriptor = createPropertyDescriptor$5;
@@ -3206,7 +3206,7 @@ var URLSearchParamsState = function (init) {
3206
3206
  this.url = null;
3207
3207
 
3208
3208
  if (init !== undefined) {
3209
- if (isObject$5(init)) this.parseObject(init);
3209
+ if (isObject$4(init)) this.parseObject(init);
3210
3210
  else this.parseQuery(typeof init == 'string' ? charAt$1(init, 0) === '?' ? stringSlice$2(init, 1) : init : $toString$2(init));
3211
3211
  }
3212
3212
  };
@@ -3423,7 +3423,7 @@ if (!USE_NATIVE_URL$1 && isCallable$3(Headers)) {
3423
3423
  var headersSet = uncurryThis$d(HeadersPrototype.set);
3424
3424
 
3425
3425
  var wrapRequestOptions = function (init) {
3426
- if (isObject$5(init)) {
3426
+ if (isObject$4(init)) {
3427
3427
  var body = init.body;
3428
3428
  var headers;
3429
3429
  if (classof$2(body) === URL_SEARCH_PARAMS) {
@@ -4522,7 +4522,7 @@ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND
4522
4522
  return call$3.apply(apply$2, arguments);
4523
4523
  });
4524
4524
 
4525
- var isObject$4 = isObject$d;
4525
+ var isObject$3 = isObject$c;
4526
4526
  var classof$1 = classofRaw$1;
4527
4527
  var wellKnownSymbol$5 = wellKnownSymbol$m;
4528
4528
 
@@ -4532,7 +4532,7 @@ var MATCH$1 = wellKnownSymbol$5('match');
4532
4532
  // https://tc39.es/ecma262/#sec-isregexp
4533
4533
  var isRegexp = function (it) {
4534
4534
  var isRegExp;
4535
- return isObject$4(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$1(it) == 'RegExp');
4535
+ return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$1(it) == 'RegExp');
4536
4536
  };
4537
4537
 
4538
4538
  var global$f = global$T;
@@ -4957,7 +4957,7 @@ $$d({ target: 'Number', stat: true }, {
4957
4957
  });
4958
4958
 
4959
4959
  var isCallable$2 = isCallable$k;
4960
- var isObject$3 = isObject$d;
4960
+ var isObject$2 = isObject$c;
4961
4961
  var setPrototypeOf$1 = objectSetPrototypeOf;
4962
4962
 
4963
4963
  // makes subclassing work correct for wrapped built-ins
@@ -4969,7 +4969,7 @@ var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
4969
4969
  // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
4970
4970
  isCallable$2(NewTarget = dummy.constructor) &&
4971
4971
  NewTarget !== Wrapper &&
4972
- isObject$3(NewTargetPrototype = NewTarget.prototype) &&
4972
+ isObject$2(NewTargetPrototype = NewTarget.prototype) &&
4973
4973
  NewTargetPrototype !== Wrapper.prototype
4974
4974
  ) setPrototypeOf$1($this, NewTargetPrototype);
4975
4975
  return $this;
@@ -5625,9 +5625,9 @@ var styles$2 = {
5625
5625
  Svg: styled$g.svg.withConfig({
5626
5626
  displayName: "styles__Svg",
5627
5627
  componentId: "sc-jf3e5i-0"
5628
- })(["fill:", ";", " ", ";"], function (props) {
5628
+ })(["fill:", ";", " ", ";", ";"], function (props) {
5629
5629
  return getColor(props.color);
5630
- }, mediaBreaks.onlyPrint(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n\t\t\tfill: ", ";\n\t\t"])), palette.darkGrey), function (props) {
5630
+ }, mediaBreaks.onlyPrint(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n\t\t\tfill: ", ";\n\t\t"])), palette.darkGrey), mixins.transition('fill'), function (props) {
5631
5631
  return props.styles;
5632
5632
  }),
5633
5633
  Path: styled$g.path.withConfig({
@@ -7128,7 +7128,7 @@ var styled$d = {
7128
7128
  Chip: styled$g.button.withConfig({
7129
7129
  displayName: "styles__Chip",
7130
7130
  componentId: "sc-1vnh4co-0"
7131
- })(["padding:", ";cursor:", ";font-size:13px;color:", ";height:", ";width:", ";min-width:36px;max-width:150px;border-radius:", ";display:inline-flex;justify-content:center;align-items:center;pointer-events:", ";white-space:nowrap;", ";.chip-icon{", ";", ";}", ";", " ", " ", " ", ""], function (props) {
7131
+ })(["padding:", ";cursor:", ";font-size:13px;color:", ";height:", ";width:", ";min-width:36px;max-width:150px;border-radius:", ";display:inline-flex;justify-content:center;align-items:center;pointer-events:", ";white-space:nowrap;.chip-icon{", ";}", ";", ";", " ", " ", " ", ""], function (props) {
7132
7132
  return !props.onlyIcon ? '0 12px' : '0';
7133
7133
  }, function (props) {
7134
7134
  return props.clickable ? 'pointer' : 'default';
@@ -7140,12 +7140,10 @@ var styled$d = {
7140
7140
  return !props.onlyIcon ? '50px' : '50%';
7141
7141
  }, function (props) {
7142
7142
  return props.clickable || props.hasLink ? 'auto' : 'none';
7143
- }, function (props) {
7144
- return getChipVariant(props);
7145
7143
  }, function (props) {
7146
7144
  return !props.onlyIcon && 'margin-right: 8px';
7147
7145
  }, function (props) {
7148
- return props.iconColor && "fill: ".concat(getColor(props.iconColor));
7146
+ return getChipVariant(props);
7149
7147
  }, function (props) {
7150
7148
  return props.styles;
7151
7149
  }, function (props) {
@@ -7155,12 +7153,10 @@ var styled$d = {
7155
7153
  }, function (props) {
7156
7154
  return props.textColor && "color: ".concat(getColor(props.textColor), ";");
7157
7155
  }, mediaBreaks.onlyPrint(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n\t\t\tborder: 1px solid ", ";\n\t\t"])), palette.darkGrey)),
7158
- iconPathStyles: css(["", ";"], mixins.transition('fill')),
7159
7156
  DeleteButton: styled$g.button.withConfig({
7160
7157
  displayName: "styles__DeleteButton",
7161
7158
  componentId: "sc-1vnh4co-1"
7162
7159
  })(["width:16px;height:16px;margin-left:12px;"]),
7163
- deleteButtonPathStyles: css(["", ";"], mixins.transition('fill')),
7164
7160
  Children: styled$g.div.withConfig({
7165
7161
  displayName: "styles__Children",
7166
7162
  componentId: "sc-1vnh4co-2"
@@ -7197,21 +7193,18 @@ var Chip = function Chip(_ref) {
7197
7193
  selected: selected,
7198
7194
  textColor: textColor,
7199
7195
  variant: variant,
7200
- iconColor: iconColor,
7201
7196
  hasLink: hasLink,
7202
7197
  onlyIcon: !children && icon
7203
7198
  }, props), icon && /*#__PURE__*/React__default.createElement(Icon, {
7204
7199
  className: "chip-icon",
7205
7200
  name: icon,
7206
7201
  color: iconColor,
7207
- size: iconSize,
7208
- pathStyles: styled$d.iconPathStyles
7202
+ size: iconSize
7209
7203
  }), children && /*#__PURE__*/React__default.createElement(styled$d.Children, null, children), onDelete && /*#__PURE__*/React__default.createElement(styled$d.DeleteButton, {
7210
7204
  type: "button",
7211
7205
  onClick: onDelete
7212
7206
  }, /*#__PURE__*/React__default.createElement(Icon, {
7213
7207
  color: "black",
7214
- pathStyles: styled$d.deleteButtonPathStyles,
7215
7208
  className: "delete-button",
7216
7209
  name: "cross_circle_flat",
7217
7210
  size: 16
@@ -17064,40 +17057,6 @@ var getBoundsFromMarkers = (function () {
17064
17057
  return getBounds(markersFlatted);
17065
17058
  });
17066
17059
 
17067
- /**
17068
- * Sets the map center based on the provided markers or a default center value.
17069
- * @param {Object} center A default center object with latitude and longitude values.
17070
- * @param {number} center.lat The latitude value of the default center.
17071
- * @param {number} center.lng The longitude value of the default center.
17072
- */
17073
-
17074
- var getCenterByGeolocationOrCenter = (function () {
17075
- var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17076
- if (validateCoordinates(center)) return center;
17077
- return getGeolocationCoordinates();
17078
- });
17079
-
17080
- /**
17081
- * Retrieves the current geolocation of the user and updates the map's center coordinates.
17082
- */
17083
- var getGeolocationCoordinates = (function () {
17084
- try {
17085
- navigator.geolocation.getCurrentPosition(function () {
17086
- var pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17087
- var _pos$coords = pos.coords,
17088
- lat = _pos$coords.latitude,
17089
- lng = _pos$coords.longitude;
17090
- return {
17091
- lat: lat,
17092
- lng: lng
17093
- };
17094
- });
17095
- } catch (error) {
17096
- console.log(error);
17097
- return {};
17098
- }
17099
- });
17100
-
17101
17060
  var LIBRARIES = ['geometry', 'drawing', 'places'];
17102
17061
  var DEFAULT_CENTER = {
17103
17062
  lat: 0,
@@ -17276,15 +17235,6 @@ var getParsedComponents = (function () {
17276
17235
  });
17277
17236
  });
17278
17237
 
17279
- /**
17280
- * Function to check if a value is an object
17281
- * @param {*} value Value to check if it is an object
17282
- * @returns Returns true if the value is an object
17283
- */
17284
- var isObject$2 = function isObject(value) {
17285
- return _typeof(value) === 'object' && !Array.isArray(value) && value instanceof Object;
17286
- };
17287
-
17288
17238
  var global$7 = global$T;
17289
17239
 
17290
17240
  var nativePromiseConstructor = global$7.Promise;
@@ -17617,7 +17567,7 @@ newPromiseCapability$2.f = function (C) {
17617
17567
  };
17618
17568
 
17619
17569
  var anObject = anObject$h;
17620
- var isObject$1 = isObject$d;
17570
+ var isObject$1 = isObject$c;
17621
17571
  var newPromiseCapability$1 = newPromiseCapability$2;
17622
17572
 
17623
17573
  var promiseResolve$1 = function (C, x) {
@@ -17684,7 +17634,7 @@ var setToStringTag = setToStringTag$5;
17684
17634
  var setSpecies = setSpecies$1;
17685
17635
  var aCallable = aCallable$7;
17686
17636
  var isCallable = isCallable$k;
17687
- var isObject = isObject$d;
17637
+ var isObject = isObject$c;
17688
17638
  var anInstance = anInstance$3;
17689
17639
  var inspectSource = inspectSource$4;
17690
17640
  var iterate = iterate$1;
@@ -35404,28 +35354,6 @@ var parsePlaces = (function (places, parsedData) {
35404
35354
  }, _objectSpread2({}, parsedData));
35405
35355
  });
35406
35356
 
35407
- /**
35408
- * @function validateCoordinates
35409
- * @description return true or false is region has latitude and longitude keys and type number
35410
- * @param {object} coordinates - object with latitude and longitude
35411
- * @param {number} coordinates.lng - longitude
35412
- * @param {number} coordinates.lat - latitude
35413
- * @returns {boolean}
35414
- * @example isValidRegionData({latitude: -345345, longitude: -345435345}) => true
35415
- * @example isValidRegionData({latitude: -345345, longitude: '3453453453'}) => false
35416
- * @example isValidRegionData({latitude: -345345}) => false
35417
- */
35418
-
35419
- var validateCoordinates = (function () {
35420
- var coordinates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35421
- if (!isObject$2(coordinates) || !Object.keys(coordinates).length) return false;
35422
- var lng = coordinates.lng,
35423
- lat = coordinates.lat;
35424
- if (!lng || !lat) return false;
35425
- if (!lodash.exports.isNumber(lng) || !lodash.exports.isNumber(lat)) return false;
35426
- return true;
35427
- });
35428
-
35429
35357
  var styled = {
35430
35358
  LoadingElement: styled$g.div.withConfig({
35431
35359
  displayName: "styles__LoadingElement",
@@ -35493,8 +35421,7 @@ var SearchBox = function SearchBox(_ref) {
35493
35421
  };
35494
35422
 
35495
35423
  var _excluded = ["googleMapsApiKey", "width", "height", "center", "zoom", "markers", "markerOptions", "options", "callbackOnSuccessDirections", "callbackOnErrorDirections"];
35496
-
35497
- var Map$1 = function Map(_ref) {
35424
+ var Map$1 = /*#__PURE__*/forwardRef(function (_ref, ref) {
35498
35425
  var _mapRef$current;
35499
35426
 
35500
35427
  var _ref$googleMapsApiKey = _ref.googleMapsApiKey,
@@ -35503,8 +35430,7 @@ var Map$1 = function Map(_ref) {
35503
35430
  width = _ref$width === void 0 ? '800px' : _ref$width,
35504
35431
  _ref$height = _ref.height,
35505
35432
  height = _ref$height === void 0 ? '400px' : _ref$height,
35506
- _ref$center = _ref.center,
35507
- center = _ref$center === void 0 ? DEFAULT_CENTER : _ref$center,
35433
+ center = _ref.center,
35508
35434
  _ref$zoom = _ref.zoom,
35509
35435
  zoom = _ref$zoom === void 0 ? 13 : _ref$zoom,
35510
35436
  _ref$markers = _ref.markers,
@@ -35547,7 +35473,7 @@ var Map$1 = function Map(_ref) {
35547
35473
  mapRef.current.panTo(newCenter);
35548
35474
  };
35549
35475
 
35550
- var onLoad = useCallback(function (map) {
35476
+ var onLoad = function onLoad(map) {
35551
35477
  if (!map) return;
35552
35478
  mapRef.current = map;
35553
35479
  mapRef.current.setOptions({
@@ -35556,10 +35482,22 @@ var Map$1 = function Map(_ref) {
35556
35482
  var fullScreenPos = mapOptions.showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
35557
35483
  handlePositions('fullScreen', window.google.maps.ControlPosition[fullScreenPos]);
35558
35484
  handlePositions('zoom', window.google.maps.ControlPosition.RIGHT_BOTTOM);
35559
- if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(getCenterByGeolocationOrCenter(center || DEFAULT_CENTER));
35560
- if (markers !== null && markers !== void 0 && markers.length) mapRef.current.fitBounds(getBoundsFromMarkers(markers));
35561
- mapRef.current.setZoom(zoom);
35562
- }, [center, markers, options, zoom]);
35485
+ if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(center || DEFAULT_CENTER);
35486
+ mapRef.current.setZoom(!center ? 2 : zoom);
35487
+ };
35488
+
35489
+ useImperativeHandle(ref, function () {
35490
+ return {
35491
+ setZoom: function setZoom(zoom) {
35492
+ return mapRef.current.setZoom(zoom);
35493
+ }
35494
+ };
35495
+ });
35496
+ useEffect(function () {
35497
+ if (mapRef.current && markers !== null && markers !== void 0 && markers.length) {
35498
+ mapRef.current.fitBounds(getBoundsFromMarkers(markers));
35499
+ }
35500
+ }, [mapRef.current, markers]);
35563
35501
  if (!isLoaded) return null;
35564
35502
  return /*#__PURE__*/React__default.createElement(GoogleMap, _extends$1({
35565
35503
  className: "google-map-component",
@@ -35569,7 +35507,7 @@ var Map$1 = function Map(_ref) {
35569
35507
  width: width
35570
35508
  },
35571
35509
  options: mapOptions,
35572
- center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.center
35510
+ center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.getCenter()
35573
35511
  }, props), mapOptions.showSearchBar && /*#__PURE__*/React__default.createElement(SearchBox, {
35574
35512
  updateMarker: updateMarker,
35575
35513
  className: "google-map-component__search-box"
@@ -35581,7 +35519,8 @@ var Map$1 = function Map(_ref) {
35581
35519
  callbackOnErrorDirections: callbackOnErrorDirections,
35582
35520
  googleMapsApiKey: googleMapsApiKey
35583
35521
  }));
35584
- };
35522
+ });
35523
+ Map$1.displayName = 'Map';
35585
35524
 
35586
35525
  var rotate = keyframes(["to{transform:rotate(360deg);}"]);
35587
35526
  var Spinner$1 = styled$g.div.withConfig({