@janiscommerce/ui-web 0.29.1 → 0.30.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 +10 -0
- package/dist/index.esm.js +83 -58
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +83 -58
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
<<<<<<< HEAD
|
|
11
|
+
## [0.30.0] - 2025-03-06
|
|
12
|
+
=======
|
|
13
|
+
## [0.30.0] - 2025-02-26
|
|
14
|
+
>>>>>>> 91ba7c2d8e55838f6f56bc165ea011472e05dc62
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Options prop to map
|
|
19
|
+
|
|
10
20
|
## [0.29.1] - 2025-02-26
|
|
11
21
|
|
|
12
22
|
### Fixed
|
package/dist/index.esm.js
CHANGED
|
@@ -7066,7 +7066,7 @@ if (DESCRIPTORS$1 && !FUNCTION_NAME_EXISTS) {
|
|
|
7066
7066
|
});
|
|
7067
7067
|
}
|
|
7068
7068
|
|
|
7069
|
-
var _excluded$
|
|
7069
|
+
var _excluded$a = ["color", "name", "size", "styles", "pathStyles", "width", "height", "viewBox"];
|
|
7070
7070
|
|
|
7071
7071
|
var Icon = function Icon(_ref) {
|
|
7072
7072
|
var color = _ref.color,
|
|
@@ -7077,7 +7077,7 @@ var Icon = function Icon(_ref) {
|
|
|
7077
7077
|
width = _ref.width,
|
|
7078
7078
|
height = _ref.height,
|
|
7079
7079
|
viewBox = _ref.viewBox,
|
|
7080
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
7080
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
7081
7081
|
|
|
7082
7082
|
if (!icons[name]) return null;
|
|
7083
7083
|
var _icons$name = icons[name],
|
|
@@ -7165,7 +7165,7 @@ var styled$d = {
|
|
|
7165
7165
|
})(["text-overflow:ellipsis;overflow:hidden;"])
|
|
7166
7166
|
};
|
|
7167
7167
|
|
|
7168
|
-
var _excluded$
|
|
7168
|
+
var _excluded$9 = ["backgroundColor", "borderColor", "children", "disabled", "icon", "iconColor", "onClick", "onDelete", "selected", "textColor", "variant", "hasLink"];
|
|
7169
7169
|
|
|
7170
7170
|
var Chip = function Chip(_ref) {
|
|
7171
7171
|
var backgroundColor = _ref.backgroundColor,
|
|
@@ -7180,7 +7180,7 @@ var Chip = function Chip(_ref) {
|
|
|
7180
7180
|
textColor = _ref.textColor,
|
|
7181
7181
|
variant = _ref.variant,
|
|
7182
7182
|
hasLink = _ref.hasLink,
|
|
7183
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
7183
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
7184
7184
|
|
|
7185
7185
|
if (!children && !icon) return null;
|
|
7186
7186
|
return /*#__PURE__*/React__default.createElement(styled$d.Chip, _extends$1({
|
|
@@ -7485,7 +7485,7 @@ var styled$b = {
|
|
|
7485
7485
|
})
|
|
7486
7486
|
};
|
|
7487
7487
|
|
|
7488
|
-
var _excluded$
|
|
7488
|
+
var _excluded$8 = ["children", "color", "hideLabel", "icon", "iconColor", "iconSize", "fontColor", "rounded", "styles", "variant", "disabled"];
|
|
7489
7489
|
|
|
7490
7490
|
var Button = function Button(_ref) {
|
|
7491
7491
|
var children = _ref.children,
|
|
@@ -7499,7 +7499,7 @@ var Button = function Button(_ref) {
|
|
|
7499
7499
|
styles = _ref.styles,
|
|
7500
7500
|
variant = _ref.variant,
|
|
7501
7501
|
disabled = _ref.disabled,
|
|
7502
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
7502
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
7503
7503
|
|
|
7504
7504
|
return /*#__PURE__*/React__default.createElement(styled$b.Button, _extends$1({
|
|
7505
7505
|
color: color,
|
|
@@ -7548,7 +7548,7 @@ var styled$a = {
|
|
|
7548
7548
|
})
|
|
7549
7549
|
};
|
|
7550
7550
|
|
|
7551
|
-
var _excluded$
|
|
7551
|
+
var _excluded$7 = ["autoComplete", "disabled", "defaultChecked", "onChange", "rounded", "styles", "value"];
|
|
7552
7552
|
|
|
7553
7553
|
var Checkbox = function Checkbox(_ref) {
|
|
7554
7554
|
var autoComplete = _ref.autoComplete,
|
|
@@ -7558,7 +7558,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
7558
7558
|
rounded = _ref.rounded,
|
|
7559
7559
|
styles = _ref.styles,
|
|
7560
7560
|
value = _ref.value,
|
|
7561
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
7561
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
7562
7562
|
|
|
7563
7563
|
var _useState = useState(!!value || defaultChecked),
|
|
7564
7564
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -7674,7 +7674,7 @@ var styled$8 = {
|
|
|
7674
7674
|
iconCheckStyles: iconCheckStyles
|
|
7675
7675
|
};
|
|
7676
7676
|
|
|
7677
|
-
var _excluded$
|
|
7677
|
+
var _excluded$6 = ["autoComplete", "defaultChecked", "disabled", "id", "name", "onChange", "value"];
|
|
7678
7678
|
|
|
7679
7679
|
var Switch = function Switch(_ref) {
|
|
7680
7680
|
var autoComplete = _ref.autoComplete,
|
|
@@ -7684,7 +7684,7 @@ var Switch = function Switch(_ref) {
|
|
|
7684
7684
|
name = _ref.name,
|
|
7685
7685
|
onChange = _ref.onChange,
|
|
7686
7686
|
value = _ref.value,
|
|
7687
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
7687
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
7688
7688
|
|
|
7689
7689
|
var _useState = useState(!!value || defaultChecked),
|
|
7690
7690
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -7856,7 +7856,7 @@ var styled$7 = {
|
|
|
7856
7856
|
})(["position:absolute;flex-shrink:0;flex-grow:0;margin-right:8px;height:100%;"])
|
|
7857
7857
|
};
|
|
7858
7858
|
|
|
7859
|
-
var _excluded$
|
|
7859
|
+
var _excluded$5 = ["icon", "error", "disabled", "placeholder", "errorMessage", "autoComplete", "hasFloatingLabel", "value", "isTranslateActive", "defaultValue"];
|
|
7860
7860
|
|
|
7861
7861
|
var Input = /*#__PURE__*/function (_PureComponent) {
|
|
7862
7862
|
_inherits$2(Input, _PureComponent);
|
|
@@ -7952,7 +7952,7 @@ var Input = /*#__PURE__*/function (_PureComponent) {
|
|
|
7952
7952
|
value = _this$props$value === void 0 ? stateValue : _this$props$value,
|
|
7953
7953
|
isTranslateActive = _this$props.isTranslateActive;
|
|
7954
7954
|
_this$props.defaultValue;
|
|
7955
|
-
var props = _objectWithoutProperties(_this$props, _excluded$
|
|
7955
|
+
var props = _objectWithoutProperties(_this$props, _excluded$5);
|
|
7956
7956
|
|
|
7957
7957
|
var autoCompleteOff = props.type === 'password' ? 'new-password' : 'off';
|
|
7958
7958
|
var isFloating = isFocused || !!value.toString();
|
|
@@ -8065,7 +8065,7 @@ var styled$6 = {
|
|
|
8065
8065
|
})(["color:", ";font-size:12px;line-height:14px;display:block;word-break:break-word;"], palette.statusRed)
|
|
8066
8066
|
};
|
|
8067
8067
|
|
|
8068
|
-
var _excluded$
|
|
8068
|
+
var _excluded$4 = ["label", "error", "disabled", "placeholder", "autoComplete", "errorMessage", "hasFloatingLabel", "isTranslateActive", "value", "defaultValue"];
|
|
8069
8069
|
|
|
8070
8070
|
var Textarea = /*#__PURE__*/function (_PureComponent) {
|
|
8071
8071
|
_inherits$2(Textarea, _PureComponent);
|
|
@@ -8167,7 +8167,7 @@ var Textarea = /*#__PURE__*/function (_PureComponent) {
|
|
|
8167
8167
|
_this$props$value = _this$props.value,
|
|
8168
8168
|
value = _this$props$value === void 0 ? stateValue : _this$props$value;
|
|
8169
8169
|
_this$props.defaultValue;
|
|
8170
|
-
var props = _objectWithoutProperties(_this$props, _excluded$
|
|
8170
|
+
var props = _objectWithoutProperties(_this$props, _excluded$4);
|
|
8171
8171
|
|
|
8172
8172
|
var isFloating = isFocused || !!value;
|
|
8173
8173
|
return /*#__PURE__*/React__default.createElement(styled$6.Container, {
|
|
@@ -9696,14 +9696,14 @@ var styled$2 = {
|
|
|
9696
9696
|
})(["margin-right:8px;"])
|
|
9697
9697
|
};
|
|
9698
9698
|
|
|
9699
|
-
var _excluded$
|
|
9699
|
+
var _excluded$3 = ["href", "children", "target", "icon"];
|
|
9700
9700
|
|
|
9701
9701
|
var Link = function Link(_ref) {
|
|
9702
9702
|
var href = _ref.href,
|
|
9703
9703
|
children = _ref.children,
|
|
9704
9704
|
target = _ref.target,
|
|
9705
9705
|
icon = _ref.icon,
|
|
9706
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
9706
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
9707
9707
|
|
|
9708
9708
|
var renderIcon = function renderIcon() {
|
|
9709
9709
|
return icon ? /*#__PURE__*/React__default.createElement(styled$2.StyledIcon, {
|
|
@@ -9827,7 +9827,7 @@ var styled$1 = {
|
|
|
9827
9827
|
Overlay: Overlay
|
|
9828
9828
|
};
|
|
9829
9829
|
|
|
9830
|
-
var _excluded$
|
|
9830
|
+
var _excluded$2 = ["open", "position", "handleClose", "transitionDuration", "fullScreen", "closeOnClickAway", "children"];
|
|
9831
9831
|
|
|
9832
9832
|
var Drawer = function Drawer(_ref) {
|
|
9833
9833
|
var open = _ref.open,
|
|
@@ -9837,7 +9837,7 @@ var Drawer = function Drawer(_ref) {
|
|
|
9837
9837
|
fullScreen = _ref.fullScreen,
|
|
9838
9838
|
closeOnClickAway = _ref.closeOnClickAway,
|
|
9839
9839
|
children = _ref.children,
|
|
9840
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
9840
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
9841
9841
|
|
|
9842
9842
|
var drawerRef = useRef(null);
|
|
9843
9843
|
return /*#__PURE__*/React__default.createElement(ClickAwayListener, {
|
|
@@ -16068,7 +16068,7 @@ var MarkersDrawer = function MarkersDrawer(_ref) {
|
|
|
16068
16068
|
var _ref$markers = _ref.markers,
|
|
16069
16069
|
markers = _ref$markers === void 0 ? [] : _ref$markers,
|
|
16070
16070
|
_ref$readOnly = _ref.readOnly,
|
|
16071
|
-
readOnly = _ref$readOnly === void 0 ?
|
|
16071
|
+
readOnly = _ref$readOnly === void 0 ? true : _ref$readOnly,
|
|
16072
16072
|
_ref$setMarker = _ref.setMarker,
|
|
16073
16073
|
setMarker = _ref$setMarker === void 0 ? function () {} : _ref$setMarker,
|
|
16074
16074
|
_ref$callbackOnSucces = _ref.callbackOnSuccessDirections,
|
|
@@ -17011,6 +17011,10 @@ var getGeolocationCoordinates = (function () {
|
|
|
17011
17011
|
});
|
|
17012
17012
|
|
|
17013
17013
|
var LIBRARIES = ['geometry', 'drawing', 'places'];
|
|
17014
|
+
var DEFAULT_CENTER = {
|
|
17015
|
+
lat: 0,
|
|
17016
|
+
lng: 0
|
|
17017
|
+
};
|
|
17014
17018
|
var INITIAL_CONTROLS_POSITION = {
|
|
17015
17019
|
zoom: 13,
|
|
17016
17020
|
fullScreen: 0
|
|
@@ -17035,36 +17039,38 @@ var MAP_FEATURE_TYPES = {
|
|
|
17035
17039
|
water: 'water',
|
|
17036
17040
|
_default: 'poi'
|
|
17037
17041
|
};
|
|
17042
|
+
var DEFAULT_MAP_OPTIONS = {
|
|
17043
|
+
mapTypeControl: false,
|
|
17044
|
+
streetViewControl: false,
|
|
17045
|
+
zoomControl: true,
|
|
17046
|
+
clickableIcons: false
|
|
17047
|
+
};
|
|
17038
17048
|
|
|
17039
17049
|
/**
|
|
17040
17050
|
* Parses configuration for map styles and controls based on the provided options.
|
|
17041
17051
|
* @param {boolean} showPOI Determines whether Points of Interest (POI) should be displayed on the map.
|
|
17052
|
+
* @param {Object} options An object specifying the options to control map display
|
|
17042
17053
|
* @param {Object} controlsPositions An object specifying the positions of map controls.
|
|
17043
17054
|
* @param {number} controlsPositions.zoom The position of the zoom control on the map.
|
|
17044
17055
|
* @param {number} controlsPositions.fullScreen The position of the fullscreen control on the map.
|
|
17045
17056
|
* @returns {Object} An object containing the parsed map options, including styles and control settings.
|
|
17046
17057
|
*/
|
|
17047
17058
|
|
|
17048
|
-
var getMapOptions = (function () {
|
|
17049
|
-
var showPOI = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
17059
|
+
var getMapOptions = (function (options) {
|
|
17050
17060
|
var controlsPositions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
17051
17061
|
var poi = MAP_FEATURE_TYPES.poi,
|
|
17052
17062
|
transit = MAP_FEATURE_TYPES.transit;
|
|
17053
|
-
var hideFeaturesRules = !showPOI
|
|
17054
|
-
var mapStyleOptions = getMapStylers(hideFeaturesRules);
|
|
17055
|
-
return {
|
|
17056
|
-
mapTypeControl: false,
|
|
17057
|
-
streetViewControl: false,
|
|
17058
|
-
zoomControl: true,
|
|
17063
|
+
var hideFeaturesRules = !options.showPOI ? [poi, transit] : [];
|
|
17064
|
+
var mapStyleOptions = getMapStylers(hideFeaturesRules, options.poiRules);
|
|
17065
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_MAP_OPTIONS), options), {}, {
|
|
17059
17066
|
zoomControlOptions: {
|
|
17060
17067
|
position: controlsPositions.zoom
|
|
17061
17068
|
},
|
|
17062
17069
|
fullscreenControlOptions: {
|
|
17063
17070
|
position: controlsPositions.fullScreen
|
|
17064
17071
|
},
|
|
17065
|
-
clickableIcons: false,
|
|
17066
17072
|
styles: mapStyleOptions
|
|
17067
|
-
};
|
|
17073
|
+
});
|
|
17068
17074
|
});
|
|
17069
17075
|
|
|
17070
17076
|
var $forEach = arrayIteration.forEach;
|
|
@@ -17105,20 +17111,34 @@ handlePrototype(DOMTokenListPrototype);
|
|
|
17105
17111
|
/**
|
|
17106
17112
|
* Returns the list of stylers based on the provided rules.
|
|
17107
17113
|
* @param {Array} rules Array of rules
|
|
17114
|
+
* @param {Array} poiRules Array of poiRules
|
|
17108
17115
|
* @returns Returns the list of stylers
|
|
17109
17116
|
*/
|
|
17110
17117
|
|
|
17111
17118
|
var getMapStylers = (function () {
|
|
17112
17119
|
var rules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17120
|
+
var poiRules = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
17113
17121
|
var styleRules = [];
|
|
17114
17122
|
var allRules = Array.isArray(rules) ? rules : [rules];
|
|
17123
|
+
var _MAP_STYLERS$_default = MAP_STYLERS._default,
|
|
17124
|
+
styler = _MAP_STYLERS$_default.styler,
|
|
17125
|
+
value = _MAP_STYLERS$_default.value;
|
|
17115
17126
|
allRules.forEach(function (rule) {
|
|
17116
|
-
var featureType = MAP_FEATURE_TYPES[rule] || MAP_FEATURE_TYPES._default;
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17127
|
+
var featureType = MAP_FEATURE_TYPES[rule] || MAP_FEATURE_TYPES._default;
|
|
17128
|
+
|
|
17129
|
+
if (rule === 'route') {
|
|
17130
|
+
styleRules.push({
|
|
17131
|
+
featureType: 'all',
|
|
17132
|
+
stylers: [{
|
|
17133
|
+
visibility: 'on'
|
|
17134
|
+
}, {
|
|
17135
|
+
weight: 3
|
|
17136
|
+
}]
|
|
17137
|
+
});
|
|
17138
|
+
return;
|
|
17139
|
+
}
|
|
17121
17140
|
|
|
17141
|
+
styleRules.push.apply(styleRules, _toConsumableArray(poiRules));
|
|
17122
17142
|
var ruleObj = {
|
|
17123
17143
|
featureType: featureType,
|
|
17124
17144
|
stylers: [_defineProperty({}, styler, value)]
|
|
@@ -35329,7 +35349,7 @@ var styled = {
|
|
|
35329
35349
|
})(["z-index:0;position:relative;right:0px;top:0px;background:", ";margin:10px;padding:4px 8px 6px;border-radius:2px;width:auto;box-shadow:rgba(0,0,0,0.3) 0px 1px 4px -1px;"], palette.white)
|
|
35330
35350
|
};
|
|
35331
35351
|
|
|
35332
|
-
var _excluded = ["formattedAddress"];
|
|
35352
|
+
var _excluded$1 = ["formattedAddress"];
|
|
35333
35353
|
|
|
35334
35354
|
var SearchBox = function SearchBox(_ref) {
|
|
35335
35355
|
var updateMarker = _ref.updateMarker;
|
|
@@ -35350,7 +35370,7 @@ var SearchBox = function SearchBox(_ref) {
|
|
|
35350
35370
|
|
|
35351
35371
|
case 4:
|
|
35352
35372
|
addressData = _context.sent;
|
|
35353
|
-
formattedAddress = addressData.formattedAddress, addressComponents = _objectWithoutProperties(addressData, _excluded);
|
|
35373
|
+
formattedAddress = addressData.formattedAddress, addressComponents = _objectWithoutProperties(addressData, _excluded$1);
|
|
35354
35374
|
if (updateMarker) updateMarker({
|
|
35355
35375
|
lat: newLat(),
|
|
35356
35376
|
lng: newLng(),
|
|
@@ -35379,12 +35399,16 @@ var SearchBox = function SearchBox(_ref) {
|
|
|
35379
35399
|
onPlacesChanged: onPlacesChanged,
|
|
35380
35400
|
onLoad: onLoad
|
|
35381
35401
|
}, /*#__PURE__*/React__default.createElement(styled.SearchBoxWrapper, null, /*#__PURE__*/React__default.createElement(Input, {
|
|
35382
|
-
placeholder: "
|
|
35402
|
+
placeholder: "Search",
|
|
35383
35403
|
hasFloatingLabel: false
|
|
35384
35404
|
})));
|
|
35385
35405
|
};
|
|
35386
35406
|
|
|
35407
|
+
var _excluded = ["googleMapsApiKey", "width", "height", "center", "zoom", "markers", "options", "callbackOnSuccessDirections", "callbackOnErrorDirections"];
|
|
35408
|
+
|
|
35387
35409
|
var Map$1 = function Map(_ref) {
|
|
35410
|
+
var _mapRef$current;
|
|
35411
|
+
|
|
35388
35412
|
var _ref$googleMapsApiKey = _ref.googleMapsApiKey,
|
|
35389
35413
|
googleMapsApiKey = _ref$googleMapsApiKey === void 0 ? '' : _ref$googleMapsApiKey,
|
|
35390
35414
|
_ref$width = _ref.width,
|
|
@@ -35392,21 +35416,18 @@ var Map$1 = function Map(_ref) {
|
|
|
35392
35416
|
_ref$height = _ref.height,
|
|
35393
35417
|
height = _ref$height === void 0 ? '400px' : _ref$height,
|
|
35394
35418
|
_ref$center = _ref.center,
|
|
35395
|
-
center = _ref$center === void 0 ?
|
|
35419
|
+
center = _ref$center === void 0 ? DEFAULT_CENTER : _ref$center,
|
|
35396
35420
|
_ref$zoom = _ref.zoom,
|
|
35397
35421
|
zoom = _ref$zoom === void 0 ? 13 : _ref$zoom,
|
|
35398
35422
|
_ref$markers = _ref.markers,
|
|
35399
35423
|
markers = _ref$markers === void 0 ? [] : _ref$markers,
|
|
35400
|
-
_ref$
|
|
35401
|
-
|
|
35402
|
-
_ref$readOnly = _ref.readOnly,
|
|
35403
|
-
readOnly = _ref$readOnly === void 0 ? true : _ref$readOnly,
|
|
35404
|
-
_ref$showPOI = _ref.showPOI,
|
|
35405
|
-
showPOI = _ref$showPOI === void 0 ? false : _ref$showPOI,
|
|
35424
|
+
_ref$options = _ref.options,
|
|
35425
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
35406
35426
|
_ref$callbackOnSucces = _ref.callbackOnSuccessDirections,
|
|
35407
35427
|
callbackOnSuccessDirections = _ref$callbackOnSucces === void 0 ? function () {} : _ref$callbackOnSucces,
|
|
35408
35428
|
_ref$callbackOnErrorD = _ref.callbackOnErrorDirections,
|
|
35409
|
-
callbackOnErrorDirections = _ref$callbackOnErrorD === void 0 ? function () {} : _ref$callbackOnErrorD
|
|
35429
|
+
callbackOnErrorDirections = _ref$callbackOnErrorD === void 0 ? function () {} : _ref$callbackOnErrorD,
|
|
35430
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
35410
35431
|
|
|
35411
35432
|
var _useJsApiLoader = useJsApiLoader({
|
|
35412
35433
|
googleMapsApiKey: googleMapsApiKey,
|
|
@@ -35422,10 +35443,6 @@ var Map$1 = function Map(_ref) {
|
|
|
35422
35443
|
setControlsPositions = _useState2[1];
|
|
35423
35444
|
|
|
35424
35445
|
var validMarkersExist = Array.isArray(markers) && markers.length;
|
|
35425
|
-
var defaultMapCenter = {
|
|
35426
|
-
lat: 0,
|
|
35427
|
-
lng: 0
|
|
35428
|
-
};
|
|
35429
35446
|
|
|
35430
35447
|
var handlePositions = function handlePositions(key, value) {
|
|
35431
35448
|
setControlsPositions(function (prev) {
|
|
@@ -35433,38 +35450,46 @@ var Map$1 = function Map(_ref) {
|
|
|
35433
35450
|
});
|
|
35434
35451
|
};
|
|
35435
35452
|
|
|
35436
|
-
var mapOptions = getMapOptions(
|
|
35453
|
+
var mapOptions = getMapOptions(options, controlsPositions);
|
|
35454
|
+
|
|
35455
|
+
var updateMarker = function updateMarker(newCenter) {
|
|
35456
|
+
if (!mapRef.current) return;
|
|
35457
|
+
mapRef.current.panTo(newCenter);
|
|
35458
|
+
};
|
|
35459
|
+
|
|
35437
35460
|
var onLoad = useCallback(function (map) {
|
|
35438
35461
|
if (!map) return;
|
|
35439
35462
|
mapRef.current = map;
|
|
35440
35463
|
mapRef.current.setOptions({
|
|
35441
35464
|
gestureHandling: 'greedy'
|
|
35442
35465
|
});
|
|
35443
|
-
var fullScreenPos = showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
|
|
35466
|
+
var fullScreenPos = mapOptions.showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
|
|
35444
35467
|
handlePositions('fullScreen', window.google.maps.ControlPosition[fullScreenPos]);
|
|
35445
35468
|
handlePositions('zoom', window.google.maps.ControlPosition.RIGHT_BOTTOM);
|
|
35446
|
-
if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(getCenterByGeolocationOrCenter(center ||
|
|
35469
|
+
if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(getCenterByGeolocationOrCenter(center || DEFAULT_CENTER));
|
|
35447
35470
|
if (markers !== null && markers !== void 0 && markers.length) mapRef.current.fitBounds(getBoundsFromMarkers(markers));
|
|
35448
35471
|
mapRef.current.setZoom(zoom);
|
|
35449
|
-
}, []);
|
|
35472
|
+
}, [center, markers, options, zoom]);
|
|
35450
35473
|
if (!isLoaded) return null;
|
|
35451
|
-
return /*#__PURE__*/React__default.createElement(GoogleMap, {
|
|
35474
|
+
return /*#__PURE__*/React__default.createElement(GoogleMap, _extends$1({
|
|
35452
35475
|
className: "google-map-component",
|
|
35453
35476
|
onLoad: onLoad,
|
|
35454
35477
|
mapContainerStyle: {
|
|
35455
35478
|
height: height,
|
|
35456
35479
|
width: width
|
|
35457
35480
|
},
|
|
35458
|
-
options: mapOptions
|
|
35459
|
-
|
|
35481
|
+
options: mapOptions,
|
|
35482
|
+
center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.center
|
|
35483
|
+
}, props), mapOptions.showSearchBar && /*#__PURE__*/React__default.createElement(SearchBox, {
|
|
35484
|
+
updateMarker: updateMarker,
|
|
35460
35485
|
className: "google-map-component__search-box"
|
|
35461
35486
|
}), validMarkersExist && /*#__PURE__*/React__default.createElement(MarkersDrawer, {
|
|
35462
35487
|
markers: markers,
|
|
35463
|
-
readOnly: readOnly,
|
|
35488
|
+
readOnly: mapOptions.readOnly,
|
|
35464
35489
|
callbackOnSuccessDirections: callbackOnSuccessDirections,
|
|
35465
35490
|
callbackOnErrorDirections: callbackOnErrorDirections,
|
|
35466
35491
|
googleMapsApiKey: googleMapsApiKey
|
|
35467
|
-
}))
|
|
35492
|
+
}));
|
|
35468
35493
|
};
|
|
35469
35494
|
|
|
35470
35495
|
export { Avatar, AvatarGroup$1 as AvatarGroup, Button, Checkbox, Chip, ClickAwayListener, Color, ColorPicker, Drawer, ErrorBoundary, HTML, Icon, Image, Input, Link, Map$1 as Map, QRCode, Skeleton, Switch, Textarea, icons, palette };
|