@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.
@@ -802,8 +802,9 @@ function MarkerActions({ actions }) {
802
802
  ...rest
803
803
  } = action;
804
804
  const buttonStyles = cn(
805
- "inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-colors",
806
- variant === "outline" ? "border border-border bg-background hover:bg-muted" : "bg-primary text-primary-foreground hover:bg-primary/90",
805
+ "gap-2 px-4 py-2 rounded-md font-medium transition-colors duration-500",
806
+ "flex justify-center items-center",
807
+ 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",
807
808
  size === "sm" && "text-sm px-3 py-1.5",
808
809
  size === "icon" && "p-2",
809
810
  actionClassName
@@ -907,7 +908,7 @@ function MarkerMediaCarousel({
907
908
  children: /* @__PURE__ */ jsx(IconComponent, { name: "lucide/arrow-right", size: 18 })
908
909
  }
909
910
  ),
910
- /* @__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(
911
+ /* @__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(
911
912
  "button",
912
913
  {
913
914
  type: "button",
@@ -1136,24 +1137,44 @@ function GeoMap({
1136
1137
  longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
1137
1138
  zoom: defaultViewState?.zoom ?? calculatedZoom
1138
1139
  });
1139
- const [dynamicPanelPosition, setDynamicPanelPosition] = React3.useState(
1140
- panelPosition
1140
+ const [dynamicPanelPosition, setDynamicPanelPosition] = React3.useState(panelPosition);
1141
+ const viewStateRef = React3.useRef(
1142
+ uncontrolledViewState
1141
1143
  );
1142
- const viewStateRef = React3.useRef(uncontrolledViewState);
1143
1144
  React3.useEffect(() => {
1144
1145
  if (!viewState && !defaultViewState) {
1145
- setUncontrolledViewState({
1146
- latitude: firstCoordinate.latitude,
1147
- longitude: firstCoordinate.longitude,
1148
- zoom: calculatedZoom
1146
+ setUncontrolledViewState((prev) => {
1147
+ if (prev.latitude === firstCoordinate.latitude && prev.longitude === firstCoordinate.longitude && prev.zoom === calculatedZoom) {
1148
+ return prev;
1149
+ }
1150
+ return {
1151
+ latitude: firstCoordinate.latitude,
1152
+ longitude: firstCoordinate.longitude,
1153
+ zoom: calculatedZoom
1154
+ };
1149
1155
  });
1150
1156
  }
1151
- }, [firstCoordinate, calculatedZoom, viewState, defaultViewState]);
1157
+ }, [
1158
+ // Use primitive values instead of objects to avoid reference changes
1159
+ firstCoordinate.latitude,
1160
+ firstCoordinate.longitude,
1161
+ calculatedZoom,
1162
+ viewState,
1163
+ defaultViewState
1164
+ ]);
1152
1165
  const isControlledViewState = viewState !== void 0;
1153
1166
  const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
1154
1167
  React3.useEffect(() => {
1155
1168
  viewStateRef.current = resolvedViewState || uncontrolledViewState;
1156
- }, [resolvedViewState, uncontrolledViewState]);
1169
+ }, [
1170
+ // Use primitive values to avoid reference changes
1171
+ resolvedViewState?.latitude,
1172
+ resolvedViewState?.longitude,
1173
+ resolvedViewState?.zoom,
1174
+ uncontrolledViewState.latitude,
1175
+ uncontrolledViewState.longitude,
1176
+ uncontrolledViewState.zoom
1177
+ ]);
1157
1178
  const applyViewState = React3.useCallback(
1158
1179
  (nextState) => {
1159
1180
  if (!isControlledViewState) {
@@ -1192,7 +1213,13 @@ function GeoMap({
1192
1213
  setSelection({ type: "none" });
1193
1214
  onSelectionChange?.({ type: "none" });
1194
1215
  }
1195
- }, [onSelectionChange, selectedMarker, selection]);
1216
+ }, [
1217
+ // Use primitive values to avoid object reference issues
1218
+ selection.type,
1219
+ selection.markerId,
1220
+ selectedMarker?.id,
1221
+ onSelectionChange
1222
+ ]);
1196
1223
  const emitSelectionChange = React3.useCallback(
1197
1224
  (nextSelection) => {
1198
1225
  if (nextSelection.type === "none") {
@@ -1487,7 +1514,7 @@ function GeoMap({
1487
1514
  {
1488
1515
  ref: containerRef,
1489
1516
  className: cn(
1490
- "relative rounded-2xl border border-border bg-background",
1517
+ "relative",
1491
1518
  // Remove overflow-hidden from outer container to allow panel to overflow
1492
1519
  className
1493
1520
  ),
@@ -1502,7 +1529,7 @@ function GeoMap({
1502
1529
  "div",
1503
1530
  {
1504
1531
  className: cn(
1505
- "w-full rounded-2xl",
1532
+ "w-full",
1506
1533
  // Only apply default height class if mapWrapperClassName not provided
1507
1534
  !mapWrapperClassName && `h-[${calculatedHeight}px]`,
1508
1535
  mapWrapperClassName