@mapcomponents/react-maplibre 1.1.0 → 1.3.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/dist/index.cjs.js CHANGED
@@ -20,10 +20,12 @@ var Box = require('@mui/material/Box');
20
20
  var Grid = require('@mui/material/Grid');
21
21
  var PolylineIcon = require('@mui/icons-material/Polyline');
22
22
  var PentagonIcon = require('@mui/icons-material/Pentagon');
23
- var iconsMaterial = require('@mui/icons-material');
23
+ var DeleteIcon = require('@mui/icons-material/Delete');
24
+ var TuneIcon = require('@mui/icons-material/Tune');
24
25
  var system = require('@mui/system');
26
+ var ExpandLessIcon = require('@mui/icons-material/ExpandLess');
27
+ var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
25
28
  var reactColor = require('react-color');
26
- var TuneIcon = require('@mui/icons-material/Tune');
27
29
  var Dialog = require('@mui/material/Dialog');
28
30
  var DialogActions = require('@mui/material/DialogActions');
29
31
  var DialogContent = require('@mui/material/DialogContent');
@@ -34,16 +36,12 @@ var utilities = require('@dnd-kit/utilities');
34
36
  var CloseIcon = require('@mui/icons-material/Close');
35
37
  var useMediaQuery = require('@mui/material/useMediaQuery');
36
38
  var react = require('@emotion/react');
37
- var _ = require('@mui/material/');
38
- var DeleteIcon = require('@mui/icons-material/Delete');
39
39
  var ButtonGroup = require('@mui/material/ButtonGroup');
40
40
  var ControlPointIcon = require('@mui/icons-material/ControlPoint');
41
41
  var RemoveCircleOutlineIcon = require('@mui/icons-material/RemoveCircleOutline');
42
42
  var Divider = require('@mui/material/Divider');
43
43
  var syncMove = require('@mapbox/mapbox-gl-sync-move');
44
- var Paper = require('@mui/material/Paper');
45
44
  var xmldom = require('@xmldom/xmldom');
46
- var PropTypes = require('prop-types');
47
45
  var helpers = require('@turf/helpers');
48
46
  var WMSCapabilities = require('wms-capabilities');
49
47
  var InfoIcon = require('@mui/icons-material/Info');
@@ -64,6 +62,9 @@ var osm2geojson = require('osm2geojson-lite');
64
62
  var topojsonClient = require('topojson-client');
65
63
  var externParser = require('@tmcw/togeojson');
66
64
  var d3 = require('d3');
65
+ var ArrowCircleDownIcon = require('@mui/icons-material/ArrowCircleDown');
66
+ var ArrowCircleUpIcon = require('@mui/icons-material/ArrowCircleUp');
67
+ var CenterFocusWeakIcon = require('@mui/icons-material/CenterFocusWeak');
67
68
  var core = require('@dnd-kit/core');
68
69
  var modifiers = require('@dnd-kit/modifiers');
69
70
  var PlaylistAddIcon = require('@mui/icons-material/PlaylistAdd');
@@ -86,6 +87,7 @@ var DesignServicesIcon = require('@mui/icons-material/DesignServices');
86
87
  var PictureAsPdfIcon = require('@mui/icons-material/PictureAsPdf');
87
88
  var reactRedux = require('react-redux');
88
89
  var toolkit = require('@reduxjs/toolkit');
90
+ var KeyboardArrowRightIcon = require('@mui/icons-material/KeyboardArrowRight');
89
91
 
90
92
  function _interopNamespaceDefault(e) {
91
93
  var n = Object.create(null);
@@ -2090,7 +2092,8 @@ function featureEditorStyle() {
2090
2092
  },
2091
2093
  paint: {
2092
2094
  'line-color': '#009EE0',
2093
- 'line-width': 3,
2095
+ 'line-width': 10,
2096
+ 'line-opacity': 0.2,
2094
2097
  },
2095
2098
  },
2096
2099
  {
@@ -2102,7 +2105,7 @@ function featureEditorStyle() {
2102
2105
  'line-join': 'round',
2103
2106
  },
2104
2107
  paint: {
2105
- 'line-color': "#009EE0",
2108
+ 'line-color': '#009EE0',
2106
2109
  'line-dasharray': [0.2, 2],
2107
2110
  'line-width': 2,
2108
2111
  },
@@ -2115,7 +2118,7 @@ function featureEditorStyle() {
2115
2118
  'circle-radius': mediaIsMobile ? 5 : 4,
2116
2119
  'circle-color': '#ffffff',
2117
2120
  'circle-stroke-color': '#009EE0',
2118
- 'circle-stroke-width': 1
2121
+ 'circle-stroke-width': 1,
2119
2122
  },
2120
2123
  },
2121
2124
  {
@@ -2135,7 +2138,7 @@ function featureEditorStyle() {
2135
2138
  'circle-radius': mediaIsMobile ? 7 : 5,
2136
2139
  'circle-color': '#ffffff',
2137
2140
  'circle-stroke-color': '#009EE0',
2138
- 'circle-stroke-width': 1
2141
+ 'circle-stroke-width': 1,
2139
2142
  },
2140
2143
  },
2141
2144
  {
@@ -2652,15 +2655,21 @@ var getDefaultPaintPropsByType = function (type, defaultPaintOverrides) {
2652
2655
  return defaultPaintOverrides.fill;
2653
2656
  }
2654
2657
  return {
2655
- 'fill-color': 'rgba(10,240,256,0.6)',
2656
- 'fill-outline-color': 'rgba(20,230,256,0.8)',
2658
+ // 'fill-color': 'rgba(10,240,256,0.6)',
2659
+ // 'fill-outline-color': 'rgba(20,230,256,0.8)',
2660
+ 'fill-color': '#009EE0',
2661
+ 'fill-outline-color': '#009EE0',
2657
2662
  };
2658
2663
  case 'line':
2659
2664
  if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.line) {
2665
+ console.log(defaultPaintOverrides.line);
2660
2666
  return defaultPaintOverrides.line;
2661
2667
  }
2662
2668
  return {
2663
- 'line-color': 'rgb(203,211,2)',
2669
+ // // 'line-color': 'rgb(203,211,2)',
2670
+ // 'line-width': 5,
2671
+ // 'line-blur': 0,
2672
+ 'line-color': '#009EE0',
2664
2673
  'line-width': 5,
2665
2674
  'line-blur': 0,
2666
2675
  };
@@ -2669,10 +2678,14 @@ var getDefaultPaintPropsByType = function (type, defaultPaintOverrides) {
2669
2678
  return defaultPaintOverrides.circle;
2670
2679
  }
2671
2680
  return {
2672
- 'circle-color': 'rgba(10,240,256,0.8)',
2681
+ // 'circle-color': 'rgba(10,240,256,0.8)',
2682
+ // 'circle-stroke-color': '#fff',
2683
+ // 'circle-stroke-width': 2,
2684
+ // 'circle-radius': 4,
2685
+ 'circle-color': '#009EE0',
2673
2686
  'circle-stroke-color': '#fff',
2674
2687
  'circle-stroke-width': 2,
2675
- 'circle-radius': 4,
2688
+ 'circle-radius': 5,
2676
2689
  };
2677
2690
  default:
2678
2691
  return {};
@@ -2944,7 +2957,7 @@ var MlFollowGps = function (props) {
2944
2957
  isFollowed && userLocationGeoJson && (React.createElement(MlGeoJsonLayer, { geojson: accuracyGeoJson, type: 'fill', paint: __assign({ 'fill-color': '#cbd300', 'fill-opacity': 0.3 }, props.accuracyPaint), insertBeforeLayer: props.insertBeforeLayer })),
2945
2958
  isFollowed && orientationCone && (React.createElement(MlGeoJsonLayer, { geojson: orientationCone, type: 'fill', paint: __assign({ 'fill-color': '#0000ff', 'fill-antialias': false, 'fill-opacity': 0.3 }, props.orientationConePaint), insertBeforeLayer: props.insertBeforeLayer })),
2946
2959
  isFollowed && userLocationGeoJson && (React.createElement(MlGeoJsonLayer, { geojson: userLocationGeoJson, type: 'circle', paint: __assign({ 'circle-color': '#009ee0', 'circle-radius': 5, 'circle-stroke-color': '#fafaff', 'circle-stroke-width': 1 }, props.circlePaint), insertBeforeLayer: props.insertBeforeLayer })),
2947
- React.createElement(material.Button, { variant: "navtools", sx: {
2960
+ React.createElement(material.Button, { variant: "navtools", "data-testid": "mlFollowGpsBtn", sx: {
2948
2961
  zIndex: 1002,
2949
2962
  color: isFollowed
2950
2963
  ? function (theme) { return theme.palette.GPS.GPSActiveColor; }
@@ -3185,7 +3198,7 @@ function LayerListFolder(_a) {
3185
3198
  return (React.createElement(React.Fragment, null,
3186
3199
  React.createElement(ListItemStyled$2, null,
3187
3200
  React.createElement(ListItemIconStyled$1, null,
3188
- React.createElement(IconButtonStyled$2, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(iconsMaterial.ExpandMore, null) : React.createElement(iconsMaterial.KeyboardArrowRight, null)),
3201
+ React.createElement(IconButtonStyled$2, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(ExpandMoreIcon, null) : React.createElement(ExpandLessIcon, null)),
3189
3202
  React.createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
3190
3203
  if (setVisible) {
3191
3204
  setVisible(function (val) { return !val; });
@@ -3213,7 +3226,7 @@ var ColorPicker = function (_a) {
3213
3226
  var value = (props === null || props === void 0 ? void 0 : props.value) || '';
3214
3227
  return (React.createElement(React.Fragment, null,
3215
3228
  React.createElement(material.Grid, { container: true, sx: { flexWrap: 'nowrap' } },
3216
- React.createElement(material.Grid, { xs: 12, item: true },
3229
+ React.createElement(material.Grid, { size: 12 },
3217
3230
  React.createElement(material.Button, { variant: "outlined", onClick: function () { return setShowPicker(true); }, sx: {
3218
3231
  minWidth: '100%',
3219
3232
  padding: '5px',
@@ -3458,7 +3471,8 @@ function LayerListItem(_a) {
3458
3471
  var deletedRef = React.useRef(false);
3459
3472
  var visibleRef = React.useRef(visible);
3460
3473
  // this state variable is used for layer components that provide a paint attribute
3461
- var _u = React.useState(((_b = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _b === void 0 ? void 0 : _b.paint) || ((_d = (_c = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint) ||
3474
+ var _u = React.useState(((_b = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _b === void 0 ? void 0 : _b.paint) ||
3475
+ ((_d = (_c = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint) ||
3462
3476
  getDefaultPaintPropsByType(((_e = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _e === void 0 ? void 0 : _e.type) || getDefaulLayerTypeByGeometry(layerComponent.props.geojson))), paintProps = _u[0], setPaintProps = _u[1];
3463
3477
  var _visible = React.useMemo(function () {
3464
3478
  if (!visible) {
@@ -3514,7 +3528,7 @@ function LayerListItem(_a) {
3514
3528
  layout: {
3515
3529
  visibility: _visible ? 'visible' : 'none',
3516
3530
  },
3517
- options: __assign(__assign({}, (_a = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _a === void 0 ? void 0 : _a.options), (setLayerState ? {} : { paint: paintProps }))
3531
+ options: __assign(__assign({}, (_a = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _a === void 0 ? void 0 : _a.options), (setLayerState ? {} : { paint: paintProps })),
3518
3532
  });
3519
3533
  }
3520
3534
  }
@@ -3538,7 +3552,7 @@ function LayerListItem(_a) {
3538
3552
  return !current;
3539
3553
  });
3540
3554
  } },
3541
- React.createElement(iconsMaterial.Tune, null)))) : undefined },
3555
+ React.createElement(TuneIcon, null)))) : undefined },
3542
3556
  React.createElement(CheckboxListItemIcon, null,
3543
3557
  React.createElement(CheckboxStyled, { disabled: !visible, checked: localVisible, onClick: function () {
3544
3558
  setLocalVisible(function (val) { return !val; });
@@ -3546,7 +3560,7 @@ function LayerListItem(_a) {
3546
3560
  React.createElement(material.ListItemText, { variant: "layerlist", primary: name, secondary: description, primaryTypographyProps: { overflow: 'hidden' } })));
3547
3561
  return (React.createElement(React.Fragment, null,
3548
3562
  props.sortable && props.layerId && !((_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) && (React.createElement(SortableContainer, { layerId: props.layerId }, listContent)),
3549
- !props.sortable && !((_k = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _k === void 0 ? void 0 : _k.layers) && (listContent),
3563
+ !props.sortable && !((_k = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _k === void 0 ? void 0 : _k.layers) && listContent,
3550
3564
  _layerComponent,
3551
3565
  !((_l = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _l === void 0 ? void 0 : _l.layers) &&
3552
3566
  Object.keys(paintProps).length > 0 &&
@@ -3558,7 +3572,7 @@ function LayerListItem(_a) {
3558
3572
  setShowDeletionConfirmationDialog(true);
3559
3573
  }
3560
3574
  } },
3561
- React.createElement(iconsMaterial.Delete, null)),
3575
+ React.createElement(DeleteIcon, null)),
3562
3576
  showDeletionConfirmationDialog && (React.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
3563
3577
  if (typeof setLayerState === 'function') {
3564
3578
  deletedRef.current = true;
@@ -3609,7 +3623,7 @@ function Sidebar(_a) {
3609
3623
  lg: '350px',
3610
3624
  }, boxSizing: 'border-box' }, drawerPaperProps === null || drawerPaperProps === void 0 ? void 0 : drawerPaperProps.sx) }), sx: __assign({ flexGrow: 1, zIndex: 105, position: 'absolute', bottom: 0, display: 'flex', flexDirection: 'column', maxWidth: { lg: '30%', md: '40%', sm: '50%', xs: '78%' } }, (drawerOpen ? {} : { left: mediaIsMobile ? '-90vw' : '-20vw' })) }, props),
3611
3625
  React.createElement(DrawerHeader, __assign({}, drawerHeaderProps),
3612
- React.createElement(_.Typography, { variant: "h6" }, props.name),
3626
+ React.createElement(material.Typography, { variant: "h6" }, props.name),
3613
3627
  React.createElement(material.IconButton, { onClick: setOpen
3614
3628
  ? function () {
3615
3629
  setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
@@ -3628,7 +3642,7 @@ function Sidebar(_a) {
3628
3642
  overflow: 'visible',
3629
3643
  },
3630
3644
  } }),
3631
- React.createElement(_.SwipeableDrawer, { anchor: "bottom", open: typeof props.open === 'undefined' ? drawerOpen : props.open, onClose: setOpen
3645
+ React.createElement(material.SwipeableDrawer, { anchor: "bottom", open: typeof props.open === 'undefined' ? drawerOpen : props.open, onClose: setOpen
3632
3646
  ? function () {
3633
3647
  setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
3634
3648
  }
@@ -3656,7 +3670,7 @@ function Sidebar(_a) {
3656
3670
  left: 0,
3657
3671
  } },
3658
3672
  React.createElement(Puller, null),
3659
- React.createElement(_.Typography, { variant: "h6", sx: { p: '13px' } }, props.name)),
3673
+ React.createElement(material.Typography, { variant: "h6", sx: { p: '13px' } }, props.name)),
3660
3674
  React.createElement(material.Paper, { sx: {
3661
3675
  px: '15px',
3662
3676
  pb: '15px',
@@ -3703,14 +3717,16 @@ var MlMultiMeasureTool = function (props) {
3703
3717
  });
3704
3718
  };
3705
3719
  React.useEffect(function () {
3706
- reload && setReload(false);
3707
- reload &&
3720
+ if (reload) {
3721
+ setReload(false);
3722
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
3708
3723
  measureState &&
3709
- setMeasureList(function (current) {
3710
- var newList = __spreadArray([], current, true);
3711
- newList.push(measureState);
3712
- return newList;
3713
- });
3724
+ setMeasureList(function (current) {
3725
+ var newList = __spreadArray([], current, true);
3726
+ newList.push(measureState);
3727
+ return newList;
3728
+ });
3729
+ }
3714
3730
  }, [reload]);
3715
3731
  React.useEffect(function () {
3716
3732
  setMeasureState(undefined);
@@ -3720,7 +3736,7 @@ var MlMultiMeasureTool = function (props) {
3720
3736
  React.createElement(Box, { sx: { flexGrow: 1 } },
3721
3737
  React.createElement("br", null),
3722
3738
  React.createElement(Grid, { container: true, spacing: 4, justifyContent: "flex-start" },
3723
- React.createElement(Grid, { item: true, xs: 3 },
3739
+ React.createElement(Grid, { size: 3 },
3724
3740
  React.createElement(material.Tooltip, { title: "Measure Area" },
3725
3741
  React.createElement(material.Button, { variant: "outlined", sx: {
3726
3742
  backgroundColor: selectedMode === 'polygon'
@@ -3735,7 +3751,7 @@ var MlMultiMeasureTool = function (props) {
3735
3751
  setReload(true);
3736
3752
  } },
3737
3753
  React.createElement(PentagonIcon, null)))),
3738
- React.createElement(Grid, { item: true, xs: 3 },
3754
+ React.createElement(Grid, { size: 3 },
3739
3755
  React.createElement(material.Tooltip, { title: "Measure Distance" },
3740
3756
  React.createElement(material.Button, { variant: "outlined", sx: {
3741
3757
  backgroundColor: selectedMode === 'line'
@@ -3751,7 +3767,7 @@ var MlMultiMeasureTool = function (props) {
3751
3767
  } },
3752
3768
  React.createElement(PolylineIcon, null)))))),
3753
3769
  React.createElement("br", null),
3754
- React.createElement(Grid, { item: true, xs: 4 },
3770
+ React.createElement(Grid, { size: 4 },
3755
3771
  React.createElement(material.FormControl, null,
3756
3772
  React.createElement(material.InputLabel, { id: "unit-select-label" }, "Unit"),
3757
3773
  React.createElement(material.Select, { labelId: "unit-select-label", id: "unit-select", value: selectedUnit, label: "Unit", onChange: function (e) {
@@ -3823,56 +3839,24 @@ MlMultiMeasureTool.defaultProps = {
3823
3839
  buttonStyleOverride: {},
3824
3840
  };
3825
3841
 
3826
- var _g;
3827
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
3828
- var SvgCompassNeedle = function SvgCompassNeedle(props) {
3829
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
3830
- width: 10,
3831
- height: 40,
3832
- viewBox: "0 0 10 40",
3833
- fill: "none",
3834
- id: "svg6"
3835
- }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
3836
- id: "g14",
3837
- transform: "translate(0.67544,-1.25e-5)"
3838
- }, /*#__PURE__*/React__namespace.createElement("path", {
3839
- d: "m 3.34715,4.52028 c 0.22737,-1.05154 1.72745,-1.05154 1.95482,0 L 8.64912,20 H 0 Z",
3840
- fill: "#cf003d"
3841
- }), /*#__PURE__*/React__namespace.createElement("path", {
3842
- d: "m 3.34715,35.4797 c 0.22737,1.0516 1.72745,1.0516 1.95482,0 L 8.64912,20 H 0 Z",
3843
- fill: "#d3dcf0"
3844
- }))));
3842
+ var CompassBackground = function (_a) {
3843
+ var _b = _a.className, className = _b === void 0 ? '' : _b, title = _a.title, onClick = _a.onClick, style = _a.style;
3844
+ return (React.createElement("svg", { width: "52", height: "53", viewBox: "0 0 52 53", fill: "none", className: className, onClick: onClick, role: title ? 'img' : 'presentation', "aria-hidden": !title, style: style },
3845
+ title && React.createElement("title", null, title),
3846
+ React.createElement("circle", { cx: "26.0001", cy: "26.1843", r: "24", fill: "white", stroke: "#009EE0", strokeWidth: "2" }),
3847
+ React.createElement("path", { d: "M26.4915 7.59161C26.3524 8.07338 25.6698 8.07338 25.5307 7.59161L24.2998 3.3276C24.2075 3.0079 24.4474 2.68893 24.7802 2.68893H27.242C27.5748 2.68893 27.8147 3.0079 27.7224 3.3276L26.4915 7.59161Z", fill: "#009EE0" }),
3848
+ React.createElement("path", { d: "M25.5085 44.7598C25.6476 44.278 26.3302 44.278 26.4693 44.7598L27.7002 49.0238C27.7925 49.3435 27.5526 49.6625 27.2198 49.6625H24.758C24.4252 49.6625 24.1853 49.3435 24.2776 49.0238L25.5085 44.7598Z", fill: "#009EE0" }),
3849
+ React.createElement("path", { d: "M44.6641 26.4915C44.1823 26.3524 44.1823 25.6698 44.6641 25.5307L48.9281 24.2998C49.2478 24.2075 49.5668 24.4474 49.5668 24.7802V27.242C49.5668 27.5747 49.2478 27.8147 48.9281 27.7224L44.6641 26.4915Z", fill: "#009EE0" }),
3850
+ React.createElement("path", { d: "M7.3959 25.6085C7.87766 25.7476 7.87766 26.4302 7.3959 26.5693L3.13189 27.8002C2.81218 27.8925 2.49321 27.6526 2.49321 27.3198L2.49321 24.858C2.49321 24.5253 2.81218 24.2853 3.13189 24.3776L7.3959 25.6085Z", fill: "#009EE0" })));
3845
3851
  };
3846
3852
 
3847
- var _circle, _path$1, _path2$1, _path3, _path4;
3848
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
3849
- var SvgCompassBackground = function SvgCompassBackground(props) {
3850
- return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
3851
- width: 52,
3852
- height: 53,
3853
- viewBox: "0 0 52 53",
3854
- fill: "none",
3855
- xmlns: "http://www.w3.org/2000/svg"
3856
- }, props), _circle || (_circle = /*#__PURE__*/React__namespace.createElement("circle", {
3857
- cx: 26.0001,
3858
- cy: 26.1843,
3859
- r: 24,
3860
- fill: "white",
3861
- stroke: "#009EE0",
3862
- strokeWidth: 2
3863
- })), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
3864
- d: "M26.4915 7.59161C26.3524 8.07338 25.6698 8.07338 25.5307 7.59161L24.2998 3.3276C24.2075 3.0079 24.4474 2.68893 24.7802 2.68893H27.242C27.5748 2.68893 27.8147 3.0079 27.7224 3.3276L26.4915 7.59161Z",
3865
- fill: "#009EE0"
3866
- })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
3867
- d: "M25.5085 44.7598C25.6476 44.278 26.3302 44.278 26.4693 44.7598L27.7002 49.0238C27.7925 49.3435 27.5526 49.6625 27.2198 49.6625H24.758C24.4252 49.6625 24.1853 49.3435 24.2776 49.0238L25.5085 44.7598Z",
3868
- fill: "#009EE0"
3869
- })), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
3870
- d: "M44.6641 26.4915C44.1823 26.3524 44.1823 25.6698 44.6641 25.5307L48.9281 24.2998C49.2478 24.2075 49.5668 24.4474 49.5668 24.7802V27.242C49.5668 27.5747 49.2478 27.8147 48.9281 27.7224L44.6641 26.4915Z",
3871
- fill: "#009EE0"
3872
- })), _path4 || (_path4 = /*#__PURE__*/React__namespace.createElement("path", {
3873
- d: "M7.3959 25.6085C7.87766 25.7476 7.87766 26.4302 7.3959 26.5693L3.13189 27.8002C2.81218 27.8925 2.49321 27.6526 2.49321 27.3198L2.49321 24.858C2.49321 24.5253 2.81218 24.2853 3.13189 24.3776L7.3959 25.6085Z",
3874
- fill: "#009EE0"
3875
- })));
3853
+ var CompassNeedle = function (_a) {
3854
+ var _b = _a.className, className = _b === void 0 ? '' : _b, title = _a.title, onClick = _a.onClick, style = _a.style;
3855
+ return (React.createElement("svg", { width: "10", height: "40", viewBox: "0 0 10 40", fill: "none", className: className, onClick: onClick, role: title ? 'img' : 'presentation', "aria-hidden": !title, style: style },
3856
+ title && React.createElement("title", null, title),
3857
+ React.createElement("g", { transform: "translate(0.67544,-1.25e-5)" },
3858
+ React.createElement("path", { d: "m 3.34715,4.52028 c 0.22737,-1.05154 1.72745,-1.05154 1.95482,0 L 8.64912,20 H 0 Z", fill: "#cf003d" }),
3859
+ React.createElement("path", { d: "m 3.34715,35.4797 c 0.22737,1.0516 1.72745,1.0516 1.95482,0 L 8.64912,20 H 0 Z", fill: "#d3dcf0" }))));
3876
3860
  };
3877
3861
 
3878
3862
  var BoxStyled$2 = material.styled(material.Box)(function (_a) {
@@ -3978,9 +3962,9 @@ var MlNavigationCompass = function (props) {
3978
3962
  return (React.createElement(React.Fragment, null,
3979
3963
  React.createElement(BoxStyled$2, { sx: __assign({}, props.style) },
3980
3964
  React.createElement(CompassBox, { onClick: rotate, sx: __assign({}, props.backgroundStyle) },
3981
- React.createElement(SvgCompassBackground, { style: { position: 'absolute', top: 0, left: 0 } }),
3965
+ React.createElement(CompassBackground, { style: { position: 'absolute', top: 0, left: 0 } }),
3982
3966
  React.createElement(NeedleBox, { onClick: rotate, sx: __assign({}, props.needleStyle) },
3983
- React.createElement(SvgCompassNeedle, { style: {
3967
+ React.createElement(CompassNeedle, { style: {
3984
3968
  transform: 'rotate(' + (bearing > 0 ? '-' + bearing : -1 * bearing) + 'deg)',
3985
3969
  } }))))));
3986
3970
  };
@@ -4294,20 +4278,11 @@ MlLayerMagnify.defaultProps = {
4294
4278
  magnifierStyle: {},
4295
4279
  };
4296
4280
 
4297
- var _path, _path2;
4298
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4299
- var SvgIcononlyarrow = function SvgIcononlyarrow(props) {
4300
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
4301
- viewBox: "0 0 47 30",
4302
- fill: "none",
4303
- xmlns: "http://www.w3.org/2000/svg"
4304
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
4305
- d: "M29.5 21.25L35.75 15L29.5 8.75V21.25Z",
4306
- fill: "#009EE0"
4307
- })), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
4308
- d: "M17.5 8.75L11.25 15L17.5 21.25V8.75Z",
4309
- fill: "#009EE0"
4310
- })));
4281
+ var SwipeIcon = function (_a) {
4282
+ var _b = _a.className, className = _b === void 0 ? '' : _b, title = _a.title, onClick = _a.onClick, style = _a.style, color = _a.color;
4283
+ return (React.createElement("svg", { viewBox: "0 0 47 30", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, onClick: onClick, role: title ? 'img' : 'presentation', "aria-hidden": !title, style: style, color: color },
4284
+ React.createElement("path", { d: "M29.5 21.25L35.75 15L29.5 8.75V21.25Z", fill: "#009EE0" }),
4285
+ React.createElement("path", { d: "M17.5 8.75L11.25 15L17.5 21.25V8.75Z", fill: "#009EE0" })));
4311
4286
  };
4312
4287
 
4313
4288
  /**
@@ -4401,7 +4376,7 @@ var MlLayerSwipe = function (props) {
4401
4376
  };
4402
4377
  }, [mapContext]);
4403
4378
  return (React.createElement("div", { style: __assign({ position: 'absolute', left: swipeX + '%', top: '50%', borderRadius: '50%', width: '65px', height: '65px', background: 'rgba(234, 235, 241, 0.75)', border: '2px solid rgba(0, 158, 224, 0.75)', cursor: 'pointer', zIndex: '110', marginLeft: '-35px', marginTop: '-50px', textAlign: 'center', lineHeight: '91px', fontSize: '2em', color: '#fafafa', userSelect: 'none' }, props.buttonStyle), onTouchStart: onDown, onMouseDown: onDown },
4404
- React.createElement(SvgIcononlyarrow, { color: "#0066ff", style: {
4379
+ React.createElement(SwipeIcon, { color: "#0066ff", style: {
4405
4380
  width: '65px',
4406
4381
  height: '65px',
4407
4382
  justifyContent: 'center',
@@ -4639,76 +4614,130 @@ var MlTransitionGeoJsonLayer = function (props) {
4639
4614
  React.createElement(MlGeoJsonLayer, __assign({}, restProps, { geojson: displayGeojson }))));
4640
4615
  };
4641
4616
 
4642
- /**
4643
- * Adds a marker to the map and displays the contents of the "content" property in an iframe next to it
4644
- */
4645
- var MlMarker = function (props) {
4617
+ var getBoxTransform = function (anchor) {
4618
+ if (anchor === void 0) { anchor = 'top'; }
4619
+ switch (anchor) {
4620
+ case 'bottom':
4621
+ return 'translate(-50%, 0%)';
4622
+ case 'left':
4623
+ return 'translate(-100%, -50%)';
4624
+ case 'right':
4625
+ return 'translate(0%, -50%)';
4626
+ case 'top-left':
4627
+ return 'translate(-100%, -100%)';
4628
+ case 'top-right':
4629
+ return 'translate(0%, -100%)';
4630
+ case 'bottom-left':
4631
+ return 'translate(-100%, 0%)';
4632
+ case 'bottom-right':
4633
+ return 'translate(0%, 0%)';
4634
+ default:
4635
+ case 'top':
4636
+ return 'translate(-50%, -100%)';
4637
+ }
4638
+ };
4639
+ function getBoxMargins(anchor, offset, style) {
4640
+ var w = parseInt(String((style === null || style === void 0 ? void 0 : style.width) || 14), 10);
4641
+ var h = parseInt(String((style === null || style === void 0 ? void 0 : style.height) || 14), 10);
4642
+ var m = {};
4643
+ switch (anchor) {
4644
+ case 'bottom':
4645
+ m.marginTop = "".concat(offset, "px");
4646
+ break;
4647
+ case 'left':
4648
+ m.marginLeft = "-".concat(offset, "px");
4649
+ break;
4650
+ case 'right':
4651
+ m.marginLeft = "".concat(w + offset, "px");
4652
+ break;
4653
+ case 'top-left':
4654
+ m.marginTop = "-".concat(h + offset, "px");
4655
+ m.marginLeft = "-".concat(offset, "px");
4656
+ break;
4657
+ case 'top-right':
4658
+ m.marginTop = "-".concat(h + offset, "px");
4659
+ m.marginLeft = "".concat(w + offset, "px");
4660
+ break;
4661
+ case 'bottom-left':
4662
+ m.marginTop = "".concat(offset, "px");
4663
+ m.marginLeft = "-".concat(offset, "px");
4664
+ break;
4665
+ case 'bottom-right':
4666
+ m.marginTop = "".concat(offset, "px");
4667
+ m.marginLeft = "".concat(w + offset, "px");
4668
+ break;
4669
+ case 'top':
4670
+ default:
4671
+ m.marginTop = "-".concat(h + offset, "px");
4672
+ break;
4673
+ }
4674
+ return m;
4675
+ }
4676
+ var MlMarker = function (_a) {
4677
+ var _b = _a.passEventsThrough, passEventsThrough = _b === void 0 ? true : _b, _c = _a.contentOffset, contentOffset = _c === void 0 ? 5 : _c, props = __rest(_a, ["passEventsThrough", "contentOffset"]);
4646
4678
  var mapHook = useMap({
4647
4679
  mapId: props.mapId,
4648
4680
  waitForLayer: props.insertBeforeLayer,
4649
4681
  });
4650
- var mapState = useMapState({
4651
- mapId: props.mapId,
4652
- watch: { viewport: true },
4653
- });
4654
- var iframe = React.useRef(null);
4655
- var _a = React.useState({
4656
- width: "400px",
4657
- height: "500px",
4658
- }), iframeDimensions = _a[0], setIframeDimensions = _a[1];
4659
- var _b = React.useState(), markerPixelPos = _b[0], setMarkerPixelPos = _b[1];
4660
- React.useEffect(function () {
4661
- var _a, _b;
4662
- if (!((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.project))
4663
- return;
4664
- var _pixelPos = mapHook.map.map.project([props.lng, props.lat]);
4665
- setMarkerPixelPos(_pixelPos);
4666
- }, [mapHook.map, props.lng, props.lat, mapState.viewport]);
4682
+ var _d = React.useState(null), marker = _d[0], setMarker = _d[1];
4683
+ var container = React.useRef(null);
4684
+ var iframeRef = React.useRef(null);
4667
4685
  React.useEffect(function () {
4668
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4669
- if (!mapHook.map ||
4670
- !((_d = (_c = (_b = (_a = iframe.current) === null || _a === void 0 ? void 0 : _a.contentWindow) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.scrollHeight))
4686
+ if (!mapHook.map)
4671
4687
  return;
4672
- var mapHeight = mapHook.map.map._container.clientHeight;
4673
- var _pixelPos = mapHook.map.map.project([props.lng, props.lat]);
4674
- var pixelToBottom = mapHeight - _pixelPos.y;
4675
- var iframeHeight = (_h = (_g = (_f = (_e = iframe.current) === null || _e === void 0 ? void 0 : _e.contentWindow) === null || _f === void 0 ? void 0 : _f.document) === null || _g === void 0 ? void 0 : _g.body) === null || _h === void 0 ? void 0 : _h.scrollHeight;
4676
- var iframeWidth = (_m = (_l = (_k = (_j = iframe.current) === null || _j === void 0 ? void 0 : _j.contentWindow) === null || _k === void 0 ? void 0 : _k.document) === null || _l === void 0 ? void 0 : _l.body) === null || _m === void 0 ? void 0 : _m.scrollWidth;
4677
- setIframeDimensions({
4678
- width: iframeWidth + "px",
4679
- height: (pixelToBottom < iframeHeight ? pixelToBottom : iframeHeight) + "px",
4688
+ container.current = document.createElement('div');
4689
+ var defaultMarkerStyle = {
4690
+ width: '12px',
4691
+ height: '12px',
4692
+ background: 'linear-gradient(135deg, rgb(186, 208, 218) 0%, rgb(96, 209, 253) 100%)',
4693
+ border: '1px solid rgba(255, 255, 255, 0.7)',
4694
+ boxShadow: '0 2px 6px rgba(90, 0, 0, 0.2), 0 0 0 2px rgba(240, 147, 251, 0.2)',
4695
+ borderRadius: '50%',
4696
+ };
4697
+ var markerStyle = __assign(__assign({}, defaultMarkerStyle), props.markerStyle);
4698
+ var maplibreMarker = new maplibregl.Marker({
4699
+ element: container.current,
4700
+ anchor: 'center',
4701
+ })
4702
+ .setLngLat([props.lng, props.lat])
4703
+ .addTo(mapHook.map.map);
4704
+ setMarker(maplibreMarker);
4705
+ var markerDot = document.createElement('div');
4706
+ Object.entries(markerStyle).forEach(function (_a) {
4707
+ var key = _a[0], value = _a[1];
4708
+ markerDot.style.setProperty(key.replace(/([A-Z])/g, '-$1').toLowerCase(), String(value));
4680
4709
  });
4681
- }, [props.lng, props.lat, props.content]);
4682
- return (React.createElement(React.Fragment, null,
4683
- React.createElement(MlGeoJsonLayer, { geojson: {
4684
- type: "Feature",
4685
- geometry: {
4686
- type: "Point",
4687
- coordinates: [props.lng, props.lat],
4688
- },
4689
- properties: {},
4690
- }, paint: {
4691
- "circle-radius": 14,
4692
- "circle-color": "rgba(40,200,20,0.5)",
4693
- }, type: "circle", mapId: props.mapId }),
4694
- markerPixelPos && (React.createElement(Paper, { sx: {
4695
- opacity: 0.7,
4696
- position: "fixed",
4697
- display: "flex",
4698
- /** TODO: fix positioning delay when moving the map */
4699
- left: markerPixelPos.x,
4700
- top: markerPixelPos.y,
4701
- width: iframeDimensions.width,
4702
- height: iframeDimensions.height,
4703
- "&:hover": {
4710
+ container.current.appendChild(markerDot);
4711
+ return function () {
4712
+ var _a;
4713
+ markerDot.remove();
4714
+ maplibreMarker.remove();
4715
+ (_a = container.current) === null || _a === void 0 ? void 0 : _a.remove();
4716
+ };
4717
+ }, [mapHook.map, props.lng, props.lat, props.markerStyle, props.anchor]);
4718
+ React.useEffect(function () {
4719
+ if (marker) {
4720
+ marker.setLngLat([props.lng, props.lat]);
4721
+ }
4722
+ }, [marker, props.lng, props.lat]);
4723
+ function handleIframeLoad() {
4724
+ var _a, _b, _c;
4725
+ var iframeDoc = (_b = (_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow) === null || _b === void 0 ? void 0 : _b.document;
4726
+ if (iframeDoc && ((_c = iframeRef.current) === null || _c === void 0 ? void 0 : _c.parentElement)) {
4727
+ var scrollHeight = iframeDoc.documentElement.scrollHeight;
4728
+ iframeRef.current.parentElement.style.height = "".concat(scrollHeight, "px");
4729
+ }
4730
+ }
4731
+ return (container.current &&
4732
+ ReactDOM.createPortal(React.createElement(material.Box, { sx: __assign(__assign(__assign({ position: 'absolute', display: 'flex', width: '300px', maxHeight: '500px', opacity: passEventsThrough ? 1 : 0.7, zIndex: -1, transform: getBoxTransform(props.anchor) }, getBoxMargins(props.anchor, contentOffset, props.markerStyle)), { pointerEvents: passEventsThrough ? 'none' : 'auto', '&:hover': {
4704
4733
  opacity: 1,
4705
- },
4706
- zIndex: -1,
4707
- } },
4708
- React.createElement("iframe", { style: { width: "100%" }, srcDoc: props.content, ref: iframe, sandbox: "allow-same-origin allow-popups-to-escape-sandbox", frameBorder: "0", title: mapHook.componentId })))));
4709
- };
4710
- MlMarker.defaultProps = {
4711
- mapId: undefined,
4734
+ } }), props.containerStyle) },
4735
+ React.createElement("iframe", { ref: iframeRef, onLoad: handleIframeLoad, style: __assign({ width: '100%', borderStyle: 'none' }, props.iframeStyle), srcDoc: "<div>\n\t<style>\n\t\tbody {\n\t\t\t".concat(Object.entries(props.iframeBodyStyle || {})
4736
+ .map(function (_a) {
4737
+ var key = _a[0], val = _a[1];
4738
+ return "".concat(key.replace(/([A-Z])/g, '-$1').toLowerCase(), ": ").concat(val, ";");
4739
+ })
4740
+ .join(' '), "\n\t\t}\n\t</style>\n\t").concat(props.content || '', "\n</div>"), sandbox: "allow-same-origin allow-popups-to-escape-sandbox allow-scripts", title: mapHook.componentId })), container.current));
4712
4741
  };
4713
4742
 
4714
4743
  /**
@@ -5588,12 +5617,6 @@ var MlShareMapState = function (props) {
5588
5617
  MlShareMapState.defaultProps = {
5589
5618
  mapId: undefined,
5590
5619
  };
5591
- MlShareMapState.propTypes = {
5592
- /**
5593
- * Id of the target MapLibre instance in mapContext
5594
- */
5595
- mapId: PropTypes.string,
5596
- };
5597
5620
 
5598
5621
  function getElevationData(_geojsonInfo, elevationFactor) {
5599
5622
  var createStep = function (x, y, z, x2, y2) {
@@ -5939,12 +5962,6 @@ var MlWmsFeatureInfoPopup = function (props) {
5939
5962
  MlWmsFeatureInfoPopup.defaultProps = {
5940
5963
  mapId: undefined,
5941
5964
  };
5942
- MlWmsFeatureInfoPopup.propTypes = {
5943
- /**
5944
- * Id of the target MapLibre instance in mapContext
5945
- */
5946
- mapId: PropTypes.string,
5947
- };
5948
5965
 
5949
5966
  var defaultProps = {
5950
5967
  visible: true,
@@ -6056,51 +6073,6 @@ var MlWmsLayer = function (props) {
6056
6073
  return React.createElement(React.Fragment, null);
6057
6074
  };
6058
6075
  MlWmsLayer.defaultProps = __assign({}, defaultProps);
6059
- MlWmsLayer.propTypes = {
6060
- /**
6061
- * WMS URL
6062
- */
6063
- url: PropTypes.string.isRequired,
6064
- /**
6065
- * URL query parameters that will be added to the WMS URL. A layers property (string) is mandatory. Any value defined on this attribute will extend the default object.
6066
- */
6067
- urlParameters: PropTypes.shape({
6068
- layers: PropTypes.string.isRequired,
6069
- bbox: PropTypes.string,
6070
- format: PropTypes.string,
6071
- service: PropTypes.string,
6072
- version: PropTypes.string,
6073
- request: PropTypes.string,
6074
- srs: PropTypes.string,
6075
- width: PropTypes.number,
6076
- height: PropTypes.number,
6077
- }),
6078
- /**
6079
- * Id of the target MapLibre instance in mapContext
6080
- */
6081
- mapId: PropTypes.string,
6082
- /**
6083
- * MapLibre attribution shown in the bottom right of the map, if this layer is visible
6084
- */
6085
- attribution: PropTypes.string,
6086
- /**
6087
- * Object that is passed to the MapLibre.addLayer call as config option parameter
6088
- */
6089
- layerOptions: PropTypes.object,
6090
- /**
6091
- * Object that is passed to the MapLibre.addSource call as config option parameter
6092
- */
6093
- sourceOptions: PropTypes.object,
6094
- /**
6095
- * Id of an existing layer in the mapLibre instance to help specify the layer order
6096
- * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
6097
- */
6098
- insertBeforeLayer: PropTypes.string,
6099
- /**
6100
- * Sets layer "visibility" property to "visible" if true or "none" if false
6101
- */
6102
- visible: PropTypes.bool,
6103
- };
6104
6076
 
6105
6077
  function useWms(props) {
6106
6078
  // Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
@@ -6412,7 +6384,7 @@ var MlWmsLoader = function (props) {
6412
6384
  }
6413
6385
  }, disabled: !(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })) },
6414
6386
  React.createElement(InfoIcon, null))),
6415
- React.createElement(IconButton, { edge: props.showDeleteButton ? false : 'end', sx: __assign({ padding: '4px', marginTop: '-3px' }, (props.showDeleteButton ? { marginRight: '4px' } : {})), "aria-label": "open", onClick: function () { return setOpen(function (current) { return !current; }); } }, open ? React.createElement(iconsMaterial.ExpandLess, null) : React.createElement(iconsMaterial.ExpandMore, null)),
6387
+ React.createElement(IconButton, { edge: props.showDeleteButton ? false : 'end', sx: __assign({ padding: '4px', marginTop: '-3px' }, (props.showDeleteButton ? { marginRight: '4px' } : {})), "aria-label": "open", onClick: function () { return setOpen(function (current) { return !current; }); } }, open ? React.createElement(ExpandLessIcon, null) : React.createElement(ExpandMoreIcon, null)),
6416
6388
  props.showDeleteButton && (React.createElement(React.Fragment, null,
6417
6389
  React.createElement(IconButton, { "aria-label": "delete", edge: "end", onClick: function () {
6418
6390
  if (typeof props.onConfigChange === 'function') {
@@ -6776,9 +6748,8 @@ function TemporalControllerPlayer(props) {
6776
6748
  flexShrink: 0,
6777
6749
  '& .MuiDrawer-paper': mediaIsMobile ? mobileScreenBoxStyle : bigScreenBoxStyle,
6778
6750
  } },
6779
- React.createElement(material.Grid, { container: true },
6780
- mediaIsMobile ? React.createElement(React.Fragment, null) : React.createElement(material.Grid, { item: true, xs: 3 }),
6781
- React.createElement(material.Grid, { item: true, xs: mediaIsMobile ? 12 : 6, textAlign: "center" },
6751
+ React.createElement(material.Grid, { container: true, alignItems: "center", justifyContent: "space-between" },
6752
+ React.createElement(material.Grid, { item: true, xs: 12, sm: 10, textAlign: "center" },
6782
6753
  React.createElement(material.Button, { onClick: handleFastRewind },
6783
6754
  React.createElement(FastRewindIcon, null)),
6784
6755
  React.createElement(material.Button, { onClick: handleStop },
@@ -6786,8 +6757,11 @@ function TemporalControllerPlayer(props) {
6786
6757
  React.createElement(material.Button, { onClick: handlePlayPause }, isPlaying ? React.createElement(PauseIcon, null) : React.createElement(PlayArrowIcon, null)),
6787
6758
  React.createElement(material.Button, { onClick: handleFastForward },
6788
6759
  React.createElement(FastForwardIcon, null))),
6789
- props.display && !mediaIsMobile && (React.createElement(material.Grid, { item: true, xs: 3 },
6790
- React.createElement(material.Typography, { variant: 'h5', textAlign: 'right', sx: { paddingRight: '25px' } }, Math.floor(currentVal))))),
6760
+ props.display && !mediaIsMobile && (
6761
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6762
+ // @ts-expect-error
6763
+ React.createElement(material.Grid, { item: true, xs: 12, sm: 5, textAlign: "right" },
6764
+ React.createElement(material.Typography, { variant: 'h5', sx: { paddingRight: '25px' } }, Math.floor(currentVal))))),
6791
6765
  React.createElement(material.Slider, { sx: {
6792
6766
  position: 'flex',
6793
6767
  width: '95%',
@@ -7042,37 +7016,53 @@ var sketchTools = [
7042
7016
  *
7043
7017
  */
7044
7018
  var MlSketchTool = function (props) {
7045
- var _a, _b;
7046
7019
  var mapHook = useMap({
7047
7020
  mapId: props.mapId,
7048
7021
  waitForLayer: props.insertBeforeLayer,
7049
7022
  });
7050
- var _c = React.useState(), hoveredGeometry = _c[0], setHoveredGeometry = _c[1];
7051
- var _d = React.useState({
7023
+ var _a = React.useState(), hoveredGeometry = _a[0], setHoveredGeometry = _a[1];
7024
+ var _b = React.useState({
7052
7025
  activeGeometryIndex: undefined,
7053
7026
  selectedGeoJson: undefined,
7054
7027
  geometries: [],
7055
7028
  drawMode: undefined,
7056
- }), sketchState = _d[0], setSketchState = _d[1];
7029
+ }), sketchState = _b[0], setSketchState = _b[1];
7030
+ console.log(sketchState);
7057
7031
  React.useEffect(function () {
7058
7032
  if (!(typeof props.onChange === 'function'))
7059
7033
  return;
7060
7034
  props.onChange(sketchState);
7061
7035
  }, [sketchState, props.onChange]);
7062
7036
  var buttonStyle = __assign({}, props.buttonStyleOverride);
7037
+ // const buttonClickHandler = (buttonDrawMode: keyof MapboxDraw.Modes) => {
7038
+ // setSketchState((_state) => ({
7039
+ // drawMode: _state.drawMode !== buttonDrawMode ? buttonDrawMode : undefined,
7040
+ // geometries: _state.geometries,
7041
+ // activeGeometryIndex: undefined,
7042
+ // selectedGeoJson: undefined,
7043
+ // }));
7044
+ // };
7063
7045
  var buttonClickHandler = function (buttonDrawMode) {
7064
- setSketchState(function (_state) { return ({
7065
- drawMode: _state.drawMode !== buttonDrawMode ? buttonDrawMode : undefined,
7066
- geometries: _state.geometries,
7067
- activeGeometryIndex: undefined,
7068
- selectedGeoJson: undefined,
7069
- }); });
7046
+ var modeRef = undefined;
7047
+ setSketchState(function (prevState) {
7048
+ modeRef = prevState.drawMode;
7049
+ return __assign(__assign({}, prevState), { drawMode: undefined, activeGeometryIndex: undefined, selectedGeoJson: undefined });
7050
+ });
7051
+ requestAnimationFrame(function () {
7052
+ setSketchState(function (prevState) {
7053
+ if ((modeRef === 'draw_polygon' || modeRef === 'draw_line_string') &&
7054
+ buttonDrawMode === 'draw_point') {
7055
+ return __assign(__assign({}, prevState), { drawMode: undefined });
7056
+ }
7057
+ return __assign(__assign({}, prevState), { drawMode: buttonDrawMode });
7058
+ });
7059
+ });
7070
7060
  };
7071
7061
  var removeGeoJson = function (geoJson) {
7072
7062
  setSketchState(function (_sketchState) {
7073
7063
  var _geometries = __spreadArray([], _sketchState.geometries, true);
7074
7064
  _geometries.splice(_geometries.indexOf(geoJson), 1);
7075
- return __assign(__assign({}, _sketchState), { geometries: _geometries, activeGeometryIndex: _sketchState.activeGeometryIndex
7065
+ return __assign(__assign({}, _sketchState), { drawMode: undefined, geometries: _geometries, activeGeometryIndex: _sketchState.activeGeometryIndex
7076
7066
  ? _sketchState.activeGeometryIndex - 1
7077
7067
  : undefined });
7078
7068
  });
@@ -7109,6 +7099,7 @@ var MlSketchTool = function (props) {
7109
7099
  React.createElement(ButtonGroup, null,
7110
7100
  React.createElement(SketchToolButtons, null))),
7111
7101
  sketchState.drawMode && (React.createElement(MlFeatureEditor, { mode: sketchState.drawMode, geojson: sketchState.selectedGeoJson, onChange: function (feature) {
7102
+ console.log(feature);
7112
7103
  if (!(feature === null || feature === void 0 ? void 0 : feature[0]))
7113
7104
  return;
7114
7105
  setSketchState(function (_sketchState) {
@@ -7127,6 +7118,24 @@ var MlSketchTool = function (props) {
7127
7118
  else {
7128
7119
  _geometries[_sketchState.activeGeometryIndex] = feature[0];
7129
7120
  }
7121
+ // Check if the geometry type is point and if the coordinates have changed to exit draw mode after editing
7122
+ var changedPoint = function () {
7123
+ var _a, _b, _c, _d;
7124
+ if (_sketchState.selectedGeoJson &&
7125
+ typeof _sketchState.activeGeometryIndex !== 'undefined' &&
7126
+ _sketchState.geometries[_sketchState.activeGeometryIndex] &&
7127
+ _sketchState.geometries[_sketchState.activeGeometryIndex].geometry.type ===
7128
+ 'Point') {
7129
+ var selectedCoords = (_b = (_a = _sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.geometry) === null || _b === void 0 ? void 0 : _b.coordinates;
7130
+ var activeCoords = (_d = (_c = _sketchState.geometries[_sketchState.activeGeometryIndex]) === null || _c === void 0 ? void 0 : _c.geometry) === null || _d === void 0 ? void 0 : _d.coordinates;
7131
+ // Compare coordinates
7132
+ return JSON.stringify(selectedCoords) !== JSON.stringify(activeCoords);
7133
+ }
7134
+ return false;
7135
+ };
7136
+ if (changedPoint()) {
7137
+ _sketchState.drawMode = undefined;
7138
+ }
7130
7139
  return __assign(__assign({}, _sketchState), { geometries: _geometries });
7131
7140
  });
7132
7141
  }, onFinish: function () {
@@ -7146,46 +7155,73 @@ var MlSketchTool = function (props) {
7146
7155
  }, onMouseLeave: function () {
7147
7156
  setHoveredGeometry(undefined);
7148
7157
  } },
7149
- React.createElement(LayerListItem, { listItemSx: buttonStyle, configurable: true, layerComponent: React.createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: el, layerId: String(el.id) }), type: 'layer', name: String(el.id), description: el.geometry.type }),
7158
+ React.createElement(LayerListItem, { listItemSx: buttonStyle, configurable: true, layerComponent: React.createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: el, layerId: String(el.id), defaultPaintOverrides: {
7159
+ fill: { 'fill-opacity': 0.5 },
7160
+ } }), type: 'layer', name: String(el.id), description: el.geometry.type }),
7150
7161
  React.createElement(system.Box, { sx: {
7151
7162
  padding: '3px 30px',
7152
7163
  } },
7153
7164
  React.createElement(ButtonGroup, { size: "small" },
7154
- React.createElement(material.Button, { onClick: function () {
7155
- var _a;
7156
- (_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.map.setCenter(el.geometry.type === 'Point'
7157
- ? el.geometry.coordinates
7158
- : turf__namespace.centerOfMass(el).geometry.coordinates);
7159
- } },
7160
- React.createElement(GpsFixedIcon, null)),
7161
- React.createElement(material.Button, { sx: buttonStyle, onClick: function () {
7162
- setSketchState(function (_sketchState) { return (__assign(__assign({}, _sketchState), { selectedGeoJson: el, activeGeometryIndex: _sketchState.geometries.indexOf(el), drawMode: 'simple_select' })); });
7163
- } },
7164
- React.createElement(EditIcon, null)),
7165
- React.createElement(material.Button, { sx: buttonStyle, onClick: function () {
7166
- removeGeoJson(el);
7167
- setHoveredGeometry(undefined);
7168
- } },
7169
- React.createElement(DeleteIcon, null)))))))); }),
7165
+ React.createElement(Tooltip, { title: "Center" },
7166
+ React.createElement(material.Button, { sx: __assign({ color: function (theme) { return theme.palette.primary.main; }, backgroundColor: function (theme) { return theme.palette.navigation.navColor; } }, buttonStyle), onClick: function () {
7167
+ var _a;
7168
+ (_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.map.setCenter(el.geometry.type === 'Point'
7169
+ ? el.geometry.coordinates
7170
+ : turf__namespace.centerOfMass(el).geometry.coordinates);
7171
+ } },
7172
+ React.createElement(GpsFixedIcon, null))),
7173
+ React.createElement(Tooltip, { title: "Edit" },
7174
+ React.createElement(material.Button, { sx: __assign({ color: function (theme) {
7175
+ var _a;
7176
+ if (sketchState.drawMode === 'simple_select' &&
7177
+ ((_a = sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.id) === el.id) {
7178
+ return theme.palette.navigation.navColor;
7179
+ }
7180
+ else {
7181
+ return theme.palette.primary.main;
7182
+ }
7183
+ }, backgroundColor: function (theme) {
7184
+ var _a;
7185
+ if (sketchState.drawMode === 'simple_select' &&
7186
+ ((_a = sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.id) === el.id) {
7187
+ return theme.palette.primary.main;
7188
+ }
7189
+ else {
7190
+ return theme.palette.navigation.navColor;
7191
+ }
7192
+ } }, buttonStyle), onClick: function () {
7193
+ setSketchState(function (_sketchState) {
7194
+ var _a;
7195
+ var newDrawMode = _sketchState.drawMode === 'simple_select' &&
7196
+ ((_a = _sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.id) === el.id
7197
+ ? undefined
7198
+ : 'simple_select';
7199
+ return __assign(__assign({}, _sketchState), { selectedGeoJson: el, activeGeometryIndex: _sketchState.geometries.indexOf(el), drawMode: newDrawMode });
7200
+ });
7201
+ } },
7202
+ React.createElement(EditIcon, null))),
7203
+ React.createElement(Tooltip, { title: "Delete" },
7204
+ React.createElement(material.Button, { sx: __assign({ color: function (theme) { return theme.palette.primary.main; }, backgroundColor: function (theme) { return theme.palette.navigation.navColor; } }, buttonStyle), onClick: function () {
7205
+ removeGeoJson(el);
7206
+ setHoveredGeometry(undefined);
7207
+ } },
7208
+ React.createElement(DeleteIcon, null))))))))); }),
7170
7209
  hoveredGeometry && (React.createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: { type: 'FeatureCollection', features: [hoveredGeometry] }, layerId: 'highlightBorder', defaultPaintOverrides: {
7171
7210
  circle: {
7172
- 'circle-color': '#dd9900',
7173
- 'circle-opacity': 0.4,
7211
+ 'circle-color': '#000000',
7212
+ 'circle-opacity': 0.2,
7174
7213
  'circle-radius': 10,
7175
7214
  },
7176
7215
  line: {
7177
- 'line-color': '#dd9900',
7178
- 'line-opacity': 0.4,
7216
+ 'line-color': '#000000',
7217
+ 'line-opacity': 0.2,
7179
7218
  'line-width': 10,
7180
7219
  },
7181
7220
  fill: {
7182
- 'fill-color': '#dd9900',
7183
- 'fill-opacity': 0.4,
7221
+ 'fill-color': '#000000',
7222
+ 'fill-opacity': 0.2,
7184
7223
  },
7185
- } }))),
7186
- sketchState.drawMode === 'simple_select' && (React.createElement(material.Typography, { sx: { fontSize: '0.6em' } },
7187
- "Edit ", (_b = (_a = sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.geometry) === null || _b === void 0 ? void 0 :
7188
- _b.type))));
7224
+ } })))));
7189
7225
  };
7190
7226
  MlSketchTool.defaultProps = {
7191
7227
  mapId: undefined,
@@ -7791,9 +7827,6 @@ var SimpleDataProvider = function (props) {
7791
7827
  };
7792
7828
  return (React.createElement(SimpleDataContextProvider, { value: value }, props.children));
7793
7829
  };
7794
- SimpleDataProvider.propTypes = {
7795
- children: PropTypes.node.isRequired,
7796
- };
7797
7830
 
7798
7831
  var IconButtonStyled$1 = material.styled(material.IconButton)({
7799
7832
  padding: '4px',
@@ -7901,13 +7934,13 @@ function LayerListItemFactory(props) {
7901
7934
  React.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
7902
7935
  layerContext.moveDown(layer.id || '');
7903
7936
  } },
7904
- React.createElement(iconsMaterial.ArrowCircleDown, null)),
7937
+ React.createElement(ArrowCircleDownIcon, null)),
7905
7938
  React.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
7906
7939
  layerContext.moveUp(layer.id || '');
7907
7940
  } },
7908
- React.createElement(iconsMaterial.ArrowCircleUp, null)),
7941
+ React.createElement(ArrowCircleUpIcon, null)),
7909
7942
  React.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
7910
- React.createElement(iconsMaterial.CenterFocusWeak, null))), setLayerState: function (layerConfig) {
7943
+ React.createElement(CenterFocusWeakIcon, null))), setLayerState: function (layerConfig) {
7911
7944
  return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
7912
7945
  var _layers = __spreadArray([], current, true);
7913
7946
  if (layerConfig === false) {
@@ -7947,26 +7980,26 @@ function LayerListItemFactory(props) {
7947
7980
  React.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
7948
7981
  layerContext.moveDown(layer.id || '');
7949
7982
  } },
7950
- React.createElement(iconsMaterial.ArrowCircleDown, null)),
7983
+ React.createElement(ArrowCircleDownIcon, null)),
7951
7984
  React.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
7952
7985
  layerContext.moveUp(layer.id || '');
7953
7986
  } },
7954
- React.createElement(iconsMaterial.ArrowCircleUp, null)),
7987
+ React.createElement(ArrowCircleUpIcon, null)),
7955
7988
  React.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
7956
- React.createElement(iconsMaterial.CenterFocusWeak, null))) }))));
7989
+ React.createElement(CenterFocusWeakIcon, null))) }))));
7957
7990
  case 'vt':
7958
7991
  return (React.createElement(React.Fragment, { key: (layer === null || layer === void 0 ? void 0 : layer.id) + '_listItem' },
7959
7992
  React.createElement(LayerListItem, { key: layer.id, name: (layer === null || layer === void 0 ? void 0 : layer.name) || (layer === null || layer === void 0 ? void 0 : layer.type) + ' layer' || 'unnamed layer', layerComponent: React.createElement(MlVectorTileLayer, { layers: ((_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.layers) || [], key: layer.id, mapId: layer === null || layer === void 0 ? void 0 : layer.config.mapId, sourceOptions: (_d = layer === null || layer === void 0 ? void 0 : layer.config) === null || _d === void 0 ? void 0 : _d.sourceOptions, layerId: layer.id, url: (_e = layer === null || layer === void 0 ? void 0 : layer.config) === null || _e === void 0 ? void 0 : _e.url }), buttons: React.createElement(React.Fragment, null,
7960
7993
  React.createElement(IconButtonStyled$1, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
7961
7994
  layerContext.moveDown(layer.id || '');
7962
7995
  } },
7963
- React.createElement(iconsMaterial.ArrowCircleDown, null)),
7996
+ React.createElement(ArrowCircleDownIcon, null)),
7964
7997
  React.createElement(IconButtonStyled$1, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
7965
7998
  layerContext.moveUp(layer.id || '');
7966
7999
  } },
7967
- React.createElement(iconsMaterial.ArrowCircleUp, null)),
8000
+ React.createElement(ArrowCircleUpIcon, null)),
7968
8001
  React.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
7969
- React.createElement(iconsMaterial.CenterFocusWeak, null))), setLayerState: function (layerConfig) {
8002
+ React.createElement(CenterFocusWeakIcon, null))), setLayerState: function (layerConfig) {
7970
8003
  return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
7971
8004
  var _layers = __spreadArray([], current, true);
7972
8005
  if (layerConfig === false) {
@@ -21706,18 +21739,18 @@ function LayerTreeListItem(props) {
21706
21739
  React.createElement(IconButtonStyled, { disabled: false, onClick: function () {
21707
21740
  moveDown(layer.uuid);
21708
21741
  } },
21709
- React.createElement(iconsMaterial.ArrowCircleDown, null)),
21742
+ React.createElement(ArrowCircleDownIcon, null)),
21710
21743
  React.createElement(IconButtonStyled, { disabled: false, onClick: function () {
21711
21744
  moveUp(layer.uuid);
21712
21745
  } },
21713
- React.createElement(iconsMaterial.ArrowCircleUp, null)),
21746
+ React.createElement(ArrowCircleUpIcon, null)),
21714
21747
  layer.configurable && (React.createElement(React.Fragment, null,
21715
21748
  React.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
21716
21749
  setPaintPropsFormVisible(function (current) {
21717
21750
  return !current;
21718
21751
  });
21719
21752
  } },
21720
- React.createElement(iconsMaterial.Tune, null))))) },
21753
+ React.createElement(TuneIcon, null))))) },
21721
21754
  React.createElement(CheckboxListItemIcon, null,
21722
21755
  React.createElement(CheckboxStyled, { checked: visible, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible); } })),
21723
21756
  React.createElement(material.ListItemText, { variant: "layerlist", primary: layer.name || '', secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }),
@@ -21725,7 +21758,7 @@ function LayerTreeListItem(props) {
21725
21758
  layer.configurable && paintPropsFormVisible && (React.createElement(React.Fragment, null,
21726
21759
  props.showDeleteButton && (React.createElement(React.Fragment, null,
21727
21760
  React.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () { } },
21728
- React.createElement(iconsMaterial.Delete, null)),
21761
+ React.createElement(DeleteIcon, null)),
21729
21762
  showDeletionConfirmationDialog && (React.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
21730
21763
  setShowDeletionConfirmationDialog(false);
21731
21764
  }, onCancel: function () {
@@ -21737,7 +21770,7 @@ function LayerTreeListItem(props) {
21737
21770
  return (React.createElement(React.Fragment, null,
21738
21771
  React.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
21739
21772
  React.createElement(ListItemIconStyled, null,
21740
- React.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(iconsMaterial.ExpandMore, null) : React.createElement(iconsMaterial.KeyboardArrowRight, null)),
21773
+ React.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(ExpandMoreIcon, null) : React.createElement(KeyboardArrowRightIcon, null)),
21741
21774
  React.createElement(CheckboxListItemIcon, null,
21742
21775
  React.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible === false, onClick: function () { var _a; return handleToggleVisibility((_a = layer.visible) !== null && _a !== void 0 ? _a : false); } }))),
21743
21776
  React.createElement(material.ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
@@ -21767,7 +21800,7 @@ function LayerTreeListItem(props) {
21767
21800
  return (React.createElement(React.Fragment, null,
21768
21801
  React.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx) },
21769
21802
  React.createElement(ListItemIconStyled, null,
21770
- React.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(iconsMaterial.ExpandMore, null) : React.createElement(iconsMaterial.KeyboardArrowRight, null)),
21803
+ React.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(ExpandMoreIcon, null) : React.createElement(KeyboardArrowRightIcon, null)),
21771
21804
  React.createElement(CheckboxListItemIcon, null,
21772
21805
  React.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible, onClick: function () { return handleToggleVisibility(layer.visible ? layer.visible : false); } }))),
21773
21806
  React.createElement(material.ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),