@datatechsolutions/ui 2.10.2 → 2.10.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.
@@ -12267,15 +12267,32 @@ function GeoMapCanvasInner({
12267
12267
  const hasAnyActiveFilter = React12.useMemo(() => {
12268
12268
  return regionGroups.some((regionData) => isRegionActive?.(regionData.code));
12269
12269
  }, [regionGroups, isRegionActive]);
12270
- const effectiveWidth = projectionType === "albersUsa" ? ALBERS_WIDTH : VIEWBOX_WIDTH;
12271
- const effectiveHeight = projectionType === "albersUsa" ? ALBERS_HEIGHT : VIEWBOX_HEIGHT;
12270
+ const featureBounds = React12.useMemo(() => {
12271
+ if (!pathGenerator || !geoData) return null;
12272
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
12273
+ for (const feature of geoData.features) {
12274
+ const bounds = pathGenerator.bounds(feature);
12275
+ if (!bounds || !isFinite(bounds[0][0])) continue;
12276
+ minX = Math.min(minX, bounds[0][0]);
12277
+ minY = Math.min(minY, bounds[0][1]);
12278
+ maxX = Math.max(maxX, bounds[1][0]);
12279
+ maxY = Math.max(maxY, bounds[1][1]);
12280
+ }
12281
+ if (!isFinite(minX)) return null;
12282
+ const pad = 15;
12283
+ return { x: minX - pad, y: minY - pad, width: maxX - minX + pad * 2, height: maxY - minY + pad * 2 };
12284
+ }, [pathGenerator, geoData]);
12285
+ const effectiveWidth = featureBounds?.width ?? (projectionType === "albersUsa" ? ALBERS_WIDTH : VIEWBOX_WIDTH);
12286
+ const effectiveHeight = featureBounds?.height ?? (projectionType === "albersUsa" ? ALBERS_HEIGHT : VIEWBOX_HEIGHT);
12287
+ const baseX = featureBounds?.x ?? 0;
12288
+ const baseY = featureBounds?.y ?? 0;
12272
12289
  const viewBoxParts = React12.useMemo(() => {
12273
12290
  const width = effectiveWidth / zoom;
12274
12291
  const height = effectiveHeight / zoom;
12275
- const x2 = (effectiveWidth - width) / 2 - panOffset[0];
12276
- const y2 = (effectiveHeight - height) / 2 - panOffset[1];
12292
+ const x2 = baseX + (effectiveWidth - width) / 2 - panOffset[0];
12293
+ const y2 = baseY + (effectiveHeight - height) / 2 - panOffset[1];
12277
12294
  return { x: x2, y: y2, width, height };
12278
- }, [zoom, panOffset, effectiveWidth, effectiveHeight]);
12295
+ }, [zoom, panOffset, effectiveWidth, effectiveHeight, baseX, baseY]);
12279
12296
  const viewBox = `${viewBoxParts.x} ${viewBoxParts.y} ${viewBoxParts.width} ${viewBoxParts.height}`;
12280
12297
  return /* @__PURE__ */ jsxRuntime.jsx(
12281
12298
  "div",
@@ -12288,7 +12305,6 @@ function GeoMapCanvasInner({
12288
12305
  {
12289
12306
  ref: svgRef,
12290
12307
  viewBox,
12291
- preserveAspectRatio: "xMidYMid slice",
12292
12308
  className: "w-full h-full cursor-grab active:cursor-grabbing",
12293
12309
  "aria-label": ariaLabel,
12294
12310
  style: { touchAction: "none", background: "transparent" },
@@ -12572,9 +12588,9 @@ function InteractiveGeoMapInner({
12572
12588
  "div",
12573
12589
  {
12574
12590
  ref,
12575
- className: `space-y-4 ${className ?? ""}`,
12591
+ className: `space-y-4 h-full ${className ?? ""}`,
12576
12592
  "data-testid": "interactive-geo-map-container",
12577
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
12593
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-full", children: [
12578
12594
  /* @__PURE__ */ jsxRuntime.jsx(
12579
12595
  GeoMapCanvas,
12580
12596
  {
@@ -23903,5 +23919,5 @@ exports.useGeoMapState = useGeoMapState;
23903
23919
  exports.useNotifications = useNotifications;
23904
23920
  exports.usePlatformShellStore = usePlatformShellStore;
23905
23921
  exports.usePullToRefresh = usePullToRefresh;
23906
- //# sourceMappingURL=chunk-WMPZ6UTF.js.map
23907
- //# sourceMappingURL=chunk-WMPZ6UTF.js.map
23922
+ //# sourceMappingURL=chunk-MRXTY7XN.js.map
23923
+ //# sourceMappingURL=chunk-MRXTY7XN.js.map