@janiscommerce/ui-web 0.29.0 → 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 +16 -0
- package/dist/index.esm.js +87 -67
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +87 -67
- 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,22 @@ 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
|
+
|
|
20
|
+
## [0.29.1] - 2025-02-26
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Center of map component
|
|
25
|
+
|
|
10
26
|
## [0.29.0] - 2025-02-21
|
|
11
27
|
|
|
12
28
|
### Removed
|
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,
|
|
@@ -16985,10 +16985,7 @@ var getBoundsFromMarkers = (function () {
|
|
|
16985
16985
|
|
|
16986
16986
|
var getCenterByGeolocationOrCenter = (function () {
|
|
16987
16987
|
var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16988
|
-
if (validateCoordinates(center)) return
|
|
16989
|
-
lat: center.lat,
|
|
16990
|
-
lng: center.lng
|
|
16991
|
-
};
|
|
16988
|
+
if (validateCoordinates(center)) return center;
|
|
16992
16989
|
return getGeolocationCoordinates();
|
|
16993
16990
|
});
|
|
16994
16991
|
|
|
@@ -17014,6 +17011,10 @@ var getGeolocationCoordinates = (function () {
|
|
|
17014
17011
|
});
|
|
17015
17012
|
|
|
17016
17013
|
var LIBRARIES = ['geometry', 'drawing', 'places'];
|
|
17014
|
+
var DEFAULT_CENTER = {
|
|
17015
|
+
lat: 0,
|
|
17016
|
+
lng: 0
|
|
17017
|
+
};
|
|
17017
17018
|
var INITIAL_CONTROLS_POSITION = {
|
|
17018
17019
|
zoom: 13,
|
|
17019
17020
|
fullScreen: 0
|
|
@@ -17038,36 +17039,38 @@ var MAP_FEATURE_TYPES = {
|
|
|
17038
17039
|
water: 'water',
|
|
17039
17040
|
_default: 'poi'
|
|
17040
17041
|
};
|
|
17042
|
+
var DEFAULT_MAP_OPTIONS = {
|
|
17043
|
+
mapTypeControl: false,
|
|
17044
|
+
streetViewControl: false,
|
|
17045
|
+
zoomControl: true,
|
|
17046
|
+
clickableIcons: false
|
|
17047
|
+
};
|
|
17041
17048
|
|
|
17042
17049
|
/**
|
|
17043
17050
|
* Parses configuration for map styles and controls based on the provided options.
|
|
17044
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
|
|
17045
17053
|
* @param {Object} controlsPositions An object specifying the positions of map controls.
|
|
17046
17054
|
* @param {number} controlsPositions.zoom The position of the zoom control on the map.
|
|
17047
17055
|
* @param {number} controlsPositions.fullScreen The position of the fullscreen control on the map.
|
|
17048
17056
|
* @returns {Object} An object containing the parsed map options, including styles and control settings.
|
|
17049
17057
|
*/
|
|
17050
17058
|
|
|
17051
|
-
var getMapOptions = (function () {
|
|
17052
|
-
var showPOI = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
17059
|
+
var getMapOptions = (function (options) {
|
|
17053
17060
|
var controlsPositions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
17054
17061
|
var poi = MAP_FEATURE_TYPES.poi,
|
|
17055
17062
|
transit = MAP_FEATURE_TYPES.transit;
|
|
17056
|
-
var hideFeaturesRules = !showPOI
|
|
17057
|
-
var mapStyleOptions = getMapStylers(hideFeaturesRules);
|
|
17058
|
-
return {
|
|
17059
|
-
mapTypeControl: false,
|
|
17060
|
-
streetViewControl: false,
|
|
17061
|
-
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), {}, {
|
|
17062
17066
|
zoomControlOptions: {
|
|
17063
17067
|
position: controlsPositions.zoom
|
|
17064
17068
|
},
|
|
17065
17069
|
fullscreenControlOptions: {
|
|
17066
17070
|
position: controlsPositions.fullScreen
|
|
17067
17071
|
},
|
|
17068
|
-
clickableIcons: false,
|
|
17069
17072
|
styles: mapStyleOptions
|
|
17070
|
-
};
|
|
17073
|
+
});
|
|
17071
17074
|
});
|
|
17072
17075
|
|
|
17073
17076
|
var $forEach = arrayIteration.forEach;
|
|
@@ -17108,20 +17111,34 @@ handlePrototype(DOMTokenListPrototype);
|
|
|
17108
17111
|
/**
|
|
17109
17112
|
* Returns the list of stylers based on the provided rules.
|
|
17110
17113
|
* @param {Array} rules Array of rules
|
|
17114
|
+
* @param {Array} poiRules Array of poiRules
|
|
17111
17115
|
* @returns Returns the list of stylers
|
|
17112
17116
|
*/
|
|
17113
17117
|
|
|
17114
17118
|
var getMapStylers = (function () {
|
|
17115
17119
|
var rules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17120
|
+
var poiRules = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
17116
17121
|
var styleRules = [];
|
|
17117
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;
|
|
17118
17126
|
allRules.forEach(function (rule) {
|
|
17119
|
-
var featureType = MAP_FEATURE_TYPES[rule] || MAP_FEATURE_TYPES._default;
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
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
|
+
}
|
|
17124
17140
|
|
|
17141
|
+
styleRules.push.apply(styleRules, _toConsumableArray(poiRules));
|
|
17125
17142
|
var ruleObj = {
|
|
17126
17143
|
featureType: featureType,
|
|
17127
17144
|
stylers: [_defineProperty({}, styler, value)]
|
|
@@ -35332,7 +35349,7 @@ var styled = {
|
|
|
35332
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)
|
|
35333
35350
|
};
|
|
35334
35351
|
|
|
35335
|
-
var _excluded = ["formattedAddress"];
|
|
35352
|
+
var _excluded$1 = ["formattedAddress"];
|
|
35336
35353
|
|
|
35337
35354
|
var SearchBox = function SearchBox(_ref) {
|
|
35338
35355
|
var updateMarker = _ref.updateMarker;
|
|
@@ -35353,7 +35370,7 @@ var SearchBox = function SearchBox(_ref) {
|
|
|
35353
35370
|
|
|
35354
35371
|
case 4:
|
|
35355
35372
|
addressData = _context.sent;
|
|
35356
|
-
formattedAddress = addressData.formattedAddress, addressComponents = _objectWithoutProperties(addressData, _excluded);
|
|
35373
|
+
formattedAddress = addressData.formattedAddress, addressComponents = _objectWithoutProperties(addressData, _excluded$1);
|
|
35357
35374
|
if (updateMarker) updateMarker({
|
|
35358
35375
|
lat: newLat(),
|
|
35359
35376
|
lng: newLng(),
|
|
@@ -35382,12 +35399,16 @@ var SearchBox = function SearchBox(_ref) {
|
|
|
35382
35399
|
onPlacesChanged: onPlacesChanged,
|
|
35383
35400
|
onLoad: onLoad
|
|
35384
35401
|
}, /*#__PURE__*/React__default.createElement(styled.SearchBoxWrapper, null, /*#__PURE__*/React__default.createElement(Input, {
|
|
35385
|
-
placeholder: "
|
|
35402
|
+
placeholder: "Search",
|
|
35386
35403
|
hasFloatingLabel: false
|
|
35387
35404
|
})));
|
|
35388
35405
|
};
|
|
35389
35406
|
|
|
35407
|
+
var _excluded = ["googleMapsApiKey", "width", "height", "center", "zoom", "markers", "options", "callbackOnSuccessDirections", "callbackOnErrorDirections"];
|
|
35408
|
+
|
|
35390
35409
|
var Map$1 = function Map(_ref) {
|
|
35410
|
+
var _mapRef$current;
|
|
35411
|
+
|
|
35391
35412
|
var _ref$googleMapsApiKey = _ref.googleMapsApiKey,
|
|
35392
35413
|
googleMapsApiKey = _ref$googleMapsApiKey === void 0 ? '' : _ref$googleMapsApiKey,
|
|
35393
35414
|
_ref$width = _ref.width,
|
|
@@ -35395,21 +35416,18 @@ var Map$1 = function Map(_ref) {
|
|
|
35395
35416
|
_ref$height = _ref.height,
|
|
35396
35417
|
height = _ref$height === void 0 ? '400px' : _ref$height,
|
|
35397
35418
|
_ref$center = _ref.center,
|
|
35398
|
-
center = _ref$center === void 0 ?
|
|
35419
|
+
center = _ref$center === void 0 ? DEFAULT_CENTER : _ref$center,
|
|
35399
35420
|
_ref$zoom = _ref.zoom,
|
|
35400
35421
|
zoom = _ref$zoom === void 0 ? 13 : _ref$zoom,
|
|
35401
35422
|
_ref$markers = _ref.markers,
|
|
35402
35423
|
markers = _ref$markers === void 0 ? [] : _ref$markers,
|
|
35403
|
-
_ref$
|
|
35404
|
-
|
|
35405
|
-
_ref$readOnly = _ref.readOnly,
|
|
35406
|
-
readOnly = _ref$readOnly === void 0 ? true : _ref$readOnly,
|
|
35407
|
-
_ref$showPOI = _ref.showPOI,
|
|
35408
|
-
showPOI = _ref$showPOI === void 0 ? false : _ref$showPOI,
|
|
35424
|
+
_ref$options = _ref.options,
|
|
35425
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
35409
35426
|
_ref$callbackOnSucces = _ref.callbackOnSuccessDirections,
|
|
35410
35427
|
callbackOnSuccessDirections = _ref$callbackOnSucces === void 0 ? function () {} : _ref$callbackOnSucces,
|
|
35411
35428
|
_ref$callbackOnErrorD = _ref.callbackOnErrorDirections,
|
|
35412
|
-
callbackOnErrorDirections = _ref$callbackOnErrorD === void 0 ? function () {} : _ref$callbackOnErrorD
|
|
35429
|
+
callbackOnErrorDirections = _ref$callbackOnErrorD === void 0 ? function () {} : _ref$callbackOnErrorD,
|
|
35430
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
35413
35431
|
|
|
35414
35432
|
var _useJsApiLoader = useJsApiLoader({
|
|
35415
35433
|
googleMapsApiKey: googleMapsApiKey,
|
|
@@ -35425,13 +35443,6 @@ var Map$1 = function Map(_ref) {
|
|
|
35425
35443
|
setControlsPositions = _useState2[1];
|
|
35426
35444
|
|
|
35427
35445
|
var validMarkersExist = Array.isArray(markers) && markers.length;
|
|
35428
|
-
var defaultMapCenter = {
|
|
35429
|
-
center: {
|
|
35430
|
-
lat: 0,
|
|
35431
|
-
lng: 0
|
|
35432
|
-
},
|
|
35433
|
-
zoom: zoom
|
|
35434
|
-
};
|
|
35435
35446
|
|
|
35436
35447
|
var handlePositions = function handlePositions(key, value) {
|
|
35437
35448
|
setControlsPositions(function (prev) {
|
|
@@ -35439,37 +35450,46 @@ var Map$1 = function Map(_ref) {
|
|
|
35439
35450
|
});
|
|
35440
35451
|
};
|
|
35441
35452
|
|
|
35442
|
-
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
|
+
|
|
35443
35460
|
var onLoad = useCallback(function (map) {
|
|
35444
35461
|
if (!map) return;
|
|
35445
35462
|
mapRef.current = map;
|
|
35446
|
-
|
|
35463
|
+
mapRef.current.setOptions({
|
|
35447
35464
|
gestureHandling: 'greedy'
|
|
35448
35465
|
});
|
|
35449
|
-
var fullScreenPos = showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
|
|
35466
|
+
var fullScreenPos = mapOptions.showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
|
|
35450
35467
|
handlePositions('fullScreen', window.google.maps.ControlPosition[fullScreenPos]);
|
|
35451
35468
|
handlePositions('zoom', window.google.maps.ControlPosition.RIGHT_BOTTOM);
|
|
35452
|
-
if (!(markers !== null && markers !== void 0 && markers.length))
|
|
35453
|
-
|
|
35469
|
+
if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(getCenterByGeolocationOrCenter(center || DEFAULT_CENTER));
|
|
35470
|
+
if (markers !== null && markers !== void 0 && markers.length) mapRef.current.fitBounds(getBoundsFromMarkers(markers));
|
|
35454
35471
|
mapRef.current.setZoom(zoom);
|
|
35455
|
-
}, []);
|
|
35456
|
-
|
|
35472
|
+
}, [center, markers, options, zoom]);
|
|
35473
|
+
if (!isLoaded) return null;
|
|
35474
|
+
return /*#__PURE__*/React__default.createElement(GoogleMap, _extends$1({
|
|
35457
35475
|
className: "google-map-component",
|
|
35458
35476
|
onLoad: onLoad,
|
|
35459
35477
|
mapContainerStyle: {
|
|
35460
35478
|
height: height,
|
|
35461
35479
|
width: width
|
|
35462
35480
|
},
|
|
35463
|
-
options: mapOptions
|
|
35464
|
-
|
|
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,
|
|
35465
35485
|
className: "google-map-component__search-box"
|
|
35466
35486
|
}), validMarkersExist && /*#__PURE__*/React__default.createElement(MarkersDrawer, {
|
|
35467
35487
|
markers: markers,
|
|
35468
|
-
readOnly: readOnly,
|
|
35488
|
+
readOnly: mapOptions.readOnly,
|
|
35469
35489
|
callbackOnSuccessDirections: callbackOnSuccessDirections,
|
|
35470
35490
|
callbackOnErrorDirections: callbackOnErrorDirections,
|
|
35471
35491
|
googleMapsApiKey: googleMapsApiKey
|
|
35472
|
-
}))
|
|
35492
|
+
}));
|
|
35473
35493
|
};
|
|
35474
35494
|
|
|
35475
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 };
|