@dynatrace/strato-geo 1.0.3 → 1.2.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.
Files changed (194) hide show
  1. package/esm/index.js.map +2 -2
  2. package/esm/map/MapView.js +14 -10
  3. package/esm/map/MapView.js.map +2 -2
  4. package/esm/map/components/BubbleLayer/BubbleCircleLayer.js +6 -6
  5. package/esm/map/components/BubbleLayer/BubbleCircleLayer.js.map +2 -2
  6. package/esm/map/components/BubbleLayer/BubbleLayer.js +1 -1
  7. package/esm/map/components/BubbleLayer/BubbleLayer.js.map +2 -2
  8. package/esm/map/components/BubbleLayer/BubbleOutlineLayer.js +1 -1
  9. package/esm/map/components/BubbleLayer/BubbleOutlineLayer.js.map +2 -2
  10. package/esm/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.js.map +2 -2
  11. package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js +47 -24
  12. package/esm/map/components/ChoroplethLayer/ChoroplethLayer.js.map +2 -2
  13. package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +2 -1
  14. package/esm/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js.map +2 -2
  15. package/esm/map/components/ConnectionLayer/ConnectionLayer.js +30 -48
  16. package/esm/map/components/ConnectionLayer/ConnectionLayer.js.map +2 -2
  17. package/esm/map/components/ConnectionLayer/ConnectionLayerDirection.js +10 -3
  18. package/esm/map/components/ConnectionLayer/ConnectionLayerDirection.js.map +2 -2
  19. package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js +44 -0
  20. package/esm/map/components/ConnectionLayer/ConnectionLayerLine.js.map +7 -0
  21. package/esm/map/components/ConnectionLayer/utils/{get-arc-line-features.js → get-arc-line-feature.js} +4 -8
  22. package/esm/map/components/ConnectionLayer/utils/{get-arc-line-features.js.map → get-arc-line-feature.js.map} +3 -3
  23. package/esm/map/components/ConnectionLayer/utils/get-straight-line-feature.js +11 -0
  24. package/esm/map/components/ConnectionLayer/utils/get-straight-line-feature.js.map +7 -0
  25. package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +24 -19
  26. package/esm/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js.map +2 -2
  27. package/esm/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.js.map +1 -1
  28. package/esm/map/components/DotLayer/BackgroundLayer.js +1 -1
  29. package/esm/map/components/DotLayer/BackgroundLayer.js.map +2 -2
  30. package/esm/map/components/DotLayer/DotLayer.js +5 -5
  31. package/esm/map/components/DotLayer/DotLayer.js.map +2 -2
  32. package/esm/map/components/DotLayer/utils/parse-dot-data-to-geo-json.js.map +2 -2
  33. package/esm/map/components/MapContent.js +33 -7
  34. package/esm/map/components/MapContent.js.map +2 -2
  35. package/esm/map/components/MapUnavailable.js +2 -2
  36. package/esm/map/components/MapUnavailable.js.map +2 -2
  37. package/esm/map/components/toolbar/buttons/MapResetButton.js +1 -1
  38. package/esm/map/components/toolbar/buttons/MapResetButton.js.map +2 -2
  39. package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js +1 -1
  40. package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js.map +2 -2
  41. package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js +1 -1
  42. package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js.map +2 -2
  43. package/esm/map/constants.js +23 -17
  44. package/esm/map/constants.js.map +2 -2
  45. package/esm/map/contexts/map-data-bounding-box.context.js +2 -2
  46. package/esm/map/contexts/map-data-bounding-box.context.js.map +2 -2
  47. package/esm/map/hooks/use-active-interaction.js +14 -1
  48. package/esm/map/hooks/use-active-interaction.js.map +2 -2
  49. package/esm/map/hooks/use-attach-image-from-icon.js +4 -1
  50. package/esm/map/hooks/use-attach-image-from-icon.js.map +2 -2
  51. package/esm/map/hooks/use-attach-symbol-to-map.js +2 -2
  52. package/esm/map/hooks/use-attach-symbol-to-map.js.map +2 -2
  53. package/esm/map/hooks/use-hover-interaction.js +1 -1
  54. package/esm/map/hooks/use-hover-interaction.js.map +2 -2
  55. package/esm/map/hooks/use-legend-interaction-highlighting.js +30 -1
  56. package/esm/map/hooks/use-legend-interaction-highlighting.js.map +2 -2
  57. package/esm/map/hooks/use-legend-interaction-visibility.js +10 -1
  58. package/esm/map/hooks/use-legend-interaction-visibility.js.map +2 -2
  59. package/esm/map/hooks/use-load-map-base-layer.js +4 -4
  60. package/esm/map/hooks/use-load-map-base-layer.js.map +2 -2
  61. package/esm/map/hooks/use-map-mouse-move.js +1 -1
  62. package/esm/map/hooks/use-map-mouse-move.js.map +2 -2
  63. package/esm/map/hooks/use-resolve-color.js +4 -0
  64. package/esm/map/hooks/use-resolve-color.js.map +2 -2
  65. package/esm/map/providers/imperative-handler.provider.js +1 -1
  66. package/esm/map/providers/imperative-handler.provider.js.map +2 -2
  67. package/esm/map/providers/map-initial-view.provider.js +1 -1
  68. package/esm/map/providers/map-initial-view.provider.js.map +2 -2
  69. package/esm/map/slots/BaseLayer.js.map +2 -2
  70. package/esm/map/slots/BubbleLayer.js.map +2 -2
  71. package/esm/map/slots/CategoricalLegend.js.map +2 -2
  72. package/esm/map/slots/ChartInteractions.js +3 -3
  73. package/esm/map/slots/ChartInteractions.js.map +2 -2
  74. package/esm/map/slots/ChoroplethLayer.js.map +2 -2
  75. package/esm/map/slots/ConnectionLayer.js.map +2 -2
  76. package/esm/map/slots/DotLayer.js.map +2 -2
  77. package/esm/map/slots/SequentialLegend.js.map +2 -2
  78. package/esm/map/slots/ThresholdLegend.js.map +2 -2
  79. package/esm/map/slots/states/ErrorStateSlot.js.map +2 -2
  80. package/esm/map/types/bubble-layer.js.map +2 -2
  81. package/esm/map/types/coloring.js.map +2 -2
  82. package/esm/map/utils/attach-image-from-shape.js +3 -0
  83. package/esm/map/utils/attach-image-from-shape.js.map +2 -2
  84. package/esm/map/utils/attach-image-from-string.js.map +1 -1
  85. package/esm/map/utils/attach-image-from-text.js.map +1 -1
  86. package/esm/map/utils/attach-image-to-map.js +12 -5
  87. package/esm/map/utils/attach-image-to-map.js.map +2 -2
  88. package/esm/map/utils/build-scale-from-legend-config.js +5 -1
  89. package/esm/map/utils/build-scale-from-legend-config.js.map +2 -2
  90. package/esm/map/utils/create-categorical-color-scheme-from-custom-color-object.js +17 -0
  91. package/esm/map/utils/create-categorical-color-scheme-from-custom-color-object.js.map +7 -0
  92. package/esm/map/utils/extract-layers-data.js +50 -13
  93. package/esm/map/utils/extract-layers-data.js.map +2 -2
  94. package/esm/map/utils/iterate-config-slots.js +4 -2
  95. package/esm/map/utils/iterate-config-slots.js.map +2 -2
  96. package/esm/map/utils/set-layers-id.js +12 -4
  97. package/esm/map/utils/set-layers-id.js.map +2 -2
  98. package/esm/map/utils/tooltip-type-guards.js +1 -1
  99. package/esm/map/utils/tooltip-type-guards.js.map +2 -2
  100. package/esm/map/utils/use-set-map-initial-configuration.js.map +2 -2
  101. package/index.d.ts +2 -2
  102. package/map/MapView.d.ts +1 -1
  103. package/map/MapView.js +13 -9
  104. package/map/components/BubbleLayer/BubbleCircleLayer.js +5 -5
  105. package/map/components/BubbleLayer/BubbleLayer.js +2 -2
  106. package/map/components/BubbleLayer/BubbleOutlineLayer.js +2 -2
  107. package/map/components/BubbleLayer/utils/parse-bubble-data-to-geo-json.d.ts +2 -18
  108. package/map/components/ChoroplethLayer/ChoroplethLayer.d.ts +1 -1
  109. package/map/components/ChoroplethLayer/ChoroplethLayer.js +42 -22
  110. package/map/components/ChoroplethLayer/utils/parse-region-data-to-geo-json.js +2 -1
  111. package/map/components/ConnectionLayer/ConnectionLayer.d.ts +2 -2
  112. package/map/components/ConnectionLayer/ConnectionLayer.js +29 -41
  113. package/map/components/ConnectionLayer/ConnectionLayerDirection.d.ts +1 -1
  114. package/map/components/ConnectionLayer/ConnectionLayerDirection.js +9 -4
  115. package/map/components/ConnectionLayer/ConnectionLayerLine.d.ts +12 -0
  116. package/map/components/ConnectionLayer/ConnectionLayerLine.js +66 -0
  117. package/map/components/ConnectionLayer/utils/{get-arc-line-features.d.ts → get-arc-line-feature.d.ts} +1 -1
  118. package/map/components/ConnectionLayer/utils/{get-arc-line-features.js → get-arc-line-feature.js} +6 -10
  119. package/map/components/ConnectionLayer/utils/{get-straight-line-features.d.ts → get-straight-line-feature.d.ts} +1 -1
  120. package/map/components/ConnectionLayer/utils/{get-straight-line-features.js → get-straight-line-feature.js} +6 -7
  121. package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.d.ts +1 -1
  122. package/map/components/ConnectionLayer/utils/parse-connection-data-to-geo-json.js +24 -19
  123. package/map/components/ConnectionLayer/utils/parse-direction-data-to-geo-json.d.ts +1 -1
  124. package/map/components/DotLayer/BackgroundLayer.js +2 -2
  125. package/map/components/DotLayer/DotLayer.js +5 -5
  126. package/map/components/DotLayer/utils/parse-dot-data-to-geo-json.d.ts +2 -19
  127. package/map/components/MapContent.d.ts +5 -1
  128. package/map/components/MapContent.js +28 -8
  129. package/map/components/MapUnavailable.d.ts +2 -2
  130. package/map/components/MapUnavailable.js +2 -2
  131. package/map/components/toolbar/buttons/MapResetButton.js +2 -2
  132. package/map/components/toolbar/buttons/MapZoomInOutButtons.js +2 -2
  133. package/map/components/toolbar/buttons/MapZoomToFitButton.js +2 -2
  134. package/map/constants.d.ts +13 -10
  135. package/map/constants.js +23 -17
  136. package/map/contexts/map-data-bounding-box.context.js +1 -1
  137. package/map/hooks/use-active-interaction.js +15 -2
  138. package/map/hooks/use-attach-image-from-icon.js +5 -2
  139. package/map/hooks/use-attach-symbol-to-map.js +2 -2
  140. package/map/hooks/use-hover-interaction.js +2 -2
  141. package/map/hooks/use-legend-interaction-highlighting.d.ts +2 -1
  142. package/map/hooks/use-legend-interaction-highlighting.js +31 -2
  143. package/map/hooks/use-legend-interaction-visibility.d.ts +2 -1
  144. package/map/hooks/use-legend-interaction-visibility.js +11 -2
  145. package/map/hooks/use-load-map-base-layer.d.ts +1 -1
  146. package/map/hooks/use-load-map-base-layer.js +4 -4
  147. package/map/hooks/use-map-mouse-move.js +2 -2
  148. package/map/hooks/use-resolve-color.d.ts +4 -2
  149. package/map/hooks/use-resolve-color.js +4 -0
  150. package/map/providers/imperative-handler.provider.js +2 -2
  151. package/map/providers/map-initial-view.provider.js +2 -2
  152. package/map/slots/BaseLayer.d.ts +4 -1
  153. package/map/slots/BubbleLayer.d.ts +1 -0
  154. package/map/slots/CategoricalLegend.d.ts +4 -1
  155. package/map/slots/ChartInteractions.d.ts +4 -1
  156. package/map/slots/ChartInteractions.js +3 -3
  157. package/map/slots/ChoroplethLayer.d.ts +1 -0
  158. package/map/slots/ConnectionLayer.d.ts +2 -1
  159. package/map/slots/DotLayer.d.ts +1 -0
  160. package/map/slots/SequentialLegend.d.ts +4 -1
  161. package/map/slots/ThresholdLegend.d.ts +4 -1
  162. package/map/slots/states/ErrorStateSlot.d.ts +6 -0
  163. package/map/types/base-layer.d.ts +4 -0
  164. package/map/types/bubble-layer.d.ts +4 -0
  165. package/map/types/choropleth-layer.d.ts +2 -0
  166. package/map/types/coloring.d.ts +16 -0
  167. package/map/types/connection-layer.d.ts +11 -7
  168. package/map/types/dot-layer.d.ts +2 -0
  169. package/map/types/legend.d.ts +18 -6
  170. package/map/types/location.d.ts +4 -1
  171. package/map/types/map-view.d.ts +10 -1
  172. package/map/types/shapes.d.ts +5 -1
  173. package/map/types/toolbar.d.ts +4 -1
  174. package/map/types/tooltip.d.ts +16 -1
  175. package/map/utils/attach-image-from-shape.d.ts +1 -1
  176. package/map/utils/attach-image-from-shape.js +3 -0
  177. package/map/utils/attach-image-from-string.d.ts +1 -1
  178. package/map/utils/attach-image-from-text.d.ts +1 -1
  179. package/map/utils/attach-image-to-map.d.ts +1 -1
  180. package/map/utils/attach-image-to-map.js +12 -5
  181. package/map/utils/build-scale-from-legend-config.js +5 -1
  182. package/map/utils/create-categorical-color-scheme-from-custom-color-object.d.ts +5 -0
  183. package/map/utils/create-categorical-color-scheme-from-custom-color-object.js +35 -0
  184. package/map/utils/extract-layers-data.d.ts +3 -2
  185. package/map/utils/extract-layers-data.js +50 -13
  186. package/map/utils/iterate-config-slots.d.ts +2 -1
  187. package/map/utils/iterate-config-slots.js +4 -2
  188. package/map/utils/set-layers-id.d.ts +1 -1
  189. package/map/utils/set-layers-id.js +12 -4
  190. package/map/utils/tooltip-type-guards.js +1 -1
  191. package/map/utils/use-set-map-initial-configuration.d.ts +1 -1
  192. package/package.json +8 -9
  193. package/esm/map/components/ConnectionLayer/utils/get-straight-line-features.js +0 -12
  194. package/esm/map/components/ConnectionLayer/utils/get-straight-line-features.js.map +0 -7
@@ -7,6 +7,7 @@ import type { Location } from '../types/location.js';
7
7
  * for various shapes, optional features like custom background for icons, rotation,
8
8
  * and tooltips, along with granular color customization and integration with
9
9
  * legends for color configuration.
10
+ * @public
10
11
  */
11
12
  export declare const DotLayer: {
12
13
  <T extends Location>(_: PropsWithChildren<DotLayerProps<T>>): null;
@@ -1,5 +1,8 @@
1
1
  import type { SequentialLegendProps } from '../types/legend.js';
2
- /** The sequential legend slot component */
2
+ /**
3
+ * The sequential legend slot component
4
+ * @public
5
+ */
3
6
  export declare const SequentialLegend: {
4
7
  (props: SequentialLegendProps): null;
5
8
  displayName: string;
@@ -1,5 +1,8 @@
1
1
  import type { ThresholdLegendProps } from '../types/legend.js';
2
- /** The sequential legend slot component */
2
+ /**
3
+ * The sequential legend slot component
4
+ * @public
5
+ */
3
6
  export declare const ThresholdLegend: {
4
7
  (props: ThresholdLegendProps): null;
5
8
  displayName: string;
@@ -1,5 +1,11 @@
1
1
  import type { ReactNode, JSX } from 'react';
2
+ /**
3
+ * @public
4
+ */
2
5
  export interface ErrorStateSlotProps {
3
6
  children: ReactNode | ((errorMessage: string) => JSX.Element);
4
7
  }
8
+ /**
9
+ * @public
10
+ */
5
11
  export declare const ErrorStateSlot: (props: ErrorStateSlotProps) => null;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Type to include or exclude countries to show
3
+ * @public
3
4
  */
4
5
  export interface BaseLayerProps {
5
6
  /** Include countries */
@@ -7,6 +8,9 @@ export interface BaseLayerProps {
7
8
  /** Exclude countries */
8
9
  exclude?: string[];
9
10
  }
11
+ /**
12
+ * @internal
13
+ */
10
14
  export interface BaseLayerRules {
11
15
  exclude: string[];
12
16
  include: string[];
@@ -3,6 +3,7 @@ import type { Location } from './location.js';
3
3
  /**
4
4
  * Base props to configure a BubbleLayer
5
5
  * @typeParam T - Object extending Location
6
+ * @public
6
7
  */
7
8
  export interface BubbleLayerBaseProps<T extends Location> {
8
9
  /**
@@ -20,11 +21,13 @@ export interface BubbleLayerBaseProps<T extends Location> {
20
21
  /**
21
22
  * The BubbleLayer props
22
23
  * @typeParam T - Object extending Location
24
+ * @public
23
25
  */
24
26
  export type BubbleLayerProps<T extends Location> = BubbleLayerBaseProps<T> & (LocationColorProps<T> | LegendColorLayerProps) & (ScaleRadiusProps<T> | ScaleNoneProps<T>);
25
27
  /**
26
28
  * When there's no scale provided, the radius prop is used as radius size in pixels
27
29
  * @typeParam T - Object extending Location
30
+ * @public
28
31
  */
29
32
  export interface ScaleNoneProps<T> {
30
33
  /**
@@ -41,6 +44,7 @@ export interface ScaleNoneProps<T> {
41
44
  /**
42
45
  * When a scale is provided, all the values in the dataset will be scaled to fit between the `radiusRange`.
43
46
  * @typeParam T - Object extending Location
47
+ * @public
44
48
  */
45
49
  export interface ScaleRadiusProps<T extends Location> {
46
50
  /**
@@ -2,6 +2,7 @@ import type { ChoroplethCustomColorProps, LegendColorLayerProps } from './colori
2
2
  /**
3
3
  * Base props to configure a ChoroplethLayer
4
4
  * @typeParam T - Object extending a record of string keys and any type of values
5
+ * @public
5
6
  */
6
7
  export interface ChoroplethLayerBaseProps<T extends Record<string, unknown>> {
7
8
  /**
@@ -17,6 +18,7 @@ export interface ChoroplethLayerBaseProps<T extends Record<string, unknown>> {
17
18
  /**
18
19
  * The ChoroplethLayer props
19
20
  * @typeParam T - Object extending a record of string keys and any type of values
21
+ * @public
20
22
  */
21
23
  export type ChoroplethLayerProps<T extends Record<string, unknown>> = ChoroplethLayerBaseProps<T> & (ChoroplethCustomColorProps<T> | LegendColorLayerProps);
22
24
  /** @internal */
@@ -1,14 +1,29 @@
1
+ import type { Connection } from './connection-layer.js';
1
2
  import type { Location } from './location.js';
2
3
  /**
3
4
  * Props to configure any Layer with custom coloring
4
5
  * @typeParam T - Object extending Location
6
+ * @public
5
7
  */
6
8
  export interface LocationColorProps<T extends Location> {
7
9
  /** Custom color to apply to the layer */
8
10
  color?: string | ((item: T) => string);
9
11
  }
12
+ /**
13
+ * Props to configure a connection Layer with custom coloring
14
+ * @typeParam T - Object extending Connection
15
+ * @public
16
+ */
17
+ export interface ConnectionColorProps<T extends Connection> {
18
+ /**
19
+ * Specifies the color of the connection layer.
20
+ * @defaultValue Colors.Charts.Categorical.Color03.Default
21
+ */
22
+ color?: string | ((connection: T) => string);
23
+ }
10
24
  /**
11
25
  * Props to configure any Layer with legend coloring
26
+ * @public
12
27
  */
13
28
  export interface LegendColorLayerProps {
14
29
  /** When the color prop is set to 'legend', a value accessor is needed */
@@ -19,6 +34,7 @@ export interface LegendColorLayerProps {
19
34
  /**
20
35
  * Props to configure any Layer with custom coloring
21
36
  * @typeParam T - Object extending a record of string keys and any type of values
37
+ * @public
22
38
  */
23
39
  export interface ChoroplethCustomColorProps<T extends Record<string, unknown>> {
24
40
  /** Color to apply to the layer */
@@ -1,19 +1,27 @@
1
1
  import type GeoJSON from 'geojson';
2
+ import type { ConnectionColorProps, LegendColorLayerProps } from './coloring.js';
2
3
  import type { Location } from './location.js';
3
4
  /**
4
5
  * Data type for connections in the Connection Layer.
5
6
  * @typeParam L - Object extending Location.
7
+ * @public
6
8
  */
7
9
  export type Connection = {
8
10
  /** Array of connections */
9
11
  path: Location[];
10
12
  };
13
+ /**
14
+ * The ConnectionLayer props
15
+ * @typeParam T - Object extending Connection
16
+ * @public
17
+ */
18
+ export type ConnectionLayerProps<T extends Connection> = ConnectionLayerBaseProps<T> & (ConnectionColorProps<T> | LegendColorLayerProps);
11
19
  /**
12
20
  * Shape of the Connection Layer Component Props.
13
- * @typeParam L - Object extending Location.
14
21
  * @typeParam T - Object extending Connection<L>.
22
+ * @public
15
23
  */
16
- export interface ConnectionLayerProps<T extends Connection> {
24
+ export interface ConnectionLayerBaseProps<T extends Connection> {
17
25
  /** Set of data related to the connections */
18
26
  data: T[];
19
27
  /**
@@ -30,11 +38,6 @@ export interface ConnectionLayerProps<T extends Connection> {
30
38
  * @defaultValue 'linear'
31
39
  */
32
40
  curve?: CurvedLine;
33
- /**
34
- * Specifies the color of the connection layer.
35
- * @defaultValue Colors.Charts.Categorical.Color03.Default
36
- */
37
- color?: string | ((connection: T) => string);
38
41
  /**
39
42
  * Specifies the thickness of the connection path.
40
43
  * It can accept numbers from 1 to 64 (included).
@@ -60,5 +63,6 @@ export type GeoJSONFeature<T extends GeoJSON.Geometry> = GeoJSON.Feature<T, Feat
60
63
  /**
61
64
  * This property is responsible for setting the curve type
62
65
  * @defaultValue linear
66
+ * @public
63
67
  */
64
68
  export type CurvedLine = 'linear' | 'smooth';
@@ -5,6 +5,7 @@ import type { MapShape } from './shapes.js';
5
5
  /**
6
6
  * Base props to configure a DotLayer.
7
7
  * @typeParam T - Object extending Location
8
+ * @public
8
9
  */
9
10
  export interface DotLayerBaseProps<T extends Location> {
10
11
  /**
@@ -39,6 +40,7 @@ export interface DotLayerBaseProps<T extends Location> {
39
40
  /**
40
41
  * The DotLayer props
41
42
  * @typeParam T - Object extending Location
43
+ * @public
42
44
  */
43
45
  export type DotLayerProps<T extends Location> = DotLayerBaseProps<T> & (LocationColorProps<T> | LegendColorLayerProps);
44
46
  /** @internal */
@@ -1,16 +1,25 @@
1
1
  import type { ColoredRange, ColorPalette, LegendProps } from '@dynatrace/strato-components-preview/charts';
2
- /** The props common to all different legends */
2
+ /**
3
+ * The props common to all different legends
4
+ * @public
5
+ */
3
6
  export type BaseLegendProps = Omit<LegendProps, 'resizable'>;
4
- /** The sequential legend props */
7
+ /**
8
+ * The sequential legend props
9
+ * @public
10
+ */
5
11
  export interface SequentialLegendProps extends BaseLegendProps {
6
12
  /** The min boundary */
7
- min: number;
13
+ min?: number;
8
14
  /** The max boundary */
9
- max: number;
15
+ max?: number;
10
16
  /** The color palette to apply to the legend */
11
17
  colorPalette?: string[] | ColorPalette;
12
18
  }
13
- /** The categorical legend props */
19
+ /**
20
+ * The categorical legend props
21
+ * @public
22
+ */
14
23
  export interface CategoricalLegendProps extends BaseLegendProps {
15
24
  /** Available categories to be shown in the legend */
16
25
  categories?: string[];
@@ -19,7 +28,10 @@ export interface CategoricalLegendProps extends BaseLegendProps {
19
28
  [key: string]: string;
20
29
  };
21
30
  }
22
- /** The threshold legend props */
31
+ /**
32
+ * The threshold legend props
33
+ * @public
34
+ */
23
35
  export interface ThresholdLegendProps extends BaseLegendProps {
24
36
  /** Ranges of the threshold legend */
25
37
  ranges: ColoredRange[];
@@ -1,4 +1,7 @@
1
- /** A coordinate-based location */
1
+ /**
2
+ * A coordinate-based location
3
+ * @public
4
+ */
2
5
  export interface Location {
3
6
  /** The latitude coordinate of the location. */
4
7
  latitude: number;
@@ -5,12 +5,14 @@ import { Formatter } from '@dynatrace/strato-components-preview/charts';
5
5
  import { ConvertibleUnit, FormatOptions, Unit } from '@dynatrace-sdk/units';
6
6
  /**
7
7
  * Type to disallow al props in a given type
8
+ * @public
8
9
  */
9
10
  export type DisallowAll<T> = {
10
11
  [P in keyof T]?: never;
11
12
  };
12
13
  /**
13
14
  * Props to set the initial view state on the map.
15
+ * @public
14
16
  */
15
17
  export interface ViewState {
16
18
  /** Longitude at map center */
@@ -23,6 +25,7 @@ export interface ViewState {
23
25
  /**
24
26
  * Type to use in a controlled Map.
25
27
  * It disallows the initial state and gives the user complete control over the interactions
28
+ * @public
26
29
  */
27
30
  export interface MapViewControlledProps extends ViewState {
28
31
  /**
@@ -33,6 +36,7 @@ export interface MapViewControlledProps extends ViewState {
33
36
  /**
34
37
  * Type to use in an uncontrolled Map.
35
38
  * It allows only setting up an initial state and interactions come out of the box
39
+ * @public
36
40
  */
37
41
  export interface MapViewUncontrolledProps extends DisallowAll<ViewState> {
38
42
  /**
@@ -42,6 +46,7 @@ export interface MapViewUncontrolledProps extends DisallowAll<ViewState> {
42
46
  }
43
47
  /**
44
48
  * Props present in both ways of controlling a Map
49
+ * @public
45
50
  */
46
51
  export interface MapViewBaseProps {
47
52
  /**
@@ -82,9 +87,13 @@ export interface MapViewBaseProps {
82
87
  }
83
88
  /**
84
89
  * Props to configure a Map
90
+ * @public
85
91
  */
86
92
  export type MapViewProps = MapViewBaseProps & (MapViewControlledProps | MapViewUncontrolledProps);
87
- /** The Map component ref */
93
+ /**
94
+ * The Map component ref
95
+ * @public
96
+ */
88
97
  export interface MapViewRef {
89
98
  /** The map component root element */
90
99
  readonly element: HTMLDivElement | null;
@@ -1,3 +1,7 @@
1
- /** Available shapes to be used in the map. */
1
+ /**
2
+ * Available shapes to be used in the map.
3
+ * @public
4
+ */
2
5
  export type MapShape = 'circle' | 'square' | 'diamond' | 'heart' | 'cross' | 'star' | 'triangle' | 'pin';
6
+ /** @internal */
3
7
  export type SymbolType = 'shape' | 'icon' | 'emoji';
@@ -1,6 +1,9 @@
1
1
  import type { ToolbarPlacement, ZoomChangeHandler } from '@dynatrace/strato-components-preview/charts';
2
2
  export type ToolbarInteractionModes = 'zoom' | 'zoom-to-fit' | 'zoom-in' | 'zoom-out' | 'reset' | 'download-data';
3
- /** Props for the ChartInteractions component **/
3
+ /**
4
+ * Props for the ChartInteractions component
5
+ * @public
6
+ */
4
7
  export interface ChartInteractionsProps {
5
8
  /** Callback called when any zoom event has been performed affecting the data timeframe */
6
9
  onZoomChange?: ZoomChangeHandler;
@@ -12,6 +12,7 @@ export type LayerTooltipHandler = DotLayerTooltipHandler | BubbleLayerTooltipHan
12
12
  /**
13
13
  * Dot Tooltip data payload for the tooltip handler callback
14
14
  * @typeParam T - Object extending Location
15
+ * @public
15
16
  */
16
17
  export interface DotLayerTooltipData<T extends Location = Location> {
17
18
  /** The hovered dot color */
@@ -23,11 +24,13 @@ export interface DotLayerTooltipData<T extends Location = Location> {
23
24
  }
24
25
  /**
25
26
  * Dot tooltip handler type
27
+ * @public
26
28
  */
27
29
  export type DotLayerTooltipHandler = (dotData: DotLayerTooltipData) => React.ReactNode | null;
28
30
  /**
29
31
  * Dot tooltip handler type
30
32
  * @typeParam T - Object extending Location
33
+ * @public
31
34
  */
32
35
  export interface DotLayerTooltipHandlerProps {
33
36
  /** The DotLayer tooltip handler template */
@@ -36,6 +39,7 @@ export interface DotLayerTooltipHandlerProps {
36
39
  /**
37
40
  * Bubble Tooltip data payload for the tooltip handler callback
38
41
  * @typeParam T - Object extending Location
42
+ * @public
39
43
  */
40
44
  export interface BubbleLayerTooltipData<T extends Location = Location> {
41
45
  /** The hovered bubble color */
@@ -47,11 +51,13 @@ export interface BubbleLayerTooltipData<T extends Location = Location> {
47
51
  }
48
52
  /**
49
53
  * Bubble Tooltip Component Props
54
+ * @public
50
55
  */
51
56
  export type BubbleLayerTooltipHandler = (closestDot: BubbleLayerTooltipData, dotsData: BubbleLayerTooltipData[]) => React.ReactNode | null;
52
57
  /**
53
58
  * Bubble Tooltip Component Props
54
59
  * @typeParam T - Object extending Location
60
+ * @public
55
61
  */
56
62
  export interface BubbleLayerTooltipHandlerProps {
57
63
  /** The BubbleLayer tooltip handler template */
@@ -60,6 +66,7 @@ export interface BubbleLayerTooltipHandlerProps {
60
66
  /**
61
67
  * Connection Tooltip data payload for the tooltip handler callback
62
68
  * @typeParam T - Object extending Connection
69
+ * @public
63
70
  */
64
71
  export interface ConnectionLayerTooltipData<T extends Connection = Connection> {
65
72
  /** The hovered connection color */
@@ -71,10 +78,12 @@ export interface ConnectionLayerTooltipData<T extends Connection = Connection> {
71
78
  }
72
79
  /**
73
80
  * Connection tooltip handler type
81
+ * @public
74
82
  */
75
83
  export type ConnectionLayerTooltipHandler = (connectionData: ConnectionLayerTooltipData) => React.ReactNode;
76
84
  /**
77
85
  * Connection Tooltip Component Props
86
+ * @public
78
87
  */
79
88
  export interface ConnectionLayerTooltipHandlerProps {
80
89
  /** The ConnectionLayer tooltip handler template */
@@ -83,6 +92,7 @@ export interface ConnectionLayerTooltipHandlerProps {
83
92
  /**
84
93
  * Choropleth Tooltip data payload for the tooltip handler callback
85
94
  * @typeParam T - Object extending a record of string keys and any type of values
95
+ * @public
86
96
  */
87
97
  export interface ChoroplethLayerTooltipData<T extends Record<string, unknown> = Record<string, unknown>> {
88
98
  /** The hovered region color */
@@ -94,14 +104,19 @@ export interface ChoroplethLayerTooltipData<T extends Record<string, unknown> =
94
104
  }
95
105
  /**
96
106
  * Choropleth tooltip handler type
107
+ * @public
97
108
  */
98
109
  export type ChoroplethLayerTooltipHandler = (regionData: ChoroplethLayerTooltipData) => React.ReactNode;
99
110
  /**
100
111
  * Choropleth Tooltip Component Props
112
+ * @public
101
113
  */
102
114
  export interface ChoroplethLayerTooltipHandlerProps {
103
115
  /** The ChoroplethLayer tooltip handler template */
104
116
  children?: ChoroplethLayerTooltipHandler | null;
105
117
  }
106
- /** Map Geo Tooltip Props */
118
+ /**
119
+ * Map Geo Tooltip Props
120
+ * @public
121
+ */
107
122
  export type ChartTooltip = ChartTooltipSlotsType & ChartTooltipTemplateType;
@@ -1,3 +1,3 @@
1
- import type { MapRef } from 'react-map-gl/maplibre';
1
+ import type { MapRef } from '@vis.gl/react-maplibre';
2
2
  import type { MapShape } from '../types/shapes.js';
3
3
  export declare const attachImageFromShape: (map: MapRef, shape: MapShape, name: string, outputSize?: number) => void;
@@ -38,6 +38,9 @@ const attachImageFromShape = (map, shape, name, outputSize) => {
38
38
  import_constants.DEFAULT_INPUT_ICON_SIZE,
39
39
  (0, import_create_bitmap_config_options.createBitmapConfigOptions)(outputSize)
40
40
  ).then((bitmap) => {
41
+ if (!map) {
42
+ return;
43
+ }
41
44
  (0, import_attach_image_to_map.attachImageToMap)(map, bitmap, name);
42
45
  });
43
46
  });
@@ -1,3 +1,3 @@
1
- import type { MapRef } from 'react-map-gl/maplibre';
1
+ import type { MapRef } from '@vis.gl/react-maplibre';
2
2
  import type { MapShape } from '../types/shapes.js';
3
3
  export declare const attachImageFromString: (map: MapRef, shape: MapShape | string, suffix?: string, outputSize?: number) => void;
@@ -1,2 +1,2 @@
1
- import type { MapRef } from 'react-map-gl/maplibre';
1
+ import type { MapRef } from '@vis.gl/react-maplibre';
2
2
  export declare const attachImageFromText: (map: MapRef, text: string, name: string, outputSize?: number) => void;
@@ -1,2 +1,2 @@
1
- import type { MapRef } from 'react-map-gl/maplibre';
1
+ import type { MapRef } from '@vis.gl/react-maplibre';
2
2
  export declare const attachImageToMap: (map: MapRef, bitmap: ImageBitmap | HTMLImageElement, iconName: string, sdf?: boolean) => void;
@@ -22,10 +22,17 @@ __export(attach_image_to_map_exports, {
22
22
  module.exports = __toCommonJS(attach_image_to_map_exports);
23
23
  const attachImageToMap = (map, bitmap, iconName, sdf = true) => {
24
24
  const pixelRatio = devicePixelRatio;
25
- if (!map.hasImage(iconName)) {
26
- map.addImage(iconName, bitmap, { sdf, pixelRatio });
27
- } else {
28
- map.removeImage(iconName);
29
- map.addImage(iconName, bitmap, { sdf, pixelRatio });
25
+ try {
26
+ if (!map.hasImage(iconName)) {
27
+ map.addImage(iconName, bitmap, { sdf, pixelRatio });
28
+ } else {
29
+ map.removeImage(iconName);
30
+ map.addImage(iconName, bitmap, { sdf, pixelRatio });
31
+ }
32
+ } catch (error) {
33
+ if (error instanceof Error) {
34
+ return;
35
+ }
36
+ throw error;
30
37
  }
31
38
  };
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(build_scale_from_legend_config_exports);
26
26
  var import_charts = require("@dynatrace/strato-components-preview/charts");
27
27
  var import_build_categorical_scale = require("./build-categorical-scale.js");
28
28
  var import_constants = require("../constants.js");
29
+ var import_create_categorical_color_scheme_from_custom_color_object = require("./create-categorical-color-scheme-from-custom-color-object.js");
29
30
  var import_create_categorical_color_scheme_from_legend_props = require("./create-categorical-color-scheme-from-legend-props.js");
30
31
  const isThresholdLegend = (legendConfig) => legendConfig.type === "threshold";
31
32
  const isSequentialLegend = (legendConfig) => legendConfig.type === "sequential";
@@ -43,7 +44,10 @@ const buildScaleFromLegendConfig = (mapLegendConfig, categories) => {
43
44
  mapLegendConfig.colorPalette
44
45
  );
45
46
  const isCustomColorObject = !(isDefaultColorPalette || isArrayOfColors);
46
- const colorPaletteObject = isCustomColorObject ? mapLegendConfig.colorPalette : (0, import_create_categorical_color_scheme_from_legend_props.createCategoricalColorSchemeFromLegendProps)(
47
+ const colorPaletteObject = isCustomColorObject ? (0, import_create_categorical_color_scheme_from_custom_color_object.createCategoricalColorSchemeFromCustomColorObject)(
48
+ mapLegendConfig.colorPalette,
49
+ categories ?? []
50
+ ) : (0, import_create_categorical_color_scheme_from_legend_props.createCategoricalColorSchemeFromLegendProps)(
47
51
  mapLegendConfig.colorPalette,
48
52
  categories ?? []
49
53
  );
@@ -0,0 +1,5 @@
1
+ type CustomCategoricalColorObject = {
2
+ [key: string]: string;
3
+ };
4
+ export declare const createCategoricalColorSchemeFromCustomColorObject: (colorPalette: CustomCategoricalColorObject, categories: string[]) => CustomCategoricalColorObject;
5
+ export {};
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var create_categorical_color_scheme_from_custom_color_object_exports = {};
19
+ __export(create_categorical_color_scheme_from_custom_color_object_exports, {
20
+ createCategoricalColorSchemeFromCustomColorObject: () => createCategoricalColorSchemeFromCustomColorObject
21
+ });
22
+ module.exports = __toCommonJS(create_categorical_color_scheme_from_custom_color_object_exports);
23
+ var import_constants = require("../constants.js");
24
+ const createCategoricalColorSchemeFromCustomColorObject = (colorPalette, categories) => {
25
+ let obj = { ...colorPalette };
26
+ categories.forEach((categoryName, index) => {
27
+ if (!obj[categoryName]) {
28
+ obj = {
29
+ ...obj,
30
+ [categoryName]: import_constants.DEFAULT_BASIC_SHAPE_COLOR_TOKEN.Default
31
+ };
32
+ }
33
+ });
34
+ return obj;
35
+ };
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  /**
3
3
  * Extract layers data
4
4
  * @param children - MapView children
5
- * @param valueAccessor - MapView Layer valueAccessor
5
+ * @param valueAccessors - MapView Layer valueAccessor
6
6
  * @returns flattened data array
7
7
  */
8
- export declare const extractLayersData: (children: React.ReactNode, valueAccessor?: string) => {
8
+ export declare const extractLayersData: (children: React.ReactNode, valueAccessors: Map<string, string>) => {
9
9
  flattenData: Record<string, unknown>[];
10
10
  categories: string[];
11
+ legendDomain: [number, number];
11
12
  };
@@ -42,9 +42,20 @@ const addCategory = (extendedDataPoint, valueAccessor) => {
42
42
  return extendedDataPoint[valueAccessor];
43
43
  }
44
44
  };
45
- const extractLayersData = (children, valueAccessor) => {
45
+ const updateDomain = (domain, value) => {
46
+ const [min, max] = domain;
47
+ if (value < min) {
48
+ return [value, max];
49
+ }
50
+ if (value > max) {
51
+ return [min, value];
52
+ }
53
+ return domain;
54
+ };
55
+ const extractLayersData = (children, valueAccessors) => {
46
56
  let flattenData = [];
47
57
  const categoriesSet = /* @__PURE__ */ new Set();
58
+ let legendDomain = [Infinity, -Infinity];
48
59
  import_react.default.Children.forEach(children, (child) => {
49
60
  if ((0, import_is_component.isComponent)(child, import_BubbleLayer.BubbleLayer) || (0, import_is_component.isComponent)(child, import_DotLayer.DotLayer)) {
50
61
  const { data } = child.props;
@@ -53,22 +64,38 @@ const extractLayersData = (children, valueAccessor) => {
53
64
  ...dataPoint,
54
65
  "layer-name": child.props.layerId
55
66
  };
56
- const category = addCategory(extendedDataPoint, valueAccessor);
67
+ const category = addCategory(
68
+ extendedDataPoint,
69
+ valueAccessors.get(child.props.layerId)
70
+ );
57
71
  category && categoriesSet.add(category);
72
+ if (typeof category === "number") {
73
+ legendDomain = updateDomain(legendDomain, category);
74
+ }
58
75
  flattenData = flattenData.concat(extendedDataPoint);
59
76
  });
60
77
  } else if ((0, import_is_component.isComponent)(child, import_ConnectionLayer.ConnectionLayer)) {
61
78
  const { data } = child.props;
62
79
  data.forEach((connection, connectionIndex) => {
63
- connection.path.forEach((path, pathIndex) => {
64
- const parsedPath = {
65
- ...path,
66
- "connection-name": `connection-${connectionIndex + 1}`,
67
- "connection-item-index": pathIndex,
68
- "layer-name": child.props.layerId
69
- };
70
- flattenData.push(parsedPath);
71
- });
80
+ if (connection.path.length >= 2) {
81
+ const category = addCategory(
82
+ connection,
83
+ valueAccessors.get(child.props.layerId)
84
+ );
85
+ category && categoriesSet.add(category);
86
+ if (typeof category === "number") {
87
+ legendDomain = updateDomain(legendDomain, category);
88
+ }
89
+ connection.path.forEach((path, pathIndex) => {
90
+ const parsedPath = {
91
+ ...path,
92
+ "connection-name": `connection-${connectionIndex + 1}`,
93
+ "connection-item-index": pathIndex,
94
+ "layer-name": child.props.layerId
95
+ };
96
+ flattenData.push(parsedPath);
97
+ });
98
+ }
72
99
  });
73
100
  } else if ((0, import_is_component.isComponent)(child, import_ChoroplethLayer.ChoroplethLayer)) {
74
101
  const { data, regionAccessor } = child.props;
@@ -79,11 +106,21 @@ const extractLayersData = (children, valueAccessor) => {
79
106
  region,
80
107
  "layer-name": child.props.layerId
81
108
  };
82
- const category = addCategory(choroplethLayerData, valueAccessor);
109
+ const category = addCategory(
110
+ choroplethLayerData,
111
+ valueAccessors.get(child.props.layerId)
112
+ );
83
113
  category && categoriesSet.add(category);
114
+ if (typeof category === "number") {
115
+ legendDomain = updateDomain(legendDomain, category);
116
+ }
84
117
  flattenData.push(choroplethLayerData);
85
118
  });
86
119
  }
87
120
  });
88
- return { flattenData, categories: [...categoriesSet] };
121
+ return {
122
+ flattenData,
123
+ categories: [...categoriesSet],
124
+ legendDomain
125
+ };
89
126
  };