@dynatrace/strato-geo 2.10.2 → 2.12.2

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.
Files changed (118) hide show
  1. package/esm/map/MapView.js +7 -1
  2. package/esm/map/MapView.js.map +2 -2
  3. package/esm/map/components/BubbleLayer/BubbleLayer.js +8 -10
  4. package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
  5. package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js +12 -5
  6. package/esm/map/components/BubbleLayer/BubbleLayerTooltip.js.map +2 -2
  7. package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +32 -85
  8. package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
  9. package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +12 -5
  10. package/esm/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js.map +2 -2
  11. package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +71 -0
  12. package/esm/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js.map +7 -0
  13. package/esm/map/components/ConnectionLayer/ConnectionLayer.js +8 -8
  14. package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
  15. package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +30 -27
  16. package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +2 -2
  17. package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js +11 -6
  18. package/esm/map/components/ConnectionLayer/ConnectionLayerTooltip.js.map +2 -2
  19. package/esm/map/components/ConnectionLayer/utils/restore-null-props.js +1 -1
  20. package/esm/map/components/ConnectionLayer/utils/restore-null-props.js.map +2 -2
  21. package/esm/map/components/DefaultTooltip/DefaultTooltip.js +1 -4
  22. package/esm/map/components/DefaultTooltip/DefaultTooltip.js.map +2 -2
  23. package/esm/map/components/DefaultTooltip/utils/get-default-actions.js +12 -4
  24. package/esm/map/components/DefaultTooltip/utils/get-default-actions.js.map +2 -2
  25. package/esm/map/components/DotLayer/DotLayer.js +50 -52
  26. package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
  27. package/esm/map/components/DotLayer/DotLayerTooltip.js +12 -5
  28. package/esm/map/components/DotLayer/DotLayerTooltip.js.map +2 -2
  29. package/esm/map/components/MapContent.js +6 -6
  30. package/esm/map/components/MapContent.js.map +2 -2
  31. package/esm/map/components/TooltipWrapper.js +26 -0
  32. package/esm/map/components/TooltipWrapper.js.map +7 -0
  33. package/esm/map/components/toolbar/MapToolbar.js +14 -4
  34. package/esm/map/components/toolbar/MapToolbar.js.map +2 -2
  35. package/esm/map/contexts/formatter.context.js.map +2 -2
  36. package/esm/map/contexts/tooltip.context.js +8 -0
  37. package/esm/map/contexts/tooltip.context.js.map +7 -0
  38. package/esm/map/hooks/use-active-interaction.js +24 -0
  39. package/esm/map/hooks/use-active-interaction.js.map +2 -2
  40. package/esm/map/hooks/use-formatter-context.js.map +2 -2
  41. package/esm/map/hooks/use-get-position.js +56 -0
  42. package/esm/map/hooks/use-get-position.js.map +7 -0
  43. package/esm/map/hooks/use-overlay-events.js +10 -20
  44. package/esm/map/hooks/use-overlay-events.js.map +2 -2
  45. package/esm/map/hooks/use-tooltip-event-listeners.js +6 -22
  46. package/esm/map/hooks/use-tooltip-event-listeners.js.map +2 -2
  47. package/esm/map/index.js +2 -0
  48. package/esm/map/index.js.map +2 -2
  49. package/esm/map/slots/DownloadCSV.js +6 -0
  50. package/esm/map/slots/DownloadCSV.js.map +7 -0
  51. package/esm/map/slots/Toolbar.js +6 -0
  52. package/esm/map/slots/Toolbar.js.map +7 -0
  53. package/esm/map/store/map-store.context.js +3 -2
  54. package/esm/map/store/map-store.context.js.map +2 -2
  55. package/esm/map/store/map-store.provider.js +1 -1
  56. package/esm/map/store/map-store.provider.js.map +2 -2
  57. package/esm/map/store/selectors.js +4 -0
  58. package/esm/map/store/selectors.js.map +2 -2
  59. package/esm/map/store/store.js +59 -24
  60. package/esm/map/store/store.js.map +2 -2
  61. package/esm/map/utils/iterate-config-slots.js +21 -1
  62. package/esm/map/utils/iterate-config-slots.js.map +2 -2
  63. package/esm/map/utils/parse-tooltip-data.js +17 -0
  64. package/esm/map/utils/parse-tooltip-data.js.map +3 -3
  65. package/map/MapView.d.ts +12 -0
  66. package/map/MapView.js +7 -1
  67. package/map/components/BubbleLayer/BubbleLayer.js +7 -9
  68. package/map/components/BubbleLayer/BubbleLayerTooltip.d.ts +0 -1
  69. package/map/components/BubbleLayer/BubbleLayerTooltip.js +12 -5
  70. package/map/components/ChoroplethLayer/ChoroplethLayer.js +30 -76
  71. package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.d.ts +0 -1
  72. package/map/components/ChoroplethLayer/ChoroplethLayerTooltip.js +12 -5
  73. package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.d.ts +3 -0
  74. package/map/components/ChoroplethLayer/ChoroplethOutlineLayer.js +82 -0
  75. package/map/components/ConnectionLayer/ConnectionLayer.js +8 -8
  76. package/map/components/ConnectionLayer/ConnectionLayerLine.d.ts +2 -1
  77. package/map/components/ConnectionLayer/ConnectionLayerLine.js +29 -26
  78. package/map/components/ConnectionLayer/ConnectionLayerTooltip.d.ts +1 -2
  79. package/map/components/ConnectionLayer/ConnectionLayerTooltip.js +11 -6
  80. package/map/components/ConnectionLayer/utils/restore-null-props.js +1 -1
  81. package/map/components/DefaultTooltip/DefaultTooltip.js +1 -4
  82. package/map/components/DefaultTooltip/utils/get-default-actions.d.ts +2 -2
  83. package/map/components/DefaultTooltip/utils/get-default-actions.js +12 -4
  84. package/map/components/DotLayer/DotLayer.js +49 -51
  85. package/map/components/DotLayer/DotLayerTooltip.d.ts +0 -1
  86. package/map/components/DotLayer/DotLayerTooltip.js +12 -5
  87. package/map/components/MapContent.js +1 -1
  88. package/map/components/TooltipWrapper.d.ts +4 -0
  89. package/map/components/TooltipWrapper.js +42 -0
  90. package/map/components/toolbar/MapToolbar.js +14 -4
  91. package/map/contexts/formatter.context.d.ts +2 -2
  92. package/map/contexts/tooltip.context.d.ts +3 -0
  93. package/map/contexts/tooltip.context.js +27 -0
  94. package/map/hooks/use-active-interaction.js +24 -0
  95. package/map/hooks/use-formatter-context.d.ts +3 -1
  96. package/map/hooks/use-get-position.d.ts +4 -0
  97. package/map/hooks/use-get-position.js +75 -0
  98. package/map/hooks/use-overlay-events.js +7 -17
  99. package/map/hooks/use-tooltip-event-listeners.js +5 -18
  100. package/map/index.d.ts +2 -1
  101. package/map/index.js +2 -0
  102. package/map/slots/DownloadCSV.d.ts +8 -0
  103. package/map/slots/DownloadCSV.js +25 -0
  104. package/map/slots/Toolbar.d.ts +9 -0
  105. package/map/slots/Toolbar.js +25 -0
  106. package/map/store/map-store.context.d.ts +1 -23
  107. package/map/store/map-store.context.js +3 -2
  108. package/map/store/map-store.provider.js +1 -1
  109. package/map/store/selectors.d.ts +4 -4
  110. package/map/store/selectors.js +4 -0
  111. package/map/store/store.d.ts +5 -3
  112. package/map/store/store.js +59 -24
  113. package/map/types/state.d.ts +3 -4
  114. package/map/types/toolbar.d.ts +14 -11
  115. package/map/utils/iterate-config-slots.js +21 -1
  116. package/map/utils/parse-tooltip-data.d.ts +10 -1
  117. package/map/utils/parse-tooltip-data.js +17 -0
  118. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import type { ToolbarPlacement, ZoomChangeHandler } from '@dynatrace/strato-components-preview/charts';
1
+ import type { ChartToolbarConfig, DraggableToolbarProps, ZoomChangeHandler } from '@dynatrace/strato-components-preview/charts';
2
2
  export type ToolbarInteractionModes = 'zoom' | 'zoom-to-fit' | 'zoom-in' | 'zoom-out' | 'reset' | 'download-data';
3
3
  /**
4
4
  * Props for the ChartInteractions component
@@ -9,16 +9,15 @@ export interface ChartInteractionsProps {
9
9
  onZoomChange?: ZoomChangeHandler;
10
10
  }
11
11
  /** Internal toolbar configuration interface **/
12
- export interface MapToolbarConfig {
13
- /** When enabled show the toolbar in collapsed state */
14
- collapsed?: boolean;
15
- /** When enabled the toolbar can be dragged inside the container */
16
- draggable?: boolean;
17
- /** When enabled it defines the initial placement of the Toolbar */
18
- placement?: ToolbarPlacement;
19
- /** When enabled the toolbar download button will be shown */
20
- downloadData?: boolean;
21
- }
12
+ export type MapToolbarConfig = Omit<ChartToolbarConfig, 'downloadData'> & DraggableToolbarProps & {
13
+ /** When enabled show the download CSV button in the toolbar */
14
+ downloadCSV?: {
15
+ enabled: boolean;
16
+ };
17
+ zoom?: {
18
+ enabled: boolean;
19
+ };
20
+ };
22
21
  /** API config for the chart interactions */
23
22
  export interface ChartInteractionsConfig {
24
23
  /** Handler triggered when there is a change on the time domain caused by a zoom action */
@@ -33,3 +32,7 @@ export interface ChartInteractionsConfig {
33
32
  };
34
33
  }
35
34
  export type A11yToolbarTabIndex = Record<string, number>;
35
+ /** Props for the ChartToolbar implementation in MapView
36
+ * @public
37
+ */
38
+ export type MapToolbarSlotProps = DraggableToolbarProps;
@@ -21,6 +21,7 @@ __export(iterate_config_slots_exports, {
21
21
  iterateConfigSlots: () => iterateConfigSlots
22
22
  });
23
23
  module.exports = __toCommonJS(iterate_config_slots_exports);
24
+ var import_lodash_es = require("lodash");
24
25
  var import_react = require("react");
25
26
  var import_charts = require("@dynatrace/strato-components-preview/charts");
26
27
  var import_constants = require("../constants.js");
@@ -29,8 +30,11 @@ var import_replace_infinite_values_in_ranges = require("./replace-infinite-value
29
30
  var import_BaseLayer = require("../slots/BaseLayer.js");
30
31
  var import_CategoricalLegend = require("../slots/CategoricalLegend.js");
31
32
  var import_ChartInteractions = require("../slots/ChartInteractions.js");
33
+ var import_DownloadCSV = require("../slots/DownloadCSV.js");
32
34
  var import_SequentialLegend = require("../slots/SequentialLegend.js");
33
35
  var import_ThresholdLegend = require("../slots/ThresholdLegend.js");
36
+ var import_Toolbar = require("../slots/Toolbar.js");
37
+ var import_Zoom = require("../slots/Zoom.js");
34
38
  const iterateConfigSlots = (children, legendDomain) => {
35
39
  let slots = {
36
40
  toolbar: void 0,
@@ -38,6 +42,7 @@ const iterateConfigSlots = (children, legendDomain) => {
38
42
  legend: void 0,
39
43
  baseLayer: import_constants.DEFAULT_BASE_LAYER_RULES
40
44
  };
45
+ let slotMapToolbarConfig = {};
41
46
  import_react.Children.forEach(children, (child) => {
42
47
  if ((0, import_is_slot.isSlot)(child, import_ChartInteractions.ChartInteractions)) {
43
48
  const { children: children2, ...previousInteractions } = child.props;
@@ -97,6 +102,18 @@ const iterateConfigSlots = (children, legendDomain) => {
97
102
  ranges
98
103
  }
99
104
  };
105
+ } else if ((0, import_is_slot.isSlot)(child, import_Toolbar.Toolbar)) {
106
+ slotMapToolbarConfig = { ...slotMapToolbarConfig, ...child.props };
107
+ } else if ((0, import_is_slot.isSlot)(child, import_DownloadCSV.DownloadCSV)) {
108
+ slotMapToolbarConfig = {
109
+ ...slotMapToolbarConfig,
110
+ downloadCSV: { enabled: true }
111
+ };
112
+ } else if ((0, import_is_slot.isSlot)(child, import_Zoom.Zoom)) {
113
+ slotMapToolbarConfig = {
114
+ ...slotMapToolbarConfig,
115
+ zoom: { enabled: true }
116
+ };
100
117
  } else if ((0, import_is_slot.isSlot)(child, import_BaseLayer.BaseLayer)) {
101
118
  slots = {
102
119
  ...slots,
@@ -107,6 +124,9 @@ const iterateConfigSlots = (children, legendDomain) => {
107
124
  };
108
125
  }
109
126
  });
127
+ if (!(0, import_lodash_es.isEmpty)(slotMapToolbarConfig)) {
128
+ slots.toolbar = { ...slots.toolbar, ...slotMapToolbarConfig };
129
+ }
110
130
  return slots;
111
131
  };
112
132
  const iterateChartInteractionsSlots = (children) => {
@@ -126,7 +146,7 @@ const iterateChartToolbarSlots = (children) => {
126
146
  if ((0, import_is_slot.isSlot)(childToolbar, import_charts.ChartToolbar.DownloadData)) {
127
147
  toolbar = {
128
148
  ...toolbar,
129
- downloadData: { enabled: true }
149
+ downloadCSV: { enabled: true }
130
150
  };
131
151
  }
132
152
  });
@@ -1,6 +1,15 @@
1
- import type { MapGeoJSONFeature } from 'maplibre-gl';
1
+ import type { MapGeoJSONFeature, MapLayerMouseEvent } from 'maplibre-gl';
2
2
  /**
3
3
  * Extracts useful map features data for the tooltip
4
4
  * @param features - map features
5
5
  */
6
6
  export declare const parseTooltipData: (features: MapGeoJSONFeature[]) => unknown[];
7
+ export declare const extractDataFromEvent: (event: MapLayerMouseEvent) => {
8
+ featureId?: undefined;
9
+ hoveredLayerId?: undefined;
10
+ data?: undefined;
11
+ } | {
12
+ featureId: string;
13
+ hoveredLayerId: string;
14
+ data: unknown[];
15
+ };
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var parse_tooltip_data_exports = {};
20
20
  __export(parse_tooltip_data_exports, {
21
+ extractDataFromEvent: () => extractDataFromEvent,
21
22
  parseTooltipData: () => parseTooltipData
22
23
  });
23
24
  module.exports = __toCommonJS(parse_tooltip_data_exports);
@@ -52,3 +53,19 @@ const parseTooltipData = (features) => {
52
53
  }
53
54
  return data;
54
55
  };
56
+ const extractDataFromEvent = (event) => {
57
+ if (!event.features?.length) {
58
+ return {};
59
+ }
60
+ const feature = event.features[0];
61
+ const hoveredLayerId = feature.layer.id;
62
+ const hoveredFeatures = event.features.filter(
63
+ (feature2) => feature2.layer.id === hoveredLayerId
64
+ );
65
+ const data = parseTooltipData(hoveredFeatures);
66
+ return {
67
+ featureId: `${hoveredLayerId}-${feature.id}`,
68
+ hoveredLayerId,
69
+ data
70
+ };
71
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/strato-geo",
3
- "version": "2.10.2",
3
+ "version": "2.12.2",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -48,7 +48,7 @@
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"
51
+ "maplibre-gl": ">=5.0.0 <5.12.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@dynatrace-sdk/client-classic-environment-v2": "^3.7.3",
@@ -58,10 +58,10 @@
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.13.0",
62
- "@dynatrace/strato-components-preview": "^2.10.2",
61
+ "@dynatrace/strato-components": "^1.14.0",
62
+ "@dynatrace/strato-components-preview": "^2.12.2",
63
63
  "@dynatrace/strato-design-tokens": "^1.2.0",
64
- "@dynatrace/strato-icons": "^1.10.0"
64
+ "@dynatrace/strato-icons": "^1.11.0"
65
65
  },
66
66
  "sideEffects": [
67
67
  "./map/styles/react-mapgl-styles.css",