@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/index.cjs CHANGED
@@ -861,8 +861,9 @@ function MarkerActions({ actions }) {
861
861
  ...rest
862
862
  } = action;
863
863
  const buttonStyles = cn(
864
- "inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-colors",
865
- variant === "outline" ? "border border-border bg-background hover:bg-muted" : "bg-primary text-primary-foreground hover:bg-primary/90",
864
+ "gap-2 px-4 py-2 rounded-md font-medium transition-colors duration-500",
865
+ "flex justify-center items-center",
866
+ 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",
866
867
  size === "sm" && "text-sm px-3 py-1.5",
867
868
  size === "icon" && "p-2",
868
869
  actionClassName
@@ -966,7 +967,7 @@ function MarkerMediaCarousel({
966
967
  children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { name: "lucide/arrow-right", size: 18 })
967
968
  }
968
969
  ),
969
- /* @__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(
970
+ /* @__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(
970
971
  "button",
971
972
  {
972
973
  type: "button",
@@ -1195,24 +1196,44 @@ function GeoMap({
1195
1196
  longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
1196
1197
  zoom: defaultViewState?.zoom ?? calculatedZoom
1197
1198
  });
1198
- const [dynamicPanelPosition, setDynamicPanelPosition] = React3__namespace.useState(
1199
- panelPosition
1199
+ const [dynamicPanelPosition, setDynamicPanelPosition] = React3__namespace.useState(panelPosition);
1200
+ const viewStateRef = React3__namespace.useRef(
1201
+ uncontrolledViewState
1200
1202
  );
1201
- const viewStateRef = React3__namespace.useRef(uncontrolledViewState);
1202
1203
  React3__namespace.useEffect(() => {
1203
1204
  if (!viewState && !defaultViewState) {
1204
- setUncontrolledViewState({
1205
- latitude: firstCoordinate.latitude,
1206
- longitude: firstCoordinate.longitude,
1207
- zoom: calculatedZoom
1205
+ setUncontrolledViewState((prev) => {
1206
+ if (prev.latitude === firstCoordinate.latitude && prev.longitude === firstCoordinate.longitude && prev.zoom === calculatedZoom) {
1207
+ return prev;
1208
+ }
1209
+ return {
1210
+ latitude: firstCoordinate.latitude,
1211
+ longitude: firstCoordinate.longitude,
1212
+ zoom: calculatedZoom
1213
+ };
1208
1214
  });
1209
1215
  }
1210
- }, [firstCoordinate, calculatedZoom, viewState, defaultViewState]);
1216
+ }, [
1217
+ // Use primitive values instead of objects to avoid reference changes
1218
+ firstCoordinate.latitude,
1219
+ firstCoordinate.longitude,
1220
+ calculatedZoom,
1221
+ viewState,
1222
+ defaultViewState
1223
+ ]);
1211
1224
  const isControlledViewState = viewState !== void 0;
1212
1225
  const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
1213
1226
  React3__namespace.useEffect(() => {
1214
1227
  viewStateRef.current = resolvedViewState || uncontrolledViewState;
1215
- }, [resolvedViewState, uncontrolledViewState]);
1228
+ }, [
1229
+ // Use primitive values to avoid reference changes
1230
+ resolvedViewState?.latitude,
1231
+ resolvedViewState?.longitude,
1232
+ resolvedViewState?.zoom,
1233
+ uncontrolledViewState.latitude,
1234
+ uncontrolledViewState.longitude,
1235
+ uncontrolledViewState.zoom
1236
+ ]);
1216
1237
  const applyViewState = React3__namespace.useCallback(
1217
1238
  (nextState) => {
1218
1239
  if (!isControlledViewState) {
@@ -1251,7 +1272,13 @@ function GeoMap({
1251
1272
  setSelection({ type: "none" });
1252
1273
  onSelectionChange?.({ type: "none" });
1253
1274
  }
1254
- }, [onSelectionChange, selectedMarker, selection]);
1275
+ }, [
1276
+ // Use primitive values to avoid object reference issues
1277
+ selection.type,
1278
+ selection.markerId,
1279
+ selectedMarker?.id,
1280
+ onSelectionChange
1281
+ ]);
1255
1282
  const emitSelectionChange = React3__namespace.useCallback(
1256
1283
  (nextSelection) => {
1257
1284
  if (nextSelection.type === "none") {
@@ -1546,7 +1573,7 @@ function GeoMap({
1546
1573
  {
1547
1574
  ref: containerRef,
1548
1575
  className: cn(
1549
- "relative rounded-2xl border border-border bg-background",
1576
+ "relative",
1550
1577
  // Remove overflow-hidden from outer container to allow panel to overflow
1551
1578
  className
1552
1579
  ),
@@ -1561,7 +1588,7 @@ function GeoMap({
1561
1588
  "div",
1562
1589
  {
1563
1590
  className: cn(
1564
- "w-full rounded-2xl",
1591
+ "w-full",
1565
1592
  // Only apply default height class if mapWrapperClassName not provided
1566
1593
  !mapWrapperClassName && `h-[${calculatedHeight}px]`,
1567
1594
  mapWrapperClassName