@rio-cloud/rio-uikit 2.3.0-beta.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/Marker.js +9 -5
  2. package/Table.js +10 -9
  3. package/TableNext.js +10 -9
  4. package/TableRowActionsDropdown.d.ts +2 -0
  5. package/TableRowActionsDropdown.js +5 -0
  6. package/TableRowActionsDropdown.js.map +1 -0
  7. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +38 -3
  8. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +104 -109
  9. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -1
  10. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +24 -5
  11. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +60 -56
  12. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -1
  13. package/components/datepicker/DayPicker.js +72 -70
  14. package/components/datepicker/DayPicker.js.map +1 -1
  15. package/components/datepicker/DayPickerDropdown.d.ts +1 -0
  16. package/components/datepicker/DayPickerDropdown.js +61 -48
  17. package/components/datepicker/DayPickerDropdown.js.map +1 -1
  18. package/components/datepicker/useStackedDayPickerCalendars.js +26 -26
  19. package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -1
  20. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  21. package/components/dropdown/ButtonDropdown.js +82 -80
  22. package/components/dropdown/ButtonDropdown.js.map +1 -1
  23. package/components/listMenu/ListMenu.d.ts +8 -0
  24. package/components/listMenu/ListMenu.js +74 -66
  25. package/components/listMenu/ListMenu.js.map +1 -1
  26. package/components/map/components/Map.js +207 -156
  27. package/components/map/components/Map.js.map +1 -1
  28. package/components/map/components/MapContext.d.ts +3 -0
  29. package/components/map/components/MapContext.js +9 -6
  30. package/components/map/components/MapContext.js.map +1 -1
  31. package/components/map/components/features/MapZoom.js +19 -19
  32. package/components/map/components/features/MapZoom.js.map +1 -1
  33. package/components/map/components/features/Route.d.ts +65 -1
  34. package/components/map/components/features/Route.js +184 -98
  35. package/components/map/components/features/Route.js.map +1 -1
  36. package/components/map/components/features/basics/Marker.d.ts +21 -1
  37. package/components/map/components/features/basics/Marker.js +99 -40
  38. package/components/map/components/features/basics/Marker.js.map +1 -1
  39. package/components/map/components/features/basics/Polygon.d.ts +24 -1
  40. package/components/map/components/features/basics/Polygon.js +72 -19
  41. package/components/map/components/features/basics/Polygon.js.map +1 -1
  42. package/components/map/components/features/basics/Polyline.d.ts +29 -0
  43. package/components/map/components/features/basics/Polyline.js +69 -39
  44. package/components/map/components/features/basics/Polyline.js.map +1 -1
  45. package/components/map/components/features/layers/MarkerLayer.js +8 -8
  46. package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
  47. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js +13 -6
  48. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
  49. package/components/map/utils/clustering.d.ts +1 -1
  50. package/components/map/utils/clustering.js +30 -30
  51. package/components/map/utils/clustering.js.map +1 -1
  52. package/components/map/utils/mapTypes.d.ts +141 -0
  53. package/components/map/utils/mapTypes.js.map +1 -1
  54. package/components/map/utils/mapUtils.d.ts +2 -0
  55. package/components/map/utils/mapUtils.js +4 -0
  56. package/components/map/utils/mapUtils.js.map +1 -1
  57. package/components/mapMarker/ClusterMapMarker.d.ts +2 -0
  58. package/components/mapMarker/ClusterMapMarker.js.map +1 -1
  59. package/components/mapMarker/SingleMapMarker.d.ts +2 -0
  60. package/components/mapMarker/SingleMapMarker.js.map +1 -1
  61. package/components/selects/ClearButton.js +9 -7
  62. package/components/selects/ClearButton.js.map +1 -1
  63. package/components/table/Table.d.ts +3 -1
  64. package/components/table/Table.js +239 -216
  65. package/components/table/Table.js.map +1 -1
  66. package/components/table/Table.types.d.ts +62 -4
  67. package/components/table/TableColumn.d.ts +8 -1
  68. package/components/table/TableColumn.js +66 -64
  69. package/components/table/TableColumn.js.map +1 -1
  70. package/components/table/TableExpandedRow.d.ts +4 -0
  71. package/components/table/TableExpandedRow.js +70 -67
  72. package/components/table/TableExpandedRow.js.map +1 -1
  73. package/components/table/TableGroupRow.d.ts +3 -1
  74. package/components/table/TableGroupRow.js +15 -14
  75. package/components/table/TableGroupRow.js.map +1 -1
  76. package/components/table/TableHeader.d.ts +9 -0
  77. package/components/table/TableHeader.js +110 -81
  78. package/components/table/TableHeader.js.map +1 -1
  79. package/components/table/TableHeaderColumn.d.ts +11 -1
  80. package/components/table/TableHeaderColumn.js +63 -58
  81. package/components/table/TableHeaderColumn.js.map +1 -1
  82. package/components/table/TableRow.d.ts +12 -0
  83. package/components/table/TableRow.js +78 -74
  84. package/components/table/TableRow.js.map +1 -1
  85. package/components/table/TableRowActionsDropdown.d.ts +11 -0
  86. package/components/table/TableRowActionsDropdown.js +22 -0
  87. package/components/table/TableRowActionsDropdown.js.map +1 -0
  88. package/components/table/TableStickyRowButton.d.ts +25 -0
  89. package/components/table/TableStickyRowButton.js +32 -0
  90. package/components/table/TableStickyRowButton.js.map +1 -0
  91. package/components/table/TableToolbar.d.ts +24 -3
  92. package/components/table/TableToolbar.js +78 -37
  93. package/components/table/TableToolbar.js.map +1 -1
  94. package/components/table/TableViewToggles.js +5 -5
  95. package/components/table/TableViewToggles.js.map +1 -1
  96. package/components/table/context/TableInteractionContext.d.ts +3 -0
  97. package/components/table/context/TableInteractionContext.js.map +1 -1
  98. package/components/table/context/TableLayoutContext.d.ts +1 -0
  99. package/components/table/context/TableLayoutContext.js.map +1 -1
  100. package/components/table/context/TableRenderContext.d.ts +1 -0
  101. package/components/table/context/TableRenderContext.js.map +1 -1
  102. package/components/table/layout/useHorizontalSectionSync.d.ts +2 -1
  103. package/components/table/layout/useHorizontalSectionSync.js +32 -31
  104. package/components/table/layout/useHorizontalSectionSync.js.map +1 -1
  105. package/components/table/layout/useMeasuredColumnMaxWidths.js +52 -54
  106. package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
  107. package/components/table/layout/useTableLayout.d.ts +6 -2
  108. package/components/table/layout/useTableLayout.js +61 -48
  109. package/components/table/layout/useTableLayout.js.map +1 -1
  110. package/components/table/layout/useTableVirtualization.js +51 -56
  111. package/components/table/layout/useTableVirtualization.js.map +1 -1
  112. package/components/table/model/resolveResponsiveViewType.d.ts +2 -0
  113. package/components/table/model/resolveResponsiveViewType.js +27 -0
  114. package/components/table/model/resolveResponsiveViewType.js.map +1 -0
  115. package/components/table/render/header/TableDraggableHeaderCell.js +38 -36
  116. package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -1
  117. package/components/table/render/header/TableHeader.types.d.ts +2 -0
  118. package/components/table/render/header/TableHeaderCellContent.js +16 -16
  119. package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
  120. package/components/table/render/header/TableHeaderSelectionCell.d.ts +1 -0
  121. package/components/table/render/header/TableHeaderSelectionCell.js +13 -12
  122. package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
  123. package/components/table/render/header/TableStaticHeaderCell.js +31 -29
  124. package/components/table/render/header/TableStaticHeaderCell.js.map +1 -1
  125. package/components/table/render/header/resolveHeaderCellClassName.d.ts +1 -0
  126. package/components/table/render/header/resolveHeaderCellClassName.js +10 -9
  127. package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -1
  128. package/components/table/runtime/useResolvedRenderColumns.d.ts +4 -4
  129. package/components/table/runtime/useResolvedRenderColumns.js +13 -13
  130. package/components/table/runtime/useResolvedRenderColumns.js.map +1 -1
  131. package/components/table/runtime/useResolvedRenderHeader.d.ts +1 -1
  132. package/components/table/runtime/useResolvedRenderHeader.js.map +1 -1
  133. package/components/table/runtime/useResponsiveResolvedViewType.d.ts +23 -0
  134. package/components/table/runtime/useResponsiveResolvedViewType.js +22 -0
  135. package/components/table/runtime/useResponsiveResolvedViewType.js.map +1 -0
  136. package/components/table/selection/useInternalTableSelectionState.d.ts +2 -0
  137. package/components/table/selection/useInternalTableSelectionState.js +27 -17
  138. package/components/table/selection/useInternalTableSelectionState.js.map +1 -1
  139. package/components/table/selection/useTableSelection.d.ts +5 -1
  140. package/components/table/selection/useTableSelection.js +37 -26
  141. package/components/table/selection/useTableSelection.js.map +1 -1
  142. package/components/table/shared/parsePixelSize.d.ts +2 -0
  143. package/components/table/shared/parsePixelSize.js +13 -0
  144. package/components/table/shared/parsePixelSize.js.map +1 -0
  145. package/hooks/useDraggableElement.d.ts +27 -5
  146. package/hooks/useDraggableElement.js +100 -23
  147. package/hooks/useDraggableElement.js.map +1 -1
  148. package/hooks/usePopperDropdown.d.ts +1 -0
  149. package/hooks/usePopperDropdown.js +15 -12
  150. package/hooks/usePopperDropdown.js.map +1 -1
  151. package/hooks/useResizeObserver.d.ts +25 -6
  152. package/hooks/useResizeObserver.js +20 -18
  153. package/hooks/useResizeObserver.js.map +1 -1
  154. package/package.json +10 -10
  155. package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -1
  156. package/utils/init/initConfig.js +5 -5
  157. package/utils/init/initConfig.js.map +1 -1
  158. package/version.d.ts +1 -1
  159. package/version.js +2 -2
  160. package/version.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MapContext.js","sources":["../../../../src/components/map/components/MapContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';\nimport { MAP_TYPE_DEFAULT } from './constants';\n\nexport type MapContextType = {\n api: MapApi;\n language: string;\n enableWebGL: boolean;\n baseLayer: MapType;\n activeLayers: MapLayer[];\n showCluster: boolean;\n devicePixelRatio: number;\n onMapTypeChange?: (type: MapType) => void;\n onMapLayerChange?: (layer: MapLayer) => void;\n onShowClusterChange?: (showCluster: boolean) => void;\n mapSettingsTooltip?: string | React.ReactNode;\n hideMapLayerSettings?: boolean;\n hideClusterSettings?: boolean;\n onIncidentsChange: (incidentsResult: MapIncidents) => void;\n};\n\nexport const defaultMapContext: MapContextType = {\n api: {},\n language: 'en',\n enableWebGL: true,\n baseLayer: MAP_TYPE_DEFAULT,\n activeLayers: [],\n showCluster: true,\n devicePixelRatio: 1,\n onIncidentsChange: () => {},\n};\n\nexport const MapContext = createContext<MapContextType>(defaultMapContext);\n\nexport const useMapContext = () => useContext(MapContext);\n"],"names":["defaultMapContext","MAP_TYPE_DEFAULT","MapContext","createContext","useMapContext","useContext"],"mappings":";;AAsBO,MAAMA,IAAoC;AAAA,EAC7C,KAAK,CAAA;AAAA,EACL,UAAU;AAAA,EACV,aAAa;AAAA,EACb,WAAWC;AAAA,EACX,cAAc,CAAA;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB,MAAM;AAAA,EAAC;AAC9B,GAEaC,IAAaC,EAA8BH,CAAiB,GAE5DI,IAAgB,MAAMC,EAAWH,CAAU;"}
1
+ {"version":3,"file":"MapContext.js","sources":["../../../../src/components/map/components/MapContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';\nimport { MAP_TYPE_DEFAULT } from './constants';\n\nexport type MapContextType = {\n api: MapApi;\n language: string;\n enableWebGL: boolean;\n enableMarkerIconCache: boolean;\n enableFractionalZoom: boolean;\n isZoomInteractionActive: boolean;\n baseLayer: MapType;\n activeLayers: MapLayer[];\n showCluster: boolean;\n devicePixelRatio: number;\n onMapTypeChange?: (type: MapType) => void;\n onMapLayerChange?: (layer: MapLayer) => void;\n onShowClusterChange?: (showCluster: boolean) => void;\n mapSettingsTooltip?: string | React.ReactNode;\n hideMapLayerSettings?: boolean;\n hideClusterSettings?: boolean;\n onIncidentsChange: (incidentsResult: MapIncidents) => void;\n};\n\nexport const defaultMapContext: MapContextType = {\n api: {},\n language: 'en',\n enableWebGL: true,\n enableMarkerIconCache: true,\n enableFractionalZoom: false,\n isZoomInteractionActive: false,\n baseLayer: MAP_TYPE_DEFAULT,\n activeLayers: [],\n showCluster: true,\n devicePixelRatio: 1,\n onIncidentsChange: () => {},\n};\n\nexport const MapContext = createContext<MapContextType>(defaultMapContext);\n\nexport const useMapContext = () => useContext(MapContext);\n"],"names":["defaultMapContext","MAP_TYPE_DEFAULT","MapContext","createContext","useMapContext","useContext"],"mappings":";;AAyBO,MAAMA,IAAoC;AAAA,EAC7C,KAAK,CAAA;AAAA,EACL,UAAU;AAAA,EACV,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,sBAAsB;AAAA,EACtB,yBAAyB;AAAA,EACzB,WAAWC;AAAA,EACX,cAAc,CAAA;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB,MAAM;AAAA,EAAC;AAC9B,GAEaC,IAAaC,EAA8BH,CAAiB,GAE5DI,IAAgB,MAAMC,EAAWH,CAAU;"}
@@ -1,25 +1,25 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { useEffect as f } from "react";
3
- import a from "./settings/ZoomButtons.js";
4
- import { useMapContext as p } from "../MapContext.js";
5
- const I = (r) => {
6
- const { zoom: n, hideZoomButtons: s, zoomAnimation: m, onZoomIn: u, onZoomOut: Z } = r, { api: o } = p();
7
- f(() => {
8
- if (!o)
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useRef as d, useEffect as O } from "react";
3
+ import I from "./settings/ZoomButtons.js";
4
+ import { useMapContext as M } from "../MapContext.js";
5
+ const g = 1e-3, P = (i) => {
6
+ const { zoom: t, hideZoomButtons: Z, zoomAnimation: r, onZoomIn: c, onZoomOut: a } = i, { api: o, enableFractionalZoom: m, isZoomInteractionActive: s } = M(), u = d();
7
+ O(() => {
8
+ if (!(o && t !== void 0) || u.current === t || m && s)
9
9
  return;
10
- const e = o.utils?.getZoom();
11
- n && e !== n && o.utils?.setZoom(n, m);
12
- }, [n]);
13
- const i = () => {
14
- const t = (o?.utils?.getZoom() ?? 0) + 1;
15
- u(t), o?.utils?.setZoom(t, m);
16
- }, c = () => {
17
- const t = (o?.utils?.getZoom() ?? 0) - 1;
18
- Z(t), o?.utils?.setZoom(t, m);
10
+ const n = m ? o.utils?.getPreciseZoom() : o.utils?.getZoom();
11
+ n !== void 0 && (m ? Math.abs(n - t) > g : n !== t) && o.utils?.setZoom(t, r), u.current = t;
12
+ }, [o, t, r, m, s]);
13
+ const l = () => {
14
+ const e = (o?.utils?.getZoom() ?? 0) + 1;
15
+ c(e), o?.utils?.setZoom(e, r);
16
+ }, f = () => {
17
+ const e = (o?.utils?.getZoom() ?? 0) - 1;
18
+ a(e), o?.utils?.setZoom(e, r);
19
19
  };
20
- return s ? null : /* @__PURE__ */ l(a, { onZoomIn: i, onZoomOut: c });
20
+ return Z ? null : /* @__PURE__ */ p(I, { onZoomIn: l, onZoomOut: f });
21
21
  };
22
22
  export {
23
- I as default
23
+ P as default
24
24
  };
25
25
  //# sourceMappingURL=MapZoom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MapZoom.js","sources":["../../../../../src/components/map/components/features/MapZoom.tsx"],"sourcesContent":["import { useEffect } from 'react';\n\nimport ZoomButtons from './settings/ZoomButtons';\nimport { useMapContext } from '../MapContext';\n\nexport type MapZoomProps = {\n zoom?: number;\n hideZoomButtons: boolean;\n zoomAnimation: boolean;\n onZoomIn: (zoom: number) => void;\n onZoomOut: (zoom: number) => void;\n};\n\nconst MapZoom = (props: MapZoomProps) => {\n const { zoom, hideZoomButtons, zoomAnimation, onZoomIn, onZoomOut } = props;\n\n const { api } = useMapContext();\n\n // Update Zoom from outside if value is different\n useEffect(() => {\n if (!api) {\n return;\n }\n\n const currentMapZoom = api.utils?.getZoom();\n\n if (zoom && currentMapZoom !== zoom) {\n api.utils?.setZoom(zoom, zoomAnimation);\n }\n }, [zoom]);\n\n const handleZoomIn = () => {\n const currentZoom = api?.utils?.getZoom() ?? 0;\n const newZoom = currentZoom + 1;\n\n onZoomIn(newZoom);\n api?.utils?.setZoom(newZoom, zoomAnimation);\n };\n\n const handleZoomOut = () => {\n const currentZoom = api?.utils?.getZoom() ?? 0;\n const newZoom = currentZoom - 1;\n\n onZoomOut(newZoom);\n api?.utils?.setZoom(newZoom, zoomAnimation);\n };\n\n if (hideZoomButtons) {\n return null;\n }\n\n return <ZoomButtons onZoomIn={handleZoomIn} onZoomOut={handleZoomOut} />;\n};\n\nexport default MapZoom;\n"],"names":["MapZoom","props","zoom","hideZoomButtons","zoomAnimation","onZoomIn","onZoomOut","api","useMapContext","useEffect","currentMapZoom","handleZoomIn","newZoom","handleZoomOut","jsx","ZoomButtons"],"mappings":";;;;AAaA,MAAMA,IAAU,CAACC,MAAwB;AACrC,QAAM,EAAE,MAAAC,GAAM,iBAAAC,GAAiB,eAAAC,GAAe,UAAAC,GAAU,WAAAC,MAAcL,GAEhE,EAAE,KAAAM,EAAA,IAAQC,EAAA;AAGhB,EAAAC,EAAU,MAAM;AACZ,QAAI,CAACF;AACD;AAGJ,UAAMG,IAAiBH,EAAI,OAAO,QAAA;AAElC,IAAIL,KAAQQ,MAAmBR,KAC3BK,EAAI,OAAO,QAAQL,GAAME,CAAa;AAAA,EAE9C,GAAG,CAACF,CAAI,CAAC;AAET,QAAMS,IAAe,MAAM;AAEvB,UAAMC,KADcL,GAAK,OAAO,QAAA,KAAa,KACf;AAE9B,IAAAF,EAASO,CAAO,GAChBL,GAAK,OAAO,QAAQK,GAASR,CAAa;AAAA,EAC9C,GAEMS,IAAgB,MAAM;AAExB,UAAMD,KADcL,GAAK,OAAO,QAAA,KAAa,KACf;AAE9B,IAAAD,EAAUM,CAAO,GACjBL,GAAK,OAAO,QAAQK,GAASR,CAAa;AAAA,EAC9C;AAEA,SAAID,IACO,OAGJ,gBAAAW,EAACC,GAAA,EAAY,UAAUJ,GAAc,WAAWE,GAAe;AAC1E;"}
1
+ {"version":3,"file":"MapZoom.js","sources":["../../../../../src/components/map/components/features/MapZoom.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport ZoomButtons from './settings/ZoomButtons';\nimport { useMapContext } from '../MapContext';\n\nconst ZOOM_SYNC_EPSILON = 0.001;\n\nexport type MapZoomProps = {\n zoom?: number;\n hideZoomButtons: boolean;\n zoomAnimation: boolean;\n onZoomIn: (zoom: number) => void;\n onZoomOut: (zoom: number) => void;\n};\n\nconst MapZoom = (props: MapZoomProps) => {\n const { zoom, hideZoomButtons, zoomAnimation, onZoomIn, onZoomOut } = props;\n\n const { api, enableFractionalZoom, isZoomInteractionActive } = useMapContext();\n const lastProcessedExternalZoomRef = useRef<number | undefined>();\n\n // Update Zoom from outside if value is different\n useEffect(() => {\n if (!(api && zoom !== undefined)) {\n return;\n }\n\n if (lastProcessedExternalZoomRef.current === zoom) {\n return;\n }\n\n if (enableFractionalZoom && isZoomInteractionActive) {\n return;\n }\n\n const currentMapZoom = enableFractionalZoom ? api.utils?.getPreciseZoom() : api.utils?.getZoom();\n\n if (\n currentMapZoom !== undefined &&\n (enableFractionalZoom ? Math.abs(currentMapZoom - zoom) > ZOOM_SYNC_EPSILON : currentMapZoom !== zoom)\n ) {\n api.utils?.setZoom(zoom, zoomAnimation);\n }\n\n lastProcessedExternalZoomRef.current = zoom;\n }, [api, zoom, zoomAnimation, enableFractionalZoom, isZoomInteractionActive]);\n\n const handleZoomIn = () => {\n const currentZoom = api?.utils?.getZoom() ?? 0;\n const newZoom = currentZoom + 1;\n\n onZoomIn(newZoom);\n api?.utils?.setZoom(newZoom, zoomAnimation);\n };\n\n const handleZoomOut = () => {\n const currentZoom = api?.utils?.getZoom() ?? 0;\n const newZoom = currentZoom - 1;\n\n onZoomOut(newZoom);\n api?.utils?.setZoom(newZoom, zoomAnimation);\n };\n\n if (hideZoomButtons) {\n return null;\n }\n\n return <ZoomButtons onZoomIn={handleZoomIn} onZoomOut={handleZoomOut} />;\n};\n\nexport default MapZoom;\n"],"names":["ZOOM_SYNC_EPSILON","MapZoom","props","zoom","hideZoomButtons","zoomAnimation","onZoomIn","onZoomOut","api","enableFractionalZoom","isZoomInteractionActive","useMapContext","lastProcessedExternalZoomRef","useRef","useEffect","currentMapZoom","handleZoomIn","newZoom","handleZoomOut","jsx","ZoomButtons"],"mappings":";;;;AAKA,MAAMA,IAAoB,MAUpBC,IAAU,CAACC,MAAwB;AACrC,QAAM,EAAE,MAAAC,GAAM,iBAAAC,GAAiB,eAAAC,GAAe,UAAAC,GAAU,WAAAC,MAAcL,GAEhE,EAAE,KAAAM,GAAK,sBAAAC,GAAsB,yBAAAC,EAAA,IAA4BC,EAAA,GACzDC,IAA+BC,EAAA;AAGrC,EAAAC,EAAU,MAAM;AASZ,QARI,EAAEN,KAAOL,MAAS,WAIlBS,EAA6B,YAAYT,KAIzCM,KAAwBC;AACxB;AAGJ,UAAMK,IAAiBN,IAAuBD,EAAI,OAAO,mBAAmBA,EAAI,OAAO,QAAA;AAEvF,IACIO,MAAmB,WAClBN,IAAuB,KAAK,IAAIM,IAAiBZ,CAAI,IAAIH,IAAoBe,MAAmBZ,MAEjGK,EAAI,OAAO,QAAQL,GAAME,CAAa,GAG1CO,EAA6B,UAAUT;AAAA,EAC3C,GAAG,CAACK,GAAKL,GAAME,GAAeI,GAAsBC,CAAuB,CAAC;AAE5E,QAAMM,IAAe,MAAM;AAEvB,UAAMC,KADcT,GAAK,OAAO,QAAA,KAAa,KACf;AAE9B,IAAAF,EAASW,CAAO,GAChBT,GAAK,OAAO,QAAQS,GAASZ,CAAa;AAAA,EAC9C,GAEMa,IAAgB,MAAM;AAExB,UAAMD,KADcT,GAAK,OAAO,QAAA,KAAa,KACf;AAE9B,IAAAD,EAAUU,CAAO,GACjBT,GAAK,OAAO,QAAQS,GAASZ,CAAa;AAAA,EAC9C;AAEA,SAAID,IACO,OAGJ,gBAAAe,EAACC,GAAA,EAAY,UAAUJ,GAAc,WAAWE,GAAe;AAC1E;"}
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { ArrowStyle } from './basics/Polyline';
2
3
  import { Position } from '../../utils/mapTypes';
3
4
  import { EventListenerMap } from '../../utils/eventHandling';
@@ -22,18 +23,81 @@ export type RouteStyle = {
22
23
  lineDash?: number[];
23
24
  };
24
25
  export type RouteProps = {
26
+ /**
27
+ * Defines the arrow appearance when arrows are rendered on the route.
28
+ *
29
+ * @default {}
30
+ */
25
31
  arrowStyle?: ArrowStyle;
32
+ /**
33
+ * Controls whether directional arrows are rendered on the route line.
34
+ *
35
+ * @default true
36
+ */
26
37
  hasArrows?: boolean;
38
+ /**
39
+ * Ordered geographic positions that define the route geometry.
40
+ */
27
41
  positions: Position[];
42
+ /**
43
+ * Overrides the default route styling for line and border.
44
+ *
45
+ * @default { width: 5, color: 'rgba(48, 194, 255, 1)', borderWidth: 2, borderColor: 'rgba(22, 100, 141, 1)', isBorderIncludedInWidth: false }
46
+ */
28
47
  style?: RouteStyle;
48
+ /**
49
+ * Style overrides applied while the route is hovered via its hit area.
50
+ */
51
+ hoverStyle?: RouteStyle;
52
+ /**
53
+ * Shows the internal hit area polyline in red for debugging.
54
+ *
55
+ * @default false
56
+ */
57
+ showHitArea?: boolean;
58
+ /**
59
+ * Event handlers attached to the interactive route hit area.
60
+ */
29
61
  eventListenerMap?: EventListenerMap;
62
+ /**
63
+ * Renders the route in its reduced visual style.
64
+ *
65
+ * @default false
66
+ */
30
67
  isReduced?: boolean;
68
+ /**
69
+ * Applies the alternative route base styling.
70
+ *
71
+ * @default false
72
+ */
31
73
  isRouteAlternative?: boolean;
74
+ /**
75
+ * Icon rendered at the first route position.
76
+ */
32
77
  startIcon?: JSX.Element;
78
+ /**
79
+ * Icon rendered at the middle route position.
80
+ */
33
81
  middleIcon?: JSX.Element;
82
+ /**
83
+ * Icon rendered at the last route position.
84
+ */
34
85
  endIcon?: JSX.Element;
86
+ /**
87
+ * Additional markers rendered alongside the route.
88
+ *
89
+ * @default []
90
+ */
35
91
  markers?: JSX.Element[];
92
+ /**
93
+ * Custom payload forwarded to the rendered route polylines and their events.
94
+ */
36
95
  customData?: object;
96
+ /**
97
+ * Cursor shown while hovering the interactive route hit area.
98
+ * If omitted, clickable routes automatically use `pointer`.
99
+ */
100
+ cursor?: CSSProperties['cursor'];
37
101
  };
38
- declare const Route: (props: RouteProps) => import("react/jsx-runtime").JSX.Element | null;
102
+ declare const Route: (props: RouteProps) => import("react/jsx-runtime").JSX.Element;
39
103
  export default Route;
@@ -1,121 +1,207 @@
1
- import { jsxs as P, jsx as n } from "react/jsx-runtime";
2
- import { useState as c, useEffect as O } from "react";
3
- import { isEmpty as j, isArray as J } from "es-toolkit/compat";
4
- import f from "./basics/Polyline.js";
5
- import R from "./basics/Marker.js";
6
- import g from "../../exceptions/MapException.js";
7
- const X = "Route requires a minimum of 1 positions", q = "If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth", V = "rgba(48, 194, 255, 1)", z = "rgba(48, 194, 255, 0.5)", Q = "rgb(200, 243, 247)", Y = "rgba(22, 100, 141, 1)", Z = "rgba(255, 255, 255, 0)", st = "#e22837", lt = "#ff8e3c", at = "#5cb85c", ct = "rgba(255, 255, 255, 1)", dt = "rgba(167, 83, 25, 1)", C = 5, D = 2, b = {
8
- width: C,
9
- color: V,
10
- borderWidth: D,
11
- borderColor: Y,
1
+ import { jsxs as K, jsx as u } from "react/jsx-runtime";
2
+ import { useRef as v, useMemo as p, useEffect as P } from "react";
3
+ import { isArray as V, isEmpty as x } from "es-toolkit/compat";
4
+ import N from "./basics/Polyline.js";
5
+ import b from "./basics/Marker.js";
6
+ import U from "../../exceptions/MapException.js";
7
+ import { EventUtils as s } from "../../utils/eventHandling.js";
8
+ import { useMapContext as X } from "../MapContext.js";
9
+ const J = "Route requires a minimum of 1 positions", q = "If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth", Y = "rgba(48, 194, 255, 1)", z = "rgba(48, 194, 255, 0.5)", Q = "rgb(200, 243, 247)", Z = "rgba(22, 100, 141, 1)", $ = "rgba(255, 255, 255, 0)", Ee = "#e22837", ue = "#ff8e3c", Re = "#5cb85c", ye = "rgba(255, 255, 255, 1)", _e = "rgba(167, 83, 25, 1)", j = 10, B = 5, ee = 2, M = {
10
+ width: B,
11
+ color: Y,
12
+ borderWidth: ee,
13
+ borderColor: Z,
12
14
  isBorderIncludedInWidth: !1
13
- }, $ = {
14
- ...b,
15
+ }, te = {
16
+ ...M,
15
17
  color: Q
16
- }, Et = (y) => {
17
- const {
18
- style: d,
19
- isReduced: i = !1,
20
- isRouteAlternative: E = !1,
21
- positions: t,
22
- startIcon: S,
23
- middleIcon: I,
24
- endIcon: L,
25
- arrowStyle: A = {},
26
- hasArrows: W = !0,
27
- markers: m = [],
28
- customData: h,
29
- eventListenerMap: p
30
- } = y, [_, N] = c(), [U, w] = c(), [B, F] = c(), [G, M] = c(D);
31
- O(() => {
32
- u(t), T(d, i, E);
33
- }, []), O(() => {
34
- u(t);
35
- }, [t]), O(() => {
36
- T(d, i, E);
37
- }, [d, i, E]);
38
- const u = (o) => {
39
- if (j(o))
40
- throw new g(X);
41
- const e = new H.geo.LineString();
42
- if (o.map((r) => e.pushLatLngAlt(r.lat, r.lng, 0)), o.length === 1) {
43
- const [r] = o;
44
- e.pushLatLngAlt(r.lat, r.lng, 0);
45
- }
46
- N(e);
47
- }, T = (o, e, r) => {
48
- const v = {
49
- ...r ? $ : b,
50
- ...o
18
+ }, re = (a) => {
19
+ if (x(a))
20
+ throw new U(J);
21
+ const l = new H.geo.LineString();
22
+ if (a.forEach((o) => {
23
+ l.pushLatLngAlt(o.lat, o.lng, 0);
24
+ }), a.length === 1) {
25
+ const [o] = a;
26
+ l.pushLatLngAlt(o.lat, o.lng, 0);
27
+ }
28
+ return l;
29
+ }, oe = (a) => {
30
+ const { style: l, hoverStyle: o, isReduced: d, isRouteAlternative: h, showHitArea: f } = a, n = (m) => {
31
+ const I = {
32
+ ...h ? te : M,
33
+ ...m
51
34
  }, {
52
- color: K,
53
- width: s = C,
54
- borderColor: k,
55
- borderWidth: l = 0,
56
- isBorderIncludedInWidth: x,
57
- lineDash: a
58
- } = v;
59
- if (M(e ? 0 : l), x && l >= s)
60
- throw new g(q);
61
- w(
62
- new H.map.SpatialStyle({
63
- strokeColor: e ? z : K,
64
- lineWidth: e ? l + s : s,
35
+ color: T,
36
+ width: c = B,
37
+ borderColor: _,
38
+ borderWidth: r = 0,
39
+ isBorderIncludedInWidth: O,
40
+ lineDash: i
41
+ } = I;
42
+ if (O && r >= c)
43
+ throw new U(q);
44
+ return {
45
+ borderWidth: d ? 0 : r,
46
+ routeStyle: new H.map.SpatialStyle({
47
+ strokeColor: d ? z : T,
48
+ lineWidth: d ? r + c : c,
65
49
  lineCap: "round",
66
50
  lineJoin: "bevel",
67
- ...a && { lineDash: a }
68
- })
69
- ), F(
70
- new H.map.SpatialStyle({
71
- strokeColor: i ? Z : k,
72
- lineWidth: l + s,
51
+ ...i && { lineDash: i }
52
+ }),
53
+ borderStyle: new H.map.SpatialStyle({
54
+ strokeColor: d ? $ : _,
55
+ lineWidth: r + c,
73
56
  lineCap: "round",
74
57
  lineJoin: "bevel",
75
- ...a && { lineDash: a }
58
+ ...i && { lineDash: i }
59
+ }),
60
+ hitAreaStyle: new H.map.SpatialStyle({
61
+ strokeColor: f ? "rgba(255, 0, 0, 0.35)" : "rgba(255, 255, 255, 0.001)",
62
+ lineWidth: r + c + j,
63
+ lineCap: "round",
64
+ lineJoin: "round"
76
65
  })
66
+ };
67
+ }, R = n(l), y = o ? n({ ...l, ...o }) : R;
68
+ return {
69
+ ...R,
70
+ hoverRouteStyle: y.routeStyle,
71
+ hoverBorderStyle: y.borderStyle
72
+ };
73
+ }, Oe = (a) => {
74
+ const {
75
+ style: l,
76
+ hoverStyle: o,
77
+ showHitArea: d = !1,
78
+ isReduced: h = !1,
79
+ isRouteAlternative: f = !1,
80
+ positions: n,
81
+ startIcon: R,
82
+ middleIcon: y,
83
+ endIcon: m,
84
+ arrowStyle: I = {},
85
+ hasArrows: T = !0,
86
+ markers: c = [],
87
+ customData: _,
88
+ eventListenerMap: r,
89
+ cursor: O
90
+ } = a, { api: i } = X(), D = v(), L = v(), S = v(!1), E = p(() => {
91
+ if (O)
92
+ return O;
93
+ if (r?.[s.TAP] || r?.[s.DBL_TAP] || r?.[s.CONTEXTMENU])
94
+ return "pointer";
95
+ }, [O, r]), C = p(() => re(n), [n]), t = p(
96
+ () => oe({
97
+ style: l,
98
+ hoverStyle: o,
99
+ isReduced: h,
100
+ isRouteAlternative: f,
101
+ showHitArea: d
102
+ }),
103
+ [l, o, h, f, d]
104
+ ), W = (e) => {
105
+ if (!i.map)
106
+ return;
107
+ const G = i.map.getElement(), k = i.map.getViewPort().element;
108
+ G.style.cursor = e, k.style.cursor = e;
109
+ }, A = (e) => {
110
+ D.current?.line.setStyle(e ? t.hoverRouteStyle : t.routeStyle), L.current && L.current.line.setStyle(
111
+ e ? t.hoverBorderStyle : t.borderStyle
77
112
  );
113
+ }, F = () => {
114
+ S.current = !0, A(!0), E && W(E);
115
+ }, g = () => {
116
+ S.current = !1, A(!1), E && W("");
78
117
  };
79
- return _ ? /* @__PURE__ */ P("div", { children: [
80
- G > 0 && /* @__PURE__ */ n(
81
- f,
118
+ P(() => {
119
+ A(S.current);
120
+ }, [
121
+ t.routeStyle,
122
+ t.borderStyle,
123
+ t.hoverRouteStyle,
124
+ t.hoverBorderStyle
125
+ ]), P(
126
+ () => () => {
127
+ S.current = !1, g();
128
+ },
129
+ [i.map, E]
130
+ );
131
+ const w = p(() => {
132
+ if (r || o || E)
133
+ return {
134
+ ...r,
135
+ [s.POINTER_ENTER]: (...e) => {
136
+ F(), r?.[s.POINTER_ENTER]?.(...e);
137
+ },
138
+ [s.POINTER_LEAVE]: (...e) => {
139
+ g(), r?.[s.POINTER_LEAVE]?.(...e);
140
+ },
141
+ [s.POINTER_CANCEL]: (...e) => {
142
+ g(), r?.[s.POINTER_CANCEL]?.(...e);
143
+ }
144
+ };
145
+ }, [r, o, E, t]);
146
+ return /* @__PURE__ */ K("div", { children: [
147
+ t.borderWidth > 0 && /* @__PURE__ */ u(
148
+ N,
149
+ {
150
+ geometry: C,
151
+ style: t.borderStyle,
152
+ customData: _,
153
+ onReady: (e) => {
154
+ L.current = e, e && e.line.setStyle(
155
+ S.current ? t.hoverBorderStyle : t.borderStyle
156
+ );
157
+ }
158
+ }
159
+ ),
160
+ /* @__PURE__ */ u(
161
+ N,
82
162
  {
83
- eventListenerMap: p,
84
- geometry: _,
85
- style: B,
86
- customData: h
163
+ hasArrows: T,
164
+ arrowStyle: I,
165
+ geometry: C,
166
+ style: t.routeStyle,
167
+ customData: _,
168
+ onReady: (e) => {
169
+ D.current = e, e && e.line.setStyle(
170
+ S.current ? t.hoverRouteStyle : t.routeStyle
171
+ );
172
+ }
87
173
  }
88
174
  ),
89
- /* @__PURE__ */ n(
90
- f,
175
+ w && // Keep interaction on a single invisible polyline so hover/cursor/click stay stable
176
+ // even though the visible route may consist of multiple rendered polylines.
177
+ /* @__PURE__ */ u(
178
+ N,
91
179
  {
92
- hasArrows: W,
93
- arrowStyle: A,
94
- eventListenerMap: p,
95
- geometry: _,
96
- style: U,
97
- customData: h
180
+ eventListenerMap: w,
181
+ geometry: C,
182
+ style: t.hitAreaStyle,
183
+ customData: _
98
184
  }
99
185
  ),
100
- S && /* @__PURE__ */ n(R, { position: t[0], icon: S }, "startIcon"),
101
- I && /* @__PURE__ */ n(R, { position: t[Math.floor(t.length / 2)], icon: I }, "middleIcon"),
102
- L && /* @__PURE__ */ n(R, { position: t[t.length - 1], icon: L }, "endIcon"),
103
- J(m) && m.map((o) => o)
104
- ] }) : null;
186
+ R && /* @__PURE__ */ u(b, { position: n[0], icon: R }, "startIcon"),
187
+ y && /* @__PURE__ */ u(b, { position: n[Math.floor(n.length / 2)], icon: y }, "middleIcon"),
188
+ m && /* @__PURE__ */ u(b, { position: n[n.length - 1], icon: m }, "endIcon"),
189
+ V(c) && c.map((e) => e)
190
+ ] });
105
191
  };
106
192
  export {
107
- dt as ARROW_COLOR_WARNING,
108
- Y as DEFAULT_BORDER_STROKE_COLOR,
109
- Z as DEFAULT_BORDER_STROKE_COLOR_REDUCED,
110
- V as DEFAULT_LINE_STROKE_COLOR,
193
+ _e as ARROW_COLOR_WARNING,
194
+ Z as DEFAULT_BORDER_STROKE_COLOR,
195
+ $ as DEFAULT_BORDER_STROKE_COLOR_REDUCED,
196
+ Y as DEFAULT_LINE_STROKE_COLOR,
111
197
  Q as DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE,
112
198
  z as DEFAULT_LINE_STROKE_COLOR_REDUCED,
113
- X as MISSING_POSITIONS_EXCEPTION_MSG,
114
- st as ROUTE_COLOR_DANGER,
115
- at as ROUTE_COLOR_SUCCESS,
116
- lt as ROUTE_COLOR_WARNING,
117
- ct as ROUTE_COLOR_WHITE,
199
+ J as MISSING_POSITIONS_EXCEPTION_MSG,
200
+ Ee as ROUTE_COLOR_DANGER,
201
+ Re as ROUTE_COLOR_SUCCESS,
202
+ ue as ROUTE_COLOR_WARNING,
203
+ ye as ROUTE_COLOR_WHITE,
118
204
  q as TO_LESS_LINE_WIDTH_EXCEPTION_MSG,
119
- Et as default
205
+ Oe as default
120
206
  };
121
207
  //# sourceMappingURL=Route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sources":["../../../../../src/components/map/components/features/Route.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { isArray, isEmpty } from 'es-toolkit/compat';\n\nimport Polyline, { type ArrowStyle } from './basics/Polyline';\nimport Marker from './basics/Marker';\nimport MapException from '../../exceptions/MapException';\nimport type { Position } from '../../utils/mapTypes';\nimport type { EventListenerMap } from '../../utils/eventHandling';\n\nexport const MISSING_POSITIONS_EXCEPTION_MSG = 'Route requires a minimum of 1 positions';\n\nexport const TO_LESS_LINE_WIDTH_EXCEPTION_MSG =\n 'If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth';\n\nexport const DEFAULT_LINE_STROKE_COLOR = 'rgba(48, 194, 255, 1)';\nexport const DEFAULT_LINE_STROKE_COLOR_REDUCED = 'rgba(48, 194, 255, 0.5)';\nexport const DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE = 'rgb(200, 243, 247)';\n\nexport const DEFAULT_BORDER_STROKE_COLOR = 'rgba(22, 100, 141, 1)';\nexport const DEFAULT_BORDER_STROKE_COLOR_REDUCED = 'rgba(255, 255, 255, 0)';\n\n// Both works, rgb or hex - keep in mind that these state colors may change\n// so use this constants instead of actual color values in the service\nexport const ROUTE_COLOR_DANGER = '#e22837';\nexport const ROUTE_COLOR_WARNING = '#ff8e3c';\nexport const ROUTE_COLOR_SUCCESS = '#5cb85c';\nexport const ROUTE_COLOR_WHITE = 'rgba(255, 255, 255, 1)';\n\nexport const ARROW_COLOR_WARNING = 'rgba(167, 83, 25, 1)';\n\nexport type RouteStyle = {\n width?: number;\n color?: string;\n borderWidth?: number;\n borderColor?: string;\n isBorderIncludedInWidth?: boolean;\n lineDash?: number[];\n};\n\nexport type RouteProps = {\n arrowStyle?: ArrowStyle;\n hasArrows?: boolean;\n positions: Position[];\n style?: RouteStyle;\n eventListenerMap?: EventListenerMap;\n isReduced?: boolean;\n isRouteAlternative?: boolean;\n startIcon?: JSX.Element;\n middleIcon?: JSX.Element;\n endIcon?: JSX.Element;\n markers?: JSX.Element[];\n customData?: object;\n};\n\nconst DEFAULT_WIDTH = 5;\nconst DEFAULT_BORDER_WIDTH = 2;\n\nconst defaultStyle: RouteStyle = {\n width: DEFAULT_WIDTH,\n color: DEFAULT_LINE_STROKE_COLOR,\n borderWidth: DEFAULT_BORDER_WIDTH,\n borderColor: DEFAULT_BORDER_STROKE_COLOR,\n isBorderIncludedInWidth: false,\n};\n\nconst alternativeRouteStyle = {\n ...defaultStyle,\n color: DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE,\n};\n\nconst Route = (props: RouteProps) => {\n const {\n style,\n isReduced = false,\n isRouteAlternative = false,\n positions,\n startIcon,\n middleIcon,\n endIcon,\n arrowStyle = {},\n hasArrows = true,\n markers = [],\n customData,\n eventListenerMap,\n } = props;\n\n const [lineString, setLineString] = useState<H.geo.LineString>();\n const [routeStyle, setRouteStyle] = useState<H.map.SpatialStyle>();\n const [borderStyle, setBorderStyle] = useState<H.map.SpatialStyle>();\n const [borderWidth, setBorderWidth] = useState<number>(DEFAULT_BORDER_WIDTH);\n\n useEffect(() => {\n updateGeometry(positions);\n updateStyle(style, isReduced, isRouteAlternative);\n }, []);\n\n useEffect(() => {\n updateGeometry(positions);\n }, [positions]);\n\n useEffect(() => {\n updateStyle(style, isReduced, isRouteAlternative);\n }, [style, isReduced, isRouteAlternative]);\n\n const updateGeometry = (pos: Position[]) => {\n if (isEmpty(pos)) {\n throw new MapException(MISSING_POSITIONS_EXCEPTION_MSG);\n }\n\n /* keep reference to shared geometry to prevent recalculation if other values than points change */\n const lineStringData = new H.geo.LineString();\n pos.map((singlePos: Position) => lineStringData.pushLatLngAlt(singlePos.lat, singlePos.lng, 0));\n\n if (pos.length === 1) {\n const [position] = pos;\n lineStringData.pushLatLngAlt(position.lat, position.lng, 0);\n }\n\n setLineString(lineStringData);\n };\n\n const updateStyle = (\n updatedStyle: RouteStyle | undefined,\n isReducedStyle: boolean,\n isRouteAlternativeStyle: boolean\n ) => {\n const mergedStyle = {\n ...(isRouteAlternativeStyle ? alternativeRouteStyle : defaultStyle),\n ...updatedStyle,\n };\n\n const {\n color,\n width = DEFAULT_WIDTH,\n borderColor,\n borderWidth: mergedBorderWidth = 0,\n isBorderIncludedInWidth,\n lineDash,\n } = mergedStyle;\n\n setBorderWidth(isReducedStyle ? 0 : mergedBorderWidth);\n\n if (isBorderIncludedInWidth && mergedBorderWidth >= width) {\n throw new MapException(TO_LESS_LINE_WIDTH_EXCEPTION_MSG);\n }\n\n setRouteStyle(\n new H.map.SpatialStyle({\n strokeColor: isReducedStyle ? DEFAULT_LINE_STROKE_COLOR_REDUCED : color,\n lineWidth: isReducedStyle ? mergedBorderWidth + width : width,\n lineCap: 'round',\n lineJoin: 'bevel',\n ...(lineDash && { lineDash }),\n })\n );\n\n setBorderStyle(\n new H.map.SpatialStyle({\n strokeColor: isReduced ? DEFAULT_BORDER_STROKE_COLOR_REDUCED : borderColor,\n lineWidth: mergedBorderWidth + width,\n lineCap: 'round',\n lineJoin: 'bevel',\n ...(lineDash && { lineDash }),\n })\n );\n };\n\n if (!lineString) {\n return null;\n }\n\n return (\n <div>\n {borderWidth > 0 && (\n <Polyline\n eventListenerMap={eventListenerMap}\n geometry={lineString}\n style={borderStyle}\n customData={customData}\n />\n )}\n <Polyline\n hasArrows={hasArrows}\n arrowStyle={arrowStyle}\n eventListenerMap={eventListenerMap}\n geometry={lineString}\n style={routeStyle}\n customData={customData}\n />\n {startIcon && <Marker key='startIcon' position={positions[0]} icon={startIcon} />}\n {middleIcon && (\n <Marker key='middleIcon' position={positions[Math.floor(positions.length / 2)]} icon={middleIcon} />\n )}\n {endIcon && <Marker key='endIcon' position={positions[positions.length - 1]} icon={endIcon} />}\n {isArray(markers) && markers.map(marker => marker)}\n </div>\n );\n};\n\nexport default Route;\n"],"names":["MISSING_POSITIONS_EXCEPTION_MSG","TO_LESS_LINE_WIDTH_EXCEPTION_MSG","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_COLOR_REDUCED","DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE","DEFAULT_BORDER_STROKE_COLOR","DEFAULT_BORDER_STROKE_COLOR_REDUCED","ROUTE_COLOR_DANGER","ROUTE_COLOR_WARNING","ROUTE_COLOR_SUCCESS","ROUTE_COLOR_WHITE","ARROW_COLOR_WARNING","DEFAULT_WIDTH","DEFAULT_BORDER_WIDTH","defaultStyle","alternativeRouteStyle","Route","props","style","isReduced","isRouteAlternative","positions","startIcon","middleIcon","endIcon","arrowStyle","hasArrows","markers","customData","eventListenerMap","lineString","setLineString","useState","routeStyle","setRouteStyle","borderStyle","setBorderStyle","borderWidth","setBorderWidth","useEffect","updateGeometry","updateStyle","pos","isEmpty","MapException","lineStringData","singlePos","position","updatedStyle","isReducedStyle","isRouteAlternativeStyle","mergedStyle","color","width","borderColor","mergedBorderWidth","isBorderIncludedInWidth","lineDash","jsx","Pol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CAC9B;AAAA,IAAA;AAAA,EAET;AAEA,SAAK3B,sBAKA,OAAA,EACI,UAAA;AAAA,IAAAO,IAAc,KACX,gBAAAqB;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,kBAAA9B;AAAA,QACA,UAAUC;AAAA,QACV,OAAOK;AAAA,QACP,YAAAP;AAAA,MAAA;AAAA,IAAA;AAAA,IAGR,gBAAA8B;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,WAAAjC;AAAA,QACA,YAAAD;AAAA,QACA,kBAAAI;AAAA,QACA,UAAUC;AAAA,QACV,OAAOG;AAAA,QACP,YAAAL;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHN,uBAAcsC,GAAA,EAAuB,UAAUvC,EAAU,CAAC,GAAG,MAAMC,EAAA,GAA1C,WAAqD;AAAA,IAC9EC,KACG,gBAAAmC,EAACE,GAAA,EAAwB,UAAUvC,EAAU,KAAK,MAAMA,EAAU,SAAS,CAAC,CAAC,GAAG,MAAME,KAA1E,YAAsF;AAAA,IAErGC,KAAW,gBAAAkC,EAACE,GAAA,EAAqB,UAAUvC,EAAUA,EAAU,SAAS,CAAC,GAAG,MAAMG,EAAA,GAA3D,SAAoE;AAAA,IAC3FqC,EAAQlC,CAAO,KAAKA,EAAQ,IAAI,OAAUmC,CAAM;AAAA,EAAA,GACrD,IA3BO;AA6Bf;"}
1
+ {"version":3,"file":"Route.js","sources":["../../../../../src/components/map/components/features/Route.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, type CSSProperties } from 'react';\nimport { isArray, isEmpty } from 'es-toolkit/compat';\n\nimport Polyline, { type ArrowStyle, type PolylineObjects } from './basics/Polyline';\nimport Marker from './basics/Marker';\nimport MapException from '../../exceptions/MapException';\nimport type { Position } from '../../utils/mapTypes';\nimport { EventUtils, type EventListenerMap } from '../../utils/eventHandling';\nimport { useMapContext } from '../MapContext';\n\nexport const MISSING_POSITIONS_EXCEPTION_MSG = 'Route requires a minimum of 1 positions';\n\nexport const TO_LESS_LINE_WIDTH_EXCEPTION_MSG =\n 'If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth';\n\nexport const DEFAULT_LINE_STROKE_COLOR = 'rgba(48, 194, 255, 1)';\nexport const DEFAULT_LINE_STROKE_COLOR_REDUCED = 'rgba(48, 194, 255, 0.5)';\nexport const DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE = 'rgb(200, 243, 247)';\n\nexport const DEFAULT_BORDER_STROKE_COLOR = 'rgba(22, 100, 141, 1)';\nexport const DEFAULT_BORDER_STROKE_COLOR_REDUCED = 'rgba(255, 255, 255, 0)';\n\n// Both works, rgb or hex - keep in mind that these state colors may change\n// so use this constants instead of actual color values in the service\nexport const ROUTE_COLOR_DANGER = '#e22837';\nexport const ROUTE_COLOR_WARNING = '#ff8e3c';\nexport const ROUTE_COLOR_SUCCESS = '#5cb85c';\nexport const ROUTE_COLOR_WHITE = 'rgba(255, 255, 255, 1)';\n\nexport const ARROW_COLOR_WARNING = 'rgba(167, 83, 25, 1)';\nconst HIT_POLYLINE_EXTRA_WIDTH = 10;\n\nexport type RouteStyle = {\n width?: number;\n color?: string;\n borderWidth?: number;\n borderColor?: string;\n isBorderIncludedInWidth?: boolean;\n lineDash?: number[];\n};\n\nexport type RouteProps = {\n /**\n * Defines the arrow appearance when arrows are rendered on the route.\n *\n * @default {}\n */\n arrowStyle?: ArrowStyle;\n\n /**\n * Controls whether directional arrows are rendered on the route line.\n *\n * @default true\n */\n hasArrows?: boolean;\n\n /**\n * Ordered geographic positions that define the route geometry.\n */\n positions: Position[];\n\n /**\n * Overrides the default route styling for line and border.\n *\n * @default { width: 5, color: 'rgba(48, 194, 255, 1)', borderWidth: 2, borderColor: 'rgba(22, 100, 141, 1)', isBorderIncludedInWidth: false }\n */\n style?: RouteStyle;\n\n /**\n * Style overrides applied while the route is hovered via its hit area.\n */\n hoverStyle?: RouteStyle;\n\n /**\n * Shows the internal hit area polyline in red for debugging.\n *\n * @default false\n */\n showHitArea?: boolean;\n\n /**\n * Event handlers attached to the interactive route hit area.\n */\n eventListenerMap?: EventListenerMap;\n\n /**\n * Renders the route in its reduced visual style.\n *\n * @default false\n */\n isReduced?: boolean;\n\n /**\n * Applies the alternative route base styling.\n *\n * @default false\n */\n isRouteAlternative?: boolean;\n\n /**\n * Icon rendered at the first route position.\n */\n startIcon?: JSX.Element;\n\n /**\n * Icon rendered at the middle route position.\n */\n middleIcon?: JSX.Element;\n\n /**\n * Icon rendered at the last route position.\n */\n endIcon?: JSX.Element;\n\n /**\n * Additional markers rendered alongside the route.\n *\n * @default []\n */\n markers?: JSX.Element[];\n\n /**\n * Custom payload forwarded to the rendered route polylines and their events.\n */\n customData?: object;\n\n /**\n * Cursor shown while hovering the interactive route hit area.\n * If omitted, clickable routes automatically use `pointer`.\n */\n cursor?: CSSProperties['cursor'];\n};\n\nconst DEFAULT_WIDTH = 5;\nconst DEFAULT_BORDER_WIDTH = 2;\n\nconst defaultStyle: RouteStyle = {\n width: DEFAULT_WIDTH,\n color: DEFAULT_LINE_STROKE_COLOR,\n borderWidth: DEFAULT_BORDER_WIDTH,\n borderColor: DEFAULT_BORDER_STROKE_COLOR,\n isBorderIncludedInWidth: false,\n};\n\nconst alternativeRouteStyle = {\n ...defaultStyle,\n color: DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE,\n};\n\nconst createLineString = (positions: Position[]) => {\n if (isEmpty(positions)) {\n throw new MapException(MISSING_POSITIONS_EXCEPTION_MSG);\n }\n\n const lineString = new H.geo.LineString();\n\n positions.forEach(position => {\n lineString.pushLatLngAlt(position.lat, position.lng, 0);\n });\n\n if (positions.length === 1) {\n const [position] = positions;\n lineString.pushLatLngAlt(position.lat, position.lng, 0);\n }\n\n return lineString;\n};\n\nconst createResolvedRouteStyles = (options: {\n style?: RouteStyle;\n hoverStyle?: RouteStyle;\n isReduced: boolean;\n isRouteAlternative: boolean;\n showHitArea: boolean;\n}) => {\n const { style, hoverStyle, isReduced, isRouteAlternative, showHitArea } = options;\n\n const createStyleSet = (updatedStyle?: RouteStyle) => {\n const mergedStyle = {\n ...(isRouteAlternative ? alternativeRouteStyle : defaultStyle),\n ...updatedStyle,\n };\n\n const {\n color,\n width = DEFAULT_WIDTH,\n borderColor,\n borderWidth: mergedBorderWidth = 0,\n isBorderIncludedInWidth,\n lineDash,\n } = mergedStyle;\n\n if (isBorderIncludedInWidth && mergedBorderWidth >= width) {\n throw new MapException(TO_LESS_LINE_WIDTH_EXCEPTION_MSG);\n }\n\n return {\n borderWidth: isReduced ? 0 : mergedBorderWidth,\n routeStyle: new H.map.SpatialStyle({\n strokeColor: isReduced ? DEFAULT_LINE_STROKE_COLOR_REDUCED : color,\n lineWidth: isReduced ? mergedBorderWidth + width : width,\n lineCap: 'round',\n lineJoin: 'bevel',\n ...(lineDash && { lineDash }),\n }),\n borderStyle: new H.map.SpatialStyle({\n strokeColor: isReduced ? DEFAULT_BORDER_STROKE_COLOR_REDUCED : borderColor,\n lineWidth: mergedBorderWidth + width,\n lineCap: 'round',\n lineJoin: 'bevel',\n ...(lineDash && { lineDash }),\n }),\n hitAreaStyle: new H.map.SpatialStyle({\n strokeColor: showHitArea ? 'rgba(255, 0, 0, 0.35)' : 'rgba(255, 255, 255, 0.001)',\n lineWidth: mergedBorderWidth + width + HIT_POLYLINE_EXTRA_WIDTH,\n lineCap: 'round',\n lineJoin: 'round',\n }),\n };\n };\n\n const baseStyleSet = createStyleSet(style);\n const hoverStyleSet = hoverStyle ? createStyleSet({ ...style, ...hoverStyle }) : baseStyleSet;\n\n return {\n ...baseStyleSet,\n hoverRouteStyle: hoverStyleSet.routeStyle,\n hoverBorderStyle: hoverStyleSet.borderStyle,\n };\n};\n\nconst Route = (props: RouteProps) => {\n const {\n style,\n hoverStyle,\n showHitArea = false,\n isReduced = false,\n isRouteAlternative = false,\n positions,\n startIcon,\n middleIcon,\n endIcon,\n arrowStyle = {},\n hasArrows = true,\n markers = [],\n customData,\n eventListenerMap,\n cursor,\n } = props;\n\n const { api } = useMapContext();\n const routePolylineRef = useRef<PolylineObjects>();\n const borderPolylineRef = useRef<PolylineObjects>();\n const isHoveredRef = useRef(false);\n\n const resolvedCursor = useMemo(() => {\n if (cursor) {\n return cursor;\n }\n\n if (\n eventListenerMap?.[EventUtils.TAP] ||\n eventListenerMap?.[EventUtils.DBL_TAP] ||\n eventListenerMap?.[EventUtils.CONTEXTMENU]\n ) {\n return 'pointer';\n }\n }, [cursor, eventListenerMap]);\n\n const lineString = useMemo(() => createLineString(positions), [positions]);\n const resolvedStyles = useMemo(\n () =>\n createResolvedRouteStyles({\n style,\n hoverStyle,\n isReduced,\n isRouteAlternative,\n showHitArea,\n }),\n [style, hoverStyle, isReduced, isRouteAlternative, showHitArea]\n );\n\n const applyCursor = (nextCursor: string) => {\n if (!api.map) {\n return;\n }\n\n const mapElement = api.map.getElement() as HTMLElement;\n const viewportElement = api.map.getViewPort().element as HTMLElement;\n\n mapElement.style.cursor = nextCursor;\n viewportElement.style.cursor = nextCursor;\n };\n\n const applyVisibleStyles = (hovered: boolean) => {\n routePolylineRef.current?.line.setStyle(hovered ? resolvedStyles.hoverRouteStyle : resolvedStyles.routeStyle);\n\n if (borderPolylineRef.current) {\n borderPolylineRef.current.line.setStyle(\n hovered ? resolvedStyles.hoverBorderStyle : resolvedStyles.borderStyle\n );\n }\n };\n\n const activateInteractionState = () => {\n isHoveredRef.current = true;\n applyVisibleStyles(true);\n\n if (resolvedCursor) {\n applyCursor(resolvedCursor);\n }\n };\n\n const clearInteractionState = () => {\n isHoveredRef.current = false;\n applyVisibleStyles(false);\n\n if (resolvedCursor) {\n applyCursor('');\n }\n };\n\n useEffect(() => {\n applyVisibleStyles(isHoveredRef.current);\n }, [\n resolvedStyles.routeStyle,\n resolvedStyles.borderStyle,\n resolvedStyles.hoverRouteStyle,\n resolvedStyles.hoverBorderStyle,\n ]);\n\n useEffect(\n () => () => {\n isHoveredRef.current = false;\n clearInteractionState();\n },\n [api.map, resolvedCursor]\n );\n\n const resolvedEventListenerMap = useMemo(() => {\n if (!(eventListenerMap || hoverStyle || resolvedCursor)) {\n return;\n }\n\n return {\n ...eventListenerMap,\n [EventUtils.POINTER_ENTER]: (...args: unknown[]) => {\n activateInteractionState();\n\n eventListenerMap?.[EventUtils.POINTER_ENTER]?.(...args);\n },\n [EventUtils.POINTER_LEAVE]: (...args: unknown[]) => {\n clearInteractionState();\n\n eventListenerMap?.[EventUtils.POINTER_LEAVE]?.(...args);\n },\n [EventUtils.POINTER_CANCEL]: (...args: unknown[]) => {\n clearInteractionState();\n\n eventListenerMap?.[EventUtils.POINTER_CANCEL]?.(...args);\n },\n } satisfies EventListenerMap;\n }, [eventListenerMap, hoverStyle, resolvedCursor, resolvedStyles]);\n\n return (\n <div>\n {resolvedStyles.borderWidth > 0 && (\n <Polyline\n geometry={lineString}\n style={resolvedStyles.borderStyle}\n customData={customData}\n onReady={objects => {\n borderPolylineRef.current = objects;\n\n if (objects) {\n objects.line.setStyle(\n isHoveredRef.current ? resolvedStyles.hoverBorderStyle : resolvedStyles.borderStyle\n );\n }\n }}\n />\n )}\n <Polyline\n hasArrows={hasArrows}\n arrowStyle={arrowStyle}\n geometry={lineString}\n style={resolvedStyles.routeStyle}\n customData={customData}\n onReady={objects => {\n routePolylineRef.current = objects;\n\n if (objects) {\n objects.line.setStyle(\n isHoveredRef.current ? resolvedStyles.hoverRouteStyle : resolvedStyles.routeStyle\n );\n }\n }}\n />\n {resolvedEventListenerMap && (\n // Keep interaction on a single invisible polyline so hover/cursor/click stay stable\n // even though the visible route may consist of multiple rendered polylines.\n <Polyline\n eventListenerMap={resolvedEventListenerMap}\n geometry={lineString}\n style={resolvedStyles.hitAreaStyle}\n customData={customData}\n />\n )}\n {startIcon && <Marker key='startIcon' position={positions[0]} icon={startIcon} />}\n {middleIcon && (\n <Marker key='middleIcon' position={positions[Math.floor(positions.length / 2)]} icon={middleIcon} />\n )}\n {endIcon && <Marker key='endIcon' position={positions[positions.length - 1]} icon={endIcon} />}\n {isArray(markers) && markers.map(marker => marker)}\n </div>\n );\n};\n\nexport default Route;\n"],"names":["MISSING_POSITIONS_EXCEPTION_MSG","TO_LESS_LINE_WIDTH_EXCEPTION_MSG","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_COLOR_REDUCED","DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE","DEFAULT_BORDER_STROKE_COLOR","DEFAULT_BORDER_STROKE_COLOR_REDUCED","ROUTE_COLOR_DANGER","ROUTE_COLOR_WARNING","ROUTE_COLOR_SUCCESS","ROUTE_COLOR_WHITE","ARROW_COLOR_WARNING","HIT_POLYLINE_EXTRA_WIDTH","DEFAULT_WIDTH","DEFAULT_BORDER_WIDTH","defaultStyle","alternativeRouteStyle","createLineString","positions","isEmpty","MapException","lineString","position","createResolvedRouteStyles","options","style","hoverStyle","isReduced","isRouteAlternative","showHitArea","createStyleSet","updatedStyle","mergedStyle","color","width","borderColor","mergedBorderWidth","isBorderIncludedInWidth","lineDash","baseStyleSet","hoverStyleSet","Route","props","startIcon","middleIcon","endIcon","arrowStyle","hasArrows","markers","customData","eventListenerMap","cursor","api","useMapContext","routePolylineRef","useRef","borderPolylineRef","isHoveredRef","resolvedCursor","useMemo","EventUtils","resolvedStyles","applyCursor","nextCursor","mapElement","viewportElement","applyVisibleStyles","hovered","activateInteractionState","clearInteractionState","useEffect","resolvedEventListenerMap","args","jsx","Polyline","objects","Marker","isArray","marker"],"mappings":";;;;;;;;AAUO,MAAMA,IAAkC,2CAElCC,IACT,oGAESC,IAA4B,yBAC5BC,IAAoC,2BACpCC,IAAwC,sBAExCC,IAA8B,yBAC9BC,IAAsC,0BAItCC,KAAqB,WACrBC,KAAsB,WACtBC,KAAsB,WACtBC,KAAoB,0BAEpBC,KAAsB,wBAC7BC,IAA2B,IAuG3BC,IAAgB,GAChBC,KAAuB,GAEvBC,IAA2B;AAAA,EAC7B,OAAOF;AAAA,EACP,OAAOX;AAAA,EACP,aAAaY;AAAA,EACb,aAAaT;AAAA,EACb,yBAAyB;AAC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AA;AAAA,IAAA;AAAA,IAEHU;AAAA;AAAA,IAGG,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,kBAAkBH;AAAA,QAClB,UAAUlD;AAAA,QACV,OAAOwC,EAAe;AAAA,QACtB,YAAAZ;AAAA,MAAA;AAAA,IAAA;AAAA,IAGPN,uBAAciC,GAAA,EAAuB,UAAU1D,EAAU,CAAC,GAAG,MAAMyB,EAAA,GAA1C,WAAqD;AAAA,IAC9EC,KACG,gBAAA6B,EAACG,GAAA,EAAwB,UAAU1D,EAAU,KAAK,MAAMA,EAAU,SAAS,CAAC,CAAC,GAAG,MAAM0B,KAA1E,YAAsF;AAAA,IAErGC,KAAW,gBAAA4B,EAACG,GAAA,EAAqB,UAAU1D,EAAUA,EAAU,SAAS,CAAC,GAAG,MAAM2B,EAAA,GAA3D,SAAoE;AAAA,IAC3FgC,EAAQ7B,CAAO,KAAKA,EAAQ,IAAI,OAAU8B,CAAM;AAAA,EAAA,GACrD;AAER;"}
@@ -2,9 +2,29 @@ import { default as React } from 'react';
2
2
  import { EventListenerMap } from '../../../utils/eventHandling';
3
3
  import { Position } from '../../../utils/mapTypes';
4
4
  export type MarkerIcon = string | React.ReactElement;
5
+ type GetOrCreateIconOptions = {
6
+ cacheEnabled?: boolean;
7
+ };
5
8
  export declare const isHMapIcon: (icon: MarkerIcon | H.map.DomIcon | undefined) => icon is H.map.Icon;
6
9
  export declare const isDomMakerNeeded: (icon: MarkerIcon | H.map.DomIcon | undefined) => boolean;
7
- export declare const getOrCreateIcon: (icon: MarkerIcon | H.map.DomIcon | undefined) => H.map.DomIcon | H.map.Icon;
10
+ export declare const getMarkerDebugStats: () => {
11
+ cacheEnabled: boolean;
12
+ domIconCreations: number;
13
+ markupCacheHits: number;
14
+ markupCacheMisses: number;
15
+ reactElementCacheHits: number;
16
+ reactElementCacheMisses: number;
17
+ uncachedDomIconCreations: number;
18
+ markerSetups: number;
19
+ markerDestroys: number;
20
+ markerIconUpdates: number;
21
+ markerIconRecreates: number;
22
+ markerSetIconCalls: number;
23
+ };
24
+ export declare const resetMarkerDebugStats: () => void;
25
+ export declare const setMarkerIconCacheEnabled: (enabled: boolean) => void;
26
+ export declare const clearMarkerIconCache: () => void;
27
+ export declare const getOrCreateIcon: (icon: MarkerIcon | H.map.DomIcon | undefined, options?: GetOrCreateIconOptions) => H.map.DomIcon | H.map.Icon;
8
28
  export type MarkerProps = {
9
29
  position: Position;
10
30
  icon?: MarkerIcon;