@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.
@@ -683,8 +683,9 @@ function MarkerActions({ actions }) {
683
683
  ...rest
684
684
  } = action;
685
685
  const buttonStyles = cn(
686
- "inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium transition-colors",
687
- variant === "outline" ? "border border-border bg-background hover:bg-muted" : "bg-primary text-primary-foreground hover:bg-primary/90",
686
+ "gap-2 px-4 py-2 rounded-md font-medium transition-colors duration-500",
687
+ "flex justify-center items-center",
688
+ 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",
688
689
  size === "sm" && "text-sm px-3 py-1.5",
689
690
  size === "icon" && "p-2",
690
691
  actionClassName
@@ -788,7 +789,7 @@ function MarkerMediaCarousel({
788
789
  children: /* @__PURE__ */ jsx(IconComponent, { name: "lucide/arrow-right", size: 18 })
789
790
  }
790
791
  ),
791
- /* @__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(
792
+ /* @__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(
792
793
  "button",
793
794
  {
794
795
  type: "button",
@@ -1017,24 +1018,44 @@ function GeoMap({
1017
1018
  longitude: defaultViewState?.longitude ?? firstCoordinate.longitude,
1018
1019
  zoom: defaultViewState?.zoom ?? calculatedZoom
1019
1020
  });
1020
- const [dynamicPanelPosition, setDynamicPanelPosition] = React3.useState(
1021
- panelPosition
1021
+ const [dynamicPanelPosition, setDynamicPanelPosition] = React3.useState(panelPosition);
1022
+ const viewStateRef = React3.useRef(
1023
+ uncontrolledViewState
1022
1024
  );
1023
- const viewStateRef = React3.useRef(uncontrolledViewState);
1024
1025
  React3.useEffect(() => {
1025
1026
  if (!viewState && !defaultViewState) {
1026
- setUncontrolledViewState({
1027
- latitude: firstCoordinate.latitude,
1028
- longitude: firstCoordinate.longitude,
1029
- zoom: calculatedZoom
1027
+ setUncontrolledViewState((prev) => {
1028
+ if (prev.latitude === firstCoordinate.latitude && prev.longitude === firstCoordinate.longitude && prev.zoom === calculatedZoom) {
1029
+ return prev;
1030
+ }
1031
+ return {
1032
+ latitude: firstCoordinate.latitude,
1033
+ longitude: firstCoordinate.longitude,
1034
+ zoom: calculatedZoom
1035
+ };
1030
1036
  });
1031
1037
  }
1032
- }, [firstCoordinate, calculatedZoom, viewState, defaultViewState]);
1038
+ }, [
1039
+ // Use primitive values instead of objects to avoid reference changes
1040
+ firstCoordinate.latitude,
1041
+ firstCoordinate.longitude,
1042
+ calculatedZoom,
1043
+ viewState,
1044
+ defaultViewState
1045
+ ]);
1033
1046
  const isControlledViewState = viewState !== void 0;
1034
1047
  const resolvedViewState = isControlledViewState ? viewState : uncontrolledViewState;
1035
1048
  React3.useEffect(() => {
1036
1049
  viewStateRef.current = resolvedViewState || uncontrolledViewState;
1037
- }, [resolvedViewState, uncontrolledViewState]);
1050
+ }, [
1051
+ // Use primitive values to avoid reference changes
1052
+ resolvedViewState?.latitude,
1053
+ resolvedViewState?.longitude,
1054
+ resolvedViewState?.zoom,
1055
+ uncontrolledViewState.latitude,
1056
+ uncontrolledViewState.longitude,
1057
+ uncontrolledViewState.zoom
1058
+ ]);
1038
1059
  const applyViewState = React3.useCallback(
1039
1060
  (nextState) => {
1040
1061
  if (!isControlledViewState) {
@@ -1073,7 +1094,13 @@ function GeoMap({
1073
1094
  setSelection({ type: "none" });
1074
1095
  onSelectionChange?.({ type: "none" });
1075
1096
  }
1076
- }, [onSelectionChange, selectedMarker, selection]);
1097
+ }, [
1098
+ // Use primitive values to avoid object reference issues
1099
+ selection.type,
1100
+ selection.markerId,
1101
+ selectedMarker?.id,
1102
+ onSelectionChange
1103
+ ]);
1077
1104
  const emitSelectionChange = React3.useCallback(
1078
1105
  (nextSelection) => {
1079
1106
  if (nextSelection.type === "none") {
@@ -1368,7 +1395,7 @@ function GeoMap({
1368
1395
  {
1369
1396
  ref: containerRef,
1370
1397
  className: cn(
1371
- "relative rounded-2xl border border-border bg-background",
1398
+ "relative",
1372
1399
  // Remove overflow-hidden from outer container to allow panel to overflow
1373
1400
  className
1374
1401
  ),
@@ -1383,7 +1410,7 @@ function GeoMap({
1383
1410
  "div",
1384
1411
  {
1385
1412
  className: cn(
1386
- "w-full rounded-2xl",
1413
+ "w-full",
1387
1414
  // Only apply default height class if mapWrapperClassName not provided
1388
1415
  !mapWrapperClassName && `h-[${calculatedHeight}px]`,
1389
1416
  mapWrapperClassName