@terraware/web-components 4.2.13 → 4.2.14-rc.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/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/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/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 +31 -0
- package/virtualWalkthrough.d.ts.map +1 -0
- package/virtualWalkthrough.js +28 -0
package/components/Map/index.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _MapBox = _interopRequireDefault(require("./MapBox"));
|
|
12
|
-
var _MapContainer = _interopRequireDefault(require("./MapContainer"));
|
|
13
|
-
var _MapDrawer = _interopRequireDefault(require("./MapDrawer"));
|
|
14
|
-
var _MapLegend = _interopRequireDefault(require("./MapLegend"));
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import MapBox from './MapBox';
|
|
3
|
+
import MapContainer from './MapContainer';
|
|
4
|
+
import MapDrawer from './MapDrawer';
|
|
5
|
+
import MapLegend from './MapLegend';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
7
|
const MapComponent = props => {
|
|
16
8
|
const {
|
|
17
9
|
clusterRadius,
|
|
@@ -39,26 +31,26 @@ const MapComponent = props => {
|
|
|
39
31
|
setDrawerOpen,
|
|
40
32
|
token
|
|
41
33
|
} = props;
|
|
42
|
-
const [mapViewStyle, setMapViewStyle] =
|
|
43
|
-
const [visibleHighlights, setVisibleHighlights] =
|
|
44
|
-
const setHighlightVisible =
|
|
34
|
+
const [mapViewStyle, setMapViewStyle] = useState(initialMapViewStyle ?? 'Streets');
|
|
35
|
+
const [visibleHighlights, setVisibleHighlights] = useState([]);
|
|
36
|
+
const setHighlightVisible = useCallback(highlightId => visible => {
|
|
45
37
|
if (visible) {
|
|
46
38
|
setVisibleHighlights(_visibleHighlights => [..._visibleHighlights, highlightId]);
|
|
47
39
|
} else {
|
|
48
40
|
setVisibleHighlights(_visibleHighlights => _visibleHighlights.filter(_highlightId => _highlightId !== highlightId));
|
|
49
41
|
}
|
|
50
42
|
}, []);
|
|
51
|
-
const [visibleMarkers, setVisibleMarkers] =
|
|
52
|
-
const setMarkerVisible =
|
|
43
|
+
const [visibleMarkers, setVisibleMarkers] = useState([]);
|
|
44
|
+
const setMarkerVisible = useCallback(markerGroupId => visible => {
|
|
53
45
|
if (visible) {
|
|
54
46
|
setVisibleMarkers(_visibleMarkers => [..._visibleMarkers, markerGroupId]);
|
|
55
47
|
} else {
|
|
56
48
|
setVisibleMarkers(_visibleMarkers => _visibleMarkers.filter(_markerGroupId => _markerGroupId !== markerGroupId));
|
|
57
49
|
}
|
|
58
50
|
}, []);
|
|
59
|
-
const [selectedLayer, setSelectedLayer] =
|
|
60
|
-
const legends =
|
|
61
|
-
return features
|
|
51
|
+
const [selectedLayer, setSelectedLayer] = useState(initialSelectedLayerId);
|
|
52
|
+
const legends = useMemo(() => {
|
|
53
|
+
return features?.map(feature => {
|
|
62
54
|
const baseLegendGroup = {
|
|
63
55
|
disabled: feature.sectionDisabled,
|
|
64
56
|
title: feature.sectionTitle,
|
|
@@ -66,14 +58,16 @@ const MapComponent = props => {
|
|
|
66
58
|
};
|
|
67
59
|
switch (feature.type) {
|
|
68
60
|
case 'highlight':
|
|
69
|
-
return
|
|
61
|
+
return {
|
|
62
|
+
...baseLegendGroup,
|
|
70
63
|
items: feature.legendItems,
|
|
71
64
|
type: 'highlight',
|
|
72
65
|
visible: visibleHighlights.findIndex(highlightId => highlightId === feature.highlight.highlightId) >= 0,
|
|
73
66
|
setVisible: setHighlightVisible(feature.highlight.highlightId)
|
|
74
|
-
}
|
|
67
|
+
};
|
|
75
68
|
case 'layer':
|
|
76
|
-
return
|
|
69
|
+
return {
|
|
70
|
+
...baseLegendGroup,
|
|
77
71
|
items: feature.layers.map(layer => ({
|
|
78
72
|
disabled: layer.disabled,
|
|
79
73
|
id: layer.layerId,
|
|
@@ -83,9 +77,10 @@ const MapComponent = props => {
|
|
|
83
77
|
selectedLayer,
|
|
84
78
|
setSelectedLayer,
|
|
85
79
|
type: 'layer'
|
|
86
|
-
}
|
|
80
|
+
};
|
|
87
81
|
case 'marker':
|
|
88
|
-
return
|
|
82
|
+
return {
|
|
83
|
+
...baseLegendGroup,
|
|
89
84
|
items: feature.groups.map(group => ({
|
|
90
85
|
disabled: group.disabled,
|
|
91
86
|
id: group.markerGroupId,
|
|
@@ -95,23 +90,20 @@ const MapComponent = props => {
|
|
|
95
90
|
visible: visibleMarkers.findIndex(markerId => markerId === group.markerGroupId) >= 0
|
|
96
91
|
})),
|
|
97
92
|
type: 'marker'
|
|
98
|
-
}
|
|
93
|
+
};
|
|
99
94
|
}
|
|
100
95
|
});
|
|
101
96
|
}, [features, selectedLayer, visibleHighlights, visibleMarkers]);
|
|
102
|
-
const layers =
|
|
103
|
-
|
|
104
|
-
return features === null || features === void 0 ? void 0 : (_features$filter = features.filter(feature => feature.type === 'layer')) === null || _features$filter === void 0 ? void 0 : (_features$filter$flat = _features$filter.flatMap(feature => feature.layers)) === null || _features$filter$flat === void 0 ? void 0 : _features$filter$flat.filter(layer => layer.layerId === selectedLayer);
|
|
97
|
+
const layers = useMemo(() => {
|
|
98
|
+
return features?.filter(feature => feature.type === 'layer')?.flatMap(feature => feature.layers)?.filter(layer => layer.layerId === selectedLayer);
|
|
105
99
|
}, [features, selectedLayer]);
|
|
106
|
-
const highlightGroups =
|
|
107
|
-
|
|
108
|
-
return features === null || features === void 0 ? void 0 : (_features$filter2 = features.filter(feature => feature.type === 'highlight')) === null || _features$filter2 === void 0 ? void 0 : (_features$filter2$map = _features$filter2.map(feature => feature.highlight)) === null || _features$filter2$map === void 0 ? void 0 : _features$filter2$map.filter(highlight => visibleHighlights.findIndex(_highlightId => _highlightId === highlight.highlightId) >= 0);
|
|
100
|
+
const highlightGroups = useMemo(() => {
|
|
101
|
+
return features?.filter(feature => feature.type === 'highlight')?.map(feature => feature.highlight)?.filter(highlight => visibleHighlights.findIndex(_highlightId => _highlightId === highlight.highlightId) >= 0);
|
|
109
102
|
}, [features, visibleHighlights]);
|
|
110
|
-
const markerGroups =
|
|
111
|
-
|
|
112
|
-
return features === null || features === void 0 ? void 0 : (_features$filter3 = features.filter(feature => feature.type === 'marker')) === null || _features$filter3 === void 0 ? void 0 : _features$filter3.flatMap(feature => feature.groups).filter(group => visibleMarkers.findIndex(_markerId => _markerId === group.markerGroupId) >= 0);
|
|
103
|
+
const markerGroups = useMemo(() => {
|
|
104
|
+
return features?.filter(feature => feature.type === 'marker')?.flatMap(feature => feature.groups).filter(group => visibleMarkers.findIndex(_markerId => _markerId === group.markerGroupId) >= 0);
|
|
113
105
|
}, [features, visibleMarkers]);
|
|
114
|
-
const mapViewState =
|
|
106
|
+
const mapViewState = useMemo(() => {
|
|
115
107
|
if (initialViewState) {
|
|
116
108
|
return initialViewState;
|
|
117
109
|
} else if (features) {
|
|
@@ -137,21 +129,20 @@ const MapComponent = props => {
|
|
|
137
129
|
}
|
|
138
130
|
}
|
|
139
131
|
}, [initialViewState]);
|
|
140
|
-
const mapImageUrls =
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
const highlightFeatures = (_features$filter5 = features === null || features === void 0 ? void 0 : features.filter(feature => feature.type === 'highlight')) !== null && _features$filter5 !== void 0 ? _features$filter5 : [];
|
|
132
|
+
const mapImageUrls = useMemo(() => {
|
|
133
|
+
const layerFeatures = features?.filter(feature => feature.type === 'layer') ?? [];
|
|
134
|
+
const highlightFeatures = features?.filter(feature => feature.type === 'highlight') ?? [];
|
|
144
135
|
const layerImageUrls = layerFeatures.flatMap(feature => feature.layers).map(layer => layer.style.fillPatternUrl).filter(url => url !== undefined);
|
|
145
136
|
const highlightImageUrls = highlightFeatures.flatMap(feature => feature.highlight.highlights).map(highlight => highlight.style.fillPatternUrl).filter(url => url !== undefined);
|
|
146
137
|
const imageUrls = new Set(layerImageUrls);
|
|
147
138
|
highlightImageUrls.forEach(url => imageUrls.add(url));
|
|
148
139
|
return Array.from(imageUrls);
|
|
149
140
|
}, [features]);
|
|
150
|
-
return /*#__PURE__*/
|
|
151
|
-
containerId: mapContainerId
|
|
152
|
-
map: /*#__PURE__*/
|
|
141
|
+
return /*#__PURE__*/_jsx(MapContainer, {
|
|
142
|
+
containerId: mapContainerId ?? 'map-container',
|
|
143
|
+
map: /*#__PURE__*/_jsx(MapBox, {
|
|
153
144
|
clusterRadius: clusterRadius,
|
|
154
|
-
containerId: mapContainerId
|
|
145
|
+
containerId: mapContainerId ?? 'map-container',
|
|
155
146
|
controlBottomLeft: controlBottomLeft,
|
|
156
147
|
controlTopRight: controlTopRight,
|
|
157
148
|
cursorInteract: cursorInteract,
|
|
@@ -165,7 +156,7 @@ const MapComponent = props => {
|
|
|
165
156
|
highlightGroups: highlightGroups,
|
|
166
157
|
initialViewState: mapViewState,
|
|
167
158
|
layers: layers,
|
|
168
|
-
mapId: mapId
|
|
159
|
+
mapId: mapId ?? 'mapId',
|
|
169
160
|
mapImageUrls: mapImageUrls,
|
|
170
161
|
mapViewStyle: mapViewStyle,
|
|
171
162
|
markerGroups: markerGroups,
|
|
@@ -173,16 +164,17 @@ const MapComponent = props => {
|
|
|
173
164
|
setMapViewStyle: setMapViewStyle,
|
|
174
165
|
token: token
|
|
175
166
|
}),
|
|
176
|
-
drawer: /*#__PURE__*/
|
|
177
|
-
open: drawerOpen
|
|
178
|
-
onClose: () => setDrawerOpen
|
|
179
|
-
size: drawerSize
|
|
180
|
-
title: drawerTitle
|
|
181
|
-
|
|
167
|
+
drawer: /*#__PURE__*/_jsx(MapDrawer, {
|
|
168
|
+
open: drawerOpen ?? false,
|
|
169
|
+
onClose: () => setDrawerOpen?.(false),
|
|
170
|
+
size: drawerSize ?? 'small',
|
|
171
|
+
title: drawerTitle ?? '',
|
|
172
|
+
children: drawerChildren
|
|
173
|
+
}),
|
|
182
174
|
drawerOpen: drawerOpen,
|
|
183
|
-
legend: !hideLegend && legends && /*#__PURE__*/
|
|
175
|
+
legend: !hideLegend && legends && /*#__PURE__*/_jsx(MapLegend, {
|
|
184
176
|
legends: legends
|
|
185
177
|
})
|
|
186
178
|
});
|
|
187
179
|
};
|
|
188
|
-
|
|
180
|
+
export default MapComponent;
|
package/components/Map/types.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.stylesUrl = exports.MapViewStyles = void 0;
|
|
7
1
|
/**
|
|
8
2
|
* Properties class for GeoJson, with a few reserved object defined.
|
|
9
3
|
*/
|
|
@@ -14,8 +8,8 @@ exports.stylesUrl = exports.MapViewStyles = void 0;
|
|
|
14
8
|
|
|
15
9
|
// Additional shading/annotations for map entities
|
|
16
10
|
|
|
17
|
-
const MapViewStyles =
|
|
18
|
-
const stylesUrl =
|
|
11
|
+
export const MapViewStyles = ['Outdoors', 'Satellite', 'Light', 'Dark', 'Streets'];
|
|
12
|
+
export const stylesUrl = {
|
|
19
13
|
Outdoors: 'mapbox://styles/mapbox/outdoors-v12?optimize=true',
|
|
20
14
|
Satellite: 'mapbox://styles/mapbox/satellite-streets-v12?optimize=true',
|
|
21
15
|
Streets: 'mapbox://styles/mapbox/streets-v12?optimize=true',
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useMaintainLayerOrder = void 0;
|
|
7
|
-
var _react = require("react");
|
|
1
|
+
import { useEffect } from 'react';
|
|
8
2
|
/**
|
|
9
3
|
* Ensures that all given layers maintain strict order in the Mapbox layer stack.
|
|
10
4
|
*/
|
|
11
|
-
const useMaintainLayerOrder = (mapRef, orderedLayerIds) => {
|
|
12
|
-
|
|
5
|
+
export const useMaintainLayerOrder = (mapRef, orderedLayerIds) => {
|
|
6
|
+
useEffect(() => {
|
|
13
7
|
const map = mapRef.current;
|
|
14
8
|
if (!map) {
|
|
15
9
|
return;
|
|
@@ -28,5 +22,4 @@ const useMaintainLayerOrder = (mapRef, orderedLayerIds) => {
|
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
24
|
}, [mapRef, orderedLayerIds]);
|
|
31
|
-
};
|
|
32
|
-
exports.useMaintainLayerOrder = useMaintainLayerOrder;
|
|
25
|
+
};
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const Markdown = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
value
|
|
14
|
-
} = _ref;
|
|
15
|
-
const [html, setHtml] = (0, _react.useState)();
|
|
16
|
-
const parseValue = (0, _react.useCallback)(async _value => {
|
|
17
|
-
const _html = await _marked.marked.parse(_value);
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { marked } from 'marked';
|
|
3
|
+
import './styles.scss';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const Markdown = ({
|
|
6
|
+
value
|
|
7
|
+
}) => {
|
|
8
|
+
const [html, setHtml] = useState();
|
|
9
|
+
const parseValue = useCallback(async _value => {
|
|
10
|
+
const _html = await marked.parse(_value);
|
|
18
11
|
setHtml(_html);
|
|
19
12
|
}, []);
|
|
20
|
-
|
|
13
|
+
useEffect(() => {
|
|
21
14
|
void parseValue(value);
|
|
22
15
|
}, [value]);
|
|
23
|
-
return /*#__PURE__*/
|
|
16
|
+
return /*#__PURE__*/_jsx("div", {
|
|
24
17
|
className: "markdown",
|
|
25
18
|
dangerouslySetInnerHTML: {
|
|
26
|
-
__html: html
|
|
19
|
+
__html: html ?? ''
|
|
27
20
|
}
|
|
28
21
|
});
|
|
29
22
|
};
|
|
30
|
-
|
|
23
|
+
export default Markdown;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.default = Message;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _utils = require("../../utils");
|
|
11
|
-
var _Icon = _interopRequireDefault(require("../Icon/Icon"));
|
|
12
|
-
require("./styles.scss");
|
|
13
|
-
function Message(props) {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useDeviceInfo } from '../../utils';
|
|
3
|
+
import Icon from '../Icon/Icon';
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export default function Message(props) {
|
|
14
7
|
const {
|
|
15
8
|
type,
|
|
16
9
|
priority,
|
|
@@ -24,43 +17,58 @@ function Message(props) {
|
|
|
24
17
|
} = props;
|
|
25
18
|
const {
|
|
26
19
|
isMobile
|
|
27
|
-
} =
|
|
28
|
-
return /*#__PURE__*/
|
|
29
|
-
className:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
-
className: "tw-message--container"
|
|
37
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
-
className: "tw-message--main-content"
|
|
39
|
-
}, type === 'page' && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
40
|
-
name: priority,
|
|
41
|
-
className: "main-content--icon"
|
|
42
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
-
className: "tw-message--main-body"
|
|
44
|
-
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className: "tw-message--title-container"
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement("h4", null, title)), typeof body === 'string' ? /*#__PURE__*/_react.default.createElement("p", null, body) : body, type === 'page' && pageButtons && pageButtons.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
47
|
-
className: "tw-message--actions-container"
|
|
48
|
-
}, pageButtons === null || pageButtons === void 0 ? void 0 : pageButtons.map((pageButton, index) => {
|
|
49
|
-
const pageButtonWithKey = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pageButton), {}, {
|
|
50
|
-
key: "page-button-".concat(index),
|
|
51
|
-
props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pageButton.props), {}, {
|
|
52
|
-
size: pageButton.props.size || 'medium'
|
|
20
|
+
} = useDeviceInfo();
|
|
21
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
22
|
+
className: `tw-message tw-message--${type} tw-message--${priority} ${isMobile ? 'tw-message--mobile' : ''}`,
|
|
23
|
+
children: [type === 'toast' && /*#__PURE__*/_jsx("div", {
|
|
24
|
+
className: "tw-message--left-side",
|
|
25
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
26
|
+
name: priority,
|
|
27
|
+
className: "left-side--icon"
|
|
53
28
|
})
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
29
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
30
|
+
className: "tw-message--container",
|
|
31
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
32
|
+
className: "tw-message--main-content",
|
|
33
|
+
children: [type === 'page' && /*#__PURE__*/_jsx(Icon, {
|
|
34
|
+
name: priority,
|
|
35
|
+
className: "main-content--icon"
|
|
36
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
37
|
+
className: "tw-message--main-body",
|
|
38
|
+
children: [title && /*#__PURE__*/_jsx("div", {
|
|
39
|
+
className: "tw-message--title-container",
|
|
40
|
+
children: /*#__PURE__*/_jsx("h4", {
|
|
41
|
+
children: title
|
|
42
|
+
})
|
|
43
|
+
}), typeof body === 'string' ? /*#__PURE__*/_jsx("p", {
|
|
44
|
+
children: body
|
|
45
|
+
}) : body, type === 'page' && pageButtons && pageButtons.length > 0 ? /*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: "tw-message--actions-container",
|
|
47
|
+
children: pageButtons?.map((pageButton, index) => {
|
|
48
|
+
const pageButtonWithKey = {
|
|
49
|
+
...pageButton,
|
|
50
|
+
key: `page-button-${index}`,
|
|
51
|
+
props: {
|
|
52
|
+
...pageButton.props,
|
|
53
|
+
size: pageButton.props.size || 'medium'
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return pageButtonWithKey;
|
|
57
|
+
})
|
|
58
|
+
}) : null]
|
|
59
|
+
})]
|
|
60
|
+
}), type === 'toast' && actionText ? /*#__PURE__*/_jsx("button", {
|
|
61
|
+
onClick: actionHandler,
|
|
62
|
+
className: "tw-message--action-text",
|
|
63
|
+
children: actionText
|
|
64
|
+
}) : showCloseButton ? /*#__PURE__*/_jsx("button", {
|
|
65
|
+
onClick: onClose,
|
|
66
|
+
className: "icon-container",
|
|
67
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
68
|
+
name: "close",
|
|
69
|
+
className: "page-message--close-icon"
|
|
70
|
+
})
|
|
71
|
+
}) : null]
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
66
74
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _react2 = require("@testing-library/react");
|
|
6
|
-
var _ = _interopRequireDefault(require("."));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import MultiSelect from '.';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
5
|
test('show options when placeholder is clicked', () => {
|
|
8
|
-
|
|
6
|
+
render(/*#__PURE__*/_jsx(MultiSelect, {
|
|
9
7
|
onAdd: () => undefined,
|
|
10
8
|
onRemove: () => undefined,
|
|
11
9
|
options: new Map([[1, 'foo'], [2, 'bar'], [3, 'baz']]),
|
|
@@ -15,25 +13,25 @@ test('show options when placeholder is clicked', () => {
|
|
|
15
13
|
}));
|
|
16
14
|
|
|
17
15
|
// we should find the placeholder text
|
|
18
|
-
const placeHolder =
|
|
16
|
+
const placeHolder = screen.getByText('Select...');
|
|
19
17
|
expect(placeHolder).toBeInTheDocument();
|
|
20
18
|
|
|
21
19
|
// we should not find the options yet
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
24
|
-
expect(
|
|
20
|
+
expect(screen.queryByText('foo')).not.toBeInTheDocument();
|
|
21
|
+
expect(screen.queryByText('bar')).not.toBeInTheDocument();
|
|
22
|
+
expect(screen.queryByText('baz')).not.toBeInTheDocument();
|
|
25
23
|
|
|
26
24
|
// click the placeholder
|
|
27
|
-
|
|
25
|
+
fireEvent.click(placeHolder);
|
|
28
26
|
|
|
29
27
|
// now the options should be visible
|
|
30
|
-
expect(
|
|
31
|
-
expect(
|
|
32
|
-
expect(
|
|
28
|
+
expect(screen.queryByText('foo')).toBeInTheDocument();
|
|
29
|
+
expect(screen.queryByText('bar')).toBeInTheDocument();
|
|
30
|
+
expect(screen.queryByText('baz')).toBeInTheDocument();
|
|
33
31
|
});
|
|
34
32
|
test('clicking an option calls the onAdd handler', () => {
|
|
35
33
|
const handleAdd = jest.fn();
|
|
36
|
-
|
|
34
|
+
render(/*#__PURE__*/_jsx(MultiSelect, {
|
|
37
35
|
onAdd: handleAdd,
|
|
38
36
|
onRemove: () => undefined,
|
|
39
37
|
options: new Map([[1, 'foo'], [2, 'bar'], [3, 'baz']]),
|
|
@@ -43,19 +41,19 @@ test('clicking an option calls the onAdd handler', () => {
|
|
|
43
41
|
}));
|
|
44
42
|
|
|
45
43
|
// click the dropdown chevron
|
|
46
|
-
const dropdown =
|
|
47
|
-
|
|
44
|
+
const dropdown = screen.getByLabelText('show-options');
|
|
45
|
+
fireEvent.click(dropdown);
|
|
48
46
|
|
|
49
47
|
// click one of the options
|
|
50
|
-
const option =
|
|
51
|
-
|
|
48
|
+
const option = screen.getByText('bar');
|
|
49
|
+
fireEvent.click(option);
|
|
52
50
|
|
|
53
51
|
// addHandler should have been called with id 2
|
|
54
52
|
expect(handleAdd).toBeCalledWith(2);
|
|
55
53
|
});
|
|
56
54
|
test('clicking the pill remove button calls the onRemove handler', () => {
|
|
57
55
|
const handleRemove = jest.fn();
|
|
58
|
-
|
|
56
|
+
render(/*#__PURE__*/_jsx(MultiSelect, {
|
|
59
57
|
onAdd: () => undefined,
|
|
60
58
|
onRemove: handleRemove,
|
|
61
59
|
options: new Map([[1, 'foo']]),
|
|
@@ -64,11 +62,11 @@ test('clicking the pill remove button calls the onRemove handler', () => {
|
|
|
64
62
|
}));
|
|
65
63
|
|
|
66
64
|
// find a pill with the 'foo' text
|
|
67
|
-
expect(
|
|
65
|
+
expect(screen.queryByText('foo')).toBeInTheDocument();
|
|
68
66
|
|
|
69
67
|
// click the remove button
|
|
70
|
-
const removeButton =
|
|
71
|
-
|
|
68
|
+
const removeButton = screen.getByLabelText('remove');
|
|
69
|
+
fireEvent.click(removeButton);
|
|
72
70
|
|
|
73
71
|
// handleRemove should have been called with id 1
|
|
74
72
|
expect(handleRemove).toBeCalledWith(1);
|