@loafmarkets/ui 0.1.426 → 0.1.427

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.mjs CHANGED
@@ -10797,6 +10797,7 @@ function GalleryMapSection({
10797
10797
  const [showVideo, setShowVideo] = useState(false);
10798
10798
  const [autoPlaying, setAutoPlaying] = useState(autoPlay);
10799
10799
  const [showFullMap, setShowFullMap] = useState(false);
10800
+ const [fullMapMountedFor, setFullMapMountedFor] = useState(null);
10800
10801
  const [showFullVideo, setShowFullVideo] = useState(false);
10801
10802
  const isMobile = useMaxWidth(768);
10802
10803
  const resolvedMapUrl = mapUrl ?? (tokenName ? `/map/${tokenName}?embed=true&zoom=14&hideOthers=true` : "about:blank");
@@ -10914,7 +10915,10 @@ function GalleryMapSection({
10914
10915
  ] }),
10915
10916
  /* @__PURE__ */ jsxs(MapHeaderRight, { children: [
10916
10917
  /* @__PURE__ */ jsx("span", { children: propertyLocation }),
10917
- /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => setShowFullMap(true), children: [
10918
+ /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
10919
+ setFullMapMountedFor(resolvedMapUrl);
10920
+ setShowFullMap(true);
10921
+ }, children: [
10918
10922
  /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { width: 14, height: 14 }, children: /* @__PURE__ */ jsx("path", { d: "M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3" }) }),
10919
10923
  "Full Screen"
10920
10924
  ] })
@@ -10963,7 +10967,7 @@ function GalleryMapSection({
10963
10967
  ] }),
10964
10968
  /* @__PURE__ */ jsx(SuburbDesc, { children: "One of Sydney's most prestigious harbourside suburbs, consistently ranked among Australia's highest-value residential markets. Strong capital growth driven by limited supply, heritage conservation overlays, and international buyer demand." })
10965
10969
  ] }),
10966
- showFullMap && !hideMap && /* @__PURE__ */ jsx(FullMapPopup, { onClose: () => setShowFullMap(false), mapUrl: resolvedMapUrl }),
10970
+ fullMapMountedFor === resolvedMapUrl && !hideMap && /* @__PURE__ */ jsx(FullMapPopup, { hidden: !showFullMap, onClose: () => setShowFullMap(false), mapUrl: resolvedMapUrl }),
10967
10971
  showFullVideo && videoUrl && /* @__PURE__ */ jsxs(FullVideoOverlay, { onClick: () => setShowFullVideo(false), children: [
10968
10972
  /* @__PURE__ */ jsx(FullVideoClose, { onClick: () => setShowFullVideo(false), "aria-label": "Close video", children: "\u2715" }),
10969
10973
  /* @__PURE__ */ jsx(
@@ -11093,21 +11097,23 @@ function StackedGallery({ images, onPhotoClick }) {
11093
11097
  }) })
11094
11098
  ] });
11095
11099
  }
11096
- function FullMapPopup({ onClose, mapUrl }) {
11100
+ function FullMapPopup({ onClose, mapUrl, hidden = false }) {
11097
11101
  useEffect(() => {
11102
+ if (hidden) return;
11098
11103
  const handleEsc = (e) => {
11099
11104
  if (e.key === "Escape") onClose();
11100
11105
  };
11101
11106
  window.addEventListener("keydown", handleEsc);
11102
11107
  return () => window.removeEventListener("keydown", handleEsc);
11103
- }, [onClose]);
11108
+ }, [onClose, hidden]);
11104
11109
  useEffect(() => {
11110
+ if (hidden) return;
11105
11111
  const handleMessage = (e) => {
11106
11112
  if (e.data === "loaf:close-embed") onClose();
11107
11113
  };
11108
11114
  window.addEventListener("message", handleMessage);
11109
11115
  return () => window.removeEventListener("message", handleMessage);
11110
- }, [onClose]);
11116
+ }, [onClose, hidden]);
11111
11117
  const iframeRef = useCallback((node) => {
11112
11118
  if (!node) return;
11113
11119
  const handleLoad = () => {
@@ -11123,7 +11129,7 @@ function FullMapPopup({ onClose, mapUrl }) {
11123
11129
  };
11124
11130
  node.addEventListener("load", handleLoad);
11125
11131
  }, [onClose]);
11126
- return /* @__PURE__ */ jsx(FullMapOverlay, { onClick: onClose, children: /* @__PURE__ */ jsxs(FullMapPanel, { onClick: (e) => e.stopPropagation(), children: [
11132
+ return /* @__PURE__ */ jsx(FullMapOverlay, { onClick: onClose, hidden, children: /* @__PURE__ */ jsxs(FullMapPanel, { onClick: (e) => e.stopPropagation(), children: [
11127
11133
  /* @__PURE__ */ jsxs(FullMapHeader, { children: [
11128
11134
  /* @__PURE__ */ jsxs(FullMapTitle, { children: [
11129
11135
  /* @__PURE__ */ jsx(BiMap, {}),
@@ -11419,6 +11425,12 @@ var FullMapOverlay = styled10.div`
11419
11425
  align-items: center;
11420
11426
  justify-content: center;
11421
11427
  backdrop-filter: blur(4px);
11428
+
11429
+ /* Kept mounted between opens (see fullMapMountedFor); \`display: flex\` above would
11430
+ otherwise beat the UA's [hidden] rule. */
11431
+ &[hidden] {
11432
+ display: none;
11433
+ }
11422
11434
  `;
11423
11435
  var FullVideoOverlay = styled10.div`
11424
11436
  position: fixed;