@dxos/react-ui-geo 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/dist/lib/browser/{countries-110m-ZM3ZIEFS.mjs → countries-110m-RE5RNRQG.mjs} +1 -1
- package/dist/lib/browser/data.mjs +4 -3
- package/dist/lib/browser/data.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +111 -120
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +19 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{countries-110m-3SFASWVD.mjs → countries-110m-4EDBXSFJ.mjs} +1 -1
- package/dist/lib/node-esm/data.mjs +5 -3
- package/dist/lib/node-esm/data.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +111 -119
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +21 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/data/airports.d.ts +4 -4
- package/dist/types/data/airports.d.ts.map +1 -1
- package/dist/types/data/cities.d.ts.map +1 -1
- package/dist/types/data/countries-110m.d.ts.map +1 -1
- package/dist/types/data/countries-dots-3.d.ts.map +1 -1
- package/dist/types/data/countries-dots-4.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +5 -3
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +6 -4
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.d.ts +20 -4
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts +1 -3
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrag.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useSpinner.d.ts.map +1 -1
- package/dist/types/src/hooks/useTour.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -4
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/debug.d.ts.map +1 -1
- package/dist/types/src/util/inertia.d.ts.map +1 -1
- package/dist/types/src/util/path.d.ts.map +1 -1
- package/dist/types/src/util/render.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -24
- package/src/components/Globe/Globe.stories.tsx +5 -6
- package/src/components/Globe/Globe.tsx +56 -21
- package/src/components/Map/Map.stories.tsx +7 -6
- package/src/components/Map/Map.tsx +76 -31
- package/src/components/Toolbar/Controls.tsx +5 -5
- package/src/hooks/context.tsx +5 -34
- package/src/hooks/useSpinner.ts +0 -1
- package/src/index.ts +0 -2
- package/src/translations.ts +4 -4
- package/src/util/render.ts +0 -1
- package/dist/lib/browser/chunk-GMWLKTLN.mjs +0 -9
- package/dist/lib/browser/chunk-GMWLKTLN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JODBF4CC.mjs +0 -11
- package/dist/lib/node-esm/chunk-JODBF4CC.mjs.map +0 -7
- /package/dist/lib/browser/{countries-110m-ZM3ZIEFS.mjs.map → countries-110m-RE5RNRQG.mjs.map} +0 -0
- /package/dist/lib/node-esm/{countries-110m-3SFASWVD.mjs.map → countries-110m-4EDBXSFJ.mjs.map} +0 -0
|
@@ -1,46 +1,16 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
loadTopology
|
|
4
|
-
} from "./chunk-JODBF4CC.mjs";
|
|
5
2
|
|
|
6
3
|
// src/components/Globe/Globe.tsx
|
|
7
4
|
import { easeLinear, easeSinOut, geoMercator, geoOrthographic, geoPath as geoPath2, geoTransverseMercator, interpolateNumber, transition } from "d3";
|
|
8
|
-
import
|
|
5
|
+
import React2, { forwardRef, useEffect as useEffect4, useImperativeHandle, useMemo as useMemo2, useRef, useState as useState3 } from "react";
|
|
9
6
|
import { useResizeDetector } from "react-resize-detector";
|
|
10
|
-
import { useDynamicRef, useThemeContext } from "@dxos/react-ui";
|
|
11
|
-
import { mx } from "@dxos/ui-theme";
|
|
7
|
+
import { useComposedRefs, useControlledState, useDynamicRef, useThemeContext } from "@dxos/react-ui";
|
|
8
|
+
import { composable, composableProps, mx } from "@dxos/ui-theme";
|
|
12
9
|
|
|
13
10
|
// src/hooks/context.tsx
|
|
14
|
-
import
|
|
11
|
+
import { createContext, useContext } from "react";
|
|
15
12
|
import { raise } from "@dxos/debug";
|
|
16
|
-
import { useControlledState } from "@dxos/react-ui";
|
|
17
|
-
var defaults = {
|
|
18
|
-
center: {
|
|
19
|
-
lat: 51,
|
|
20
|
-
lng: 0
|
|
21
|
-
},
|
|
22
|
-
zoom: 4
|
|
23
|
-
};
|
|
24
13
|
var GlobeContext = /* @__PURE__ */ createContext(void 0);
|
|
25
|
-
var GlobeContextProvider = ({ children, size, center: centerProp = defaults.center, zoom: zoomProp = defaults.zoom, translation: translationProp, rotation: rotationProp }) => {
|
|
26
|
-
const [center, setCenter] = useControlledState(centerProp);
|
|
27
|
-
const [zoom, setZoom] = useControlledState(zoomProp);
|
|
28
|
-
const [translation, setTranslation] = useControlledState(translationProp);
|
|
29
|
-
const [rotation, setRotation] = useControlledState(rotationProp);
|
|
30
|
-
return /* @__PURE__ */ React.createElement(GlobeContext.Provider, {
|
|
31
|
-
value: {
|
|
32
|
-
size,
|
|
33
|
-
center,
|
|
34
|
-
zoom,
|
|
35
|
-
translation,
|
|
36
|
-
rotation,
|
|
37
|
-
setCenter,
|
|
38
|
-
setZoom,
|
|
39
|
-
setTranslation,
|
|
40
|
-
setRotation
|
|
41
|
-
}
|
|
42
|
-
}, children);
|
|
43
|
-
};
|
|
44
14
|
var useGlobeContext = () => {
|
|
45
15
|
return useContext(GlobeContext) ?? raise(new Error("Missing GlobeContext"));
|
|
46
16
|
};
|
|
@@ -625,25 +595,9 @@ var useTour = (controller, points, options = {}) => {
|
|
|
625
595
|
};
|
|
626
596
|
|
|
627
597
|
// src/components/Toolbar/Controls.tsx
|
|
628
|
-
import
|
|
598
|
+
import React from "react";
|
|
629
599
|
import { IconButton, Toolbar, useTranslation } from "@dxos/react-ui";
|
|
630
|
-
|
|
631
|
-
// src/translations.ts
|
|
632
|
-
var translationKey = "@dxos/react-ui-geo";
|
|
633
|
-
var translations = [
|
|
634
|
-
{
|
|
635
|
-
"en-US": {
|
|
636
|
-
[translationKey]: {
|
|
637
|
-
"zoom in icon button": "Zoom in",
|
|
638
|
-
"zoom out icon button": "Zoom out",
|
|
639
|
-
"start icon button": "Start",
|
|
640
|
-
"toggle icon button": "Toggle"
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
];
|
|
645
|
-
|
|
646
|
-
// src/components/Toolbar/Controls.tsx
|
|
600
|
+
import { translationKey } from "#translations";
|
|
647
601
|
var controlPositions = {
|
|
648
602
|
topleft: "top-2 left-2",
|
|
649
603
|
topright: "top-2 right-2",
|
|
@@ -652,39 +606,39 @@ var controlPositions = {
|
|
|
652
606
|
};
|
|
653
607
|
var ZoomControls = ({ classNames, onAction }) => {
|
|
654
608
|
const { t } = useTranslation(translationKey);
|
|
655
|
-
return /* @__PURE__ */
|
|
609
|
+
return /* @__PURE__ */ React.createElement(Toolbar.Root, {
|
|
656
610
|
classNames: [
|
|
657
611
|
"gap-2",
|
|
658
612
|
classNames
|
|
659
613
|
]
|
|
660
|
-
}, /* @__PURE__ */
|
|
614
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
661
615
|
icon: "ph--plus--regular",
|
|
662
616
|
iconOnly: true,
|
|
663
|
-
label: t("zoom
|
|
617
|
+
label: t("zoom-in-icon.button"),
|
|
664
618
|
onClick: () => onAction?.("zoom-in")
|
|
665
|
-
}), /* @__PURE__ */
|
|
619
|
+
}), /* @__PURE__ */ React.createElement(IconButton, {
|
|
666
620
|
icon: "ph--minus--regular",
|
|
667
621
|
iconOnly: true,
|
|
668
|
-
label: t("zoom
|
|
622
|
+
label: t("zoom-out-icon.button"),
|
|
669
623
|
onClick: () => onAction?.("zoom-out")
|
|
670
624
|
}));
|
|
671
625
|
};
|
|
672
626
|
var ActionControls = ({ classNames, onAction }) => {
|
|
673
627
|
const { t } = useTranslation(translationKey);
|
|
674
|
-
return /* @__PURE__ */
|
|
628
|
+
return /* @__PURE__ */ React.createElement(Toolbar.Root, {
|
|
675
629
|
classNames: [
|
|
676
630
|
"gap-2",
|
|
677
631
|
classNames
|
|
678
632
|
]
|
|
679
|
-
}, /* @__PURE__ */
|
|
633
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
680
634
|
icon: "ph--path--regular",
|
|
681
635
|
iconOnly: true,
|
|
682
|
-
label: t("start
|
|
636
|
+
label: t("start-icon.button"),
|
|
683
637
|
onClick: () => onAction?.("start")
|
|
684
|
-
}), /* @__PURE__ */
|
|
638
|
+
}), /* @__PURE__ */ React.createElement(IconButton, {
|
|
685
639
|
icon: "ph--globe-hemisphere-west--regular",
|
|
686
640
|
iconOnly: true,
|
|
687
|
-
label: t("toggle
|
|
641
|
+
label: t("toggle-icon.button"),
|
|
688
642
|
onClick: () => onAction?.("toggle")
|
|
689
643
|
}));
|
|
690
644
|
};
|
|
@@ -744,19 +698,39 @@ var getProjection = (type = "orthographic") => {
|
|
|
744
698
|
}
|
|
745
699
|
return type ?? geoOrthographic();
|
|
746
700
|
};
|
|
747
|
-
var
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
701
|
+
var DEFAULT_ZOOM = 1.5;
|
|
702
|
+
var GlobeRoot = composable(({ children, center: centerProp, zoom: zoomProp = DEFAULT_ZOOM, translation: translationProp, rotation: rotationProp, ...props }, forwardedRef) => {
|
|
703
|
+
const localRef = useRef(null);
|
|
704
|
+
const composedRef = useComposedRefs(localRef, forwardedRef);
|
|
705
|
+
const { width, height } = useResizeDetector({
|
|
706
|
+
targetRef: localRef
|
|
707
|
+
});
|
|
708
|
+
const [center, setCenter] = useControlledState(centerProp);
|
|
709
|
+
const [zoom, setZoom] = useControlledState(zoomProp);
|
|
710
|
+
const [translation, setTranslation] = useControlledState(translationProp);
|
|
711
|
+
const [rotation, setRotation] = useControlledState(rotationProp);
|
|
712
|
+
return /* @__PURE__ */ React2.createElement(GlobeContext.Provider, {
|
|
713
|
+
value: {
|
|
714
|
+
size: {
|
|
715
|
+
width,
|
|
716
|
+
height
|
|
717
|
+
},
|
|
718
|
+
center,
|
|
719
|
+
zoom,
|
|
720
|
+
translation,
|
|
721
|
+
rotation,
|
|
722
|
+
setCenter,
|
|
723
|
+
setZoom,
|
|
724
|
+
setTranslation,
|
|
725
|
+
setRotation
|
|
726
|
+
}
|
|
727
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
728
|
+
...composableProps(props, {
|
|
729
|
+
classNames: "relative dx-container"
|
|
730
|
+
}),
|
|
731
|
+
ref: composedRef
|
|
758
732
|
}, children));
|
|
759
|
-
};
|
|
733
|
+
});
|
|
760
734
|
var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: projectionProp, topology, features, styles: stylesProp }, forwardRef3) => {
|
|
761
735
|
const { themeMode } = useThemeContext();
|
|
762
736
|
const styles = useMemo2(() => stylesProp ?? defaultStyles[themeMode], [
|
|
@@ -779,7 +753,6 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: projectionProp, topo
|
|
|
779
753
|
const zoomRef = useDynamicRef(zoom);
|
|
780
754
|
useEffect4(() => {
|
|
781
755
|
if (center) {
|
|
782
|
-
setZoom(1);
|
|
783
756
|
setRotation(positionToRotation(geoToPosition(center)));
|
|
784
757
|
}
|
|
785
758
|
}, [
|
|
@@ -844,7 +817,7 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: projectionProp, topo
|
|
|
844
817
|
if (!size.width || !size.height) {
|
|
845
818
|
return null;
|
|
846
819
|
}
|
|
847
|
-
return /* @__PURE__ */
|
|
820
|
+
return /* @__PURE__ */ React2.createElement("canvas", {
|
|
848
821
|
ref: canvasRef,
|
|
849
822
|
width: size.width,
|
|
850
823
|
height: size.height
|
|
@@ -852,9 +825,9 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: projectionProp, topo
|
|
|
852
825
|
});
|
|
853
826
|
var GlobeDebug = ({ position = "topleft" }) => {
|
|
854
827
|
const { size, zoom, translation, rotation } = useGlobeContext();
|
|
855
|
-
return /* @__PURE__ */
|
|
828
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
856
829
|
className: mx("z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded-sm", controlPositions[position])
|
|
857
|
-
}, /* @__PURE__ */
|
|
830
|
+
}, /* @__PURE__ */ React2.createElement("pre", {
|
|
858
831
|
className: "font-mono text-xs text-green-700"
|
|
859
832
|
}, JSON.stringify({
|
|
860
833
|
size,
|
|
@@ -864,25 +837,25 @@ var GlobeDebug = ({ position = "topleft" }) => {
|
|
|
864
837
|
}, null, 2)));
|
|
865
838
|
};
|
|
866
839
|
var GlobePanel = ({ position, classNames, children }) => {
|
|
867
|
-
return /* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
868
841
|
className: mx("z-10 absolute overflow-hidden", controlPositions[position], classNames)
|
|
869
842
|
}, children);
|
|
870
843
|
};
|
|
871
844
|
var CustomControl = ({ position, children }) => {
|
|
872
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
873
846
|
className: mx("z-10 absolute overflow-hidden", controlPositions[position])
|
|
874
847
|
}, children);
|
|
875
848
|
};
|
|
876
|
-
var GlobeZoom = ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */
|
|
849
|
+
var GlobeZoom = ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */ React2.createElement(CustomControl, {
|
|
877
850
|
position,
|
|
878
851
|
...props
|
|
879
|
-
}, /* @__PURE__ */
|
|
852
|
+
}, /* @__PURE__ */ React2.createElement(ZoomControls, {
|
|
880
853
|
onAction
|
|
881
854
|
}));
|
|
882
|
-
var GlobeAction = ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */
|
|
855
|
+
var GlobeAction = ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */ React2.createElement(CustomControl, {
|
|
883
856
|
position,
|
|
884
857
|
...props
|
|
885
|
-
}, /* @__PURE__ */
|
|
858
|
+
}, /* @__PURE__ */ React2.createElement(ActionControls, {
|
|
886
859
|
onAction
|
|
887
860
|
}));
|
|
888
861
|
var Globe = {
|
|
@@ -898,24 +871,47 @@ var Globe = {
|
|
|
898
871
|
import "leaflet/dist/leaflet.css";
|
|
899
872
|
import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
900
873
|
import L, { Control, DomEvent, DomUtil, latLngBounds } from "leaflet";
|
|
901
|
-
import
|
|
874
|
+
import React3, { forwardRef as forwardRef2, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2, useRef as useRef2 } from "react";
|
|
902
875
|
import { createRoot } from "react-dom/client";
|
|
903
876
|
import { MapContainer, Marker, Popup, TileLayer, useMap, useMapEvents } from "react-leaflet";
|
|
904
877
|
import { ThemeProvider, Tooltip } from "@dxos/react-ui";
|
|
905
|
-
import { defaultTx, mx as mx2 } from "@dxos/ui-theme";
|
|
906
|
-
var
|
|
878
|
+
import { composable as composable2, composableProps as composableProps2, defaultTx, mx as mx2 } from "@dxos/ui-theme";
|
|
879
|
+
var defaults = {
|
|
907
880
|
center: {
|
|
908
881
|
lat: 51,
|
|
909
882
|
lng: 0
|
|
910
883
|
},
|
|
911
884
|
zoom: 4
|
|
912
885
|
};
|
|
913
|
-
var [
|
|
914
|
-
var MapRoot =
|
|
915
|
-
const
|
|
886
|
+
var [MapContextProvider, useMapContext] = createContext2("Map");
|
|
887
|
+
var MapRoot = composable2(({ children, onChange, ...props }, forwardedRef) => {
|
|
888
|
+
const attention = false;
|
|
889
|
+
return /* @__PURE__ */ React3.createElement(MapContextProvider, {
|
|
890
|
+
attention,
|
|
891
|
+
onChange
|
|
892
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
893
|
+
...composableProps2(props, {
|
|
894
|
+
role: "none",
|
|
895
|
+
classNames: "dx-container grid dx-focus-ring-inset"
|
|
896
|
+
}),
|
|
897
|
+
ref: forwardedRef
|
|
898
|
+
}, children));
|
|
899
|
+
});
|
|
900
|
+
MapRoot.displayName = "Map.Root";
|
|
901
|
+
var MAP_CONTENT_NAME = "Map.Content";
|
|
902
|
+
var MapContent = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true, doubleClickZoom = true, touchZoom = true, center, zoom, children, ...props }, forwardedRef) => {
|
|
903
|
+
const { attention } = useMapContext(MAP_CONTENT_NAME);
|
|
916
904
|
const mapRef = useRef2(null);
|
|
917
905
|
const map = mapRef.current;
|
|
918
906
|
useImperativeHandle2(forwardedRef, () => ({
|
|
907
|
+
getCenter: () => {
|
|
908
|
+
const center2 = mapRef.current?.getCenter();
|
|
909
|
+
return center2 ? {
|
|
910
|
+
lat: center2.lat,
|
|
911
|
+
lng: center2.lng
|
|
912
|
+
} : void 0;
|
|
913
|
+
},
|
|
914
|
+
getZoom: () => mapRef.current?.getZoom(),
|
|
919
915
|
setCenter: (center2, zoom2) => {
|
|
920
916
|
mapRef.current?.setView(center2, zoom2);
|
|
921
917
|
},
|
|
@@ -936,29 +932,28 @@ var MapRoot = /* @__PURE__ */ forwardRef2(({ classNames, scrollWheelZoom = true,
|
|
|
936
932
|
map,
|
|
937
933
|
attention
|
|
938
934
|
]);
|
|
939
|
-
return /* @__PURE__ */
|
|
940
|
-
attention,
|
|
941
|
-
onChange
|
|
942
|
-
}, /* @__PURE__ */ React4.createElement(MapContainer, {
|
|
935
|
+
return /* @__PURE__ */ React3.createElement(MapContainer, {
|
|
943
936
|
...props,
|
|
944
|
-
|
|
945
|
-
className: mx2("group relative grid h-full w-full !bg-base-surface dx-focus-ring-inset", classNames),
|
|
937
|
+
className: mx2("group relative grid bg-base-surface!", classNames),
|
|
946
938
|
attributionControl: false,
|
|
947
939
|
zoomControl: false,
|
|
948
940
|
scrollWheelZoom,
|
|
949
941
|
doubleClickZoom,
|
|
950
942
|
touchZoom,
|
|
951
|
-
center: center ??
|
|
952
|
-
zoom: zoom ??
|
|
953
|
-
|
|
943
|
+
center: center ?? defaults.center,
|
|
944
|
+
zoom: zoom ?? defaults.zoom,
|
|
945
|
+
whenReady: () => {
|
|
946
|
+
},
|
|
947
|
+
ref: mapRef
|
|
948
|
+
}, children);
|
|
954
949
|
});
|
|
955
|
-
|
|
950
|
+
MapContent.displayName = "Map.Content";
|
|
956
951
|
var MAP_TILES_NAME = "Map.Tiles";
|
|
957
952
|
var MapTiles = (_props) => {
|
|
958
953
|
const ref = useRef2(null);
|
|
959
954
|
const { onChange } = useMapContext(MAP_TILES_NAME);
|
|
960
955
|
useMapEvents({
|
|
961
|
-
|
|
956
|
+
moveend: (ev) => {
|
|
962
957
|
onChange?.({
|
|
963
958
|
center: ev.target.getCenter(),
|
|
964
959
|
zoom: ev.target.getZoom()
|
|
@@ -973,7 +968,7 @@ var MapTiles = (_props) => {
|
|
|
973
968
|
}, [
|
|
974
969
|
attention
|
|
975
970
|
]);
|
|
976
|
-
return /* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(TileLayer, {
|
|
977
972
|
ref,
|
|
978
973
|
"data-attention": attention,
|
|
979
974
|
detectRetina: true,
|
|
@@ -986,17 +981,16 @@ MapTiles.displayName = MAP_TILES_NAME;
|
|
|
986
981
|
var MapMarkers = ({ selected, markers }) => {
|
|
987
982
|
const map = useMap();
|
|
988
983
|
useEffect5(() => {
|
|
989
|
-
if (markers.length > 0) {
|
|
984
|
+
if (markers && markers.length > 0) {
|
|
990
985
|
const bounds = latLngBounds(markers.map((marker) => marker.location));
|
|
991
986
|
map.fitBounds(bounds);
|
|
992
|
-
} else {
|
|
993
|
-
map.setView(defaults2.center, defaults2.zoom);
|
|
994
987
|
}
|
|
995
988
|
}, [
|
|
996
|
-
markers
|
|
989
|
+
markers,
|
|
990
|
+
map
|
|
997
991
|
]);
|
|
998
|
-
return /* @__PURE__ */
|
|
999
|
-
return /* @__PURE__ */
|
|
992
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, markers?.map(({ id, title, location: { lat, lng } }) => {
|
|
993
|
+
return /* @__PURE__ */ React3.createElement(Marker, {
|
|
1000
994
|
key: id,
|
|
1001
995
|
position: {
|
|
1002
996
|
lat,
|
|
@@ -1027,7 +1021,7 @@ var MapMarkers = ({ selected, markers }) => {
|
|
|
1027
1021
|
]
|
|
1028
1022
|
})
|
|
1029
1023
|
)
|
|
1030
|
-
}, title && /* @__PURE__ */
|
|
1024
|
+
}, title && /* @__PURE__ */ React3.createElement(Popup, null, title));
|
|
1031
1025
|
}));
|
|
1032
1026
|
};
|
|
1033
1027
|
MapMarkers.displayName = "Map.Markers";
|
|
@@ -1042,9 +1036,9 @@ var CustomControl2 = ({ position, children }) => {
|
|
|
1042
1036
|
DomEvent.disableClickPropagation(container);
|
|
1043
1037
|
DomEvent.disableScrollPropagation(container);
|
|
1044
1038
|
const root = createRoot(container);
|
|
1045
|
-
root.render(/* @__PURE__ */
|
|
1039
|
+
root.render(/* @__PURE__ */ React3.createElement(ThemeProvider, {
|
|
1046
1040
|
tx: defaultTx
|
|
1047
|
-
}, /* @__PURE__ */
|
|
1041
|
+
}, /* @__PURE__ */ React3.createElement(Tooltip.Provider, null, children)));
|
|
1048
1042
|
return container;
|
|
1049
1043
|
};
|
|
1050
1044
|
control.addTo(map);
|
|
@@ -1058,20 +1052,21 @@ var CustomControl2 = ({ position, children }) => {
|
|
|
1058
1052
|
]);
|
|
1059
1053
|
return null;
|
|
1060
1054
|
};
|
|
1061
|
-
var MapZoom = ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */
|
|
1055
|
+
var MapZoom = ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */ React3.createElement(CustomControl2, {
|
|
1062
1056
|
position,
|
|
1063
1057
|
...props
|
|
1064
|
-
}, /* @__PURE__ */
|
|
1058
|
+
}, /* @__PURE__ */ React3.createElement(ZoomControls, {
|
|
1065
1059
|
onAction
|
|
1066
1060
|
}));
|
|
1067
|
-
var MapAction = ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */
|
|
1061
|
+
var MapAction = ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */ React3.createElement(CustomControl2, {
|
|
1068
1062
|
position,
|
|
1069
1063
|
...props
|
|
1070
|
-
}, /* @__PURE__ */
|
|
1064
|
+
}, /* @__PURE__ */ React3.createElement(ActionControls, {
|
|
1071
1065
|
onAction
|
|
1072
1066
|
}));
|
|
1073
1067
|
var Map = {
|
|
1074
1068
|
Root: MapRoot,
|
|
1069
|
+
Content: MapContent,
|
|
1075
1070
|
Tiles: MapTiles,
|
|
1076
1071
|
Markers: MapMarkers,
|
|
1077
1072
|
Zoom: MapZoom,
|
|
@@ -1080,7 +1075,7 @@ var Map = {
|
|
|
1080
1075
|
export {
|
|
1081
1076
|
ActionControls,
|
|
1082
1077
|
Globe,
|
|
1083
|
-
|
|
1078
|
+
GlobeContext,
|
|
1084
1079
|
Map,
|
|
1085
1080
|
ZoomControls,
|
|
1086
1081
|
closestPoint,
|
|
@@ -1092,13 +1087,10 @@ export {
|
|
|
1092
1087
|
geoPoint,
|
|
1093
1088
|
geoToPosition,
|
|
1094
1089
|
getDistance,
|
|
1095
|
-
loadTopology,
|
|
1096
1090
|
positionToRotation,
|
|
1097
1091
|
renderLayers,
|
|
1098
1092
|
restrictAxis,
|
|
1099
1093
|
timer,
|
|
1100
|
-
translationKey,
|
|
1101
|
-
translations,
|
|
1102
1094
|
useDrag,
|
|
1103
1095
|
useGlobeContext,
|
|
1104
1096
|
useGlobeZoomHandler,
|