@terraware/web-components 4.2.13 → 4.2.14-rc.1
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/components/AntSwitch/index.js +8 -14
- package/components/Autocomplete/Autocomplete.js +67 -70
- package/components/Badge/index.js +16 -20
- package/components/BusySpinner/index.js +30 -35
- package/components/Button/Button.js +23 -27
- package/components/Button/button.test.js +8 -10
- package/components/Checkbox.js +10 -19
- package/components/Confirm/index.js +44 -51
- package/components/DatePicker/DatePicker.js +116 -117
- package/components/DialogBox/DialogBox.js +76 -66
- package/components/Divisor.js +15 -20
- package/components/Dropdown.js +54 -61
- package/components/EditableTable/index.js +129 -135
- package/components/ErrorBox/ErrorBox.js +37 -36
- package/components/FileChooser/index.js +73 -77
- package/components/FormBottomBar/index.js +63 -69
- package/components/Icon/Icon.js +14 -21
- package/components/Icon/icons/index.js +251 -257
- package/components/IconTooltip/index.js +29 -34
- package/components/Map/MapBox.js +199 -220
- package/components/Map/MapContainer.js +14 -18
- package/components/Map/MapDateSliderControl.js +44 -46
- package/components/Map/MapDrawer.js +32 -33
- package/components/Map/MapLegend.js +96 -95
- package/components/Map/MapViewStyleControl.js +38 -48
- package/components/Map/ReactMapboxWrapper.js +2 -9
- package/components/Map/index.js +47 -55
- package/components/Map/types.js +2 -8
- package/components/Map/useMaintainLayerOrder.js +4 -11
- package/components/Markdown/index.js +14 -21
- package/components/Message/Message.js +59 -51
- package/components/MultiSelect/MultiSelect.test.js +22 -24
- package/components/MultiSelect/index.js +73 -69
- package/components/Navbar/NavFooter.js +8 -13
- package/components/Navbar/NavItem.js +43 -37
- package/components/Navbar/NavSection.js +13 -17
- package/components/Navbar/Navbar.js +35 -38
- package/components/Navbar/SubNavbar.js +8 -13
- package/components/Note.js +14 -19
- package/components/OverlayModal/OverlayModal.js +36 -37
- package/components/PageForm/index.js +30 -35
- package/components/PhotoChooser/index.js +93 -98
- package/components/Pill/index.js +29 -31
- package/components/PillList/index.js +16 -22
- package/components/PlacementWrapper/index.js +20 -25
- package/components/PopoverMenu/Popover.js +33 -37
- package/components/PopoverMenu/index.js +41 -46
- package/components/PopoverMultiSelect/index.js +18 -21
- package/components/ProgressCircle/ProgressCircle.js +23 -26
- package/components/RadioButton.js +7 -14
- package/components/Select/Select.js +8 -13
- package/components/Select/SelectT.js +110 -108
- package/components/Separator/index.js +8 -14
- package/components/Size.js +1 -5
- package/components/Slider/index.js +7 -13
- package/components/SummaryBox.js +36 -39
- package/components/Tabs/index.js +75 -77
- package/components/TextTruncated/index.js +64 -65
- package/components/Textfield/Textfield.js +100 -95
- package/components/Textfield/TruncatedTextArea.js +44 -46
- package/components/TimelineSlider/TimelineMarker.js +24 -28
- package/components/TimelineSlider/TimelineRail.js +5 -11
- package/components/TimelineSlider/index.js +47 -51
- package/components/Tooltip/Tooltip.js +21 -26
- package/components/ViewPhotosDialog/index.js +58 -62
- package/components/VirtualWalkthrough/Annotation.d.ts +41 -0
- package/components/VirtualWalkthrough/Annotation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Annotation.js +197 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts +20 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.js +136 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts +13 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationPanel.js +196 -0
- package/components/VirtualWalkthrough/Application.d.ts +9 -0
- package/components/VirtualWalkthrough/Application.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Application.js +32 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts +109 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AutoRotator.js +217 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts +3 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BlockingSpinner.js +27 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts +9 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BoundaryRing.js +33 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts +16 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts.map +1 -0
- package/components/VirtualWalkthrough/CameraInfo.js +88 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts +37 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.js +196 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts +9 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts.map +1 -0
- package/components/VirtualWalkthrough/GradientSky.js +73 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts +50 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatControls.js +252 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts +15 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatModel.js +60 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts +18 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatRevealRain.js +38 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts +110 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.js +368 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts +15 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfXrNavigation.js +24 -0
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.d.ts +27 -0
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.d.ts.map +1 -0
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.js +282 -0
- package/components/VirtualWalkthrough/annotation-styles.css +5 -0
- package/components/VirtualWalkthrough/application-styles.css +4 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts +47 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts.map +1 -0
- package/components/VirtualWalkthrough/boundary-ring.js +125 -0
- package/components/VirtualWalkthrough/boundary-ring.test.js +109 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts +14 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/groundPlane.js +47 -0
- package/components/VirtualWalkthrough/groundPlane.test.js +45 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts +19 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts.map +1 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +119 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts +77 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts.map +1 -0
- package/components/VirtualWalkthrough/walkthrough-camera.js +320 -0
- package/components/svg/BlobbyGrayIconImage.js +36 -41
- package/components/svg/BlobbyGrayIconImport.js +36 -41
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +36 -41
- package/components/svg/BlobbyIconCloudChecked.js +161 -158
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +161 -158
- package/components/svg/BlobbyIconFolder.js +161 -158
- package/components/svg/BlobbyIconGraphReport.js +161 -158
- package/components/svg/BlobbyIconHappy.js +161 -158
- package/components/svg/BlobbyIconHeartMonitor.js +161 -158
- package/components/svg/BlobbyIconLeaf.js +161 -158
- package/components/svg/BlobbyIconLibrary.js +161 -158
- package/components/svg/BlobbyIconNursery.js +163 -160
- package/components/svg/BlobbyIconOrganization.js +161 -158
- package/components/svg/BlobbyIconParchment.js +161 -158
- package/components/svg/BlobbyIconPeople.js +161 -158
- package/components/svg/BlobbyIconSeedBank.js +161 -158
- package/components/svg/BlobbyIconSeedling.js +161 -158
- package/components/svg/BlobbyIconSeeds.js +161 -158
- package/components/svg/BlobbyIconSite.js +164 -161
- package/components/svg/BlobbyIconSparkles.js +161 -158
- package/components/svg/BlobbyIconWrench.js +161 -158
- package/components/svg/Bug.js +18 -27
- package/components/svg/Calendar.js +18 -27
- package/components/svg/CaretDown.js +18 -27
- package/components/svg/CaretLeft.js +18 -27
- package/components/svg/CaretRight.js +18 -27
- package/components/svg/CaretUp.js +18 -27
- package/components/svg/ChevronDown.js +18 -27
- package/components/svg/ChevronUp.js +18 -27
- package/components/svg/Close.js +18 -27
- package/components/svg/Critical.js +18 -27
- package/components/svg/Edit.js +161 -158
- package/components/svg/Error.js +18 -27
- package/components/svg/Filter.js +18 -27
- package/components/svg/Folder.js +18 -27
- package/components/svg/Help.js +18 -27
- package/components/svg/Home.js +18 -27
- package/components/svg/IconAdd.js +18 -27
- package/components/svg/IconArrowRight.js +19 -28
- package/components/svg/IconBusinessNetwork.js +18 -27
- package/components/svg/IconCalendar.js +18 -27
- package/components/svg/IconCancel.js +18 -27
- package/components/svg/IconChargingBattery.js +18 -27
- package/components/svg/IconChecklist.js +19 -28
- package/components/svg/IconCheckmark.js +18 -27
- package/components/svg/IconCoinInHand.js +18 -27
- package/components/svg/IconColumns.js +18 -27
- package/components/svg/IconComment.js +18 -27
- package/components/svg/IconDashboard.js +18 -27
- package/components/svg/IconDataMigration.js +18 -27
- package/components/svg/IconDocument.js +19 -28
- package/components/svg/IconDownloadFromTheCloud.js +19 -28
- package/components/svg/IconEdit.js +19 -28
- package/components/svg/IconExpand.js +19 -28
- package/components/svg/IconExport.js +18 -27
- package/components/svg/IconExternalLink.js +18 -27
- package/components/svg/IconEye.js +18 -27
- package/components/svg/IconEyeOff.js +18 -27
- package/components/svg/IconFile.js +18 -27
- package/components/svg/IconFolder.js +18 -27
- package/components/svg/IconFullScreen.js +18 -27
- package/components/svg/IconFutures.js +18 -27
- package/components/svg/IconGraphReport.js +18 -27
- package/components/svg/IconHeartMonitor.js +18 -27
- package/components/svg/IconHelp.js +19 -28
- package/components/svg/IconHistory.js +18 -27
- package/components/svg/IconImport.js +18 -27
- package/components/svg/IconIndex.js +18 -27
- package/components/svg/IconLayers.js +18 -27
- package/components/svg/IconLibrary.js +18 -27
- package/components/svg/IconList.js +18 -27
- package/components/svg/IconLivePlant.js +18 -27
- package/components/svg/IconLocations.js +18 -27
- package/components/svg/IconMail.js +18 -27
- package/components/svg/IconManager.js +18 -27
- package/components/svg/IconMarker.js +18 -27
- package/components/svg/IconMenu.js +18 -27
- package/components/svg/IconMenuHorizontal.js +18 -27
- package/components/svg/IconModule.js +18 -27
- package/components/svg/IconMyLocation.js +18 -27
- package/components/svg/IconNote.js +19 -28
- package/components/svg/IconNursery.js +18 -27
- package/components/svg/IconOrg.js +18 -27
- package/components/svg/IconParchment.js +18 -27
- package/components/svg/IconPhoto.js +18 -27
- package/components/svg/IconPlantsFilled.js +18 -27
- package/components/svg/IconRedo.js +18 -27
- package/components/svg/IconRestorationSite.js +18 -27
- package/components/svg/IconSeedBank.js +18 -27
- package/components/svg/IconSeedling.js +18 -27
- package/components/svg/IconSettings.js +18 -27
- package/components/svg/IconSlice.js +18 -27
- package/components/svg/IconSubmit.js +18 -27
- package/components/svg/IconSubtract.js +19 -28
- package/components/svg/IconSynced.js +18 -27
- package/components/svg/IconTrashCan.js +18 -27
- package/components/svg/IconTreasureMap.js +18 -27
- package/components/svg/IconUnavailable.js +18 -27
- package/components/svg/IconUndo.js +18 -27
- package/components/svg/IconVariable.js +18 -27
- package/components/svg/IconVideo.js +19 -28
- package/components/svg/IconWifi.js +18 -27
- package/components/svg/Info.js +18 -27
- package/components/svg/Key.js +18 -27
- package/components/svg/Leaf.js +18 -27
- package/components/svg/Lock.js +18 -27
- package/components/svg/Logo.js +40 -45
- package/components/svg/MenuVertical.js +18 -27
- package/components/svg/Notification.js +18 -27
- package/components/svg/Person.js +18 -27
- package/components/svg/Plus.js +18 -27
- package/components/svg/RestorationSite.js +18 -27
- package/components/svg/Search.js +18 -27
- package/components/svg/Seeds.js +18 -27
- package/components/svg/Site.js +18 -27
- package/components/svg/Sparkles.js +18 -27
- package/components/svg/Species.js +18 -27
- package/components/svg/Species2.js +161 -158
- package/components/svg/Spinner.js +27 -36
- package/components/svg/Star.js +18 -27
- package/components/svg/Success.js +18 -27
- package/components/svg/SuccessFilled.js +18 -27
- package/components/svg/TerrawareLogoDesktop.js +44 -49
- package/components/svg/TerrawareLogoMobile.js +20 -29
- package/components/svg/Touchscreen.js +18 -27
- package/components/svg/UploadCloud.js +161 -158
- package/components/svg/Warning.js +18 -27
- package/components/svg/WelcomeClipboard.js +130 -135
- package/components/svg/index.js +127 -895
- package/components/table/EnhancedTableToolbar.js +45 -47
- package/components/table/EnhancedTableToolbarV2.js +18 -26
- package/components/table/TableCellRenderer.js +137 -143
- package/components/table/TableHeader.js +45 -47
- package/components/table/TableHeaderItem.js +65 -64
- package/components/table/density.js +3 -11
- package/components/table/index.js +225 -218
- package/components/table/sort.js +8 -18
- package/components/table/sort.test.js +6 -8
- package/components/table/types.js +1 -5
- package/components/types/index.js +1 -5
- package/hooks/useBoolean.d.ts +4 -0
- package/hooks/useBoolean.d.ts.map +1 -0
- package/hooks/useBoolean.js +12 -0
- package/hooks/useCameraPosition.d.ts +8 -0
- package/hooks/useCameraPosition.d.ts.map +1 -0
- package/hooks/useCameraPosition.js +33 -0
- package/hooks/useDevicePerformance.d.ts +9 -0
- package/hooks/useDevicePerformance.d.ts.map +1 -0
- package/hooks/useDevicePerformance.js +16 -0
- package/index.js +57 -398
- package/license-report.html +1 -1
- package/package.json +10 -3
- package/style-dictionary-dist/TerrawareTheme.js +1 -7
- package/theme.js +7 -14
- package/utils/color.d.ts +2 -0
- package/utils/color.d.ts.map +1 -0
- package/utils/color.js +14 -0
- package/utils/date.js +13 -24
- package/utils/date.test.js +40 -43
- package/utils/index.js +5 -53
- package/utils/preventDefaultEvent.js +1 -7
- package/utils/text.js +2 -9
- package/utils/text.test.js +9 -11
- package/utils/useDeviceInfo.js +10 -16
- package/virtualWalkthrough.d.ts +34 -0
- package/virtualWalkthrough.d.ts.map +1 -0
- package/virtualWalkthrough.js +30 -0
package/components/Map/MapBox.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
require("mapbox-gl/dist/mapbox-gl.css");
|
|
13
|
-
var _utils = require("../../utils");
|
|
14
|
-
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
15
|
-
var _MapViewStyleControl = _interopRequireDefault(require("./MapViewStyleControl"));
|
|
16
|
-
var _ReactMapboxWrapper = _interopRequireDefault(require("./ReactMapboxWrapper"));
|
|
17
|
-
var _types = require("./types");
|
|
18
|
-
var _useMaintainLayerOrder = require("./useMaintainLayerOrder");
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { FullscreenControl, Layer, Marker, NavigationControl, Source } from 'react-map-gl/mapbox';
|
|
3
|
+
import { Box, useTheme } from '@mui/material';
|
|
4
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
5
|
+
import { useDeviceInfo } from '../../utils';
|
|
6
|
+
import Icon from '../Icon/Icon';
|
|
7
|
+
import MapViewStyleControl from './MapViewStyleControl';
|
|
8
|
+
import ReactMapbox from './ReactMapboxWrapper';
|
|
9
|
+
import { stylesUrl } from './types';
|
|
10
|
+
import { useMaintainLayerOrder } from './useMaintainLayerOrder';
|
|
11
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
12
|
const MapBox = props => {
|
|
20
13
|
const {
|
|
21
14
|
clusterRadius,
|
|
@@ -41,16 +34,16 @@ const MapBox = props => {
|
|
|
41
34
|
setMapViewStyle,
|
|
42
35
|
token
|
|
43
36
|
} = props;
|
|
44
|
-
const theme =
|
|
45
|
-
const mapRef =
|
|
37
|
+
const theme = useTheme();
|
|
38
|
+
const mapRef = useRef(null);
|
|
46
39
|
const {
|
|
47
40
|
isDesktop
|
|
48
|
-
} =
|
|
49
|
-
const [cursor, setCursor] =
|
|
50
|
-
const [hoverFeatureId, setHoverFeatureId] =
|
|
51
|
-
const [zoom, setZoom] =
|
|
52
|
-
const loadImages =
|
|
53
|
-
mapImageUrls
|
|
41
|
+
} = useDeviceInfo();
|
|
42
|
+
const [cursor, setCursor] = useState('auto');
|
|
43
|
+
const [hoverFeatureId, setHoverFeatureId] = useState();
|
|
44
|
+
const [zoom, setZoom] = useState();
|
|
45
|
+
const loadImages = useCallback(map => {
|
|
46
|
+
mapImageUrls?.forEach(url => {
|
|
54
47
|
if (!map.hasImage(url)) {
|
|
55
48
|
map.loadImage(url, (error, image) => {
|
|
56
49
|
if (image) {
|
|
@@ -62,17 +55,17 @@ const MapBox = props => {
|
|
|
62
55
|
}
|
|
63
56
|
});
|
|
64
57
|
}, [mapImageUrls]);
|
|
65
|
-
const mapRefCallback =
|
|
58
|
+
const mapRefCallback = useCallback(map => {
|
|
66
59
|
if (map !== null) {
|
|
67
60
|
mapRef.current = map;
|
|
68
61
|
setZoom(map.getZoom());
|
|
69
62
|
loadImages(map);
|
|
70
63
|
}
|
|
71
64
|
}, []);
|
|
72
|
-
const onMove =
|
|
65
|
+
const onMove = useCallback(view => {
|
|
73
66
|
setZoom(view.viewState.zoom);
|
|
74
67
|
}, []);
|
|
75
|
-
const clusterMarkers =
|
|
68
|
+
const clusterMarkers = useCallback((map, markers) => {
|
|
76
69
|
if (!map || map.getZoom() > 15) {
|
|
77
70
|
// Too zoomed in. Return all marker as is
|
|
78
71
|
return markers.map(marker => [marker]);
|
|
@@ -94,7 +87,7 @@ const MapBox = props => {
|
|
|
94
87
|
const dx = markerPixels[marker.id].x - markerPixels[otherMarker.id].x;
|
|
95
88
|
const dy = markerPixels[marker.id].y - markerPixels[otherMarker.id].y;
|
|
96
89
|
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
97
|
-
if (dist <= (clusterRadius
|
|
90
|
+
if (dist <= (clusterRadius ?? 40)) {
|
|
98
91
|
cluster.push(otherMarker);
|
|
99
92
|
visited.add(otherMarker.id);
|
|
100
93
|
}
|
|
@@ -107,22 +100,20 @@ const MapBox = props => {
|
|
|
107
100
|
}, [clusterRadius]);
|
|
108
101
|
|
|
109
102
|
// Find all layers with at least some clickable elements
|
|
110
|
-
const interactiveLayerIds =
|
|
111
|
-
|
|
112
|
-
return featureGroups === null || featureGroups === void 0 ? void 0 : (_featureGroups$filter = featureGroups.filter(group => group.features.some(feature => feature.onClick !== undefined))) === null || _featureGroups$filter === void 0 ? void 0 : _featureGroups$filter.map(group => group.layerId);
|
|
103
|
+
const interactiveLayerIds = useMemo(() => {
|
|
104
|
+
return featureGroups?.filter(group => group.features.some(feature => feature.onClick !== undefined))?.map(group => group.layerId);
|
|
113
105
|
}, [featureGroups]);
|
|
114
|
-
const geojson =
|
|
115
|
-
const features = featureGroups
|
|
106
|
+
const geojson = useMemo(() => {
|
|
107
|
+
const features = featureGroups?.flatMap(group => {
|
|
116
108
|
return group.features.map(feature => {
|
|
117
|
-
var _feature$priority, _feature$selected;
|
|
118
109
|
const properties = {
|
|
119
110
|
id: feature.featureId,
|
|
120
111
|
clickable: feature.onClick !== undefined,
|
|
121
112
|
label: feature.label,
|
|
122
|
-
layerFeatureId:
|
|
113
|
+
layerFeatureId: `${group.layerId}/${feature.featureId}`,
|
|
123
114
|
layerId: group.layerId,
|
|
124
|
-
priority:
|
|
125
|
-
selected:
|
|
115
|
+
priority: feature.priority ?? 0,
|
|
116
|
+
selected: feature.selected ?? false
|
|
126
117
|
};
|
|
127
118
|
return {
|
|
128
119
|
type: 'Feature',
|
|
@@ -140,11 +131,10 @@ const MapBox = props => {
|
|
|
140
131
|
borderLayers,
|
|
141
132
|
fillLayers,
|
|
142
133
|
textLayers
|
|
143
|
-
} =
|
|
144
|
-
const _borderLayers = featureGroups
|
|
145
|
-
return /*#__PURE__*/
|
|
146
|
-
|
|
147
|
-
id: "".concat(group.layerId, "-border"),
|
|
134
|
+
} = useMemo(() => {
|
|
135
|
+
const _borderLayers = featureGroups?.map(group => {
|
|
136
|
+
return /*#__PURE__*/_jsx(Layer, {
|
|
137
|
+
id: `${group.layerId}-border`,
|
|
148
138
|
source: 'mapData',
|
|
149
139
|
type: "line",
|
|
150
140
|
paint: {
|
|
@@ -152,11 +142,10 @@ const MapBox = props => {
|
|
|
152
142
|
'line-width': 2
|
|
153
143
|
},
|
|
154
144
|
filter: ['==', ['get', 'layerId'], group.layerId]
|
|
155
|
-
});
|
|
145
|
+
}, `${group.layerId}-border`);
|
|
156
146
|
});
|
|
157
|
-
const _fillLayers = featureGroups
|
|
158
|
-
|
|
159
|
-
const opacity = Math.min(0.4, (_group$style$opacity = group.style.opacity) !== null && _group$style$opacity !== void 0 ? _group$style$opacity : 0.2);
|
|
147
|
+
const _fillLayers = featureGroups?.map(group => {
|
|
148
|
+
const opacity = Math.min(0.4, group.style.opacity ?? 0.2);
|
|
160
149
|
const selectedOpacity = opacity * 2;
|
|
161
150
|
const hoverOpacity = opacity * 1.5;
|
|
162
151
|
const hoverAndSelectedOpacity = opacity * 2.5;
|
|
@@ -164,78 +153,74 @@ const MapBox = props => {
|
|
|
164
153
|
const clickableFilter = ['==', ['get', 'clickable'], true];
|
|
165
154
|
const selectedFilter = ['==', ['get', 'selected'], true];
|
|
166
155
|
const notSelectedFilter = ['==', ['get', 'selected'], false];
|
|
167
|
-
const hoverFilter = ['==', ['get', 'id'], hoverFeatureId
|
|
168
|
-
const notHoverFilter = ['!=', ['get', 'id'], hoverFeatureId
|
|
169
|
-
return /*#__PURE__*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
'
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
'
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
},
|
|
230
|
-
filter: ['all', groupFilter, hoverFilter, selectedFilter]
|
|
231
|
-
}));
|
|
156
|
+
const hoverFilter = ['==', ['get', 'id'], hoverFeatureId ?? null];
|
|
157
|
+
const notHoverFilter = ['!=', ['get', 'id'], hoverFeatureId ?? null];
|
|
158
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
159
|
+
children: [/*#__PURE__*/_jsx(Layer, {
|
|
160
|
+
id: group.layerId,
|
|
161
|
+
source: 'mapData',
|
|
162
|
+
type: 'fill',
|
|
163
|
+
paint: {
|
|
164
|
+
'fill-opacity': 0
|
|
165
|
+
},
|
|
166
|
+
filter: ['all', groupFilter, clickableFilter]
|
|
167
|
+
}, group.layerId), /*#__PURE__*/_jsx(Layer, {
|
|
168
|
+
id: `${group.layerId}-unselected`,
|
|
169
|
+
source: 'mapData',
|
|
170
|
+
type: 'fill',
|
|
171
|
+
paint: group.style.fillPatternUrl ? {
|
|
172
|
+
'fill-pattern': group.style.fillPatternUrl,
|
|
173
|
+
'fill-opacity': opacity
|
|
174
|
+
} : {
|
|
175
|
+
'fill-color': group.style.fillColor,
|
|
176
|
+
'fill-opacity': opacity
|
|
177
|
+
},
|
|
178
|
+
filter: ['all', groupFilter, notSelectedFilter, notHoverFilter]
|
|
179
|
+
}, `${group.layerId}-unselected`), /*#__PURE__*/_jsx(Layer, {
|
|
180
|
+
id: `${group.layerId}-selected`,
|
|
181
|
+
slot: 'bottom',
|
|
182
|
+
source: 'mapData',
|
|
183
|
+
type: 'fill',
|
|
184
|
+
paint: group.style.fillPatternUrl ? {
|
|
185
|
+
'fill-pattern': group.style.fillPatternUrl,
|
|
186
|
+
'fill-opacity': selectedOpacity
|
|
187
|
+
} : {
|
|
188
|
+
'fill-color': group.style.fillColor,
|
|
189
|
+
'fill-opacity': selectedOpacity
|
|
190
|
+
},
|
|
191
|
+
filter: ['all', groupFilter, selectedFilter, notHoverFilter]
|
|
192
|
+
}, `${group.layerId}-selected`), /*#__PURE__*/_jsx(Layer, {
|
|
193
|
+
id: `${group.layerId}-hover`,
|
|
194
|
+
source: 'mapData',
|
|
195
|
+
type: 'fill',
|
|
196
|
+
paint: group.style.fillPatternUrl ? {
|
|
197
|
+
'fill-pattern': group.style.fillPatternUrl,
|
|
198
|
+
'fill-opacity': hoverOpacity
|
|
199
|
+
} : {
|
|
200
|
+
'fill-color': group.style.fillColor,
|
|
201
|
+
'fill-opacity': hoverOpacity
|
|
202
|
+
},
|
|
203
|
+
filter: ['all', groupFilter, hoverFilter, notSelectedFilter]
|
|
204
|
+
}, `${group.layerId}-hover`), /*#__PURE__*/_jsx(Layer, {
|
|
205
|
+
id: `${group.layerId}-selected-hover`,
|
|
206
|
+
source: 'mapData',
|
|
207
|
+
type: 'fill',
|
|
208
|
+
paint: group.style.fillPatternUrl ? {
|
|
209
|
+
'fill-pattern': group.style.fillPatternUrl,
|
|
210
|
+
'fill-opacity': hoverAndSelectedOpacity
|
|
211
|
+
} : {
|
|
212
|
+
'fill-color': group.style.fillColor,
|
|
213
|
+
'fill-opacity': hoverAndSelectedOpacity
|
|
214
|
+
},
|
|
215
|
+
filter: ['all', groupFilter, hoverFilter, selectedFilter]
|
|
216
|
+
}, `${group.layerId}-selected-hover`)]
|
|
217
|
+
});
|
|
232
218
|
});
|
|
233
|
-
const _textLayers = featureGroups
|
|
219
|
+
const _textLayers = featureGroups?.map(group => {
|
|
234
220
|
const groupFilter = ['==', ['get', 'layerId'], group.layerId];
|
|
235
221
|
const labelFilter = ['has', 'label'];
|
|
236
|
-
return /*#__PURE__*/
|
|
237
|
-
|
|
238
|
-
id: "".concat(group.layerId, "-label"),
|
|
222
|
+
return /*#__PURE__*/_jsx(Layer, {
|
|
223
|
+
id: `${group.layerId}-label`,
|
|
239
224
|
source: 'mapData',
|
|
240
225
|
type: 'symbol',
|
|
241
226
|
layout: {
|
|
@@ -250,108 +235,101 @@ const MapBox = props => {
|
|
|
250
235
|
'text-color': '#ffffff'
|
|
251
236
|
},
|
|
252
237
|
filter: ['all', groupFilter, labelFilter]
|
|
253
|
-
});
|
|
238
|
+
}, `${group.layerId}-label`);
|
|
254
239
|
});
|
|
255
240
|
return {
|
|
256
|
-
borderLayers: _borderLayers
|
|
257
|
-
fillLayers: _fillLayers
|
|
258
|
-
textLayers: _textLayers
|
|
241
|
+
borderLayers: _borderLayers ?? [],
|
|
242
|
+
fillLayers: _fillLayers ?? [],
|
|
243
|
+
textLayers: _textLayers ?? []
|
|
259
244
|
};
|
|
260
245
|
}, [featureGroups, hoverFeatureId]);
|
|
261
|
-
const highlightLayers =
|
|
262
|
-
|
|
263
|
-
return (_highlightGroups$flat = highlightGroups === null || highlightGroups === void 0 ? void 0 : highlightGroups.flatMap(group => {
|
|
246
|
+
const highlightLayers = useMemo(() => {
|
|
247
|
+
return highlightGroups?.flatMap(group => {
|
|
264
248
|
return group.highlights.map((highlight, index) => {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
return "".concat(layerId, "/").concat(featureId);
|
|
272
|
-
});
|
|
273
|
-
return /*#__PURE__*/_react.default.createElement(_mapbox.Layer, {
|
|
274
|
-
key: "highlight-".concat(group.highlightId, "-").concat(index),
|
|
275
|
-
id: "highlight-".concat(group.highlightId, "-").concat(index),
|
|
249
|
+
const highlightFeatureIds = highlight.featureIds.map(({
|
|
250
|
+
layerId,
|
|
251
|
+
featureId
|
|
252
|
+
}) => `${layerId}/${featureId}`);
|
|
253
|
+
return /*#__PURE__*/_jsx(Layer, {
|
|
254
|
+
id: `highlight-${group.highlightId}-${index}`,
|
|
276
255
|
source: 'mapData',
|
|
277
256
|
type: 'fill',
|
|
278
257
|
paint: highlight.style.fillPatternUrl ? {
|
|
279
258
|
'fill-pattern': highlight.style.fillPatternUrl,
|
|
280
|
-
'fill-opacity':
|
|
259
|
+
'fill-opacity': highlight.style.opacity ?? 0.5
|
|
281
260
|
} : {
|
|
282
261
|
'fill-color': highlight.style.fillColor,
|
|
283
|
-
'fill-opacity':
|
|
262
|
+
'fill-opacity': highlight.style.opacity ?? 0.5
|
|
284
263
|
},
|
|
285
264
|
filter: ['all', ['has', 'layerFeatureId'], ['match', ['get', 'layerFeatureId'], highlightFeatureIds, true, false]]
|
|
286
|
-
});
|
|
265
|
+
}, `highlight-${group.highlightId}-${index}`);
|
|
287
266
|
});
|
|
288
|
-
})
|
|
267
|
+
}) ?? [];
|
|
289
268
|
}, [highlightGroups]);
|
|
290
|
-
const markersComponents =
|
|
291
|
-
return markerGroups
|
|
269
|
+
const markersComponents = useMemo(() => {
|
|
270
|
+
return markerGroups?.flatMap(markerGroup => {
|
|
292
271
|
// cluster markers here
|
|
293
272
|
const clusteredMarkers = clusterMarkers(mapRef.current, markerGroup.markers);
|
|
294
273
|
return clusteredMarkers.map((markers, i) => {
|
|
295
274
|
if (markers.length === 1) {
|
|
296
275
|
const marker = markers[0];
|
|
297
|
-
return /*#__PURE__*/
|
|
276
|
+
return /*#__PURE__*/_jsx(Marker, {
|
|
298
277
|
className: "map-marker",
|
|
299
|
-
key: "marker-".concat(i),
|
|
300
278
|
longitude: marker.longitude,
|
|
301
279
|
latitude: marker.latitude,
|
|
302
280
|
anchor: "center",
|
|
303
281
|
onClick: event => {
|
|
304
|
-
|
|
305
|
-
(_marker$onClick = marker.onClick) === null || _marker$onClick === void 0 ? void 0 : _marker$onClick.call(marker);
|
|
282
|
+
marker.onClick?.();
|
|
306
283
|
event.originalEvent.stopPropagation();
|
|
307
284
|
},
|
|
308
285
|
style: {
|
|
309
286
|
backgroundColor: marker.selected ? markerGroup.style.iconColor : theme.palette.TwClrBg
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
287
|
+
},
|
|
288
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
289
|
+
fillColor: marker.selected ? theme.palette.TwClrBg : markerGroup.style.iconColor,
|
|
290
|
+
name: markerGroup.style.iconName,
|
|
291
|
+
size: 'small'
|
|
292
|
+
})
|
|
293
|
+
}, `marker-${i}`);
|
|
316
294
|
} else if (markers.length > 1) {
|
|
317
295
|
const latSum = markers.reduce((sum, marker) => sum + marker.latitude, 0);
|
|
318
296
|
const lngSum = markers.reduce((sum, marker) => sum + marker.longitude, 0);
|
|
319
297
|
const latAvg = latSum / markers.length;
|
|
320
298
|
const lngAvg = lngSum / markers.length;
|
|
321
299
|
const selected = markers.some(marker => marker.selected);
|
|
322
|
-
return /*#__PURE__*/
|
|
300
|
+
return /*#__PURE__*/_jsxs(Marker, {
|
|
323
301
|
className: "map-marker map-marker--cluster",
|
|
324
|
-
key: "marker-".concat(i),
|
|
325
302
|
longitude: lngAvg,
|
|
326
303
|
latitude: latAvg,
|
|
327
304
|
anchor: "center",
|
|
328
305
|
onClick: event => {
|
|
329
|
-
|
|
330
|
-
(_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.easeTo({
|
|
306
|
+
mapRef.current?.easeTo({
|
|
331
307
|
center: {
|
|
332
308
|
lat: latAvg,
|
|
333
309
|
lon: lngAvg
|
|
334
310
|
},
|
|
335
|
-
zoom: (zoom
|
|
311
|
+
zoom: (zoom ?? 10) + 1,
|
|
336
312
|
duration: 500
|
|
337
313
|
});
|
|
338
314
|
event.originalEvent.stopPropagation();
|
|
339
315
|
},
|
|
340
316
|
style: {
|
|
341
317
|
backgroundColor: selected ? markerGroup.style.iconColor : theme.palette.TwClrBg
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
318
|
+
},
|
|
319
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
320
|
+
className: "count",
|
|
321
|
+
children: markers.length
|
|
322
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
|
323
|
+
fillColor: selected ? theme.palette.TwClrBg : markerGroup.style.iconColor,
|
|
324
|
+
name: markerGroup.style.iconName,
|
|
325
|
+
size: 'small'
|
|
326
|
+
})]
|
|
327
|
+
}, `marker-${i}`);
|
|
350
328
|
}
|
|
351
329
|
});
|
|
352
330
|
});
|
|
353
331
|
}, [markerGroups, theme, zoom]);
|
|
354
|
-
const onMouseMove =
|
|
332
|
+
const onMouseMove = useCallback(event => {
|
|
355
333
|
if (event.features && event.features.length) {
|
|
356
334
|
const properties = event.features.map(feature => feature.properties).filter(featureProperties => featureProperties && featureProperties.id !== undefined && featureProperties.priority !== undefined && featureProperties.clickable);
|
|
357
335
|
if (properties.length) {
|
|
@@ -364,18 +342,17 @@ const MapBox = props => {
|
|
|
364
342
|
}
|
|
365
343
|
setHoverFeatureId(undefined);
|
|
366
344
|
}, []);
|
|
367
|
-
|
|
345
|
+
useEffect(() => {
|
|
368
346
|
if (!mapRef.current) {
|
|
369
347
|
return;
|
|
370
348
|
}
|
|
371
349
|
const observer = new ResizeObserver(() => {
|
|
372
|
-
|
|
373
|
-
(_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.resize();
|
|
350
|
+
mapRef.current?.resize();
|
|
374
351
|
});
|
|
375
352
|
observer.observe(mapRef.current.getContainer());
|
|
376
353
|
return () => observer.disconnect();
|
|
377
354
|
}, []);
|
|
378
|
-
|
|
355
|
+
useEffect(() => {
|
|
379
356
|
if (!mapRef.current) {
|
|
380
357
|
return;
|
|
381
358
|
}
|
|
@@ -383,17 +360,16 @@ const MapBox = props => {
|
|
|
383
360
|
}, [drawerOpen]);
|
|
384
361
|
|
|
385
362
|
// Hovering interactive layers
|
|
386
|
-
const onMouseEnter =
|
|
387
|
-
const onMouseLeave =
|
|
363
|
+
const onMouseEnter = useCallback(() => setCursor(cursorInteract ?? 'pointer'), [cursorInteract]);
|
|
364
|
+
const onMouseLeave = useCallback(() => setCursor('auto'), []);
|
|
388
365
|
|
|
389
366
|
// Entering and exiting canvases
|
|
390
|
-
const onMouseOver =
|
|
391
|
-
const onMouseOut =
|
|
367
|
+
const onMouseOver = useCallback(() => setCursor(cursorMap ?? 'auto'), [cursorMap]);
|
|
368
|
+
const onMouseOut = useCallback(() => setCursor('auto'), []);
|
|
392
369
|
|
|
393
370
|
// On layer click
|
|
394
|
-
const onMapClick =
|
|
395
|
-
|
|
396
|
-
if (featureGroups && (_event$features = event.features) !== null && _event$features !== void 0 && _event$features.length) {
|
|
371
|
+
const onMapClick = useCallback(event => {
|
|
372
|
+
if (featureGroups && event.features?.length) {
|
|
397
373
|
const properties = event.features.map(feature => feature.properties).filter(featureProperties => featureProperties && featureProperties.id !== undefined && featureProperties.priority !== undefined && featureProperties.clickable);
|
|
398
374
|
if (properties.length) {
|
|
399
375
|
const topPriorityFeature = properties.reduce((top, current) => {
|
|
@@ -411,19 +387,18 @@ const MapBox = props => {
|
|
|
411
387
|
onClickCanvas(event);
|
|
412
388
|
}
|
|
413
389
|
}, [featureGroups, onClickCanvas]);
|
|
414
|
-
const orderedLayerIds =
|
|
390
|
+
const orderedLayerIds = useMemo(() => {
|
|
415
391
|
return [...fillLayers.map(layer => layer.props.id), ...highlightLayers.map(layer => layer.props.id), ...borderLayers.map(layer => layer.props.id), ...textLayers.map(layer => layer.props.id)];
|
|
416
392
|
}, [borderLayers, fillLayers, highlightLayers, textLayers]);
|
|
417
|
-
|
|
418
|
-
return /*#__PURE__*/
|
|
419
|
-
key: mapId,
|
|
393
|
+
useMaintainLayerOrder(mapRef, orderedLayerIds);
|
|
394
|
+
return /*#__PURE__*/_jsxs(ReactMapbox, {
|
|
420
395
|
attributionControl: false,
|
|
421
396
|
cursor: cursor,
|
|
422
397
|
doubleClickZoom: !disableZoom && !disableDoubleClickZoom,
|
|
423
398
|
interactiveLayerIds: interactiveLayerIds,
|
|
424
399
|
initialViewState: initialViewState,
|
|
425
400
|
mapboxAccessToken: token,
|
|
426
|
-
mapStyle:
|
|
401
|
+
mapStyle: stylesUrl[mapViewStyle],
|
|
427
402
|
ref: mapRefCallback,
|
|
428
403
|
scrollZoom: !disableZoom,
|
|
429
404
|
style: {
|
|
@@ -437,43 +412,47 @@ const MapBox = props => {
|
|
|
437
412
|
onMouseLeave: onMouseLeave,
|
|
438
413
|
onMouseOver: onMouseOver,
|
|
439
414
|
onMouseOut: onMouseOut,
|
|
440
|
-
onMouseMove: onMouseMove
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
415
|
+
onMouseMove: onMouseMove,
|
|
416
|
+
children: [isDesktop && !hideFullScreenControl && /*#__PURE__*/_jsx(FullscreenControl, {
|
|
417
|
+
position: "top-left",
|
|
418
|
+
containerId: containerId
|
|
419
|
+
}), !hideZoomControl && /*#__PURE__*/_jsx(NavigationControl, {
|
|
420
|
+
showCompass: false,
|
|
421
|
+
style: {
|
|
422
|
+
marginRight: theme.spacing(2),
|
|
423
|
+
marginBottom: theme.spacing(2)
|
|
424
|
+
},
|
|
425
|
+
position: "bottom-right"
|
|
426
|
+
}), !hideMapViewStyleControl && /*#__PURE__*/_jsx(MapViewStyleControl, {
|
|
427
|
+
containerId: containerId,
|
|
428
|
+
mapViewStyle: mapViewStyle,
|
|
429
|
+
setMapViewStyle: setMapViewStyle
|
|
430
|
+
}), controlTopRight && /*#__PURE__*/_jsx(Box, {
|
|
431
|
+
sx: {
|
|
432
|
+
height: 'max-content',
|
|
433
|
+
position: 'absolute',
|
|
434
|
+
right: theme.spacing(2),
|
|
435
|
+
top: theme.spacing(2),
|
|
436
|
+
width: 'max-content',
|
|
437
|
+
zIndex: 1000
|
|
438
|
+
},
|
|
439
|
+
children: controlTopRight
|
|
440
|
+
}), controlBottomLeft && /*#__PURE__*/_jsx(Box, {
|
|
441
|
+
style: {
|
|
442
|
+
height: 'max-content',
|
|
443
|
+
position: 'absolute',
|
|
444
|
+
left: theme.spacing(2),
|
|
445
|
+
bottom: theme.spacing(4),
|
|
446
|
+
width: 'max-content',
|
|
447
|
+
zIndex: 1000
|
|
448
|
+
},
|
|
449
|
+
children: controlBottomLeft
|
|
450
|
+
}), geojson && /*#__PURE__*/_jsxs(Source, {
|
|
451
|
+
id: "mapData",
|
|
452
|
+
type: "geojson",
|
|
453
|
+
data: geojson,
|
|
454
|
+
children: [fillLayers, highlightLayers, borderLayers, textLayers]
|
|
455
|
+
}), markersComponents]
|
|
456
|
+
}, mapId);
|
|
478
457
|
};
|
|
479
|
-
|
|
458
|
+
export default MapBox;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _utils = require("../../utils");
|
|
10
|
-
require("./styles.scss");
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useDeviceInfo } from '../../utils';
|
|
3
|
+
import './styles.scss';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
5
|
const MapContainer = props => {
|
|
12
6
|
const {
|
|
13
7
|
containerId,
|
|
@@ -18,13 +12,15 @@ const MapContainer = props => {
|
|
|
18
12
|
} = props;
|
|
19
13
|
const {
|
|
20
14
|
isDesktop
|
|
21
|
-
} =
|
|
22
|
-
const drawerOnly =
|
|
23
|
-
return /*#__PURE__*/
|
|
15
|
+
} = useDeviceInfo();
|
|
16
|
+
const drawerOnly = useMemo(() => !isDesktop && drawerOpen, [drawerOpen, isDesktop]);
|
|
17
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
24
18
|
id: containerId,
|
|
25
|
-
className:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
className: `map-container map-container${isDesktop ? '--desktop' : `--mobile${drawerOpen ? '-drawer-open' : ''}`}`,
|
|
20
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
21
|
+
className: `map-holder${drawerOnly ? ' map-holder--hidden' : ''}`,
|
|
22
|
+
children: map
|
|
23
|
+
}), drawerOpen && drawer, !drawerOnly && legend]
|
|
24
|
+
});
|
|
29
25
|
};
|
|
30
|
-
|
|
26
|
+
export default MapContainer;
|