@page-speed/maps 0.2.2 → 0.2.4
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/dist/components/geo-map.cjs +42 -15
- package/dist/components/geo-map.cjs.map +1 -1
- package/dist/components/geo-map.js +42 -15
- package/dist/components/geo-map.js.map +1 -1
- package/dist/components/index.cjs +42 -15
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +42 -15
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +42 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -704,8 +704,9 @@ function MarkerActions({ actions }) {
|
|
|
704
704
|
...rest
|
|
705
705
|
} = action;
|
|
706
706
|
const buttonStyles = cn(
|
|
707
|
-
"
|
|
708
|
-
|
|
707
|
+
"gap-2 px-4 py-2 rounded-md font-medium transition-colors duration-500",
|
|
708
|
+
"flex justify-center items-center",
|
|
709
|
+
variant === "outline" ? "border border-border bg-card text-card-foreground hover:bg-primary hover:text-primary-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
709
710
|
size === "sm" && "text-sm px-3 py-1.5",
|
|
710
711
|
size === "icon" && "p-2",
|
|
711
712
|
actionClassName
|
|
@@ -809,7 +810,7 @@ function MarkerMediaCarousel({
|
|
|
809
810
|
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { name: "lucide/arrow-right", size: 18 })
|
|
810
811
|
}
|
|
811
812
|
),
|
|
812
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-2 left-1/2 flex -translate-x-1/2 items-center gap-1.5 z-
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-2 left-1/2 flex -translate-x-1/2 items-center gap-1.5 z-2", children: mediaItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
813
814
|
"button",
|
|
814
815
|
{
|
|
815
816
|
type: "button",
|
|
@@ -1038,24 +1039,44 @@ function GeoMap({
|
|
|
1038
1039
|
longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
|
|
1039
1040
|
zoom: defaultViewState?.zoom ?? calculatedZoom
|
|
1040
1041
|
});
|
|
1041
|
-
const [dynamicPanelPosition, setDynamicPanelPosition] = React3__namespace.useState(
|
|
1042
|
-
|
|
1042
|
+
const [dynamicPanelPosition, setDynamicPanelPosition] = React3__namespace.useState(panelPosition);
|
|
1043
|
+
const viewStateRef = React3__namespace.useRef(
|
|
1044
|
+
uncontrolledViewState
|
|
1043
1045
|
);
|
|
1044
|
-
const viewStateRef = React3__namespace.useRef(uncontrolledViewState);
|
|
1045
1046
|
React3__namespace.useEffect(() => {
|
|
1046
1047
|
if (!viewState && !defaultViewState) {
|
|
1047
|
-
setUncontrolledViewState({
|
|
1048
|
-
latitude
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
setUncontrolledViewState((prev) => {
|
|
1049
|
+
if (prev.latitude === firstCoordinate.latitude && prev.longitude === firstCoordinate.longitude && prev.zoom === calculatedZoom) {
|
|
1050
|
+
return prev;
|
|
1051
|
+
}
|
|
1052
|
+
return {
|
|
1053
|
+
latitude: firstCoordinate.latitude,
|
|
1054
|
+
longitude: firstCoordinate.longitude,
|
|
1055
|
+
zoom: calculatedZoom
|
|
1056
|
+
};
|
|
1051
1057
|
});
|
|
1052
1058
|
}
|
|
1053
|
-
}, [
|
|
1059
|
+
}, [
|
|
1060
|
+
// Use primitive values instead of objects to avoid reference changes
|
|
1061
|
+
firstCoordinate.latitude,
|
|
1062
|
+
firstCoordinate.longitude,
|
|
1063
|
+
calculatedZoom,
|
|
1064
|
+
viewState,
|
|
1065
|
+
defaultViewState
|
|
1066
|
+
]);
|
|
1054
1067
|
const isControlledViewState = viewState !== void 0;
|
|
1055
1068
|
const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
|
|
1056
1069
|
React3__namespace.useEffect(() => {
|
|
1057
1070
|
viewStateRef.current = resolvedViewState || uncontrolledViewState;
|
|
1058
|
-
}, [
|
|
1071
|
+
}, [
|
|
1072
|
+
// Use primitive values to avoid reference changes
|
|
1073
|
+
resolvedViewState?.latitude,
|
|
1074
|
+
resolvedViewState?.longitude,
|
|
1075
|
+
resolvedViewState?.zoom,
|
|
1076
|
+
uncontrolledViewState.latitude,
|
|
1077
|
+
uncontrolledViewState.longitude,
|
|
1078
|
+
uncontrolledViewState.zoom
|
|
1079
|
+
]);
|
|
1059
1080
|
const applyViewState = React3__namespace.useCallback(
|
|
1060
1081
|
(nextState) => {
|
|
1061
1082
|
if (!isControlledViewState) {
|
|
@@ -1094,7 +1115,13 @@ function GeoMap({
|
|
|
1094
1115
|
setSelection({ type: "none" });
|
|
1095
1116
|
onSelectionChange?.({ type: "none" });
|
|
1096
1117
|
}
|
|
1097
|
-
}, [
|
|
1118
|
+
}, [
|
|
1119
|
+
// Use primitive values to avoid object reference issues
|
|
1120
|
+
selection.type,
|
|
1121
|
+
selection.markerId,
|
|
1122
|
+
selectedMarker?.id,
|
|
1123
|
+
onSelectionChange
|
|
1124
|
+
]);
|
|
1098
1125
|
const emitSelectionChange = React3__namespace.useCallback(
|
|
1099
1126
|
(nextSelection) => {
|
|
1100
1127
|
if (nextSelection.type === "none") {
|
|
@@ -1389,7 +1416,7 @@ function GeoMap({
|
|
|
1389
1416
|
{
|
|
1390
1417
|
ref: containerRef,
|
|
1391
1418
|
className: cn(
|
|
1392
|
-
"relative
|
|
1419
|
+
"relative",
|
|
1393
1420
|
// Remove overflow-hidden from outer container to allow panel to overflow
|
|
1394
1421
|
className
|
|
1395
1422
|
),
|
|
@@ -1404,7 +1431,7 @@ function GeoMap({
|
|
|
1404
1431
|
"div",
|
|
1405
1432
|
{
|
|
1406
1433
|
className: cn(
|
|
1407
|
-
"w-full
|
|
1434
|
+
"w-full",
|
|
1408
1435
|
// Only apply default height class if mapWrapperClassName not provided
|
|
1409
1436
|
!mapWrapperClassName && `h-[${calculatedHeight}px]`,
|
|
1410
1437
|
mapWrapperClassName
|