@dynatrace/strato-geo 2.13.2 → 2.15.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.
@@ -1,4 +1,11 @@
1
- const handleCopyToClipboard = (location) => navigator.clipboard.writeText(`${location.latitude}, ${location.longitude}`);
1
+ const handleCopyToClipboard = async (location) => {
2
+ try {
3
+ await navigator.clipboard.writeText(
4
+ `${location.latitude}, ${location.longitude}`
5
+ );
6
+ } catch {
7
+ }
8
+ };
2
9
  export {
3
10
  handleCopyToClipboard
4
11
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/map/components/DefaultTooltip/utils/handle-copy-to-clipboard.ts"],
4
- "sourcesContent": ["import type { Location } from '../../../types/location.js';\n\nexport const handleCopyToClipboard = (location: Location) =>\n navigator.clipboard.writeText(`${location.latitude}, ${location.longitude}`);\n"],
5
- "mappings": "AAEO,MAAM,wBAAwB,CAAC,aACpC,UAAU,UAAU,UAAU,GAAG,SAAS,QAAQ,KAAK,SAAS,SAAS,EAAE;",
4
+ "sourcesContent": ["import type { Location } from '../../../types/location.js';\n\nexport const handleCopyToClipboard = async (location: Location) => {\n try {\n await navigator.clipboard.writeText(\n `${location.latitude}, ${location.longitude}`,\n );\n } catch {\n // For now, we silently ignore clipboard write errors.\n }\n};\n"],
5
+ "mappings": "AAEO,MAAM,wBAAwB,OAAO,aAAuB;AACjE,MAAI;AACF,UAAM,UAAU,UAAU;AAAA,MACxB,GAAG,SAAS,QAAQ,KAAK,SAAS,SAAS;AAAA,IAC7C;AAAA,EACF,QAAQ;AAAA,EAER;AACF;",
6
6
  "names": []
7
7
  }
@@ -169,6 +169,7 @@ const MapContent = forwardRef((props, forwardedRef) => {
169
169
  setZoomState(zoomState);
170
170
  }
171
171
  };
172
+ const isZoomEnabled = toolbarConfig?.zoom?.enabled !== false;
172
173
  return /* @__PURE__ */ jsx(
173
174
  "div",
174
175
  {
@@ -203,6 +204,10 @@ const MapContent = forwardRef((props, forwardedRef) => {
203
204
  onZoomEnd: handleZoomEnd,
204
205
  onDrag: handleDrag,
205
206
  onDragEnd: handleDragEnd,
207
+ boxZoom: isZoomEnabled,
208
+ keyboard: isZoomEnabled,
209
+ scrollZoom: isZoomEnabled,
210
+ doubleClickZoom: isZoomEnabled,
206
211
  attributionControl: false,
207
212
  onRender: () => onRenderHandler && onRenderHandler(),
208
213
  onLoad: (e) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/components/MapContent.tsx"],
4
- "sourcesContent": ["import {\n Layer,\n type LayerProps,\n Map,\n Source,\n type ViewStateChangeEvent,\n} from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport {\n forwardRef,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport { _useGraphSize as useGraphSize } from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport {\n BASE_LAYER_FILL_ID,\n BASE_LAYER_LINE_ID,\n COUNTRY_BORDER_WIDTH,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n DEFAULT_COUNTRIES_FILL_COLOR,\n MAX_LATITUDE,\n MAX_LONGITUDE,\n MIN_LATITUDE,\n MIN_LONGITUDE,\n REGION_BORDER_WIDTH,\n} from '../constants.js';\nimport { useMapZoomState, useSetStateZoom } from '../store/store.js';\nimport { MapToolbar } from './toolbar/MapToolbar.js';\nimport { LayerIdsContext } from '../contexts/layer-ids.context.js';\nimport { MapDataBoundingBoxContext } from '../contexts/map-data-bounding-box.context.js';\nimport { useActiveInteraction } from '../hooks/use-active-interaction.js';\nimport { useHoverInteraction } from '../hooks/use-hover-interaction.js';\nimport { useMapBaseLayerFeatures } from '../hooks/use-map-base-layer-features.js';\nimport { useMapConfig } from '../hooks/use-map-config.js';\nimport { useMapLoading } from '../hooks/use-map-loading.js';\nimport { useMapPerformance } from '../hooks/use-map-performance.js';\nimport { useOverlayEvents } from '../hooks/use-overlay-events.js';\nimport { useTooltipEventListeners } from '../hooks/use-tooltip-event-listeners.js';\nimport { useWebGLContextError } from '../hooks/use-webgl-context-error.js';\nimport { defaultStyle } from '../map-styles/default-style.js';\nimport { MapViewImperativeHandler } from '../providers/imperative-handler.provider.js';\nimport type {\n MapViewProps,\n MapViewRef,\n ViewStateRequired,\n} from '../types/map-view.js';\nimport { getColorFromToken } from '../utils/get-color-from-token.js';\nimport { getDataLayersBoundingBox } from '../utils/get-data-layers-bounding-box.js';\nimport { toMapBoxInitialViewState } from '../utils/to-mapbox-initial-view-state.js';\nimport { useSetMapInitialConfiguration } from '../utils/use-set-map-initial-configuration.js';\nimport { generateNewZoomState } from './toolbar/utils/zoom-state-utils.js';\n\nconst lineLayer: LayerProps = {\n id: BASE_LAYER_LINE_ID,\n type: 'line',\n};\n\nconst fillLayer: LayerProps = {\n id: BASE_LAYER_FILL_ID,\n type: 'fill',\n};\n\nconst MapSource = () => {\n const baseLayerFeatures = useMapBaseLayerFeatures();\n return (\n baseLayerFeatures && (\n <Source id=\"data\" type=\"geojson\" data={baseLayerFeatures}>\n <Layer\n {...fillLayer}\n paint={{\n 'fill-color': getColorFromToken(DEFAULT_COUNTRIES_FILL_COLOR),\n }}\n />\n <Layer\n {...lineLayer}\n type=\"line\"\n filter={[\n 'any',\n ['==', 'region_type', 'COUNTRY'],\n ['==', 'region_type', 'REGION'],\n ]}\n paint={{\n 'line-color': getColorFromToken(DEFAULT_BOUNDARIES_BORDER_COLOR),\n 'line-width': [\n 'case',\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n </Source>\n )\n );\n};\n\nconst MapInteractions = ({\n children,\n onContextLostError,\n}: PropsWithChildren<{\n onContextLostError?: () => void;\n}>) => {\n const [contextLostError, setContextLostError] = useState<Error | null>(null);\n\n useHoverInteraction();\n useActiveInteraction();\n useWebGLContextError(() => {\n onContextLostError?.();\n setContextLostError(\n new Error(\n 'Too many active maps. This is a browser limitation. Try reducing the number of map instances.',\n ),\n );\n });\n\n if (contextLostError) {\n throw contextLostError;\n }\n\n return children;\n};\ntype MapContentProps = MapViewProps & {\n onMapLoad: () => void;\n};\n\nexport const MapContent = forwardRef<\n MapViewRef,\n PropsWithChildren<MapContentProps>\n>((props, forwardedRef) => {\n const {\n initialViewState: initialViewStateProp,\n children,\n style,\n mapStyle = defaultStyle,\n onViewStateChange,\n onMapLoad,\n onContextLostError,\n ...remaining\n } = props;\n\n const loading = useMapLoading();\n const setZoomState = useSetStateZoom();\n const [savedInitialViewState, setSavedInitialViewState] = useState<\n ViewStateRequired | undefined\n >();\n\n const mapContainerRef = useRef<HTMLDivElement>(null);\n\n const mergedRefs = useMergeRefs<MapViewRef | HTMLDivElement>([\n mapContainerRef,\n forwardedRef,\n ]);\n\n const baseFeatureCollection = useMapBaseLayerFeatures();\n\n const dataLayersBBox = getDataLayersBoundingBox(\n children,\n baseFeatureCollection?.features,\n );\n\n useTooltipEventListeners();\n\n const { toolbar: toolbarConfig, interactions: interactionsConfig } =\n useMapConfig();\n const layerIds = useContext(LayerIdsContext);\n\n const shouldRenderToolbar =\n (!isUndefined(toolbarConfig) && !toolbarConfig.hidden) ||\n !isUndefined(interactionsConfig);\n\n const { height: graphHeight, width: graphWidth } = useGraphSize();\n\n const {\n handleMouseEnter,\n handleMouseMove,\n handleMouseLeave,\n handleMouseClick,\n handleZoom,\n handleDrag,\n } = useOverlayEvents();\n\n const initialViewState = initialViewStateProp ?? dataLayersBBox;\n\n const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);\n const calculatedInitialViewState = toMapBoxInitialViewState(initialViewState);\n\n const { zoomToFitInProgress } = useMapZoomState();\n\n const handleZoomEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n const handleDragEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n return (\n <div\n data-testid=\"map-container\"\n ref={mergedRefs}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Map\n style={{\n width: graphWidth,\n height: `${graphHeight}px`,\n ...style,\n }}\n onMove={(evt) => {\n onViewStateChange?.(evt.viewState);\n }}\n initialViewState={calculatedInitialViewState}\n mapStyle={mapStyle}\n dragRotate={false}\n fadeDuration={0}\n renderWorldCopies={false}\n interactiveLayerIds={layerIds}\n maxBounds={[\n [MIN_LONGITUDE, MIN_LATITUDE],\n [MAX_LONGITUDE, MAX_LATITUDE],\n ]}\n onMouseMove={(e) => handleMouseMove(e as MapLayerMouseEvent)}\n onClick={(e) => handleMouseClick(e as MapLayerMouseEvent)}\n onZoom={handleZoom}\n onZoomEnd={handleZoomEnd}\n onDrag={handleDrag}\n onDragEnd={handleDragEnd}\n attributionControl={false}\n onRender={() => onRenderHandler && onRenderHandler()}\n onLoad={(e) => {\n onMapLoad();\n onLoadHandler && onLoadHandler();\n\n const initialCenter = e.target.getCenter();\n\n setSavedInitialViewState({\n latitude: initialCenter.lat,\n longitude: initialCenter.lng,\n zoom: e.target.getZoom(),\n });\n }}\n ref={useSetMapInitialConfiguration()}\n interactive\n {...remaining}\n >\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapViewImperativeHandler\n forwardedRef={forwardedRef}\n containerRef={mapContainerRef}\n >\n <MapSource />\n {loading ? null : (\n <>\n <MapInteractions onContextLostError={onContextLostError}>\n {children}\n </MapInteractions>\n {shouldRenderToolbar ? <MapToolbar /> : null}\n </>\n )}\n </MapViewImperativeHandler>\n </MapDataBoundingBoxContext.Provider>\n </Map>\n </div>\n );\n});\n\n(MapContent as typeof MapContent & { displayName: string }).displayName =\n 'MapContent';\n"],
5
- "mappings": "AAwEM,SA2MQ,UA1MN,KADF;AAxEN;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,mBAAmB;AAE5B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAMzC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,qCAAqC;AAC9C,SAAS,4BAA4B;AAErC,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,YAAY,MAAM;AACtB,QAAM,oBAAoB,wBAAwB;AAClD,SACE,qBACE,qBAAC,UAAO,IAAG,QAAO,MAAK,WAAU,MAAM,mBACrC;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,OAAO;AAAA,UACL,cAAc,kBAAkB,4BAA4B;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;A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CAAC,MAAM,gBAAgB,CAAuB;AAAA,UAC3D,SAAS,CAAC,MAAM,iBAAiB,CAAuB;AAAA,UACxD,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,oBAAoB;AAAA,UACpB,UAAU,MAAM,mBAAmB,gBAAgB;AAAA,UACnD,QAAQ,CAAC,MAAM;AACb,sBAAU;AACV,6BAAiB,cAAc;AAE/B,kBAAM,gBAAgB,EAAE,OAAO,UAAU;AAEzC,qCAAyB;AAAA,cACvB,UAAU,cAAc;AAAA,cACxB,WAAW,cAAc;AAAA,cACzB,MAAM,EAAE,OAAO,QAAQ;AAAA,YACzB,CAAC;AAAA,UACH;AAAA,UACA,KAAK,8BAA8B;AAAA,UACnC,aAAW;AAAA,UACV,GAAG;AAAA,UAEJ,8BAAC,0BAA0B,UAA1B,EAAmC,OAAO,gBACzC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,cAAc;AAAA,cAEd;AAAA,oCAAC,aAAU;AAAA,gBACV,UAAU,OACT,iCACE;AAAA,sCAAC,mBAAgB,oBACd,UACH;AAAA,kBACC,sBAAsB,oBAAC,cAAW,IAAK;AAAA,mBAC1C;AAAA;AAAA;AAAA,UAEJ,GACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAEA,WAA2D,cAC1D;",
4
+ "sourcesContent": ["import {\n Layer,\n type LayerProps,\n Map,\n Source,\n type ViewStateChangeEvent,\n} from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport {\n forwardRef,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport { _useGraphSize as useGraphSize } from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport {\n BASE_LAYER_FILL_ID,\n BASE_LAYER_LINE_ID,\n COUNTRY_BORDER_WIDTH,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n DEFAULT_COUNTRIES_FILL_COLOR,\n MAX_LATITUDE,\n MAX_LONGITUDE,\n MIN_LATITUDE,\n MIN_LONGITUDE,\n REGION_BORDER_WIDTH,\n} from '../constants.js';\nimport { useMapZoomState, useSetStateZoom } from '../store/store.js';\nimport { MapToolbar } from './toolbar/MapToolbar.js';\nimport { LayerIdsContext } from '../contexts/layer-ids.context.js';\nimport { MapDataBoundingBoxContext } from '../contexts/map-data-bounding-box.context.js';\nimport { useActiveInteraction } from '../hooks/use-active-interaction.js';\nimport { useHoverInteraction } from '../hooks/use-hover-interaction.js';\nimport { useMapBaseLayerFeatures } from '../hooks/use-map-base-layer-features.js';\nimport { useMapConfig } from '../hooks/use-map-config.js';\nimport { useMapLoading } from '../hooks/use-map-loading.js';\nimport { useMapPerformance } from '../hooks/use-map-performance.js';\nimport { useOverlayEvents } from '../hooks/use-overlay-events.js';\nimport { useTooltipEventListeners } from '../hooks/use-tooltip-event-listeners.js';\nimport { useWebGLContextError } from '../hooks/use-webgl-context-error.js';\nimport { defaultStyle } from '../map-styles/default-style.js';\nimport { MapViewImperativeHandler } from '../providers/imperative-handler.provider.js';\nimport type {\n MapViewProps,\n MapViewRef,\n ViewStateRequired,\n} from '../types/map-view.js';\nimport { getColorFromToken } from '../utils/get-color-from-token.js';\nimport { getDataLayersBoundingBox } from '../utils/get-data-layers-bounding-box.js';\nimport { toMapBoxInitialViewState } from '../utils/to-mapbox-initial-view-state.js';\nimport { useSetMapInitialConfiguration } from '../utils/use-set-map-initial-configuration.js';\nimport { generateNewZoomState } from './toolbar/utils/zoom-state-utils.js';\n\nconst lineLayer: LayerProps = {\n id: BASE_LAYER_LINE_ID,\n type: 'line',\n};\n\nconst fillLayer: LayerProps = {\n id: BASE_LAYER_FILL_ID,\n type: 'fill',\n};\n\nconst MapSource = () => {\n const baseLayerFeatures = useMapBaseLayerFeatures();\n return (\n baseLayerFeatures && (\n <Source id=\"data\" type=\"geojson\" data={baseLayerFeatures}>\n <Layer\n {...fillLayer}\n paint={{\n 'fill-color': getColorFromToken(DEFAULT_COUNTRIES_FILL_COLOR),\n }}\n />\n <Layer\n {...lineLayer}\n type=\"line\"\n filter={[\n 'any',\n ['==', 'region_type', 'COUNTRY'],\n ['==', 'region_type', 'REGION'],\n ]}\n paint={{\n 'line-color': getColorFromToken(DEFAULT_BOUNDARIES_BORDER_COLOR),\n 'line-width': [\n 'case',\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n </Source>\n )\n );\n};\n\nconst MapInteractions = ({\n children,\n onContextLostError,\n}: PropsWithChildren<{\n onContextLostError?: () => void;\n}>) => {\n const [contextLostError, setContextLostError] = useState<Error | null>(null);\n\n useHoverInteraction();\n useActiveInteraction();\n useWebGLContextError(() => {\n onContextLostError?.();\n setContextLostError(\n new Error(\n 'Too many active maps. This is a browser limitation. Try reducing the number of map instances.',\n ),\n );\n });\n\n if (contextLostError) {\n throw contextLostError;\n }\n\n return children;\n};\ntype MapContentProps = MapViewProps & {\n onMapLoad: () => void;\n};\n\nexport const MapContent = forwardRef<\n MapViewRef,\n PropsWithChildren<MapContentProps>\n>((props, forwardedRef) => {\n const {\n initialViewState: initialViewStateProp,\n children,\n style,\n mapStyle = defaultStyle,\n onViewStateChange,\n onMapLoad,\n onContextLostError,\n ...remaining\n } = props;\n\n const loading = useMapLoading();\n const setZoomState = useSetStateZoom();\n const [savedInitialViewState, setSavedInitialViewState] = useState<\n ViewStateRequired | undefined\n >();\n\n const mapContainerRef = useRef<HTMLDivElement>(null);\n\n const mergedRefs = useMergeRefs<MapViewRef | HTMLDivElement>([\n mapContainerRef,\n forwardedRef,\n ]);\n\n const baseFeatureCollection = useMapBaseLayerFeatures();\n\n const dataLayersBBox = getDataLayersBoundingBox(\n children,\n baseFeatureCollection?.features,\n );\n\n useTooltipEventListeners();\n\n const { toolbar: toolbarConfig, interactions: interactionsConfig } =\n useMapConfig();\n const layerIds = useContext(LayerIdsContext);\n\n const shouldRenderToolbar =\n (!isUndefined(toolbarConfig) && !toolbarConfig.hidden) ||\n !isUndefined(interactionsConfig);\n\n const { height: graphHeight, width: graphWidth } = useGraphSize();\n\n const {\n handleMouseEnter,\n handleMouseMove,\n handleMouseLeave,\n handleMouseClick,\n handleZoom,\n handleDrag,\n } = useOverlayEvents();\n\n const initialViewState = initialViewStateProp ?? dataLayersBBox;\n\n const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);\n const calculatedInitialViewState = toMapBoxInitialViewState(initialViewState);\n\n const { zoomToFitInProgress } = useMapZoomState();\n\n const handleZoomEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n const handleDragEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n const isZoomEnabled = toolbarConfig?.zoom?.enabled !== false;\n\n return (\n <div\n data-testid=\"map-container\"\n ref={mergedRefs}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Map\n style={{\n width: graphWidth,\n height: `${graphHeight}px`,\n ...style,\n }}\n onMove={(evt) => {\n onViewStateChange?.(evt.viewState);\n }}\n initialViewState={calculatedInitialViewState}\n mapStyle={mapStyle}\n dragRotate={false}\n fadeDuration={0}\n renderWorldCopies={false}\n interactiveLayerIds={layerIds}\n maxBounds={[\n [MIN_LONGITUDE, MIN_LATITUDE],\n [MAX_LONGITUDE, MAX_LATITUDE],\n ]}\n onMouseMove={(e) => handleMouseMove(e as MapLayerMouseEvent)}\n onClick={(e) => handleMouseClick(e as MapLayerMouseEvent)}\n onZoom={handleZoom}\n onZoomEnd={handleZoomEnd}\n onDrag={handleDrag}\n onDragEnd={handleDragEnd}\n boxZoom={isZoomEnabled}\n keyboard={isZoomEnabled}\n scrollZoom={isZoomEnabled}\n doubleClickZoom={isZoomEnabled}\n attributionControl={false}\n onRender={() => onRenderHandler && onRenderHandler()}\n onLoad={(e) => {\n onMapLoad();\n onLoadHandler && onLoadHandler();\n\n const initialCenter = e.target.getCenter();\n\n setSavedInitialViewState({\n latitude: initialCenter.lat,\n longitude: initialCenter.lng,\n zoom: e.target.getZoom(),\n });\n }}\n ref={useSetMapInitialConfiguration()}\n interactive\n {...remaining}\n >\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapViewImperativeHandler\n forwardedRef={forwardedRef}\n containerRef={mapContainerRef}\n >\n <MapSource />\n {loading ? null : (\n <>\n <MapInteractions onContextLostError={onContextLostError}>\n {children}\n </MapInteractions>\n {shouldRenderToolbar ? <MapToolbar /> : null}\n </>\n )}\n </MapViewImperativeHandler>\n </MapDataBoundingBoxContext.Provider>\n </Map>\n </div>\n );\n});\n\n(MapContent as typeof MapContent & { displayName: string }).displayName =\n 'MapContent';\n"],
5
+ "mappings": "AAwEM,SAiNQ,UAhNN,KADF;AAxEN;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,mBAAmB;AAE5B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,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UAEJ,8BAAC,0BAA0B,UAA1B,EAAmC,OAAO,gBACzC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,cAAc;AAAA,cAEd;AAAA,oCAAC,aAAU;AAAA,gBACV,UAAU,OACT,iCACE;AAAA,sCAAC,mBAAgB,oBACd,UACH;AAAA,kBACC,sBAAsB,oBAAC,cAAW,IAAK;AAAA,mBAC1C;AAAA;AAAA;AAAA,UAEJ,GACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAEA,WAA2D,cAC1D;",
6
6
  "names": []
7
7
  }
@@ -15,8 +15,8 @@ const CategoricalLegendRenderer = () => {
15
15
  const orientation = getLegendOrientation(layoutOrientation);
16
16
  const items = buildCategoricalItemsFromScale(scale);
17
17
  const truncationMode = useTruncationMode();
18
- const handleHover = (items2) => {
19
- updateStateSelection({ highlightedSeries: items2 });
18
+ const handleHover = (item) => {
19
+ updateStateSelection({ highlightedSeries: item });
20
20
  };
21
21
  function handleClick(items2) {
22
22
  updateStateSelection({ visible: items2 });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/map/components/legend/CategoricalLegendRenderer.tsx"],
4
- "sourcesContent": ["import type { ScaleOrdinal } from 'd3-scale';\n\nimport type { _LegendItem as LegendItem } from '@dynatrace/strato-components-preview/charts';\nimport {\n _buildCategoricalItemsFromScale as buildCategoricalItemsFromScale,\n _ChartLegend as ChartLegend,\n _getLegendOrientation as getLegendOrientation,\n _useChartLayoutOrientation as useChartLayoutOrientation,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { useColorScale } from '../../hooks/use-color-scale.js';\nimport { useTruncationMode } from '../../hooks/use-truncation-mode.js';\nimport { useSetStateSelection } from '../../store/store.js';\n\nexport const CategoricalLegendRenderer = () => {\n const { orientation: layoutOrientation } = useChartLayoutOrientation();\n const scale = useColorScale() as ScaleOrdinal<string, string>;\n const updateStateSelection = useSetStateSelection();\n const orientation = getLegendOrientation(layoutOrientation);\n const items = buildCategoricalItemsFromScale(scale);\n const truncationMode = useTruncationMode();\n\n const handleHover = (items?: LegendItem[]) => {\n updateStateSelection({ highlightedSeries: items });\n };\n\n function handleClick(items: LegendItem[]) {\n updateStateSelection({ visible: items });\n }\n\n return (\n <ChartLegend\n items={items}\n orientation={orientation}\n onClick={handleClick}\n onHover={handleHover}\n truncationMode={truncationMode}\n />\n );\n};\n"],
5
- "mappings": "AA+BI;AA5BJ;AAAA,EACE,mCAAmC;AAAA,EACnC,gBAAgB;AAAA,EAChB,yBAAyB;AAAA,EACzB,8BAA8B;AAAA,OACzB;AAEP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AAE9B,MAAM,4BAA4B,MAAM;AAC7C,QAAM,EAAE,aAAa,kBAAkB,IAAI,0BAA0B;AACrE,QAAM,QAAQ,cAAc;AAC5B,QAAM,uBAAuB,qBAAqB;AAClD,QAAM,cAAc,qBAAqB,iBAAiB;AAC1D,QAAM,QAAQ,+BAA+B,KAAK;AAClD,QAAM,iBAAiB,kBAAkB;AAEzC,QAAM,cAAc,CAACA,WAAyB;AAC5C,yBAAqB,EAAE,mBAAmBA,OAAM,CAAC;AAAA,EACnD;AAEA,WAAS,YAAYA,QAAqB;AACxC,yBAAqB,EAAE,SAASA,OAAM,CAAC;AAAA,EACzC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["import type { ScaleOrdinal } from 'd3-scale';\n\nimport type { _LegendItem as LegendItem } from '@dynatrace/strato-components-preview/charts';\nimport {\n _buildCategoricalItemsFromScale as buildCategoricalItemsFromScale,\n _ChartLegend as ChartLegend,\n _getLegendOrientation as getLegendOrientation,\n _useChartLayoutOrientation as useChartLayoutOrientation,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { useColorScale } from '../../hooks/use-color-scale.js';\nimport { useTruncationMode } from '../../hooks/use-truncation-mode.js';\nimport { useSetStateSelection } from '../../store/store.js';\n\nexport const CategoricalLegendRenderer = () => {\n const { orientation: layoutOrientation } = useChartLayoutOrientation();\n const scale = useColorScale() as ScaleOrdinal<string, string>;\n const updateStateSelection = useSetStateSelection();\n const orientation = getLegendOrientation(layoutOrientation);\n const items = buildCategoricalItemsFromScale(scale);\n const truncationMode = useTruncationMode();\n\n const handleHover = (item?: LegendItem) => {\n updateStateSelection({ highlightedSeries: item });\n };\n\n function handleClick(items: LegendItem[]) {\n updateStateSelection({ visible: items });\n }\n\n return (\n <ChartLegend\n items={items}\n orientation={orientation}\n onClick={handleClick}\n onHover={handleHover}\n truncationMode={truncationMode}\n />\n );\n};\n"],
5
+ "mappings": "AA+BI;AA5BJ;AAAA,EACE,mCAAmC;AAAA,EACnC,gBAAgB;AAAA,EAChB,yBAAyB;AAAA,EACzB,8BAA8B;AAAA,OACzB;AAEP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AAE9B,MAAM,4BAA4B,MAAM;AAC7C,QAAM,EAAE,aAAa,kBAAkB,IAAI,0BAA0B;AACrE,QAAM,QAAQ,cAAc;AAC5B,QAAM,uBAAuB,qBAAqB;AAClD,QAAM,cAAc,qBAAqB,iBAAiB;AAC1D,QAAM,QAAQ,+BAA+B,KAAK;AAClD,QAAM,iBAAiB,kBAAkB;AAEzC,QAAM,cAAc,CAAC,SAAsB;AACzC,yBAAqB,EAAE,mBAAmB,KAAK,CAAC;AAAA,EAClD;AAEA,WAAS,YAAYA,QAAqB;AACxC,yBAAqB,EAAE,SAASA,OAAM,CAAC;AAAA,EACzC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": ["items"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/contexts/tooltip.context.ts"],
4
- "sourcesContent": ["import { createContext } from 'react';\n\nexport const TooltipContext = createContext<{\n markerRef: React.RefObject<maplibregl.Marker | undefined>;\n}>({\n markerRef: { current: undefined },\n});\n"],
5
- "mappings": "AAAA,SAAS,qBAAqB;AAEvB,MAAM,iBAAiB,cAE3B;AAAA,EACD,WAAW,EAAE,SAAS,OAAU;AAClC,CAAC;",
4
+ "sourcesContent": ["import { createContext, type RefObject } from 'react';\n\nexport const TooltipContext = createContext<{\n markerRef: RefObject<maplibregl.Marker | undefined>;\n}>({\n markerRef: { current: undefined },\n});\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqC;AAEvC,MAAM,iBAAiB,cAE3B;AAAA,EACD,WAAW,EAAE,SAAS,OAAU;AAClC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -29,9 +29,9 @@ const useLegendInteractionHighlighting = (props, sourceId) => {
29
29
  );
30
30
  }
31
31
  if (highlightedSeries) {
32
- const highlightedSeriesNames = highlightedSeries.map((s) => s.name);
32
+ const highlightedSeriesName = highlightedSeries.name;
33
33
  const hoveredByLegend2 = map.querySourceFeatures(sourceId, {
34
- filter: ["!in", props.valueAccessor, ...highlightedSeriesNames]
34
+ filter: ["!in", props.valueAccessor, highlightedSeriesName]
35
35
  });
36
36
  hoveredByLegend2?.map(
37
37
  (ft) => map.setFeatureState(
@@ -42,7 +42,7 @@ const useLegendInteractionHighlighting = (props, sourceId) => {
42
42
  if (hasAssociatedFeatures(sourceId)) {
43
43
  const associatedId = `${sourceId}-direction`;
44
44
  const hoveredByLegend3 = map.querySourceFeatures(associatedId, {
45
- filter: ["!in", props.valueAccessor, ...highlightedSeriesNames]
45
+ filter: ["!in", props.valueAccessor, highlightedSeriesName]
46
46
  });
47
47
  hoveredByLegend3?.map(
48
48
  (ft) => map.setFeatureState(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/hooks/use-legend-interaction-highlighting.ts"],
4
- "sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\n\nimport { useMapSelectionState } from '../store/selectors.js';\nimport type { BubbleLayerProps } from '../types/bubble-layer.js';\nimport type { ChoroplethLayerProps } from '../types/choropleth-layer.js';\nimport { isLegendColoring } from '../types/coloring.js';\nimport type {\n Connection,\n ConnectionLayerProps,\n} from '../types/connection-layer.js';\nimport type { DotLayerProps } from '../types/dot-layer.js';\nimport type { Location } from '../types/location.js';\nimport { hasAssociatedFeatures } from '../utils/associated-features.js';\n\nexport const useLegendInteractionHighlighting = <\n L extends Location,\n C extends Connection,\n R extends Record<string, unknown>,\n>(\n props:\n | DotLayerProps<L>\n | BubbleLayerProps<L>\n | ChoroplethLayerProps<R>\n | ConnectionLayerProps<C>,\n sourceId: string,\n) => {\n const { highlightedSeries } = useMapSelectionState();\n\n const { current: map } = useMap();\n\n if (isLegendColoring(props) && !isUndefined(map)) {\n // Before highlight, we need to remove previous state (all highlighted symbols)\n const hoveredByLegend = map.querySourceFeatures(sourceId, {\n filter: ['all'],\n });\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: sourceId, id: ft.id },\n { legendHover: true },\n ),\n );\n\n if (hasAssociatedFeatures(sourceId)) {\n const associatedId = `${sourceId}-direction`;\n\n const hoveredByLegend = map.querySourceFeatures(associatedId, {\n filter: ['all'],\n });\n\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: associatedId, id: ft.id },\n { legendHover: true },\n ),\n );\n }\n\n if (highlightedSeries) {\n const highlightedSeriesNames = highlightedSeries.map((s) => s.name);\n const hoveredByLegend = map.querySourceFeatures(sourceId, {\n filter: ['!in', props.valueAccessor, ...highlightedSeriesNames],\n });\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: sourceId, id: ft.id },\n { legendHover: false },\n ),\n );\n\n if (hasAssociatedFeatures(sourceId)) {\n const associatedId = `${sourceId}-direction`;\n\n const hoveredByLegend = map.querySourceFeatures(associatedId, {\n filter: ['!in', props.valueAccessor, ...highlightedSeriesNames],\n });\n\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: associatedId, id: ft.id },\n { legendHover: false },\n ),\n );\n }\n } else {\n hoveredByLegend?.map((ft) =>\n map.removeFeatureState({ source: sourceId, id: ft.id }, 'legendHover'),\n );\n }\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAE5B,SAAS,4BAA4B;AAGrC,SAAS,wBAAwB;AAOjC,SAAS,6BAA6B;AAE/B,MAAM,mCAAmC,CAK9C,OAKA,aACG;AACH,QAAM,EAAE,kBAAkB,IAAI,qBAAqB;AAEnD,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAEhC,MAAI,iBAAiB,KAAK,KAAK,CAAC,YAAY,GAAG,GAAG;AAEhD,UAAM,kBAAkB,IAAI,oBAAoB,UAAU;AAAA,MACxD,QAAQ,CAAC,KAAK;AAAA,IAChB,CAAC;AACD,qBAAiB;AAAA,MAAI,CAAC,OACpB,IAAI;AAAA,QACF,EAAE,QAAQ,UAAU,IAAI,GAAG,GAAG;AAAA,QAC9B,EAAE,aAAa,KAAK;AAAA,MACtB;AAAA,IACF;AAEA,QAAI,sBAAsB,QAAQ,GAAG;AACnC,YAAM,eAAe,GAAG,QAAQ;AAEhC,YAAMA,mBAAkB,IAAI,oBAAoB,cAAc;AAAA,QAC5D,QAAQ,CAAC,KAAK;AAAA,MAChB,CAAC;AAED,MAAAA,kBAAiB;AAAA,QAAI,CAAC,OACpB,IAAI;AAAA,UACF,EAAE,QAAQ,cAAc,IAAI,GAAG,GAAG;AAAA,UAClC,EAAE,aAAa,KAAK;AAAA,QACtB;AAAA,MACF;AAAA,IACF;AAEA,QAAI,mBAAmB;AACrB,YAAM,yBAAyB,kBAAkB,IAAI,CAAC,MAAM,EAAE,IAAI;AAClE,YAAMA,mBAAkB,IAAI,oBAAoB,UAAU;AAAA,QACxD,QAAQ,CAAC,OAAO,MAAM,eAAe,GAAG,sBAAsB;AAAA,MAChE,CAAC;AACD,MAAAA,kBAAiB;AAAA,QAAI,CAAC,OACpB,IAAI;AAAA,UACF,EAAE,QAAQ,UAAU,IAAI,GAAG,GAAG;AAAA,UAC9B,EAAE,aAAa,MAAM;AAAA,QACvB;AAAA,MACF;AAEA,UAAI,sBAAsB,QAAQ,GAAG;AACnC,cAAM,eAAe,GAAG,QAAQ;AAEhC,cAAMA,mBAAkB,IAAI,oBAAoB,cAAc;AAAA,UAC5D,QAAQ,CAAC,OAAO,MAAM,eAAe,GAAG,sBAAsB;AAAA,QAChE,CAAC;AAED,QAAAA,kBAAiB;AAAA,UAAI,CAAC,OACpB,IAAI;AAAA,YACF,EAAE,QAAQ,cAAc,IAAI,GAAG,GAAG;AAAA,YAClC,EAAE,aAAa,MAAM;AAAA,UACvB;AAAA,QACF;AAAA,MACF;AAAA,IACF,OAAO;AACL,uBAAiB;AAAA,QAAI,CAAC,OACpB,IAAI,mBAAmB,EAAE,QAAQ,UAAU,IAAI,GAAG,GAAG,GAAG,aAAa;AAAA,MACvE;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\n\nimport { useMapSelectionState } from '../store/selectors.js';\nimport type { BubbleLayerProps } from '../types/bubble-layer.js';\nimport type { ChoroplethLayerProps } from '../types/choropleth-layer.js';\nimport { isLegendColoring } from '../types/coloring.js';\nimport type {\n Connection,\n ConnectionLayerProps,\n} from '../types/connection-layer.js';\nimport type { DotLayerProps } from '../types/dot-layer.js';\nimport type { Location } from '../types/location.js';\nimport { hasAssociatedFeatures } from '../utils/associated-features.js';\n\nexport const useLegendInteractionHighlighting = <\n L extends Location,\n C extends Connection,\n R extends Record<string, unknown>,\n>(\n props:\n | DotLayerProps<L>\n | BubbleLayerProps<L>\n | ChoroplethLayerProps<R>\n | ConnectionLayerProps<C>,\n sourceId: string,\n) => {\n const { highlightedSeries } = useMapSelectionState();\n\n const { current: map } = useMap();\n\n if (isLegendColoring(props) && !isUndefined(map)) {\n // Before highlight, we need to remove previous state (all highlighted symbols)\n const hoveredByLegend = map.querySourceFeatures(sourceId, {\n filter: ['all'],\n });\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: sourceId, id: ft.id },\n { legendHover: true },\n ),\n );\n\n if (hasAssociatedFeatures(sourceId)) {\n const associatedId = `${sourceId}-direction`;\n\n const hoveredByLegend = map.querySourceFeatures(associatedId, {\n filter: ['all'],\n });\n\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: associatedId, id: ft.id },\n { legendHover: true },\n ),\n );\n }\n\n if (highlightedSeries) {\n const highlightedSeriesName = highlightedSeries.name;\n const hoveredByLegend = map.querySourceFeatures(sourceId, {\n filter: ['!in', props.valueAccessor, highlightedSeriesName],\n });\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: sourceId, id: ft.id },\n { legendHover: false },\n ),\n );\n\n if (hasAssociatedFeatures(sourceId)) {\n const associatedId = `${sourceId}-direction`;\n\n const hoveredByLegend = map.querySourceFeatures(associatedId, {\n filter: ['!in', props.valueAccessor, highlightedSeriesName],\n });\n\n hoveredByLegend?.map((ft) =>\n map.setFeatureState(\n { source: associatedId, id: ft.id },\n { legendHover: false },\n ),\n );\n }\n } else {\n hoveredByLegend?.map((ft) =>\n map.removeFeatureState({ source: sourceId, id: ft.id }, 'legendHover'),\n );\n }\n }\n};\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAE5B,SAAS,4BAA4B;AAGrC,SAAS,wBAAwB;AAOjC,SAAS,6BAA6B;AAE/B,MAAM,mCAAmC,CAK9C,OAKA,aACG;AACH,QAAM,EAAE,kBAAkB,IAAI,qBAAqB;AAEnD,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAEhC,MAAI,iBAAiB,KAAK,KAAK,CAAC,YAAY,GAAG,GAAG;AAEhD,UAAM,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;AAAA,QAAI,CAAC,OACpB,IAAI,mBAAmB,EAAE,QAAQ,UAAU,IAAI,GAAG,GAAG,GAAG,aAAa;AAAA,MACvE;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["hoveredByLegend"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/map/index.ts"],
4
- "sourcesContent": ["export { ChartInteractions } from './slots/ChartInteractions.js';\nexport { MapView } from './MapView.js';\nexport { ConnectionLayer } from './slots/ConnectionLayer.js';\nexport { DotLayer } from './slots/DotLayer.js';\nexport { BubbleLayer } from './slots/BubbleLayer.js';\nexport { BaseLayer } from './slots/BaseLayer.js';\nexport { ChoroplethLayer } from './slots/ChoroplethLayer.js';\nexport { Tooltip, TooltipAtoms } from './slots/Tooltip.js';\nexport { DownloadCSV } from './slots/DownloadCSV.js';\n\nexport type {\n MapViewProps,\n MapViewBaseProps,\n MapViewUncontrolledProps,\n MapViewControlledProps,\n DisallowAll,\n ViewState,\n MapViewRef,\n} from './types/map-view.js';\n\nexport type { BaseLayerProps } from './types/base-layer.js';\n\nexport type {\n Connection,\n ConnectionLayerBaseProps,\n ConnectionLayerProps,\n CurvedLine,\n} from './types/connection-layer.js';\n\nexport type { DotLayerBaseProps, DotLayerProps } from './types/dot-layer.js';\n\nexport type {\n BubbleLayerBaseProps,\n BubbleLayerProps,\n ScaleNoneProps,\n ScaleRadiusProps,\n} from './types/bubble-layer.js';\n\nexport type {\n ChoroplethLayerBaseProps,\n ChoroplethLayerProps,\n} from './types/choropleth-layer.js';\n\nexport type { Location } from './types/location.js';\nexport type { MapShape } from './types/shapes.js';\nexport type {\n ChartInteractionsProps,\n MapToolbarSlotProps,\n} from './types/toolbar.js';\nexport type { ErrorStateSlotProps } from './slots/states/ErrorStateSlot.js';\n\nexport type {\n BaseLegendProps,\n CategoricalLegendProps,\n SequentialLegendProps,\n ThresholdLegendProps,\n} from './types/legend.js';\n\nexport type {\n LocationColorProps,\n LegendColorLayerProps,\n ChoroplethCustomColorProps,\n ConnectionColorProps,\n} from './types/coloring.js';\n\nexport { SequentialLegend } from './slots/SequentialLegend.js';\nexport { ThresholdLegend } from './slots/ThresholdLegend.js';\nexport { CategoricalLegend } from './slots/CategoricalLegend.js';\n\nexport type {\n BubbleLayerTooltipHandler,\n BubbleLayerTooltipHandlerProps,\n DotLayerTooltipHandler,\n DotLayerTooltipHandlerProps,\n ConnectionLayerTooltipHandler,\n ConnectionLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandler,\n ChartTooltip,\n DotLayerTooltipData,\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n ChoroplethLayerTooltipData,\n} from './types/tooltip.js';\n\nexport { getAllCountries } from './utils/get-all-countries.js';\n"],
5
- "mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AAyD5B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAkBlC,SAAS,uBAAuB;",
4
+ "sourcesContent": ["/* eslint-disable-next-line @typescript-eslint/no-deprecated */\nexport { ChartInteractions } from './slots/ChartInteractions.js';\nexport { MapView } from './MapView.js';\nexport { ConnectionLayer } from './slots/ConnectionLayer.js';\nexport { DotLayer } from './slots/DotLayer.js';\nexport { BubbleLayer } from './slots/BubbleLayer.js';\nexport { BaseLayer } from './slots/BaseLayer.js';\nexport { ChoroplethLayer } from './slots/ChoroplethLayer.js';\nexport { Tooltip, TooltipAtoms } from './slots/Tooltip.js';\nexport { DownloadCSV } from './slots/DownloadCSV.js';\n\nexport type {\n MapViewProps,\n MapViewBaseProps,\n MapViewUncontrolledProps,\n MapViewControlledProps,\n DisallowAll,\n ViewState,\n MapViewRef,\n} from './types/map-view.js';\n\nexport type { BaseLayerProps } from './types/base-layer.js';\n\nexport type { MapViewZoomSlotProps } from './slots/Zoom.js';\n\nexport type {\n Connection,\n ConnectionLayerBaseProps,\n ConnectionLayerProps,\n CurvedLine,\n} from './types/connection-layer.js';\n\nexport type { DotLayerBaseProps, DotLayerProps } from './types/dot-layer.js';\n\nexport type {\n BubbleLayerBaseProps,\n BubbleLayerProps,\n ScaleNoneProps,\n ScaleRadiusProps,\n} from './types/bubble-layer.js';\n\nexport type {\n ChoroplethLayerBaseProps,\n ChoroplethLayerProps,\n} from './types/choropleth-layer.js';\n\nexport type { Location } from './types/location.js';\nexport type { MapShape } from './types/shapes.js';\nexport type {\n ChartInteractionsProps,\n MapToolbarSlotProps,\n} from './types/toolbar.js';\nexport type { ErrorStateSlotProps } from './slots/states/ErrorStateSlot.js';\n\nexport type {\n BaseLegendProps,\n CategoricalLegendProps,\n SequentialLegendProps,\n ThresholdLegendProps,\n} from './types/legend.js';\n\nexport type {\n LocationColorProps,\n LegendColorLayerProps,\n ChoroplethCustomColorProps,\n ConnectionColorProps,\n} from './types/coloring.js';\n\nexport { SequentialLegend } from './slots/SequentialLegend.js';\nexport { ThresholdLegend } from './slots/ThresholdLegend.js';\nexport { CategoricalLegend } from './slots/CategoricalLegend.js';\n\nexport type {\n BubbleLayerTooltipHandler,\n BubbleLayerTooltipHandlerProps,\n DotLayerTooltipHandler,\n DotLayerTooltipHandlerProps,\n ConnectionLayerTooltipHandler,\n ConnectionLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandlerProps,\n ChoroplethLayerTooltipHandler,\n ChartTooltip,\n DotLayerTooltipData,\n BubbleLayerTooltipData,\n ConnectionLayerTooltipData,\n ChoroplethLayerTooltipData,\n} from './types/tooltip.js';\n\nexport { getAllCountries } from './utils/get-all-countries.js';\n"],
5
+ "mappings": "AACA,SAAS,yBAAyB;AAClC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AA2D5B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAkBlC,SAAS,uBAAuB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/ChartInteractions.tsx"],
4
- "sourcesContent": ["import { type PropsWithChildren } from 'react';\n\nimport { Zoom } from './Zoom.js';\nimport { ZoomToFit } from './ZoomToFit.js';\nimport type { ChartInteractionsProps } from '../types/toolbar.js';\n\n/**\n * ChartInteractions slot component.\n */\nconst ChartInteractionsRoot = (\n props: PropsWithChildren<ChartInteractionsProps>,\n) => null;\n\nChartInteractionsRoot['displayName'] = 'ChartInteractions';\n\n/**\n * ChartInteractions interactions slot component\n * @public\n */\nexport const ChartInteractions = Object.assign(ChartInteractionsRoot, {\n Zoom,\n ZoomToFit,\n});\n"],
5
- "mappings": "AAEA,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAM1B,MAAM,wBAAwB,CAC5B,UACG;AAEL,sBAAsB,aAAa,IAAI;AAMhC,MAAM,oBAAoB,OAAO,OAAO,uBAAuB;AAAA,EACpE;AAAA,EACA;AACF,CAAC;",
4
+ "sourcesContent": ["import { type PropsWithChildren } from 'react';\n\nimport { Zoom } from './Zoom.js';\nimport { ZoomToFit } from './ZoomToFit.js';\nimport type { ChartInteractionsProps } from '../types/toolbar.js';\n\n/**\n * ChartInteractions slot component.\n */\nconst ChartInteractionsRoot = (\n props: PropsWithChildren<ChartInteractionsProps>,\n) => null;\n\nChartInteractionsRoot['displayName'] = 'ChartInteractions';\n\n/**\n * ChartInteractions interactions slot component. @deprecated ChartInteractions is deprecated, please use `<[MapView].Zoom/>` instead.\n * @public\n */\n\nexport const ChartInteractions = Object.assign(ChartInteractionsRoot, {\n Zoom,\n ZoomToFit,\n});\n"],
5
+ "mappings": "AAEA,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAM1B,MAAM,wBAAwB,CAC5B,UACG;AAEL,sBAAsB,aAAa,IAAI;AAOhC,MAAM,oBAAoB,OAAO,OAAO,uBAAuB;AAAA,EACpE;AAAA,EACA;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- const Zoom = () => null;
1
+ const Zoom = (props) => null;
2
2
  Zoom["displayName"] = "Zoom";
3
3
  export {
4
4
  Zoom
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/slots/Zoom.tsx"],
4
- "sourcesContent": ["/**\n * Zoom slot component.\n */\nexport const Zoom = () => null;\n\nZoom['displayName'] = 'Zoom';\n"],
5
- "mappings": "AAGO,MAAM,OAAO,MAAM;AAE1B,KAAK,aAAa,IAAI;",
4
+ "sourcesContent": ["/**\n * Props for the Zoom slot component.\n * @public\n */\nexport interface MapViewZoomSlotProps {\n /**\n * Whether the zoom is disabled.\n */\n disabled?: boolean;\n}\n\n/**\n * Zoom slot component.\n */\nexport const Zoom = (props: MapViewZoomSlotProps) => null;\n\nZoom['displayName'] = 'Zoom';\n"],
5
+ "mappings": "AAcO,MAAM,OAAO,CAAC,UAAgC;AAErD,KAAK,aAAa,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { isEmpty } from "lodash-es";
1
+ import { isEmpty, isUndefined } from "lodash-es";
2
2
  import { Children } from "react";
3
3
  import { ChartToolbar } from "@dynatrace/strato-components-preview/charts";
4
4
  import {
@@ -97,7 +97,7 @@ const iterateConfigSlots = (children, legendDomain) => {
97
97
  } else if (isSlot(child, Zoom)) {
98
98
  slotMapToolbarConfig = {
99
99
  ...slotMapToolbarConfig,
100
- zoom: { enabled: true }
100
+ zoom: { enabled: child.props.disabled !== true }
101
101
  };
102
102
  } else if (isSlot(child, BaseLayer)) {
103
103
  slots = {
@@ -109,6 +109,10 @@ const iterateConfigSlots = (children, legendDomain) => {
109
109
  };
110
110
  }
111
111
  });
112
+ const shouldEnableDefaultZoom = isUndefined(slotMapToolbarConfig.zoom) && !isEmpty(slotMapToolbarConfig) && slots.toolbar?.hidden !== true;
113
+ if (shouldEnableDefaultZoom) {
114
+ slotMapToolbarConfig.zoom = { enabled: true };
115
+ }
112
116
  if (!isEmpty(slotMapToolbarConfig)) {
113
117
  slots.toolbar = { ...slots.toolbar, ...slotMapToolbarConfig };
114
118
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/map/utils/iterate-config-slots.ts"],
4
- "sourcesContent": ["import { isEmpty } from 'lodash-es';\nimport { Children, type ReactNode } from 'react';\n\nimport { ChartToolbar } from '@dynatrace/strato-components-preview/charts';\n\nimport {\n DEFAULT_BASE_LAYER_RULES,\n DEFAULT_MAP_LEGEND_RATIO,\n DEFAULT_MAP_POSITION,\n DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n} from '../constants.js';\nimport { isSlot } from './is-slot.js';\nimport { replaceInfiniteValuesInRanges } from './replace-infinite-values-in-ranges.js';\nimport { BaseLayer } from '../slots/BaseLayer.js';\nimport { CategoricalLegend } from '../slots/CategoricalLegend.js';\nimport { ChartInteractions } from '../slots/ChartInteractions.js';\nimport { DownloadCSV } from '../slots/DownloadCSV.js';\nimport { SequentialLegend } from '../slots/SequentialLegend.js';\nimport { ThresholdLegend } from '../slots/ThresholdLegend.js';\nimport { sanitizeProps, Toolbar } from '../slots/Toolbar.js';\nimport { Zoom } from '../slots/Zoom.js';\nimport type { MapConfig } from '../types/configuration.js';\nimport type {\n ChartInteractionsConfig,\n MapToolbarConfig,\n} from '../types/toolbar.js';\n\n/**\n * Generate map config based on slots\n * @param children - Map children\n * @param legendDomain - Domain containing min and max value relevant for legend\n * @returns Map slot config\n */\nexport const iterateConfigSlots = (\n children: ReactNode,\n legendDomain: [number, number],\n) => {\n let slots: MapConfig = {\n toolbar: undefined,\n interactions: undefined,\n legend: undefined,\n baseLayer: DEFAULT_BASE_LAYER_RULES,\n };\n\n let slotMapToolbarConfig: MapToolbarConfig = {};\n\n Children.forEach(children, (child) => {\n if (isSlot(child, ChartInteractions)) {\n const { children, ...previousInteractions } = child.props;\n\n const interactions = iterateChartInteractionsSlots(children);\n\n slots = {\n ...slots,\n interactions: {\n ...previousInteractions,\n ...interactions,\n },\n };\n } else if (isSlot(child, ChartToolbar)) {\n const { children, ...toolbar } = child.props;\n const childrenToolbar = iterateChartToolbarSlots(children);\n\n slots = {\n ...slots,\n toolbar: {\n ...toolbar,\n ...childrenToolbar,\n },\n };\n } else if (isSlot(child, SequentialLegend)) {\n slots = {\n ...slots,\n legend: {\n type: 'sequential',\n colorPalette: DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n position: DEFAULT_MAP_POSITION,\n ratio: DEFAULT_MAP_LEGEND_RATIO,\n ...child.props,\n min: child.props.min ?? legendDomain[0],\n max: child.props.max ?? legendDomain[1],\n },\n };\n } else if (isSlot(child, CategoricalLegend)) {\n slots = {\n ...slots,\n legend: {\n type: 'categorical',\n position: DEFAULT_MAP_POSITION,\n ...child.props,\n },\n };\n } else if (isSlot(child, ThresholdLegend)) {\n const getDomainValue = (index: number, legendDomainValue: number) =>\n Number.isFinite(legendDomainValue)\n ? legendDomainValue\n : child.props.ranges?.at(index)?.to ?? legendDomainValue;\n\n const ranges = replaceInfiniteValuesInRanges(child.props.ranges, [\n getDomainValue(0, legendDomain[0]),\n getDomainValue(-1, legendDomain[1]),\n ]);\n\n slots = {\n ...slots,\n legend: {\n type: 'threshold',\n position: DEFAULT_MAP_POSITION,\n ratio: DEFAULT_MAP_LEGEND_RATIO,\n ...child.props,\n ranges,\n },\n };\n } else if (isSlot(child, Toolbar)) {\n slotMapToolbarConfig = {\n ...slotMapToolbarConfig,\n ...sanitizeProps(child.props),\n };\n } else if (isSlot(child, DownloadCSV)) {\n slotMapToolbarConfig = {\n ...slotMapToolbarConfig,\n downloadCSV: { enabled: true },\n };\n } else if (isSlot(child, Zoom)) {\n slotMapToolbarConfig = {\n ...slotMapToolbarConfig,\n zoom: { enabled: true },\n };\n } else if (isSlot(child, BaseLayer)) {\n slots = {\n ...slots,\n baseLayer: {\n ...slots.baseLayer,\n ...child.props,\n },\n };\n }\n });\n if (!isEmpty(slotMapToolbarConfig)) {\n slots.toolbar = { ...slots.toolbar, ...slotMapToolbarConfig };\n }\n\n return slots;\n};\n\nconst iterateChartInteractionsSlots = (children: ReactNode) => {\n let interactions: ChartInteractionsConfig = {};\n\n Children.forEach(children, (childInteractions) => {\n if (isSlot(childInteractions, ChartInteractions.Zoom)) {\n interactions = { ...interactions, zoom: { enabled: true } };\n } else if (isSlot(childInteractions, ChartInteractions.ZoomToFit)) {\n interactions = { ...interactions, zoomToFit: { enabled: true } };\n }\n });\n\n return interactions;\n};\n\n/**\n * Generates chart config based on slots\n * @param children - CharInteraction children\n * @returns ChartInteraction slot config\n */\nconst iterateChartToolbarSlots = (children: ReactNode) => {\n let toolbar = {};\n\n Children.forEach(children, (childToolbar) => {\n if (isSlot(childToolbar, ChartToolbar.DownloadData)) {\n toolbar = {\n ...toolbar,\n downloadCSV: { enabled: true },\n };\n }\n });\n\n return toolbar;\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,gBAAgC;AAEzC,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,qCAAqC;AAC9C,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,eAAe,eAAe;AACvC,SAAS,YAAY;AAad,MAAM,qBAAqB,CAChC,UACA,iBACG;AACH,MAAI,QAAmB;AAAA,IACrB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,Q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AG,cAAc,WAAW,EAAE,SAAS,KAAK,EAAE;AAAA,IACjE;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAOA,MAAM,2BAA2B,CAAC,aAAwB;AACxD,MAAI,UAAU,CAAC;AAEf,WAAS,QAAQ,UAAU,CAAC,iBAAiB;AAC3C,QAAI,OAAO,cAAc,aAAa,YAAY,GAAG;AACnD,gBAAU;AAAA,QACR,GAAG;AAAA,QACH,aAAa,EAAE,SAAS,KAAK;AAAA,MAC/B;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
4
+ "sourcesContent": ["import { isEmpty, isUndefined } from 'lodash-es';\nimport { Children, type ReactNode } from 'react';\n\nimport { ChartToolbar } from '@dynatrace/strato-components-preview/charts';\n\nimport {\n DEFAULT_BASE_LAYER_RULES,\n DEFAULT_MAP_LEGEND_RATIO,\n DEFAULT_MAP_POSITION,\n DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n} from '../constants.js';\nimport { isSlot } from './is-slot.js';\nimport { replaceInfiniteValuesInRanges } from './replace-infinite-values-in-ranges.js';\nimport { BaseLayer } from '../slots/BaseLayer.js';\nimport { CategoricalLegend } from '../slots/CategoricalLegend.js';\nimport { ChartInteractions } from '../slots/ChartInteractions.js';\nimport { DownloadCSV } from '../slots/DownloadCSV.js';\nimport { SequentialLegend } from '../slots/SequentialLegend.js';\nimport { ThresholdLegend } from '../slots/ThresholdLegend.js';\nimport { sanitizeProps, Toolbar } from '../slots/Toolbar.js';\nimport { Zoom } from '../slots/Zoom.js';\nimport type { MapConfig } from '../types/configuration.js';\nimport type {\n ChartInteractionsConfig,\n MapToolbarConfig,\n} from '../types/toolbar.js';\n\n/**\n * Generate map config based on slots\n * @param children - Map children\n * @param legendDomain - Domain containing min and max value relevant for legend\n * @returns Map slot config\n */\nexport const iterateConfigSlots = (\n children: ReactNode,\n legendDomain: [number, number],\n) => {\n let slots: MapConfig = {\n toolbar: undefined,\n interactions: undefined,\n legend: undefined,\n baseLayer: DEFAULT_BASE_LAYER_RULES,\n };\n\n let slotMapToolbarConfig: MapToolbarConfig = {};\n\n Children.forEach(children, (child) => {\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n if (isSlot(child, ChartInteractions)) {\n const { children, ...previousInteractions } = child.props;\n\n const interactions = iterateChartInteractionsSlots(children);\n\n slots = {\n ...slots,\n interactions: {\n ...previousInteractions,\n ...interactions,\n },\n };\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n } else if (isSlot(child, ChartToolbar)) {\n const { children, ...toolbar } = child.props;\n const childrenToolbar = iterateChartToolbarSlots(children);\n\n slots = {\n ...slots,\n toolbar: {\n ...toolbar,\n ...childrenToolbar,\n },\n };\n } else if (isSlot(child, SequentialLegend)) {\n slots = {\n ...slots,\n legend: {\n type: 'sequential',\n colorPalette: DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE,\n position: DEFAULT_MAP_POSITION,\n ratio: DEFAULT_MAP_LEGEND_RATIO,\n ...child.props,\n min: child.props.min ?? legendDomain[0],\n max: child.props.max ?? legendDomain[1],\n },\n };\n } else if (isSlot(child, CategoricalLegend)) {\n slots = {\n ...slots,\n legend: {\n type: 'categorical',\n position: DEFAULT_MAP_POSITION,\n ...child.props,\n },\n };\n } else if (isSlot(child, ThresholdLegend)) {\n const getDomainValue = (index: number, legendDomainValue: number) =>\n Number.isFinite(legendDomainValue)\n ? legendDomainValue\n : child.props.ranges?.at(index)?.to ?? legendDomainValue;\n\n const ranges = replaceInfiniteValuesInRanges(child.props.ranges, [\n getDomainValue(0, legendDomain[0]),\n getDomainValue(-1, legendDomain[1]),\n ]);\n\n slots = {\n ...slots,\n legend: {\n type: 'threshold',\n position: DEFAULT_MAP_POSITION,\n ratio: DEFAULT_MAP_LEGEND_RATIO,\n ...child.props,\n ranges,\n },\n };\n } else if (isSlot(child, Toolbar)) {\n slotMapToolbarConfig = {\n ...slotMapToolbarConfig,\n ...sanitizeProps(child.props),\n };\n } else if (isSlot(child, DownloadCSV)) {\n slotMapToolbarConfig = {\n ...slotMapToolbarConfig,\n downloadCSV: { enabled: true },\n };\n } else if (isSlot(child, Zoom)) {\n slotMapToolbarConfig = {\n ...slotMapToolbarConfig,\n zoom: { enabled: child.props.disabled !== true },\n };\n } else if (isSlot(child, BaseLayer)) {\n slots = {\n ...slots,\n baseLayer: {\n ...slots.baseLayer,\n ...child.props,\n },\n };\n }\n });\n\n // Enable zoom by default if toolbar config exists, Zoom is not set, and toolbar is visible\n const shouldEnableDefaultZoom =\n isUndefined(slotMapToolbarConfig.zoom) &&\n !isEmpty(slotMapToolbarConfig) &&\n slots.toolbar?.hidden !== true;\n\n if (shouldEnableDefaultZoom) {\n slotMapToolbarConfig.zoom = { enabled: true };\n }\n\n if (!isEmpty(slotMapToolbarConfig)) {\n slots.toolbar = { ...slots.toolbar, ...slotMapToolbarConfig };\n }\n return slots;\n};\n\nconst iterateChartInteractionsSlots = (children: ReactNode) => {\n let interactions: ChartInteractionsConfig = {};\n\n Children.forEach(children, (childInteractions) => {\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n if (isSlot(childInteractions, ChartInteractions.Zoom)) {\n interactions = { ...interactions, zoom: { enabled: true } };\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n } else if (isSlot(childInteractions, ChartInteractions.ZoomToFit)) {\n interactions = { ...interactions, zoomToFit: { enabled: true } };\n }\n });\n\n return interactions;\n};\n\n/**\n * Generates chart config based on slots\n * @param children - CharInteraction children\n * @returns ChartInteraction slot config\n */\nconst iterateChartToolbarSlots = (children: ReactNode) => {\n let toolbar = {};\n\n Children.forEach(children, (childToolbar) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if (isSlot(childToolbar, ChartToolbar.DownloadData)) {\n toolbar = {\n ...toolbar,\n downloadCSV: { enabled: true },\n };\n }\n });\n\n return toolbar;\n};\n"],
5
+ "mappings": "AAAA,SAAS,SAAS,mBAAmB;AACrC,SAAS,gBAAgC;AAEzC,SAAS,oBAAoB;AAE7B;AA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B,IAAI,KACrC,CAAC,QAAQ,oBAAoB,KAC7B,MAAM,SAAS,WAAW;AAE5B,MAAI,yBAAyB;AAC3B,yBAAqB,OAAO,EAAE,SAAS,KAAK;AAAA,EAC9C;AAEA,MAAI,CAAC,QAAQ,oBAAoB,GAAG;AAClC,UAAM,UAAU,EAAE,GAAG,MAAM,SAAS,GAAG,qBAAqB;AAAA,EAC9D;AACA,SAAO;AACT;AAEA,MAAM,gCAAgC,CAAC,aAAwB;AAC7D,MAAI,eAAwC,CAAC;AAE7C,WAAS,QAAQ,UAAU,CAAC,sBAAsB;AAEhD,QAAI,OAAO,mBAAmB,kBAAkB,IAAI,GAAG;AACrD,qBAAe,EAAE,GAAG,cAAc,MAAM,EAAE,SAAS,KAAK,EAAE;AAAA,IAE5D,WAAW,OAAO,mBAAmB,kBAAkB,SAAS,GAAG;AACjE,qBAAe,EAAE,GAAG,cAAc,WAAW,EAAE,SAAS,KAAK,EAAE;AAAA,IACjE;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAOA,MAAM,2BAA2B,CAAC,aAAwB;AACxD,MAAI,UAAU,CAAC;AAEf,WAAS,QAAQ,UAAU,CAAC,iBAAiB;AAE3C,QAAI,OAAO,cAAc,aAAa,YAAY,GAAG;AACnD,gBAAU;AAAA,QACR,GAAG;AAAA,QACH,aAAa,EAAE,SAAS,KAAK;AAAA,MAC/B;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
6
6
  "names": ["children"]
7
7
  }
package/map/MapView.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare const MapView: ((props: PropsWithChildren<MapViewProps> & import(
16
16
  displayName: string;
17
17
  };
18
18
  Zoom: {
19
- (): null;
19
+ (props: import("./slots/Zoom.js").MapViewZoomSlotProps): null;
20
20
  displayName: string;
21
21
  };
22
22
  };
@@ -21,4 +21,11 @@ __export(handle_copy_to_clipboard_exports, {
21
21
  handleCopyToClipboard: () => handleCopyToClipboard
22
22
  });
23
23
  module.exports = __toCommonJS(handle_copy_to_clipboard_exports);
24
- const handleCopyToClipboard = (location) => navigator.clipboard.writeText(`${location.latitude}, ${location.longitude}`);
24
+ const handleCopyToClipboard = async (location) => {
25
+ try {
26
+ await navigator.clipboard.writeText(
27
+ `${location.latitude}, ${location.longitude}`
28
+ );
29
+ } catch {
30
+ }
31
+ };
@@ -172,6 +172,7 @@ const MapContent = (0, import_react.forwardRef)((props, forwardedRef) => {
172
172
  setZoomState(zoomState);
173
173
  }
174
174
  };
175
+ const isZoomEnabled = toolbarConfig?.zoom?.enabled !== false;
175
176
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
177
  "div",
177
178
  {
@@ -206,6 +207,10 @@ const MapContent = (0, import_react.forwardRef)((props, forwardedRef) => {
206
207
  onZoomEnd: handleZoomEnd,
207
208
  onDrag: handleDrag,
208
209
  onDragEnd: handleDragEnd,
210
+ boxZoom: isZoomEnabled,
211
+ keyboard: isZoomEnabled,
212
+ scrollZoom: isZoomEnabled,
213
+ doubleClickZoom: isZoomEnabled,
209
214
  attributionControl: false,
210
215
  onRender: () => onRenderHandler && onRenderHandler(),
211
216
  onLoad: (e) => {
@@ -33,8 +33,8 @@ const CategoricalLegendRenderer = () => {
33
33
  const orientation = (0, import_charts._getLegendOrientation)(layoutOrientation);
34
34
  const items = (0, import_charts._buildCategoricalItemsFromScale)(scale);
35
35
  const truncationMode = (0, import_use_truncation_mode.useTruncationMode)();
36
- const handleHover = (items2) => {
37
- updateStateSelection({ highlightedSeries: items2 });
36
+ const handleHover = (item) => {
37
+ updateStateSelection({ highlightedSeries: item });
38
38
  };
39
39
  function handleClick(items2) {
40
40
  updateStateSelection({ visible: items2 });
@@ -1,3 +1,4 @@
1
+ import { type RefObject } from 'react';
1
2
  export declare const TooltipContext: import("react").Context<{
2
- markerRef: React.RefObject<maplibregl.Marker | undefined>;
3
+ markerRef: RefObject<maplibregl.Marker | undefined>;
3
4
  }>;
@@ -52,9 +52,9 @@ const useLegendInteractionHighlighting = (props, sourceId) => {
52
52
  );
53
53
  }
54
54
  if (highlightedSeries) {
55
- const highlightedSeriesNames = highlightedSeries.map((s) => s.name);
55
+ const highlightedSeriesName = highlightedSeries.name;
56
56
  const hoveredByLegend2 = map.querySourceFeatures(sourceId, {
57
- filter: ["!in", props.valueAccessor, ...highlightedSeriesNames]
57
+ filter: ["!in", props.valueAccessor, highlightedSeriesName]
58
58
  });
59
59
  hoveredByLegend2?.map(
60
60
  (ft) => map.setFeatureState(
@@ -65,7 +65,7 @@ const useLegendInteractionHighlighting = (props, sourceId) => {
65
65
  if ((0, import_associated_features.hasAssociatedFeatures)(sourceId)) {
66
66
  const associatedId = `${sourceId}-direction`;
67
67
  const hoveredByLegend3 = map.querySourceFeatures(associatedId, {
68
- filter: ["!in", props.valueAccessor, ...highlightedSeriesNames]
68
+ filter: ["!in", props.valueAccessor, highlightedSeriesName]
69
69
  });
70
70
  hoveredByLegend3?.map(
71
71
  (ft) => map.setFeatureState(
package/map/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { Tooltip, TooltipAtoms } from './slots/Tooltip.js';
9
9
  export { DownloadCSV } from './slots/DownloadCSV.js';
10
10
  export type { MapViewProps, MapViewBaseProps, MapViewUncontrolledProps, MapViewControlledProps, DisallowAll, ViewState, MapViewRef, } from './types/map-view.js';
11
11
  export type { BaseLayerProps } from './types/base-layer.js';
12
+ export type { MapViewZoomSlotProps } from './slots/Zoom.js';
12
13
  export type { Connection, ConnectionLayerBaseProps, ConnectionLayerProps, CurvedLine, } from './types/connection-layer.js';
13
14
  export type { DotLayerBaseProps, DotLayerProps } from './types/dot-layer.js';
14
15
  export type { BubbleLayerBaseProps, BubbleLayerProps, ScaleNoneProps, ScaleRadiusProps, } from './types/bubble-layer.js';
@@ -1,7 +1,7 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import type { ChartInteractionsProps } from '../types/toolbar.js';
3
3
  /**
4
- * ChartInteractions interactions slot component
4
+ * ChartInteractions interactions slot component. @deprecated ChartInteractions is deprecated, please use `<[MapView].Zoom/>` instead.
5
5
  * @public
6
6
  */
7
7
  export declare const ChartInteractions: {
@@ -9,7 +9,7 @@ export declare const ChartInteractions: {
9
9
  displayName: string;
10
10
  } & {
11
11
  Zoom: {
12
- (): null;
12
+ (props: import("./Zoom.js").MapViewZoomSlotProps): null;
13
13
  displayName: string;
14
14
  };
15
15
  ZoomToFit: {
@@ -1,7 +1,17 @@
1
+ /**
2
+ * Props for the Zoom slot component.
3
+ * @public
4
+ */
5
+ export interface MapViewZoomSlotProps {
6
+ /**
7
+ * Whether the zoom is disabled.
8
+ */
9
+ disabled?: boolean;
10
+ }
1
11
  /**
2
12
  * Zoom slot component.
3
13
  */
4
14
  export declare const Zoom: {
5
- (): null;
15
+ (props: MapViewZoomSlotProps): null;
6
16
  displayName: string;
7
17
  };
package/map/slots/Zoom.js CHANGED
@@ -21,5 +21,5 @@ __export(Zoom_exports, {
21
21
  Zoom: () => Zoom
22
22
  });
23
23
  module.exports = __toCommonJS(Zoom_exports);
24
- const Zoom = () => null;
24
+ const Zoom = (props) => null;
25
25
  Zoom["displayName"] = "Zoom";
@@ -1,7 +1,7 @@
1
1
  import type { LngLat } from 'maplibre-gl';
2
2
  import type { _LegendItem as LegendItem } from '@dynatrace/strato-components-preview/charts';
3
3
  export interface MapSelectionState {
4
- highlightedSeries: LegendItem[] | undefined;
4
+ highlightedSeries: LegendItem | undefined;
5
5
  visible: LegendItem[] | undefined;
6
6
  }
7
7
  export interface MapTooltipState<T> {
@@ -115,7 +115,7 @@ const iterateConfigSlots = (children, legendDomain) => {
115
115
  } else if ((0, import_is_slot.isSlot)(child, import_Zoom.Zoom)) {
116
116
  slotMapToolbarConfig = {
117
117
  ...slotMapToolbarConfig,
118
- zoom: { enabled: true }
118
+ zoom: { enabled: child.props.disabled !== true }
119
119
  };
120
120
  } else if ((0, import_is_slot.isSlot)(child, import_BaseLayer.BaseLayer)) {
121
121
  slots = {
@@ -127,6 +127,10 @@ const iterateConfigSlots = (children, legendDomain) => {
127
127
  };
128
128
  }
129
129
  });
130
+ const shouldEnableDefaultZoom = (0, import_lodash_es.isUndefined)(slotMapToolbarConfig.zoom) && !(0, import_lodash_es.isEmpty)(slotMapToolbarConfig) && slots.toolbar?.hidden !== true;
131
+ if (shouldEnableDefaultZoom) {
132
+ slotMapToolbarConfig.zoom = { enabled: true };
133
+ }
130
134
  if (!(0, import_lodash_es.isEmpty)(slotMapToolbarConfig)) {
131
135
  slots.toolbar = { ...slots.toolbar, ...slotMapToolbarConfig };
132
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/strato-geo",
3
- "version": "2.13.2",
3
+ "version": "2.15.1",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -42,26 +42,26 @@
42
42
  "@turf/midpoint": "^6.5.0",
43
43
  "@turf/projection": "^6.5.0",
44
44
  "@turf/rhumb-bearing": "^6.5.0",
45
- "@vanilla-extract/css": "^1.17.4",
45
+ "@vanilla-extract/css": "^1.18.0",
46
46
  "@vanilla-extract/recipes": "^0.5.7",
47
47
  "@vis.gl/react-maplibre": "^8.0.0",
48
48
  "d3-array": "^3.2.4",
49
49
  "d3-interpolate": "^3.0.1",
50
50
  "d3-scale": "^4.0.2",
51
- "maplibre-gl": ">=5.0.0 <5.12.0"
51
+ "maplibre-gl": "~5.16.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "@dynatrace-sdk/client-classic-environment-v2": "^3.7.3",
54
+ "@dynatrace-sdk/client-classic-environment-v2": "^3.7.3 || ^4.0.0 || ^5.0.0",
55
55
  "@dynatrace-sdk/client-platform-management-service": "^1.7.0",
56
56
  "@dynatrace-sdk/units": "^1.3.1",
57
57
  "react": "^18.0.0",
58
58
  "react-dom": "^18.0.0",
59
59
  "react-intl": "^6.0.8 || ^7.0.0",
60
60
  "react-is": "^18.0.0",
61
- "@dynatrace/strato-components": "^1.15.0",
62
- "@dynatrace/strato-components-preview": "^2.13.2",
63
- "@dynatrace/strato-design-tokens": "^1.3.0",
64
- "@dynatrace/strato-icons": "^1.11.1"
61
+ "@dynatrace/strato-components": "^1.16.1",
62
+ "@dynatrace/strato-components-preview": "^2.15.1",
63
+ "@dynatrace/strato-design-tokens": "^1.3.1",
64
+ "@dynatrace/strato-icons": "^1.12.0"
65
65
  },
66
66
  "sideEffects": [
67
67
  "./map/styles/react-mapgl-styles.css",