@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
|
@@ -823,8 +823,9 @@ function MarkerActions({ actions }) {
|
|
|
823
823
|
...rest
|
|
824
824
|
} = action;
|
|
825
825
|
const buttonStyles = cn(
|
|
826
|
-
"
|
|
827
|
-
|
|
826
|
+
"gap-2 px-4 py-2 rounded-md font-medium transition-colors duration-500",
|
|
827
|
+
"flex justify-center items-center",
|
|
828
|
+
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",
|
|
828
829
|
size === "sm" && "text-sm px-3 py-1.5",
|
|
829
830
|
size === "icon" && "p-2",
|
|
830
831
|
actionClassName
|
|
@@ -928,7 +929,7 @@ function MarkerMediaCarousel({
|
|
|
928
929
|
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { name: "lucide/arrow-right", size: 18 })
|
|
929
930
|
}
|
|
930
931
|
),
|
|
931
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-2 left-1/2 flex -translate-x-1/2 items-center gap-1.5 z-
|
|
932
|
+
/* @__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(
|
|
932
933
|
"button",
|
|
933
934
|
{
|
|
934
935
|
type: "button",
|
|
@@ -1157,24 +1158,44 @@ function GeoMap({
|
|
|
1157
1158
|
longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
|
|
1158
1159
|
zoom: defaultViewState?.zoom ?? calculatedZoom
|
|
1159
1160
|
});
|
|
1160
|
-
const [dynamicPanelPosition, setDynamicPanelPosition] = React3__namespace.useState(
|
|
1161
|
-
|
|
1161
|
+
const [dynamicPanelPosition, setDynamicPanelPosition] = React3__namespace.useState(panelPosition);
|
|
1162
|
+
const viewStateRef = React3__namespace.useRef(
|
|
1163
|
+
uncontrolledViewState
|
|
1162
1164
|
);
|
|
1163
|
-
const viewStateRef = React3__namespace.useRef(uncontrolledViewState);
|
|
1164
1165
|
React3__namespace.useEffect(() => {
|
|
1165
1166
|
if (!viewState && !defaultViewState) {
|
|
1166
|
-
setUncontrolledViewState({
|
|
1167
|
-
latitude
|
|
1168
|
-
|
|
1169
|
-
|
|
1167
|
+
setUncontrolledViewState((prev) => {
|
|
1168
|
+
if (prev.latitude === firstCoordinate.latitude && prev.longitude === firstCoordinate.longitude && prev.zoom === calculatedZoom) {
|
|
1169
|
+
return prev;
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
latitude: firstCoordinate.latitude,
|
|
1173
|
+
longitude: firstCoordinate.longitude,
|
|
1174
|
+
zoom: calculatedZoom
|
|
1175
|
+
};
|
|
1170
1176
|
});
|
|
1171
1177
|
}
|
|
1172
|
-
}, [
|
|
1178
|
+
}, [
|
|
1179
|
+
// Use primitive values instead of objects to avoid reference changes
|
|
1180
|
+
firstCoordinate.latitude,
|
|
1181
|
+
firstCoordinate.longitude,
|
|
1182
|
+
calculatedZoom,
|
|
1183
|
+
viewState,
|
|
1184
|
+
defaultViewState
|
|
1185
|
+
]);
|
|
1173
1186
|
const isControlledViewState = viewState !== void 0;
|
|
1174
1187
|
const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
|
|
1175
1188
|
React3__namespace.useEffect(() => {
|
|
1176
1189
|
viewStateRef.current = resolvedViewState || uncontrolledViewState;
|
|
1177
|
-
}, [
|
|
1190
|
+
}, [
|
|
1191
|
+
// Use primitive values to avoid reference changes
|
|
1192
|
+
resolvedViewState?.latitude,
|
|
1193
|
+
resolvedViewState?.longitude,
|
|
1194
|
+
resolvedViewState?.zoom,
|
|
1195
|
+
uncontrolledViewState.latitude,
|
|
1196
|
+
uncontrolledViewState.longitude,
|
|
1197
|
+
uncontrolledViewState.zoom
|
|
1198
|
+
]);
|
|
1178
1199
|
const applyViewState = React3__namespace.useCallback(
|
|
1179
1200
|
(nextState) => {
|
|
1180
1201
|
if (!isControlledViewState) {
|
|
@@ -1213,7 +1234,13 @@ function GeoMap({
|
|
|
1213
1234
|
setSelection({ type: "none" });
|
|
1214
1235
|
onSelectionChange?.({ type: "none" });
|
|
1215
1236
|
}
|
|
1216
|
-
}, [
|
|
1237
|
+
}, [
|
|
1238
|
+
// Use primitive values to avoid object reference issues
|
|
1239
|
+
selection.type,
|
|
1240
|
+
selection.markerId,
|
|
1241
|
+
selectedMarker?.id,
|
|
1242
|
+
onSelectionChange
|
|
1243
|
+
]);
|
|
1217
1244
|
const emitSelectionChange = React3__namespace.useCallback(
|
|
1218
1245
|
(nextSelection) => {
|
|
1219
1246
|
if (nextSelection.type === "none") {
|
|
@@ -1508,7 +1535,7 @@ function GeoMap({
|
|
|
1508
1535
|
{
|
|
1509
1536
|
ref: containerRef,
|
|
1510
1537
|
className: cn(
|
|
1511
|
-
"relative
|
|
1538
|
+
"relative",
|
|
1512
1539
|
// Remove overflow-hidden from outer container to allow panel to overflow
|
|
1513
1540
|
className
|
|
1514
1541
|
),
|
|
@@ -1523,7 +1550,7 @@ function GeoMap({
|
|
|
1523
1550
|
"div",
|
|
1524
1551
|
{
|
|
1525
1552
|
className: cn(
|
|
1526
|
-
"w-full
|
|
1553
|
+
"w-full",
|
|
1527
1554
|
// Only apply default height class if mapWrapperClassName not provided
|
|
1528
1555
|
!mapWrapperClassName && `h-[${calculatedHeight}px]`,
|
|
1529
1556
|
mapWrapperClassName
|