@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.js CHANGED
@@ -840,8 +840,9 @@ function MarkerActions({ actions }) {
840
840
  ...rest
841
841
  } = action;
842
842
  const buttonStyles = cn(
843
- "inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-colors",
844
- variant === "outline" ? "border border-border bg-background hover:bg-muted" : "bg-primary text-primary-foreground hover:bg-primary/90",
843
+ "gap-2 px-4 py-2 rounded-md font-medium transition-colors duration-500",
844
+ "flex justify-center items-center",
845
+ 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",
845
846
  size === "sm" && "text-sm px-3 py-1.5",
846
847
  size === "icon" && "p-2",
847
848
  actionClassName
@@ -945,7 +946,7 @@ function MarkerMediaCarousel({
945
946
  children: /* @__PURE__ */ jsx(IconComponent, { name: "lucide/arrow-right", size: 18 })
946
947
  }
947
948
  ),
948
- /* @__PURE__ */ 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__ */ jsx(
949
+ /* @__PURE__ */ 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__ */ jsx(
949
950
  "button",
950
951
  {
951
952
  type: "button",
@@ -1174,24 +1175,44 @@ function GeoMap({
1174
1175
  longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
1175
1176
  zoom: defaultViewState?.zoom ?? calculatedZoom
1176
1177
  });
1177
- const [dynamicPanelPosition, setDynamicPanelPosition] = React3.useState(
1178
- panelPosition
1178
+ const [dynamicPanelPosition, setDynamicPanelPosition] = React3.useState(panelPosition);
1179
+ const viewStateRef = React3.useRef(
1180
+ uncontrolledViewState
1179
1181
  );
1180
- const viewStateRef = React3.useRef(uncontrolledViewState);
1181
1182
  React3.useEffect(() => {
1182
1183
  if (!viewState && !defaultViewState) {
1183
- setUncontrolledViewState({
1184
- latitude: firstCoordinate.latitude,
1185
- longitude: firstCoordinate.longitude,
1186
- zoom: calculatedZoom
1184
+ setUncontrolledViewState((prev) => {
1185
+ if (prev.latitude === firstCoordinate.latitude && prev.longitude === firstCoordinate.longitude && prev.zoom === calculatedZoom) {
1186
+ return prev;
1187
+ }
1188
+ return {
1189
+ latitude: firstCoordinate.latitude,
1190
+ longitude: firstCoordinate.longitude,
1191
+ zoom: calculatedZoom
1192
+ };
1187
1193
  });
1188
1194
  }
1189
- }, [firstCoordinate, calculatedZoom, viewState, defaultViewState]);
1195
+ }, [
1196
+ // Use primitive values instead of objects to avoid reference changes
1197
+ firstCoordinate.latitude,
1198
+ firstCoordinate.longitude,
1199
+ calculatedZoom,
1200
+ viewState,
1201
+ defaultViewState
1202
+ ]);
1190
1203
  const isControlledViewState = viewState !== void 0;
1191
1204
  const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
1192
1205
  React3.useEffect(() => {
1193
1206
  viewStateRef.current = resolvedViewState || uncontrolledViewState;
1194
- }, [resolvedViewState, uncontrolledViewState]);
1207
+ }, [
1208
+ // Use primitive values to avoid reference changes
1209
+ resolvedViewState?.latitude,
1210
+ resolvedViewState?.longitude,
1211
+ resolvedViewState?.zoom,
1212
+ uncontrolledViewState.latitude,
1213
+ uncontrolledViewState.longitude,
1214
+ uncontrolledViewState.zoom
1215
+ ]);
1195
1216
  const applyViewState = React3.useCallback(
1196
1217
  (nextState) => {
1197
1218
  if (!isControlledViewState) {
@@ -1230,7 +1251,13 @@ function GeoMap({
1230
1251
  setSelection({ type: "none" });
1231
1252
  onSelectionChange?.({ type: "none" });
1232
1253
  }
1233
- }, [onSelectionChange, selectedMarker, selection]);
1254
+ }, [
1255
+ // Use primitive values to avoid object reference issues
1256
+ selection.type,
1257
+ selection.markerId,
1258
+ selectedMarker?.id,
1259
+ onSelectionChange
1260
+ ]);
1234
1261
  const emitSelectionChange = React3.useCallback(
1235
1262
  (nextSelection) => {
1236
1263
  if (nextSelection.type === "none") {
@@ -1525,7 +1552,7 @@ function GeoMap({
1525
1552
  {
1526
1553
  ref: containerRef,
1527
1554
  className: cn(
1528
- "relative rounded-2xl border border-border bg-background",
1555
+ "relative",
1529
1556
  // Remove overflow-hidden from outer container to allow panel to overflow
1530
1557
  className
1531
1558
  ),
@@ -1540,7 +1567,7 @@ function GeoMap({
1540
1567
  "div",
1541
1568
  {
1542
1569
  className: cn(
1543
- "w-full rounded-2xl",
1570
+ "w-full",
1544
1571
  // Only apply default height class if mapWrapperClassName not provided
1545
1572
  !mapWrapperClassName && `h-[${calculatedHeight}px]`,
1546
1573
  mapWrapperClassName